From 2ed90918aa3d39d974de36dc214d9a832e04ada5 Mon Sep 17 00:00:00 2001 From: Xiong Date: Mon, 28 Mar 2022 23:57:38 -0400 Subject: [PATCH 001/113] upgrade cosmos sdk & tendermint --- app/app.go | 723 +++++++++++++++++++++++++++------------ app/encoding.go | 33 ++ app/export.go | 161 ++++++--- app/params/encoding.go | 17 + cmd/stchaind/main_new.go | 24 ++ cmd/stchaind/root.go | 306 +++++++++++++++++ encoding/codec/codec.go | 19 + encoding/config.go | 31 ++ go.mod | 34 +- helpers/antehelper.go | 69 ++-- types/codec.go | 2 +- 11 files changed, 1125 insertions(+), 294 deletions(-) create mode 100644 app/encoding.go create mode 100644 app/params/encoding.go create mode 100644 cmd/stchaind/main_new.go create mode 100644 cmd/stchaind/root.go create mode 100644 encoding/codec/codec.go create mode 100644 encoding/config.go diff --git a/app/app.go b/app/app.go index cc05ad67..baff78bb 100644 --- a/app/app.go +++ b/app/app.go @@ -1,45 +1,103 @@ package app import ( - "encoding/json" "io" + "net/http" "os" - "github.com/stratosnet/stratos-chain/types" + "github.com/gorilla/mux" + "github.com/rakyll/statik/fs" + "github.com/spf13/cast" + abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" tmos "github.com/tendermint/tendermint/libs/os" dbm "github.com/tendermint/tm-db" - bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/simapp" - store "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/capability" + capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/crisis" + crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distr "github.com/cosmos/cosmos-sdk/x/distribution" distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/evidence" + evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" + feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" + feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/mint" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/cosmos-sdk/x/slashing" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/cosmos-sdk/x/upgrade" upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - + upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/ibc-go/v3/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v3/modules/core" + ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + + stratosparams "github.com/stratosnet/stratos-chain/app/params" "github.com/stratosnet/stratos-chain/helpers" "github.com/stratosnet/stratos-chain/x/pot" + pottypes "github.com/stratosnet/stratos-chain/x/pot/types" "github.com/stratosnet/stratos-chain/x/register" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" "github.com/stratosnet/stratos-chain/x/sds" - // this line is used by starport scaffolding # 1 + sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) const ( @@ -53,290 +111,441 @@ var ( auth.AppModuleBasic{}, genutil.AppModuleBasic{}, bank.AppModuleBasic{}, - //capability.AppModuleBasic{}, + capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( - paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler), + paramsclient.ProposalHandler, + distrclient.ProposalHandler, + upgradeclient.ProposalHandler, + upgradeclient.CancelProposalHandler, + ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, - supply.AppModuleBasic{}, - register.AppModuleBasic{}, - pot.AppModuleBasic{}, - sds.AppModuleBasic{}, + ibc.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, - // this line is used by starport scaffolding # 2 + transfer.AppModuleBasic{}, + vesting.AppModuleBasic{}, + // stratos modules + //register.AppModuleBasic{}, + //pot.AppModuleBasic{}, + //sds.AppModuleBasic{}, + //evm.AppModuleBasic{}, ) maccPerms = map[string][]string{ - auth.FeeCollectorName: nil, - distr.ModuleName: nil, - mint.ModuleName: {supply.Minter}, - staking.BondedPoolName: {supply.Burner, supply.Staking}, - staking.NotBondedPoolName: {supply.Burner, supply.Staking}, - gov.ModuleName: {supply.Burner}, - pot.FoundationAccount: nil, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + pot.FoundationAccount: nil, + //evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account } + // module accounts that are allowed to receive tokens - //allowedReceivingModAcc = map[string]bool{ - // distr.ModuleName: true, - //} + allowedReceivingModAcc = map[string]bool{ + distrtypes.ModuleName: true, + pot.FoundationAccount: true, + } ) -func MakeCodec() *codec.Codec { - var cdc = codec.New() - - types.RegisterCodec(cdc) - ModuleBasics.RegisterCodec(cdc) - sdk.RegisterCodec(cdc) - codec.RegisterCrypto(cdc) - - return cdc.Seal() -} - type NewApp struct { - *bam.BaseApp - cdc *codec.Codec + *baseapp.BaseApp - invCheckPeriod uint + appName string - keys map[string]*sdk.KVStoreKey - tKeys map[string]*sdk.TransientStoreKey + cdc *codec.LegacyAmino + appCodec codec.Codec + interfaceRegistry codectypes.InterfaceRegistry - subspaces map[string]params.Subspace + invCheckPeriod uint - accountKeeper auth.AccountKeeper - bankKeeper bank.Keeper - stakingKeeper staking.Keeper - supplyKeeper supply.Keeper - paramsKeeper params.Keeper + // keys to access the substores + keys map[string]*sdk.KVStoreKey + tKeys map[string]*sdk.TransientStoreKey + memKeys map[string]*sdk.MemoryStoreKey + + accountKeeper authkeeper.AccountKeeper + bankKeeper bankkeeper.Keeper + capabilityKeeper *capabilitykeeper.Keeper + stakingKeeper stakingkeeper.Keeper + slashingKeeper slashingkeeper.Keeper + mintKeeper mintkeeper.Keeper + distrKeeper distrkeeper.Keeper + govKeeper govkeeper.Keeper + crisisKeeper crisiskeeper.Keeper + upgradeKeeper upgradekeeper.Keeper + paramsKeeper paramskeeper.Keeper + ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + authzKeeper authzkeeper.Keeper + evidenceKeeper evidencekeeper.Keeper + feeGrantKeeper feegrantkeeper.Keeper + transferKeeper ibctransferkeeper.Keeper + + // make scoped keepers public for test purposes + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + + // stratos keepers registerKeeper register.Keeper potKeeper pot.Keeper sdsKeeper sds.Keeper - govKeeper gov.Keeper - slashingKeeper slashing.Keeper - mintKeeper mint.Keeper - upgradeKeeper upgrade.Keeper - distrKeeper distr.Keeper - crisisKeeper crisis.Keeper - // this line is used by starport scaffolding # 3 - mm *module.Manager + //evmKeeper *evmkeeper.Keeper + // the module manager + mm *module.Manager + // simulation manager sm *module.SimulationManager + // module configurator + configurator module.Configurator } var _ simapp.App = (*NewApp)(nil) func NewInitApp( - logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, - invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp), + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + loadLatest bool, + skipUpgradeHeights map[int64]bool, + homePath string, + invCheckPeriod uint, + encodingConfig stratosparams.EncodingConfig, + appOpts servertypes.AppOptions, + baseAppOptions ...func(*baseapp.BaseApp), ) *NewApp { - cdc := MakeCodec() + appCodec := encodingConfig.Marshaler + cdc := encodingConfig.Amino + interfaceRegistry := encodingConfig.InterfaceRegistry - bApp := bam.NewBaseApp(appName, logger, db, auth.DefaultTxDecoder(cdc), baseAppOptions...) + bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) - bApp.SetAppVersion(version.Version) + bApp.SetVersion(version.Version) + bApp.SetInterfaceRegistry(interfaceRegistry) keys := sdk.NewKVStoreKeys( - bam.MainStoreKey, - auth.StoreKey, - staking.StoreKey, - supply.StoreKey, - params.StoreKey, - gov.StoreKey, - mint.StoreKey, - distr.StoreKey, - slashing.StoreKey, - upgrade.StoreKey, - register.StoreKey, - pot.StoreKey, - sds.StoreKey, - // this line is used by starport scaffolding # 5 + // SDK keys + authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, + minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, + govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, + evidencetypes.StoreKey, capabilitytypes.StoreKey, feegrant.StoreKey, + authzkeeper.StoreKey, + // ibc keys + ibchost.StoreKey, ibctransfertypes.StoreKey, + // stratos keys + register.StoreKey, pot.StoreKey, sds.StoreKey, + //evmtypes.StoreKey, ) + tKeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) + memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + + app := &NewApp{ + BaseApp: bApp, + cdc: cdc, + appCodec: appCodec, + interfaceRegistry: interfaceRegistry, + invCheckPeriod: invCheckPeriod, + keys: keys, + tKeys: tKeys, + memKeys: memKeys, + } - tKeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey) + // init params keeper and subspaces + app.paramsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tKeys[paramstypes.TStoreKey]) + // set the BaseApp's parameter store + bApp.SetParamStore(app.paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) + // add capability keeper and ScopeToModule for ibc module + app.capabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - var app = &NewApp{ - BaseApp: bApp, - cdc: cdc, - invCheckPeriod: invCheckPeriod, - keys: keys, - tKeys: tKeys, - subspaces: make(map[string]params.Subspace), - } + scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedTransferKeeper := app.capabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - // add keepers - app.paramsKeeper = params.NewKeeper(app.cdc, keys[params.StoreKey], tKeys[params.TStoreKey]) - - app.subspaces[auth.ModuleName] = app.paramsKeeper.Subspace(auth.DefaultParamspace) - app.subspaces[bank.ModuleName] = app.paramsKeeper.Subspace(bank.DefaultParamspace) - app.subspaces[staking.ModuleName] = app.paramsKeeper.Subspace(staking.DefaultParamspace) - app.subspaces[mint.ModuleName] = app.paramsKeeper.Subspace(mint.DefaultParamspace) - app.subspaces[distr.ModuleName] = app.paramsKeeper.Subspace(distr.DefaultParamspace).WithKeyTable(distr.ParamKeyTable()) - app.subspaces[slashing.ModuleName] = app.paramsKeeper.Subspace(slashing.DefaultParamspace) - app.subspaces[crisis.ModuleName] = app.paramsKeeper.Subspace(crisis.DefaultParamspace) - app.subspaces[gov.ModuleName] = app.paramsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable()) - app.subspaces[register.ModuleName] = app.paramsKeeper.Subspace(register.DefaultParamSpace) - app.subspaces[pot.ModuleName] = app.paramsKeeper.Subspace(pot.DefaultParamSpace) - app.subspaces[sds.ModuleName] = app.paramsKeeper.Subspace(sds.DefaultParamSpace) - // this line is used by starport scaffolding # 5.1 - - app.accountKeeper = auth.NewAccountKeeper(app.cdc, keys[auth.StoreKey], app.subspaces[auth.ModuleName], auth.ProtoBaseAccount) - - app.bankKeeper = bank.NewBaseKeeper(app.accountKeeper, app.subspaces[bank.ModuleName], app.ModuleAccountAddrs()) - app.supplyKeeper = supply.NewKeeper(app.cdc, keys[supply.StoreKey], app.accountKeeper, app.bankKeeper, maccPerms) - - stakingKeeper := staking.NewKeeper(app.cdc, keys[staking.StoreKey], app.supplyKeeper, app.subspaces[staking.ModuleName]) - app.mintKeeper = mint.NewKeeper(app.cdc, keys[mint.StoreKey], app.subspaces[mint.ModuleName], &stakingKeeper, app.supplyKeeper, auth.FeeCollectorName) - app.distrKeeper = distr.NewKeeper(app.cdc, keys[distr.StoreKey], app.subspaces[distr.ModuleName], &stakingKeeper, app.supplyKeeper, - auth.FeeCollectorName, app.ModuleAccountAddrs()) - app.slashingKeeper = slashing.NewKeeper(app.cdc, keys[slashing.StoreKey], &stakingKeeper, app.subspaces[slashing.ModuleName]) - app.crisisKeeper = crisis.NewKeeper(app.subspaces[crisis.ModuleName], invCheckPeriod, app.supplyKeeper, auth.FeeCollectorName) - app.upgradeKeeper = upgrade.NewKeeper(map[int64]bool{}, keys[upgrade.StoreKey], app.cdc) + // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating + // their scoped modules in `NewApp` with `ScopeToModule` + app.capabilityKeeper.Seal() + app.accountKeeper = authkeeper.NewAccountKeeper( + appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, + ) + app.bankKeeper = bankkeeper.NewBaseKeeper( + appCodec, keys[banktypes.StoreKey], app.accountKeeper, app.GetSubspace(banktypes.ModuleName), app.BlockedAddrs(), + ) + stakingKeeper := stakingkeeper.NewKeeper( + appCodec, keys[stakingtypes.StoreKey], app.accountKeeper, app.bankKeeper, app.GetSubspace(stakingtypes.ModuleName), + ) + app.mintKeeper = mintkeeper.NewKeeper( + appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper, + app.accountKeeper, app.bankKeeper, authtypes.FeeCollectorName, + ) + app.distrKeeper = distrkeeper.NewKeeper( + appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.accountKeeper, app.bankKeeper, + &stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(), + ) + app.slashingKeeper = slashingkeeper.NewKeeper( + appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName), + ) + app.crisisKeeper = crisiskeeper.NewKeeper( + app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.bankKeeper, authtypes.FeeCollectorName, + ) + app.feeGrantKeeper = feegrantkeeper.NewKeeper( + appCodec, keys[feegrant.StoreKey], app.accountKeeper, + ) + app.upgradeKeeper = upgradekeeper.NewKeeper( + skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, + ) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks app.stakingKeeper = *stakingKeeper.SetHooks( - staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks()), + stakingtypes.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks()), + ) + app.authzKeeper = authzkeeper.NewKeeper( + keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter(), ) - // this line is used by starport scaffolding # 4 + // Create IBC Keeper + app.ibcKeeper = ibckeeper.NewKeeper( + appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.stakingKeeper, app.upgradeKeeper, scopedIBCKeeper, + ) // register the proposal types - govRouter := gov.NewRouter() - govRouter.AddRoute(gov.RouterKey, gov.ProposalHandler). - AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). - AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)). - AddRoute(upgrade.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)) - app.govKeeper = gov.NewKeeper( - app.cdc, keys[gov.StoreKey], app.subspaces[gov.ModuleName], app.supplyKeeper, + govRouter := govtypes.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). + AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)). + AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)). + AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)) + + govKeeper := govkeeper.NewKeeper( + appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.accountKeeper, app.bankKeeper, &stakingKeeper, govRouter, ) - app.registerKeeper = register.NewKeeper( - app.cdc, - keys[register.StoreKey], - app.subspaces[register.ModuleName], - app.accountKeeper, - app.bankKeeper, + app.govKeeper = *govKeeper.SetHooks( + govtypes.NewMultiGovHooks( + // register the governance hooks + ), ) - app.potKeeper = pot.NewKeeper( - app.cdc, - keys[pot.StoreKey], - app.subspaces[pot.ModuleName], - auth.FeeCollectorName, - app.bankKeeper, - app.supplyKeeper, - app.accountKeeper, - app.stakingKeeper, - app.registerKeeper, + // Create Transfer Keepers + app.transferKeeper = ibctransferkeeper.NewKeeper( + appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + app.ibcKeeper.ChannelKeeper, app.ibcKeeper.ChannelKeeper, &app.ibcKeeper.PortKeeper, + app.accountKeeper, app.bankKeeper, scopedTransferKeeper, ) + transferModule := transfer.NewAppModule(app.transferKeeper) + transferIBCModule := transfer.NewIBCModule(app.transferKeeper) - app.sdsKeeper = sds.NewKeeper( - app.cdc, - keys[sds.StoreKey], - app.subspaces[sds.ModuleName], - app.bankKeeper, - app.registerKeeper, - app.potKeeper, + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := porttypes.NewRouter() + ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule) + app.ibcKeeper.SetRouter(ibcRouter) + + // create evidence keeper with router + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, keys[evidencetypes.StoreKey], &app.stakingKeeper, app.slashingKeeper, ) + // If evidence needs to be handled for the app, set routes in router here and seal + app.evidenceKeeper = *evidenceKeeper + + // Create Stratos keepers + //app.registerKeeper = register.NewKeeper( + // app.cdc, + // keys[register.StoreKey], + // app.subspaces[register.ModuleName], + // app.accountKeeper, + // app.bankKeeper, + //) + // + //app.potKeeper = pot.NewKeeper( + // app.cdc, + // keys[pot.StoreKey], + // app.subspaces[pot.ModuleName], + // auth.FeeCollectorName, + // app.bankKeeper, + // app.supplyKeeper, + // app.accountKeeper, + // app.stakingKeeper, + // app.registerKeeper, + //) + // + //app.sdsKeeper = sds.NewKeeper( + // app.cdc, + // keys[sds.StoreKey], + // app.subspaces[sds.ModuleName], + // app.bankKeeper, + // app.registerKeeper, + // app.potKeeper, + //) + + /**** Module Options ****/ + + // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment + // we prefer to be more strict in what arguments the modules expect. + var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) app.mm = module.NewManager( - genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx), - auth.NewAppModule(app.accountKeeper), - bank.NewAppModule(app.bankKeeper, app.accountKeeper), - supply.NewAppModule(app.supplyKeeper, app.accountKeeper), - crisis.NewAppModule(&app.crisisKeeper), - gov.NewAppModule(app.govKeeper, app.accountKeeper, app.supplyKeeper), - mint.NewAppModule(app.mintKeeper), - slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper), - distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.supplyKeeper, app.stakingKeeper), - staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper), + genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig), + auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts), + vesting.NewAppModule(app.accountKeeper, app.bankKeeper), + bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper), + capability.NewAppModule(appCodec, *app.capabilityKeeper), + crisis.NewAppModule(&app.crisisKeeper, skipGenesisInvariants), + gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper), + mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper), + slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), + distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), + staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), upgrade.NewAppModule(app.upgradeKeeper), + evidence.NewAppModule(app.evidenceKeeper), + params.NewAppModule(app.paramsKeeper), + feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.feeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), + // ibc modules + ibc.NewAppModule(app.ibcKeeper), + transferModule, + + // Stratos app modules + //register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), + //pot.NewAppModule(app.potKeeper, app.bankKeeper, app.supplyKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), + //sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), + ) - register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), - pot.NewAppModule(app.potKeeper, app.bankKeeper, app.supplyKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), - sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), - // this line is used by starport scaffolding # 6 + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: upgrade module must go first to handle software upgrades. + // NOTE: staking module is required if HistoricalEntries param > 0. + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + app.mm.SetOrderBeginBlockers( + upgradetypes.ModuleName, + capabilitytypes.ModuleName, + //evmtypes.ModuleName, + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + ibchost.ModuleName, + // no-op modules + ibctransfertypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + govtypes.ModuleName, + crisistypes.ModuleName, + genutiltypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + vestingtypes.ModuleName, ) + // NOTE: fee market module must go last in order to retrieve the block gas used. app.mm.SetOrderEndBlockers( - crisis.ModuleName, gov.ModuleName, staking.ModuleName, register.ModuleName, - // this line is used by starport scaffolding # 6.1 + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + //register.ModuleName, + //evmtypes.ModuleName, + // no-op modules + ibchost.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + minttypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, ) + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. app.mm.SetOrderInitGenesis( - // this line is used by starport scaffolding # 6.2 - auth.ModuleName, - bank.ModuleName, - distr.ModuleName, - staking.ModuleName, - slashing.ModuleName, - gov.ModuleName, - mint.ModuleName, - crisis.ModuleName, - genutil.ModuleName, - register.ModuleName, - pot.ModuleName, - sds.ModuleName, - upgrade.ModuleName, - supply.ModuleName, - - // this line is used by starport scaffolding # 7 + // SDK modules + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + ibchost.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + ibctransfertypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + // Stratos modules + //evmtypes.ModuleName, + + // NOTE: crisis module must go at the end to check for invariants on each module + crisistypes.ModuleName, ) - app.mm.RegisterRoutes(app.Router(), app.QueryRouter()) + app.mm.RegisterInvariants(&app.crisisKeeper) + app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + app.mm.RegisterServices(app.configurator) + // initialize stores + app.MountKVStores(keys) + app.MountTransientStores(tKeys) + app.MountMemoryStores(memKeys) + + // initialize BaseApp app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) - app.SetEndBlocker(app.EndBlocker) - - app.upgradeKeeper.SetUpgradeHandler(version.Version, func(ctx sdk.Context, plan upgrade.Plan) { - logger.Info("Upgrade Handler working") - }) - app.SetStoreLoader(bam.StoreLoaderWithUpgrade(&store.StoreUpgrades{ - Renamed: []store.StoreRename{{ - //OldKey: "foo", - //NewKey: "bar", - }}, - }), - ) - - app.SetAnteHandler( - auth.NewAnteHandler( - app.accountKeeper, - app.supplyKeeper, - helpers.StSigVerificationGasConsumer, - ), - ) - app.MountKVStores(keys) - app.MountTransientStores(tKeys) + // custom AnteHandler + options := ante.HandlerOptions{ + AccountKeeper: app.accountKeeper, + BankKeeper: app.bankKeeper, + FeegrantKeeper: app.feeGrantKeeper, + SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + SigGasConsumer: helpers.StSigVerificationGasConsumer, + } + antHandler, err := ante.NewAnteHandler(options) + if err != nil { + panic(err) + } + app.SetAnteHandler(antHandler) + app.SetEndBlocker(app.EndBlocker) if loadLatest { - err := app.LoadLatestVersion(app.keys[bam.MainStoreKey]) - if err != nil { + if err = app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) } } - return app -} - -type GenesisState map[string]json.RawMessage + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedTransferKeeper = scopedTransferKeeper -func NewDefaultGenesisState() GenesisState { - return ModuleBasics.DefaultGenesis() + return app } func (app *NewApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState simapp.GenesisState app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState) - return app.mm.InitGenesis(ctx, genesisState) + return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } func (app *NewApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { @@ -348,20 +557,32 @@ func (app *NewApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Re } func (app *NewApp) LoadHeight(height int64) error { - return app.LoadVersion(height, app.keys[bam.MainStoreKey]) + return app.LoadVersion(height) } +// ModuleAccountAddrs returns all the app's module account addresses. func (app *NewApp) ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) for acc := range maccPerms { - modAccAddrs[supply.NewModuleAddress(acc).String()] = true + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true } return modAccAddrs } -func (app *NewApp) Codec() *codec.Codec { - return app.cdc +// BlockedAddrs returns all the app's module account addresses that are not +// allowed to receive external tokens. +func (app *NewApp) BlockedAddrs() map[string]bool { + blockedAddrs := make(map[string]bool) + for acc := range maccPerms { + blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc] + } + + return blockedAddrs +} + +func (app *NewApp) Codec() codec.Codec { + return app.appCodec } func (app *NewApp) SimulationManager() *module.SimulationManager { @@ -375,3 +596,83 @@ func GetMaccPerms() map[string][]string { } return modAccPerms } + +// GetSubspace returns a param subspace for a given module name. +// +// NOTE: This is solely to be used for testing purposes. +func (app *NewApp) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.paramsKeeper.GetSubspace(moduleName) + return subspace +} + +func (app *NewApp) LegacyAmino() *codec.LegacyAmino { + return app.cdc +} + +func (app *NewApp) RegisterTxService(clientCtx client.Context) { + authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) +} + +func (app *NewApp) RegisterTendermintService(clientCtx client.Context) { + tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (app *NewApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + clientCtx := apiSvr.ClientCtx + rpc.RegisterRoutes(clientCtx, apiSvr.Router) + + //evmrest.RegisterTxRoutes(clientCtx, apiSvr.Router) + + // Register new tx routes from grpc-gateway. + authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register new tendermint queries routes from grpc-gateway. + tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register legacy and grpc-gateway routes for all modules. + ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router) + ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // register swagger API from root so that other applications can override easily + if apiConfig.Swagger { + RegisterSwaggerAPI(clientCtx, apiSvr.Router) + } +} + +// RegisterSwaggerAPI registers swagger route with API Server +func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { + statikFS, err := fs.New() + if err != nil { + panic(err) + } + + staticServer := http.FileServer(statikFS) + rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper( + appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + // SDK subspaces + paramsKeeper.Subspace(authtypes.ModuleName) + paramsKeeper.Subspace(banktypes.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) + paramsKeeper.Subspace(distrtypes.ModuleName) + paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) + paramsKeeper.Subspace(crisistypes.ModuleName) + // ibc subspaces + paramsKeeper.Subspace(ibctransfertypes.ModuleName) + paramsKeeper.Subspace(ibchost.ModuleName) + // stratos subspaces + paramsKeeper.Subspace(registertypes.ModuleName) + paramsKeeper.Subspace(pottypes.ModuleName) + paramsKeeper.Subspace(sdstypes.ModuleName) + //paramsKeeper.Subspace(evmtypes.ModuleName) + + return paramsKeeper +} diff --git a/app/encoding.go b/app/encoding.go new file mode 100644 index 00000000..e5c9b037 --- /dev/null +++ b/app/encoding.go @@ -0,0 +1,33 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + + "github.com/stratosnet/stratos-chain/app/params" +) + +// MakeEncodingConfig creates an EncodingConfig for testing. This function +// should be used only in tests or when creating a new app instance (NewApp*()). +// App user shouldn't create new codecs - use the app.AppCodec instead. +// [DEPRECATED] +func MakeConfig() params.EncodingConfig { + cdc := codec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + marshaler := codec.NewProtoCodec(interfaceRegistry) + + encodingConfig := params.EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: marshaler, + TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes), + Amino: cdc, + } + + std.RegisterLegacyAminoCodec(encodingConfig.Amino) + std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) + ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig +} diff --git a/app/export.go b/app/export.go index 7aafdb18..e7ca6558 100644 --- a/app/export.go +++ b/app/export.go @@ -2,73 +2,137 @@ package app import ( "encoding/json" - "log" + "fmt" - abci "github.com/tendermint/tendermint/abci/types" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/cosmos/cosmos-sdk/codec" + servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) // ExportAppStateAndValidators exports the state of the application for a genesis // file. func (app *NewApp) ExportAppStateAndValidators( - forZeroHeight bool, jailWhiteList []string, -) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) { + forZeroHeight bool, jailAllowedAddrs []string, +) (servertypes.ExportedApp, error) { + // Creates context with current height and checks txs for ctx to be usable by start of next block + ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + + // We export at last height + 1, because that's the height at which + // Tendermint will start InitChain. + height := app.LastBlockHeight() + 1 + if forZeroHeight { + height = 0 - // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) + if err := app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs); err != nil { + return servertypes.ExportedApp{}, err + } + } - if forZeroHeight { - app.prepForZeroHeightGenesis(ctx, jailWhiteList) + genState := app.mm.ExportGenesis(ctx, app.appCodec) + appState, err := json.MarshalIndent(genState, "", " ") + if err != nil { + return servertypes.ExportedApp{}, err } - genState := app.mm.ExportGenesis(ctx) - appState, err = codec.MarshalJSONIndent(app.cdc, genState) + validators, err := staking.WriteValidators(ctx, app.stakingKeeper) if err != nil { - return nil, nil, err + return servertypes.ExportedApp{}, err } - validators = staking.WriteValidators(ctx, app.stakingKeeper) - return appState, validators, nil + return servertypes.ExportedApp{ + AppState: appState, + Validators: validators, + Height: height, + ConsensusParams: app.BaseApp.GetConsensusParams(ctx), + }, nil } // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated -// in favour of export at a block height -func (app *NewApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string) { - applyWhiteList := false +// in favor of export at a block height +func (app *NewApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) error { + applyAllowedAddrs := false - //Check if there is a whitelist - if len(jailWhiteList) > 0 { - applyWhiteList = true + // check if there is a allowed address list + if len(jailAllowedAddrs) > 0 { + applyAllowedAddrs = true } - whiteListMap := make(map[string]bool) + allowedAddrsMap := make(map[string]bool) - for _, addr := range jailWhiteList { + for _, addr := range jailAllowedAddrs { _, err := sdk.ValAddressFromBech32(addr) if err != nil { - log.Fatal(err) + return err + } + allowedAddrsMap[addr] = true + } + + /* Just to be safe, assert the invariants on current state. */ + app.crisisKeeper.AssertInvariants(ctx) + + /* Handle fee distribution state. */ + + // withdraw all validator commission + app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + _, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + return false + }) + + // withdraw all delegator rewards + dels := app.stakingKeeper.GetAllDelegations(ctx) + for _, delegation := range dels { + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + return err } - whiteListMap[addr] = true + + delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) + if err != nil { + return err + } + _, _ = app.distrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) } - // this line is used by starport scaffolding # 1 + // clear validator slash events + app.distrKeeper.DeleteAllValidatorSlashEvents(ctx) + + // clear validator historical rewards + app.distrKeeper.DeleteAllValidatorHistoricalRewards(ctx) // set context height to zero height := ctx.BlockHeight() ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.stakingKeeper.IterateValidators(ctx, func(_ int64, val staking.ValidatorI) (stop bool) { - // this line is used by starport scaffolding # 2 + app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + // donate any unwithdrawn outstanding reward fraction tokens to the community pool + scraps := app.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + feePool := app.distrKeeper.GetFeePool(ctx) + feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + app.distrKeeper.SetFeePool(ctx, feePool) + + app.distrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) return false }) - // this line is used by starport scaffolding # 3 + // reinitialize all delegations + for _, del := range dels { + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) + if err != nil { + return err + } + delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress) + if err != nil { + return err + } + app.distrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) + app.distrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) + } // reset context height ctx = ctx.WithBlockHeight(height) @@ -76,7 +140,7 @@ func (app *NewApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []str /* Handle staking state. */ // iterate through redelegations, reset creation height - app.stakingKeeper.IterateRedelegations(ctx, func(_ int64, red staking.Redelegation) (stop bool) { + app.stakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } @@ -85,7 +149,7 @@ func (app *NewApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []str }) // iterate through unbonding delegations, reset creation height - app.stakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd staking.UnbondingDelegation) (stop bool) { + app.stakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } @@ -95,27 +159,42 @@ func (app *NewApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []str // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. - store := ctx.KVStore(app.keys[staking.StoreKey]) - iter := sdk.KVStoreReversePrefixIterator(store, staking.ValidatorsKey) - counter := int16(0) + store := ctx.KVStore(app.keys[stakingtypes.StoreKey]) + iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) for ; iter.Valid(); iter.Next() { - addr := sdk.ValAddress(iter.Key()[1:]) + addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) validator, found := app.stakingKeeper.GetValidator(ctx, addr) if !found { - panic("expected validator, not found") + return fmt.Errorf("expected validator %s not found", addr) } validator.UnbondingHeight = 0 - if applyWhiteList && !whiteListMap[addr.String()] { + if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { validator.Jailed = true } app.stakingKeeper.SetValidator(ctx, validator) - counter++ } - iter.Close() + if err := iter.Close(); err != nil { + return err + } + + if _, err := app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx); err != nil { + return err + } - _ = app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + /* Handle slashing state. */ + + // reset start height on signing infos + app.slashingKeeper.IterateValidatorSigningInfos( + ctx, + func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { + info.StartHeight = 0 + app.slashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + return false + }, + ) + return nil } diff --git a/app/params/encoding.go b/app/params/encoding.go new file mode 100644 index 00000000..2cd16263 --- /dev/null +++ b/app/params/encoding.go @@ -0,0 +1,17 @@ +package params + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" +) + +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + // NOTE: this field will be renamed to Codec + Marshaler codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} diff --git a/cmd/stchaind/main_new.go b/cmd/stchaind/main_new.go new file mode 100644 index 00000000..e270fc61 --- /dev/null +++ b/cmd/stchaind/main_new.go @@ -0,0 +1,24 @@ +package main + +import ( + "os" + + "github.com/cosmos/cosmos-sdk/server" + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + + "github.com/stratosnet/stratos-chain/app" +) + +func main() { + app.SetConfig() + rootCmd, _ := NewRootCmd() + if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { + switch e := err.(type) { + case server.ErrorCode: + os.Exit(e.Code) + + default: + os.Exit(1) + } + } +} diff --git a/cmd/stchaind/root.go b/cmd/stchaind/root.go new file mode 100644 index 00000000..a758681e --- /dev/null +++ b/cmd/stchaind/root.go @@ -0,0 +1,306 @@ +package main + +import ( + "errors" + "io" + "os" + "path/filepath" + + "github.com/spf13/cast" + "github.com/spf13/cobra" + + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/config" + "github.com/cosmos/cosmos-sdk/client/debug" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/server" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/snapshots" + "github.com/cosmos/cosmos-sdk/store" + sdk "github.com/cosmos/cosmos-sdk/types" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + + "github.com/stratosnet/stratos-chain/app" + "github.com/stratosnet/stratos-chain/app/params" +) + +// NewRootCmd creates a new root command for simd. It is called once in the +// main function. +func NewRootCmd() (*cobra.Command, params.EncodingConfig) { + encodingConfig := app.MakeConfig() + initClientCtx := client.Context{}. + WithCodec(encodingConfig.Marshaler). + WithInterfaceRegistry(encodingConfig.InterfaceRegistry). + WithTxConfig(encodingConfig.TxConfig). + WithLegacyAmino(encodingConfig.Amino). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(app.DefaultNodeHome). + WithViper("") // In simapp, we don't use any prefix for env variables. + + rootCmd := &cobra.Command{ + Use: "stchaind", + Short: "Stratos Daemon", + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { + // set the default command outputs + cmd.SetOut(cmd.OutOrStdout()) + cmd.SetErr(cmd.ErrOrStderr()) + + initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) + if err != nil { + return err + } + + initClientCtx, err = config.ReadFromClientConfig(initClientCtx) + if err != nil { + return err + } + + if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { + return err + } + + customAppTemplate, customAppConfig := initAppConfig() + + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig) + }, + } + + initRootCmd(rootCmd, encodingConfig) + + return rootCmd, encodingConfig +} + +// initAppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func initAppConfig() (string, interface{}) { + // The following code snippet is just for reference. + + // WASMConfig defines configuration for the wasm module. + type WASMConfig struct { + // This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries + QueryGasLimit uint64 `mapstructure:"query_gas_limit"` + + // Address defines the gRPC-web server to listen on + LruSize uint64 `mapstructure:"lru_size"` + } + + type CustomAppConfig struct { + serverconfig.Config + + WASM WASMConfig `mapstructure:"wasm"` + } + + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := serverconfig.DefaultConfig() + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In simapp, we set the min gas prices to 0. + srvCfg.MinGasPrices = "0ustos" + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + WASM: WASMConfig{ + LruSize: 1, + QueryGasLimit: 300000, + }, + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + ` +[wasm] +# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries +query_gas_limit = 300000 +# This is the number of wasm vm instances we keep cached in memory for speed-up +# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally +lru_size = 0` + + return customAppTemplate, customAppConfig +} + +func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { + cfg := sdk.GetConfig() + cfg.Seal() + + rootCmd.AddCommand( + genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), + genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + genutilcli.MigrateGenesisCmd(), + genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + genutilcli.ValidateGenesisCmd(app.ModuleBasics), + //TODO: fix these cmds + //AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome), + //AddGenesisIndexingNodeCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome, banktypes.GenesisBalancesIterator{}), + //LoadTestCommands(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome), + tmcli.NewCompletionCmd(rootCmd, true), + //testnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}), + debug.Cmd(), + config.Cmd(), + ) + + a := appCreator{encodingConfig} + server.AddCommands(rootCmd, app.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags) + + // add keybase, auxiliary RPC, query, and tx child commands + rootCmd.AddCommand( + rpc.StatusCommand(), + queryCommand(), + txCommand(), + keys.Commands(app.DefaultNodeHome), + ) + + // add rosetta + rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) +} + +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetAccountCmd(), + rpc.ValidatorCommand(), + rpc.BlockCommand(), + authcmd.QueryTxsByEventsCmd(), + authcmd.QueryTxCmd(), + ) + + app.ModuleBasics.AddQueryCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), + authcmd.GetValidateSignaturesCommand(), + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + ) + + app.ModuleBasics.AddTxCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +type appCreator struct { + encCfg params.EncodingConfig +} + +// newApp is an appCreator +func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { + var cache sdk.MultiStorePersistentCache + + if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { + cache = store.NewCommitKVStoreCacheManager() + } + + skipUpgradeHeights := make(map[int64]bool) + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + + pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts) + if err != nil { + panic(err) + } + + snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") + snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) + if err != nil { + panic(err) + } + snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) + if err != nil { + panic(err) + } + + return app.NewInitApp( + logger, db, traceStore, true, skipUpgradeHeights, + cast.ToString(appOpts.Get(flags.FlagHome)), + cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), + a.encCfg, + appOpts, + baseapp.SetPruning(pruningOpts), + baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), + baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), + baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), + baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), + baseapp.SetInterBlockCache(cache), + baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), + baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), + baseapp.SetSnapshotStore(snapshotStore), + baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))), + baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))), + ) +} + +// appExport creates a new simapp (optionally at a given height) +// and exports state. +func (a appCreator) appExport( + logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, + appOpts servertypes.AppOptions) (servertypes.ExportedApp, error) { + + var stratosApp *app.NewApp + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home not set") + } + + if height != -1 { + stratosApp = app.NewInitApp(logger, db, traceStore, false, map[int64]bool{}, homePath, uint(1), a.encCfg, appOpts) + + if err := stratosApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } else { + stratosApp = app.NewInitApp(logger, db, traceStore, true, map[int64]bool{}, homePath, uint(1), a.encCfg, appOpts) + } + + return stratosApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs) +} diff --git a/encoding/codec/codec.go b/encoding/codec/codec.go new file mode 100644 index 00000000..d0db28b1 --- /dev/null +++ b/encoding/codec/codec.go @@ -0,0 +1,19 @@ +package codec + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterLegacyAminoCodec registers Interfaces from types, crypto, and SDK std. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + sdk.RegisterLegacyAminoCodec(cdc) + codec.RegisterEvidences(cdc) +} + +// RegisterInterfaces registers Interfaces from types, crypto, and SDK std. +func RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) { + std.RegisterInterfaces(interfaceRegistry) +} diff --git a/encoding/config.go b/encoding/config.go new file mode 100644 index 00000000..605728ee --- /dev/null +++ b/encoding/config.go @@ -0,0 +1,31 @@ +package encoding + +import ( + sdkcodec "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/simapp/params" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + + "github.com/stratosnet/stratos-chain/encoding/codec" +) + +// MakeConfig creates an EncodingConfig for testing +func MakeConfig(mb module.BasicManager) params.EncodingConfig { + cdc := sdkcodec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + marshaler := sdkcodec.NewProtoCodec(interfaceRegistry) + + encodingConfig := params.EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: marshaler, + TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes), + Amino: cdc, + } + + codec.RegisterLegacyAminoCodec(encodingConfig.Amino) + mb.RegisterLegacyAminoCodec(encodingConfig.Amino) + codec.RegisterInterfaces(encodingConfig.InterfaceRegistry) + mb.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig +} diff --git a/go.mod b/go.mod index 3259ecd8..4384d6bd 100644 --- a/go.mod +++ b/go.mod @@ -3,20 +3,28 @@ module github.com/stratosnet/stratos-chain go 1.15 require ( - github.com/ReneKroon/ttlcache/v2 v2.7.0 - github.com/cosmos/cosmos-sdk v0.39.2 - github.com/golang/mock v1.4.3 // indirect - github.com/gorilla/mux v1.7.4 - github.com/onsi/ginkgo v1.8.0 // indirect - github.com/onsi/gomega v1.5.0 // indirect - github.com/spf13/afero v1.2.2 // indirect - github.com/spf13/cobra v1.0.0 + github.com/cosmos/cosmos-sdk v0.45.1 + github.com/cosmos/ibc-go/v3 v3.0.0-rc0 + github.com/gogo/protobuf v1.3.3 + github.com/tendermint/tendermint v0.34.14 + github.com/tendermint/tm-db v0.6.7 + github.com/tendermint/btcd v0.1.1 // indirect + github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect + github.com/tendermint/go-amino v0.16.0 // indirect + github.com/ethereum/go-ethereum v1.10.16 + github.com/gorilla/mux v1.8.0 + github.com/onsi/ginkgo v1.16.5 + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cobra v1.3.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.7.0 + github.com/spf13/viper v1.10.1 github.com/stretchr/testify v1.7.0 - github.com/tendermint/go-amino v0.15.1 - github.com/tendermint/tendermint v0.33.9 - github.com/tendermint/tm-db v0.5.1 golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 // indirect - gopkg.in/yaml.v2 v2.3.0 + gopkg.in/yaml.v2 v2.4.0 + github.com/ReneKroon/ttlcache/v2 v2.7.0 + github.com/golang/mock v1.4.3 // indirect + github.com/onsi/gomega v1.5.0 // indirect ) +replace ( + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/helpers/antehelper.go b/helpers/antehelper.go index 9768ea22..3c912f2a 100644 --- a/helpers/antehelper.go +++ b/helpers/antehelper.go @@ -1,57 +1,70 @@ package helpers import ( - "github.com/cosmos/cosmos-sdk/codec" + "fmt" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/crypto/types/multisig" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/tx/signing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/multisig" - "github.com/tendermint/tendermint/crypto/secp256k1" ) // StSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas // for signature verification based upon the public key type. The cost is fetched from the given params and is matched // by the concrete type. func StSigVerificationGasConsumer( - meter sdk.GasMeter, sig []byte, pubkey crypto.PubKey, params authtypes.Params, + meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params, ) error { - switch pubkey := pubkey.(type) { - case ed25519.PubKeyEd25519: + pubKey := sig.PubKey + switch pubKey := pubKey.(type) { + case *ed25519.PubKey: meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") return registertypes.ErrED25519InvalidPubKey - - case secp256k1.PubKeySecp256k1: + case *secp256k1.PubKey: meter.ConsumeGas(params.SigVerifyCostSecp256k1, "ante verify: secp256k1") return nil - - case multisig.PubKeyMultisigThreshold: - var multisignature multisig.Multisignature - codec.Cdc.MustUnmarshalBinaryBare(sig, &multisignature) - - consumeMultisignatureVerificationGas(meter, multisignature, pubkey, params) + case multisig.PubKey: + multisignature, ok := sig.Data.(*signing.MultiSignatureData) + if !ok { + return fmt.Errorf("expected %T, got, %T", &signing.MultiSignatureData{}, sig.Data) + } + err := consumeMultisignatureVerificationGas(meter, multisignature, pubKey, params, sig.Sequence) + if err != nil { + return err + } return nil - default: - return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey) + return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubKey) } } // ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubkey signature -func consumeMultisignatureVerificationGas(meter sdk.GasMeter, - sig multisig.Multisignature, pubkey multisig.PubKeyMultisigThreshold, - params authtypes.Params) { - size := sig.BitArray.Size() +func consumeMultisignatureVerificationGas( + meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey, params authtypes.Params, accSeq uint64, +) error { + size := sig.BitArray.Count() sigIndex := 0 + for i := 0; i < size; i++ { - if sig.BitArray.GetIndex(i) { - err := StSigVerificationGasConsumer(meter, sig.Sigs[sigIndex], pubkey.PubKeys[i], params) - if err != nil { - return - } - sigIndex++ + if !sig.BitArray.GetIndex(i) { + continue } + sigV2 := signing.SignatureV2{ + PubKey: pubkey.GetPubKeys()[i], + Data: sig.Signatures[sigIndex], + Sequence: accSeq, + } + err := StSigVerificationGasConsumer(meter, sigV2, params) + if err != nil { + return err + } + sigIndex++ } + + return nil } diff --git a/types/codec.go b/types/codec.go index c7d7b464..9288d469 100644 --- a/types/codec.go +++ b/types/codec.go @@ -4,6 +4,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -func RegisterCodec(cdc *codec.Codec) { +func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(SdsAddress{}, "SdsAddress", nil) } From 91fdd7d355cfbc3a9ad1eba577501d7b36dd0132 Mon Sep 17 00:00:00 2001 From: Xiong Date: Tue, 12 Apr 2022 10:26:17 -0400 Subject: [PATCH 002/113] add evm & web3 rpc module --- app/app.go | 32 +- cmd/stchaincli/faucet.go | 1004 +- cmd/stchaincli/main.go | 360 +- cmd/stchaind/gen_idx_nodes.go | 320 +- cmd/stchaind/genaccounts.go | 302 +- cmd/stchaind/loadtest.go | 1070 +- cmd/stchaind/main.go | 216 +- crypto/codec/amino.go | 28 + crypto/codec/codec.go | 13 + crypto/ethsecp256k1/ethsecp256k1.go | 217 + crypto/ethsecp256k1/keys.pb.go | 498 + crypto/hd/algorithm.go | 111 + ethereum/eip712/eip712.go | 449 + go.mod | 151 +- go.sum | 1052 +- helpers/antehelper.go | 4 +- proto/buf.yaml | 19 + .../stratos/crypto/v1/ethsecp256k1/keys.proto | 19 + proto/stratos/evm/v1/evm.proto | 258 + proto/stratos/evm/v1/genesis.proto | 33 + proto/stratos/evm/v1/query.proto | 299 + proto/stratos/evm/v1/tx.proto | 172 + proto/stratos/types/v1/account.proto | 25 + proto/stratos/types/v1/web3.proto | 25 + rpc/apis.go | 136 + rpc/ethereum/backend/backend.go | 1056 ++ rpc/ethereum/backend/feebackend.go | 213 + rpc/ethereum/backend/utils.go | 255 + rpc/ethereum/namespaces/debug/api.go | 502 + rpc/ethereum/namespaces/debug/trace.go | 84 + .../namespaces/debug/trace_fallback.go | 36 + rpc/ethereum/namespaces/debug/utils.go | 60 + rpc/ethereum/namespaces/eth/api.go | 1115 ++ rpc/ethereum/namespaces/eth/filters/api.go | 606 + .../namespaces/eth/filters/filter_system.go | 304 + .../namespaces/eth/filters/filters.go | 253 + .../namespaces/eth/filters/subscription.go | 63 + rpc/ethereum/namespaces/eth/filters/utils.go | 106 + rpc/ethereum/namespaces/miner/api.go | 186 + rpc/ethereum/namespaces/miner/unsupported.go | 51 + rpc/ethereum/namespaces/net/api.go | 57 + rpc/ethereum/namespaces/personal/api.go | 253 + rpc/ethereum/namespaces/txpool/api.go | 51 + rpc/ethereum/namespaces/web3/api.go | 26 + rpc/ethereum/pubsub/pubsub.go | 143 + rpc/ethereum/types/addrlock.go | 38 + rpc/ethereum/types/block.go | 193 + rpc/ethereum/types/query_client.go | 66 + rpc/ethereum/types/types.go | 89 + rpc/ethereum/types/utils.go | 359 + rpc/websockets.go | 636 + scripts/proto-tools-installer.sh | 155 + server/config/config.go | 308 + server/config/toml.go | 67 + third_party/proto/buf.yaml | 33 + .../proto/cosmos/auth/v1beta1/auth.proto | 50 + .../proto/cosmos/auth/v1beta1/genesis.proto | 17 + .../proto/cosmos/auth/v1beta1/query.proto | 68 + .../proto/cosmos/authz/v1beta1/authz.proto | 26 + .../proto/cosmos/authz/v1beta1/event.proto | 24 + .../proto/cosmos/authz/v1beta1/genesis.proto | 23 + .../proto/cosmos/authz/v1beta1/query.proto | 34 + .../proto/cosmos/authz/v1beta1/tx.proto | 67 + .../proto/cosmos/bank/v1beta1/authz.proto | 17 + .../proto/cosmos/bank/v1beta1/bank.proto | 92 + .../proto/cosmos/bank/v1beta1/genesis.proto | 39 + .../proto/cosmos/bank/v1beta1/query.proto | 159 + .../proto/cosmos/bank/v1beta1/tx.proto | 42 + .../proto/cosmos/base/abci/v1beta1/abci.proto | 137 + .../proto/cosmos/base/kv/v1beta1/kv.proto | 17 + .../base/query/v1beta1/pagination.proto | 53 + .../base/reflection/v1beta1/reflection.proto | 44 + .../base/reflection/v2alpha1/reflection.proto | 217 + .../base/snapshots/v1beta1/snapshot.proto | 20 + .../base/store/v1beta1/commit_info.proto | 29 + .../cosmos/base/store/v1beta1/listening.proto | 14 + .../cosmos/base/store/v1beta1/snapshot.proto | 28 + .../base/tendermint/v1beta1/query.proto | 136 + .../proto/cosmos/base/v1beta1/coin.proto | 40 + .../capability/v1beta1/capability.proto | 30 + .../cosmos/capability/v1beta1/genesis.proto | 26 + .../proto/cosmos/crisis/v1beta1/genesis.proto | 15 + .../proto/cosmos/crisis/v1beta1/tx.proto | 25 + .../proto/cosmos/crypto/ed25519/keys.proto | 23 + .../proto/cosmos/crypto/multisig/keys.proto | 18 + .../crypto/multisig/v1beta1/multisig.proto | 25 + .../proto/cosmos/crypto/secp256k1/keys.proto | 22 + .../proto/cosmos/crypto/secp256r1/keys.proto | 22 + .../distribution/v1beta1/distribution.proto | 157 + .../cosmos/distribution/v1beta1/genesis.proto | 155 + .../cosmos/distribution/v1beta1/query.proto | 218 + .../cosmos/distribution/v1beta1/tx.proto | 79 + .../cosmos/evidence/v1beta1/evidence.proto | 21 + .../cosmos/evidence/v1beta1/genesis.proto | 12 + .../proto/cosmos/evidence/v1beta1/query.proto | 51 + .../proto/cosmos/evidence/v1beta1/tx.proto | 32 + .../cosmos/feegrant/v1beta1/feegrant.proto | 77 + .../cosmos/feegrant/v1beta1/genesis.proto | 12 + .../proto/cosmos/feegrant/v1beta1/query.proto | 54 + .../proto/cosmos/feegrant/v1beta1/tx.proto | 47 + .../cosmos/genutil/v1beta1/genesis.proto | 16 + .../proto/cosmos/gov/v1beta1/genesis.proto | 26 + .../proto/cosmos/gov/v1beta1/gov.proto | 197 + .../proto/cosmos/gov/v1beta1/query.proto | 190 + third_party/proto/cosmos/gov/v1beta1/tx.proto | 93 + .../proto/cosmos/mint/v1beta1/genesis.proto | 16 + .../proto/cosmos/mint/v1beta1/mint.proto | 53 + .../proto/cosmos/mint/v1beta1/query.proto | 57 + .../proto/cosmos/params/v1beta1/params.proto | 27 + .../proto/cosmos/params/v1beta1/query.proto | 32 + .../cosmos/slashing/v1beta1/genesis.proto | 50 + .../proto/cosmos/slashing/v1beta1/query.proto | 63 + .../cosmos/slashing/v1beta1/slashing.proto | 58 + .../proto/cosmos/slashing/v1beta1/tx.proto | 26 + .../proto/cosmos/staking/v1beta1/authz.proto | 43 + .../cosmos/staking/v1beta1/genesis.proto | 53 + .../proto/cosmos/staking/v1beta1/query.proto | 348 + .../cosmos/staking/v1beta1/staking.proto | 334 + .../proto/cosmos/staking/v1beta1/tx.proto | 126 + .../cosmos/tx/signing/v1beta1/signing.proto | 79 + .../proto/cosmos/tx/v1beta1/service.proto | 132 + third_party/proto/cosmos/tx/v1beta1/tx.proto | 183 + .../proto/cosmos/upgrade/v1beta1/query.proto | 90 + .../cosmos/upgrade/v1beta1/upgrade.proto | 76 + .../proto/cosmos/vesting/v1beta1/tx.proto | 31 + .../cosmos/vesting/v1beta1/vesting.proto | 83 + third_party/proto/cosmos_proto/cosmos.proto | 16 + third_party/proto/gogoproto/gogo.proto | 145 + .../proto/google/api/annotations.proto | 31 + third_party/proto/google/api/http.proto | 325 + third_party/proto/google/api/httpbody.proto | 78 + third_party/proto/google/protobuf/any.proto | 161 + .../proto/google/protobuf/descriptor.proto | 895 ++ third_party/proto/tendermint/abci/types.proto | 407 + .../proto/tendermint/crypto/keys.proto | 17 + .../proto/tendermint/crypto/proof.proto | 41 + .../proto/tendermint/libs/bits/types.proto | 9 + third_party/proto/tendermint/p2p/types.proto | 34 + .../proto/tendermint/types/block.proto | 15 + .../proto/tendermint/types/evidence.proto | 38 + .../proto/tendermint/types/params.proto | 80 + .../proto/tendermint/types/types.proto | 157 + .../proto/tendermint/types/validator.proto | 25 + .../proto/tendermint/version/types.proto | 24 + types/account.go | 19 + types/address.go | 66 +- types/block.go | 28 + types/chain_id.go | 50 + types/coin.go | 12 + types/errors.go | 26 + types/hdpath.go | 24 + types/protoco.go | 9 + types/validation.go | 39 + vue/.browserslistrc | 3 - vue/.env | 1 - vue/.gitignore | 22 - vue/README.md | 27 - vue/babel.config.js | 5 - vue/package-lock.json | 11792 ---------------- vue/package.json | 24 - vue/public/favicon.ico | Bin 4286 -> 0 bytes vue/public/index.html | 17 - vue/src/App.vue | 21 - vue/src/main.js | 12 - vue/src/router/index.js | 20 - vue/src/store/index.js | 9 - vue/src/views/Index.vue | 18 - vue/vue.config.js | 5 - x/evm/client/cli/feemarket_query.go | 145 + x/evm/client/cli/query.go | 108 + x/evm/client/cli/tx.go | 111 + x/evm/client/cli/utils.go | 47 + x/evm/client/rest/rest.go | 117 + x/evm/genesis.go | 99 + x/evm/handler.go | 26 + x/evm/keeper/abci.go | 62 + x/evm/keeper/eip1559.go | 80 + x/evm/keeper/grpc_query.go | 594 + x/evm/keeper/hooks.go | 31 + x/evm/keeper/keeper.go | 359 + x/evm/keeper/migrations.go | 13 + x/evm/keeper/msg_server.go | 88 + x/evm/keeper/params.go | 41 + x/evm/keeper/state_transition.go | 500 + x/evm/keeper/statedb.go | 223 + x/evm/keeper/utils.go | 109 + x/evm/module.go | 192 + x/evm/simulation/genesis.go | 30 + x/evm/statedb/access_list.go | 118 + x/evm/statedb/config.go | 32 + x/evm/statedb/interfaces.go | 22 + x/evm/statedb/journal.go | 243 + x/evm/statedb/state_object.go | 237 + x/evm/statedb/statedb.go | 463 + x/evm/types/ERC20Contract.json | 4 + x/evm/types/SimpleStorageContract.json | 4 + x/evm/types/TestMessageCall.json | 4 + x/evm/types/access_list.go | 55 + x/evm/types/access_list_tx.go | 243 + x/evm/types/chain_config.go | 163 + x/evm/types/codec.go | 70 + x/evm/types/compiled_contract.go | 117 + x/evm/types/config.go | 17 + x/evm/types/dynamic_fee_tx.go | 281 + x/evm/types/errors.go | 133 + x/evm/types/events.go | 27 + x/evm/types/evm.pb.go | 4164 ++++++ x/evm/types/genesis.go | 51 + x/evm/types/genesis.pb.go | 719 + x/evm/types/interfaces.go | 49 + x/evm/types/key.go | 62 + x/evm/types/legacy_tx.go | 213 + x/evm/types/logs.go | 127 + x/evm/types/msg.go | 348 + x/evm/types/params.go | 252 + x/evm/types/query.go | 24 + x/evm/types/query.pb.go | 5985 ++++++++ x/evm/types/query.pb.gw.go | 1202 ++ x/evm/types/storage.go | 66 + x/evm/types/tracer.go | 157 + x/evm/types/tx.go | 29 + x/evm/types/tx.pb.go | 2817 ++++ x/evm/types/tx.pb.gw.go | 166 + x/evm/types/tx_args.go | 246 + x/evm/types/tx_data.go | 119 + x/evm/types/utils.go | 107 + 226 files changed, 42241 insertions(+), 13790 deletions(-) create mode 100644 crypto/codec/amino.go create mode 100644 crypto/codec/codec.go create mode 100644 crypto/ethsecp256k1/ethsecp256k1.go create mode 100644 crypto/ethsecp256k1/keys.pb.go create mode 100644 crypto/hd/algorithm.go create mode 100644 ethereum/eip712/eip712.go create mode 100644 proto/buf.yaml create mode 100644 proto/stratos/crypto/v1/ethsecp256k1/keys.proto create mode 100644 proto/stratos/evm/v1/evm.proto create mode 100644 proto/stratos/evm/v1/genesis.proto create mode 100644 proto/stratos/evm/v1/query.proto create mode 100644 proto/stratos/evm/v1/tx.proto create mode 100644 proto/stratos/types/v1/account.proto create mode 100644 proto/stratos/types/v1/web3.proto create mode 100644 rpc/apis.go create mode 100644 rpc/ethereum/backend/backend.go create mode 100644 rpc/ethereum/backend/feebackend.go create mode 100644 rpc/ethereum/backend/utils.go create mode 100644 rpc/ethereum/namespaces/debug/api.go create mode 100644 rpc/ethereum/namespaces/debug/trace.go create mode 100644 rpc/ethereum/namespaces/debug/trace_fallback.go create mode 100644 rpc/ethereum/namespaces/debug/utils.go create mode 100644 rpc/ethereum/namespaces/eth/api.go create mode 100644 rpc/ethereum/namespaces/eth/filters/api.go create mode 100644 rpc/ethereum/namespaces/eth/filters/filter_system.go create mode 100644 rpc/ethereum/namespaces/eth/filters/filters.go create mode 100644 rpc/ethereum/namespaces/eth/filters/subscription.go create mode 100644 rpc/ethereum/namespaces/eth/filters/utils.go create mode 100644 rpc/ethereum/namespaces/miner/api.go create mode 100644 rpc/ethereum/namespaces/miner/unsupported.go create mode 100644 rpc/ethereum/namespaces/net/api.go create mode 100644 rpc/ethereum/namespaces/personal/api.go create mode 100644 rpc/ethereum/namespaces/txpool/api.go create mode 100644 rpc/ethereum/namespaces/web3/api.go create mode 100644 rpc/ethereum/pubsub/pubsub.go create mode 100644 rpc/ethereum/types/addrlock.go create mode 100644 rpc/ethereum/types/block.go create mode 100644 rpc/ethereum/types/query_client.go create mode 100644 rpc/ethereum/types/types.go create mode 100644 rpc/ethereum/types/utils.go create mode 100644 rpc/websockets.go create mode 100644 scripts/proto-tools-installer.sh create mode 100644 server/config/config.go create mode 100644 server/config/toml.go create mode 100644 third_party/proto/buf.yaml create mode 100644 third_party/proto/cosmos/auth/v1beta1/auth.proto create mode 100644 third_party/proto/cosmos/auth/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/auth/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/authz/v1beta1/authz.proto create mode 100644 third_party/proto/cosmos/authz/v1beta1/event.proto create mode 100644 third_party/proto/cosmos/authz/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/authz/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/authz/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/bank/v1beta1/authz.proto create mode 100644 third_party/proto/cosmos/bank/v1beta1/bank.proto create mode 100644 third_party/proto/cosmos/bank/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/bank/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/bank/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/base/abci/v1beta1/abci.proto create mode 100644 third_party/proto/cosmos/base/kv/v1beta1/kv.proto create mode 100644 third_party/proto/cosmos/base/query/v1beta1/pagination.proto create mode 100644 third_party/proto/cosmos/base/reflection/v1beta1/reflection.proto create mode 100644 third_party/proto/cosmos/base/reflection/v2alpha1/reflection.proto create mode 100644 third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto create mode 100644 third_party/proto/cosmos/base/store/v1beta1/commit_info.proto create mode 100644 third_party/proto/cosmos/base/store/v1beta1/listening.proto create mode 100644 third_party/proto/cosmos/base/store/v1beta1/snapshot.proto create mode 100644 third_party/proto/cosmos/base/tendermint/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/base/v1beta1/coin.proto create mode 100644 third_party/proto/cosmos/capability/v1beta1/capability.proto create mode 100644 third_party/proto/cosmos/capability/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/crisis/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/crisis/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/crypto/ed25519/keys.proto create mode 100644 third_party/proto/cosmos/crypto/multisig/keys.proto create mode 100644 third_party/proto/cosmos/crypto/multisig/v1beta1/multisig.proto create mode 100644 third_party/proto/cosmos/crypto/secp256k1/keys.proto create mode 100644 third_party/proto/cosmos/crypto/secp256r1/keys.proto create mode 100644 third_party/proto/cosmos/distribution/v1beta1/distribution.proto create mode 100644 third_party/proto/cosmos/distribution/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/distribution/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/distribution/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/evidence/v1beta1/evidence.proto create mode 100644 third_party/proto/cosmos/evidence/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/evidence/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/evidence/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto create mode 100644 third_party/proto/cosmos/feegrant/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/feegrant/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/feegrant/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/genutil/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/gov/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/gov/v1beta1/gov.proto create mode 100644 third_party/proto/cosmos/gov/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/gov/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/mint/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/mint/v1beta1/mint.proto create mode 100644 third_party/proto/cosmos/mint/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/params/v1beta1/params.proto create mode 100644 third_party/proto/cosmos/params/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/slashing/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/slashing/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/slashing/v1beta1/slashing.proto create mode 100644 third_party/proto/cosmos/slashing/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/staking/v1beta1/authz.proto create mode 100644 third_party/proto/cosmos/staking/v1beta1/genesis.proto create mode 100644 third_party/proto/cosmos/staking/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/staking/v1beta1/staking.proto create mode 100644 third_party/proto/cosmos/staking/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/tx/signing/v1beta1/signing.proto create mode 100644 third_party/proto/cosmos/tx/v1beta1/service.proto create mode 100644 third_party/proto/cosmos/tx/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/upgrade/v1beta1/query.proto create mode 100644 third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto create mode 100644 third_party/proto/cosmos/vesting/v1beta1/tx.proto create mode 100644 third_party/proto/cosmos/vesting/v1beta1/vesting.proto create mode 100644 third_party/proto/cosmos_proto/cosmos.proto create mode 100644 third_party/proto/gogoproto/gogo.proto create mode 100644 third_party/proto/google/api/annotations.proto create mode 100644 third_party/proto/google/api/http.proto create mode 100644 third_party/proto/google/api/httpbody.proto create mode 100644 third_party/proto/google/protobuf/any.proto create mode 100644 third_party/proto/google/protobuf/descriptor.proto create mode 100644 third_party/proto/tendermint/abci/types.proto create mode 100644 third_party/proto/tendermint/crypto/keys.proto create mode 100644 third_party/proto/tendermint/crypto/proof.proto create mode 100644 third_party/proto/tendermint/libs/bits/types.proto create mode 100644 third_party/proto/tendermint/p2p/types.proto create mode 100644 third_party/proto/tendermint/types/block.proto create mode 100644 third_party/proto/tendermint/types/evidence.proto create mode 100644 third_party/proto/tendermint/types/params.proto create mode 100644 third_party/proto/tendermint/types/types.proto create mode 100644 third_party/proto/tendermint/types/validator.proto create mode 100644 third_party/proto/tendermint/version/types.proto create mode 100644 types/account.go create mode 100644 types/block.go create mode 100644 types/chain_id.go create mode 100644 types/coin.go create mode 100644 types/errors.go create mode 100644 types/hdpath.go create mode 100644 types/protoco.go create mode 100644 types/validation.go delete mode 100644 vue/.browserslistrc delete mode 100644 vue/.env delete mode 100644 vue/.gitignore delete mode 100644 vue/README.md delete mode 100644 vue/babel.config.js delete mode 100644 vue/package-lock.json delete mode 100644 vue/package.json delete mode 100644 vue/public/favicon.ico delete mode 100644 vue/public/index.html delete mode 100644 vue/src/App.vue delete mode 100644 vue/src/main.js delete mode 100644 vue/src/router/index.js delete mode 100644 vue/src/store/index.js delete mode 100644 vue/src/views/Index.vue delete mode 100644 vue/vue.config.js create mode 100644 x/evm/client/cli/feemarket_query.go create mode 100644 x/evm/client/cli/query.go create mode 100644 x/evm/client/cli/tx.go create mode 100644 x/evm/client/cli/utils.go create mode 100644 x/evm/client/rest/rest.go create mode 100644 x/evm/genesis.go create mode 100644 x/evm/handler.go create mode 100644 x/evm/keeper/abci.go create mode 100644 x/evm/keeper/eip1559.go create mode 100644 x/evm/keeper/grpc_query.go create mode 100644 x/evm/keeper/hooks.go create mode 100644 x/evm/keeper/keeper.go create mode 100644 x/evm/keeper/migrations.go create mode 100644 x/evm/keeper/msg_server.go create mode 100644 x/evm/keeper/params.go create mode 100644 x/evm/keeper/state_transition.go create mode 100644 x/evm/keeper/statedb.go create mode 100644 x/evm/keeper/utils.go create mode 100644 x/evm/module.go create mode 100644 x/evm/simulation/genesis.go create mode 100644 x/evm/statedb/access_list.go create mode 100644 x/evm/statedb/config.go create mode 100644 x/evm/statedb/interfaces.go create mode 100644 x/evm/statedb/journal.go create mode 100644 x/evm/statedb/state_object.go create mode 100644 x/evm/statedb/statedb.go create mode 100644 x/evm/types/ERC20Contract.json create mode 100644 x/evm/types/SimpleStorageContract.json create mode 100644 x/evm/types/TestMessageCall.json create mode 100644 x/evm/types/access_list.go create mode 100644 x/evm/types/access_list_tx.go create mode 100644 x/evm/types/chain_config.go create mode 100644 x/evm/types/codec.go create mode 100644 x/evm/types/compiled_contract.go create mode 100644 x/evm/types/config.go create mode 100644 x/evm/types/dynamic_fee_tx.go create mode 100644 x/evm/types/errors.go create mode 100644 x/evm/types/events.go create mode 100644 x/evm/types/evm.pb.go create mode 100644 x/evm/types/genesis.go create mode 100644 x/evm/types/genesis.pb.go create mode 100644 x/evm/types/interfaces.go create mode 100644 x/evm/types/key.go create mode 100644 x/evm/types/legacy_tx.go create mode 100644 x/evm/types/logs.go create mode 100644 x/evm/types/msg.go create mode 100644 x/evm/types/params.go create mode 100644 x/evm/types/query.go create mode 100644 x/evm/types/query.pb.go create mode 100644 x/evm/types/query.pb.gw.go create mode 100644 x/evm/types/storage.go create mode 100644 x/evm/types/tracer.go create mode 100644 x/evm/types/tx.go create mode 100644 x/evm/types/tx.pb.go create mode 100644 x/evm/types/tx.pb.gw.go create mode 100644 x/evm/types/tx_args.go create mode 100644 x/evm/types/tx_data.go create mode 100644 x/evm/types/utils.go diff --git a/app/app.go b/app/app.go index baff78bb..d861635d 100644 --- a/app/app.go +++ b/app/app.go @@ -92,12 +92,12 @@ import ( stratosparams "github.com/stratosnet/stratos-chain/app/params" "github.com/stratosnet/stratos-chain/helpers" - "github.com/stratosnet/stratos-chain/x/pot" - pottypes "github.com/stratosnet/stratos-chain/x/pot/types" - "github.com/stratosnet/stratos-chain/x/register" - registertypes "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/stratosnet/stratos-chain/x/sds" - sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" + //"github.com/stratosnet/stratos-chain/x/pot" + //pottypes "github.com/stratosnet/stratos-chain/x/pot/types" + //"github.com/stratosnet/stratos-chain/x/register" + //registertypes "github.com/stratosnet/stratos-chain/x/register/types" + //"github.com/stratosnet/stratos-chain/x/sds" + //sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) const ( @@ -144,14 +144,14 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - pot.FoundationAccount: nil, + //pot.FoundationAccount: nil, //evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account } // module accounts that are allowed to receive tokens allowedReceivingModAcc = map[string]bool{ distrtypes.ModuleName: true, - pot.FoundationAccount: true, + //pot.FoundationAccount: true, } ) @@ -193,9 +193,9 @@ type NewApp struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper // stratos keepers - registerKeeper register.Keeper - potKeeper pot.Keeper - sdsKeeper sds.Keeper + //registerKeeper register.Keeper + //potKeeper pot.Keeper + //sdsKeeper sds.Keeper //evmKeeper *evmkeeper.Keeper // the module manager @@ -239,7 +239,7 @@ func NewInitApp( // ibc keys ibchost.StoreKey, ibctransfertypes.StoreKey, // stratos keys - register.StoreKey, pot.StoreKey, sds.StoreKey, + //register.StoreKey, pot.StoreKey, sds.StoreKey, //evmtypes.StoreKey, ) tKeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -327,7 +327,7 @@ func NewInitApp( app.govKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( - // register the governance hooks + // register the governance hooks ), ) @@ -669,9 +669,9 @@ func initParamsKeeper( paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) // stratos subspaces - paramsKeeper.Subspace(registertypes.ModuleName) - paramsKeeper.Subspace(pottypes.ModuleName) - paramsKeeper.Subspace(sdstypes.ModuleName) + //paramsKeeper.Subspace(registertypes.ModuleName) + //paramsKeeper.Subspace(pottypes.ModuleName) + //paramsKeeper.Subspace(sdstypes.ModuleName) //paramsKeeper.Subspace(evmtypes.ModuleName) return paramsKeeper diff --git a/cmd/stchaincli/faucet.go b/cmd/stchaincli/faucet.go index 3fbf2fff..b2775e01 100644 --- a/cmd/stchaincli/faucet.go +++ b/cmd/stchaincli/faucet.go @@ -1,504 +1,504 @@ package main -import ( - "bufio" - "fmt" - "net" - "net/http" - "os" - "os/signal" - "strconv" - "strings" - "sync" - "syscall" - "time" - - "github.com/ReneKroon/ttlcache/v2" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/input" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/gorilla/mux" - "github.com/spf13/cobra" - "github.com/spf13/viper" - "github.com/tendermint/tendermint/libs/cli" -) - -const ( - flagFundFrom = "from" // optional - flagAmt = "amt" // denom fixed as ustos - flagPort = "port" - flagChainId = "chain-id" - flagAddrCap = "addr-cap" - flagIpCap = "ip-cap" - - defaultOutputFlag = "text" - defaultKeyringBackend = "test" - defaultDenom = "ustos" - defaultChainId = "test-chain" - defaultPort = "26600" - defaultAddrCap = 1 - defaultIpCap = 3 - capDuration = 60 // in minutes - - maxAmtFaucet = 100000000000 - requestInterval = 100 * time.Millisecond -) - -// used in request channel -type FaucetReq struct { - FromAddress sdk.AccAddress - FromName string - From string - - ToAddr sdk.AccAddress - resChan chan FaucetRsp - Index int -} - -// used in response channel -type FaucetRsp struct { - ErrorMsg string - TxResponse sdk.TxResponse - Seq uint64 -} - -// used for restful response -type RestFaucetRsp struct { - ErrorMsg string - TxResponse sdk.TxResponse -} - -type FaucetToMiddleware struct { - Cap int // maximum faucet cap to an individual addr during an hour - AddrCache ttlcache.SimpleCache -} - -type FromIpMiddleware struct { - Cap int // maximum accessing times during an hour - IpCache ttlcache.SimpleCache -} - -func (ftm *FaucetToMiddleware) Middleware(h http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - addr := vars["address"] - if ftm.checkCap(addr) { - h.ServeHTTP(w, r) - } else { - w.WriteHeader(http.StatusTooManyRequests) - w.Write([]byte("Faucet request to address [" + addr + "] exceeds hourly cap (" + strconv.Itoa(ftm.Cap) + " request(s) per hour)")) - } - }) -} - -func (ftm *FaucetToMiddleware) checkCap(toAddr string) bool { - val, _ := ftm.AddrCache.Get(toAddr) - if val == nil { - ftm.AddrCache.Set(toAddr, 1) - return true - } - - if val.(int) >= ftm.Cap { - return false - } - ftm.AddrCache.Set(toAddr, val.(int)+1) - return true -} - -func (fim *FromIpMiddleware) Middleware(h http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - realIp := getRealAddr(r) - if fim.checkCap(realIp) { - h.ServeHTTP(w, r) - } else { - fmt.Printf(" ********** request from %s breached ip cap\n", realIp) - w.WriteHeader(http.StatusTooManyRequests) - w.Write([]byte("Faucet request from Ip " + realIp + " exceeds hourly cap (" + strconv.Itoa(fim.Cap) + " request(s) per hour)!")) - } - }) -} - -func (fim *FromIpMiddleware) checkCap(fromIp string) bool { - val, _ := fim.IpCache.Get(fromIp) - if val == nil { - fim.IpCache.Set(fromIp, 1) - return true - } - - if val.(int) >= fim.Cap { - return false - } - fim.IpCache.Set(fromIp, val.(int)+1) - return true -} - -// global to load command line args -var ( - faucetServices = make([]FaucetService, 0) - faucetPort = defaultPort -) - -// struct to hold the command-line args -type FaucetService struct { - fromAddress sdk.AccAddress - fromName string - from string - coins sdk.Coins - seqInfo SeqInfo -} - -type ServiceIndex struct { - nextServiceIndex int - lenOfService int - mux sync.Mutex -} - -func (si *ServiceIndex) getIndexAndScrollNext() int { - if si.lenOfService < 1 { - return 0 - } - si.mux.Lock() - defer si.mux.Unlock() - ret := si.nextServiceIndex - if si.nextServiceIndex < si.lenOfService-1 { - si.nextServiceIndex += 1 - } else { - si.nextServiceIndex = 0 - } - return ret -} - -type SeqInfo struct { - lastSuccSeq int - startSeq int - mu sync.Mutex -} - -func (si *SeqInfo) incrLastSuccSeq(succSeq uint64) { - si.mu.Lock() - defer si.mu.Unlock() - if si.lastSuccSeq < int(succSeq) { - si.lastSuccSeq = int(succSeq) - } -} - -func (si *SeqInfo) getNewSeq(newStartSeq int) int { - si.mu.Lock() - defer si.mu.Unlock() - - if si.lastSuccSeq < newStartSeq-1 { - si.lastSuccSeq = newStartSeq - 1 - return newStartSeq - } else { - return si.lastSuccSeq + 1 - } -} - -func FaucetJobFromCh(faucetReq *chan FaucetReq, cliCtx context.CLIContext, txBldr authtypes.TxBuilder, from sdk.AccAddress, coin sdk.Coin, quit chan os.Signal) { - for { - select { - case sig := <-quit: - fmt.Printf("**** faucet service (sender[%s]) quit after receiving signal[%s] ****\n", from, sig.String()) - os.Exit(0) - case fReq := <-*faucetReq: - resChan := fReq.resChan - // update cliCtx - cliCtx := cliCtx.WithFromName(fReq.FromName).WithFrom(fReq.From).WithFromAddress(fReq.FromAddress) - - // get latest seq and accountNumber by FromAddress - accountNumber, latestSeq, err := authtypes.NewAccountRetriever(cliCtx).GetAccountNumberSequence(fReq.FromAddress) - if err != nil { - faucetRsp := FaucetRsp{ErrorMsg: "Node is under maintenance, please try again later!"} - resChan <- faucetRsp - continue - } - fmt.Printf("----sender[%s] senderIdx[%d] accNum[%d] lastSeq[%d] -----\n", cliCtx.From, fReq.Index, int(accountNumber), int(latestSeq)) - newSeq := faucetServices[fReq.Index].seqInfo.getNewSeq(int(latestSeq)) - err = doTransfer(cliCtx, - txBldr. - WithAccountNumber(accountNumber). - WithSequence(uint64(newSeq)). - WithChainID(viper.GetString(flags.FlagChainID)). - WithGas(uint64(400000)). - WithMemo(strconv.Itoa(newSeq)), - fReq.ToAddr, fReq.FromAddress, coin, &resChan) - if err != nil { - faucetRsp := FaucetRsp{ErrorMsg: err.Error()} - resChan <- faucetRsp - } - } - } -} - -// GetFaucetCmd returns faucet cobra Command -func GetFaucetCmd(cdc *codec.Codec) *cobra.Command { - - cmd := &cobra.Command{ - Use: "faucet", - Short: "Run a faucet server", - Args: cobra.RangeArgs(0, 7), - RunE: func(cmd *cobra.Command, args []string) (err error) { - if !viper.IsSet(flagFundFrom) { - return fmt.Errorf("fund-from not specified") - } - if !viper.IsSet(flags.FlagChainID) { - return fmt.Errorf("chain-id not specified") - } - if !viper.IsSet(flags.FlagKeyringBackend) { - viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) - } - - addrCap := viper.GetInt(flagAddrCap) - ipCap := viper.GetInt(flagIpCap) - - fmt.Print("Set hourly addrCap = " + strconv.Itoa(addrCap) + ", hourly ipCap = " + strconv.Itoa(ipCap)) - - faucetToCache := ttlcache.NewCache() - faucetToCache.SetTTL(capDuration * time.Minute) - faucetToCache.SkipTTLExtensionOnHit(true) - faucetToCache.SetCacheSizeLimit(65535) - ftm := FaucetToMiddleware{AddrCache: faucetToCache, Cap: addrCap} - - fromIpCache := ttlcache.NewCache() - fromIpCache.SetTTL(capDuration * time.Minute) - fromIpCache.SkipTTLExtensionOnHit(true) - fromIpCache.SetCacheSizeLimit(65535) - fim := FromIpMiddleware{IpCache: fromIpCache, Cap: ipCap} - - // parse coins to transfer - var toTransferAmt int - if toTransferAmt = viper.GetInt(flagAmt); toTransferAmt <= 0 || toTransferAmt > maxAmtFaucet { - return fmt.Errorf("invalid amount in faucet") - } - coin := sdk.Coin{Amount: sdk.NewInt(int64(toTransferAmt)), Denom: defaultDenom} - - // parse funding accs - fromAddressesStr := viper.GetString(flagFundFrom) - fundAccs := strings.Split(fromAddressesStr, ",") - if len(fundAccs) < 1 { - return fmt.Errorf("at least 1 funding acc need to be specified for faucet") - } - inBuf := bufio.NewReader(cmd.InOrStdin()) - faucetReqChList := make([]chan FaucetReq, 0) - chQuitSlice := make([]chan os.Signal, 0) - for _, acc := range fundAccs { - fromAddress, fromName, err := context.GetFromFields(inBuf, acc, false) - if err != nil { - return fmt.Errorf("failed to parse bech32 address fro FROM Address: %w", err) - } - - service := FaucetService{ - fromAddress: fromAddress, - fromName: fromName, - from: acc, - coins: sdk.Coins{coin}, - seqInfo: SeqInfo{startSeq: 0, lastSuccSeq: 0}, - } - faucetServices = append(faucetServices, service) - // new reqCh for service - reqCh := make(chan FaucetReq, 10000) - faucetReqChList = append(faucetReqChList, reqCh) - - // new quit signal - quit := make(chan os.Signal, 1) - signal.Notify(quit, - syscall.SIGTERM, - syscall.SIGINT, - syscall.SIGQUIT, - syscall.SIGKILL, - syscall.SIGHUP, - ) - chQuitSlice = append(chQuitSlice, quit) - } - if len(faucetServices) != len(faucetReqChList) { - return fmt.Errorf("failed to setup context for each funding accs") - } - //fmt.Printf("FaucetServices are [%v]", faucetServices) - // start threads - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - viper.Set(flags.FlagSkipConfirmation, true) - viper.Set(cli.OutputFlag, defaultOutputFlag) - - cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, faucetServices[0].fromAddress.String()).WithCodec(cdc) - - // setup port - portFromCmd := viper.GetString(flagPort) - if len(portFromCmd) > 0 { - faucetPort = portFromCmd - } - fmt.Print("\nfunding address: ", "addr", fromAddressesStr) - fmt.Print("\nStarting faucet...") - // listen to localhost:faucetPort - listener, err := net.Listen("tcp", ":"+faucetPort) - fmt.Print("\nlisten to [" + ":" + faucetPort + "]\n") - - // init serviceIndex - serviceIndex := ServiceIndex{ - nextServiceIndex: 0, - lenOfService: len(faucetServices), - } - - // router - r := mux.NewRouter() - // health check - r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - w.Write([]byte("ok\n")) - }) - //faucetReqCh := make(chan FaucetReq, 10000) - //faucet - r.HandleFunc("/faucet/{address}", func(writer http.ResponseWriter, request *http.Request) { - vars := mux.Vars(request) - addr := vars["address"] - remoteIp := getRealAddr(request) - toAddr, err := sdk.AccAddressFromBech32(addr) - if err != nil { - writer.WriteHeader(http.StatusBadRequest) - writer.Write([]byte(err.Error())) - } - // select a context (bonded with funding acc) - reqIndex := serviceIndex.getIndexAndScrollNext() - fmt.Printf("get request from ip [%s], faucet to account [%s], senderIdx[%d]\n", remoteIp, addr, reqIndex) - resChan := make(chan FaucetRsp) - faucetReq := FaucetReq{ - FromAddress: faucetServices[reqIndex].fromAddress, - FromName: faucetServices[reqIndex].fromName, - From: faucetServices[reqIndex].from, - ToAddr: toAddr, - resChan: resChan, - Index: reqIndex, - } - faucetReqChList[reqIndex] <- faucetReq - - faucetRsp := <-resChan - if int(faucetRsp.TxResponse.Code) < 1 && len(faucetRsp.ErrorMsg) == 0 { - // sigverify pass - faucetServices[reqIndex].seqInfo.incrLastSuccSeq(faucetRsp.Seq) - } - fmt.Println("tx send=", faucetRsp.TxResponse.TxHash, ", height=", faucetRsp.TxResponse.Height, ", errorMsg=", faucetRsp.ErrorMsg, ", ip=", remoteIp, ", acc=", addr) - restRsp := &RestFaucetRsp{ErrorMsg: faucetRsp.ErrorMsg, TxResponse: faucetRsp.TxResponse} - rest.PostProcessResponseBare(writer, cliCtx, restRsp) - return - }).Methods("POST") - // ipCap check has higher priority than toAddrCap - r.Use(fim.Middleware) - r.Use(ftm.Middleware) - - for i, _ := range faucetServices { - go FaucetJobFromCh(&faucetReqChList[i], cliCtx, txBldr, faucetServices[i].fromAddress, coin, chQuitSlice[i]) - } - //start the server - err = http.Serve(listener, r) - if err != nil { - fmt.Println(err.Error()) - } - // print stats - fmt.Println("####################################################################") - fmt.Println("################ Terminating faucet ##################") - fmt.Println("####################################################################") - return nil - }, - } - - cmd.Flags().String(flags.FlagKeyringBackend, defaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().String(flagAmt, "", "amt to transfer in faucet") - cmd.Flags().String(flagFundFrom, "", "fund from address") - cmd.Flags().String(flagPort, "26600", "port of faucet server") - cmd.Flags().Int(flagAddrCap, defaultAddrCap, "hourly cap of faucet to a particular account address") - cmd.Flags().Int(flagIpCap, defaultIpCap, "hourly cap of faucet from a particular IP") - - return cmd -} - -func doTransfer(cliCtx context.CLIContext, txBldr authtypes.TxBuilder, to sdk.AccAddress, from sdk.AccAddress, coin sdk.Coin, resChan *chan FaucetRsp) error { - //// build and sign the transaction, then broadcast to Tendermint - msg := bank.NewMsgSend(from, to, sdk.Coins{coin}) - msgs := []sdk.Msg{msg} - txBldr, err := utils.PrepareTxBuilder(txBldr, cliCtx) - if err != nil { - return err - } - - fromName := cliCtx.GetFromName() - - if txBldr.SimulateAndExecute() || cliCtx.Simulate { - txBldr, err = utils.EnrichWithGas(txBldr, cliCtx, msgs) - if err != nil { - return err - } - - gasEst := utils.GasEstimateResponse{GasEstimate: txBldr.Gas()} - _, _ = fmt.Fprintf(os.Stderr, "%s\n", gasEst.String()) - } - - if !cliCtx.SkipConfirm { - stdSignMsg, err := txBldr.BuildSignMsg(msgs) - if err != nil { - return err - } - - var json []byte - if viper.GetBool(flags.FlagIndentResponse) { - json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ") - if err != nil { - panic(err) - } - } else { - json = cliCtx.Codec.MustMarshalJSON(stdSignMsg) - } - - _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", json) - - buf := bufio.NewReader(os.Stdin) - ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf) - if err != nil || !ok { - _, _ = fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction") - return err - } - } - // build and sign the transaction - txBytes, err := txBldr.BuildAndSign(fromName, keys.DefaultKeyPass, msgs) - if err != nil { - return err - } - - // broadcast to a Tendermint node - res, err := cliCtx.BroadcastTxCommit(txBytes) - if err != nil { - return err - } - faucetRsp := FaucetRsp{TxResponse: res, Seq: txBldr.Sequence()} - *resChan <- faucetRsp - return nil -} - -func getRealAddr(r *http.Request) string { - remoteIP := "" - // the default is the originating ip. but we try to find better options because this is almost - // never the right IP - if parts := strings.Split(r.RemoteAddr, ":"); len(parts) == 2 { - remoteIP = parts[0] - } - // If we have a forwarded-for header, take the address from there - if xff := strings.Trim(r.Header.Get("X-Forwarded-For"), ","); len(xff) > 0 { - addrs := strings.Split(xff, ",") - lastFwd := addrs[len(addrs)-1] - if ip := net.ParseIP(lastFwd); ip != nil { - remoteIP = ip.String() - } - // parse X-Real-Ip header - } else if xri := r.Header.Get("X-Real-Ip"); len(xri) > 0 { - if ip := net.ParseIP(xri); ip != nil { - remoteIP = ip.String() - } - } - return remoteIP -} +//import ( +// "bufio" +// "fmt" +// "net" +// "net/http" +// "os" +// "os/signal" +// "strconv" +// "strings" +// "sync" +// "syscall" +// "time" +// +// "github.com/ReneKroon/ttlcache/v2" +// "github.com/cosmos/cosmos-sdk/client/context" +// "github.com/cosmos/cosmos-sdk/client/flags" +// "github.com/cosmos/cosmos-sdk/client/input" +// "github.com/cosmos/cosmos-sdk/client/keys" +// "github.com/cosmos/cosmos-sdk/codec" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/types/rest" +// "github.com/cosmos/cosmos-sdk/x/auth" +// "github.com/cosmos/cosmos-sdk/x/auth/client/utils" +// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/gorilla/mux" +// "github.com/spf13/cobra" +// "github.com/spf13/viper" +// "github.com/tendermint/tendermint/libs/cli" +//) +// +//const ( +// flagFundFrom = "from" // optional +// flagAmt = "amt" // denom fixed as ustos +// flagPort = "port" +// flagChainId = "chain-id" +// flagAddrCap = "addr-cap" +// flagIpCap = "ip-cap" +// +// defaultOutputFlag = "text" +// defaultKeyringBackend = "test" +// defaultDenom = "ustos" +// defaultChainId = "test-chain" +// defaultPort = "26600" +// defaultAddrCap = 1 +// defaultIpCap = 3 +// capDuration = 60 // in minutes +// +// maxAmtFaucet = 100000000000 +// requestInterval = 100 * time.Millisecond +//) +// +//// used in request channel +//type FaucetReq struct { +// FromAddress sdk.AccAddress +// FromName string +// From string +// +// ToAddr sdk.AccAddress +// resChan chan FaucetRsp +// Index int +//} +// +//// used in response channel +//type FaucetRsp struct { +// ErrorMsg string +// TxResponse sdk.TxResponse +// Seq uint64 +//} +// +//// used for restful response +//type RestFaucetRsp struct { +// ErrorMsg string +// TxResponse sdk.TxResponse +//} +// +//type FaucetToMiddleware struct { +// Cap int // maximum faucet cap to an individual addr during an hour +// AddrCache ttlcache.SimpleCache +//} +// +//type FromIpMiddleware struct { +// Cap int // maximum accessing times during an hour +// IpCache ttlcache.SimpleCache +//} +// +//func (ftm *FaucetToMiddleware) Middleware(h http.Handler) http.Handler { +// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// vars := mux.Vars(r) +// addr := vars["address"] +// if ftm.checkCap(addr) { +// h.ServeHTTP(w, r) +// } else { +// w.WriteHeader(http.StatusTooManyRequests) +// w.Write([]byte("Faucet request to address [" + addr + "] exceeds hourly cap (" + strconv.Itoa(ftm.Cap) + " request(s) per hour)")) +// } +// }) +//} +// +//func (ftm *FaucetToMiddleware) checkCap(toAddr string) bool { +// val, _ := ftm.AddrCache.Get(toAddr) +// if val == nil { +// ftm.AddrCache.Set(toAddr, 1) +// return true +// } +// +// if val.(int) >= ftm.Cap { +// return false +// } +// ftm.AddrCache.Set(toAddr, val.(int)+1) +// return true +//} +// +//func (fim *FromIpMiddleware) Middleware(h http.Handler) http.Handler { +// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// realIp := getRealAddr(r) +// if fim.checkCap(realIp) { +// h.ServeHTTP(w, r) +// } else { +// fmt.Printf(" ********** request from %s breached ip cap\n", realIp) +// w.WriteHeader(http.StatusTooManyRequests) +// w.Write([]byte("Faucet request from Ip " + realIp + " exceeds hourly cap (" + strconv.Itoa(fim.Cap) + " request(s) per hour)!")) +// } +// }) +//} +// +//func (fim *FromIpMiddleware) checkCap(fromIp string) bool { +// val, _ := fim.IpCache.Get(fromIp) +// if val == nil { +// fim.IpCache.Set(fromIp, 1) +// return true +// } +// +// if val.(int) >= fim.Cap { +// return false +// } +// fim.IpCache.Set(fromIp, val.(int)+1) +// return true +//} +// +//// global to load command line args +//var ( +// faucetServices = make([]FaucetService, 0) +// faucetPort = defaultPort +//) +// +//// struct to hold the command-line args +//type FaucetService struct { +// fromAddress sdk.AccAddress +// fromName string +// from string +// coins sdk.Coins +// seqInfo SeqInfo +//} +// +//type ServiceIndex struct { +// nextServiceIndex int +// lenOfService int +// mux sync.Mutex +//} +// +//func (si *ServiceIndex) getIndexAndScrollNext() int { +// if si.lenOfService < 1 { +// return 0 +// } +// si.mux.Lock() +// defer si.mux.Unlock() +// ret := si.nextServiceIndex +// if si.nextServiceIndex < si.lenOfService-1 { +// si.nextServiceIndex += 1 +// } else { +// si.nextServiceIndex = 0 +// } +// return ret +//} +// +//type SeqInfo struct { +// lastSuccSeq int +// startSeq int +// mu sync.Mutex +//} +// +//func (si *SeqInfo) incrLastSuccSeq(succSeq uint64) { +// si.mu.Lock() +// defer si.mu.Unlock() +// if si.lastSuccSeq < int(succSeq) { +// si.lastSuccSeq = int(succSeq) +// } +//} +// +//func (si *SeqInfo) getNewSeq(newStartSeq int) int { +// si.mu.Lock() +// defer si.mu.Unlock() +// +// if si.lastSuccSeq < newStartSeq-1 { +// si.lastSuccSeq = newStartSeq - 1 +// return newStartSeq +// } else { +// return si.lastSuccSeq + 1 +// } +//} +// +//func FaucetJobFromCh(faucetReq *chan FaucetReq, cliCtx context.CLIContext, txBldr authtypes.TxBuilder, from sdk.AccAddress, coin sdk.Coin, quit chan os.Signal) { +// for { +// select { +// case sig := <-quit: +// fmt.Printf("**** faucet service (sender[%s]) quit after receiving signal[%s] ****\n", from, sig.String()) +// os.Exit(0) +// case fReq := <-*faucetReq: +// resChan := fReq.resChan +// // update cliCtx +// cliCtx := cliCtx.WithFromName(fReq.FromName).WithFrom(fReq.From).WithFromAddress(fReq.FromAddress) +// +// // get latest seq and accountNumber by FromAddress +// accountNumber, latestSeq, err := authtypes.NewAccountRetriever(cliCtx).GetAccountNumberSequence(fReq.FromAddress) +// if err != nil { +// faucetRsp := FaucetRsp{ErrorMsg: "Node is under maintenance, please try again later!"} +// resChan <- faucetRsp +// continue +// } +// fmt.Printf("----sender[%s] senderIdx[%d] accNum[%d] lastSeq[%d] -----\n", cliCtx.From, fReq.Index, int(accountNumber), int(latestSeq)) +// newSeq := faucetServices[fReq.Index].seqInfo.getNewSeq(int(latestSeq)) +// err = doTransfer(cliCtx, +// txBldr. +// WithAccountNumber(accountNumber). +// WithSequence(uint64(newSeq)). +// WithChainID(viper.GetString(flags.FlagChainID)). +// WithGas(uint64(400000)). +// WithMemo(strconv.Itoa(newSeq)), +// fReq.ToAddr, fReq.FromAddress, coin, &resChan) +// if err != nil { +// faucetRsp := FaucetRsp{ErrorMsg: err.Error()} +// resChan <- faucetRsp +// } +// } +// } +//} +// +//// GetFaucetCmd returns faucet cobra Command +//func GetFaucetCmd(cdc *codec.Codec) *cobra.Command { +// +// cmd := &cobra.Command{ +// Use: "faucet", +// Short: "Run a faucet server", +// Args: cobra.RangeArgs(0, 7), +// RunE: func(cmd *cobra.Command, args []string) (err error) { +// if !viper.IsSet(flagFundFrom) { +// return fmt.Errorf("fund-from not specified") +// } +// if !viper.IsSet(flags.FlagChainID) { +// return fmt.Errorf("chain-id not specified") +// } +// if !viper.IsSet(flags.FlagKeyringBackend) { +// viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) +// } +// +// addrCap := viper.GetInt(flagAddrCap) +// ipCap := viper.GetInt(flagIpCap) +// +// fmt.Print("Set hourly addrCap = " + strconv.Itoa(addrCap) + ", hourly ipCap = " + strconv.Itoa(ipCap)) +// +// faucetToCache := ttlcache.NewCache() +// faucetToCache.SetTTL(capDuration * time.Minute) +// faucetToCache.SkipTTLExtensionOnHit(true) +// faucetToCache.SetCacheSizeLimit(65535) +// ftm := FaucetToMiddleware{AddrCache: faucetToCache, Cap: addrCap} +// +// fromIpCache := ttlcache.NewCache() +// fromIpCache.SetTTL(capDuration * time.Minute) +// fromIpCache.SkipTTLExtensionOnHit(true) +// fromIpCache.SetCacheSizeLimit(65535) +// fim := FromIpMiddleware{IpCache: fromIpCache, Cap: ipCap} +// +// // parse coins to transfer +// var toTransferAmt int +// if toTransferAmt = viper.GetInt(flagAmt); toTransferAmt <= 0 || toTransferAmt > maxAmtFaucet { +// return fmt.Errorf("invalid amount in faucet") +// } +// coin := sdk.Coin{Amount: sdk.NewInt(int64(toTransferAmt)), Denom: defaultDenom} +// +// // parse funding accs +// fromAddressesStr := viper.GetString(flagFundFrom) +// fundAccs := strings.Split(fromAddressesStr, ",") +// if len(fundAccs) < 1 { +// return fmt.Errorf("at least 1 funding acc need to be specified for faucet") +// } +// inBuf := bufio.NewReader(cmd.InOrStdin()) +// faucetReqChList := make([]chan FaucetReq, 0) +// chQuitSlice := make([]chan os.Signal, 0) +// for _, acc := range fundAccs { +// fromAddress, fromName, err := context.GetFromFields(inBuf, acc, false) +// if err != nil { +// return fmt.Errorf("failed to parse bech32 address fro FROM Address: %w", err) +// } +// +// service := FaucetService{ +// fromAddress: fromAddress, +// fromName: fromName, +// from: acc, +// coins: sdk.Coins{coin}, +// seqInfo: SeqInfo{startSeq: 0, lastSuccSeq: 0}, +// } +// faucetServices = append(faucetServices, service) +// // new reqCh for service +// reqCh := make(chan FaucetReq, 10000) +// faucetReqChList = append(faucetReqChList, reqCh) +// +// // new quit signal +// quit := make(chan os.Signal, 1) +// signal.Notify(quit, +// syscall.SIGTERM, +// syscall.SIGINT, +// syscall.SIGQUIT, +// syscall.SIGKILL, +// syscall.SIGHUP, +// ) +// chQuitSlice = append(chQuitSlice, quit) +// } +// if len(faucetServices) != len(faucetReqChList) { +// return fmt.Errorf("failed to setup context for each funding accs") +// } +// //fmt.Printf("FaucetServices are [%v]", faucetServices) +// // start threads +// txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) +// viper.Set(flags.FlagSkipConfirmation, true) +// viper.Set(cli.OutputFlag, defaultOutputFlag) +// +// cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, faucetServices[0].fromAddress.String()).WithCodec(cdc) +// +// // setup port +// portFromCmd := viper.GetString(flagPort) +// if len(portFromCmd) > 0 { +// faucetPort = portFromCmd +// } +// fmt.Print("\nfunding address: ", "addr", fromAddressesStr) +// fmt.Print("\nStarting faucet...") +// // listen to localhost:faucetPort +// listener, err := net.Listen("tcp", ":"+faucetPort) +// fmt.Print("\nlisten to [" + ":" + faucetPort + "]\n") +// +// // init serviceIndex +// serviceIndex := ServiceIndex{ +// nextServiceIndex: 0, +// lenOfService: len(faucetServices), +// } +// +// // router +// r := mux.NewRouter() +// // health check +// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { +// w.WriteHeader(http.StatusOK) +// w.Write([]byte("ok\n")) +// }) +// //faucetReqCh := make(chan FaucetReq, 10000) +// //faucet +// r.HandleFunc("/faucet/{address}", func(writer http.ResponseWriter, request *http.Request) { +// vars := mux.Vars(request) +// addr := vars["address"] +// remoteIp := getRealAddr(request) +// toAddr, err := sdk.AccAddressFromBech32(addr) +// if err != nil { +// writer.WriteHeader(http.StatusBadRequest) +// writer.Write([]byte(err.Error())) +// } +// // select a context (bonded with funding acc) +// reqIndex := serviceIndex.getIndexAndScrollNext() +// fmt.Printf("get request from ip [%s], faucet to account [%s], senderIdx[%d]\n", remoteIp, addr, reqIndex) +// resChan := make(chan FaucetRsp) +// faucetReq := FaucetReq{ +// FromAddress: faucetServices[reqIndex].fromAddress, +// FromName: faucetServices[reqIndex].fromName, +// From: faucetServices[reqIndex].from, +// ToAddr: toAddr, +// resChan: resChan, +// Index: reqIndex, +// } +// faucetReqChList[reqIndex] <- faucetReq +// +// faucetRsp := <-resChan +// if int(faucetRsp.TxResponse.Code) < 1 && len(faucetRsp.ErrorMsg) == 0 { +// // sigverify pass +// faucetServices[reqIndex].seqInfo.incrLastSuccSeq(faucetRsp.Seq) +// } +// fmt.Println("tx send=", faucetRsp.TxResponse.TxHash, ", height=", faucetRsp.TxResponse.Height, ", errorMsg=", faucetRsp.ErrorMsg, ", ip=", remoteIp, ", acc=", addr) +// restRsp := &RestFaucetRsp{ErrorMsg: faucetRsp.ErrorMsg, TxResponse: faucetRsp.TxResponse} +// rest.PostProcessResponseBare(writer, cliCtx, restRsp) +// return +// }).Methods("POST") +// // ipCap check has higher priority than toAddrCap +// r.Use(fim.Middleware) +// r.Use(ftm.Middleware) +// +// for i, _ := range faucetServices { +// go FaucetJobFromCh(&faucetReqChList[i], cliCtx, txBldr, faucetServices[i].fromAddress, coin, chQuitSlice[i]) +// } +// //start the server +// err = http.Serve(listener, r) +// if err != nil { +// fmt.Println(err.Error()) +// } +// // print stats +// fmt.Println("####################################################################") +// fmt.Println("################ Terminating faucet ##################") +// fmt.Println("####################################################################") +// return nil +// }, +// } +// +// cmd.Flags().String(flags.FlagKeyringBackend, defaultKeyringBackend, "Select keyring's backend (os|file|test)") +// cmd.Flags().String(flagAmt, "", "amt to transfer in faucet") +// cmd.Flags().String(flagFundFrom, "", "fund from address") +// cmd.Flags().String(flagPort, "26600", "port of faucet server") +// cmd.Flags().Int(flagAddrCap, defaultAddrCap, "hourly cap of faucet to a particular account address") +// cmd.Flags().Int(flagIpCap, defaultIpCap, "hourly cap of faucet from a particular IP") +// +// return cmd +//} +// +//func doTransfer(cliCtx context.CLIContext, txBldr authtypes.TxBuilder, to sdk.AccAddress, from sdk.AccAddress, coin sdk.Coin, resChan *chan FaucetRsp) error { +// //// build and sign the transaction, then broadcast to Tendermint +// msg := bank.NewMsgSend(from, to, sdk.Coins{coin}) +// msgs := []sdk.Msg{msg} +// txBldr, err := utils.PrepareTxBuilder(txBldr, cliCtx) +// if err != nil { +// return err +// } +// +// fromName := cliCtx.GetFromName() +// +// if txBldr.SimulateAndExecute() || cliCtx.Simulate { +// txBldr, err = utils.EnrichWithGas(txBldr, cliCtx, msgs) +// if err != nil { +// return err +// } +// +// gasEst := utils.GasEstimateResponse{GasEstimate: txBldr.Gas()} +// _, _ = fmt.Fprintf(os.Stderr, "%s\n", gasEst.String()) +// } +// +// if !cliCtx.SkipConfirm { +// stdSignMsg, err := txBldr.BuildSignMsg(msgs) +// if err != nil { +// return err +// } +// +// var json []byte +// if viper.GetBool(flags.FlagIndentResponse) { +// json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ") +// if err != nil { +// panic(err) +// } +// } else { +// json = cliCtx.Codec.MustMarshalJSON(stdSignMsg) +// } +// +// _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", json) +// +// buf := bufio.NewReader(os.Stdin) +// ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf) +// if err != nil || !ok { +// _, _ = fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction") +// return err +// } +// } +// // build and sign the transaction +// txBytes, err := txBldr.BuildAndSign(fromName, keys.DefaultKeyPass, msgs) +// if err != nil { +// return err +// } +// +// // broadcast to a Tendermint node +// res, err := cliCtx.BroadcastTxCommit(txBytes) +// if err != nil { +// return err +// } +// faucetRsp := FaucetRsp{TxResponse: res, Seq: txBldr.Sequence()} +// *resChan <- faucetRsp +// return nil +//} +// +//func getRealAddr(r *http.Request) string { +// remoteIP := "" +// // the default is the originating ip. but we try to find better options because this is almost +// // never the right IP +// if parts := strings.Split(r.RemoteAddr, ":"); len(parts) == 2 { +// remoteIP = parts[0] +// } +// // If we have a forwarded-for header, take the address from there +// if xff := strings.Trim(r.Header.Get("X-Forwarded-For"), ","); len(xff) > 0 { +// addrs := strings.Split(xff, ",") +// lastFwd := addrs[len(addrs)-1] +// if ip := net.ParseIP(lastFwd); ip != nil { +// remoteIP = ip.String() +// } +// // parse X-Real-Ip header +// } else if xri := r.Header.Get("X-Real-Ip"); len(xri) > 0 { +// if ip := net.ParseIP(xri); ip != nil { +// remoteIP = ip.String() +// } +// } +// return remoteIP +//} diff --git a/cmd/stchaincli/main.go b/cmd/stchaincli/main.go index 3716923c..bd9744b9 100644 --- a/cmd/stchaincli/main.go +++ b/cmd/stchaincli/main.go @@ -1,182 +1,182 @@ package main -import ( - "fmt" - "os" - "path" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/lcd" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/auth" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" - "github.com/cosmos/cosmos-sdk/x/bank" - bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" - govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - reportcmd "github.com/stratosnet/stratos-chain/x/pot/client/cli" - uploadcmd "github.com/stratosnet/stratos-chain/x/sds/client/cli" - - "github.com/spf13/cobra" - "github.com/spf13/viper" - - "github.com/tendermint/go-amino" - "github.com/tendermint/tendermint/libs/cli" - - "github.com/stratosnet/stratos-chain/app" - // this line is used by starport scaffolding # 1 -) - -func main() { - // Configure cobra to sort commands - cobra.EnableCommandSorting = false - - // Instantiate the codec for the command line application - cdc := app.MakeCodec() - - app.SetConfig() - - // TODO: setup keybase, viper object, etc. to be passed into - // the below functions and eliminate global vars, like we do - // with the cdc - - rootCmd := &cobra.Command{ - Use: "stchaincli", - Short: "Command line interface for interacting with stratoschaind", - } - - // Add --chain-id to persistent flags and mark it required - rootCmd.PersistentFlags().String(flags.FlagChainID, "", "Chain ID of tendermint node") - rootCmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error { - return initConfig(rootCmd) - } - - // Construct Root Command - rootCmd.AddCommand( - rpc.StatusCommand(), - client.ConfigCmd(app.DefaultCLIHome), - queryCmd(cdc), - txCmd(cdc), - flags.LineBreak, - lcd.ServeCommand(cdc, registerRoutes), - flags.LineBreak, - GetFaucetCmd(cdc), - flags.LineBreak, - keys.Commands(), - flags.LineBreak, - version.Cmd, - flags.NewCompletionCmd(rootCmd, true), - - flags.LineBreak, - ) - - // Add flags and prefix all env exposed with AA - executor := cli.PrepareMainCmd(rootCmd, "AA", app.DefaultCLIHome) - - err := executor.Execute() - if err != nil { - fmt.Printf("Failed executing CLI command: %s, exiting...\n", err) - os.Exit(1) - } -} - -func queryCmd(cdc *amino.Codec) *cobra.Command { - queryCmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - } - - queryCmd.AddCommand( - authcmd.GetAccountCmd(cdc), - flags.LineBreak, - rpc.ValidatorCommand(cdc), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(cdc), - authcmd.QueryTxCmd(cdc), - flags.LineBreak, - ) - - // add modules' query commands - app.ModuleBasics.AddQueryCommands(queryCmd, cdc) - - return queryCmd -} - -func txCmd(cdc *amino.Codec) *cobra.Command { - txCmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - } - - txCmd.AddCommand( - bankcmd.SendTxCmd(cdc), - flags.LineBreak, - uploadcmd.FileUploadTxCmd(cdc), - reportcmd.VolumeReportCmd(cdc), - flags.LineBreak, - govcmd.GetCmdSubmitProposal(cdc), - govcmd.GetCmdDeposit(cdc), - govcmd.GetCmdVote(cdc), - flags.LineBreak, - authcmd.GetSignCommand(cdc), - authcmd.GetMultiSignCommand(cdc), - flags.LineBreak, - authcmd.GetBroadcastCommand(cdc), - authcmd.GetEncodeCommand(cdc), - authcmd.GetDecodeCommand(cdc), - flags.LineBreak, - ) - - // add modules' tx commands - app.ModuleBasics.AddTxCommands(txCmd, cdc) - - // remove auth and bank commands as they're mounted under the root tx command - var cmdsToRemove []*cobra.Command - - for _, cmd := range txCmd.Commands() { - if cmd.Use == auth.ModuleName || cmd.Use == bank.ModuleName { - cmdsToRemove = append(cmdsToRemove, cmd) - } - } - - txCmd.RemoveCommand(cmdsToRemove...) - - return txCmd -} - -// registerRoutes registers the routes from the different modules for the LCD. -// NOTE: details on the routes added for each module are in the module documentation -// NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go -func registerRoutes(rs *lcd.RestServer) { - client.RegisterRoutes(rs.CliCtx, rs.Mux) - authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) - app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) - // this line is used by starport scaffolding # 2 -} - -func initConfig(cmd *cobra.Command) error { - home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) - if err != nil { - return err - } - - cfgFile := path.Join(home, "config", "config.toml") - if _, err := os.Stat(cfgFile); err == nil { - viper.SetConfigFile(cfgFile) - - if err := viper.ReadInConfig(); err != nil { - return err - } - } - if err := viper.BindPFlag(flags.FlagChainID, cmd.PersistentFlags().Lookup(flags.FlagChainID)); err != nil { - return err - } - if err := viper.BindPFlag(cli.EncodingFlag, cmd.PersistentFlags().Lookup(cli.EncodingFlag)); err != nil { - return err - } - return viper.BindPFlag(cli.OutputFlag, cmd.PersistentFlags().Lookup(cli.OutputFlag)) -} +//import ( +// "fmt" +// "os" +// "path" +// +// "github.com/cosmos/cosmos-sdk/client" +// "github.com/cosmos/cosmos-sdk/client/flags" +// "github.com/cosmos/cosmos-sdk/client/keys" +// "github.com/cosmos/cosmos-sdk/client/lcd" +// "github.com/cosmos/cosmos-sdk/client/rpc" +// "github.com/cosmos/cosmos-sdk/version" +// "github.com/cosmos/cosmos-sdk/x/auth" +// authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" +// authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" +// "github.com/cosmos/cosmos-sdk/x/bank" +// bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" +// govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli" +// reportcmd "github.com/stratosnet/stratos-chain/x/pot/client/cli" +// uploadcmd "github.com/stratosnet/stratos-chain/x/sds/client/cli" +// +// "github.com/spf13/cobra" +// "github.com/spf13/viper" +// +// "github.com/tendermint/go-amino" +// "github.com/tendermint/tendermint/libs/cli" +// +// "github.com/stratosnet/stratos-chain/app" +// // this line is used by starport scaffolding # 1 +//) +// +//func main() { +// // Configure cobra to sort commands +// cobra.EnableCommandSorting = false +// +// // Instantiate the codec for the command line application +// cdc := app.MakeCodec() +// +// app.SetConfig() +// +// // TODO: setup keybase, viper object, etc. to be passed into +// // the below functions and eliminate global vars, like we do +// // with the cdc +// +// rootCmd := &cobra.Command{ +// Use: "stchaincli", +// Short: "Command line interface for interacting with stratoschaind", +// } +// +// // Add --chain-id to persistent flags and mark it required +// rootCmd.PersistentFlags().String(flags.FlagChainID, "", "Chain ID of tendermint node") +// rootCmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error { +// return initConfig(rootCmd) +// } +// +// // Construct Root Command +// rootCmd.AddCommand( +// rpc.StatusCommand(), +// client.ConfigCmd(app.DefaultCLIHome), +// queryCmd(cdc), +// txCmd(cdc), +// flags.LineBreak, +// lcd.ServeCommand(cdc, registerRoutes), +// flags.LineBreak, +// GetFaucetCmd(cdc), +// flags.LineBreak, +// keys.Commands(), +// flags.LineBreak, +// version.Cmd, +// flags.NewCompletionCmd(rootCmd, true), +// +// flags.LineBreak, +// ) +// +// // Add flags and prefix all env exposed with AA +// executor := cli.PrepareMainCmd(rootCmd, "AA", app.DefaultCLIHome) +// +// err := executor.Execute() +// if err != nil { +// fmt.Printf("Failed executing CLI command: %s, exiting...\n", err) +// os.Exit(1) +// } +//} +// +//func queryCmd(cdc *amino.Codec) *cobra.Command { +// queryCmd := &cobra.Command{ +// Use: "query", +// Aliases: []string{"q"}, +// Short: "Querying subcommands", +// } +// +// queryCmd.AddCommand( +// authcmd.GetAccountCmd(cdc), +// flags.LineBreak, +// rpc.ValidatorCommand(cdc), +// rpc.BlockCommand(), +// authcmd.QueryTxsByEventsCmd(cdc), +// authcmd.QueryTxCmd(cdc), +// flags.LineBreak, +// ) +// +// // add modules' query commands +// app.ModuleBasics.AddQueryCommands(queryCmd, cdc) +// +// return queryCmd +//} +// +//func txCmd(cdc *amino.Codec) *cobra.Command { +// txCmd := &cobra.Command{ +// Use: "tx", +// Short: "Transactions subcommands", +// } +// +// txCmd.AddCommand( +// bankcmd.SendTxCmd(cdc), +// flags.LineBreak, +// uploadcmd.FileUploadTxCmd(cdc), +// reportcmd.VolumeReportCmd(cdc), +// flags.LineBreak, +// govcmd.GetCmdSubmitProposal(cdc), +// govcmd.GetCmdDeposit(cdc), +// govcmd.GetCmdVote(cdc), +// flags.LineBreak, +// authcmd.GetSignCommand(cdc), +// authcmd.GetMultiSignCommand(cdc), +// flags.LineBreak, +// authcmd.GetBroadcastCommand(cdc), +// authcmd.GetEncodeCommand(cdc), +// authcmd.GetDecodeCommand(cdc), +// flags.LineBreak, +// ) +// +// // add modules' tx commands +// app.ModuleBasics.AddTxCommands(txCmd, cdc) +// +// // remove auth and bank commands as they're mounted under the root tx command +// var cmdsToRemove []*cobra.Command +// +// for _, cmd := range txCmd.Commands() { +// if cmd.Use == auth.ModuleName || cmd.Use == bank.ModuleName { +// cmdsToRemove = append(cmdsToRemove, cmd) +// } +// } +// +// txCmd.RemoveCommand(cmdsToRemove...) +// +// return txCmd +//} +// +//// registerRoutes registers the routes from the different modules for the LCD. +//// NOTE: details on the routes added for each module are in the module documentation +//// NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go +//func registerRoutes(rs *lcd.RestServer) { +// client.RegisterRoutes(rs.CliCtx, rs.Mux) +// authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) +// app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) +// // this line is used by starport scaffolding # 2 +//} +// +//func initConfig(cmd *cobra.Command) error { +// home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) +// if err != nil { +// return err +// } +// +// cfgFile := path.Join(home, "config", "config.toml") +// if _, err := os.Stat(cfgFile); err == nil { +// viper.SetConfigFile(cfgFile) +// +// if err := viper.ReadInConfig(); err != nil { +// return err +// } +// } +// if err := viper.BindPFlag(flags.FlagChainID, cmd.PersistentFlags().Lookup(flags.FlagChainID)); err != nil { +// return err +// } +// if err := viper.BindPFlag(cli.EncodingFlag, cmd.PersistentFlags().Lookup(cli.EncodingFlag)); err != nil { +// return err +// } +// return viper.BindPFlag(cli.OutputFlag, cmd.PersistentFlags().Lookup(cli.OutputFlag)) +//} diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index 59158a41..ad43d8ee 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -1,162 +1,162 @@ package main -import ( - "encoding/json" - "fmt" - "io/ioutil" - "os" - "path/filepath" - - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/types/errors" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/genutil" - "github.com/spf13/cobra" - "github.com/spf13/viper" - "github.com/stratosnet/stratos-chain/x/register" - "github.com/tendermint/tendermint/libs/cli" - tmtypes "github.com/tendermint/tendermint/types" -) - -const ( - defaultDemon = "ustos" - flagGenIdxNodeDir = "gen-idx-node-dir" -) - -// GenesisAccountsIterator defines the expected iterating genesis accounts object -type GenesisAccountsIterator interface { - IterateGenesisAccounts( - cdc *codec.Codec, - appGenesis map[string]json.RawMessage, - iterateFn func(authexported.Account) (stop bool), - ) -} - -func getIndexingNodeInfoFromFile(cdc *codec.Codec, genIdxNodesDir string, genDoc tmtypes.GenesisDoc, genAccIterator GenesisAccountsIterator, -) (appGenIdxNodes []register.IndexingNode, err error) { - var fos []os.FileInfo - fos, err = ioutil.ReadDir(genIdxNodesDir) - if err != nil { - return appGenIdxNodes, err - } - - var appState map[string]json.RawMessage - if err := cdc.UnmarshalJSON(genDoc.AppState, &appState); err != nil { - return appGenIdxNodes, err - } - - addrMap := make(map[string]authexported.Account) - genAccIterator.IterateGenesisAccounts(cdc, appState, - func(acc authexported.Account) (stop bool) { - addrMap[acc.GetAddress().String()] = acc - return false - }, - ) - - for _, fo := range fos { - filename := filepath.Join(genIdxNodesDir, fo.Name()) - if !fo.IsDir() && (filepath.Ext(filename) != ".json") { - continue - } - - // get the node info - var jsonRawIdxNode []byte - if jsonRawIdxNode, err = ioutil.ReadFile(filename); err != nil { - return appGenIdxNodes, err - } - - var genIdxNode register.GenesisIndexingNode - if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { - return appGenIdxNodes, err - } - - indexingNode := genIdxNode.ToIndexingNode() - appGenIdxNodes = append(appGenIdxNodes, indexingNode) - - ownerAddrStr := indexingNode.GetOwnerAddr().String() - ownerAccount, ownerOk := addrMap[ownerAddrStr] - if !ownerOk { - return appGenIdxNodes, fmt.Errorf( - "account %v not in genesis.json: %+v", ownerAccount, addrMap) - } - - if ownerAccount.GetCoins().AmountOf(defaultDemon).LT(indexingNode.GetTokens()) { - return appGenIdxNodes, fmt.Errorf( - "insufficient fund for delegation %v: %v < %v", - ownerAccount.GetAddress(), ownerAccount.GetCoins().AmountOf(defaultDemon), indexingNode.GetTokens(), - ) - } - fmt.Println("Add indexing node: " + indexingNode.NetworkAddr.String() + " success.") - } - - return appGenIdxNodes, nil -} - -// AddGenesisIndexingNodeCmd returns add-genesis-indexing-node cobra Command. -func AddGenesisIndexingNodeCmd( - ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, genAccIterator GenesisAccountsIterator, -) *cobra.Command { - - cmd := &cobra.Command{ - Use: "add-genesis-indexing-node", - Short: "Add a genesis indexing node to genesis.json", - Long: `Add a genesis indexing node to genesis.json. If a node name is given, -the address will be looked up in the local Keybase. -`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - config := ctx.Config - config.SetRoot(viper.GetString(cli.HomeFlag)) - - genDoc, err := tmtypes.GenesisDocFromFile(config.GenesisFile()) - if err != nil { - return errors.Wrap(err, "failed to read genesis doc from file") - } - - genIdxNodesDir := viper.GetString(flagGenIdxNodeDir) - if genIdxNodesDir == "" { - genIdxNodesDir = filepath.Join(config.RootDir, "config", "genidxnodes") - } - - appIdxNodes, err := getIndexingNodeInfoFromFile(cdc, genIdxNodesDir, *genDoc, genAccIterator) - if err != nil { - return fmt.Errorf("failed to get indexing node from file: %w", err) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - registerGenState := register.GetGenesisStateFromAppState(cdc, appState) - - for _, appIdxNode := range appIdxNodes { - registerGenState.IndexingNodes = append(registerGenState.IndexingNodes, appIdxNode) - } - - registerGenStateBz, err := cdc.MarshalJSON(registerGenState) - if err != nil { - return fmt.Errorf("failed to marshal register genesis state: %w", err) - } - - appState[register.ModuleName] = registerGenStateBz - - appStateJSON, err := cdc.MarshalJSON(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") - cmd.Flags().String(flagGenIdxNodeDir, "", "directory of genesis indexing nodes info") - return cmd -} +//import ( +// "encoding/json" +// "fmt" +// "io/ioutil" +// "os" +// "path/filepath" +// +// "github.com/cosmos/cosmos-sdk/client/flags" +// "github.com/cosmos/cosmos-sdk/codec" +// "github.com/cosmos/cosmos-sdk/server" +// "github.com/cosmos/cosmos-sdk/types/errors" +// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" +// "github.com/cosmos/cosmos-sdk/x/genutil" +// "github.com/spf13/cobra" +// "github.com/spf13/viper" +// "github.com/stratosnet/stratos-chain/x/register" +// "github.com/tendermint/tendermint/libs/cli" +// tmtypes "github.com/tendermint/tendermint/types" +//) +// +//const ( +// defaultDemon = "ustos" +// flagGenIdxNodeDir = "gen-idx-node-dir" +//) +// +//// GenesisAccountsIterator defines the expected iterating genesis accounts object +//type GenesisAccountsIterator interface { +// IterateGenesisAccounts( +// cdc *codec.Codec, +// appGenesis map[string]json.RawMessage, +// iterateFn func(authexported.Account) (stop bool), +// ) +//} +// +//func getIndexingNodeInfoFromFile(cdc *codec.Codec, genIdxNodesDir string, genDoc tmtypes.GenesisDoc, genAccIterator GenesisAccountsIterator, +//) (appGenIdxNodes []register.IndexingNode, err error) { +// var fos []os.FileInfo +// fos, err = ioutil.ReadDir(genIdxNodesDir) +// if err != nil { +// return appGenIdxNodes, err +// } +// +// var appState map[string]json.RawMessage +// if err := cdc.UnmarshalJSON(genDoc.AppState, &appState); err != nil { +// return appGenIdxNodes, err +// } +// +// addrMap := make(map[string]authexported.Account) +// genAccIterator.IterateGenesisAccounts(cdc, appState, +// func(acc authexported.Account) (stop bool) { +// addrMap[acc.GetAddress().String()] = acc +// return false +// }, +// ) +// +// for _, fo := range fos { +// filename := filepath.Join(genIdxNodesDir, fo.Name()) +// if !fo.IsDir() && (filepath.Ext(filename) != ".json") { +// continue +// } +// +// // get the node info +// var jsonRawIdxNode []byte +// if jsonRawIdxNode, err = ioutil.ReadFile(filename); err != nil { +// return appGenIdxNodes, err +// } +// +// var genIdxNode register.GenesisIndexingNode +// if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { +// return appGenIdxNodes, err +// } +// +// indexingNode := genIdxNode.ToIndexingNode() +// appGenIdxNodes = append(appGenIdxNodes, indexingNode) +// +// ownerAddrStr := indexingNode.GetOwnerAddr().String() +// ownerAccount, ownerOk := addrMap[ownerAddrStr] +// if !ownerOk { +// return appGenIdxNodes, fmt.Errorf( +// "account %v not in genesis.json: %+v", ownerAccount, addrMap) +// } +// +// if ownerAccount.GetCoins().AmountOf(defaultDemon).LT(indexingNode.GetTokens()) { +// return appGenIdxNodes, fmt.Errorf( +// "insufficient fund for delegation %v: %v < %v", +// ownerAccount.GetAddress(), ownerAccount.GetCoins().AmountOf(defaultDemon), indexingNode.GetTokens(), +// ) +// } +// fmt.Println("Add indexing node: " + indexingNode.NetworkAddr.String() + " success.") +// } +// +// return appGenIdxNodes, nil +//} +// +//// AddGenesisIndexingNodeCmd returns add-genesis-indexing-node cobra Command. +//func AddGenesisIndexingNodeCmd( +// ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, genAccIterator GenesisAccountsIterator, +//) *cobra.Command { +// +// cmd := &cobra.Command{ +// Use: "add-genesis-indexing-node", +// Short: "Add a genesis indexing node to genesis.json", +// Long: `Add a genesis indexing node to genesis.json. If a node name is given, +//the address will be looked up in the local Keybase. +//`, +// Args: cobra.ExactArgs(0), +// RunE: func(cmd *cobra.Command, args []string) error { +// config := ctx.Config +// config.SetRoot(viper.GetString(cli.HomeFlag)) +// +// genDoc, err := tmtypes.GenesisDocFromFile(config.GenesisFile()) +// if err != nil { +// return errors.Wrap(err, "failed to read genesis doc from file") +// } +// +// genIdxNodesDir := viper.GetString(flagGenIdxNodeDir) +// if genIdxNodesDir == "" { +// genIdxNodesDir = filepath.Join(config.RootDir, "config", "genidxnodes") +// } +// +// appIdxNodes, err := getIndexingNodeInfoFromFile(cdc, genIdxNodesDir, *genDoc, genAccIterator) +// if err != nil { +// return fmt.Errorf("failed to get indexing node from file: %w", err) +// } +// +// genFile := config.GenesisFile() +// appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) +// if err != nil { +// return fmt.Errorf("failed to unmarshal genesis state: %w", err) +// } +// +// registerGenState := register.GetGenesisStateFromAppState(cdc, appState) +// +// for _, appIdxNode := range appIdxNodes { +// registerGenState.IndexingNodes = append(registerGenState.IndexingNodes, appIdxNode) +// } +// +// registerGenStateBz, err := cdc.MarshalJSON(registerGenState) +// if err != nil { +// return fmt.Errorf("failed to marshal register genesis state: %w", err) +// } +// +// appState[register.ModuleName] = registerGenStateBz +// +// appStateJSON, err := cdc.MarshalJSON(appState) +// if err != nil { +// return fmt.Errorf("failed to marshal application genesis state: %w", err) +// } +// +// genDoc.AppState = appStateJSON +// return genutil.ExportGenesisFile(genDoc, genFile) +// }, +// } +// +// cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") +// cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") +// cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") +// cmd.Flags().String(flagGenIdxNodeDir, "", "directory of genesis indexing nodes info") +// return cmd +//} diff --git a/cmd/stchaind/genaccounts.go b/cmd/stchaind/genaccounts.go index 031e6576..275e9ded 100644 --- a/cmd/stchaind/genaccounts.go +++ b/cmd/stchaind/genaccounts.go @@ -1,153 +1,153 @@ package main -import ( - "bufio" - "errors" - "fmt" - - "github.com/spf13/cobra" - "github.com/spf13/viper" - - "github.com/tendermint/tendermint/libs/cli" - - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/crypto/keys" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting" - "github.com/cosmos/cosmos-sdk/x/genutil" -) - -const ( - flagClientHome = "home-client" - flagVestingStart = "vesting-start-time" - flagVestingEnd = "vesting-end-time" - flagVestingAmt = "vesting-amount" -) - -// AddGenesisAccountCmd returns add-genesis-account cobra Command. -func AddGenesisAccountCmd( - ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, -) *cobra.Command { - - cmd := &cobra.Command{ - Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", - Short: "Add a genesis account to genesis.json", - Long: `Add a genesis account to genesis.json. The provided account must specify -the account address or key name and a list of initial coins. If a key name is given, -the address will be looked up in the local Keybase. The list of initial tokens must -contain valid denominations. Accounts may optionally be supplied with vesting parameters. -`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - config := ctx.Config - config.SetRoot(viper.GetString(cli.HomeFlag)) - - addr, err := sdk.AccAddressFromBech32(args[0]) - inBuf := bufio.NewReader(cmd.InOrStdin()) - if err != nil { - // attempt to lookup address from Keybase if no address was provided - kb, err := keys.NewKeyring( - sdk.KeyringServiceName(), - viper.GetString(flags.FlagKeyringBackend), - viper.GetString(flagClientHome), - inBuf, - ) - if err != nil { - return err - } - - info, err := kb.Get(args[0]) - if err != nil { - return fmt.Errorf("failed to get address from Keybase: %w", err) - } - - addr = info.GetAddress() - } - - coins, err := sdk.ParseCoins(args[1]) - if err != nil { - return fmt.Errorf("failed to parse coins: %w", err) - } - - vestingStart := viper.GetInt64(flagVestingStart) - vestingEnd := viper.GetInt64(flagVestingEnd) - vestingAmt, err := sdk.ParseCoins(viper.GetString(flagVestingAmt)) - if err != nil { - return fmt.Errorf("failed to parse vesting amount: %w", err) - } - - // create concrete account type based on input parameters - var genAccount authexported.GenesisAccount - - baseAccount := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0) - if !vestingAmt.IsZero() { - baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) - if err != nil { - return fmt.Errorf("failed to create base vesting account: %w", err) - } - - switch { - case vestingStart != 0 && vestingEnd != 0: - genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) - - case vestingEnd != 0: - genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) - - default: - return errors.New("invalid vesting parameters; must supply start and end time or end time") - } - } else { - genAccount = baseAccount - } - - if err := genAccount.Validate(); err != nil { - return fmt.Errorf("failed to validate new genesis account: %w", err) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - authGenState := auth.GetGenesisStateFromAppState(cdc, appState) - - if authGenState.Accounts.Contains(addr) { - return fmt.Errorf("cannot add account at existing address %s", addr) - } - - // Add the new account to the set of genesis accounts and sanitize the - // accounts afterwards. - authGenState.Accounts = append(authGenState.Accounts, genAccount) - authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts) - - authGenStateBz, err := cdc.MarshalJSON(authGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - - appState[auth.ModuleName] = authGenStateBz - - appStateJSON, err := cdc.MarshalJSON(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") - cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") - cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") - cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") - - return cmd -} +//import ( +// "bufio" +// "errors" +// "fmt" +// +// "github.com/spf13/cobra" +// "github.com/spf13/viper" +// +// "github.com/tendermint/tendermint/libs/cli" +// +// "github.com/cosmos/cosmos-sdk/client/flags" +// "github.com/cosmos/cosmos-sdk/codec" +// "github.com/cosmos/cosmos-sdk/crypto/keys" +// "github.com/cosmos/cosmos-sdk/server" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" +// authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting" +// "github.com/cosmos/cosmos-sdk/x/genutil" +//) +// +//const ( +// flagClientHome = "home-client" +// flagVestingStart = "vesting-start-time" +// flagVestingEnd = "vesting-end-time" +// flagVestingAmt = "vesting-amount" +//) +// +//// AddGenesisAccountCmd returns add-genesis-account cobra Command. +//func AddGenesisAccountCmd( +// ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, +//) *cobra.Command { +// +// cmd := &cobra.Command{ +// Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", +// Short: "Add a genesis account to genesis.json", +// Long: `Add a genesis account to genesis.json. The provided account must specify +//the account address or key name and a list of initial coins. If a key name is given, +//the address will be looked up in the local Keybase. The list of initial tokens must +//contain valid denominations. Accounts may optionally be supplied with vesting parameters. +//`, +// Args: cobra.ExactArgs(2), +// RunE: func(cmd *cobra.Command, args []string) error { +// config := ctx.Config +// config.SetRoot(viper.GetString(cli.HomeFlag)) +// +// addr, err := sdk.AccAddressFromBech32(args[0]) +// inBuf := bufio.NewReader(cmd.InOrStdin()) +// if err != nil { +// // attempt to lookup address from Keybase if no address was provided +// kb, err := keys.NewKeyring( +// sdk.KeyringServiceName(), +// viper.GetString(flags.FlagKeyringBackend), +// viper.GetString(flagClientHome), +// inBuf, +// ) +// if err != nil { +// return err +// } +// +// info, err := kb.Get(args[0]) +// if err != nil { +// return fmt.Errorf("failed to get address from Keybase: %w", err) +// } +// +// addr = info.GetAddress() +// } +// +// coins, err := sdk.ParseCoins(args[1]) +// if err != nil { +// return fmt.Errorf("failed to parse coins: %w", err) +// } +// +// vestingStart := viper.GetInt64(flagVestingStart) +// vestingEnd := viper.GetInt64(flagVestingEnd) +// vestingAmt, err := sdk.ParseCoins(viper.GetString(flagVestingAmt)) +// if err != nil { +// return fmt.Errorf("failed to parse vesting amount: %w", err) +// } +// +// // create concrete account type based on input parameters +// var genAccount authexported.GenesisAccount +// +// baseAccount := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0) +// if !vestingAmt.IsZero() { +// baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) +// if err != nil { +// return fmt.Errorf("failed to create base vesting account: %w", err) +// } +// +// switch { +// case vestingStart != 0 && vestingEnd != 0: +// genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) +// +// case vestingEnd != 0: +// genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) +// +// default: +// return errors.New("invalid vesting parameters; must supply start and end time or end time") +// } +// } else { +// genAccount = baseAccount +// } +// +// if err := genAccount.Validate(); err != nil { +// return fmt.Errorf("failed to validate new genesis account: %w", err) +// } +// +// genFile := config.GenesisFile() +// appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) +// if err != nil { +// return fmt.Errorf("failed to unmarshal genesis state: %w", err) +// } +// +// authGenState := auth.GetGenesisStateFromAppState(cdc, appState) +// +// if authGenState.Accounts.Contains(addr) { +// return fmt.Errorf("cannot add account at existing address %s", addr) +// } +// +// // Add the new account to the set of genesis accounts and sanitize the +// // accounts afterwards. +// authGenState.Accounts = append(authGenState.Accounts, genAccount) +// authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts) +// +// authGenStateBz, err := cdc.MarshalJSON(authGenState) +// if err != nil { +// return fmt.Errorf("failed to marshal auth genesis state: %w", err) +// } +// +// appState[auth.ModuleName] = authGenStateBz +// +// appStateJSON, err := cdc.MarshalJSON(appState) +// if err != nil { +// return fmt.Errorf("failed to marshal application genesis state: %w", err) +// } +// +// genDoc.AppState = appStateJSON +// return genutil.ExportGenesisFile(genDoc, genFile) +// }, +// } +// +// cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") +// cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") +// cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") +// cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") +// cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") +// cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") +// +// return cmd +//} diff --git a/cmd/stchaind/loadtest.go b/cmd/stchaind/loadtest.go index 658e2249..55b95ef8 100644 --- a/cmd/stchaind/loadtest.go +++ b/cmd/stchaind/loadtest.go @@ -1,537 +1,537 @@ package main -import ( - "bufio" - "encoding/json" - "fmt" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/cosmos/cosmos-sdk/x/auth/exported" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/spf13/cobra" - "github.com/spf13/viper" - "github.com/tendermint/tendermint/libs/cli" - tmtypes "github.com/tendermint/tendermint/types" - "os" - "os/signal" - "strconv" - "strings" - "sync" - "time" -) - -const ( - flagThreads = "threads" - flagInterval = "interval" - flagRandomRecv = "random-recv" - flagMaxTx = "max-tx" - flagAddr = "addr" - flagShowTxHash = "show-txhash" - flagSkipInit = "skip-init" - - defaultOutputFlag = "text" - - defaultNodeURI = "tcp://127.0.0.1:26657" - defaultKeyringBackend = "test" - defaultHome = "build/node/stchaincli" - defaultDenom = "ustos" - defaultChainId = "test-chain" -) - -//var ModuleCdc *codec.Codec - -// global to load command line args -var loadTestArgs = LoadTestArgs{} - -// struct to hold the command-line args -type LoadTestArgs struct { - threads int // no. of threads in the load test; for concurrency - interval int // interval (in milliseconds) between two successive send transactions on a thread - randomRecv bool // whether to send tokens to a random address every time or no, the default is false - maxTx int // max transactions after which the load test should stop, default is 10000(10k) - address []byte -} - -func LoadTestCommands(ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "load", - Short: "Run a load test", - Long: `Run a load test with fixed senders or random senders`, - } - cmd.AddCommand( - AddFixedLoadTestCmd(ctx, cdc, defaultNodeHome, defaultClientHome), - AddRandomLoadTestCmd(ctx, cdc, defaultNodeHome, defaultClientHome), - ) - return cmd -} - -// AddLoadTestCmd returns load test cobra Command. -func AddFixedLoadTestCmd( - ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, -) *cobra.Command { - - cmd := &cobra.Command{ - Use: "fixed", - Short: "Run a load test with fixed senders and receivers", - Args: cobra.RangeArgs(0, 5), - RunE: func(cmd *cobra.Command, args []string) (err error) { - config := ctx.Config - config.SetRoot(viper.GetString(cli.HomeFlag)) - - loadTestArgs.threads = viper.GetInt(flagThreads) - loadTestArgs.interval = viper.GetInt(flagInterval) - loadTestArgs.maxTx = viper.GetInt(flagMaxTx) - loadTestArgs.randomRecv = viper.GetBool(flagRandomRecv) - senderAddr := viper.GetString(flagAddr) - senderAddrBytes, err := sdk.AccAddressFromBech32(senderAddr) - if err != nil { - return fmt.Errorf("failed to parse bech32 address: %w", err) - } - loadTestArgs.address = senderAddrBytes - - if loadTestArgs.address == nil { - genesis := ctx.Config.GenesisFile() - loadTestArgs.address, err = getFirstAccAddressFromGenesis(cdc, genesis) - if err != nil { - return fmt.Errorf("failed to parse genesis: %w", err) - } - fmt.Printf("No sender account specified, using accounts in genesis for load test\n") - } - - ctx.Logger.Info("Starting load test with fixed senders/receivers...") - - // create a channel to catch os.Interrupt from a SIGTERM or similar kill signal - c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) - - // create vars for concurrency management - stopChan := make(chan bool, loadTestArgs.threads) - waiter := sync.WaitGroup{} - counterChan := make(chan int, loadTestArgs.threads) - - // spawn a goroutine to handle sigterm and max transactions - waiter.Add(1) - counter := 0 - go handleSigTerm(c, counterChan, stopChan, loadTestArgs.threads, loadTestArgs.maxTx, &waiter, &counter) - - genesis := ctx.Config.GenesisFile() - accsFromGenesis, err := getAllAccAddressFromGenesis(cdc, genesis) - if err != nil { - return fmt.Errorf("failed to parse bech32 address: %w", err) - } - - if loadTestArgs.threads > len(accsFromGenesis) { - loadTestArgs.threads = len(accsFromGenesis) - fmt.Printf("Total available accounts: %d, max threads num set to %d", len(accsFromGenesis), len(accsFromGenesis)) - } - seqStart := make(map[int]uint64) - // start threads - for i := 0; i < loadTestArgs.threads; i++ { - inBuf := bufio.NewReader(cmd.InOrStdin()) - if !viper.IsSet(flags.FlagChainID) { - viper.Set(flags.FlagChainID, defaultChainId) - } - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)).WithChainID(viper.GetString(flags.FlagChainID)) - viper.Set(flags.FlagBroadcastMode, "async") - viper.Set(flags.FlagSkipConfirmation, true) - if !viper.IsSet(flags.FlagKeyringBackend) { - viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) - } - if viper.GetBool(flagShowTxHash) { - viper.Set(cli.OutputFlag, defaultOutputFlag) - } - if !viper.IsSet(flags.FlagNode) { - viper.Set(flags.FlagNode, defaultNodeURI) - } - if !viper.IsSet(flags.FlagHome) { - viper.Set(flags.FlagHome, defaultHome) - } - viper.Set(flags.FlagTrustNode, true) - from := accsFromGenesis[i] - if len(loadTestArgs.address) != 0 { - from = loadTestArgs.address - } - cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, from.String()).WithCodec(cdc) - to := accsFromGenesis[0] - if len(accsFromGenesis)-1 > i && (i != loadTestArgs.threads-1 || i == 0) { - to = accsFromGenesis[i+1] - } - ctx.Logger.Info(fmt.Sprintf("thread: %d, from addr %s, to addr %s", i, from, to)) - txBldr, _ = utils.PrepareTxBuilder(txBldr, cliCtx) - ctx.Logger.Info(fmt.Sprintf("thread: %d, first sequence in this thread: %d\n", i, int(txBldr.Sequence()))) - seqStart[i] = txBldr.Sequence() - - // single-threading start -------- - //for j := 0; j < loadTestArgs.maxTx; j++ { - // ctx.Logger.Info(fmt.Sprintf("current sequence: %d\n", int(firstSeqUint64+uint64(j)))) - // doSendTransaction(cliCtx, txBldr.WithSequence(seqStart[i]+uint64(j)), i, to, from, loadTestArgs.randomRecv, sdk.Coin{Amount: sdk.NewInt(10), Denom: defaultDenom}, seqStart[i]) // send coin to temp account - // counter += 1 - //} - // single-threading end -------- - - // multi-threading start -------- - threadIndex := i - threadTo := to - threadFrom := from - threadTxBldr := txBldr - threadCliCtx := cliCtx - // start a thread to keep sending transactions after some interval - go func(stop chan bool) { - waitDuration := getWaitDuration(loadTestArgs.interval) - cliCtx.SkipConfirm = true - iter := 0 - for true { - currSeqInt := int(seqStart[threadIndex] + uint64(iter)) - ctx.Logger.Info(fmt.Sprintf("thread: %d, sending tx with sequence: %d\n", threadIndex, currSeqInt)) - doSendTransaction(threadCliCtx, threadTxBldr.WithSequence(seqStart[threadIndex]+uint64(iter)).WithMemo(strconv.Itoa(currSeqInt)).WithGas(uint64(400000)), threadIndex, threadTo, threadFrom, loadTestArgs.randomRecv, sdk.Coin{Amount: sdk.NewInt(1), Denom: defaultDenom}, seqStart[threadIndex]) // send coin to temp account - iter += 1 - counterChan <- 1 - - select { - case <-stop: - waiter.Done() - return - default: - time.Sleep(waitDuration) - } - } - }(stopChan) - } - //// wait for all threads to close through sigterm; indefinitely - waiter.Wait() - // multi-threading end -------- - - // print stats - fmt.Println("####################################################################") - fmt.Println("################ Terminating load test ###############") - fmt.Println("####################################################################") - fmt.Printf("################ Messages sent: % 9d ###############\n", counter) - fmt.Println("####################################################################") - return nil - }, - } - - cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") - cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().Int(flagThreads, 1, "no. of threads in the load test; for concurrency") - cmd.Flags().Int(flagInterval, 10, "interval (in milliseconds) between two successive send transactions on a thread") - cmd.Flags().Bool(flagRandomRecv, false, "whether to send tokens to a random address every time or no, the default is false") - cmd.Flags().Bool(flagShowTxHash, false, "whether to show tx hash after sending it") - cmd.Flags().Int(flagMaxTx, 10000, "max transactions after which the load test should stop, default is 10000(10k)") - cmd.Flags().String(flagAddr, "", "fund address that load test uses") - cmd.Flags().String(flags.FlagChainID, "", "chain id") - - return cmd -} - -// AddLoadTestCmd returns load test cobra Command. -func AddRandomLoadTestCmd( - ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, -) *cobra.Command { - - cmd := &cobra.Command{ - Use: "random", - Short: "Run a load test with random senders and receivers", - Args: cobra.RangeArgs(0, 1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - config := ctx.Config - config.SetRoot(viper.GetString(cli.HomeFlag)) - - loadTestArgs.threads = viper.GetInt(flagThreads) - loadTestArgs.interval = viper.GetInt(flagInterval) - loadTestArgs.maxTx = viper.GetInt(flagMaxTx) - loadTestArgs.randomRecv = viper.GetBool(flagRandomRecv) - senderAddr := viper.GetString(flagAddr) - senderAddrBytes, err := sdk.AccAddressFromBech32(senderAddr) - if err != nil { - return fmt.Errorf("failed to parse bech32 address: %w", err) - } - loadTestArgs.address = senderAddrBytes - - if loadTestArgs.address == nil { - genesis := ctx.Config.GenesisFile() - loadTestArgs.address, err = getFirstAccAddressFromGenesis(cdc, genesis) - if err != nil { - return fmt.Errorf("failed to parse genesis: %w", err) - } - fmt.Printf("No sender account specified, using accounts in genesis for load test\n") - } - - ctx.Logger.Info("Starting load test with random senders/receivers...") - - // create a channel to catch os.Interrupt from a SIGTERM or similar kill signal - c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) - - // create vars for concurrency management - stopChan := make(chan bool, loadTestArgs.threads) - waiter := sync.WaitGroup{} - counterChan := make(chan int, loadTestArgs.threads) - - // spawn a goroutine to handle sigterm and max transactions - waiter.Add(1) - counter := 0 - go handleSigTerm(c, counterChan, stopChan, loadTestArgs.threads, loadTestArgs.maxTx, &waiter, &counter) - - genesis := ctx.Config.GenesisFile() - accsFromGenesis, err := getAllAccAddressFromGenesis(cdc, genesis) - if err != nil { - return fmt.Errorf("failed to parse bech32 address: %w", err) - } - - fundFrom := accsFromGenesis[0] - if len(loadTestArgs.address) != 0 { - fundFrom = loadTestArgs.address - } - - inBuf := bufio.NewReader(cmd.InOrStdin()) - if !viper.IsSet(flags.FlagChainID) { - viper.Set(flags.FlagChainID, defaultChainId) - } - - if !viper.GetBool(flagSkipInit) { - initDistribution(ctx, inBuf, cdc, fundFrom, accsFromGenesis) - } - - if loadTestArgs.threads > len(accsFromGenesis) { - loadTestArgs.threads = len(accsFromGenesis) - fmt.Printf("Total available accounts: %d, max threads num set to %d", len(accsFromGenesis), len(accsFromGenesis)) - } - - fmt.Printf("Start testing in multiple threads\n") - seqStart := make(map[int]uint64) - // start threads - for i := 0; i < loadTestArgs.threads; i++ { - //waiter.Add(1) - inBuf := bufio.NewReader(cmd.InOrStdin()) - if !viper.IsSet(flags.FlagChainID) { - viper.Set(flags.FlagChainID, defaultChainId) - } - //if !viper.IsSet("gas") { - // viper.Set("gas", flags.GasFlagAuto) - //} - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)).WithChainID(viper.GetString(flags.FlagChainID)) - viper.Set(flags.FlagBroadcastMode, "block") - viper.Set(flags.FlagSkipConfirmation, true) - if !viper.IsSet(flags.FlagKeyringBackend) { - viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) - } - if viper.GetBool(flagShowTxHash) { - viper.Set(cli.OutputFlag, defaultOutputFlag) - } - if !viper.IsSet(flags.FlagNode) { - viper.Set(flags.FlagNode, defaultNodeURI) - } - if !viper.IsSet(flags.FlagHome) { - viper.Set(flags.FlagHome, defaultHome) - } - viper.Set(flags.FlagTrustNode, true) - - //ctx.Logger.Info(fmt.Sprintf("From addr: %s, chain-id: %s, keyring-backend: %s, home: %s", from.String(), - cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, accsFromGenesis[i].String()).WithCodec(cdc) - from := accsFromGenesis[i] - to := accsFromGenesis[0] - if len(accsFromGenesis) > i && (i != loadTestArgs.threads-1 || i == 0) { - to = accsFromGenesis[i+1] - } - ctx.Logger.Info(fmt.Sprintf("thread: %d, from addr %s, to addr %s", i, accsFromGenesis[i], to)) - txBldr, _ = utils.PrepareTxBuilder(txBldr, cliCtx) - ctx.Logger.Info(fmt.Sprintf("thread: %d, first sequence in this thread: %d\n", i, int(txBldr.Sequence()))) - seqStart[i] = txBldr.Sequence() - - // multi-threading start -------- - threadIndex := i - threadTo := to - threadFrom := from - threadTxBldr := txBldr - threadCliCtx := cliCtx - // start a thread to keep sending transactions after some interval - go func(stop chan bool) { - waitDuration := getWaitDuration(loadTestArgs.interval) - cliCtx.SkipConfirm = true - iter := 0 - for true { - currSeqInt := int(seqStart[threadIndex] + uint64(iter)) - ctx.Logger.Info(fmt.Sprintf("thread: %d, sending tx with sequence: %d\n", threadIndex, currSeqInt)) - doSendTransaction(threadCliCtx, threadTxBldr.WithSequence(seqStart[threadIndex]+uint64(iter)).WithMemo(strconv.Itoa(currSeqInt)).WithGas(uint64(400000)), threadIndex, threadTo, threadFrom, loadTestArgs.randomRecv, sdk.Coin{Amount: sdk.NewInt(1), Denom: defaultDenom}, seqStart[threadIndex]) // send coin to temp account - iter += 1 - counterChan <- 1 - - select { - case <-stop: - waiter.Done() - return - default: - time.Sleep(waitDuration) - } - } - }(stopChan) - } - //// wait for all threads to close through sigterm; indefinitely - waiter.Wait() - // multi-threading end -------- - - // print stats - fmt.Println("####################################################################") - fmt.Println("################ Terminating load test ###############") - fmt.Println("####################################################################") - fmt.Printf("################ Messages sent: % 9d ###############\n", counter) - fmt.Println("####################################################################") - return nil - }, - } - - cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") - cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().Int(flagThreads, 1, "no. of threads in the load test; for concurrency") - cmd.Flags().Int(flagInterval, 10, "interval (in milliseconds) between two successive send transactions on a thread") - cmd.Flags().Bool(flagRandomRecv, true, "whether to send tokens to a random address every time or no, the default is false") - cmd.Flags().Bool(flagShowTxHash, false, "whether to show tx hash after sending it") - cmd.Flags().Bool(flagSkipInit, false, "whether to skip init distribution") - cmd.Flags().Int(flagMaxTx, 10000, "max transactions after which the load test should stop, default is 10000(10k)") - cmd.Flags().String(flagAddr, "", "fund address that load test uses") - cmd.Flags().String(flags.FlagChainID, "", "chain id") - - return cmd -} - -func initDistribution(ctx *server.Context, inBuf *bufio.Reader, cdc *codec.Codec, fundFrom sdk.AccAddress, accsFromGenesis []sdk.AccAddress) { - txBldrFund := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)).WithChainID(viper.GetString(flags.FlagChainID)) - viper.Set(flags.FlagBroadcastMode, "async") - viper.Set(flags.FlagSkipConfirmation, true) - if !viper.IsSet(flags.FlagKeyringBackend) { - viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) - } - if viper.GetBool(flagShowTxHash) { - viper.Set(cli.OutputFlag, defaultOutputFlag) - } - if !viper.IsSet(flags.FlagNode) { - viper.Set(flags.FlagNode, defaultNodeURI) - } - if !viper.IsSet(flags.FlagHome) { - viper.Set(flags.FlagHome, defaultHome) - } - //if !viper.IsSet("gas") { - // viper.Set("gas", flags.GasFlagAuto) - //} - viper.Set(flags.FlagTrustNode, true) - - cliCtxFund := context.NewCLIContextWithInputAndFrom(inBuf, fundFrom.String()).WithCodec(cdc) - txBldrFund, _ = utils.PrepareTxBuilder(txBldrFund, cliCtxFund) - seqStartFund := txBldrFund.Sequence() - ctx.Logger.Info(fmt.Sprintf("Preparing funds for each test account, seq starts from %d", int(seqStartFund))) - doInitDistribution(ctx, cliCtxFund, txBldrFund, seqStartFund, fundFrom, accsFromGenesis, sdk.Coin{Amount: sdk.NewInt(1000000000), Denom: defaultDenom}) -} - -func doInitDistribution(ctx *server.Context, cliCtx context.CLIContext, txBldr authtypes.TxBuilder, seqStartFund uint64, fundAcc sdk.AccAddress, subAccs []sdk.AccAddress, coin sdk.Coin) { - for i := 0; i < len(subAccs); i++ { - msg := bank.NewMsgSend(fundAcc, subAccs[i], sdk.Coins{coin}) - currSeqInt := seqStartFund + uint64(i) - //// build and sign the transaction, then broadcast to Tendermint - err := utils.GenerateOrBroadcastMsgs(cliCtx, txBldr.WithSequence(currSeqInt).WithGas(uint64(400000)), []sdk.Msg{msg}) - ctx.Logger.Info(fmt.Sprintf("Transfered fund to account %s (index: %d, seq: %d)", subAccs[i].String(), i, int(currSeqInt))) - if err != nil { - fmt.Println(err) - } - time.Sleep(getWaitDuration(20)) // 20ms - } -} - -// doSendTransaction takes in an account and currency object and sends random amounts of coin from the -// node account. It prints any errors to ctx.logger and returns -func doSendTransaction(cliCtx context.CLIContext, txBldr authtypes.TxBuilder, threadNo int, to sdk.AccAddress, from sdk.AccAddress, randomRev bool, coin sdk.Coin, firstSeq uint64) { - msg := bank.NewMsgSend(from, to, sdk.Coins{coin}) - //// build and sign the transaction, then broadcast to Tendermint - err := utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) - if err != nil { - fmt.Println(err) - } -} - -// handleSigTerm keeps a count of messages sent and if the maximum number of transactions is reached it stops -// all threads and proceeds to shut down the main thread. If it catches a SIGTERM or a CTRL C it similarly shuts down -// gracefully. This function is blocking and is called as a go routine. -func handleSigTerm(c chan os.Signal, counterChan chan int, stopChan chan bool, - n int, maxTx int, waiter *sync.WaitGroup, cnt *int) { - - // indefinite loop listens over the counter and os.Signal for interrupt signal - for true { - select { - case <-c: - // signal the goroutines to stop - for i := 0; i < n; i++ { - stopChan <- true - } - // wait for the goroutines to stop - time.Sleep(time.Second) - - waiter.Done() - - case <-counterChan: - // increment counter - *cnt++ - - // send shutdown signal if max no. of transactions is reached - if *cnt >= maxTx { - c <- os.Interrupt - } - } - } -} - -func getAllAccAddressFromGenesis(cdc *codec.Codec, genesisFilePath string) (accAddrs []sdk.AccAddress, err error) { - var genDoc *tmtypes.GenesisDoc - if genDoc, err = tmtypes.GenesisDocFromFile(strings.ReplaceAll(genesisFilePath, "cli", "d")); err != nil { - return nil, fmt.Errorf("error loading genesis doc from %s: %s", genesisFilePath, err.Error()) - } - var genState map[string]json.RawMessage - if err = cdc.UnmarshalJSON(genDoc.AppState, &genState); err != nil { - return nil, fmt.Errorf("error unmarshalling genesis doc %s: %s", genesisFilePath, err.Error()) - } - var addresses []sdk.AccAddress - auth.GenesisAccountIterator{}.IterateGenesisAccounts( - cdc, genState, func(acc exported.Account) (stop bool) { - addresses = append(addresses, acc.GetAddress()) - return false - }, - ) - if len(addresses) > 0 { - return addresses, nil - } - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "No account initiated in genesis") -} - -func getWaitDuration(interval int) time.Duration { - return time.Millisecond * time.Duration(interval) -} - -func getFirstAccAddressFromGenesis(cdc *codec.Codec, genesisFilePath string) (accAddr sdk.AccAddress, err error) { - var genDoc *tmtypes.GenesisDoc - if genDoc, err = tmtypes.GenesisDocFromFile(strings.ReplaceAll(genesisFilePath, "cli", "d")); err != nil { - return nil, fmt.Errorf("error loading genesis doc from %s: %s", genesisFilePath, err.Error()) - } - var genState map[string]json.RawMessage - if err = cdc.UnmarshalJSON(genDoc.AppState, &genState); err != nil { - return nil, fmt.Errorf("error unmarshalling genesis doc %s: %s", genesisFilePath, err.Error()) - } - var addresses []sdk.AccAddress - auth.GenesisAccountIterator{}.IterateGenesisAccounts( - cdc, genState, func(acc exported.Account) (stop bool) { - addresses = append(addresses, acc.GetAddress()) - return false - }, - ) - if len(addresses) > 0 { - return addresses[0], nil - } - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "No account initiated in genesis") -} +//import ( +// "bufio" +// "encoding/json" +// "fmt" +// "github.com/cosmos/cosmos-sdk/client/context" +// "github.com/cosmos/cosmos-sdk/client/flags" +// "github.com/cosmos/cosmos-sdk/codec" +// "github.com/cosmos/cosmos-sdk/server" +// sdk "github.com/cosmos/cosmos-sdk/types" +// sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +// "github.com/cosmos/cosmos-sdk/x/auth" +// "github.com/cosmos/cosmos-sdk/x/auth/client/utils" +// "github.com/cosmos/cosmos-sdk/x/auth/exported" +// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/spf13/cobra" +// "github.com/spf13/viper" +// "github.com/tendermint/tendermint/libs/cli" +// tmtypes "github.com/tendermint/tendermint/types" +// "os" +// "os/signal" +// "strconv" +// "strings" +// "sync" +// "time" +//) +// +//const ( +// flagThreads = "threads" +// flagInterval = "interval" +// flagRandomRecv = "random-recv" +// flagMaxTx = "max-tx" +// flagAddr = "addr" +// flagShowTxHash = "show-txhash" +// flagSkipInit = "skip-init" +// +// defaultOutputFlag = "text" +// +// defaultNodeURI = "tcp://127.0.0.1:26657" +// defaultKeyringBackend = "test" +// defaultHome = "build/node/stchaincli" +// defaultDenom = "ustos" +// defaultChainId = "test-chain" +//) +// +////var ModuleCdc *codec.Codec +// +//// global to load command line args +//var loadTestArgs = LoadTestArgs{} +// +//// struct to hold the command-line args +//type LoadTestArgs struct { +// threads int // no. of threads in the load test; for concurrency +// interval int // interval (in milliseconds) between two successive send transactions on a thread +// randomRecv bool // whether to send tokens to a random address every time or no, the default is false +// maxTx int // max transactions after which the load test should stop, default is 10000(10k) +// address []byte +//} +// +//func LoadTestCommands(ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string) *cobra.Command { +// cmd := &cobra.Command{ +// Use: "load", +// Short: "Run a load test", +// Long: `Run a load test with fixed senders or random senders`, +// } +// cmd.AddCommand( +// AddFixedLoadTestCmd(ctx, cdc, defaultNodeHome, defaultClientHome), +// AddRandomLoadTestCmd(ctx, cdc, defaultNodeHome, defaultClientHome), +// ) +// return cmd +//} +// +//// AddLoadTestCmd returns load test cobra Command. +//func AddFixedLoadTestCmd( +// ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, +//) *cobra.Command { +// +// cmd := &cobra.Command{ +// Use: "fixed", +// Short: "Run a load test with fixed senders and receivers", +// Args: cobra.RangeArgs(0, 5), +// RunE: func(cmd *cobra.Command, args []string) (err error) { +// config := ctx.Config +// config.SetRoot(viper.GetString(cli.HomeFlag)) +// +// loadTestArgs.threads = viper.GetInt(flagThreads) +// loadTestArgs.interval = viper.GetInt(flagInterval) +// loadTestArgs.maxTx = viper.GetInt(flagMaxTx) +// loadTestArgs.randomRecv = viper.GetBool(flagRandomRecv) +// senderAddr := viper.GetString(flagAddr) +// senderAddrBytes, err := sdk.AccAddressFromBech32(senderAddr) +// if err != nil { +// return fmt.Errorf("failed to parse bech32 address: %w", err) +// } +// loadTestArgs.address = senderAddrBytes +// +// if loadTestArgs.address == nil { +// genesis := ctx.Config.GenesisFile() +// loadTestArgs.address, err = getFirstAccAddressFromGenesis(cdc, genesis) +// if err != nil { +// return fmt.Errorf("failed to parse genesis: %w", err) +// } +// fmt.Printf("No sender account specified, using accounts in genesis for load test\n") +// } +// +// ctx.Logger.Info("Starting load test with fixed senders/receivers...") +// +// // create a channel to catch os.Interrupt from a SIGTERM or similar kill signal +// c := make(chan os.Signal, 1) +// signal.Notify(c, os.Interrupt) +// +// // create vars for concurrency management +// stopChan := make(chan bool, loadTestArgs.threads) +// waiter := sync.WaitGroup{} +// counterChan := make(chan int, loadTestArgs.threads) +// +// // spawn a goroutine to handle sigterm and max transactions +// waiter.Add(1) +// counter := 0 +// go handleSigTerm(c, counterChan, stopChan, loadTestArgs.threads, loadTestArgs.maxTx, &waiter, &counter) +// +// genesis := ctx.Config.GenesisFile() +// accsFromGenesis, err := getAllAccAddressFromGenesis(cdc, genesis) +// if err != nil { +// return fmt.Errorf("failed to parse bech32 address: %w", err) +// } +// +// if loadTestArgs.threads > len(accsFromGenesis) { +// loadTestArgs.threads = len(accsFromGenesis) +// fmt.Printf("Total available accounts: %d, max threads num set to %d", len(accsFromGenesis), len(accsFromGenesis)) +// } +// seqStart := make(map[int]uint64) +// // start threads +// for i := 0; i < loadTestArgs.threads; i++ { +// inBuf := bufio.NewReader(cmd.InOrStdin()) +// if !viper.IsSet(flags.FlagChainID) { +// viper.Set(flags.FlagChainID, defaultChainId) +// } +// txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)).WithChainID(viper.GetString(flags.FlagChainID)) +// viper.Set(flags.FlagBroadcastMode, "async") +// viper.Set(flags.FlagSkipConfirmation, true) +// if !viper.IsSet(flags.FlagKeyringBackend) { +// viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) +// } +// if viper.GetBool(flagShowTxHash) { +// viper.Set(cli.OutputFlag, defaultOutputFlag) +// } +// if !viper.IsSet(flags.FlagNode) { +// viper.Set(flags.FlagNode, defaultNodeURI) +// } +// if !viper.IsSet(flags.FlagHome) { +// viper.Set(flags.FlagHome, defaultHome) +// } +// viper.Set(flags.FlagTrustNode, true) +// from := accsFromGenesis[i] +// if len(loadTestArgs.address) != 0 { +// from = loadTestArgs.address +// } +// cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, from.String()).WithCodec(cdc) +// to := accsFromGenesis[0] +// if len(accsFromGenesis)-1 > i && (i != loadTestArgs.threads-1 || i == 0) { +// to = accsFromGenesis[i+1] +// } +// ctx.Logger.Info(fmt.Sprintf("thread: %d, from addr %s, to addr %s", i, from, to)) +// txBldr, _ = utils.PrepareTxBuilder(txBldr, cliCtx) +// ctx.Logger.Info(fmt.Sprintf("thread: %d, first sequence in this thread: %d\n", i, int(txBldr.Sequence()))) +// seqStart[i] = txBldr.Sequence() +// +// // single-threading start -------- +// //for j := 0; j < loadTestArgs.maxTx; j++ { +// // ctx.Logger.Info(fmt.Sprintf("current sequence: %d\n", int(firstSeqUint64+uint64(j)))) +// // doSendTransaction(cliCtx, txBldr.WithSequence(seqStart[i]+uint64(j)), i, to, from, loadTestArgs.randomRecv, sdk.Coin{Amount: sdk.NewInt(10), Denom: defaultDenom}, seqStart[i]) // send coin to temp account +// // counter += 1 +// //} +// // single-threading end -------- +// +// // multi-threading start -------- +// threadIndex := i +// threadTo := to +// threadFrom := from +// threadTxBldr := txBldr +// threadCliCtx := cliCtx +// // start a thread to keep sending transactions after some interval +// go func(stop chan bool) { +// waitDuration := getWaitDuration(loadTestArgs.interval) +// cliCtx.SkipConfirm = true +// iter := 0 +// for true { +// currSeqInt := int(seqStart[threadIndex] + uint64(iter)) +// ctx.Logger.Info(fmt.Sprintf("thread: %d, sending tx with sequence: %d\n", threadIndex, currSeqInt)) +// doSendTransaction(threadCliCtx, threadTxBldr.WithSequence(seqStart[threadIndex]+uint64(iter)).WithMemo(strconv.Itoa(currSeqInt)).WithGas(uint64(400000)), threadIndex, threadTo, threadFrom, loadTestArgs.randomRecv, sdk.Coin{Amount: sdk.NewInt(1), Denom: defaultDenom}, seqStart[threadIndex]) // send coin to temp account +// iter += 1 +// counterChan <- 1 +// +// select { +// case <-stop: +// waiter.Done() +// return +// default: +// time.Sleep(waitDuration) +// } +// } +// }(stopChan) +// } +// //// wait for all threads to close through sigterm; indefinitely +// waiter.Wait() +// // multi-threading end -------- +// +// // print stats +// fmt.Println("####################################################################") +// fmt.Println("################ Terminating load test ###############") +// fmt.Println("####################################################################") +// fmt.Printf("################ Messages sent: % 9d ###############\n", counter) +// fmt.Println("####################################################################") +// return nil +// }, +// } +// +// cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") +// cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") +// cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") +// cmd.Flags().Int(flagThreads, 1, "no. of threads in the load test; for concurrency") +// cmd.Flags().Int(flagInterval, 10, "interval (in milliseconds) between two successive send transactions on a thread") +// cmd.Flags().Bool(flagRandomRecv, false, "whether to send tokens to a random address every time or no, the default is false") +// cmd.Flags().Bool(flagShowTxHash, false, "whether to show tx hash after sending it") +// cmd.Flags().Int(flagMaxTx, 10000, "max transactions after which the load test should stop, default is 10000(10k)") +// cmd.Flags().String(flagAddr, "", "fund address that load test uses") +// cmd.Flags().String(flags.FlagChainID, "", "chain id") +// +// return cmd +//} +// +//// AddLoadTestCmd returns load test cobra Command. +//func AddRandomLoadTestCmd( +// ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, +//) *cobra.Command { +// +// cmd := &cobra.Command{ +// Use: "random", +// Short: "Run a load test with random senders and receivers", +// Args: cobra.RangeArgs(0, 1), +// RunE: func(cmd *cobra.Command, args []string) (err error) { +// config := ctx.Config +// config.SetRoot(viper.GetString(cli.HomeFlag)) +// +// loadTestArgs.threads = viper.GetInt(flagThreads) +// loadTestArgs.interval = viper.GetInt(flagInterval) +// loadTestArgs.maxTx = viper.GetInt(flagMaxTx) +// loadTestArgs.randomRecv = viper.GetBool(flagRandomRecv) +// senderAddr := viper.GetString(flagAddr) +// senderAddrBytes, err := sdk.AccAddressFromBech32(senderAddr) +// if err != nil { +// return fmt.Errorf("failed to parse bech32 address: %w", err) +// } +// loadTestArgs.address = senderAddrBytes +// +// if loadTestArgs.address == nil { +// genesis := ctx.Config.GenesisFile() +// loadTestArgs.address, err = getFirstAccAddressFromGenesis(cdc, genesis) +// if err != nil { +// return fmt.Errorf("failed to parse genesis: %w", err) +// } +// fmt.Printf("No sender account specified, using accounts in genesis for load test\n") +// } +// +// ctx.Logger.Info("Starting load test with random senders/receivers...") +// +// // create a channel to catch os.Interrupt from a SIGTERM or similar kill signal +// c := make(chan os.Signal, 1) +// signal.Notify(c, os.Interrupt) +// +// // create vars for concurrency management +// stopChan := make(chan bool, loadTestArgs.threads) +// waiter := sync.WaitGroup{} +// counterChan := make(chan int, loadTestArgs.threads) +// +// // spawn a goroutine to handle sigterm and max transactions +// waiter.Add(1) +// counter := 0 +// go handleSigTerm(c, counterChan, stopChan, loadTestArgs.threads, loadTestArgs.maxTx, &waiter, &counter) +// +// genesis := ctx.Config.GenesisFile() +// accsFromGenesis, err := getAllAccAddressFromGenesis(cdc, genesis) +// if err != nil { +// return fmt.Errorf("failed to parse bech32 address: %w", err) +// } +// +// fundFrom := accsFromGenesis[0] +// if len(loadTestArgs.address) != 0 { +// fundFrom = loadTestArgs.address +// } +// +// inBuf := bufio.NewReader(cmd.InOrStdin()) +// if !viper.IsSet(flags.FlagChainID) { +// viper.Set(flags.FlagChainID, defaultChainId) +// } +// +// if !viper.GetBool(flagSkipInit) { +// initDistribution(ctx, inBuf, cdc, fundFrom, accsFromGenesis) +// } +// +// if loadTestArgs.threads > len(accsFromGenesis) { +// loadTestArgs.threads = len(accsFromGenesis) +// fmt.Printf("Total available accounts: %d, max threads num set to %d", len(accsFromGenesis), len(accsFromGenesis)) +// } +// +// fmt.Printf("Start testing in multiple threads\n") +// seqStart := make(map[int]uint64) +// // start threads +// for i := 0; i < loadTestArgs.threads; i++ { +// //waiter.Add(1) +// inBuf := bufio.NewReader(cmd.InOrStdin()) +// if !viper.IsSet(flags.FlagChainID) { +// viper.Set(flags.FlagChainID, defaultChainId) +// } +// //if !viper.IsSet("gas") { +// // viper.Set("gas", flags.GasFlagAuto) +// //} +// txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)).WithChainID(viper.GetString(flags.FlagChainID)) +// viper.Set(flags.FlagBroadcastMode, "block") +// viper.Set(flags.FlagSkipConfirmation, true) +// if !viper.IsSet(flags.FlagKeyringBackend) { +// viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) +// } +// if viper.GetBool(flagShowTxHash) { +// viper.Set(cli.OutputFlag, defaultOutputFlag) +// } +// if !viper.IsSet(flags.FlagNode) { +// viper.Set(flags.FlagNode, defaultNodeURI) +// } +// if !viper.IsSet(flags.FlagHome) { +// viper.Set(flags.FlagHome, defaultHome) +// } +// viper.Set(flags.FlagTrustNode, true) +// +// //ctx.Logger.Info(fmt.Sprintf("From addr: %s, chain-id: %s, keyring-backend: %s, home: %s", from.String(), +// cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, accsFromGenesis[i].String()).WithCodec(cdc) +// from := accsFromGenesis[i] +// to := accsFromGenesis[0] +// if len(accsFromGenesis) > i && (i != loadTestArgs.threads-1 || i == 0) { +// to = accsFromGenesis[i+1] +// } +// ctx.Logger.Info(fmt.Sprintf("thread: %d, from addr %s, to addr %s", i, accsFromGenesis[i], to)) +// txBldr, _ = utils.PrepareTxBuilder(txBldr, cliCtx) +// ctx.Logger.Info(fmt.Sprintf("thread: %d, first sequence in this thread: %d\n", i, int(txBldr.Sequence()))) +// seqStart[i] = txBldr.Sequence() +// +// // multi-threading start -------- +// threadIndex := i +// threadTo := to +// threadFrom := from +// threadTxBldr := txBldr +// threadCliCtx := cliCtx +// // start a thread to keep sending transactions after some interval +// go func(stop chan bool) { +// waitDuration := getWaitDuration(loadTestArgs.interval) +// cliCtx.SkipConfirm = true +// iter := 0 +// for true { +// currSeqInt := int(seqStart[threadIndex] + uint64(iter)) +// ctx.Logger.Info(fmt.Sprintf("thread: %d, sending tx with sequence: %d\n", threadIndex, currSeqInt)) +// doSendTransaction(threadCliCtx, threadTxBldr.WithSequence(seqStart[threadIndex]+uint64(iter)).WithMemo(strconv.Itoa(currSeqInt)).WithGas(uint64(400000)), threadIndex, threadTo, threadFrom, loadTestArgs.randomRecv, sdk.Coin{Amount: sdk.NewInt(1), Denom: defaultDenom}, seqStart[threadIndex]) // send coin to temp account +// iter += 1 +// counterChan <- 1 +// +// select { +// case <-stop: +// waiter.Done() +// return +// default: +// time.Sleep(waitDuration) +// } +// } +// }(stopChan) +// } +// //// wait for all threads to close through sigterm; indefinitely +// waiter.Wait() +// // multi-threading end -------- +// +// // print stats +// fmt.Println("####################################################################") +// fmt.Println("################ Terminating load test ###############") +// fmt.Println("####################################################################") +// fmt.Printf("################ Messages sent: % 9d ###############\n", counter) +// fmt.Println("####################################################################") +// return nil +// }, +// } +// +// cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") +// cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") +// cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") +// cmd.Flags().Int(flagThreads, 1, "no. of threads in the load test; for concurrency") +// cmd.Flags().Int(flagInterval, 10, "interval (in milliseconds) between two successive send transactions on a thread") +// cmd.Flags().Bool(flagRandomRecv, true, "whether to send tokens to a random address every time or no, the default is false") +// cmd.Flags().Bool(flagShowTxHash, false, "whether to show tx hash after sending it") +// cmd.Flags().Bool(flagSkipInit, false, "whether to skip init distribution") +// cmd.Flags().Int(flagMaxTx, 10000, "max transactions after which the load test should stop, default is 10000(10k)") +// cmd.Flags().String(flagAddr, "", "fund address that load test uses") +// cmd.Flags().String(flags.FlagChainID, "", "chain id") +// +// return cmd +//} +// +//func initDistribution(ctx *server.Context, inBuf *bufio.Reader, cdc *codec.Codec, fundFrom sdk.AccAddress, accsFromGenesis []sdk.AccAddress) { +// txBldrFund := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)).WithChainID(viper.GetString(flags.FlagChainID)) +// viper.Set(flags.FlagBroadcastMode, "async") +// viper.Set(flags.FlagSkipConfirmation, true) +// if !viper.IsSet(flags.FlagKeyringBackend) { +// viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) +// } +// if viper.GetBool(flagShowTxHash) { +// viper.Set(cli.OutputFlag, defaultOutputFlag) +// } +// if !viper.IsSet(flags.FlagNode) { +// viper.Set(flags.FlagNode, defaultNodeURI) +// } +// if !viper.IsSet(flags.FlagHome) { +// viper.Set(flags.FlagHome, defaultHome) +// } +// //if !viper.IsSet("gas") { +// // viper.Set("gas", flags.GasFlagAuto) +// //} +// viper.Set(flags.FlagTrustNode, true) +// +// cliCtxFund := context.NewCLIContextWithInputAndFrom(inBuf, fundFrom.String()).WithCodec(cdc) +// txBldrFund, _ = utils.PrepareTxBuilder(txBldrFund, cliCtxFund) +// seqStartFund := txBldrFund.Sequence() +// ctx.Logger.Info(fmt.Sprintf("Preparing funds for each test account, seq starts from %d", int(seqStartFund))) +// doInitDistribution(ctx, cliCtxFund, txBldrFund, seqStartFund, fundFrom, accsFromGenesis, sdk.Coin{Amount: sdk.NewInt(1000000000), Denom: defaultDenom}) +//} +// +//func doInitDistribution(ctx *server.Context, cliCtx context.CLIContext, txBldr authtypes.TxBuilder, seqStartFund uint64, fundAcc sdk.AccAddress, subAccs []sdk.AccAddress, coin sdk.Coin) { +// for i := 0; i < len(subAccs); i++ { +// msg := bank.NewMsgSend(fundAcc, subAccs[i], sdk.Coins{coin}) +// currSeqInt := seqStartFund + uint64(i) +// //// build and sign the transaction, then broadcast to Tendermint +// err := utils.GenerateOrBroadcastMsgs(cliCtx, txBldr.WithSequence(currSeqInt).WithGas(uint64(400000)), []sdk.Msg{msg}) +// ctx.Logger.Info(fmt.Sprintf("Transfered fund to account %s (index: %d, seq: %d)", subAccs[i].String(), i, int(currSeqInt))) +// if err != nil { +// fmt.Println(err) +// } +// time.Sleep(getWaitDuration(20)) // 20ms +// } +//} +// +//// doSendTransaction takes in an account and currency object and sends random amounts of coin from the +//// node account. It prints any errors to ctx.logger and returns +//func doSendTransaction(cliCtx context.CLIContext, txBldr authtypes.TxBuilder, threadNo int, to sdk.AccAddress, from sdk.AccAddress, randomRev bool, coin sdk.Coin, firstSeq uint64) { +// msg := bank.NewMsgSend(from, to, sdk.Coins{coin}) +// //// build and sign the transaction, then broadcast to Tendermint +// err := utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) +// if err != nil { +// fmt.Println(err) +// } +//} +// +//// handleSigTerm keeps a count of messages sent and if the maximum number of transactions is reached it stops +//// all threads and proceeds to shut down the main thread. If it catches a SIGTERM or a CTRL C it similarly shuts down +//// gracefully. This function is blocking and is called as a go routine. +//func handleSigTerm(c chan os.Signal, counterChan chan int, stopChan chan bool, +// n int, maxTx int, waiter *sync.WaitGroup, cnt *int) { +// +// // indefinite loop listens over the counter and os.Signal for interrupt signal +// for true { +// select { +// case <-c: +// // signal the goroutines to stop +// for i := 0; i < n; i++ { +// stopChan <- true +// } +// // wait for the goroutines to stop +// time.Sleep(time.Second) +// +// waiter.Done() +// +// case <-counterChan: +// // increment counter +// *cnt++ +// +// // send shutdown signal if max no. of transactions is reached +// if *cnt >= maxTx { +// c <- os.Interrupt +// } +// } +// } +//} +// +//func getAllAccAddressFromGenesis(cdc *codec.Codec, genesisFilePath string) (accAddrs []sdk.AccAddress, err error) { +// var genDoc *tmtypes.GenesisDoc +// if genDoc, err = tmtypes.GenesisDocFromFile(strings.ReplaceAll(genesisFilePath, "cli", "d")); err != nil { +// return nil, fmt.Errorf("error loading genesis doc from %s: %s", genesisFilePath, err.Error()) +// } +// var genState map[string]json.RawMessage +// if err = cdc.UnmarshalJSON(genDoc.AppState, &genState); err != nil { +// return nil, fmt.Errorf("error unmarshalling genesis doc %s: %s", genesisFilePath, err.Error()) +// } +// var addresses []sdk.AccAddress +// auth.GenesisAccountIterator{}.IterateGenesisAccounts( +// cdc, genState, func(acc exported.Account) (stop bool) { +// addresses = append(addresses, acc.GetAddress()) +// return false +// }, +// ) +// if len(addresses) > 0 { +// return addresses, nil +// } +// return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "No account initiated in genesis") +//} +// +//func getWaitDuration(interval int) time.Duration { +// return time.Millisecond * time.Duration(interval) +//} +// +//func getFirstAccAddressFromGenesis(cdc *codec.Codec, genesisFilePath string) (accAddr sdk.AccAddress, err error) { +// var genDoc *tmtypes.GenesisDoc +// if genDoc, err = tmtypes.GenesisDocFromFile(strings.ReplaceAll(genesisFilePath, "cli", "d")); err != nil { +// return nil, fmt.Errorf("error loading genesis doc from %s: %s", genesisFilePath, err.Error()) +// } +// var genState map[string]json.RawMessage +// if err = cdc.UnmarshalJSON(genDoc.AppState, &genState); err != nil { +// return nil, fmt.Errorf("error unmarshalling genesis doc %s: %s", genesisFilePath, err.Error()) +// } +// var addresses []sdk.AccAddress +// auth.GenesisAccountIterator{}.IterateGenesisAccounts( +// cdc, genState, func(acc exported.Account) (stop bool) { +// addresses = append(addresses, acc.GetAddress()) +// return false +// }, +// ) +// if len(addresses) > 0 { +// return addresses[0], nil +// } +// return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "No account initiated in genesis") +//} diff --git a/cmd/stchaind/main.go b/cmd/stchaind/main.go index 2a516a87..320d6c09 100644 --- a/cmd/stchaind/main.go +++ b/cmd/stchaind/main.go @@ -1,110 +1,110 @@ package main -import ( - "encoding/json" - "io" - - "github.com/spf13/cobra" - "github.com/spf13/viper" - - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/cli" - "github.com/tendermint/tendermint/libs/log" - tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tm-db" - - "github.com/stratosnet/stratos-chain/app" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client/debug" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "github.com/cosmos/cosmos-sdk/x/staking" -) - -const flagInvCheckPeriod = "inv-check-period" - -var invCheckPeriod uint - -func main() { - cdc := app.MakeCodec() - - app.SetConfig() - - ctx := server.NewDefaultContext() - cobra.EnableCommandSorting = false - rootCmd := &cobra.Command{ - Use: "stchaind", - Short: "app Daemon (server)", - PersistentPreRunE: server.PersistentPreRunEFn(ctx), - } - - rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) - rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome)) - rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) - rootCmd.AddCommand( - genutilcli.GenTxCmd( - ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, - auth.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome, - ), - ) - rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) - rootCmd.AddCommand(AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) - rootCmd.AddCommand(AddGenesisIndexingNodeCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome, auth.GenesisAccountIterator{})) - rootCmd.AddCommand(LoadTestCommands(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) - rootCmd.AddCommand(flags.NewCompletionCmd(rootCmd, true)) - rootCmd.AddCommand(debug.Cmd(cdc)) - - server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) - - // prepare and add flags - executor := cli.PrepareBaseCmd(rootCmd, "AU", app.DefaultNodeHome) - rootCmd.PersistentFlags().UintVar(&invCheckPeriod, flagInvCheckPeriod, - 0, "Assert registered invariants every N blocks") - err := executor.Execute() - if err != nil { - panic(err) - } -} - -func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application { - var cache sdk.MultiStorePersistentCache - - if viper.GetBool(server.FlagInterBlockCache) { - cache = store.NewCommitKVStoreCacheManager() - } - pruningOpts, err := server.GetPruningOptionsFromFlags() - if err != nil { - panic(err) - } - return app.NewInitApp( - logger, db, traceStore, true, invCheckPeriod, - baseapp.SetPruning(pruningOpts), - baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)), - baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)), - baseapp.SetHaltTime(viper.GetUint64(server.FlagHaltTime)), - baseapp.SetInterBlockCache(cache), - ) -} - -func exportAppStateAndTMValidators( - logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailWhiteList []string, -) (json.RawMessage, []tmtypes.GenesisValidator, error) { - - if height != -1 { - aApp := app.NewInitApp(logger, db, traceStore, false, uint(1)) - err := aApp.LoadHeight(height) - if err != nil { - return nil, nil, err - } - return aApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) - } - - aApp := app.NewInitApp(logger, db, traceStore, true, uint(1)) - - return aApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) -} +//import ( +// "encoding/json" +// "io" +// +// "github.com/spf13/cobra" +// "github.com/spf13/viper" +// +// abci "github.com/tendermint/tendermint/abci/types" +// "github.com/tendermint/tendermint/libs/cli" +// "github.com/tendermint/tendermint/libs/log" +// tmtypes "github.com/tendermint/tendermint/types" +// dbm "github.com/tendermint/tm-db" +// +// "github.com/stratosnet/stratos-chain/app" +// +// "github.com/cosmos/cosmos-sdk/baseapp" +// "github.com/cosmos/cosmos-sdk/client/debug" +// "github.com/cosmos/cosmos-sdk/client/flags" +// "github.com/cosmos/cosmos-sdk/server" +// "github.com/cosmos/cosmos-sdk/store" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" +// "github.com/cosmos/cosmos-sdk/x/staking" +//) +// +//const flagInvCheckPeriod = "inv-check-period" +// +//var invCheckPeriod uint +// +//func main() { +// cdc := app.MakeCodec() +// +// app.SetConfig() +// +// ctx := server.NewDefaultContext() +// cobra.EnableCommandSorting = false +// rootCmd := &cobra.Command{ +// Use: "stchaind", +// Short: "app Daemon (server)", +// PersistentPreRunE: server.PersistentPreRunEFn(ctx), +// } +// +// rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) +// rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome)) +// rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) +// rootCmd.AddCommand( +// genutilcli.GenTxCmd( +// ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, +// auth.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome, +// ), +// ) +// rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) +// rootCmd.AddCommand(AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) +// rootCmd.AddCommand(AddGenesisIndexingNodeCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome, auth.GenesisAccountIterator{})) +// rootCmd.AddCommand(LoadTestCommands(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) +// rootCmd.AddCommand(flags.NewCompletionCmd(rootCmd, true)) +// rootCmd.AddCommand(debug.Cmd(cdc)) +// +// server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) +// +// // prepare and add flags +// executor := cli.PrepareBaseCmd(rootCmd, "AU", app.DefaultNodeHome) +// rootCmd.PersistentFlags().UintVar(&invCheckPeriod, flagInvCheckPeriod, +// 0, "Assert registered invariants every N blocks") +// err := executor.Execute() +// if err != nil { +// panic(err) +// } +//} +// +//func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application { +// var cache sdk.MultiStorePersistentCache +// +// if viper.GetBool(server.FlagInterBlockCache) { +// cache = store.NewCommitKVStoreCacheManager() +// } +// pruningOpts, err := server.GetPruningOptionsFromFlags() +// if err != nil { +// panic(err) +// } +// return app.NewInitApp( +// logger, db, traceStore, true, invCheckPeriod, +// baseapp.SetPruning(pruningOpts), +// baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)), +// baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)), +// baseapp.SetHaltTime(viper.GetUint64(server.FlagHaltTime)), +// baseapp.SetInterBlockCache(cache), +// ) +//} +// +//func exportAppStateAndTMValidators( +// logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailWhiteList []string, +//) (json.RawMessage, []tmtypes.GenesisValidator, error) { +// +// if height != -1 { +// aApp := app.NewInitApp(logger, db, traceStore, false, uint(1)) +// err := aApp.LoadHeight(height) +// if err != nil { +// return nil, nil, err +// } +// return aApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) +// } +// +// aApp := app.NewInitApp(logger, db, traceStore, true, uint(1)) +// +// return aApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) +//} diff --git a/crypto/codec/amino.go b/crypto/codec/amino.go new file mode 100644 index 00000000..b8cc9212 --- /dev/null +++ b/crypto/codec/amino.go @@ -0,0 +1,28 @@ +package codec + +import ( + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" +) + +// RegisterCrypto registers all crypto dependency types with the provided Amino +// codec. +func RegisterCrypto(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(ðsecp256k1.PubKey{}, + ethsecp256k1.PubKeyName, nil) + cdc.RegisterConcrete(ðsecp256k1.PrivKey{}, + ethsecp256k1.PrivKeyName, nil) + + keyring.RegisterLegacyAminoCodec(cdc) + cryptocodec.RegisterCrypto(cdc) + + // NOTE: update SDK's amino codec to include the ethsecp256k1 keys. + // DO NOT REMOVE unless deprecated on the SDK. + legacy.Cdc = cdc + keys.KeysCdc = cdc +} diff --git a/crypto/codec/codec.go b/crypto/codec/codec.go new file mode 100644 index 00000000..00475d39 --- /dev/null +++ b/crypto/codec/codec.go @@ -0,0 +1,13 @@ +package codec + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" +) + +// RegisterInterfaces register the stratos key concrete types. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*cryptotypes.PubKey)(nil), ðsecp256k1.PubKey{}) +} diff --git a/crypto/ethsecp256k1/ethsecp256k1.go b/crypto/ethsecp256k1/ethsecp256k1.go new file mode 100644 index 00000000..4d24dc56 --- /dev/null +++ b/crypto/ethsecp256k1/ethsecp256k1.go @@ -0,0 +1,217 @@ +package ethsecp256k1 + +import ( + "bytes" + "crypto/ecdsa" + "crypto/subtle" + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/crypto" + + tmcrypto "github.com/tendermint/tendermint/crypto" +) + +const ( + // PrivKeySize defines the size of the PrivKey bytes + PrivKeySize = 32 + // PubKeySize defines the size of the PubKey bytes + PubKeySize = 33 + // KeyType is the string constant for the Secp256k1 algorithm + KeyType = "eth_secp256k1" +) + +// Amino encoding names +const ( + // PrivKeyName defines the amino encoding name for the EthSecp256k1 private key + PrivKeyName = "stratos/PrivKeyEthSecp256k1" + // PubKeyName defines the amino encoding name for the EthSecp256k1 public key + PubKeyName = "stratos/PubKeyEthSecp256k1" +) + +// ---------------------------------------------------------------------------- +// secp256k1 Private Key + +var ( + _ cryptotypes.PrivKey = &PrivKey{} + _ codec.AminoMarshaler = &PrivKey{} +) + +// GenerateKey generates a new random private key. It returns an error upon +// failure. +func GenerateKey() (*PrivKey, error) { + priv, err := crypto.GenerateKey() + if err != nil { + return nil, err + } + + return &PrivKey{ + Key: crypto.FromECDSA(priv), + }, nil +} + +// Bytes returns the byte representation of the ECDSA Private Key. +func (privKey PrivKey) Bytes() []byte { + bz := make([]byte, len(privKey.Key)) + copy(bz, privKey.Key) + + return bz +} + +// PubKey returns the ECDSA private key's public key. If the privkey is not valid +// it returns a nil value. +func (privKey PrivKey) PubKey() cryptotypes.PubKey { + ecdsaPrivKey, err := privKey.ToECDSA() + if err != nil { + return nil + } + + return &PubKey{ + Key: crypto.CompressPubkey(&ecdsaPrivKey.PublicKey), + } +} + +// Equals returns true if two ECDSA private keys are equal and false otherwise. +func (privKey PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool { + return privKey.Type() == other.Type() && subtle.ConstantTimeCompare(privKey.Bytes(), other.Bytes()) == 1 +} + +// Type returns eth_secp256k1 +func (privKey PrivKey) Type() string { + return KeyType +} + +// MarshalAmino overrides Amino binary marshaling. +func (privKey PrivKey) MarshalAmino() ([]byte, error) { + return privKey.Key, nil +} + +// UnmarshalAmino overrides Amino binary marshaling. +func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { + if len(bz) != PrivKeySize { + return fmt.Errorf("invalid privkey size, expected %d got %d", PrivKeySize, len(bz)) + } + privKey.Key = bz + + return nil +} + +// MarshalAminoJSON overrides Amino JSON marshaling. +func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { + // When we marshal to Amino JSON, we don't marshal the "key" field itself, + // just its contents (i.e. the key bytes). + return privKey.MarshalAmino() +} + +// UnmarshalAminoJSON overrides Amino JSON marshaling. +func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { + return privKey.UnmarshalAmino(bz) +} + +// Sign creates a recoverable ECDSA signature on the secp256k1 curve over the +// provided hash of the message. The produced signature is 65 bytes +// where the last byte contains the recovery ID. +func (privKey PrivKey) Sign(digestBz []byte) ([]byte, error) { + // TODO: remove + if len(digestBz) != crypto.DigestLength { + digestBz = crypto.Keccak256Hash(digestBz).Bytes() + } + + key, err := privKey.ToECDSA() + if err != nil { + return nil, err + } + + return crypto.Sign(digestBz, key) +} + +// ToECDSA returns the ECDSA private key as a reference to ecdsa.PrivateKey type. +func (privKey PrivKey) ToECDSA() (*ecdsa.PrivateKey, error) { + return crypto.ToECDSA(privKey.Bytes()) +} + +// ---------------------------------------------------------------------------- +// secp256k1 Public Key + +var ( + _ cryptotypes.PubKey = &PubKey{} + _ codec.AminoMarshaler = &PubKey{} +) + +// Address returns the address of the ECDSA public key. +// The function will return an empty address if the public key is invalid. +func (pubKey PubKey) Address() tmcrypto.Address { + pubk, err := crypto.DecompressPubkey(pubKey.Key) + if err != nil { + return nil + } + + return tmcrypto.Address(crypto.PubkeyToAddress(*pubk).Bytes()) +} + +// Bytes returns the raw bytes of the ECDSA public key. +func (pubKey PubKey) Bytes() []byte { + bz := make([]byte, len(pubKey.Key)) + copy(bz, pubKey.Key) + + return bz +} + +// String implements the fmt.Stringer interface. +func (pubKey PubKey) String() string { + return fmt.Sprintf("EthPubKeySecp256k1{%X}", pubKey.Key) +} + +// Type returns eth_secp256k1 +func (pubKey PubKey) Type() string { + return KeyType +} + +// Equals returns true if the pubkey type is the same and their bytes are deeply equal. +func (pubKey PubKey) Equals(other cryptotypes.PubKey) bool { + return pubKey.Type() == other.Type() && bytes.Equal(pubKey.Bytes(), other.Bytes()) +} + +// MarshalAmino overrides Amino binary marshaling. +func (pubKey PubKey) MarshalAmino() ([]byte, error) { + return pubKey.Key, nil +} + +// UnmarshalAmino overrides Amino binary marshaling. +func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { + if len(bz) != PubKeySize { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid pubkey size, expected %d, got %d", PubKeySize, len(bz)) + } + pubKey.Key = bz + + return nil +} + +// MarshalAminoJSON overrides Amino JSON marshaling. +func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { + // When we marshal to Amino JSON, we don't marshal the "key" field itself, + // just its contents (i.e. the key bytes). + return pubKey.MarshalAmino() +} + +// UnmarshalAminoJSON overrides Amino JSON marshaling. +func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { + return pubKey.UnmarshalAmino(bz) +} + +// VerifySignature verifies that the ECDSA public key created a given signature over +// the provided message. It will calculate the Keccak256 hash of the message +// prior to verification. +// +// CONTRACT: The signature should be in [R || S] format. +func (pubKey PubKey) VerifySignature(msg, sig []byte) bool { + if len(sig) == crypto.SignatureLength { + // remove recovery ID (V) if contained in the signature + sig = sig[:len(sig)-1] + } + + // the signature needs to be in [R || S] format when provided to VerifySignature + return crypto.VerifySignature(pubKey.Key, crypto.Keccak256Hash(msg).Bytes(), sig) +} diff --git a/crypto/ethsecp256k1/keys.pb.go b/crypto/ethsecp256k1/keys.pb.go new file mode 100644 index 00000000..8770368f --- /dev/null +++ b/crypto/ethsecp256k1/keys.pb.go @@ -0,0 +1,498 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/crypto/v1/ethsecp256k1/keys.proto + +package ethsecp256k1 + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// PubKey defines a type alias for an ecdsa.PublicKey that implements +// Tendermint's PubKey interface. It represents the 33-byte compressed public +// key format. +type PubKey struct { + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *PubKey) Reset() { *m = PubKey{} } +func (*PubKey) ProtoMessage() {} +func (*PubKey) Descriptor() ([]byte, []int) { + return fileDescriptor_0ad7c5ba69f52fc6, []int{0} +} +func (m *PubKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PubKey.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 *PubKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_PubKey.Merge(m, src) +} +func (m *PubKey) XXX_Size() int { + return m.Size() +} +func (m *PubKey) XXX_DiscardUnknown() { + xxx_messageInfo_PubKey.DiscardUnknown(m) +} + +var xxx_messageInfo_PubKey proto.InternalMessageInfo + +func (m *PubKey) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +// PrivKey defines a type alias for an ecdsa.PrivateKey that implements +// Tendermint's PrivateKey interface. +type PrivKey struct { + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *PrivKey) Reset() { *m = PrivKey{} } +func (m *PrivKey) String() string { return proto.CompactTextString(m) } +func (*PrivKey) ProtoMessage() {} +func (*PrivKey) Descriptor() ([]byte, []int) { + return fileDescriptor_0ad7c5ba69f52fc6, []int{1} +} +func (m *PrivKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PrivKey.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 *PrivKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_PrivKey.Merge(m, src) +} +func (m *PrivKey) XXX_Size() int { + return m.Size() +} +func (m *PrivKey) XXX_DiscardUnknown() { + xxx_messageInfo_PrivKey.DiscardUnknown(m) +} + +var xxx_messageInfo_PrivKey proto.InternalMessageInfo + +func (m *PrivKey) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func init() { + proto.RegisterType((*PubKey)(nil), "stratos.crypto.v1.ethsecp256k1.PubKey") + proto.RegisterType((*PrivKey)(nil), "stratos.crypto.v1.ethsecp256k1.PrivKey") +} + +func init() { + proto.RegisterFile("stratos/crypto/v1/ethsecp256k1/keys.proto", fileDescriptor_0ad7c5ba69f52fc6) +} + +var fileDescriptor_0ad7c5ba69f52fc6 = []byte{ + // 199 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2c, 0x2e, 0x29, 0x4a, + 0x2c, 0xc9, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, + 0xc9, 0x28, 0x4e, 0x4d, 0x2e, 0x30, 0x32, 0x35, 0xcb, 0x36, 0xd4, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x83, 0x2a, 0xd5, 0x83, 0x28, 0xd5, 0x2b, 0x33, 0xd4, + 0x43, 0x56, 0x2a, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xaa, 0x0f, 0x62, 0x41, 0x74, 0x29, + 0x29, 0x70, 0xb1, 0x05, 0x94, 0x26, 0x79, 0xa7, 0x56, 0x0a, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, + 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0x98, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x28, + 0x49, 0x73, 0xb1, 0x07, 0x14, 0x65, 0x96, 0x61, 0x55, 0xe2, 0x14, 0x78, 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, 0xe6, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, + 0xb9, 0xfa, 0x50, 0x97, 0xe5, 0xa5, 0x96, 0xc0, 0x98, 0xba, 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, + 0x5f, 0x21, 0xbb, 0x33, 0x89, 0x0d, 0xec, 0x30, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc7, + 0x10, 0xe4, 0xc4, 0xfb, 0x00, 0x00, 0x00, +} + +func (m *PubKey) 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 *PubKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PrivKey) 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 *PrivKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { + offset -= sovKeys(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PubKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKeys(uint64(l)) + } + return n +} + +func (m *PrivKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKeys(uint64(l)) + } + return n +} + +func sovKeys(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozKeys(x uint64) (n int) { + return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PubKey) 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 ErrIntOverflowKeys + } + 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: PubKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PrivKey) 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 ErrIntOverflowKeys + } + 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: PrivKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrivKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKeys + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKeys + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKeys + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKeys(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthKeys + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipKeys(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, ErrIntOverflowKeys + } + 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, ErrIntOverflowKeys + } + 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, ErrIntOverflowKeys + } + 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, ErrInvalidLengthKeys + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupKeys + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthKeys + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") +) diff --git a/crypto/hd/algorithm.go b/crypto/hd/algorithm.go new file mode 100644 index 00000000..f830124e --- /dev/null +++ b/crypto/hd/algorithm.go @@ -0,0 +1,111 @@ +package hd + +import ( + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcutil/hdkeychain" + "github.com/tyler-smith/go-bip39" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" +) + +const ( + // EthSecp256k1Type defines the ECDSA secp256k1 used on Ethereum + EthSecp256k1Type = hd.PubKeyType(ethsecp256k1.KeyType) +) + +var ( + // SupportedAlgorithms defines the list of signing algorithms used on stratos: + // - eth_secp256k1 (Ethereum) + // - secp256k1 (Tendermint) + SupportedAlgorithms = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1} + // SupportedAlgorithmsLedger defines the list of signing algorithms used on stratos for the Ledger device: + // - eth_secp256k1 (Ethereum) + // - secp256k1 (Tendermint) + SupportedAlgorithmsLedger = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1} +) + +// EthSecp256k1Option defines a function keys options for the ethereum Secp256k1 curve. +// It supports eth_secp256k1 and secp256k1 keys for accounts. +func EthSecp256k1Option() keyring.Option { + return func(options *keyring.Options) { + options.SupportedAlgos = SupportedAlgorithms + options.SupportedAlgosLedger = SupportedAlgorithmsLedger + } +} + +var ( + _ keyring.SignatureAlgo = EthSecp256k1 + + // EthSecp256k1 uses the Bitcoin secp256k1 ECDSA parameters. + EthSecp256k1 = ethSecp256k1Algo{} +) + +type ethSecp256k1Algo struct{} + +// Name returns eth_secp256k1 +func (s ethSecp256k1Algo) Name() hd.PubKeyType { + return EthSecp256k1Type +} + +// Derive derives and returns the eth_secp256k1 private key for the given mnemonic and HD path. +func (s ethSecp256k1Algo) Derive() hd.DeriveFn { + return func(mnemonic, bip39Passphrase, path string) ([]byte, error) { + hdpath, err := accounts.ParseDerivationPath(path) + if err != nil { + return nil, err + } + + seed, err := bip39.NewSeedWithErrorChecking(mnemonic, bip39Passphrase) + if err != nil { + return nil, err + } + + // create a BTC-utils hd-derivation key chain + masterKey, err := hdkeychain.NewMaster(seed, &chaincfg.MainNetParams) + if err != nil { + return nil, err + } + + key := masterKey + for _, n := range hdpath { + key, err = key.Derive(n) + if err != nil { + return nil, err + } + } + + // btc-utils representation of a secp256k1 private key + privateKey, err := key.ECPrivKey() + if err != nil { + return nil, err + } + + // cast private key to a convertible form (single scalar field element of secp256k1) + // and then load into ethcrypto private key format. + // TODO: add links to godocs of the two methods or implementations of them, to compare equivalency + privateKeyECDSA := privateKey.ToECDSA() + derivedKey := crypto.FromECDSA(privateKeyECDSA) + + return derivedKey, nil + } +} + +// Generate generates a eth_secp256k1 private key from the given bytes. +func (s ethSecp256k1Algo) Generate() hd.GenerateFn { + return func(bz []byte) cryptotypes.PrivKey { + bzArr := make([]byte, ethsecp256k1.PrivKeySize) + copy(bzArr, bz) + + // TODO: modulo P + return ðsecp256k1.PrivKey{ + Key: bzArr, + } + } +} diff --git a/ethereum/eip712/eip712.go b/ethereum/eip712/eip712.go new file mode 100644 index 00000000..35a05dc2 --- /dev/null +++ b/ethereum/eip712/eip712.go @@ -0,0 +1,449 @@ +package eip712 + +import ( + "bytes" + "encoding/json" + "fmt" + "math/big" + "reflect" + "strings" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/signer/core/apitypes" +) + +// ComputeTypedDataHash computes keccak hash of typed data for signing. +func ComputeTypedDataHash(typedData apitypes.TypedData) ([]byte, error) { + domainSeparator, err := typedData.HashStruct("EIP712Domain", typedData.Domain.Map()) + if err != nil { + err = sdkerrors.Wrap(err, "failed to pack and hash typedData EIP712Domain") + return nil, err + } + + typedDataHash, err := typedData.HashStruct(typedData.PrimaryType, typedData.Message) + if err != nil { + err = sdkerrors.Wrap(err, "failed to pack and hash typedData primary type") + return nil, err + } + + rawData := []byte(fmt.Sprintf("\x19\x01%s%s", string(domainSeparator), string(typedDataHash))) + return crypto.Keccak256(rawData), nil +} + +// WrapTxToTypedData is an ultimate method that wraps Amino-encoded Cosmos Tx JSON data +// into an EIP712-compatible TypedData request. +func WrapTxToTypedData( + cdc codectypes.AnyUnpacker, + chainID uint64, + msg sdk.Msg, + data []byte, + feeDelegation *FeeDelegationOptions, +) (apitypes.TypedData, error) { + txData := make(map[string]interface{}) + + if err := json.Unmarshal(data, &txData); err != nil { + return apitypes.TypedData{}, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "failed to JSON unmarshal data") + } + + domain := apitypes.TypedDataDomain{ + Name: "Cosmos Web3", + Version: "1.0.0", + ChainId: math.NewHexOrDecimal256(int64(chainID)), + VerifyingContract: "cosmos", + Salt: "0", + } + + msgTypes, err := extractMsgTypes(cdc, "MsgValue", msg) + if err != nil { + return apitypes.TypedData{}, err + } + + if feeDelegation != nil { + feeInfo, ok := txData["fee"].(map[string]interface{}) + if !ok { + return apitypes.TypedData{}, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "cannot parse fee from tx data") + } + + feeInfo["feePayer"] = feeDelegation.FeePayer.String() + + // also patching msgTypes to include feePayer + msgTypes["Fee"] = []apitypes.Type{ + {Name: "feePayer", Type: "string"}, + {Name: "amount", Type: "Coin[]"}, + {Name: "gas", Type: "string"}, + } + } + + typedData := apitypes.TypedData{ + Types: msgTypes, + PrimaryType: "Tx", + Domain: domain, + Message: txData, + } + + return typedData, nil +} + +type FeeDelegationOptions struct { + FeePayer sdk.AccAddress +} + +func extractMsgTypes(cdc codectypes.AnyUnpacker, msgTypeName string, msg sdk.Msg) (apitypes.Types, error) { + rootTypes := apitypes.Types{ + "EIP712Domain": { + { + Name: "name", + Type: "string", + }, + { + Name: "version", + Type: "string", + }, + { + Name: "chainId", + Type: "uint256", + }, + { + Name: "verifyingContract", + Type: "string", + }, + { + Name: "salt", + Type: "string", + }, + }, + "Tx": { + {Name: "account_number", Type: "string"}, + {Name: "chain_id", Type: "string"}, + {Name: "fee", Type: "Fee"}, + {Name: "memo", Type: "string"}, + {Name: "msgs", Type: "Msg[]"}, + {Name: "sequence", Type: "string"}, + // Note timeout_height was removed because it was not getting filled with the legacyTx + // {Name: "timeout_height", Type: "string"}, + }, + "Fee": { + {Name: "amount", Type: "Coin[]"}, + {Name: "gas", Type: "string"}, + }, + "Coin": { + {Name: "denom", Type: "string"}, + {Name: "amount", Type: "string"}, + }, + "Msg": { + {Name: "type", Type: "string"}, + {Name: "value", Type: msgTypeName}, + }, + msgTypeName: {}, + } + + if err := walkFields(cdc, rootTypes, msgTypeName, msg); err != nil { + return nil, err + } + + return rootTypes, nil +} + +const typeDefPrefix = "_" + +func walkFields(cdc codectypes.AnyUnpacker, typeMap apitypes.Types, rootType string, in interface{}) (err error) { + defer doRecover(&err) + + t := reflect.TypeOf(in) + v := reflect.ValueOf(in) + + for { + if t.Kind() == reflect.Ptr || + t.Kind() == reflect.Interface { + t = t.Elem() + v = v.Elem() + + continue + } + + break + } + + return traverseFields(cdc, typeMap, rootType, typeDefPrefix, t, v) +} + +type cosmosAnyWrapper struct { + Type string `json:"type"` + Value interface{} `json:"value"` +} + +func traverseFields( + cdc codectypes.AnyUnpacker, + typeMap apitypes.Types, + rootType string, + prefix string, + t reflect.Type, + v reflect.Value, +) error { + n := t.NumField() + + if prefix == typeDefPrefix { + if len(typeMap[rootType]) == n { + return nil + } + } else { + typeDef := sanitizeTypedef(prefix) + if len(typeMap[typeDef]) == n { + return nil + } + } + + for i := 0; i < n; i++ { + var field reflect.Value + if v.IsValid() { + field = v.Field(i) + } + + fieldType := t.Field(i).Type + fieldName := jsonNameFromTag(t.Field(i).Tag) + + if fieldType == cosmosAnyType { + any, ok := field.Interface().(*codectypes.Any) + if !ok { + return sdkerrors.Wrapf(sdkerrors.ErrPackAny, "%T", field.Interface()) + } + + anyWrapper := &cosmosAnyWrapper{ + Type: any.TypeUrl, + } + + if err := cdc.UnpackAny(any, &anyWrapper.Value); err != nil { + return sdkerrors.Wrap(err, "failed to unpack Any in msg struct") + } + + fieldType = reflect.TypeOf(anyWrapper) + field = reflect.ValueOf(anyWrapper) + + // then continue as normal + } + + for { + if fieldType.Kind() == reflect.Ptr { + fieldType = fieldType.Elem() + + if field.IsValid() { + field = field.Elem() + } + + continue + } + + if fieldType.Kind() == reflect.Interface { + fieldType = reflect.TypeOf(field.Interface()) + continue + } + + if field.Kind() == reflect.Ptr { + field = field.Elem() + continue + } + + break + } + + var isCollection bool + if fieldType.Kind() == reflect.Array || fieldType.Kind() == reflect.Slice { + if field.Len() == 0 { + // skip empty collections from type mapping + continue + } + + fieldType = fieldType.Elem() + field = field.Index(0) + isCollection = true + } + + for { + if fieldType.Kind() == reflect.Ptr { + fieldType = fieldType.Elem() + + if field.IsValid() { + field = field.Elem() + } + + continue + } + + if fieldType.Kind() == reflect.Interface { + fieldType = reflect.TypeOf(field.Interface()) + continue + } + + if field.Kind() == reflect.Ptr { + field = field.Elem() + continue + } + + break + } + + fieldPrefix := fmt.Sprintf("%s.%s", prefix, fieldName) + + ethTyp := typToEth(fieldType) + if len(ethTyp) > 0 { + if prefix == typeDefPrefix { + typeMap[rootType] = append(typeMap[rootType], apitypes.Type{ + Name: fieldName, + Type: ethTyp, + }) + } else { + typeDef := sanitizeTypedef(prefix) + typeMap[typeDef] = append(typeMap[typeDef], apitypes.Type{ + Name: fieldName, + Type: ethTyp, + }) + } + + continue + } + + if fieldType.Kind() == reflect.Struct { + + var fieldTypedef string + + if isCollection { + fieldTypedef = sanitizeTypedef(fieldPrefix) + "[]" + } else { + fieldTypedef = sanitizeTypedef(fieldPrefix) + } + + if prefix == typeDefPrefix { + typeMap[rootType] = append(typeMap[rootType], apitypes.Type{ + Name: fieldName, + Type: fieldTypedef, + }) + } else { + typeDef := sanitizeTypedef(prefix) + typeMap[typeDef] = append(typeMap[typeDef], apitypes.Type{ + Name: fieldName, + Type: fieldTypedef, + }) + } + + if err := traverseFields(cdc, typeMap, rootType, fieldPrefix, fieldType, field); err != nil { + return err + } + + continue + } + } + + return nil +} + +func jsonNameFromTag(tag reflect.StructTag) string { + jsonTags := tag.Get("json") + parts := strings.Split(jsonTags, ",") + return parts[0] +} + +// _.foo_bar.baz -> TypeFooBarBaz +// +// this is needed for Geth's own signing code which doesn't +// tolerate complex type names +func sanitizeTypedef(str string) string { + buf := new(bytes.Buffer) + parts := strings.Split(str, ".") + + for _, part := range parts { + if part == "_" { + buf.WriteString("Type") + continue + } + + subparts := strings.Split(part, "_") + for _, subpart := range subparts { + buf.WriteString(strings.Title(subpart)) + } + } + + return buf.String() +} + +var ( + hashType = reflect.TypeOf(common.Hash{}) + addressType = reflect.TypeOf(common.Address{}) + bigIntType = reflect.TypeOf(big.Int{}) + cosmIntType = reflect.TypeOf(sdk.Int{}) + cosmosAnyType = reflect.TypeOf(&codectypes.Any{}) +) + +// typToEth supports only basic types and arrays of basic types. +// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md +func typToEth(typ reflect.Type) string { + const str = "string" + + switch typ.Kind() { + case reflect.String: + return str + case reflect.Bool: + return "bool" + case reflect.Int: + return "int64" + case reflect.Int8: + return "int8" + case reflect.Int16: + return "int16" + case reflect.Int32: + return "int32" + case reflect.Int64: + return "int64" + case reflect.Uint: + return "uint64" + case reflect.Uint8: + return "uint8" + case reflect.Uint16: + return "uint16" + case reflect.Uint32: + return "uint32" + case reflect.Uint64: + return "uint64" + case reflect.Slice: + ethName := typToEth(typ.Elem()) + if len(ethName) > 0 { + return ethName + "[]" + } + case reflect.Array: + ethName := typToEth(typ.Elem()) + if len(ethName) > 0 { + return ethName + "[]" + } + case reflect.Ptr: + if typ.Elem().ConvertibleTo(bigIntType) || + typ.Elem().ConvertibleTo(cosmIntType) { + return str + } + case reflect.Struct: + if typ.ConvertibleTo(hashType) || + typ.ConvertibleTo(addressType) || + typ.ConvertibleTo(bigIntType) || + typ.ConvertibleTo(cosmIntType) { + return str + } + } + + return "" +} + +func doRecover(err *error) { + if r := recover(); r != nil { + if e, ok := r.(error); ok { + e = sdkerrors.Wrap(e, "panicked with error") + *err = e + return + } + + *err = fmt.Errorf("%v", r) + } +} diff --git a/go.mod b/go.mod index 4384d6bd..c3f51efb 100644 --- a/go.mod +++ b/go.mod @@ -1,30 +1,147 @@ module github.com/stratosnet/stratos-chain -go 1.15 +go 1.17 require ( + github.com/btcsuite/btcd v0.22.0-beta + github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cosmos/cosmos-sdk v0.45.1 - github.com/cosmos/ibc-go/v3 v3.0.0-rc0 + github.com/cosmos/ibc-go/v3 v3.0.0 + github.com/davecgh/go-spew v1.1.1 + github.com/ethereum/go-ethereum v1.10.16 github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.5.2 + github.com/gorilla/mux v1.8.0 + github.com/gorilla/websocket v1.5.0 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/pkg/errors v0.9.1 + github.com/rakyll/statik v0.1.7 + github.com/regen-network/cosmos-proto v0.3.1 + github.com/spf13/cast v1.4.1 + github.com/spf13/cobra v1.4.0 + github.com/spf13/viper v1.10.1 github.com/tendermint/tendermint v0.34.14 github.com/tendermint/tm-db v0.6.7 + github.com/tyler-smith/go-bip39 v1.1.0 + google.golang.org/genproto v0.0.0-20220211171837-173942840c17 + google.golang.org/grpc v1.44.0 + google.golang.org/protobuf v1.28.0 + gopkg.in/yaml.v2 v2.4.0 +) + +require ( + filippo.io/edwards25519 v1.0.0-beta.2 // indirect + github.com/99designs/keyring v1.1.6 // indirect + github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect + github.com/DataDog/zstd v1.4.5 // indirect + github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/VictoriaMetrics/fastcache v1.6.0 // indirect + github.com/Workiva/go-datastructures v1.0.52 // indirect + github.com/armon/go-metrics v0.3.10 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/cespare/xxhash v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect + github.com/confio/ics23/go v0.7.0 // indirect + github.com/cosmos/btcutil v1.0.4 // indirect + github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gorocksdb v1.2.0 // indirect + github.com/cosmos/iavl v0.17.3 // indirect + github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect + github.com/cosmos/ledger-go v0.9.2 // indirect + github.com/danieljoos/wincred v1.0.2 // indirect + github.com/deckarep/golang-set v1.8.0 // indirect + github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect + github.com/dgraph-io/badger/v2 v2.2007.2 // indirect + github.com/dgraph-io/ristretto v0.0.3 // indirect + github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/dustin/go-humanize v1.0.0 // indirect + github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect + github.com/felixge/httpsnoop v1.0.1 // indirect + github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + github.com/ghodss/yaml v1.0.0 // indirect + github.com/go-kit/kit v0.10.0 // indirect + github.com/go-logfmt/logfmt v0.5.0 // indirect + github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect + github.com/gogo/gateway v1.1.0 // indirect + github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/btree v1.0.0 // indirect + github.com/google/orderedcode v0.0.1 // indirect + github.com/google/uuid v1.1.5 // indirect + github.com/gorilla/handlers v1.5.1 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect + github.com/gtank/merlin v0.1.1 // indirect + github.com/gtank/ristretto255 v0.1.2 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect + github.com/holiman/uint256 v1.2.0 // indirect + github.com/huin/goupnp v1.0.2 // indirect + github.com/improbable-eng/grpc-web v0.14.1 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jackpal/go-nat-pmp v1.0.2 // indirect + github.com/jmhodges/levigo v1.0.0 // indirect + github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect + github.com/klauspost/compress v1.11.7 // indirect + github.com/lib/pq v1.10.2 // indirect + github.com/libp2p/go-buffer-pool v0.0.2 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect + github.com/minio/highwayhash v1.0.1 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/mtibben/percent v0.2.1 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/pelletier/go-toml v1.9.4 // indirect + github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.29.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/prometheus/tsdb v0.7.1 // indirect + github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect + github.com/rjeczalik/notify v0.9.1 // indirect + github.com/rs/cors v1.7.0 // indirect + github.com/rs/zerolog v1.23.0 // indirect + github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect + github.com/stretchr/testify v1.7.1 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/ethereum/go-ethereum v1.10.16 - github.com/gorilla/mux v1.8.0 - github.com/onsi/ginkgo v1.16.5 - github.com/spf13/afero v1.6.0 // indirect - github.com/spf13/cobra v1.3.0 - github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.10.1 - github.com/stretchr/testify v1.7.0 + github.com/tklauser/go-sysconf v0.3.5 // indirect + github.com/tklauser/numcpus v0.2.2 // indirect + github.com/zondax/hid v0.9.0 // indirect + go.etcd.io/bbolt v1.3.6 // indirect + golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect + golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 // indirect - gopkg.in/yaml.v2 v2.4.0 - github.com/ReneKroon/ttlcache/v2 v2.7.0 - github.com/golang/mock v1.4.3 // indirect - github.com/onsi/gomega v1.5.0 // indirect + golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect + golang.org/x/text v0.3.7 // indirect + gopkg.in/ini.v1 v1.66.2 // indirect + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + nhooyr.io/websocket v1.8.6 // indirect ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index bb9dafdc..90f8c56b 100644 --- a/go.sum +++ b/go.sum @@ -1,220 +1,505 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI= +filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o= github.com/99designs/keyring v1.1.6 h1:kVDC2uCgVwecxCk+9zoCt2uEL6dt+dfVzMvGgnVcIuM= github.com/99designs/keyring v1.1.6/go.mod h1:16e0ds7LGQQcT59QqkTg72Hh5ShM51Byv5PEmW6uoRU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= +github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= +github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU= +github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/ReneKroon/ttlcache/v2 v2.7.0 h1:sZeaSwA2UN/y/h7CvkW15Kovd2Oiy76CBDORiOwHPwI= -github.com/ReneKroon/ttlcache/v2 v2.7.0/go.mod h1:mBxvsNY+BT8qLLd6CuAJubbKo6r0jh3nb5et22bbfGY= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= +github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= +github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= +github.com/adlio/schema v1.1.13 h1:LeNMVg5Z1FX+Qgz8tJUijBLRdcpbFUElz+d1489On98= +github.com/adlio/schema v1.1.13/go.mod h1:L5Z7tw+7lRK1Fnpi/LT/ooCP1elkXn0krMWBQHUhEDE= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d h1:1aAija9gr0Hyv4KfQcRcwlmFIrhkDmIj2dz5bkg/s/8= -github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d/go.mod h1:icNx/6QdFblhsEjZehARqbNumymUT/ydwlLojFdv7Sk= +github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= +github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= +github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= +github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= +github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= +github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= +github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= +github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= +github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= +github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= +github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= +github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.7.0 h1:00d2kukk7sPoHWL4zZBZwzxnpA2pec1NPdwbSokJ5w8= +github.com/confio/ics23/go v0.7.0/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= +github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= +github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= +github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 h1:NmTXa/uVnDyp0TY5MKi197+3HWcnYWfnHGyaFthlnGw= +github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-sdk v0.39.2 h1:nLfCJMkUuFt7ansi/YvCxwwxLFrgHCA3cYP4sJKYQdk= -github.com/cosmos/cosmos-sdk v0.39.2/go.mod h1:VNUluciWBFj2vkhpMcp8rYZL/kCw0FtNc7SseUjE1KM= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= +github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= +github.com/cosmos/cosmos-sdk v0.45.1 h1:PY79YxPea5qlRLExRnzg8/rT1Scc8GGgRs22p7DX99Q= +github.com/cosmos/cosmos-sdk v0.45.1/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= +github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= +github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= +github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= +github.com/cosmos/ibc-go/v3 v3.0.0 h1:XUNplHVS51Q2gMnTFsFsH9QJ7flsovMamnltKbEgPQ4= +github.com/cosmos/ibc-go/v3 v3.0.0/go.mod h1:Mb+1NXiPOLd+CPFlOC6BKeAUaxXlhuWenMmRiUiSmwY= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= +github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= +github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= +github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= +github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b h1:HBah4D48ypg3J7Np4N+HY/ZR76fx3HEUGxDU6Uk39oQ= github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= +github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= +github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= +github.com/ethereum/go-ethereum v1.10.16 h1:3oPrumn0bCW/idjcxMn5YYVCdK7VzJYIvwGZUGLEaoc= +github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= +github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= +github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= -github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I= +github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg= -github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= +github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -227,81 +512,178 @@ github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoP github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM= +github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= +github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goupnp v1.0.2 h1:RfGLP+h3mvisuWEyybxNq5Eft3NWhHLPeUN72kpKZoI= +github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= +github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= +github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= +github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= +github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= +github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= +github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= +github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= +github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= +github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= +github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= +github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.7 h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg= +github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= +github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2BA= -github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -310,15 +692,30 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -326,33 +723,77 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= +github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runc v1.0.3 h1:1hbqejyQWCJBvtKAfdO0b1FmaEf2z/bxnjqbARass5k= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= +github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= +github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4= -github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= +github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -360,6 +801,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -368,8 +811,11 @@ github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= -github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -381,49 +827,95 @@ github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7q github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.29.0 h1:3jqPBvKT4OHAbje2Ql7KeaaSicDBCxMYwEJU1zRJceE= +github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= -github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= +github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= +github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= +github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.23.0 h1:UskrK+saS9P9Y789yNNulYKdARjPZuS35B8gJF2x60g= +github.com/rs/zerolog v1.23.0/go.mod h1:6c7hFfxPOy7TacJc4Fcdi24/J0NKYGzjG8FWRI916Qo= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= +github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= +github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= +github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -431,10 +923,16 @@ github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= +github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= +github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= +github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -442,81 +940,147 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d h1:gZZadD8H+fF+n9CmNhYL1Y0dJB+kLOmKd7FbPJLeGHs= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= -github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN+4JgQ= -github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/iavl v0.14.1 h1:jz7YOvGiPwmcqqVMcSMjxCu4WXtQYGhKdKrWTTJ5EKs= -github.com/tendermint/iavl v0.14.1/go.mod h1:QmfViflFiXzxKLQE4tAUuWQHq+RSuQFxablW5oJZ6sE= -github.com/tendermint/tendermint v0.33.5/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= -github.com/tendermint/tendermint v0.33.9 h1:rRKIfu5qAXX5f9bwX1oUXSZz/ALFJjDuivhkbGUQxiU= -github.com/tendermint/tendermint v0.33.9/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM= -github.com/tendermint/tm-db v0.5.1 h1:H9HDq8UEA7Eeg13kdYckkgwwkQLBnJGgX4PgLJRhieY= -github.com/tendermint/tm-db v0.5.1/go.mod h1:g92zWjHpCYlEvQXvy9M168Su8V1IBEeawpXVVBaK4f4= +github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= +github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tendermint/tendermint v0.34.14 h1:GCXmlS8Bqd2Ix3TQCpwYLUNHe+Y+QyJsm5YE+S/FkPo= +github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= +github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= +github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= +github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/sjson v1.1.4/go.mod h1:wXpKXu8CtDjKAZ+3DrKY5ROCorDFahq8l0tey/Lx1fg= +github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= +github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -526,18 +1090,29 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -549,26 +1124,69 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f h1:w6wWR0H+nyVpbSAQbzVEIACVyr/h8l/BEkY6Sokc7Eg= +golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -579,41 +1197,111 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201013132646-2da7054afaeb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 h1:A9i04dxx7Cribqbs8jf3FQLogkL/CV2YN7hj9KWJCkc= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -630,29 +1318,91 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20210112230658-8b4aab62c064 h1:BmCFkEH4nJrYcAc2L08yX5RhYGD4j58PTMkEUDkpz2I= -golang.org/x/tools v0.0.0-20210112230658-8b4aab62c064/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -660,14 +1410,54 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20220211171837-173942840c17 h1:2X+CNIheCutWRyKRte8szGxrE5ggtV4U+NKAbh/oLhg= +google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -678,50 +1468,92 @@ google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= -google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= +nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= +nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/helpers/antehelper.go b/helpers/antehelper.go index 3c912f2a..670d21ee 100644 --- a/helpers/antehelper.go +++ b/helpers/antehelper.go @@ -10,8 +10,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - registertypes "github.com/stratosnet/stratos-chain/x/register/types" ) // StSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas @@ -24,7 +22,7 @@ func StSigVerificationGasConsumer( switch pubKey := pubKey.(type) { case *ed25519.PubKey: meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") - return registertypes.ErrED25519InvalidPubKey + return sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "ED25519 public keys are unsupported") case *secp256k1.PubKey: meter.ConsumeGas(params.SigVerifyCostSecp256k1, "ante verify: secp256k1") return nil diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 00000000..bda80539 --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,19 @@ +version: v1 +lint: + use: + - DEFAULT + - COMMENTS + - FILE_LOWER_SNAKE_CASE + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME + - RPC_REQUEST_RESPONSE_UNIQUE + - RPC_RESPONSE_STANDARD_NAME + - RPC_REQUEST_RESPONSE_UNIQUE + - COMMENT_MESSAGE +breaking: + use: + - FILE \ No newline at end of file diff --git a/proto/stratos/crypto/v1/ethsecp256k1/keys.proto b/proto/stratos/crypto/v1/ethsecp256k1/keys.proto new file mode 100644 index 00000000..45e25a51 --- /dev/null +++ b/proto/stratos/crypto/v1/ethsecp256k1/keys.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package stratos.crypto.v1.ethsecp256k1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1"; + +// PubKey defines a type alias for an ecdsa.PublicKey that implements +// Tendermint's PubKey interface. It represents the 33-byte compressed public +// key format. +message PubKey { + option (gogoproto.goproto_stringer) = false; + + bytes key = 1; +} + +// PrivKey defines a type alias for an ecdsa.PrivateKey that implements +// Tendermint's PrivateKey interface. +message PrivKey { bytes key = 1; } diff --git a/proto/stratos/evm/v1/evm.proto b/proto/stratos/evm/v1/evm.proto new file mode 100644 index 00000000..06731540 --- /dev/null +++ b/proto/stratos/evm/v1/evm.proto @@ -0,0 +1,258 @@ +syntax = "proto3"; +package stratos.evm.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/evm/types"; + +// Params defines the EVM module parameters +message Params { + // evm denom represents the token denomination used to run the EVM state + // transitions. + string evm_denom = 1 [ (gogoproto.moretags) = "yaml:\"evm_denom\"" ]; + // enable create toggles state transitions that use the vm.Create function + bool enable_create = 2 [ (gogoproto.moretags) = "yaml:\"enable_create\"" ]; + // enable call toggles state transitions that use the vm.Call function + bool enable_call = 3 [ (gogoproto.moretags) = "yaml:\"enable_call\"" ]; + // extra eips defines the additional EIPs for the vm.Config + repeated int64 extra_eips = 4 [ + (gogoproto.customname) = "ExtraEIPs", + (gogoproto.moretags) = "yaml:\"extra_eips\"" + ]; + // chain config defines the EVM chain configuration parameters + ChainConfig chain_config = 5 [ + (gogoproto.moretags) = "yaml:\"chain_config\"", + (gogoproto.nullable) = false + ]; + FeeMarketParams fee_market_params = 6 [ + (gogoproto.moretags) = "yaml:\"fee_market_params\"", + (gogoproto.nullable) = false + ]; +} + +// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values +// instead of *big.Int. +message ChainConfig { + // Homestead switch block (nil no fork, 0 = already homestead) + string homestead_block = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"homestead_block\"" + ]; + // TheDAO hard-fork switch block (nil no fork) + string dao_fork_block = 2 [ + (gogoproto.customname) = "DAOForkBlock", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"dao_fork_block\"" + ]; + // Whether the nodes supports or opposes the DAO hard-fork + bool dao_fork_support = 3 [ + (gogoproto.customname) = "DAOForkSupport", + (gogoproto.moretags) = "yaml:\"dao_fork_support\"" + ]; + // EIP150 implements the Gas price changes + // (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork) + string eip150_block = 4 [ + (gogoproto.customname) = "EIP150Block", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"eip150_block\"" + ]; + // EIP150 HF hash (needed for header only clients as only gas pricing changed) + string eip150_hash = 5 [ + (gogoproto.customname) = "EIP150Hash", + (gogoproto.moretags) = "yaml:\"byzantium_block\"" + ]; + // EIP155Block HF block + string eip155_block = 6 [ + (gogoproto.customname) = "EIP155Block", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"eip155_block\"" + ]; + // EIP158 HF block + string eip158_block = 7 [ + (gogoproto.customname) = "EIP158Block", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"eip158_block\"" + ]; + // Byzantium switch block (nil no fork, 0 = already on byzantium) + string byzantium_block = 8 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"byzantium_block\"" + ]; + // Constantinople switch block (nil no fork, 0 = already activated) + string constantinople_block = 9 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"constantinople_block\"" + ]; + // Petersburg switch block (nil same as Constantinople) + string petersburg_block = 10 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"petersburg_block\"" + ]; + // Istanbul switch block (nil no fork, 0 = already on istanbul) + string istanbul_block = 11 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"istanbul_block\"" + ]; + // Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated) + string muir_glacier_block = 12 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"muir_glacier_block\"" + ]; + // Berlin switch block (nil = no fork, 0 = already on berlin) + string berlin_block = 13 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"berlin_block\"" + ]; + // DEPRECATED: EWASM, YOLOV3 and Catalyst block have been deprecated + reserved 14, 15, 16; + reserved "yolo_v3_block", "ewasm_block", "catalyst_block"; + // London switch block (nil = no fork, 0 = already on london) + string london_block = 17 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"london_block\"" + ]; + // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) + string arrow_glacier_block = 18 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"arrow_glacier_block\"" + ]; + // EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in merge proceedings) + string merge_fork_block = 19 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"merge_fork_block\"" + ]; +} + +// State represents a single Storage key value pair item. +message State { + string key = 1; + string value = 2; +} + +// TransactionLogs define the logs generated from a transaction execution +// with a given hash. It it used for import/export data as transactions are not +// persisted on blockchain state after an upgrade. +message TransactionLogs { + string hash = 1; + repeated Log logs = 2; +} + +// Log represents an protobuf compatible Ethereum Log that defines a contract +// log event. These events are generated by the LOG opcode and stored/indexed by +// the node. +message Log { + // Consensus fields: + + // address of the contract that generated the event + string address = 1; + // list of topics provided by the contract. + repeated string topics = 2; + // supplied by the contract, usually ABI-encoded + bytes data = 3; + + // Derived fields. These fields are filled in by the node + // but not secured by consensus. + + // block in which the transaction was included + uint64 block_number = 4 [ (gogoproto.jsontag) = "blockNumber" ]; + // hash of the transaction + string tx_hash = 5 [ (gogoproto.jsontag) = "transactionHash" ]; + // index of the transaction in the block + uint64 tx_index = 6 [ (gogoproto.jsontag) = "transactionIndex" ]; + // hash of the block in which the transaction was included + string block_hash = 7 [ (gogoproto.jsontag) = "blockHash" ]; + // index of the log in the block + uint64 index = 8 [ (gogoproto.jsontag) = "logIndex" ]; + + // The Removed field is true if this log was reverted due to a chain + // reorganisation. You must pay attention to this field if you receive logs + // through a filter query. + bool removed = 9; +} + +// TxResult stores results of Tx execution. +message TxResult { + option (gogoproto.goproto_getters) = false; + + // contract_address contains the ethereum address of the created contract (if + // any). If the state transition is an evm.Call, the contract address will be + // empty. + string contract_address = 1 + [ (gogoproto.moretags) = "yaml:\"contract_address\"" ]; + // bloom represents the bloom filter bytes + bytes bloom = 2; + // tx_logs contains the transaction hash and the proto-compatible ethereum + // logs. + TransactionLogs tx_logs = 3 [ + (gogoproto.moretags) = "yaml:\"tx_logs\"", + (gogoproto.nullable) = false + ]; + // ret defines the bytes from the execution. + bytes ret = 4; + // reverted flag is set to true when the call has been reverted + bool reverted = 5; + // gas_used notes the amount of gas consumed while execution + uint64 gas_used = 6; +} + +// AccessTuple is the element type of an access list. +message AccessTuple { + option (gogoproto.goproto_getters) = false; + + // hex formatted ethereum address + string address = 1; + // hex formatted hashes of the storage keys + repeated string storage_keys = 2 [ (gogoproto.jsontag) = "storageKeys" ]; +} + +// TraceConfig holds extra parameters to trace functions. +message TraceConfig { + // DEPRECATED: DisableMemory and DisableReturnData have been renamed to + // Enable*. + reserved 4, 7; + reserved "disable_memory", "disable_return_data"; + + // custom javascript tracer + string tracer = 1; + // overrides the default timeout of 5 seconds for JavaScript-based tracing + // calls + string timeout = 2; + // number of blocks the tracer is willing to go back + uint64 reexec = 3; + // disable stack capture + bool disable_stack = 5 [ (gogoproto.jsontag) = "disableStack" ]; + // disable storage capture + bool disable_storage = 6 [ (gogoproto.jsontag) = "disableStorage" ]; + // print output during capture end + bool debug = 8; + // maximum length of output, but zero means unlimited + int32 limit = 9; + // Chain overrides, can be used to execute a trace using future fork rules + ChainConfig overrides = 10; + // enable memory capture + bool enable_memory = 11 [ (gogoproto.jsontag) = "enableMemory" ]; + // enable return data capture + bool enable_return_data = 12 [ (gogoproto.jsontag) = "enableReturnData" ]; +} + +// Params defines the EVM module parameters +message FeeMarketParams { + // no base fee forces the EIP-1559 base fee to 0 (needed for 0 price calls) + bool no_base_fee = 1; + // base fee change denominator bounds the amount the base fee can change + // between blocks. + uint32 base_fee_change_denominator = 2; + // elasticity multiplier bounds the maximum gas limit an EIP-1559 block may + // have. + uint32 elasticity_multiplier = 3; + // DEPRECATED: initial base fee for EIP-1559 blocks. + reserved 4; + reserved "initial_base_fee"; + // height at which the base fee calculation is enabled. + int64 enable_height = 5; + // base fee for EIP-1559 blocks. + string base_fee = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/stratos/evm/v1/genesis.proto b/proto/stratos/evm/v1/genesis.proto new file mode 100644 index 00000000..7b17bb76 --- /dev/null +++ b/proto/stratos/evm/v1/genesis.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package stratos.evm.v1; + +import "gogoproto/gogo.proto"; +import "stratos/evm/v1/evm.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/evm/types"; + +// GenesisState defines the evm module's genesis state. +message GenesisState { + // accounts is an array containing the ethereum genesis accounts. + repeated GenesisAccount accounts = 1 [ (gogoproto.nullable) = false ]; + // params defines all the parameters of the module. + Params params = 2 [ (gogoproto.nullable) = false ]; + + /*---------------------------fee market start----------------------------------------*/ + // block gas is the amount of gas used on the last block before the upgrade. + // Zero by default. + uint64 block_gas = 3; +} + +// GenesisAccount defines an account to be initialized in the genesis state. +// Its main difference between with Geth's GenesisAccount is that it uses a +// custom storage type and that it doesn't contain the private key field. +message GenesisAccount { + // address defines an ethereum hex formated address of an account + string address = 1; + // code defines the hex bytes of the account code. + string code = 2; + // storage defines the set of state key values for the account. + repeated State storage = 3 + [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "Storage" ]; +} diff --git a/proto/stratos/evm/v1/query.proto b/proto/stratos/evm/v1/query.proto new file mode 100644 index 00000000..9ff792a9 --- /dev/null +++ b/proto/stratos/evm/v1/query.proto @@ -0,0 +1,299 @@ +syntax = "proto3"; +package stratos.evm.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "google/api/annotations.proto"; +import "stratos/evm/v1/evm.proto"; +import "stratos/evm/v1/tx.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/evm/types"; + +// Query defines the gRPC querier service. +service Query { + // Account queries an Ethereum account. + rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { + option (google.api.http).get = "/stratos/evm/v1/account/{address}"; + } + + // CosmosAccount queries an Ethereum account's Cosmos Address. + rpc CosmosAccount(QueryCosmosAccountRequest) + returns (QueryCosmosAccountResponse) { + option (google.api.http).get = "/stratos/evm/v1/cosmos_account/{address}"; + } + + // ValidatorAccount queries an Ethereum account's from a validator consensus + // Address. + rpc ValidatorAccount(QueryValidatorAccountRequest) + returns (QueryValidatorAccountResponse) { + option (google.api.http).get = + "/stratos/evm/v1/validator_account/{cons_address}"; + } + + // Balance queries the balance of a the EVM denomination for a single + // EthAccount. + rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { + option (google.api.http).get = "/stratos/evm/v1/balances/{address}"; + } + + // Storage queries the balance of all coins for a single account. + rpc Storage(QueryStorageRequest) returns (QueryStorageResponse) { + option (google.api.http).get = "/stratos/evm/v1/storage/{address}/{key}"; + } + + // Code queries the balance of all coins for a single account. + rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { + option (google.api.http).get = "/stratos/evm/v1/codes/{address}"; + } + + // Params queries the parameters of x/evm module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/stratos/evm/v1/params"; + } + + // EthCall implements the `eth_call` rpc api + rpc EthCall(EthCallRequest) returns (MsgEthereumTxResponse) { + option (google.api.http).get = "/stratos/evm/v1/eth_call"; + } + + // EstimateGas implements the `eth_estimateGas` rpc api + rpc EstimateGas(EthCallRequest) returns (EstimateGasResponse) { + option (google.api.http).get = "/stratos/evm/v1/estimate_gas"; + } + + // TraceTx implements the `debug_traceTransaction` rpc api + rpc TraceTx(QueryTraceTxRequest) returns (QueryTraceTxResponse) { + option (google.api.http).get = "/stratos/evm/v1/trace_tx"; + } + + // TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api + rpc TraceBlock(QueryTraceBlockRequest) returns (QueryTraceBlockResponse) { + option (google.api.http).get = "/stratos/evm/v1/trace_block"; + } + + // BaseFee queries the base fee of the parent block of the current block. + rpc QueryBaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) { + option (google.api.http).get = "/stratos/evm/v1/base_fee"; + } + + // BlockGas queries the gas used at a given block height + rpc BlockGas(QueryBlockGasRequest) returns (QueryBlockGasResponse) { + option (google.api.http).get = "/stratos/evm/v1/block_gas"; + } +} + +// QueryAccountRequest is the request type for the Query/Account RPC method. +message QueryAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the account for. + string address = 1; +} + +// QueryAccountResponse is the response type for the Query/Account RPC method. +message QueryAccountResponse { + // balance is the balance of the EVM denomination. + string balance = 1; + // code hash is the hex-formatted code bytes from the EOA. + string code_hash = 2; + // nonce is the account's sequence number. + uint64 nonce = 3; +} + +// QueryCosmosAccountRequest is the request type for the Query/CosmosAccount RPC +// method. +message QueryCosmosAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the account for. + string address = 1; +} + +// QueryCosmosAccountResponse is the response type for the Query/CosmosAccount +// RPC method. +message QueryCosmosAccountResponse { + // cosmos_address is the cosmos address of the account. + string cosmos_address = 1; + // sequence is the account's sequence number. + uint64 sequence = 2; + // account_number is the account numbert + uint64 account_number = 3; +} + +// QueryValidatorAccountRequest is the request type for the +// Query/ValidatorAccount RPC method. +message QueryValidatorAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // cons_address is the validator cons address to query the account for. + string cons_address = 1; +} + +// QueryValidatorAccountResponse is the response type for the +// Query/ValidatorAccount RPC method. +message QueryValidatorAccountResponse { + // account_address is the cosmos address of the account in bech32 format. + string account_address = 1; + // sequence is the account's sequence number. + uint64 sequence = 2; + // account_number is the account number + uint64 account_number = 3; +} + +// QueryBalanceRequest is the request type for the Query/Balance RPC method. +message QueryBalanceRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the balance for. + string address = 1; +} + +// QueryBalanceResponse is the response type for the Query/Balance RPC method. +message QueryBalanceResponse { + // balance is the balance of the EVM denomination. + string balance = 1; +} + +// QueryStorageRequest is the request type for the Query/Storage RPC method. +message QueryStorageRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + /// address is the ethereum hex address to query the storage state for. + string address = 1; + + // key defines the key of the storage state + string key = 2; +} + +// QueryStorageResponse is the response type for the Query/Storage RPC +// method. +message QueryStorageResponse { + // key defines the storage state value hash associated with the given key. + string value = 1; +} + +// QueryCodeRequest is the request type for the Query/Code RPC method. +message QueryCodeRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the code for. + string address = 1; +} + +// QueryCodeResponse is the response type for the Query/Code RPC +// method. +message QueryCodeResponse { + // code represents the code bytes from an ethereum address. + bytes code = 1; +} + +// QueryTxLogsRequest is the request type for the Query/TxLogs RPC method. +message QueryTxLogsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // hash is the ethereum transaction hex hash to query the logs for. + string hash = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryTxLogs is the response type for the Query/TxLogs RPC method. +message QueryTxLogsResponse { + // logs represents the ethereum logs generated from the given transaction. + repeated Log logs = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryParamsRequest defines the request type for querying x/evm parameters. +message QueryParamsRequest {} + +// QueryParamsResponse defines the response type for querying x/evm parameters. +message QueryParamsResponse { + // params define the evm module parameters. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +// EthCallRequest defines EthCall request +message EthCallRequest { + // same json format as the json rpc api. + bytes args = 1; + // the default gas cap to be used + uint64 gas_cap = 2; +} + +// EstimateGasResponse defines EstimateGas response +message EstimateGasResponse { + // the estimated gas + uint64 gas = 1; +} + +// QueryTraceTxRequest defines TraceTx request +message QueryTraceTxRequest { + // msgEthereumTx for the requested transaction + MsgEthereumTx msg = 1; + // transaction index + uint64 tx_index = 2; + // TraceConfig holds extra parameters to trace functions. + TraceConfig trace_config = 3; + // the predecessor transactions included in the same block + // need to be replayed first to get correct context for tracing. + repeated MsgEthereumTx predecessors = 4; + // block number of requested transaction + int64 block_number = 5; + // block hex hash of requested transaction + string block_hash = 6; + // block time of requested transaction + google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// QueryTraceTxResponse defines TraceTx response +message QueryTraceTxResponse { + // response serialized in bytes + bytes data = 1; +} + +// QueryTraceBlockRequest defines TraceTx request +message QueryTraceBlockRequest { + // txs messages in the block + repeated MsgEthereumTx txs = 1; + // TraceConfig holds extra parameters to trace functions. + TraceConfig trace_config = 3; + // block number + int64 block_number = 5; + // block hex hash + string block_hash = 6; + // block time + google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// QueryTraceBlockResponse defines TraceBlock response +message QueryTraceBlockResponse { + bytes data = 1; +} + + +// QueryBaseFeeRequest defines the request type for querying the EIP1559 base +// fee. +message QueryBaseFeeRequest {} + +// BaseFeeResponse returns the EIP1559 base fee. +message QueryBaseFeeResponse { + string base_fee = 1 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; +} + +// QueryBlockGasRequest defines the request type for querying the EIP1559 base +// fee. +message QueryBlockGasRequest {} + +// QueryBlockGasResponse returns block gas used for a given height. +message QueryBlockGasResponse { int64 gas = 1; } \ No newline at end of file diff --git a/proto/stratos/evm/v1/tx.proto b/proto/stratos/evm/v1/tx.proto new file mode 100644 index 00000000..63dbd710 --- /dev/null +++ b/proto/stratos/evm/v1/tx.proto @@ -0,0 +1,172 @@ +syntax = "proto3"; +package stratos.evm.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; +import "stratos/evm/v1/evm.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/evm/types"; + +// Msg defines the evm Msg service. +service Msg { + // EthereumTx defines a method submitting Ethereum transactions. + rpc EthereumTx(MsgEthereumTx) returns (MsgEthereumTxResponse) { + option (google.api.http).post = "/stratos/evm/v1/ethereum_tx"; + }; +} + +// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message. +message MsgEthereumTx { + option (gogoproto.goproto_getters) = false; + + // inner transaction data + google.protobuf.Any data = 1; + // caches + + // encoded storage size of the transaction + double size = 2 [ (gogoproto.jsontag) = "-" ]; + // transaction hash in hex format + string hash = 3 [ (gogoproto.moretags) = "rlp:\"-\"" ]; + // ethereum signer address in hex format. This address value is checked + // against the address derived from the signature (V, R, S) using the + // secp256k1 elliptic curve + string from = 4; +} + +// LegacyTx is the transaction data of regular Ethereum transactions. +message LegacyTx { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "TxData"; + + // nonce corresponds to the account nonce (transaction sequence). + uint64 nonce = 1; + // gas price defines the value for each gas unit + string gas_price = 2 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; + // gas defines the gas limit defined for the transaction. + uint64 gas = 3 [ (gogoproto.customname) = "GasLimit" ]; + // hex formatted address of the recipient + string to = 4; + // value defines the unsigned integer value of the transaction amount. + string value = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customname) = "Amount" + ]; + // input defines the data payload bytes of the transaction. + bytes data = 6; + // v defines the signature value + bytes v = 7; + // r defines the signature value + bytes r = 8; + // s define the signature value + bytes s = 9; +} + +// AccessListTx is the data of EIP-2930 access list transactions. +message AccessListTx { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "TxData"; + + // destination EVM chain ID + string chain_id = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customname) = "ChainID", + (gogoproto.jsontag) = "chainID" + ]; + // nonce corresponds to the account nonce (transaction sequence). + uint64 nonce = 2; + // gas price defines the value for each gas unit + string gas_price = 3 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; + // gas defines the gas limit defined for the transaction. + uint64 gas = 4 [ (gogoproto.customname) = "GasLimit" ]; + // hex formatted address of the recipient + string to = 5; + // value defines the unsigned integer value of the transaction amount. + string value = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customname) = "Amount" + ]; + // input defines the data payload bytes of the transaction. + bytes data = 7; + repeated AccessTuple accesses = 8 [ + (gogoproto.castrepeated) = "AccessList", + (gogoproto.jsontag) = "accessList", + (gogoproto.nullable) = false + ]; + // v defines the signature value + bytes v = 9; + // r defines the signature value + bytes r = 10; + // s define the signature value + bytes s = 11; +} + +// DynamicFeeTx is the data of EIP-1559 dinamic fee transactions. +message DynamicFeeTx { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "TxData"; + + // destination EVM chain ID + string chain_id = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customname) = "ChainID", + (gogoproto.jsontag) = "chainID" + ]; + // nonce corresponds to the account nonce (transaction sequence). + uint64 nonce = 2; + // gas tip cap defines the max value for the gas tip + string gas_tip_cap = 3 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; + // gas fee cap defines the max value for the gas fee + string gas_fee_cap = 4 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; + // gas defines the gas limit defined for the transaction. + uint64 gas = 5 [ (gogoproto.customname) = "GasLimit" ]; + // hex formatted address of the recipient + string to = 6; + // value defines the the transaction amount. + string value = 7 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customname) = "Amount" + ]; + // input defines the data payload bytes of the transaction. + bytes data = 8; + repeated AccessTuple accesses = 9 [ + (gogoproto.castrepeated) = "AccessList", + (gogoproto.jsontag) = "accessList", + (gogoproto.nullable) = false + ]; + // v defines the signature value + bytes v = 10; + // r defines the signature value + bytes r = 11; + // s define the signature value + bytes s = 12; +} + +message ExtensionOptionsEthereumTx { + option (gogoproto.goproto_getters) = false; +} + +// MsgEthereumTxResponse defines the Msg/EthereumTx response type. +message MsgEthereumTxResponse { + option (gogoproto.goproto_getters) = false; + + // ethereum transaction hash in hex format. This hash differs from the + // Tendermint sha256 hash of the transaction bytes. See + // https://github.com/tendermint/tendermint/issues/6539 for reference + string hash = 1; + // logs contains the transaction hash and the proto-compatible ethereum + // logs. + repeated Log logs = 2; + // returned data from evm function (result or data supplied with revert + // opcode) + bytes ret = 3; + // vm error is the error returned by vm execution + string vm_error = 4; + // gas consumed by the transaction + uint64 gas_used = 5; +} diff --git a/proto/stratos/types/v1/account.proto b/proto/stratos/types/v1/account.proto new file mode 100644 index 00000000..38e525d9 --- /dev/null +++ b/proto/stratos/types/v1/account.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package stratos.types.v1; + +import "cosmos/auth/v1beta1/auth.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/types"; + +// EthAccount implements the authtypes.AccountI interface and embeds an +// authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. +message EthAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + + option (cosmos_proto.implements_interface) = + "github.com/cosmos/cosmos-sdk/x/auth/types.AccountI"; + + cosmos.auth.v1beta1.BaseAccount base_account = 1 [ + (gogoproto.embed) = true, + (gogoproto.moretags) = "yaml:\"base_account\"" + ]; + string code_hash = 2 [ (gogoproto.moretags) = "yaml:\"code_hash\"" ]; +} diff --git a/proto/stratos/types/v1/web3.proto b/proto/stratos/types/v1/web3.proto new file mode 100644 index 00000000..e50c7699 --- /dev/null +++ b/proto/stratos/types/v1/web3.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package stratos.types.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/types"; + +message ExtensionOptionsWeb3Tx { + option (gogoproto.goproto_getters) = false; + + // typed data chain id used only in EIP712 Domain and should match + // Ethereum network ID in a Web3 provider (e.g. Metamask). + uint64 typed_data_chain_id = 1 [ + (gogoproto.jsontag) = "typedDataChainID,omitempty", + (gogoproto.customname) = "TypedDataChainID" + ]; + + // fee payer is an account address for the fee payer. It will be validated + // during EIP712 signature checking. + string fee_payer = 2 [ (gogoproto.jsontag) = "feePayer,omitempty" ]; + + // fee payer sig is a signature data from the fee paying account, + // allows to perform fee delegation when using EIP712 Domain. + bytes fee_payer_sig = 3 [ (gogoproto.jsontag) = "feePayerSig,omitempty" ]; +} diff --git a/rpc/apis.go b/rpc/apis.go new file mode 100644 index 00000000..2e13c0a8 --- /dev/null +++ b/rpc/apis.go @@ -0,0 +1,136 @@ +// Package rpc contains RPC handler methods and utilities to start +// Stratos Web3-compatibly JSON-RPC server. +package rpc + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" + + "github.com/ethereum/go-ethereum/rpc" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/debug" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/eth" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/eth/filters" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/miner" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/net" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/personal" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/txpool" + "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/web3" + "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" +) + +// RPC namespaces and API version +const ( + Web3Namespace = "web3" + EthNamespace = "eth" + PersonalNamespace = "personal" + NetNamespace = "net" + TxPoolNamespace = "txpool" + DebugNamespace = "debug" + MinerNamespace = "miner" + + apiVersion = "1.0" +) + +// GetRPCAPIs returns the list of all APIs +func GetRPCAPIs(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient, selectedAPIs []string) []rpc.API { + nonceLock := new(types.AddrLocker) + evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + + var apis []rpc.API + // remove duplicates + selectedAPIs = unique(selectedAPIs) + + for index := range selectedAPIs { + switch selectedAPIs[index] { + case EthNamespace: + apis = append(apis, + rpc.API{ + Namespace: EthNamespace, + Version: apiVersion, + Service: eth.NewPublicAPI(ctx.Logger, clientCtx, evmBackend, nonceLock), + Public: true, + }, + rpc.API{ + Namespace: EthNamespace, + Version: apiVersion, + Service: filters.NewPublicAPI(ctx.Logger, tmWSClient, evmBackend), + Public: true, + }, + ) + case Web3Namespace: + apis = append(apis, + rpc.API{ + Namespace: Web3Namespace, + Version: apiVersion, + Service: web3.NewPublicAPI(), + Public: true, + }, + ) + case NetNamespace: + apis = append(apis, + rpc.API{ + Namespace: NetNamespace, + Version: apiVersion, + Service: net.NewPublicAPI(clientCtx), + Public: true, + }, + ) + case PersonalNamespace: + apis = append(apis, + rpc.API{ + Namespace: PersonalNamespace, + Version: apiVersion, + Service: personal.NewAPI(ctx.Logger, clientCtx, evmBackend), + Public: false, + }, + ) + case TxPoolNamespace: + apis = append(apis, + rpc.API{ + Namespace: TxPoolNamespace, + Version: apiVersion, + Service: txpool.NewPublicAPI(ctx.Logger), + Public: true, + }, + ) + case DebugNamespace: + apis = append(apis, + rpc.API{ + Namespace: DebugNamespace, + Version: apiVersion, + Service: debug.NewAPI(ctx, evmBackend, clientCtx), + Public: true, + }, + ) + case MinerNamespace: + apis = append(apis, + rpc.API{ + Namespace: MinerNamespace, + Version: apiVersion, + Service: miner.NewPrivateAPI(ctx, clientCtx, evmBackend), + Public: false, + }, + ) + default: + ctx.Logger.Error("invalid namespace value", "namespace", selectedAPIs[index]) + } + } + + return apis +} + +func unique(intSlice []string) []string { + keys := make(map[string]bool) + var list []string + for _, entry := range intSlice { + if _, value := keys[entry]; !value { + keys[entry] = true + list = append(list, entry) + } + } + return list +} diff --git a/rpc/ethereum/backend/backend.go b/rpc/ethereum/backend/backend.go new file mode 100644 index 00000000..43ed8c35 --- /dev/null +++ b/rpc/ethereum/backend/backend.go @@ -0,0 +1,1056 @@ +package backend + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "math/big" + "strconv" + "time" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/accounts/keystore" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rpc" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + + "github.com/pkg/errors" + "github.com/tendermint/tendermint/libs/log" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/client" + sdk "github.com/cosmos/cosmos-sdk/types" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/server/config" + stratos "github.com/stratosnet/stratos-chain/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" + //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" +) + +// Backend implements the functionality shared within namespaces. +// Implemented by EVMBackend. +type Backend interface { + // Fee API + FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*types.FeeHistoryResult, error) + + // General Ethereum API + RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection + RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection + RPCTxFeeCap() float64 // RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for send-transaction variants. The unit is ether. + + RPCMinGasPrice() int64 + SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) + + // Blockchain API + BlockNumber() (hexutil.Uint64, error) + GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) + GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) + GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) + GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) + BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) + BlockByHash(blockHash common.Hash) (*ethtypes.Block, error) + CurrentHeader() *ethtypes.Header + HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) + HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) + PendingTransactions() ([]*sdk.Tx, error) + GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) + SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) + GetCoinbase() (sdk.AccAddress, error) + GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) + GetTxByEthHash(txHash common.Hash) (*tmrpctypes.ResultTx, error) + GetTxByTxIndex(height int64, txIndex uint) (*tmrpctypes.ResultTx, error) + EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) + BaseFee(height int64) (*big.Int, error) + + // Filter API + BloomStatus() (uint64, uint64) + GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) + GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) + ChainConfig() *params.ChainConfig + SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) + GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx +} + +var _ Backend = (*EVMBackend)(nil) + +var bAttributeKeyEthereumBloom = []byte(evmtypes.AttributeKeyEthereumBloom) + +// EVMBackend implements the Backend interface +type EVMBackend struct { + ctx context.Context + clientCtx client.Context + queryClient *types.QueryClient // gRPC query client + logger log.Logger + chainID *big.Int + cfg config.Config +} + +// NewEVMBackend creates a new EVMBackend instance +func NewEVMBackend(ctx *server.Context, logger log.Logger, clientCtx client.Context) *EVMBackend { + chainID, err := stratos.ParseChainID(clientCtx.ChainID) + if err != nil { + panic(err) + } + + appConf := config.GetConfig(ctx.Viper) + + return &EVMBackend{ + ctx: context.Background(), + clientCtx: clientCtx, + queryClient: types.NewQueryClient(clientCtx), + logger: logger.With("module", "evm-backend"), + chainID: chainID, + cfg: appConf, + } +} + +// BlockNumber returns the current block number in abci app state. +// Because abci app state could lag behind from tendermint latest block, it's more stable +// for the client to use the latest block number in abci app state than tendermint rpc. +func (e *EVMBackend) BlockNumber() (hexutil.Uint64, error) { + // do any grpc query, ignore the response and use the returned block height + var header metadata.MD + _, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}, grpc.Header(&header)) + if err != nil { + return hexutil.Uint64(0), err + } + + blockHeightHeader := header.Get(grpctypes.GRPCBlockHeightHeader) + if headerLen := len(blockHeightHeader); headerLen != 1 { + return 0, fmt.Errorf("unexpected '%s' gRPC header length; got %d, expected: %d", grpctypes.GRPCBlockHeightHeader, headerLen, 1) + } + + height, err := strconv.ParseUint(blockHeightHeader[0], 10, 64) + if err != nil { + return 0, fmt.Errorf("failed to parse block height: %w", err) + } + + return hexutil.Uint64(height), nil +} + +// GetBlockByNumber returns the block identified by number. +func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) { + resBlock, err := e.GetTendermintBlockByNumber(blockNum) + if err != nil { + return nil, err + } + + // return if requested block height is greater than the current one + if resBlock == nil || resBlock.Block == nil { + return nil, nil + } + + res, err := e.EthBlockFromTendermint(resBlock.Block, fullTx) + if err != nil { + e.logger.Debug("EthBlockFromTendermint failed", "height", blockNum, "error", err.Error()) + return nil, err + } + + return res, nil +} + +// GetBlockByHash returns the block identified by hash. +func (e *EVMBackend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { + resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) + if err != nil { + e.logger.Debug("BlockByHash block not found", "hash", hash.Hex(), "error", err.Error()) + return nil, err + } + + if resBlock == nil || resBlock.Block == nil { + e.logger.Debug("BlockByHash block not found", "hash", hash.Hex()) + return nil, nil + } + + return e.EthBlockFromTendermint(resBlock.Block, fullTx) +} + +// BlockByNumber returns the block identified by number. +func (e *EVMBackend) BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) { + height := blockNum.Int64() + + switch blockNum { + case types.EthLatestBlockNumber: + currentBlockNumber, _ := e.BlockNumber() + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthPendingBlockNumber: + currentBlockNumber, _ := e.BlockNumber() + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthEarliestBlockNumber: + height = 1 + default: + if blockNum < 0 { + return nil, errors.Errorf("incorrect block height: %d", height) + } + } + + resBlock, err := e.clientCtx.Client.Block(e.ctx, &height) + if err != nil { + e.logger.Debug("HeaderByNumber failed", "height", height) + return nil, err + } + + if resBlock == nil || resBlock.Block == nil { + return nil, errors.Errorf("block not found for height %d", height) + } + + return e.EthBlockFromTm(resBlock.Block) +} + +// BlockByHash returns the block identified by hash. +func (e *EVMBackend) BlockByHash(hash common.Hash) (*ethtypes.Block, error) { + resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) + if err != nil { + e.logger.Debug("HeaderByHash failed", "hash", hash.Hex()) + return nil, err + } + + if resBlock == nil || resBlock.Block == nil { + return nil, errors.Errorf("block not found for hash %s", hash) + } + + return e.EthBlockFromTm(resBlock.Block) +} + +func (e *EVMBackend) EthBlockFromTm(block *tmtypes.Block) (*ethtypes.Block, error) { + height := block.Height + bloom, err := e.BlockBloom(&height) + if err != nil { + e.logger.Debug("HeaderByNumber BlockBloom failed", "height", height) + } + + baseFee, err := e.BaseFee(height) + if err != nil { + e.logger.Debug("HeaderByNumber BaseFee failed", "height", height, "error", err.Error()) + return nil, err + } + + ethHeader := types.EthHeaderFromTendermint(block.Header, bloom, baseFee) + + var txs []*ethtypes.Transaction + for _, txBz := range block.Txs { + tx, err := e.clientCtx.TxConfig.TxDecoder()(txBz) + if err != nil { + e.logger.Debug("failed to decode transaction in block", "height", height, "error", err.Error()) + continue + } + + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + continue + } + + tx := ethMsg.AsTransaction() + txs = append(txs, tx) + } + } + + // TODO: add tx receipts + ethBlock := ethtypes.NewBlock(ethHeader, txs, nil, nil, nil) + return ethBlock, nil +} + +// GetTendermintBlockByNumber returns a Tendermint format block by block number +func (e *EVMBackend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) { + height := blockNum.Int64() + currentBlockNumber, _ := e.BlockNumber() + + switch blockNum { + case types.EthLatestBlockNumber: + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthPendingBlockNumber: + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthEarliestBlockNumber: + height = 1 + default: + if blockNum < 0 { + return nil, errors.Errorf("cannot fetch a negative block height: %d", height) + } + if height > int64(currentBlockNumber) { + return nil, nil + } + } + + resBlock, err := e.clientCtx.Client.Block(e.ctx, &height) + if err != nil { + if resBlock, err = e.clientCtx.Client.Block(e.ctx, nil); err != nil { + e.logger.Debug("tendermint client failed to get latest block", "height", height, "error", err.Error()) + return nil, nil + } + } + + if resBlock.Block == nil { + e.logger.Debug("GetBlockByNumber block not found", "height", height) + return nil, nil + } + + return resBlock, nil +} + +// GetTendermintBlockByHash returns a Tendermint format block by block number +func (e *EVMBackend) GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) { + resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, blockHash.Bytes()) + if err != nil { + e.logger.Debug("tendermint client failed to get block", "blockHash", blockHash.Hex(), "error", err.Error()) + } + + if resBlock == nil || resBlock.Block == nil { + e.logger.Debug("GetBlockByNumber block not found", "blockHash", blockHash.Hex()) + return nil, nil + } + + return resBlock, nil +} + +// BlockBloom query block bloom filter from block results +func (e *EVMBackend) BlockBloom(height *int64) (ethtypes.Bloom, error) { + result, err := e.clientCtx.Client.BlockResults(e.ctx, height) + if err != nil { + return ethtypes.Bloom{}, err + } + for _, event := range result.EndBlockEvents { + if event.Type != evmtypes.EventTypeBlockBloom { + continue + } + + for _, attr := range event.Attributes { + if bytes.Equal(attr.Key, bAttributeKeyEthereumBloom) { + return ethtypes.BytesToBloom(attr.Value), nil + } + } + } + return ethtypes.Bloom{}, errors.New("block bloom event is not found") +} + +// EthBlockFromTendermint returns a JSON-RPC compatible Ethereum block from a given Tendermint block and its block result. +func (e *EVMBackend) EthBlockFromTendermint( + block *tmtypes.Block, + fullTx bool, +) (map[string]interface{}, error) { + ethRPCTxs := []interface{}{} + + ctx := types.ContextWithHeight(block.Height) + + baseFee, err := e.BaseFee(block.Height) + if err != nil { + return nil, err + } + + resBlockResult, err := e.clientCtx.Client.BlockResults(ctx, &block.Height) + if err != nil { + return nil, err + } + + txResults := resBlockResult.TxsResults + + for i, txBz := range block.Txs { + tx, err := e.clientCtx.TxConfig.TxDecoder()(txBz) + if err != nil { + e.logger.Debug("failed to decode transaction in block", "height", block.Height, "error", err.Error()) + continue + } + + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + continue + } + + tx := ethMsg.AsTransaction() + + // check tx exists on EVM by cross checking with blockResults + if txResults[i].Code != 0 { + e.logger.Debug("invalid tx result code", "hash", tx.Hash().Hex()) + continue + } + + if !fullTx { + hash := tx.Hash() + ethRPCTxs = append(ethRPCTxs, hash) + continue + } + + rpcTx, err := types.NewRPCTransaction( + tx, + common.BytesToHash(block.Hash()), + uint64(block.Height), + uint64(i), + baseFee, + ) + if err != nil { + e.logger.Debug("NewTransactionFromData for receipt failed", "hash", tx.Hash().Hex(), "error", err.Error()) + continue + } + ethRPCTxs = append(ethRPCTxs, rpcTx) + } + } + + bloom, err := e.BlockBloom(&block.Height) + if err != nil { + e.logger.Debug("failed to query BlockBloom", "height", block.Height, "error", err.Error()) + } + + req := &evmtypes.QueryValidatorAccountRequest{ + ConsAddress: sdk.ConsAddress(block.Header.ProposerAddress).String(), + } + + res, err := e.queryClient.ValidatorAccount(ctx, req) + if err != nil { + e.logger.Debug( + "failed to query validator operator address", + "height", block.Height, + "cons-address", req.ConsAddress, + "error", err.Error(), + ) + return nil, err + } + + addr, err := sdk.AccAddressFromBech32(res.AccountAddress) + if err != nil { + return nil, err + } + + validatorAddr := common.BytesToAddress(addr) + + gasLimit, err := types.BlockMaxGasFromConsensusParams(ctx, e.clientCtx, block.Height) + if err != nil { + e.logger.Error("failed to query consensus params", "error", err.Error()) + } + + gasUsed := uint64(0) + + for _, txsResult := range txResults { + // workaround for cosmos-sdk bug. https://github.com/cosmos/cosmos-sdk/issues/10832 + if txsResult.GetCode() == 11 && txsResult.GetLog() == "no block gas left to run tx: out of gas" { + // block gas limit has exceeded, other txs must have failed with same reason. + break + } + gasUsed += uint64(txsResult.GetGasUsed()) + } + + formattedBlock := types.FormatBlock( + block.Header, block.Size(), + gasLimit, new(big.Int).SetUint64(gasUsed), + ethRPCTxs, bloom, validatorAddr, baseFee, + ) + return formattedBlock, nil +} + +// CurrentHeader returns the latest block header +func (e *EVMBackend) CurrentHeader() *ethtypes.Header { + header, _ := e.HeaderByNumber(types.EthLatestBlockNumber) + return header +} + +// HeaderByNumber returns the block header identified by height. +func (e *EVMBackend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) { + height := blockNum.Int64() + + switch blockNum { + case types.EthLatestBlockNumber: + currentBlockNumber, _ := e.BlockNumber() + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthPendingBlockNumber: + currentBlockNumber, _ := e.BlockNumber() + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthEarliestBlockNumber: + height = 1 + default: + if blockNum < 0 { + return nil, errors.Errorf("incorrect block height: %d", height) + } + } + + resBlock, err := e.clientCtx.Client.Block(e.ctx, &height) + if err != nil { + e.logger.Debug("HeaderByNumber failed") + return nil, err + } + + bloom, err := e.BlockBloom(&resBlock.Block.Height) + if err != nil { + e.logger.Debug("HeaderByNumber BlockBloom failed", "height", resBlock.Block.Height) + } + + baseFee, err := e.BaseFee(resBlock.Block.Height) + if err != nil { + e.logger.Debug("HeaderByNumber BaseFee failed", "height", resBlock.Block.Height, "error", err.Error()) + return nil, err + } + + ethHeader := types.EthHeaderFromTendermint(resBlock.Block.Header, bloom, baseFee) + return ethHeader, nil +} + +// HeaderByHash returns the block header identified by hash. +func (e *EVMBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) { + resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, blockHash.Bytes()) + if err != nil { + e.logger.Debug("HeaderByHash failed", "hash", blockHash.Hex()) + return nil, err + } + + if resBlock == nil || resBlock.Block == nil { + return nil, errors.Errorf("block not found for hash %s", blockHash.Hex()) + } + + bloom, err := e.BlockBloom(&resBlock.Block.Height) + if err != nil { + e.logger.Debug("HeaderByHash BlockBloom failed", "height", resBlock.Block.Height) + } + + baseFee, err := e.BaseFee(resBlock.Block.Height) + if err != nil { + e.logger.Debug("HeaderByHash BaseFee failed", "height", resBlock.Block.Height, "error", err.Error()) + return nil, err + } + + ethHeader := types.EthHeaderFromTendermint(resBlock.Block.Header, bloom, baseFee) + return ethHeader, nil +} + +// PendingTransactions returns the transactions that are in the transaction pool +// and have a from address that is one of the accounts this node manages. +func (e *EVMBackend) PendingTransactions() ([]*sdk.Tx, error) { + res, err := e.clientCtx.Client.UnconfirmedTxs(e.ctx, nil) + if err != nil { + return nil, err + } + + result := make([]*sdk.Tx, 0, len(res.Txs)) + for _, txBz := range res.Txs { + tx, err := e.clientCtx.TxConfig.TxDecoder()(txBz) + if err != nil { + return nil, err + } + result = append(result, &tx) + } + + return result, nil +} + +// GetLogsByHeight returns all the logs from all the ethereum transactions in a block. +func (e *EVMBackend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) { + // NOTE: we query the state in case the tx result logs are not persisted after an upgrade. + blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, height) + if err != nil { + return nil, err + } + + blockLogs := [][]*ethtypes.Log{} + for _, txResult := range blockRes.TxsResults { + logs, err := AllTxLogsFromEvents(txResult.Events) + if err != nil { + return nil, err + } + + blockLogs = append(blockLogs, logs...) + } + + return blockLogs, nil +} + +// GetLogs returns all the logs from all the ethereum transactions in a block. +func (e *EVMBackend) GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) { + block, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) + if err != nil { + return nil, err + } + return e.GetLogsByHeight(&block.Block.Header.Height) +} + +func (e *EVMBackend) GetLogsByNumber(blockNum types.BlockNumber) ([][]*ethtypes.Log, error) { + height := blockNum.Int64() + + switch blockNum { + case types.EthLatestBlockNumber: + currentBlockNumber, _ := e.BlockNumber() + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthPendingBlockNumber: + currentBlockNumber, _ := e.BlockNumber() + if currentBlockNumber > 0 { + height = int64(currentBlockNumber) + } + case types.EthEarliestBlockNumber: + height = 1 + default: + if blockNum < 0 { + return nil, errors.Errorf("incorrect block height: %d", height) + } + } + + return e.GetLogsByHeight(&height) +} + +// BloomStatus returns the BloomBitsBlocks and the number of processed sections maintained +// by the chain indexer. +func (e *EVMBackend) BloomStatus() (uint64, uint64) { + return 4096, 0 +} + +// GetCoinbase is the address that staking rewards will be send to (alias for Etherbase). +func (e *EVMBackend) GetCoinbase() (sdk.AccAddress, error) { + node, err := e.clientCtx.GetNode() + if err != nil { + return nil, err + } + + status, err := node.Status(e.ctx) + if err != nil { + return nil, err + } + + req := &evmtypes.QueryValidatorAccountRequest{ + ConsAddress: sdk.ConsAddress(status.ValidatorInfo.Address).String(), + } + + res, err := e.queryClient.ValidatorAccount(e.ctx, req) + if err != nil { + return nil, err + } + + address, _ := sdk.AccAddressFromBech32(res.AccountAddress) + return address, nil +} + +// GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash +func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) { + res, err := e.GetTxByEthHash(txHash) + hexTx := txHash.Hex() + if err != nil { + // try to find tx in mempool + txs, err := e.PendingTransactions() + if err != nil { + e.logger.Debug("tx not found", "hash", hexTx, "error", err.Error()) + return nil, nil + } + + for _, tx := range txs { + msg, err := evmtypes.UnwrapEthereumMsg(tx, txHash) + if err != nil { + // not ethereum tx + continue + } + + if msg.Hash == hexTx { + rpctx, err := types.NewTransactionFromMsg( + msg, + common.Hash{}, + uint64(0), + uint64(0), + e.chainID, + ) + if err != nil { + return nil, err + } + return rpctx, nil + } + } + + e.logger.Debug("tx not found", "hash", hexTx) + return nil, nil + } + + if res.TxResult.Code != 0 { + return nil, errors.New("invalid ethereum tx") + } + + msgIndex, attrs := types.FindTxAttributes(res.TxResult.Events, hexTx) + if msgIndex < 0 { + return nil, fmt.Errorf("ethereum tx not found in msgs: %s", hexTx) + } + + tx, err := e.clientCtx.TxConfig.TxDecoder()(res.Tx) + if err != nil { + return nil, err + } + + // the `msgIndex` is inferred from tx events, should be within the bound. + msg, ok := tx.GetMsgs()[msgIndex].(*evmtypes.MsgEthereumTx) + if !ok { + return nil, errors.New("invalid ethereum tx") + } + + block, err := e.clientCtx.Client.Block(e.ctx, &res.Height) + if err != nil { + e.logger.Debug("block not found", "height", res.Height, "error", err.Error()) + return nil, err + } + + // Try to find txIndex from events + found := false + txIndex, err := types.GetUint64Attribute(attrs, evmtypes.AttributeKeyTxIndex) + if err == nil { + found = true + } else { + // Fallback to find tx index by iterating all valid eth transactions + blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &block.Block.Height) + if err != nil { + return nil, nil + } + msgs := e.GetEthereumMsgsFromTendermintBlock(block, blockRes) + for i := range msgs { + if msgs[i].Hash == hexTx { + txIndex = uint64(i) + found = true + break + } + } + } + if !found { + return nil, errors.New("can't find index of ethereum tx") + } + + return types.NewTransactionFromMsg( + msg, + common.BytesToHash(block.BlockID.Hash.Bytes()), + uint64(res.Height), + txIndex, + e.chainID, + ) +} + +// GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash +// TODO: Don't need to convert once hashing is fixed on Tendermint +// https://github.com/tendermint/tendermint/issues/6539 +func (e *EVMBackend) GetTxByEthHash(hash common.Hash) (*tmrpctypes.ResultTx, error) { + query := fmt.Sprintf("%s.%s='%s'", evmtypes.TypeMsgEthereumTx, evmtypes.AttributeKeyEthereumTxHash, hash.Hex()) + resTxs, err := e.clientCtx.Client.TxSearch(e.ctx, query, false, nil, nil, "") + if err != nil { + return nil, err + } + if len(resTxs.Txs) == 0 { + return nil, errors.Errorf("ethereum tx not found for hash %s", hash.Hex()) + } + return resTxs.Txs[0], nil +} + +// GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs +func (e *EVMBackend) GetTxByTxIndex(height int64, index uint) (*tmrpctypes.ResultTx, error) { + query := fmt.Sprintf("tx.height=%d AND %s.%s=%d", + height, evmtypes.TypeMsgEthereumTx, + evmtypes.AttributeKeyTxIndex, index, + ) + resTxs, err := e.clientCtx.Client.TxSearch(e.ctx, query, false, nil, nil, "") + if err != nil { + return nil, err + } + if len(resTxs.Txs) == 0 { + return nil, errors.Errorf("ethereum tx not found for block %d index %d", height, index) + } + return resTxs.Txs[0], nil +} + +func (e *EVMBackend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { + // Look up the wallet containing the requested signer + _, err := e.clientCtx.Keyring.KeyByAddress(sdk.AccAddress(args.From.Bytes())) + if err != nil { + e.logger.Error("failed to find key in keyring", "address", args.From, "error", err.Error()) + return common.Hash{}, fmt.Errorf("%s; %s", keystore.ErrNoMatch, err.Error()) + } + + args, err = e.SetTxDefaults(args) + if err != nil { + return common.Hash{}, err + } + + msg := args.ToTransaction() + if err := msg.ValidateBasic(); err != nil { + e.logger.Debug("tx failed basic validation", "error", err.Error()) + return common.Hash{}, err + } + + bn, err := e.BlockNumber() + if err != nil { + e.logger.Debug("failed to fetch latest block number", "error", err.Error()) + return common.Hash{}, err + } + + signer := ethtypes.MakeSigner(e.ChainConfig(), new(big.Int).SetUint64(uint64(bn))) + + // Sign transaction + if err := msg.Sign(signer, e.clientCtx.Keyring); err != nil { + e.logger.Debug("failed to sign tx", "error", err.Error()) + return common.Hash{}, err + } + + // Query params to use the EVM denomination + res, err := e.queryClient.QueryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) + if err != nil { + e.logger.Error("failed to query evm params", "error", err.Error()) + return common.Hash{}, err + } + + // Assemble transaction from fields + tx, err := msg.BuildTx(e.clientCtx.TxConfig.NewTxBuilder(), res.Params.EvmDenom) + if err != nil { + e.logger.Error("build cosmos tx failed", "error", err.Error()) + return common.Hash{}, err + } + + // Encode transaction by default Tx encoder + txEncoder := e.clientCtx.TxConfig.TxEncoder() + txBytes, err := txEncoder(tx) + if err != nil { + e.logger.Error("failed to encode eth tx using default encoder", "error", err.Error()) + return common.Hash{}, err + } + + txHash := msg.AsTransaction().Hash() + + // Broadcast transaction in sync mode (default) + // NOTE: If error is encountered on the node, the broadcast will not return an error + syncCtx := e.clientCtx.WithBroadcastMode(flags.BroadcastSync) + rsp, err := syncCtx.BroadcastTx(txBytes) + if rsp != nil && rsp.Code != 0 { + err = sdkerrors.ABCIError(rsp.Codespace, rsp.Code, rsp.RawLog) + } + if err != nil { + e.logger.Error("failed to broadcast tx", "error", err.Error()) + return txHash, err + } + + // Return transaction hash + return txHash, nil +} + +// EstimateGas returns an estimate of gas usage for the given smart contract call. +func (e *EVMBackend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) { + blockNr := types.EthPendingBlockNumber + if blockNrOptional != nil { + blockNr = *blockNrOptional + } + + bz, err := json.Marshal(&args) + if err != nil { + return 0, err + } + + req := evmtypes.EthCallRequest{ + Args: bz, + GasCap: e.RPCGasCap(), + } + + // From ContextWithHeight: if the provided height is 0, + // it will return an empty context and the gRPC query will use + // the latest block height for querying. + res, err := e.queryClient.EstimateGas(types.ContextWithHeight(blockNr.Int64()), &req) + if err != nil { + return 0, err + } + return hexutil.Uint64(res.Gas), nil +} + +// GetTransactionCount returns the number of transactions at the given address up to the given block number. +func (e *EVMBackend) GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) { + // Get nonce (sequence) from account + from := sdk.AccAddress(address.Bytes()) + accRet := e.clientCtx.AccountRetriever + + err := accRet.EnsureExists(e.clientCtx, from) + if err != nil { + // account doesn't exist yet, return 0 + n := hexutil.Uint64(0) + return &n, nil + } + + includePending := blockNum == types.EthPendingBlockNumber + nonce, err := e.getAccountNonce(address, includePending, blockNum.Int64(), e.logger) + if err != nil { + return nil, err + } + + n := hexutil.Uint64(nonce) + return &n, nil +} + +// RPCGasCap is the global gas cap for eth-call variants. +func (e *EVMBackend) RPCGasCap() uint64 { + return e.cfg.JSONRPC.GasCap +} + +// RPCEVMTimeout is the global evm timeout for eth-call variants. +func (e *EVMBackend) RPCEVMTimeout() time.Duration { + return e.cfg.JSONRPC.EVMTimeout +} + +// RPCGasCap is the global gas cap for eth-call variants. +func (e *EVMBackend) RPCTxFeeCap() float64 { + return e.cfg.JSONRPC.TxFeeCap +} + +// RPCFilterCap is the limit for total number of filters that can be created +func (e *EVMBackend) RPCFilterCap() int32 { + return e.cfg.JSONRPC.FilterCap +} + +// RPCFeeHistoryCap is the limit for total number of blocks that can be fetched +func (e *EVMBackend) RPCFeeHistoryCap() int32 { + return e.cfg.JSONRPC.FeeHistoryCap +} + +// RPCLogsCap defines the max number of results can be returned from single `eth_getLogs` query. +func (e *EVMBackend) RPCLogsCap() int32 { + return e.cfg.JSONRPC.LogsCap +} + +// RPCBlockRangeCap defines the max block range allowed for `eth_getLogs` query. +func (e *EVMBackend) RPCBlockRangeCap() int32 { + return e.cfg.JSONRPC.BlockRangeCap +} + +// RPCMinGasPrice returns the minimum gas price for a transaction obtained from +// the node config. If set value is 0, it will default to 20. + +func (e *EVMBackend) RPCMinGasPrice() int64 { + evmParams, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) + if err != nil { + return stratos.DefaultGasPrice + } + + minGasPrice := e.cfg.GetMinGasPrices() + amt := minGasPrice.AmountOf(evmParams.Params.EvmDenom).TruncateInt64() + if amt == 0 { + return stratos.DefaultGasPrice + } + + return amt +} + +// ChainConfig return the ethereum chain configuration +func (e *EVMBackend) ChainConfig() *params.ChainConfig { + params, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) + if err != nil { + return nil + } + + return params.Params.ChainConfig.EthereumConfig(e.chainID) +} + +// SuggestGasTipCap returns the suggested tip cap +// Although we don't support tx prioritization yet, but we return a positive value to help client to +// mitigate the base fee changes. +func (e *EVMBackend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) { + if baseFee == nil { + // london hardfork not enabled or feemarket not enabeld + return big.NewInt(0), nil + } + + params, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) + if err != nil { + return nil, err + } + // calculate the maximum base fee delta in current block, assuming all block gas limit is consumed + // ``` + // GasTarget = GasLimit / ElasticityMultiplier + // Delta = BaseFee * (GasUsed - GasTarget) / GasTarget / Denominator + // ``` + // The delta is at maximum when `GasUsed` is equal to `GasLimit`, which is: + // ``` + // MaxDelta = BaseFee * (GasLimit - GasLimit / ElasticityMultiplier) / (GasLimit / ElasticityMultiplier) / Denominator + // = BaseFee * (ElasticityMultiplier - 1) / Denominator + // ``` + maxDelta := baseFee.Int64() * (int64(params.Params.FeeMarketParams.ElasticityMultiplier) - 1) / int64(params.Params.FeeMarketParams.BaseFeeChangeDenominator) + if maxDelta < 0 { + // impossible if the parameter validation passed. + maxDelta = 0 + } + return big.NewInt(maxDelta), nil +} + +// BaseFee returns the base fee tracked by the Fee Market module. If the base fee is not enabled, +// it returns the initial base fee amount. Return nil if London is not activated. +func (e *EVMBackend) BaseFee(height int64) (*big.Int, error) { + cfg := e.ChainConfig() + if !cfg.IsLondon(new(big.Int).SetInt64(height)) { + return nil, nil + } + + // Checks the feemarket param NoBaseFee settings, return 0 if it is enabled. + resParams, err := e.queryClient.Params(types.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}) + if err != nil { + return nil, err + } + + if resParams.Params.FeeMarketParams.NoBaseFee { + return big.NewInt(0), nil + } + + blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &height) + if err != nil { + return nil, err + } + + baseFee := types.BaseFeeFromEvents(blockRes.BeginBlockEvents) + if baseFee != nil { + return baseFee, nil + } + + // If we cannot find in events, we tried to get it from the state. + // It will return feemarket.baseFee if london is activated but feemarket is not enable + res, err := e.queryClient.QueryBaseFee(types.ContextWithHeight(height), &evmtypes.QueryBaseFeeRequest{}) + if err == nil && res.BaseFee != nil { + return res.BaseFee.BigInt(), nil + } + + return nil, nil +} + +// GetEthereumMsgsFromTendermintBlock returns all real MsgEthereumTxs from a Tendermint block. +// It also ensures consistency over the correct txs indexes across RPC endpoints +func (e *EVMBackend) GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx { + var result []*evmtypes.MsgEthereumTx + + txResults := blockRes.TxsResults + + for i, tx := range block.Block.Txs { + // check tx exists on EVM by cross checking with blockResults + if txResults[i].Code != 0 { + e.logger.Debug("invalid tx result code", "cosmos-hash", hexutil.Encode(tx.Hash())) + continue + } + + tx, err := e.clientCtx.TxConfig.TxDecoder()(tx) + if err != nil { + e.logger.Debug("failed to decode transaction in block", "height", block.Block.Height, "error", err.Error()) + continue + } + + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + continue + } + + result = append(result, ethMsg) + } + } + + return result +} diff --git a/rpc/ethereum/backend/feebackend.go b/rpc/ethereum/backend/feebackend.go new file mode 100644 index 00000000..9c60cc92 --- /dev/null +++ b/rpc/ethereum/backend/feebackend.go @@ -0,0 +1,213 @@ +package backend + +import ( + "fmt" + "math/big" + "sort" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/rpc" + + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + + rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +type ( + txGasAndReward struct { + gasUsed uint64 + reward *big.Int + } + sortGasAndReward []txGasAndReward +) + +func (s sortGasAndReward) Len() int { return len(s) } +func (s sortGasAndReward) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s sortGasAndReward) Less(i, j int) bool { + return s[i].reward.Cmp(s[j].reward) < 0 +} + +// output: targetOneFeeHistory +func (e *EVMBackend) processBlock( + tendermintBlock *tmrpctypes.ResultBlock, + ethBlock *map[string]interface{}, + rewardPercentiles []float64, + tendermintBlockResult *tmrpctypes.ResultBlockResults, + targetOneFeeHistory *rpctypes.OneFeeHistory) error { + blockHeight := tendermintBlock.Block.Height + blockBaseFee, err := e.BaseFee(blockHeight) + if err != nil { + return err + } + + // set basefee + targetOneFeeHistory.BaseFee = blockBaseFee + + // set gasused ratio + gasLimitUint64 := (*ethBlock)["gasLimit"].(hexutil.Uint64) + gasUsedBig := (*ethBlock)["gasUsed"].(*hexutil.Big) + gasusedfloat, _ := new(big.Float).SetInt(gasUsedBig.ToInt()).Float64() + + if gasLimitUint64 <= 0 { + return fmt.Errorf("gasLimit of block height %d should be bigger than 0 , current gaslimit %d", blockHeight, gasLimitUint64) + } + + gasUsedRatio := gasusedfloat / float64(gasLimitUint64) + blockGasUsed := gasusedfloat + targetOneFeeHistory.GasUsedRatio = gasUsedRatio + + rewardCount := len(rewardPercentiles) + targetOneFeeHistory.Reward = make([]*big.Int, rewardCount) + for i := 0; i < rewardCount; i++ { + targetOneFeeHistory.Reward[i] = big.NewInt(2000) + } + + // check tendermintTxs + tendermintTxs := tendermintBlock.Block.Txs + tendermintTxResults := tendermintBlockResult.TxsResults + tendermintTxCount := len(tendermintTxs) + sorter := make(sortGasAndReward, tendermintTxCount) + + for i := 0; i < tendermintTxCount; i++ { + eachTendermintTx := tendermintTxs[i] + eachTendermintTxResult := tendermintTxResults[i] + + tx, err := e.clientCtx.TxConfig.TxDecoder()(eachTendermintTx) + if err != nil { + e.logger.Debug("failed to decode transaction in block", "height", blockHeight, "error", err.Error()) + continue + } + txGasUsed := uint64(eachTendermintTxResult.GasUsed) + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + continue + } + tx := ethMsg.AsTransaction() + reward := tx.EffectiveGasTipValue(blockBaseFee) + sorter[i] = txGasAndReward{gasUsed: txGasUsed, reward: reward} + break + } + } + sort.Sort(sorter) + + var txIndex int + sumGasUsed := uint64(0) + if len(sorter) > 0 { + sumGasUsed = sorter[0].gasUsed + } + for i, p := range rewardPercentiles { + thresholdGasUsed := uint64(blockGasUsed * p / 100) + for sumGasUsed < thresholdGasUsed && txIndex < tendermintTxCount-1 { + txIndex++ + sumGasUsed += sorter[txIndex].gasUsed + } + + chosenReward := big.NewInt(0) + if 0 <= txIndex && txIndex < len(sorter) { + chosenReward = sorter[txIndex].reward + } + targetOneFeeHistory.Reward[i] = chosenReward + } + + return nil +} + +// FeeHistory returns data relevant for fee estimation based on the specified range of blocks. +func (e *EVMBackend) FeeHistory( + userBlockCount rpc.DecimalOrHex, // number blocks to fetch, maximum is 100 + lastBlock rpc.BlockNumber, // the block to start search , to oldest + rewardPercentiles []float64, // percentiles to fetch reward +) (*rpctypes.FeeHistoryResult, error) { + blockEnd := int64(lastBlock) + + if blockEnd <= 0 { + blockNumber, err := e.BlockNumber() + if err != nil { + return nil, err + } + blockEnd = int64(blockNumber) + } + userBlockCountInt := int64(userBlockCount) + maxBlockCount := int64(e.cfg.JSONRPC.FeeHistoryCap) + if userBlockCountInt > maxBlockCount { + return nil, fmt.Errorf("FeeHistory user block count %d higher than %d", userBlockCountInt, maxBlockCount) + } + blockStart := blockEnd - userBlockCountInt + if blockStart < 0 { + blockStart = 0 + } + + blockCount := blockEnd - blockStart + + oldestBlock := (*hexutil.Big)(big.NewInt(blockStart)) + + // prepare space + reward := make([][]*hexutil.Big, blockCount) + rewardCount := len(rewardPercentiles) + for i := 0; i < int(blockCount); i++ { + reward[i] = make([]*hexutil.Big, rewardCount) + } + thisBaseFee := make([]*hexutil.Big, blockCount) + thisGasUsedRatio := make([]float64, blockCount) + + // rewards should only be calculated if reward percentiles were included + calculateRewards := rewardCount != 0 + + // fetch block + for blockID := blockStart; blockID < blockEnd; blockID++ { + index := int32(blockID - blockStart) + // eth block + ethBlock, err := e.GetBlockByNumber(rpctypes.BlockNumber(blockID), true) + if ethBlock == nil { + return nil, err + } + + // tendermint block + tendermintblock, err := e.GetTendermintBlockByNumber(rpctypes.BlockNumber(blockID)) + if tendermintblock == nil { + return nil, err + } + + // tendermint block result + tendermintBlockResult, err := e.clientCtx.Client.BlockResults(e.ctx, &tendermintblock.Block.Height) + if tendermintBlockResult == nil { + e.logger.Debug("block result not found", "height", tendermintblock.Block.Height, "error", err.Error()) + return nil, err + } + + oneFeeHistory := rpctypes.OneFeeHistory{} + err = e.processBlock(tendermintblock, ðBlock, rewardPercentiles, tendermintBlockResult, &oneFeeHistory) + if err != nil { + return nil, err + } + + // copy + thisBaseFee[index] = (*hexutil.Big)(oneFeeHistory.BaseFee) + thisGasUsedRatio[index] = oneFeeHistory.GasUsedRatio + if calculateRewards { + for j := 0; j < rewardCount; j++ { + reward[index][j] = (*hexutil.Big)(oneFeeHistory.Reward[j]) + if reward[index][j] == nil { + reward[index][j] = (*hexutil.Big)(big.NewInt(0)) + } + } + } + } + + feeHistory := rpctypes.FeeHistoryResult{ + OldestBlock: oldestBlock, + BaseFee: thisBaseFee, + GasUsedRatio: thisGasUsedRatio, + } + + if calculateRewards { + feeHistory.Reward = reward + } + + return &feeHistory, nil +} diff --git a/rpc/ethereum/backend/utils.go b/rpc/ethereum/backend/utils.go new file mode 100644 index 00000000..e3a1ddd2 --- /dev/null +++ b/rpc/ethereum/backend/utils.go @@ -0,0 +1,255 @@ +package backend + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "math/big" + + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// SetTxDefaults populates tx message with default values in case they are not +// provided on the args +func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) { + if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { + return args, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") + } + + head := e.CurrentHeader() + if head == nil { + return args, errors.New("latest header is nil") + } + + // If user specifies both maxPriorityfee and maxFee, then we do not + // need to consult the chain for defaults. It's definitely a London tx. + if args.MaxPriorityFeePerGas == nil || args.MaxFeePerGas == nil { + // In this clause, user left some fields unspecified. + if head.BaseFee != nil && args.GasPrice == nil { + if args.MaxPriorityFeePerGas == nil { + tip, err := e.SuggestGasTipCap(head.BaseFee) + if err != nil { + return args, err + } + args.MaxPriorityFeePerGas = (*hexutil.Big)(tip) + } + + if args.MaxFeePerGas == nil { + gasFeeCap := new(big.Int).Add( + (*big.Int)(args.MaxPriorityFeePerGas), + new(big.Int).Mul(head.BaseFee, big.NewInt(2)), + ) + args.MaxFeePerGas = (*hexutil.Big)(gasFeeCap) + } + + if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 { + return args, fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas) + } + + } else { + if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil { + return args, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet") + } + + if args.GasPrice == nil { + price, err := e.SuggestGasTipCap(head.BaseFee) + if err != nil { + return args, err + } + if head.BaseFee != nil { + // The legacy tx gas price suggestion should not add 2x base fee + // because all fees are consumed, so it would result in a spiral + // upwards. + price.Add(price, head.BaseFee) + } + args.GasPrice = (*hexutil.Big)(price) + } + } + } else { + // Both maxPriorityfee and maxFee set by caller. Sanity-check their internal relation + if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 { + return args, fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas) + } + } + + if args.Value == nil { + args.Value = new(hexutil.Big) + } + if args.Nonce == nil { + // get the nonce from the account retriever + // ignore error in case tge account doesn't exist yet + nonce, _ := e.getAccountNonce(*args.From, true, 0, e.logger) + args.Nonce = (*hexutil.Uint64)(&nonce) + } + + if args.Data != nil && args.Input != nil && !bytes.Equal(*args.Data, *args.Input) { + return args, errors.New("both 'data' and 'input' are set and not equal. Please use 'input' to pass transaction call data") + } + + if args.To == nil { + // Contract creation + var input []byte + if args.Data != nil { + input = *args.Data + } else if args.Input != nil { + input = *args.Input + } + + if len(input) == 0 { + return args, errors.New("contract creation without any data provided") + } + } + + if args.Gas == nil { + // For backwards-compatibility reason, we try both input and data + // but input is preferred. + input := args.Input + if input == nil { + input = args.Data + } + + callArgs := evmtypes.TransactionArgs{ + From: args.From, + To: args.To, + Gas: args.Gas, + GasPrice: args.GasPrice, + MaxFeePerGas: args.MaxFeePerGas, + MaxPriorityFeePerGas: args.MaxPriorityFeePerGas, + Value: args.Value, + Data: input, + AccessList: args.AccessList, + } + + blockNr := types.NewBlockNumber(big.NewInt(0)) + estimated, err := e.EstimateGas(callArgs, &blockNr) + if err != nil { + return args, err + } + args.Gas = &estimated + e.logger.Debug("estimate gas usage automatically", "gas", args.Gas) + } + + if args.ChainID == nil { + args.ChainID = (*hexutil.Big)(e.chainID) + } + + return args, nil +} + +// getAccountNonce returns the account nonce for the given account address. +// If the pending value is true, it will iterate over the mempool (pending) +// txs in order to compute and return the pending tx sequence. +// Todo: include the ability to specify a blockNumber +func (e *EVMBackend) getAccountNonce(accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) { + queryClient := authtypes.NewQueryClient(e.clientCtx) + res, err := queryClient.Account(types.ContextWithHeight(height), &authtypes.QueryAccountRequest{Address: sdk.AccAddress(accAddr.Bytes()).String()}) + if err != nil { + return 0, err + } + var acc authtypes.AccountI + if err := e.clientCtx.InterfaceRegistry.UnpackAny(res.Account, &acc); err != nil { + return 0, err + } + + nonce := acc.GetSequence() + + if !pending { + return nonce, nil + } + + // the account retriever doesn't include the uncommitted transactions on the nonce so we need to + // to manually add them. + pendingTxs, err := e.PendingTransactions() + if err != nil { + logger.Error("failed to fetch pending transactions", "error", err.Error()) + return nonce, nil + } + + // add the uncommitted txs to the nonce counter + // only supports `MsgEthereumTx` style tx + for _, tx := range pendingTxs { + for _, msg := range (*tx).GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + // not ethereum tx + break + } + + sender, err := ethMsg.GetSender(e.chainID) + if err != nil { + continue + } + if sender == accAddr { + nonce++ + } + } + } + + return nonce, nil +} + +// AllTxLogsFromEvents parses all ethereum logs from cosmos events +func AllTxLogsFromEvents(events []abci.Event) ([][]*ethtypes.Log, error) { + allLogs := make([][]*ethtypes.Log, 0, 4) + for _, event := range events { + if event.Type != evmtypes.EventTypeTxLog { + continue + } + + logs, err := ParseTxLogsFromEvent(event) + if err != nil { + return nil, err + } + + allLogs = append(allLogs, logs) + } + return allLogs, nil +} + +// TxLogsFromEvents parses ethereum logs from cosmos events for specific msg index +func TxLogsFromEvents(events []abci.Event, msgIndex int) ([]*ethtypes.Log, error) { + for _, event := range events { + if event.Type != evmtypes.EventTypeTxLog { + continue + } + + if msgIndex > 0 { + // not the eth tx we want + msgIndex-- + continue + } + + return ParseTxLogsFromEvent(event) + } + return nil, fmt.Errorf("eth tx logs not found for message index %d", msgIndex) +} + +// ParseTxLogsFromEvent parse tx logs from one event +func ParseTxLogsFromEvent(event abci.Event) ([]*ethtypes.Log, error) { + logs := make([]*evmtypes.Log, 0, len(event.Attributes)) + for _, attr := range event.Attributes { + if !bytes.Equal(attr.Key, []byte(evmtypes.AttributeKeyTxLog)) { + continue + } + + var log evmtypes.Log + if err := json.Unmarshal(attr.Value, &log); err != nil { + return nil, err + } + + logs = append(logs, &log) + } + return evmtypes.LogsToEthereum(logs), nil +} diff --git a/rpc/ethereum/namespaces/debug/api.go b/rpc/ethereum/namespaces/debug/api.go new file mode 100644 index 00000000..26dd4a3c --- /dev/null +++ b/rpc/ethereum/namespaces/debug/api.go @@ -0,0 +1,502 @@ +package debug + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "runtime" + "runtime/debug" + "runtime/pprof" + "sync" + "time" + + "github.com/davecgh/go-spew/spew" + + "github.com/tendermint/tendermint/libs/log" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" + stderrors "github.com/pkg/errors" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/consensus/ethash" + "github.com/ethereum/go-ethereum/rlp" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" + rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// HandlerT keeps track of the cpu profiler and trace execution +type HandlerT struct { + cpuFilename string + cpuFile io.WriteCloser + mu sync.Mutex + traceFilename string + traceFile io.WriteCloser +} + +// API is the collection of tracing APIs exposed over the private debugging endpoint. +type API struct { + ctx *server.Context + logger log.Logger + backend backend.Backend + clientCtx client.Context + queryClient *rpctypes.QueryClient + handler *HandlerT +} + +// NewAPI creates a new API definition for the tracing methods of the Ethereum service. +func NewAPI( + ctx *server.Context, + backend backend.Backend, + clientCtx client.Context, +) *API { + return &API{ + ctx: ctx, + logger: ctx.Logger.With("module", "debug"), + backend: backend, + clientCtx: clientCtx, + queryClient: rpctypes.NewQueryClient(clientCtx), + handler: new(HandlerT), + } +} + +// TraceTransaction returns the structured logs created during the execution of EVM +// and returns them as a JSON object. +func (a *API) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfig) (interface{}, error) { + a.logger.Debug("debug_traceTransaction", "hash", hash) + // Get transaction by hash + transaction, err := a.backend.GetTxByEthHash(hash) + if err != nil { + a.logger.Debug("tx not found", "hash", hash) + return nil, err + } + + // check if block number is 0 + if transaction.Height == 0 { + return nil, errors.New("genesis is not traceable") + } + + blk, err := a.backend.GetTendermintBlockByNumber(rpctypes.BlockNumber(transaction.Height)) + if err != nil { + a.logger.Debug("block not found", "height", transaction.Height) + return nil, err + } + + msgIndex, _ := rpctypes.FindTxAttributes(transaction.TxResult.Events, hash.Hex()) + if msgIndex < 0 { + return nil, fmt.Errorf("ethereum tx not found in msgs: %s", hash.Hex()) + } + + // check tx index is not out of bound + if uint32(len(blk.Block.Txs)) < transaction.Index { + a.logger.Debug("tx index out of bounds", "index", transaction.Index, "hash", hash.String(), "height", blk.Block.Height) + return nil, fmt.Errorf("transaction not included in block %v", blk.Block.Height) + } + + var predecessors []*evmtypes.MsgEthereumTx + for _, txBz := range blk.Block.Txs[:transaction.Index] { + tx, err := a.clientCtx.TxConfig.TxDecoder()(txBz) + if err != nil { + a.logger.Debug("failed to decode transaction in block", "height", blk.Block.Height, "error", err.Error()) + continue + } + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + continue + } + + predecessors = append(predecessors, ethMsg) + } + } + + tx, err := a.clientCtx.TxConfig.TxDecoder()(transaction.Tx) + if err != nil { + a.logger.Debug("tx not found", "hash", hash) + return nil, err + } + + // add predecessor messages in current cosmos tx + for i := 0; i < msgIndex; i++ { + ethMsg, ok := tx.GetMsgs()[i].(*evmtypes.MsgEthereumTx) + if !ok { + continue + } + predecessors = append(predecessors, ethMsg) + } + + ethMessage, ok := tx.GetMsgs()[msgIndex].(*evmtypes.MsgEthereumTx) + if !ok { + a.logger.Debug("invalid transaction type", "type", fmt.Sprintf("%T", tx)) + return nil, fmt.Errorf("invalid transaction type %T", tx) + } + + traceTxRequest := evmtypes.QueryTraceTxRequest{ + Msg: ethMessage, + TxIndex: uint64(transaction.Index), + Predecessors: predecessors, + BlockNumber: blk.Block.Height, + BlockTime: blk.Block.Time, + BlockHash: common.Bytes2Hex(blk.BlockID.Hash), + } + + if config != nil { + traceTxRequest.TraceConfig = config + } + + // minus one to get the context of block beginning + contextHeight := transaction.Height - 1 + if contextHeight < 1 { + // 0 is a special value in `ContextWithHeight` + contextHeight = 1 + } + traceResult, err := a.queryClient.TraceTx(rpctypes.ContextWithHeight(contextHeight), &traceTxRequest) + if err != nil { + return nil, err + } + + // Response format is unknown due to custom tracer config param + // More information can be found here https://geth.ethereum.org/docs/dapp/tracing-filtered + var decodedResult interface{} + err = json.Unmarshal(traceResult.Data, &decodedResult) + if err != nil { + return nil, err + } + + return decodedResult, nil +} + +// TraceBlockByNumber returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +func (a *API) TraceBlockByNumber(height rpctypes.BlockNumber, config *evmtypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { + a.logger.Debug("debug_traceBlockByNumber", "height", height) + if height == 0 { + return nil, errors.New("genesis is not traceable") + } + // Get Tendermint Block + resBlock, err := a.backend.GetTendermintBlockByNumber(height) + if err != nil { + a.logger.Debug("get block failed", "height", height, "error", err.Error()) + return nil, err + } + + return a.traceBlock(height, config, resBlock) +} + +// TraceBlockByHash returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +func (a *API) TraceBlockByHash(hash common.Hash, config *evmtypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { + a.logger.Debug("debug_traceBlockByHash", "hash", hash) + // Get Tendermint Block + resBlock, err := a.backend.GetTendermintBlockByHash(hash) + if err != nil { + a.logger.Debug("get block failed", "hash", hash.Hex(), "error", err.Error()) + return nil, err + } + + if resBlock == nil || resBlock.Block == nil { + a.logger.Debug("block not found", "hash", hash.Hex()) + return nil, errors.New("block not found") + } + + return a.traceBlock(rpctypes.BlockNumber(resBlock.Block.Height), config, resBlock) +} + +// traceBlock configures a new tracer according to the provided configuration, and +// executes all the transactions contained within. The return value will be one item +// per transaction, dependent on the requested tracer. +func (a *API) traceBlock(height rpctypes.BlockNumber, config *evmtypes.TraceConfig, block *tmrpctypes.ResultBlock) ([]*evmtypes.TxTraceResult, error) { + txs := block.Block.Txs + txsLength := len(txs) + + if txsLength == 0 { + // If there are no transactions return empty array + return []*evmtypes.TxTraceResult{}, nil + } + + txDecoder := a.clientCtx.TxConfig.TxDecoder() + + var txsMessages []*evmtypes.MsgEthereumTx + for i, tx := range txs { + decodedTx, err := txDecoder(tx) + if err != nil { + a.logger.Error("failed to decode transaction", "hash", txs[i].Hash(), "error", err.Error()) + continue + } + + for _, msg := range decodedTx.GetMsgs() { + ethMessage, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + // Just considers Ethereum transactions + continue + } + txsMessages = append(txsMessages, ethMessage) + } + } + + // minus one to get the context at the beginning of the block + contextHeight := height - 1 + if contextHeight < 1 { + // 0 is a special value for `ContextWithHeight`. + contextHeight = 1 + } + ctxWithHeight := rpctypes.ContextWithHeight(int64(contextHeight)) + + traceBlockRequest := &evmtypes.QueryTraceBlockRequest{ + Txs: txsMessages, + TraceConfig: config, + BlockNumber: block.Block.Height, + BlockTime: block.Block.Time, + BlockHash: common.Bytes2Hex(block.BlockID.Hash), + } + + res, err := a.queryClient.TraceBlock(ctxWithHeight, traceBlockRequest) + if err != nil { + return nil, err + } + + decodedResults := make([]*evmtypes.TxTraceResult, txsLength) + if err := json.Unmarshal(res.Data, &decodedResults); err != nil { + return nil, err + } + + return decodedResults, nil +} + +// BlockProfile turns on goroutine profiling for nsec seconds and writes profile data to +// file. It uses a profile rate of 1 for most accurate information. If a different rate is +// desired, set the rate and write the profile manually. +func (a *API) BlockProfile(file string, nsec uint) error { + a.logger.Debug("debug_blockProfile", "file", file, "nsec", nsec) + runtime.SetBlockProfileRate(1) + defer runtime.SetBlockProfileRate(0) + + time.Sleep(time.Duration(nsec) * time.Second) + return writeProfile("block", file, a.logger) +} + +// CpuProfile turns on CPU profiling for nsec seconds and writes +// profile data to file. +func (a *API) CpuProfile(file string, nsec uint) error { // nolint: golint, stylecheck, revive + a.logger.Debug("debug_cpuProfile", "file", file, "nsec", nsec) + if err := a.StartCPUProfile(file); err != nil { + return err + } + time.Sleep(time.Duration(nsec) * time.Second) + return a.StopCPUProfile() +} + +// GcStats returns GC statistics. +func (a *API) GcStats() *debug.GCStats { + a.logger.Debug("debug_gcStats") + s := new(debug.GCStats) + debug.ReadGCStats(s) + return s +} + +// GoTrace turns on tracing for nsec seconds and writes +// trace data to file. +func (a *API) GoTrace(file string, nsec uint) error { + a.logger.Debug("debug_goTrace", "file", file, "nsec", nsec) + if err := a.StartGoTrace(file); err != nil { + return err + } + time.Sleep(time.Duration(nsec) * time.Second) + return a.StopGoTrace() +} + +// MemStats returns detailed runtime memory statistics. +func (a *API) MemStats() *runtime.MemStats { + a.logger.Debug("debug_memStats") + s := new(runtime.MemStats) + runtime.ReadMemStats(s) + return s +} + +// SetBlockProfileRate sets the rate of goroutine block profile data collection. +// rate 0 disables block profiling. +func (a *API) SetBlockProfileRate(rate int) { + a.logger.Debug("debug_setBlockProfileRate", "rate", rate) + runtime.SetBlockProfileRate(rate) +} + +// Stacks returns a printed representation of the stacks of all goroutines. +func (a *API) Stacks() string { + a.logger.Debug("debug_stacks") + buf := new(bytes.Buffer) + err := pprof.Lookup("goroutine").WriteTo(buf, 2) + if err != nil { + a.logger.Error("Failed to create stacks", "error", err.Error()) + } + return buf.String() +} + +// StartCPUProfile turns on CPU profiling, writing to the given file. +func (a *API) StartCPUProfile(file string) error { + a.logger.Debug("debug_startCPUProfile", "file", file) + a.handler.mu.Lock() + defer a.handler.mu.Unlock() + + switch { + case isCPUProfileConfigurationActivated(a.ctx): + a.logger.Debug("CPU profiling already in progress using the configuration file") + return errors.New("CPU profiling already in progress using the configuration file") + case a.handler.cpuFile != nil: + a.logger.Debug("CPU profiling already in progress") + return errors.New("CPU profiling already in progress") + default: + fp, err := ExpandHome(file) + if err != nil { + a.logger.Debug("failed to get filepath for the CPU profile file", "error", err.Error()) + return err + } + f, err := os.Create(fp) + if err != nil { + a.logger.Debug("failed to create CPU profile file", "error", err.Error()) + return err + } + if err := pprof.StartCPUProfile(f); err != nil { + a.logger.Debug("cpu profiling already in use", "error", err.Error()) + if err := f.Close(); err != nil { + a.logger.Debug("failed to close cpu profile file") + return stderrors.Wrap(err, "failed to close cpu profile file") + } + return err + } + + a.logger.Info("CPU profiling started", "profile", file) + a.handler.cpuFile = f + a.handler.cpuFilename = file + return nil + } +} + +// StopCPUProfile stops an ongoing CPU profile. +func (a *API) StopCPUProfile() error { + a.logger.Debug("debug_stopCPUProfile") + a.handler.mu.Lock() + defer a.handler.mu.Unlock() + + switch { + case isCPUProfileConfigurationActivated(a.ctx): + a.logger.Debug("CPU profiling already in progress using the configuration file") + return errors.New("CPU profiling already in progress using the configuration file") + case a.handler.cpuFile != nil: + a.logger.Info("Done writing CPU profile", "profile", a.handler.cpuFilename) + pprof.StopCPUProfile() + if err := a.handler.cpuFile.Close(); err != nil { + a.logger.Debug("failed to close cpu file") + return stderrors.Wrap(err, "failed to close cpu file") + } + a.handler.cpuFile = nil + a.handler.cpuFilename = "" + return nil + default: + a.logger.Debug("CPU profiling not in progress") + return errors.New("CPU profiling not in progress") + } +} + +// WriteBlockProfile writes a goroutine blocking profile to the given file. +func (a *API) WriteBlockProfile(file string) error { + a.logger.Debug("debug_writeBlockProfile", "file", file) + return writeProfile("block", file, a.logger) +} + +// WriteMemProfile writes an allocation profile to the given file. +// Note that the profiling rate cannot be set through the API, +// it must be set on the command line. +func (a *API) WriteMemProfile(file string) error { + a.logger.Debug("debug_writeMemProfile", "file", file) + return writeProfile("heap", file, a.logger) +} + +// MutexProfile turns on mutex profiling for nsec seconds and writes profile data to file. +// It uses a profile rate of 1 for most accurate information. If a different rate is +// desired, set the rate and write the profile manually. +func (a *API) MutexProfile(file string, nsec uint) error { + a.logger.Debug("debug_mutexProfile", "file", file, "nsec", nsec) + runtime.SetMutexProfileFraction(1) + time.Sleep(time.Duration(nsec) * time.Second) + defer runtime.SetMutexProfileFraction(0) + return writeProfile("mutex", file, a.logger) +} + +// SetMutexProfileFraction sets the rate of mutex profiling. +func (a *API) SetMutexProfileFraction(rate int) { + a.logger.Debug("debug_setMutexProfileFraction", "rate", rate) + runtime.SetMutexProfileFraction(rate) +} + +// WriteMutexProfile writes a goroutine blocking profile to the given file. +func (a *API) WriteMutexProfile(file string) error { + a.logger.Debug("debug_writeMutexProfile", "file", file) + return writeProfile("mutex", file, a.logger) +} + +// FreeOSMemory forces a garbage collection. +func (a *API) FreeOSMemory() { + a.logger.Debug("debug_freeOSMemory") + debug.FreeOSMemory() +} + +// SetGCPercent sets the garbage collection target percentage. It returns the previous +// setting. A negative value disables GC. +func (a *API) SetGCPercent(v int) int { + a.logger.Debug("debug_setGCPercent", "percent", v) + return debug.SetGCPercent(v) +} + +// GetHeaderRlp retrieves the RLP encoded for of a single header. +func (a *API) GetHeaderRlp(number uint64) (hexutil.Bytes, error) { + header, err := a.backend.HeaderByNumber(rpctypes.BlockNumber(number)) + if err != nil { + return nil, err + } + + return rlp.EncodeToBytes(header) +} + +// GetBlockRlp retrieves the RLP encoded for of a single block. +func (a *API) GetBlockRlp(number uint64) (hexutil.Bytes, error) { + block, err := a.backend.BlockByNumber(rpctypes.BlockNumber(number)) + if err != nil { + return nil, err + } + + return rlp.EncodeToBytes(block) +} + +// PrintBlock retrieves a block and returns its pretty printed form. +func (a *API) PrintBlock(number uint64) (string, error) { + block, err := a.backend.BlockByNumber(rpctypes.BlockNumber(number)) + if err != nil { + return "", err + } + + return spew.Sdump(block), nil +} + +// SeedHash retrieves the seed hash of a block. +func (a *API) SeedHash(number uint64) (string, error) { + _, err := a.backend.HeaderByNumber(rpctypes.BlockNumber(number)) + if err != nil { + return "", err + } + + return fmt.Sprintf("0x%x", ethash.SeedHash(number)), nil +} + +// IntermediateRoots executes a block, and returns a list +// of intermediate roots: the stateroot after each transaction. +func (a *API) IntermediateRoots(hash common.Hash, _ *evmtypes.TraceConfig) ([]common.Hash, error) { + a.logger.Debug("debug_intermediateRoots", "hash", hash) + return ([]common.Hash)(nil), nil +} diff --git a/rpc/ethereum/namespaces/debug/trace.go b/rpc/ethereum/namespaces/debug/trace.go new file mode 100644 index 00000000..6abbd830 --- /dev/null +++ b/rpc/ethereum/namespaces/debug/trace.go @@ -0,0 +1,84 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +//go:build go1.5 +// +build go1.5 + +package debug + +import ( + "errors" + "os" + "runtime/trace" + + stderrors "github.com/pkg/errors" +) + +// StartGoTrace turns on tracing, writing to the given file. +func (a *API) StartGoTrace(file string) error { + a.logger.Debug("debug_startGoTrace", "file", file) + a.handler.mu.Lock() + defer a.handler.mu.Unlock() + + if a.handler.traceFile != nil { + a.logger.Debug("trace already in progress") + return errors.New("trace already in progress") + } + fp, err := ExpandHome(file) + if err != nil { + a.logger.Debug("failed to get filepath for the CPU profile file", "error", err.Error()) + return err + } + f, err := os.Create(fp) + if err != nil { + a.logger.Debug("failed to create go trace file", "error", err.Error()) + return err + } + if err := trace.Start(f); err != nil { + a.logger.Debug("Go tracing already started", "error", err.Error()) + if err := f.Close(); err != nil { + a.logger.Debug("failed to close trace file") + return stderrors.Wrap(err, "failed to close trace file") + } + + return err + } + a.handler.traceFile = f + a.handler.traceFilename = file + a.logger.Info("Go tracing started", "dump", a.handler.traceFilename) + return nil +} + +// StopGoTrace stops an ongoing trace. +func (a *API) StopGoTrace() error { + a.logger.Debug("debug_stopGoTrace") + a.handler.mu.Lock() + defer a.handler.mu.Unlock() + + trace.Stop() + if a.handler.traceFile == nil { + a.logger.Debug("trace not in progress") + return errors.New("trace not in progress") + } + a.logger.Info("Done writing Go trace", "dump", a.handler.traceFilename) + if err := a.handler.traceFile.Close(); err != nil { + a.logger.Debug("failed to close trace file") + return stderrors.Wrap(err, "failed to close trace file") + } + a.handler.traceFile = nil + a.handler.traceFilename = "" + return nil +} diff --git a/rpc/ethereum/namespaces/debug/trace_fallback.go b/rpc/ethereum/namespaces/debug/trace_fallback.go new file mode 100644 index 00000000..8f4c6caa --- /dev/null +++ b/rpc/ethereum/namespaces/debug/trace_fallback.go @@ -0,0 +1,36 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +//go:build !go1.5 +// +build !go1.5 + +// no-op implementation of tracing methods for Go < 1.5. + +package debug + +import ( + "errors" +) + +func (*API) StartGoTrace(string file) error { + a.logger.Debug("debug_stopGoTrace", "file", file) + return errors.New("tracing is not supported on Go < 1.5") +} + +func (*API) StopGoTrace() error { + a.logger.Debug("debug_stopGoTrace") + return errors.New("tracing is not supported on Go < 1.5") +} diff --git a/rpc/ethereum/namespaces/debug/utils.go b/rpc/ethereum/namespaces/debug/utils.go new file mode 100644 index 00000000..7f270ed7 --- /dev/null +++ b/rpc/ethereum/namespaces/debug/utils.go @@ -0,0 +1,60 @@ +package debug + +import ( + "os" + "os/user" + "path/filepath" + "runtime/pprof" + "strings" + + "github.com/cosmos/cosmos-sdk/server" + "github.com/tendermint/tendermint/libs/log" +) + +// isCPUProfileConfigurationActivated checks if cpuprofile was configured via flag +func isCPUProfileConfigurationActivated(ctx *server.Context) bool { + // TODO: use same constants as server/start.go + // constant declared in start.go cannot be imported (cyclical dependency) + const flagCPUProfile = "cpu-profile" + if cpuProfile := ctx.Viper.GetString(flagCPUProfile); cpuProfile != "" { + return true + } + return false +} + +// ExpandHome expands home directory in file paths. +// ~someuser/tmp will not be expanded. +func ExpandHome(p string) (string, error) { + if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") { + usr, err := user.Current() + if err != nil { + return p, err + } + home := usr.HomeDir + p = home + p[1:] + } + return filepath.Clean(p), nil +} + +// writeProfile writes the data to a file +func writeProfile(name, file string, log log.Logger) error { + p := pprof.Lookup(name) + log.Info("Writing profile records", "count", p.Count(), "type", name, "dump", file) + fp, err := ExpandHome(file) + if err != nil { + return err + } + f, err := os.Create(fp) + if err != nil { + return err + } + + if err := p.WriteTo(f, 0); err != nil { + if err := f.Close(); err != nil { + return err + } + return err + } + + return f.Close() +} diff --git a/rpc/ethereum/namespaces/eth/api.go b/rpc/ethereum/namespaces/eth/api.go new file mode 100644 index 00000000..4d6b478c --- /dev/null +++ b/rpc/ethereum/namespaces/eth/api.go @@ -0,0 +1,1115 @@ +package eth + +import ( + "context" + "encoding/json" + "fmt" + "math" + "math/big" + + "github.com/stratosnet/stratos-chain/ethereum/eip712" + + "github.com/ethereum/go-ethereum/signer/core/apitypes" + + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pkg/errors" + "github.com/spf13/viper" + "github.com/tendermint/tendermint/libs/log" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/ethereum/go-ethereum/accounts/keystore" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/stratosnet/stratos-chain/crypto/hd" + "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" + rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + stratos "github.com/stratosnet/stratos-chain/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// PublicAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec. +type PublicAPI struct { + ctx context.Context + clientCtx client.Context + queryClient *rpctypes.QueryClient + chainIDEpoch *big.Int + logger log.Logger + backend backend.Backend + nonceLock *rpctypes.AddrLocker + signer ethtypes.Signer +} + +// NewPublicAPI creates an instance of the public ETH Web3 API. +func NewPublicAPI( + logger log.Logger, + clientCtx client.Context, + backend backend.Backend, + nonceLock *rpctypes.AddrLocker, +) *PublicAPI { + eip155ChainID, err := stratos.ParseChainID(clientCtx.ChainID) + if err != nil { + panic(err) + } + + algos, _ := clientCtx.Keyring.SupportedAlgorithms() + + if !algos.Contains(hd.EthSecp256k1) { + kr, err := keyring.New( + sdk.KeyringServiceName(), + viper.GetString(flags.FlagKeyringBackend), + clientCtx.KeyringDir, + clientCtx.Input, + hd.EthSecp256k1Option(), + ) + if err != nil { + panic(err) + } + + clientCtx = clientCtx.WithKeyring(kr) + } + + // The signer used by the API should always be the 'latest' known one because we expect + // signers to be backwards-compatible with old transactions. + cfg := backend.ChainConfig() + if cfg == nil { + cfg = evmtypes.DefaultChainConfig().EthereumConfig(eip155ChainID) + } + + signer := ethtypes.LatestSigner(cfg) + + api := &PublicAPI{ + ctx: context.Background(), + clientCtx: clientCtx, + queryClient: rpctypes.NewQueryClient(clientCtx), + chainIDEpoch: eip155ChainID, + logger: logger.With("client", "json-rpc"), + backend: backend, + nonceLock: nonceLock, + signer: signer, + } + + return api +} + +// ClientCtx returns client context +func (e *PublicAPI) ClientCtx() client.Context { + return e.clientCtx +} + +func (e *PublicAPI) QueryClient() *rpctypes.QueryClient { + return e.queryClient +} + +func (e *PublicAPI) Ctx() context.Context { + return e.ctx +} + +// ProtocolVersion returns the supported Ethereum protocol version. +func (e *PublicAPI) ProtocolVersion() hexutil.Uint { + e.logger.Debug("eth_protocolVersion") + return hexutil.Uint(stratos.ProtocolVersion) +} + +// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. +func (e *PublicAPI) ChainId() (*hexutil.Big, error) { // nolint + e.logger.Debug("eth_chainId") + // if current block is at or past the EIP-155 replay-protection fork block, return chainID from config + bn, err := e.backend.BlockNumber() + if err != nil { + e.logger.Debug("failed to fetch latest block number", "error", err.Error()) + return (*hexutil.Big)(e.chainIDEpoch), nil + } + + if config := e.backend.ChainConfig(); config.IsEIP155(new(big.Int).SetUint64(uint64(bn))) { + return (*hexutil.Big)(config.ChainID), nil + } + + return nil, fmt.Errorf("chain not synced beyond EIP-155 replay-protection fork block") +} + +// Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not +// yet received the latest block headers from its pears. In case it is synchronizing: +// - startingBlock: block number this node started to synchronize from +// - currentBlock: block number this node is currently importing +// - highestBlock: block number of the highest block header this node has received from peers +// - pulledStates: number of state entries processed until now +// - knownStates: number of known state entries that still need to be pulled +func (e *PublicAPI) Syncing() (interface{}, error) { + e.logger.Debug("eth_syncing") + + status, err := e.clientCtx.Client.Status(e.ctx) + if err != nil { + return false, err + } + + if !status.SyncInfo.CatchingUp { + return false, nil + } + + return map[string]interface{}{ + "startingBlock": hexutil.Uint64(status.SyncInfo.EarliestBlockHeight), + "currentBlock": hexutil.Uint64(status.SyncInfo.LatestBlockHeight), + // "highestBlock": nil, // NA + // "pulledStates": nil, // NA + // "knownStates": nil, // NA + }, nil +} + +// Coinbase is the address that staking rewards will be send to (alias for Etherbase). +func (e *PublicAPI) Coinbase() (string, error) { + e.logger.Debug("eth_coinbase") + + coinbase, err := e.backend.GetCoinbase() + if err != nil { + return "", err + } + ethAddr := common.BytesToAddress(coinbase.Bytes()) + return ethAddr.Hex(), nil +} + +// Mining returns whether or not this node is currently mining. Always false. +func (e *PublicAPI) Mining() bool { + e.logger.Debug("eth_mining") + return false +} + +// Hashrate returns the current node's hashrate. Always 0. +func (e *PublicAPI) Hashrate() hexutil.Uint64 { + e.logger.Debug("eth_hashrate") + return 0 +} + +// GasPrice returns the current gas price based on Stratos's gas price oracle. +func (e *PublicAPI) GasPrice() (*hexutil.Big, error) { + e.logger.Debug("eth_gasPrice") + var ( + result *big.Int + err error + ) + if head := e.backend.CurrentHeader(); head.BaseFee != nil { + result, err = e.backend.SuggestGasTipCap(head.BaseFee) + if err != nil { + return nil, err + } + result = result.Add(result, head.BaseFee) + } else { + result = big.NewInt(e.backend.RPCMinGasPrice()) + } + + return (*hexutil.Big)(result), nil +} + +// MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions. +func (e *PublicAPI) MaxPriorityFeePerGas() (*hexutil.Big, error) { + e.logger.Debug("eth_maxPriorityFeePerGas") + head := e.backend.CurrentHeader() + tipcap, err := e.backend.SuggestGasTipCap(head.BaseFee) + if err != nil { + return nil, err + } + return (*hexutil.Big)(tipcap), nil +} + +func (e *PublicAPI) FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) { + e.logger.Debug("eth_feeHistory") + return e.backend.FeeHistory(blockCount, lastBlock, rewardPercentiles) +} + +// Accounts returns the list of accounts available to this node. +func (e *PublicAPI) Accounts() ([]common.Address, error) { + e.logger.Debug("eth_accounts") + + addresses := make([]common.Address, 0) // return [] instead of nil if empty + + infos, err := e.clientCtx.Keyring.List() + if err != nil { + return addresses, err + } + + for _, info := range infos { + addressBytes := info.GetPubKey().Address().Bytes() + addresses = append(addresses, common.BytesToAddress(addressBytes)) + } + + return addresses, nil +} + +// BlockNumber returns the current block number. +func (e *PublicAPI) BlockNumber() (hexutil.Uint64, error) { + e.logger.Debug("eth_blockNumber") + return e.backend.BlockNumber() +} + +// GetBalance returns the provided account's balance up to the provided block number. +func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Big, error) { + e.logger.Debug("eth_getBalance", "address", address.String(), "block number or hash", blockNrOrHash) + + blockNum, err := e.getBlockNumber(blockNrOrHash) + if err != nil { + return nil, err + } + + req := &evmtypes.QueryBalanceRequest{ + Address: address.String(), + } + + res, err := e.queryClient.Balance(rpctypes.ContextWithHeight(blockNum.Int64()), req) + if err != nil { + return nil, err + } + + val, ok := sdk.NewIntFromString(res.Balance) + if !ok { + return nil, errors.New("invalid balance") + } + + return (*hexutil.Big)(val.BigInt()), nil +} + +// GetStorageAt returns the contract storage at the given address, block number, and key. +func (e *PublicAPI) GetStorageAt(address common.Address, key string, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { + e.logger.Debug("eth_getStorageAt", "address", address.Hex(), "key", key, "block number or hash", blockNrOrHash) + + blockNum, err := e.getBlockNumber(blockNrOrHash) + if err != nil { + return nil, err + } + + req := &evmtypes.QueryStorageRequest{ + Address: address.String(), + Key: key, + } + + res, err := e.queryClient.Storage(rpctypes.ContextWithHeight(blockNum.Int64()), req) + if err != nil { + return nil, err + } + + value := common.HexToHash(res.Value) + return value.Bytes(), nil +} + +// GetTransactionCount returns the number of transactions at the given address up to the given block number. +func (e *PublicAPI) GetTransactionCount(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (*hexutil.Uint64, error) { + e.logger.Debug("eth_getTransactionCount", "address", address.Hex(), "block number or hash", blockNrOrHash) + blockNum, err := e.getBlockNumber(blockNrOrHash) + if err != nil { + return nil, err + } + return e.backend.GetTransactionCount(address, blockNum) +} + +// GetBlockTransactionCountByHash returns the number of transactions in the block identified by hash. +func (e *PublicAPI) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint { + e.logger.Debug("eth_getBlockTransactionCountByHash", "hash", hash.Hex()) + + block, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) + if err != nil { + e.logger.Debug("block not found", "hash", hash.Hex(), "error", err.Error()) + return nil + } + + if block.Block == nil { + e.logger.Debug("block not found", "hash", hash.Hex()) + return nil + } + + blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &block.Block.Height) + if err != nil { + return nil + } + + ethMsgs := e.backend.GetEthereumMsgsFromTendermintBlock(block, blockRes) + n := hexutil.Uint(len(ethMsgs)) + return &n +} + +// GetBlockTransactionCountByNumber returns the number of transactions in the block identified by number. +func (e *PublicAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint { + e.logger.Debug("eth_getBlockTransactionCountByNumber", "height", blockNum.Int64()) + block, err := e.clientCtx.Client.Block(e.ctx, blockNum.TmHeight()) + if err != nil { + e.logger.Debug("block not found", "height", blockNum.Int64(), "error", err.Error()) + return nil + } + + if block.Block == nil { + e.logger.Debug("block not found", "height", blockNum.Int64()) + return nil + } + + blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &block.Block.Height) + if err != nil { + return nil + } + + ethMsgs := e.backend.GetEthereumMsgsFromTendermintBlock(block, blockRes) + n := hexutil.Uint(len(ethMsgs)) + return &n +} + +// GetUncleCountByBlockHash returns the number of uncles in the block identified by hash. Always zero. +func (e *PublicAPI) GetUncleCountByBlockHash(hash common.Hash) hexutil.Uint { + return 0 +} + +// GetUncleCountByBlockNumber returns the number of uncles in the block identified by number. Always zero. +func (e *PublicAPI) GetUncleCountByBlockNumber(blockNum rpctypes.BlockNumber) hexutil.Uint { + return 0 +} + +// GetCode returns the contract code at the given address and block number. +func (e *PublicAPI) GetCode(address common.Address, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Bytes, error) { + e.logger.Debug("eth_getCode", "address", address.Hex(), "block number or hash", blockNrOrHash) + + blockNum, err := e.getBlockNumber(blockNrOrHash) + if err != nil { + return nil, err + } + + req := &evmtypes.QueryCodeRequest{ + Address: address.String(), + } + + res, err := e.queryClient.Code(rpctypes.ContextWithHeight(blockNum.Int64()), req) + if err != nil { + return nil, err + } + + return res.Code, nil +} + +// GetTransactionLogs returns the logs given a transaction hash. +func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) { + e.logger.Debug("eth_getTransactionLogs", "hash", txHash) + + hexTx := txHash.Hex() + res, err := e.backend.GetTxByEthHash(txHash) + if err != nil { + e.logger.Debug("tx not found", "hash", hexTx, "error", err.Error()) + return nil, nil + } + + msgIndex, _ := rpctypes.FindTxAttributes(res.TxResult.Events, hexTx) + if msgIndex < 0 { + return nil, fmt.Errorf("ethereum tx not found in msgs: %s", hexTx) + } + // parse tx logs from events + return backend.TxLogsFromEvents(res.TxResult.Events, msgIndex) +} + +// Sign signs the provided data using the private key of address via Geth's signature standard. +func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { + e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data)) + + from := sdk.AccAddress(address.Bytes()) + + _, err := e.clientCtx.Keyring.KeyByAddress(from) + if err != nil { + e.logger.Error("failed to find key in keyring", "address", address.String()) + return nil, fmt.Errorf("%s; %s", keystore.ErrNoMatch, err.Error()) + } + + // Sign the requested hash with the wallet + signature, _, err := e.clientCtx.Keyring.SignByAddress(from, data) + if err != nil { + e.logger.Error("keyring.SignByAddress failed", "address", address.Hex()) + return nil, err + } + + signature[crypto.RecoveryIDOffset] += 27 // Transform V from 0/1 to 27/28 according to the yellow paper + return signature, nil +} + +// SignTypedData signs EIP-712 conformant typed data +func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { + e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData) + from := sdk.AccAddress(address.Bytes()) + + _, err := e.clientCtx.Keyring.KeyByAddress(from) + if err != nil { + e.logger.Error("failed to find key in keyring", "address", address.String()) + return nil, fmt.Errorf("%s; %s", keystore.ErrNoMatch, err.Error()) + } + + sigHash, err := eip712.ComputeTypedDataHash(typedData) + if err != nil { + return nil, err + } + + // Sign the requested hash with the wallet + signature, _, err := e.clientCtx.Keyring.SignByAddress(from, sigHash) + if err != nil { + e.logger.Error("keyring.SignByAddress failed", "address", address.Hex()) + return nil, err + } + + signature[crypto.RecoveryIDOffset] += 27 // Transform V from 0/1 to 27/28 according to the yellow paper + return signature, nil +} + +// SendTransaction sends an Ethereum transaction. +func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { + e.logger.Debug("eth_sendTransaction", "args", args.String()) + return e.backend.SendTransaction(args) +} + +// FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) +// on a given unsigned transaction, and returns it to the caller for further +// processing (signing + broadcast). +func (e *PublicAPI) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.SignTransactionResult, error) { + // Set some sanity defaults and terminate on failure + args, err := e.backend.SetTxDefaults(args) + if err != nil { + return nil, err + } + + // Assemble the transaction and obtain rlp + tx := args.ToTransaction().AsTransaction() + + data, err := tx.MarshalBinary() + if err != nil { + return nil, err + } + + return &rpctypes.SignTransactionResult{ + Raw: data, + Tx: tx, + }, nil +} + +// SendRawTransaction send a raw Ethereum transaction. +func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) { + e.logger.Debug("eth_sendRawTransaction", "length", len(data)) + + // RLP decode raw transaction bytes + tx := ðtypes.Transaction{} + if err := tx.UnmarshalBinary(data); err != nil { + e.logger.Error("transaction decoding failed", "error", err.Error()) + return common.Hash{}, err + } + + ethereumTx := &evmtypes.MsgEthereumTx{} + if err := ethereumTx.FromEthereumTx(tx); err != nil { + e.logger.Error("transaction converting failed", "error", err.Error()) + return common.Hash{}, err + } + + if err := ethereumTx.ValidateBasic(); err != nil { + e.logger.Debug("tx failed basic validation", "error", err.Error()) + return common.Hash{}, err + } + + // Query params to use the EVM denomination + res, err := e.queryClient.QueryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) + if err != nil { + e.logger.Error("failed to query evm params", "error", err.Error()) + return common.Hash{}, err + } + + cosmosTx, err := ethereumTx.BuildTx(e.clientCtx.TxConfig.NewTxBuilder(), res.Params.EvmDenom) + if err != nil { + e.logger.Error("failed to build cosmos tx", "error", err.Error()) + return common.Hash{}, err + } + + // Encode transaction by default Tx encoder + txBytes, err := e.clientCtx.TxConfig.TxEncoder()(cosmosTx) + if err != nil { + e.logger.Error("failed to encode eth tx using default encoder", "error", err.Error()) + return common.Hash{}, err + } + + txHash := ethereumTx.AsTransaction().Hash() + + syncCtx := e.clientCtx.WithBroadcastMode(flags.BroadcastSync) + rsp, err := syncCtx.BroadcastTx(txBytes) + if rsp != nil && rsp.Code != 0 { + err = sdkerrors.ABCIError(rsp.Codespace, rsp.Code, rsp.RawLog) + } + if err != nil { + e.logger.Error("failed to broadcast tx", "error", err.Error()) + return txHash, err + } + + return txHash, nil +} + +// checkTxFee is an internal function used to check whether the fee of +// the given transaction is _reasonable_(under the cap). +func checkTxFee(gasPrice *big.Int, gas uint64, cap float64) error { + // Short circuit if there is no cap for transaction fee at all. + if cap == 0 { + return nil + } + totalfee := new(big.Float).SetInt(new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(gas))) + // 1 photon in 10^18 aphoton + oneToken := new(big.Float).SetInt(big.NewInt(params.Ether)) + // quo = rounded(x/y) + feeEth := new(big.Float).Quo(totalfee, oneToken) + // no need to check error from parsing + feeFloat, _ := feeEth.Float64() + if feeFloat > cap { + return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, cap) + } + return nil +} + +// Resend accepts an existing transaction and a new gas price and limit. It will remove +// the given transaction from the pool and reinsert it with the new gas price and limit. +func (e *PublicAPI) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) { + e.logger.Debug("eth_resend", "args", args.String()) + if args.Nonce == nil { + return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec") + } + + args, err := e.backend.SetTxDefaults(args) + if err != nil { + return common.Hash{}, err + } + + matchTx := args.ToTransaction().AsTransaction() + + // Before replacing the old transaction, ensure the _new_ transaction fee is reasonable. + price := matchTx.GasPrice() + if gasPrice != nil { + price = gasPrice.ToInt() + } + gas := matchTx.Gas() + if gasLimit != nil { + gas = uint64(*gasLimit) + } + if err := checkTxFee(price, gas, e.backend.RPCTxFeeCap()); err != nil { + return common.Hash{}, err + } + + pending, err := e.backend.PendingTransactions() + if err != nil { + return common.Hash{}, err + } + + for _, tx := range pending { + // FIXME does Resend api possible at all? https://github.com/tharsis/ethermint/issues/905 + p, err := evmtypes.UnwrapEthereumMsg(tx, common.Hash{}) + if err != nil { + // not valid ethereum tx + continue + } + + pTx := p.AsTransaction() + + wantSigHash := e.signer.Hash(matchTx) + pFrom, err := ethtypes.Sender(e.signer, pTx) + if err != nil { + continue + } + + if pFrom == *args.From && e.signer.Hash(pTx) == wantSigHash { + // Match. Re-sign and send the transaction. + if gasPrice != nil && (*big.Int)(gasPrice).Sign() != 0 { + args.GasPrice = gasPrice + } + if gasLimit != nil && *gasLimit != 0 { + args.Gas = gasLimit + } + + return e.backend.SendTransaction(args) // TODO: this calls SetTxDefaults again, refactor to avoid calling it twice + } + } + + return common.Hash{}, fmt.Errorf("transaction %#x not found", matchTx.Hash()) +} + +// Call performs a raw contract call. +func (e *PublicAPI) Call(args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, _ *rpctypes.StateOverride) (hexutil.Bytes, error) { + e.logger.Debug("eth_call", "args", args.String(), "block number or hash", blockNrOrHash) + + blockNum, err := e.getBlockNumber(blockNrOrHash) + if err != nil { + return nil, err + } + data, err := e.doCall(args, blockNum) + if err != nil { + return []byte{}, err + } + + return (hexutil.Bytes)(data.Ret), nil +} + +// DoCall performs a simulated call operation through the evmtypes. It returns the +// estimated gas used on the operation or an error if fails. +func (e *PublicAPI) doCall( + args evmtypes.TransactionArgs, blockNr rpctypes.BlockNumber, +) (*evmtypes.MsgEthereumTxResponse, error) { + bz, err := json.Marshal(&args) + if err != nil { + return nil, err + } + + req := evmtypes.EthCallRequest{ + Args: bz, + GasCap: e.backend.RPCGasCap(), + } + + // From ContextWithHeight: if the provided height is 0, + // it will return an empty context and the gRPC query will use + // the latest block height for querying. + ctx := rpctypes.ContextWithHeight(blockNr.Int64()) + timeout := e.backend.RPCEVMTimeout() + + // Setup context so it may be canceled the call has completed + // or, in case of unmetered gas, setup a context with a timeout. + var cancel context.CancelFunc + if timeout > 0 { + ctx, cancel = context.WithTimeout(ctx, timeout) + } else { + ctx, cancel = context.WithCancel(ctx) + } + + // Make sure the context is canceled when the call has completed + // this makes sure resources are cleaned up. + defer cancel() + + res, err := e.queryClient.EthCall(ctx, &req) + if err != nil { + return nil, err + } + + if res.Failed() { + if res.VmError != vm.ErrExecutionReverted.Error() { + return nil, status.Error(codes.Internal, res.VmError) + } + return nil, evmtypes.NewExecErrorWithReason(res.Ret) + } + + return res, nil +} + +// EstimateGas returns an estimate of gas usage for the given smart contract call. +func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error) { + e.logger.Debug("eth_estimateGas") + return e.backend.EstimateGas(args, blockNrOptional) +} + +// GetBlockByHash returns the block identified by hash. +func (e *PublicAPI) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { + e.logger.Debug("eth_getBlockByHash", "hash", hash.Hex(), "full", fullTx) + return e.backend.GetBlockByHash(hash, fullTx) +} + +// GetBlockByNumber returns the block identified by number. +func (e *PublicAPI) GetBlockByNumber(ethBlockNum rpctypes.BlockNumber, fullTx bool) (map[string]interface{}, error) { + e.logger.Debug("eth_getBlockByNumber", "number", ethBlockNum, "full", fullTx) + return e.backend.GetBlockByNumber(ethBlockNum, fullTx) +} + +// GetTransactionByHash returns the transaction identified by hash. +func (e *PublicAPI) GetTransactionByHash(hash common.Hash) (*rpctypes.RPCTransaction, error) { + e.logger.Debug("eth_getTransactionByHash", "hash", hash.Hex()) + return e.backend.GetTransactionByHash(hash) +} + +// getTransactionByBlockAndIndex is the common code shared by `GetTransactionByBlockNumberAndIndex` and `GetTransactionByBlockHashAndIndex`. +func (e *PublicAPI) getTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { + var msg *evmtypes.MsgEthereumTx + // try /tx_search first + res, err := e.backend.GetTxByTxIndex(block.Block.Height, uint(idx)) + if err == nil { + tx, err := e.clientCtx.TxConfig.TxDecoder()(res.Tx) + if err != nil { + e.logger.Debug("invalid ethereum tx", "height", block.Block.Header, "index", idx) + return nil, nil + } + // find msg index in events + msgIndex := rpctypes.FindTxAttributesByIndex(res.TxResult.Events, uint64(idx)) + if msgIndex < 0 { + e.logger.Debug("invalid ethereum tx", "height", block.Block.Header, "index", idx) + return nil, nil + } + var ok bool + // msgIndex is inferred from tx events, should be within bound. + msg, ok = tx.GetMsgs()[msgIndex].(*evmtypes.MsgEthereumTx) + if !ok { + e.logger.Debug("invalid ethereum tx", "height", block.Block.Header, "index", idx) + return nil, nil + } + } else { + blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &block.Block.Height) + if err != nil { + return nil, nil + } + + i := int(idx) + ethMsgs := e.backend.GetEthereumMsgsFromTendermintBlock(block, blockRes) + if i >= len(ethMsgs) { + e.logger.Debug("block txs index out of bound", "index", i) + return nil, nil + } + + msg = ethMsgs[i] + } + + return rpctypes.NewTransactionFromMsg( + msg, + common.BytesToHash(block.Block.Hash()), + uint64(block.Block.Height), + uint64(idx), + e.chainIDEpoch, + ) +} + +// GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index. +func (e *PublicAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { + e.logger.Debug("eth_getTransactionByBlockHashAndIndex", "hash", hash.Hex(), "index", idx) + + block, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) + if err != nil { + e.logger.Debug("block not found", "hash", hash.Hex(), "error", err.Error()) + return nil, nil + } + + if block.Block == nil { + e.logger.Debug("block not found", "hash", hash.Hex()) + return nil, nil + } + + return e.getTransactionByBlockAndIndex(block, idx) +} + +// GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index. +func (e *PublicAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { + e.logger.Debug("eth_getTransactionByBlockNumberAndIndex", "number", blockNum, "index", idx) + + block, err := e.clientCtx.Client.Block(e.ctx, blockNum.TmHeight()) + if err != nil { + e.logger.Debug("block not found", "height", blockNum.Int64(), "error", err.Error()) + return nil, nil + } + + if block.Block == nil { + e.logger.Debug("block not found", "height", blockNum.Int64()) + return nil, nil + } + + return e.getTransactionByBlockAndIndex(block, idx) +} + +// GetTransactionReceipt returns the transaction receipt identified by hash. +func (e *PublicAPI) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) { + hexTx := hash.Hex() + e.logger.Debug("eth_getTransactionReceipt", "hash", hexTx) + + res, err := e.backend.GetTxByEthHash(hash) + if err != nil { + e.logger.Debug("tx not found", "hash", hexTx, "error", err.Error()) + return nil, nil + } + + msgIndex, attrs := rpctypes.FindTxAttributes(res.TxResult.Events, hexTx) + if msgIndex < 0 { + return nil, fmt.Errorf("ethereum tx not found in msgs: %s", hexTx) + } + + resBlock, err := e.clientCtx.Client.Block(e.ctx, &res.Height) + if err != nil { + e.logger.Debug("block not found", "height", res.Height, "error", err.Error()) + return nil, nil + } + + tx, err := e.clientCtx.TxConfig.TxDecoder()(res.Tx) + if err != nil { + e.logger.Debug("decoding failed", "error", err.Error()) + return nil, fmt.Errorf("failed to decode tx: %w", err) + } + + // the `msgIndex` is inferred from tx events, should be within the bound. + msg := tx.GetMsgs()[msgIndex] + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + e.logger.Debug(fmt.Sprintf("invalid tx type: %T", msg)) + return nil, fmt.Errorf("invalid tx type: %T", msg) + } + + txData, err := evmtypes.UnpackTxData(ethMsg.Data) + if err != nil { + e.logger.Error("failed to unpack tx data", "error", err.Error()) + return nil, err + } + + cumulativeGasUsed := uint64(0) + blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &res.Height) + if err != nil { + e.logger.Debug("failed to retrieve block results", "height", res.Height, "error", err.Error()) + return nil, nil + } + + for i := 0; i < int(res.Index) && i < len(blockRes.TxsResults); i++ { + cumulativeGasUsed += uint64(blockRes.TxsResults[i].GasUsed) + } + cumulativeGasUsed += rpctypes.AccumulativeGasUsedOfMsg(res.TxResult.Events, msgIndex) + + var gasUsed uint64 + if len(tx.GetMsgs()) == 1 { + // backward compatibility + gasUsed = uint64(res.TxResult.GasUsed) + } else { + gasUsed, err = rpctypes.GetUint64Attribute(attrs, evmtypes.AttributeKeyTxGasUsed) + if err != nil { + return nil, err + } + } + + // Get the transaction result from the log + _, found := attrs[evmtypes.AttributeKeyEthereumTxFailed] + var status hexutil.Uint + if found { + status = hexutil.Uint(ethtypes.ReceiptStatusFailed) + } else { + status = hexutil.Uint(ethtypes.ReceiptStatusSuccessful) + } + + from, err := ethMsg.GetSender(e.chainIDEpoch) + if err != nil { + return nil, err + } + + // parse tx logs from events + logs, err := backend.TxLogsFromEvents(res.TxResult.Events, msgIndex) + if err != nil { + e.logger.Debug("logs not found", "hash", hexTx, "error", err.Error()) + } + + // Try to find txIndex from events + found = false + txIndex, err := rpctypes.GetUint64Attribute(attrs, evmtypes.AttributeKeyTxIndex) + if err == nil { + found = true + } else { + // Fallback to find tx index by iterating all valid eth transactions + msgs := e.backend.GetEthereumMsgsFromTendermintBlock(resBlock, blockRes) + for i := range msgs { + if msgs[i].Hash == hexTx { + txIndex = uint64(i) + found = true + break + } + } + } + if !found { + return nil, errors.New("can't find index of ethereum tx") + } + + receipt := map[string]interface{}{ + // Consensus fields: These fields are defined by the Yellow Paper + "status": status, + "cumulativeGasUsed": hexutil.Uint64(cumulativeGasUsed), + "logsBloom": ethtypes.BytesToBloom(ethtypes.LogsBloom(logs)), + "logs": logs, + + // Implementation fields: These fields are added by geth when processing a transaction. + // They are stored in the chain database. + "transactionHash": hash, + "contractAddress": nil, + "gasUsed": hexutil.Uint64(gasUsed), + "type": hexutil.Uint(txData.TxType()), + + // Inclusion information: These fields provide information about the inclusion of the + // transaction corresponding to this receipt. + "blockHash": common.BytesToHash(resBlock.Block.Header.Hash()).Hex(), + "blockNumber": hexutil.Uint64(res.Height), + "transactionIndex": hexutil.Uint64(txIndex), + + // sender and receiver (contract or EOA) addreses + "from": from, + "to": txData.GetTo(), + } + + if logs == nil { + receipt["logs"] = [][]*ethtypes.Log{} + } + + // If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation + if txData.GetTo() == nil { + receipt["contractAddress"] = crypto.CreateAddress(from, txData.GetNonce()) + } + + if dynamicTx, ok := txData.(*evmtypes.DynamicFeeTx); ok { + baseFee, err := e.backend.BaseFee(res.Height) + if err != nil { + return nil, err + } + receipt["effectiveGasPrice"] = hexutil.Big(*dynamicTx.GetEffectiveGasPrice(baseFee)) + } + + return receipt, nil +} + +// GetPendingTransactions returns the transactions that are in the transaction pool +// and have a from address that is one of the accounts this node manages. +func (e *PublicAPI) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error) { + e.logger.Debug("eth_getPendingTransactions") + + txs, err := e.backend.PendingTransactions() + if err != nil { + return nil, err + } + + result := make([]*rpctypes.RPCTransaction, 0, len(txs)) + for _, tx := range txs { + for _, msg := range (*tx).GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + // not valid ethereum tx + break + } + + rpctx, err := rpctypes.NewTransactionFromMsg( + ethMsg, + common.Hash{}, + uint64(0), + uint64(0), + e.chainIDEpoch, + ) + if err != nil { + return nil, err + } + + result = append(result, rpctx) + } + } + + return result, nil +} + +// GetUncleByBlockHashAndIndex returns the uncle identified by hash and index. Always returns nil. +func (e *PublicAPI) GetUncleByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) map[string]interface{} { + return nil +} + +// GetUncleByBlockNumberAndIndex returns the uncle identified by number and index. Always returns nil. +func (e *PublicAPI) GetUncleByBlockNumberAndIndex(number, idx hexutil.Uint) map[string]interface{} { + return nil +} + +// GetProof returns an account object with proof and any storage proofs +func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error) { + e.logger.Debug("eth_getProof", "address", address.Hex(), "keys", storageKeys, "block number or hash", blockNrOrHash) + + blockNum, err := e.getBlockNumber(blockNrOrHash) + if err != nil { + return nil, err + } + + height := blockNum.Int64() + ctx := rpctypes.ContextWithHeight(height) + + // if the height is equal to zero, meaning the query condition of the block is either "pending" or "latest" + if height == 0 { + bn, err := e.backend.BlockNumber() + if err != nil { + return nil, err + } + + if bn > math.MaxInt64 { + return nil, fmt.Errorf("not able to query block number greater than MaxInt64") + } + + height = int64(bn) + } + + clientCtx := e.clientCtx.WithHeight(height) + + // query storage proofs + storageProofs := make([]rpctypes.StorageResult, len(storageKeys)) + + for i, key := range storageKeys { + hexKey := common.HexToHash(key) + valueBz, proof, err := e.queryClient.GetProof(clientCtx, evmtypes.StoreKey, evmtypes.StateKey(address, hexKey.Bytes())) + if err != nil { + return nil, err + } + + // check for proof + var proofStr string + if proof != nil { + proofStr = proof.String() + } + + storageProofs[i] = rpctypes.StorageResult{ + Key: key, + Value: (*hexutil.Big)(new(big.Int).SetBytes(valueBz)), + Proof: []string{proofStr}, + } + } + + // query EVM account + req := &evmtypes.QueryAccountRequest{ + Address: address.String(), + } + + res, err := e.queryClient.Account(ctx, req) + if err != nil { + return nil, err + } + + // query account proofs + accountKey := authtypes.AddressStoreKey(sdk.AccAddress(address.Bytes())) + _, proof, err := e.queryClient.GetProof(clientCtx, authtypes.StoreKey, accountKey) + if err != nil { + return nil, err + } + + // check for proof + var accProofStr string + if proof != nil { + accProofStr = proof.String() + } + + balance, ok := sdk.NewIntFromString(res.Balance) + if !ok { + return nil, errors.New("invalid balance") + } + + return &rpctypes.AccountResult{ + Address: address, + AccountProof: []string{accProofStr}, + Balance: (*hexutil.Big)(balance.BigInt()), + CodeHash: common.HexToHash(res.CodeHash), + Nonce: hexutil.Uint64(res.Nonce), + StorageHash: common.Hash{}, // NOTE: Stratos doesn't have a storage hash. TODO: implement? + StorageProof: storageProofs, + }, nil +} + +// getBlockNumber returns the BlockNumber from BlockNumberOrHash +func (e *PublicAPI) getBlockNumber(blockNrOrHash rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error) { + switch { + case blockNrOrHash.BlockHash == nil && blockNrOrHash.BlockNumber == nil: + return rpctypes.EthEarliestBlockNumber, fmt.Errorf("types BlockHash and BlockNumber cannot be both nil") + case blockNrOrHash.BlockHash != nil: + blockHeader, err := e.backend.HeaderByHash(*blockNrOrHash.BlockHash) + if err != nil { + return rpctypes.EthEarliestBlockNumber, err + } + return rpctypes.NewBlockNumber(blockHeader.Number), nil + case blockNrOrHash.BlockNumber != nil: + return *blockNrOrHash.BlockNumber, nil + default: + return rpctypes.EthEarliestBlockNumber, nil + } +} diff --git a/rpc/ethereum/namespaces/eth/filters/api.go b/rpc/ethereum/namespaces/eth/filters/api.go new file mode 100644 index 00000000..44d7568d --- /dev/null +++ b/rpc/ethereum/namespaces/eth/filters/api.go @@ -0,0 +1,606 @@ +package filters + +import ( + "context" + "fmt" + "sync" + "time" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + + "github.com/tendermint/tendermint/libs/log" + + coretypes "github.com/tendermint/tendermint/rpc/core/types" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/filters" + "github.com/ethereum/go-ethereum/rpc" + + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// Backend defines the methods requided by the PublicFilterAPI backend +type Backend interface { + GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) + HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) + HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) + GetLogs(blockHash common.Hash) ([][]*ethtypes.Log, error) + GetLogsByNumber(blockNum types.BlockNumber) ([][]*ethtypes.Log, error) + BlockBloom(height *int64) (ethtypes.Bloom, error) + + BloomStatus() (uint64, uint64) + + RPCFilterCap() int32 + RPCLogsCap() int32 + RPCBlockRangeCap() int32 +} + +// consider a filter inactive if it has not been polled for within deadline +var deadline = 5 * time.Minute + +// filter is a helper struct that holds meta information over the filter type +// and associated subscription in the event system. +type filter struct { + typ filters.Type + deadline *time.Timer // filter is inactive when deadline triggers + hashes []common.Hash + crit filters.FilterCriteria + logs []*ethtypes.Log + s *Subscription // associated subscription in event system +} + +// PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various +// information related to the Ethereum protocol such as blocks, transactions and logs. +type PublicFilterAPI struct { + logger log.Logger + backend Backend + events *EventSystem + filtersMu sync.Mutex + filters map[rpc.ID]*filter +} + +// NewPublicAPI returns a new PublicFilterAPI instance. +func NewPublicAPI(logger log.Logger, tmWSClient *rpcclient.WSClient, backend Backend) *PublicFilterAPI { + logger = logger.With("api", "filter") + api := &PublicFilterAPI{ + logger: logger, + backend: backend, + filters: make(map[rpc.ID]*filter), + events: NewEventSystem(logger, tmWSClient), + } + + go api.timeoutLoop() + + return api +} + +// timeoutLoop runs every 5 minutes and deletes filters that have not been recently used. +// Tt is started when the api is created. +func (api *PublicFilterAPI) timeoutLoop() { + ticker := time.NewTicker(deadline) + defer ticker.Stop() + + for { + <-ticker.C + api.filtersMu.Lock() + for id, f := range api.filters { + select { + case <-f.deadline.C: + f.s.Unsubscribe(api.events) + delete(api.filters, id) + default: + continue + } + } + api.filtersMu.Unlock() + } +} + +// NewPendingTransactionFilter creates a filter that fetches pending transaction hashes +// as transactions enter the pending state. +// +// It is part of the filter package because this filter can be used through the +// `eth_getFilterChanges` polling method that is also used for log filters. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newPendingTransactionFilter +func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID { + api.filtersMu.Lock() + defer api.filtersMu.Unlock() + + if len(api.filters) >= int(api.backend.RPCFilterCap()) { + return rpc.ID("error creating pending tx filter: max limit reached") + } + + pendingTxSub, cancelSubs, err := api.events.SubscribePendingTxs() + if err != nil { + // wrap error on the ID + return rpc.ID(fmt.Sprintf("error creating pending tx filter: %s", err.Error())) + } + + api.filters[pendingTxSub.ID()] = &filter{typ: filters.PendingTransactionsSubscription, deadline: time.NewTimer(deadline), hashes: make([]common.Hash, 0), s: pendingTxSub} + + go func(txsCh <-chan coretypes.ResultEvent, errCh <-chan error) { + defer cancelSubs() + + for { + select { + case ev, ok := <-txsCh: + if !ok { + api.filtersMu.Lock() + delete(api.filters, pendingTxSub.ID()) + api.filtersMu.Unlock() + return + } + + data, ok := ev.Data.(tmtypes.EventDataTx) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) + continue + } + + txHash := common.BytesToHash(tmtypes.Tx(data.Tx).Hash()) + + api.filtersMu.Lock() + if f, found := api.filters[pendingTxSub.ID()]; found { + f.hashes = append(f.hashes, txHash) + } + api.filtersMu.Unlock() + case <-errCh: + api.filtersMu.Lock() + delete(api.filters, pendingTxSub.ID()) + api.filtersMu.Unlock() + } + } + }(pendingTxSub.eventCh, pendingTxSub.Err()) + + return pendingTxSub.ID() +} + +// NewPendingTransactions creates a subscription that is triggered each time a transaction +// enters the transaction pool and was signed from one of the transactions this nodes manages. +func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error) { + notifier, supported := rpc.NotifierFromContext(ctx) + if !supported { + return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported + } + + rpcSub := notifier.CreateSubscription() + + ctx, cancelFn := context.WithTimeout(context.Background(), deadline) + defer cancelFn() + + api.events.WithContext(ctx) + + pendingTxSub, cancelSubs, err := api.events.SubscribePendingTxs() + if err != nil { + return nil, err + } + + go func(txsCh <-chan coretypes.ResultEvent) { + defer cancelSubs() + + for { + select { + case ev, ok := <-txsCh: + if !ok { + api.filtersMu.Lock() + delete(api.filters, pendingTxSub.ID()) + api.filtersMu.Unlock() + return + } + + data, ok := ev.Data.(tmtypes.EventDataTx) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) + continue + } + + txHash := common.BytesToHash(tmtypes.Tx(data.Tx).Hash()) + + // To keep the original behavior, send a single tx hash in one notification. + // TODO(rjl493456442) Send a batch of tx hashes in one notification + err = notifier.Notify(rpcSub.ID, txHash) + if err != nil { + return + } + case <-rpcSub.Err(): + pendingTxSub.Unsubscribe(api.events) + return + case <-notifier.Closed(): + pendingTxSub.Unsubscribe(api.events) + return + } + } + }(pendingTxSub.eventCh) + + return rpcSub, err +} + +// NewBlockFilter creates a filter that fetches blocks that are imported into the chain. +// It is part of the filter package since polling goes with eth_getFilterChanges. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter +func (api *PublicFilterAPI) NewBlockFilter() rpc.ID { + api.filtersMu.Lock() + defer api.filtersMu.Unlock() + + if len(api.filters) >= int(api.backend.RPCFilterCap()) { + return rpc.ID("error creating block filter: max limit reached") + } + + headerSub, cancelSubs, err := api.events.SubscribeNewHeads() + if err != nil { + // wrap error on the ID + return rpc.ID(fmt.Sprintf("error creating block filter: %s", err.Error())) + } + + api.filters[headerSub.ID()] = &filter{typ: filters.BlocksSubscription, deadline: time.NewTimer(deadline), hashes: []common.Hash{}, s: headerSub} + + go func(headersCh <-chan coretypes.ResultEvent, errCh <-chan error) { + defer cancelSubs() + + for { + select { + case ev, ok := <-headersCh: + if !ok { + api.filtersMu.Lock() + delete(api.filters, headerSub.ID()) + api.filtersMu.Unlock() + return + } + + data, ok := ev.Data.(tmtypes.EventDataNewBlockHeader) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) + continue + } + + baseFee := types.BaseFeeFromEvents(data.ResultBeginBlock.Events) + + header := types.EthHeaderFromTendermint(data.Header, ethtypes.Bloom{}, baseFee) + api.filtersMu.Lock() + if f, found := api.filters[headerSub.ID()]; found { + f.hashes = append(f.hashes, header.Hash()) + } + api.filtersMu.Unlock() + case <-errCh: + api.filtersMu.Lock() + delete(api.filters, headerSub.ID()) + api.filtersMu.Unlock() + return + } + } + }(headerSub.eventCh, headerSub.Err()) + + return headerSub.ID() +} + +// NewHeads send a notification each time a new (header) block is appended to the chain. +func (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) { + notifier, supported := rpc.NotifierFromContext(ctx) + if !supported { + return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported + } + + api.events.WithContext(ctx) + rpcSub := notifier.CreateSubscription() + + headersSub, cancelSubs, err := api.events.SubscribeNewHeads() + if err != nil { + return &rpc.Subscription{}, err + } + + go func(headersCh <-chan coretypes.ResultEvent) { + defer cancelSubs() + + for { + select { + case ev, ok := <-headersCh: + if !ok { + headersSub.Unsubscribe(api.events) + return + } + + data, ok := ev.Data.(tmtypes.EventDataNewBlockHeader) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) + continue + } + + baseFee := types.BaseFeeFromEvents(data.ResultBeginBlock.Events) + + // TODO: fetch bloom from events + header := types.EthHeaderFromTendermint(data.Header, ethtypes.Bloom{}, baseFee) + err = notifier.Notify(rpcSub.ID, header) + if err != nil { + headersSub.err <- err + return + } + case <-rpcSub.Err(): + headersSub.Unsubscribe(api.events) + return + case <-notifier.Closed(): + headersSub.Unsubscribe(api.events) + return + } + } + }(headersSub.eventCh) + + return rpcSub, err +} + +// Logs creates a subscription that fires for all new log that match the given filter criteria. +func (api *PublicFilterAPI) Logs(ctx context.Context, crit filters.FilterCriteria) (*rpc.Subscription, error) { + notifier, supported := rpc.NotifierFromContext(ctx) + if !supported { + return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported + } + + api.events.WithContext(ctx) + rpcSub := notifier.CreateSubscription() + + logsSub, cancelSubs, err := api.events.SubscribeLogs(crit) + if err != nil { + return &rpc.Subscription{}, err + } + + go func(logsCh <-chan coretypes.ResultEvent) { + defer cancelSubs() + + for { + select { + case ev, ok := <-logsCh: + if !ok { + logsSub.Unsubscribe(api.events) + return + } + + // filter only events from EVM module txs + _, isMsgEthereumTx := ev.Events[evmtypes.TypeMsgEthereumTx] + + if !isMsgEthereumTx { + // ignore transaction as it's not from the evm module + return + } + + // get transaction result data + dataTx, ok := ev.Data.(tmtypes.EventDataTx) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) + continue + } + + txResponse, err := evmtypes.DecodeTxResponse(dataTx.TxResult.Result.Data) + if err != nil { + return + } + + logs := FilterLogs(evmtypes.LogsToEthereum(txResponse.Logs), crit.FromBlock, crit.ToBlock, crit.Addresses, crit.Topics) + + for _, log := range logs { + err = notifier.Notify(rpcSub.ID, log) + if err != nil { + return + } + } + case <-rpcSub.Err(): // client send an unsubscribe request + logsSub.Unsubscribe(api.events) + return + case <-notifier.Closed(): // connection dropped + logsSub.Unsubscribe(api.events) + return + } + } + }(logsSub.eventCh) + + return rpcSub, err +} + +// NewFilter creates a new filter and returns the filter id. It can be +// used to retrieve logs when the state changes. This method cannot be +// used to fetch logs that are already stored in the state. +// +// Default criteria for the from and to block are "latest". +// Using "latest" as block number will return logs for mined blocks. +// Using "pending" as block number returns logs for not yet mined (pending) blocks. +// In case logs are removed (chain reorg) previously returned logs are returned +// again but with the removed property set to true. +// +// In case "fromBlock" > "toBlock" an error is returned. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter +func (api *PublicFilterAPI) NewFilter(criteria filters.FilterCriteria) (rpc.ID, error) { + api.filtersMu.Lock() + defer api.filtersMu.Unlock() + + if len(api.filters) >= int(api.backend.RPCFilterCap()) { + return rpc.ID(""), fmt.Errorf("error creating filter: max limit reached") + } + + var ( + filterID = rpc.ID("") + err error + ) + + logsSub, cancelSubs, err := api.events.SubscribeLogs(criteria) + if err != nil { + return rpc.ID(""), err + } + + filterID = logsSub.ID() + + api.filters[filterID] = &filter{typ: filters.LogsSubscription, crit: criteria, deadline: time.NewTimer(deadline), hashes: []common.Hash{}, s: logsSub} + + go func(eventCh <-chan coretypes.ResultEvent) { + defer cancelSubs() + + for { + select { + case ev, ok := <-eventCh: + if !ok { + api.filtersMu.Lock() + delete(api.filters, filterID) + api.filtersMu.Unlock() + return + } + dataTx, ok := ev.Data.(tmtypes.EventDataTx) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) + continue + } + + txResponse, err := evmtypes.DecodeTxResponse(dataTx.TxResult.Result.Data) + if err != nil { + return + } + + logs := FilterLogs(evmtypes.LogsToEthereum(txResponse.Logs), criteria.FromBlock, criteria.ToBlock, criteria.Addresses, criteria.Topics) + + api.filtersMu.Lock() + if f, found := api.filters[filterID]; found { + f.logs = append(f.logs, logs...) + } + api.filtersMu.Unlock() + case <-logsSub.Err(): + api.filtersMu.Lock() + delete(api.filters, filterID) + api.filtersMu.Unlock() + return + } + } + }(logsSub.eventCh) + + return filterID, err +} + +// GetLogs returns logs matching the given argument that are stored within the state. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs +func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([]*ethtypes.Log, error) { + var filter *Filter + if crit.BlockHash != nil { + // Block filter requested, construct a single-shot filter + filter = NewBlockFilter(api.logger, api.backend, crit) + } else { + // Convert the RPC block numbers into internal representations + begin := rpc.LatestBlockNumber.Int64() + if crit.FromBlock != nil { + begin = crit.FromBlock.Int64() + } + end := rpc.LatestBlockNumber.Int64() + if crit.ToBlock != nil { + end = crit.ToBlock.Int64() + } + // Construct the range filter + filter = NewRangeFilter(api.logger, api.backend, begin, end, crit.Addresses, crit.Topics) + } + + // Run the filter and return all the logs + logs, err := filter.Logs(ctx, int(api.backend.RPCLogsCap()), int64(api.backend.RPCBlockRangeCap())) + if err != nil { + return nil, err + } + + return returnLogs(logs), err +} + +// UninstallFilter removes the filter with the given filter id. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter +func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool { + api.filtersMu.Lock() + f, found := api.filters[id] + if found { + delete(api.filters, id) + } + api.filtersMu.Unlock() + + if !found { + return false + } + f.s.Unsubscribe(api.events) + return true +} + +// GetFilterLogs returns the logs for the filter with the given id. +// If the filter could not be found an empty array of logs is returned. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs +func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ethtypes.Log, error) { + api.filtersMu.Lock() + f, found := api.filters[id] + api.filtersMu.Unlock() + + if !found { + return returnLogs(nil), fmt.Errorf("filter %s not found", id) + } + + if f.typ != filters.LogsSubscription { + return returnLogs(nil), fmt.Errorf("filter %s doesn't have a LogsSubscription type: got %d", id, f.typ) + } + + var filter *Filter + if f.crit.BlockHash != nil { + // Block filter requested, construct a single-shot filter + filter = NewBlockFilter(api.logger, api.backend, f.crit) + } else { + // Convert the RPC block numbers into internal representations + begin := rpc.LatestBlockNumber.Int64() + if f.crit.FromBlock != nil { + begin = f.crit.FromBlock.Int64() + } + end := rpc.LatestBlockNumber.Int64() + if f.crit.ToBlock != nil { + end = f.crit.ToBlock.Int64() + } + // Construct the range filter + filter = NewRangeFilter(api.logger, api.backend, begin, end, f.crit.Addresses, f.crit.Topics) + } + // Run the filter and return all the logs + logs, err := filter.Logs(ctx, int(api.backend.RPCLogsCap()), int64(api.backend.RPCBlockRangeCap())) + if err != nil { + return nil, err + } + return returnLogs(logs), nil +} + +// GetFilterChanges returns the logs for the filter with the given id since +// last time it was called. This can be used for polling. +// +// For pending transaction and block filters the result is []common.Hash. +// (pending)Log filters return []Log. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges +func (api *PublicFilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) { + api.filtersMu.Lock() + defer api.filtersMu.Unlock() + + f, found := api.filters[id] + if !found { + return nil, fmt.Errorf("filter %s not found", id) + } + + if !f.deadline.Stop() { + // timer expired but filter is not yet removed in timeout loop + // receive timer value and reset timer + <-f.deadline.C + } + f.deadline.Reset(deadline) + + switch f.typ { + case filters.PendingTransactionsSubscription, filters.BlocksSubscription: + hashes := f.hashes + f.hashes = nil + return returnHashes(hashes), nil + case filters.LogsSubscription, filters.MinedAndPendingLogsSubscription: + logs := make([]*ethtypes.Log, len(f.logs)) + copy(logs, f.logs) + f.logs = []*ethtypes.Log{} + return returnLogs(logs), nil + default: + return nil, fmt.Errorf("invalid filter %s type %d", id, f.typ) + } +} diff --git a/rpc/ethereum/namespaces/eth/filters/filter_system.go b/rpc/ethereum/namespaces/eth/filters/filter_system.go new file mode 100644 index 00000000..12087d4e --- /dev/null +++ b/rpc/ethereum/namespaces/eth/filters/filter_system.go @@ -0,0 +1,304 @@ +package filters + +import ( + "context" + "fmt" + "sync" + "time" + + "github.com/pkg/errors" + + tmjson "github.com/tendermint/tendermint/libs/json" + "github.com/tendermint/tendermint/libs/log" + tmquery "github.com/tendermint/tendermint/libs/pubsub/query" + coretypes "github.com/tendermint/tendermint/rpc/core/types" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/filters" + "github.com/ethereum/go-ethereum/rpc" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/pubsub" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +var ( + txEvents = tmtypes.QueryForEvent(tmtypes.EventTx).String() + evmEvents = tmquery.MustParse(fmt.Sprintf("%s='%s' AND %s.%s='%s'", tmtypes.EventTypeKey, tmtypes.EventTx, sdk.EventTypeMessage, sdk.AttributeKeyModule, evmtypes.ModuleName)).String() + headerEvents = tmtypes.QueryForEvent(tmtypes.EventNewBlockHeader).String() +) + +// EventSystem creates subscriptions, processes events and broadcasts them to the +// subscription which match the subscription criteria using the Tendermint's RPC client. +type EventSystem struct { + logger log.Logger + ctx context.Context + tmWSClient *rpcclient.WSClient + + // light client mode + lightMode bool + + index filterIndex + topicChans map[string]chan<- coretypes.ResultEvent + indexMux *sync.RWMutex + + // Channels + install chan *Subscription // install filter for event notification + uninstall chan *Subscription // remove filter for event notification + eventBus pubsub.EventBus +} + +// NewEventSystem creates a new manager that listens for event on the given mux, +// parses and filters them. It uses the all map to retrieve filter changes. The +// work loop holds its own index that is used to forward events to filters. +// +// The returned manager has a loop that needs to be stopped with the Stop function +// or by stopping the given mux. +func NewEventSystem(logger log.Logger, tmWSClient *rpcclient.WSClient) *EventSystem { + index := make(filterIndex) + for i := filters.UnknownSubscription; i < filters.LastIndexSubscription; i++ { + index[i] = make(map[rpc.ID]*Subscription) + } + + es := &EventSystem{ + logger: logger, + ctx: context.Background(), + tmWSClient: tmWSClient, + lightMode: false, + index: index, + topicChans: make(map[string]chan<- coretypes.ResultEvent, len(index)), + indexMux: new(sync.RWMutex), + install: make(chan *Subscription), + uninstall: make(chan *Subscription), + eventBus: pubsub.NewEventBus(), + } + + go es.eventLoop() + go es.consumeEvents() + return es +} + +// WithContext sets a new context to the EventSystem. This is required to set a timeout context when +// a new filter is intantiated. +func (es *EventSystem) WithContext(ctx context.Context) { + es.ctx = ctx +} + +// subscribe performs a new event subscription to a given Tendermint event. +// The subscription creates a unidirectional receive event channel to receive the ResultEvent. +func (es *EventSystem) subscribe(sub *Subscription) (*Subscription, pubsub.UnsubscribeFunc, error) { + var ( + err error + cancelFn context.CancelFunc + ) + + ctx, cancelFn := context.WithCancel(context.Background()) + defer cancelFn() + + existingSubs := es.eventBus.Topics() + for _, topic := range existingSubs { + if topic == sub.event { + eventCh, unsubFn, err := es.eventBus.Subscribe(sub.event) + if err != nil { + err := errors.Wrapf(err, "failed to subscribe to topic: %s", sub.event) + return nil, nil, err + } + + sub.eventCh = eventCh + return sub, unsubFn, nil + } + } + + switch sub.typ { + case filters.LogsSubscription: + err = es.tmWSClient.Subscribe(ctx, sub.event) + case filters.BlocksSubscription: + err = es.tmWSClient.Subscribe(ctx, sub.event) + case filters.PendingTransactionsSubscription: + err = es.tmWSClient.Subscribe(ctx, sub.event) + default: + err = fmt.Errorf("invalid filter subscription type %d", sub.typ) + } + + if err != nil { + sub.err <- err + return nil, nil, err + } + + // wrap events in a go routine to prevent blocking + es.install <- sub + <-sub.installed + + eventCh, unsubFn, err := es.eventBus.Subscribe(sub.event) + if err != nil { + return nil, nil, errors.Wrapf(err, "failed to subscribe to topic after installed: %s", sub.event) + } + + sub.eventCh = eventCh + return sub, unsubFn, nil +} + +// SubscribeLogs creates a subscription that will write all logs matching the +// given criteria to the given logs channel. Default value for the from and to +// block is "latest". If the fromBlock > toBlock an error is returned. +func (es *EventSystem) SubscribeLogs(crit filters.FilterCriteria) (*Subscription, pubsub.UnsubscribeFunc, error) { + var from, to rpc.BlockNumber + if crit.FromBlock == nil { + from = rpc.LatestBlockNumber + } else { + from = rpc.BlockNumber(crit.FromBlock.Int64()) + } + if crit.ToBlock == nil { + to = rpc.LatestBlockNumber + } else { + to = rpc.BlockNumber(crit.ToBlock.Int64()) + } + + switch { + // only interested in new mined logs, mined logs within a specific block range, or + // logs from a specific block number to new mined blocks + case (from == rpc.LatestBlockNumber && to == rpc.LatestBlockNumber), + (from >= 0 && to >= 0 && to >= from), + (from >= 0 && to == rpc.LatestBlockNumber): + return es.subscribeLogs(crit) + + default: + return nil, nil, fmt.Errorf("invalid from and to block combination: from > to (%d > %d)", from, to) + } +} + +// subscribeLogs creates a subscription that will write all logs matching the +// given criteria to the given logs channel. +func (es *EventSystem) subscribeLogs(crit filters.FilterCriteria) (*Subscription, pubsub.UnsubscribeFunc, error) { + sub := &Subscription{ + id: rpc.NewID(), + typ: filters.LogsSubscription, + event: evmEvents, + logsCrit: crit, + created: time.Now().UTC(), + logs: make(chan []*ethtypes.Log), + installed: make(chan struct{}, 1), + err: make(chan error, 1), + } + return es.subscribe(sub) +} + +// SubscribeNewHeads subscribes to new block headers events. +func (es EventSystem) SubscribeNewHeads() (*Subscription, pubsub.UnsubscribeFunc, error) { + sub := &Subscription{ + id: rpc.NewID(), + typ: filters.BlocksSubscription, + event: headerEvents, + created: time.Now().UTC(), + headers: make(chan *ethtypes.Header), + installed: make(chan struct{}, 1), + err: make(chan error, 1), + } + return es.subscribe(sub) +} + +// SubscribePendingTxs subscribes to new pending transactions events from the mempool. +func (es EventSystem) SubscribePendingTxs() (*Subscription, pubsub.UnsubscribeFunc, error) { + sub := &Subscription{ + id: rpc.NewID(), + typ: filters.PendingTransactionsSubscription, + event: txEvents, + created: time.Now().UTC(), + hashes: make(chan []common.Hash), + installed: make(chan struct{}, 1), + err: make(chan error, 1), + } + return es.subscribe(sub) +} + +type filterIndex map[filters.Type]map[rpc.ID]*Subscription + +// eventLoop (un)installs filters and processes mux events. +func (es *EventSystem) eventLoop() { + for { + select { + case f := <-es.install: + es.indexMux.Lock() + es.index[f.typ][f.id] = f + ch := make(chan coretypes.ResultEvent) + es.topicChans[f.event] = ch + if err := es.eventBus.AddTopic(f.event, ch); err != nil { + es.logger.Error("failed to add event topic to event bus", "topic", f.event, "error", err.Error()) + } + es.indexMux.Unlock() + close(f.installed) + case f := <-es.uninstall: + es.indexMux.Lock() + delete(es.index[f.typ], f.id) + + var channelInUse bool + for _, sub := range es.index[f.typ] { + if sub.event == f.event { + channelInUse = true + break + } + } + + // remove topic only when channel is not used by other subscriptions + if !channelInUse { + if err := es.tmWSClient.Unsubscribe(es.ctx, f.event); err != nil { + es.logger.Error("failed to unsubscribe from query", "query", f.event, "error", err.Error()) + } + + ch, ok := es.topicChans[f.event] + if ok { + es.eventBus.RemoveTopic(f.event) + close(ch) + delete(es.topicChans, f.event) + } + } + + es.indexMux.Unlock() + close(f.err) + } + } +} + +func (es *EventSystem) consumeEvents() { + for { + for rpcResp := range es.tmWSClient.ResponsesCh { + var ev coretypes.ResultEvent + + if rpcResp.Error != nil { + time.Sleep(5 * time.Second) + continue + } else if err := tmjson.Unmarshal(rpcResp.Result, &ev); err != nil { + es.logger.Error("failed to JSON unmarshal ResponsesCh result event", "error", err.Error()) + continue + } + + if len(ev.Query) == 0 { + // skip empty responses + continue + } + + es.indexMux.RLock() + ch, ok := es.topicChans[ev.Query] + es.indexMux.RUnlock() + if !ok { + es.logger.Debug("channel for subscription not found", "topic", ev.Query) + es.logger.Debug("list of available channels", "channels", es.eventBus.Topics()) + continue + } + + // gracefully handle lagging subscribers + t := time.NewTimer(time.Second) + select { + case <-t.C: + es.logger.Debug("dropped event during lagging subscription", "topic", ev.Query) + case ch <- ev: + } + } + + time.Sleep(time.Second) + } +} diff --git a/rpc/ethereum/namespaces/eth/filters/filters.go b/rpc/ethereum/namespaces/eth/filters/filters.go new file mode 100644 index 00000000..6766ab6d --- /dev/null +++ b/rpc/ethereum/namespaces/eth/filters/filters.go @@ -0,0 +1,253 @@ +package filters + +import ( + "context" + "encoding/binary" + "math/big" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + + "github.com/pkg/errors" + "github.com/tendermint/tendermint/libs/log" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/eth/filters" +) + +// BloomIV represents the bit indexes and value inside the bloom filter that belong +// to some key. +type BloomIV struct { + I [3]uint + V [3]byte +} + +// Filter can be used to retrieve and filter logs. +type Filter struct { + logger log.Logger + backend Backend + criteria filters.FilterCriteria + + bloomFilters [][]BloomIV // Filter the system is matching for +} + +// NewBlockFilter creates a new filter which directly inspects the contents of +// a block to figure out whether it is interesting or not. +func NewBlockFilter(logger log.Logger, backend Backend, criteria filters.FilterCriteria) *Filter { + // Create a generic filter and convert it into a block filter + return newFilter(logger, backend, criteria, nil) +} + +// NewRangeFilter creates a new filter which uses a bloom filter on blocks to +// figure out whether a particular block is interesting or not. +func NewRangeFilter(logger log.Logger, backend Backend, begin, end int64, addresses []common.Address, topics [][]common.Hash) *Filter { + // Flatten the address and topic filter clauses into a single bloombits filter + // system. Since the bloombits are not positional, nil topics are permitted, + // which get flattened into a nil byte slice. + var filtersBz [][][]byte // nolint: prealloc + if len(addresses) > 0 { + filter := make([][]byte, len(addresses)) + for i, address := range addresses { + filter[i] = address.Bytes() + } + filtersBz = append(filtersBz, filter) + } + + for _, topicList := range topics { + filter := make([][]byte, len(topicList)) + for i, topic := range topicList { + filter[i] = topic.Bytes() + } + filtersBz = append(filtersBz, filter) + } + + // Create a generic filter and convert it into a range filter + criteria := filters.FilterCriteria{ + FromBlock: big.NewInt(begin), + ToBlock: big.NewInt(end), + Addresses: addresses, + Topics: topics, + } + + return newFilter(logger, backend, criteria, createBloomFilters(filtersBz, logger)) +} + +// newFilter returns a new Filter +func newFilter(logger log.Logger, backend Backend, criteria filters.FilterCriteria, bloomFilters [][]BloomIV) *Filter { + return &Filter{ + logger: logger, + backend: backend, + criteria: criteria, + bloomFilters: bloomFilters, + } +} + +const ( + maxToOverhang = 600 +) + +// Logs searches the blockchain for matching log entries, returning all from the +// first block that contains matches, updating the start of the filter accordingly. +func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) ([]*ethtypes.Log, error) { + logs := []*ethtypes.Log{} + var err error + + // If we're doing singleton block filtering, execute and return + if f.criteria.BlockHash != nil && *f.criteria.BlockHash != (common.Hash{}) { + header, err := f.backend.HeaderByHash(*f.criteria.BlockHash) + if err != nil { + return nil, errors.Wrap(err, "failed to fetch header by hash") + } + + if header == nil { + return nil, errors.Errorf("unknown block header %s", f.criteria.BlockHash.String()) + } + + return f.blockLogs(header.Number.Int64(), header.Bloom) + } + + // Figure out the limits of the filter range + header, err := f.backend.HeaderByNumber(types.EthLatestBlockNumber) + if err != nil { + return nil, errors.Wrap(err, "failed to fetch header by number (latest)") + } + + if header == nil || header.Number == nil { + f.logger.Debug("header not found or has no number") + return nil, nil + } + + head := header.Number.Int64() + if f.criteria.FromBlock.Int64() < 0 { + f.criteria.FromBlock = big.NewInt(head) + } else if f.criteria.FromBlock.Int64() == 0 { + f.criteria.FromBlock = big.NewInt(1) + } + if f.criteria.ToBlock.Int64() < 0 { + f.criteria.ToBlock = big.NewInt(head) + } else if f.criteria.ToBlock.Int64() == 0 { + f.criteria.ToBlock = big.NewInt(1) + } + + if f.criteria.ToBlock.Int64()-f.criteria.FromBlock.Int64() > blockLimit { + return nil, errors.Errorf("maximum [from, to] blocks distance: %d", blockLimit) + } + + // check bounds + if f.criteria.FromBlock.Int64() > head { + return []*ethtypes.Log{}, nil + } else if f.criteria.ToBlock.Int64() > head+maxToOverhang { + f.criteria.ToBlock = big.NewInt(head + maxToOverhang) + } + + from := f.criteria.FromBlock.Int64() + to := f.criteria.ToBlock.Int64() + + for height := from; height <= to; height++ { + bloom, err := f.backend.BlockBloom(&height) + if err != nil { + return nil, err + } + + filtered, err := f.blockLogs(height, bloom) + if err != nil { + return nil, errors.Wrapf(err, "failed to fetch block by number %d", height) + } + + // check logs limit + if len(logs)+len(filtered) > logLimit { + return nil, errors.Errorf("query returned more than %d results", logLimit) + } + logs = append(logs, filtered...) + } + return logs, nil +} + +// blockLogs returns the logs matching the filter criteria within a single block. +func (f *Filter) blockLogs(height int64, bloom ethtypes.Bloom) ([]*ethtypes.Log, error) { + if !bloomFilter(bloom, f.criteria.Addresses, f.criteria.Topics) { + return []*ethtypes.Log{}, nil + } + + // DANGER: do not call GetLogs(header.Hash()) + // eth header's hash doesn't match tm block hash + logsList, err := f.backend.GetLogsByNumber(types.BlockNumber(height)) + if err != nil { + return []*ethtypes.Log{}, errors.Wrapf(err, "failed to fetch logs block number %d", height) + } + + unfiltered := make([]*ethtypes.Log, 0) + for _, logs := range logsList { + unfiltered = append(unfiltered, logs...) + } + + logs := FilterLogs(unfiltered, nil, nil, f.criteria.Addresses, f.criteria.Topics) + if len(logs) == 0 { + return []*ethtypes.Log{}, nil + } + + return logs, nil +} + +func createBloomFilters(filters [][][]byte, logger log.Logger) [][]BloomIV { + bloomFilters := make([][]BloomIV, 0) + for _, filter := range filters { + // Gather the bit indexes of the filter rule, special casing the nil filter + if len(filter) == 0 { + continue + } + bloomIVs := make([]BloomIV, len(filter)) + + // Transform the filter rules (the addresses and topics) to the bloom index and value arrays + // So it can be used to compare with the bloom of the block header. If the rule has any nil + // clauses. The rule will be ignored. + for i, clause := range filter { + if clause == nil { + bloomIVs = nil + break + } + + iv, err := calcBloomIVs(clause) + if err != nil { + bloomIVs = nil + logger.Error("calcBloomIVs error: %v", err) + break + } + + bloomIVs[i] = iv + } + // Accumulate the filter rules if no nil rule was within + if bloomIVs != nil { + bloomFilters = append(bloomFilters, bloomIVs) + } + } + return bloomFilters +} + +// calcBloomIVs returns BloomIV for the given data, +// revised from https://github.com/ethereum/go-ethereum/blob/401354976bb44f0ad4455ca1e0b5c0dc31d9a5f5/core/types/bloom9.go#L139 +func calcBloomIVs(data []byte) (BloomIV, error) { + hashbuf := make([]byte, 6) + biv := BloomIV{} + + sha := crypto.NewKeccakState() + sha.Reset() + if _, err := sha.Write(data); err != nil { + return BloomIV{}, err + } + if _, err := sha.Read(hashbuf); err != nil { + return BloomIV{}, err + } + + // The actual bits to flip + biv.V[0] = byte(1 << (hashbuf[1] & 0x7)) + biv.V[1] = byte(1 << (hashbuf[3] & 0x7)) + biv.V[2] = byte(1 << (hashbuf[5] & 0x7)) + // The indices for the bytes to OR in + biv.I[0] = ethtypes.BloomByteLength - uint((binary.BigEndian.Uint16(hashbuf)&0x7ff)>>3) - 1 + biv.I[1] = ethtypes.BloomByteLength - uint((binary.BigEndian.Uint16(hashbuf[2:])&0x7ff)>>3) - 1 + biv.I[2] = ethtypes.BloomByteLength - uint((binary.BigEndian.Uint16(hashbuf[4:])&0x7ff)>>3) - 1 + + return biv, nil +} diff --git a/rpc/ethereum/namespaces/eth/filters/subscription.go b/rpc/ethereum/namespaces/eth/filters/subscription.go new file mode 100644 index 00000000..e8881177 --- /dev/null +++ b/rpc/ethereum/namespaces/eth/filters/subscription.go @@ -0,0 +1,63 @@ +package filters + +import ( + "time" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/filters" + "github.com/ethereum/go-ethereum/rpc" + + coretypes "github.com/tendermint/tendermint/rpc/core/types" +) + +// Subscription defines a wrapper for the private subscription +type Subscription struct { + id rpc.ID + typ filters.Type + event string + created time.Time + logsCrit filters.FilterCriteria + logs chan []*ethtypes.Log + hashes chan []common.Hash + headers chan *ethtypes.Header + installed chan struct{} // closed when the filter is installed + eventCh <-chan coretypes.ResultEvent + err chan error +} + +// ID returns the underlying subscription RPC identifier. +func (s Subscription) ID() rpc.ID { + return s.id +} + +// Unsubscribe from the current subscription to Tendermint Websocket. It sends an error to the +// subscription error channel if unsubscription fails. +func (s *Subscription) Unsubscribe(es *EventSystem) { + go func() { + uninstallLoop: + for { + // write uninstall request and consume logs/hashes. This prevents + // the eventLoop broadcast method to deadlock when writing to the + // filter event channel while the subscription loop is waiting for + // this method to return (and thus not reading these events). + select { + case es.uninstall <- s: + break uninstallLoop + case <-s.logs: + case <-s.hashes: + case <-s.headers: + } + } + }() +} + +// Err returns the error channel +func (s *Subscription) Err() <-chan error { + return s.err +} + +// Event returns the tendermint result event channel +func (s *Subscription) Event() <-chan coretypes.ResultEvent { + return s.eventCh +} diff --git a/rpc/ethereum/namespaces/eth/filters/utils.go b/rpc/ethereum/namespaces/eth/filters/utils.go new file mode 100644 index 00000000..12a69301 --- /dev/null +++ b/rpc/ethereum/namespaces/eth/filters/utils.go @@ -0,0 +1,106 @@ +package filters + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// FilterLogs creates a slice of logs matching the given criteria. +// [] -> anything +// [A] -> A in first position of log topics, anything after +// [null, B] -> anything in first position, B in second position +// [A, B] -> A in first position and B in second position +// [[A, B], [A, B]] -> A or B in first position, A or B in second position +func FilterLogs(logs []*ethtypes.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*ethtypes.Log { + var ret []*ethtypes.Log +Logs: + for _, log := range logs { + if fromBlock != nil && fromBlock.Int64() >= 0 && fromBlock.Uint64() > log.BlockNumber { + continue + } + if toBlock != nil && toBlock.Int64() >= 0 && toBlock.Uint64() < log.BlockNumber { + continue + } + if len(addresses) > 0 && !includes(addresses, log.Address) { + continue + } + // If the to filtered topics is greater than the amount of topics in logs, skip. + if len(topics) > len(log.Topics) { + continue + } + for i, sub := range topics { + match := len(sub) == 0 // empty rule set == wildcard + for _, topic := range sub { + if log.Topics[i] == topic { + match = true + break + } + } + if !match { + continue Logs + } + } + ret = append(ret, log) + } + return ret +} + +func includes(addresses []common.Address, a common.Address) bool { + for _, addr := range addresses { + if addr == a { + return true + } + } + + return false +} + +// https://github.com/ethereum/go-ethereum/blob/v1.10.14/eth/filters/filter.go#L321 +func bloomFilter(bloom ethtypes.Bloom, addresses []common.Address, topics [][]common.Hash) bool { + if len(addresses) > 0 { + var included bool + for _, addr := range addresses { + if ethtypes.BloomLookup(bloom, addr) { + included = true + break + } + } + if !included { + return false + } + } + + for _, sub := range topics { + included := len(sub) == 0 // empty rule set == wildcard + for _, topic := range sub { + if ethtypes.BloomLookup(bloom, topic) { + included = true + break + } + } + if !included { + return false + } + } + return true +} + +// returnHashes is a helper that will return an empty hash array case the given hash array is nil, +// otherwise the given hashes array is returned. +func returnHashes(hashes []common.Hash) []common.Hash { + if hashes == nil { + return []common.Hash{} + } + return hashes +} + +// returnLogs is a helper that will return an empty log array in case the given logs array is nil, +// otherwise the given logs array is returned. +func returnLogs(logs []*ethtypes.Log) []*ethtypes.Log { + if logs == nil { + return []*ethtypes.Log{} + } + return logs +} diff --git a/rpc/ethereum/namespaces/miner/api.go b/rpc/ethereum/namespaces/miner/api.go new file mode 100644 index 00000000..0cf2ca2a --- /dev/null +++ b/rpc/ethereum/namespaces/miner/api.go @@ -0,0 +1,186 @@ +package miner + +import ( + "math/big" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/server" + sdkconfig "github.com/cosmos/cosmos-sdk/server/config" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + + "github.com/tendermint/tendermint/libs/log" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" + rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/server/config" +) + +// API is the private miner prefixed set of APIs in the Miner JSON-RPC spec. +type API struct { + ctx *server.Context + logger log.Logger + clientCtx client.Context + backend backend.Backend +} + +// NewPrivateAPI creates an instance of the Miner API. +func NewPrivateAPI( + ctx *server.Context, + clientCtx client.Context, + backend backend.Backend, +) *API { + return &API{ + ctx: ctx, + clientCtx: clientCtx, + logger: ctx.Logger.With("api", "miner"), + backend: backend, + } +} + +// SetEtherbase sets the etherbase of the miner +func (api *API) SetEtherbase(etherbase common.Address) bool { + api.logger.Debug("miner_setEtherbase") + + delAddr, err := api.backend.GetCoinbase() + if err != nil { + api.logger.Debug("failed to get coinbase address", "error", err.Error()) + return false + } + + withdrawAddr := sdk.AccAddress(etherbase.Bytes()) + msg := distributiontypes.NewMsgSetWithdrawAddress(delAddr, withdrawAddr) + + if err := msg.ValidateBasic(); err != nil { + api.logger.Debug("tx failed basic validation", "error", err.Error()) + return false + } + + // Assemble transaction from fields + builder, ok := api.clientCtx.TxConfig.NewTxBuilder().(authtx.ExtensionOptionsTxBuilder) + if !ok { + api.logger.Debug("clientCtx.TxConfig.NewTxBuilder returns unsupported builder", "error", err.Error()) + return false + } + + err = builder.SetMsgs(msg) + if err != nil { + api.logger.Error("builder.SetMsgs failed", "error", err.Error()) + return false + } + + // Fetch minimun gas price to calculate fees using the configuration. + appConf := config.GetConfig(api.ctx.Viper) + + minGasPrices := appConf.GetMinGasPrices() + if len(minGasPrices) == 0 || minGasPrices.Empty() { + api.logger.Debug("the minimun fee is not set") + return false + } + minGasPriceValue := minGasPrices[0].Amount + denom := minGasPrices[0].Denom + + delCommonAddr := common.BytesToAddress(delAddr.Bytes()) + nonce, err := api.backend.GetTransactionCount(delCommonAddr, rpctypes.EthPendingBlockNumber) + if err != nil { + api.logger.Debug("failed to get nonce", "error", err.Error()) + return false + } + + txFactory := tx.Factory{} + txFactory = txFactory. + WithChainID(api.clientCtx.ChainID). + WithKeybase(api.clientCtx.Keyring). + WithTxConfig(api.clientCtx.TxConfig). + WithSequence(uint64(*nonce)). + WithGasAdjustment(1.25) + + _, gas, err := tx.CalculateGas(api.clientCtx, txFactory, msg) + if err != nil { + api.logger.Debug("failed to calculate gas", "error", err.Error()) + return false + } + + txFactory = txFactory.WithGas(gas) + + value := new(big.Int).SetUint64(gas * minGasPriceValue.Ceil().TruncateInt().Uint64()) + fees := sdk.Coins{sdk.NewCoin(denom, sdk.NewIntFromBigInt(value))} + builder.SetFeeAmount(fees) + builder.SetGasLimit(gas) + + keyInfo, err := api.clientCtx.Keyring.KeyByAddress(delAddr) + if err != nil { + api.logger.Debug("failed to get the wallet address using the keyring", "error", err.Error()) + return false + } + + if err := tx.Sign(txFactory, keyInfo.GetName(), builder, false); err != nil { + api.logger.Debug("failed to sign tx", "error", err.Error()) + return false + } + + // Encode transaction by default Tx encoder + txEncoder := api.clientCtx.TxConfig.TxEncoder() + txBytes, err := txEncoder(builder.GetTx()) + if err != nil { + api.logger.Debug("failed to encode eth tx using default encoder", "error", err.Error()) + return false + } + + tmHash := common.BytesToHash(tmtypes.Tx(txBytes).Hash()) + + // Broadcast transaction in sync mode (default) + // NOTE: If error is encountered on the node, the broadcast will not return an error + syncCtx := api.clientCtx.WithBroadcastMode(flags.BroadcastSync) + rsp, err := syncCtx.BroadcastTx(txBytes) + if rsp != nil && rsp.Code != 0 { + err = sdkerrors.ABCIError(rsp.Codespace, rsp.Code, rsp.RawLog) + } + if err != nil { + api.logger.Debug("failed to broadcast tx", "error", err.Error()) + return false + } + + api.logger.Debug("broadcasted tx to set miner withdraw address (etherbase)", "hash", tmHash.String()) + return true +} + +// SetGasPrice sets the minimum accepted gas price for the miner. +// NOTE: this function accepts only integers to have the same interface than go-eth +// to use float values, the gas prices must be configured using the configuration file +func (api *API) SetGasPrice(gasPrice hexutil.Big) bool { + api.logger.Info(api.ctx.Viper.ConfigFileUsed()) + appConf := config.GetConfig(api.ctx.Viper) + + var unit string + minGasPrices := appConf.GetMinGasPrices() + + // fetch the base denom from the sdk Config in case it's not currently defined on the node config + if len(minGasPrices) == 0 || minGasPrices.Empty() { + var err error + unit, err = sdk.GetBaseDenom() + if err != nil { + api.logger.Debug("could not get the denom of smallest unit registered", "error", err.Error()) + return false + } + } else { + unit = minGasPrices[0].Denom + } + + c := sdk.NewDecCoin(unit, sdk.NewIntFromBigInt(gasPrice.ToInt())) + + appConf.SetMinGasPrices(sdk.DecCoins{c}) + sdkconfig.WriteConfigFile(api.ctx.Viper.ConfigFileUsed(), appConf) + api.logger.Info("Your configuration file was modified. Please RESTART your node.", "gas-price", c.String()) + return true +} diff --git a/rpc/ethereum/namespaces/miner/unsupported.go b/rpc/ethereum/namespaces/miner/unsupported.go new file mode 100644 index 00000000..81c08f4e --- /dev/null +++ b/rpc/ethereum/namespaces/miner/unsupported.go @@ -0,0 +1,51 @@ +package miner + +import ( + "errors" + + "github.com/ethereum/go-ethereum/common/hexutil" +) + +// GetHashrate returns the current hashrate for local CPU miner and remote miner. +// Unsupported in Stratos +func (api *API) GetHashrate() uint64 { + api.logger.Debug("miner_getHashrate") + api.logger.Debug("Unsupported rpc function: miner_getHashrate") + return 0 +} + +// SetExtra sets the extra data string that is included when this miner mines a block. +// Unsupported in Stratos +func (api *API) SetExtra(extra string) (bool, error) { + api.logger.Debug("miner_setExtra") + api.logger.Debug("Unsupported rpc function: miner_setExtra") + return false, errors.New("unsupported rpc function: miner_setExtra") +} + +// SetGasLimit sets the gaslimit to target towards during mining. +// Unsupported in stratos +func (api *API) SetGasLimit(gasLimit hexutil.Uint64) bool { + api.logger.Debug("miner_setGasLimit") + api.logger.Debug("Unsupported rpc function: miner_setGasLimit") + return false +} + +// Start starts the miner with the given number of threads. If threads is nil, +// the number of workers started is equal to the number of logical CPUs that are +// usable by this process. If mining is already running, this method adjust the +// number of threads allowed to use and updates the minimum price required by the +// transaction pool. +// Unsupported in stratos +func (api *API) Start(threads *int) error { + api.logger.Debug("miner_start") + api.logger.Debug("Unsupported rpc function: miner_start") + return errors.New("unsupported rpc function: miner_start") +} + +// Stop terminates the miner, both at the consensus engine level as well as at +// the block creation level. +// Unsupported in stratos +func (api *API) Stop() { + api.logger.Debug("miner_stop") + api.logger.Debug("Unsupported rpc function: miner_stop") +} diff --git a/rpc/ethereum/namespaces/net/api.go b/rpc/ethereum/namespaces/net/api.go new file mode 100644 index 00000000..ac8b6e78 --- /dev/null +++ b/rpc/ethereum/namespaces/net/api.go @@ -0,0 +1,57 @@ +package net + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + + rpcclient "github.com/tendermint/tendermint/rpc/client" + + stratos "github.com/stratosnet/stratos-chain/types" +) + +// PublicAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec. +type PublicAPI struct { + networkVersion uint64 + tmClient rpcclient.Client +} + +// NewPublicAPI creates an instance of the public Net Web3 API. +func NewPublicAPI(clientCtx client.Context) *PublicAPI { + // parse the chainID from a integer string + chainIDEpoch, err := stratos.ParseChainID(clientCtx.ChainID) + if err != nil { + panic(err) + } + + return &PublicAPI{ + networkVersion: chainIDEpoch.Uint64(), + tmClient: clientCtx.Client, + } +} + +// Version returns the current ethereum protocol version. +func (s *PublicAPI) Version() string { + return fmt.Sprintf("%d", s.networkVersion) +} + +// Listening returns if client is actively listening for network connections. +func (s *PublicAPI) Listening() bool { + ctx := context.Background() + netInfo, err := s.tmClient.NetInfo(ctx) + if err != nil { + return false + } + return netInfo.Listening +} + +// PeerCount returns the number of peers currently connected to the client. +func (s *PublicAPI) PeerCount() int { + ctx := context.Background() + netInfo, err := s.tmClient.NetInfo(ctx) + if err != nil { + return 0 + } + return len(netInfo.Peers) +} diff --git a/rpc/ethereum/namespaces/personal/api.go b/rpc/ethereum/namespaces/personal/api.go new file mode 100644 index 00000000..18227479 --- /dev/null +++ b/rpc/ethereum/namespaces/personal/api.go @@ -0,0 +1,253 @@ +package personal + +import ( + "context" + "fmt" + "os" + "time" + + "github.com/tendermint/tendermint/libs/log" + + "github.com/cosmos/cosmos-sdk/client" + sdkcrypto "github.com/cosmos/cosmos-sdk/crypto" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" + "github.com/stratosnet/stratos-chain/crypto/hd" + "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" + stratos "github.com/stratosnet/stratos-chain/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// PrivateAccountAPI is the personal_ prefixed set of APIs in the Web3 JSON-RPC spec. +type PrivateAccountAPI struct { + clientCtx client.Context + backend backend.Backend + logger log.Logger + hdPathIter stratos.HDPathIterator +} + +// NewAPI creates an instance of the public Personal Eth API. +func NewAPI(logger log.Logger, clientCtx client.Context, backend backend.Backend) *PrivateAccountAPI { + cfg := sdk.GetConfig() + basePath := cfg.GetFullBIP44Path() + + iterator, err := stratos.NewHDPathIterator(basePath, true) + if err != nil { + panic(err) + } + + return &PrivateAccountAPI{ + clientCtx: clientCtx, + logger: logger.With("api", "personal"), + hdPathIter: iterator, + backend: backend, + } +} + +// ImportRawKey armors and encrypts a given raw hex encoded ECDSA key and stores it into the key directory. +// The name of the key will have the format "personal_", where is the total number of +// keys stored on the keyring. +// +// NOTE: The key will be both armored and encrypted using the same passphrase. +func (api *PrivateAccountAPI) ImportRawKey(privkey, password string) (common.Address, error) { + api.logger.Debug("personal_importRawKey") + priv, err := crypto.HexToECDSA(privkey) + if err != nil { + return common.Address{}, err + } + + privKey := ðsecp256k1.PrivKey{Key: crypto.FromECDSA(priv)} + + addr := sdk.AccAddress(privKey.PubKey().Address().Bytes()) + ethereumAddr := common.BytesToAddress(addr) + + // return if the key has already been imported + if _, err := api.clientCtx.Keyring.KeyByAddress(addr); err == nil { + return ethereumAddr, nil + } + + // ignore error as we only care about the length of the list + list, _ := api.clientCtx.Keyring.List() + privKeyName := fmt.Sprintf("personal_%d", len(list)) + + armor := sdkcrypto.EncryptArmorPrivKey(privKey, password, ethsecp256k1.KeyType) + + if err := api.clientCtx.Keyring.ImportPrivKey(privKeyName, armor, password); err != nil { + return common.Address{}, err + } + + api.logger.Info("key successfully imported", "name", privKeyName, "address", ethereumAddr.String()) + + return ethereumAddr, nil +} + +// ListAccounts will return a list of addresses for accounts this node manages. +func (api *PrivateAccountAPI) ListAccounts() ([]common.Address, error) { + api.logger.Debug("personal_listAccounts") + addrs := []common.Address{} + + list, err := api.clientCtx.Keyring.List() + if err != nil { + return nil, err + } + + for _, info := range list { + addrs = append(addrs, common.BytesToAddress(info.GetPubKey().Address())) + } + + return addrs, nil +} + +// LockAccount will lock the account associated with the given address when it's unlocked. +// It removes the key corresponding to the given address from the API's local keys. +func (api *PrivateAccountAPI) LockAccount(address common.Address) bool { + api.logger.Debug("personal_lockAccount", "address", address.String()) + api.logger.Info("personal_lockAccount not supported") + // TODO: Not supported. See underlying issue https://github.com/99designs/keyring/issues/85 + return false +} + +// NewAccount will create a new account and returns the address for the new account. +func (api *PrivateAccountAPI) NewAccount(password string) (common.Address, error) { + api.logger.Debug("personal_newAccount") + + name := "key_" + time.Now().UTC().Format(time.RFC3339) + + // create the mnemonic and save the account + hdPath := api.hdPathIter() + + info, _, err := api.clientCtx.Keyring.NewMnemonic(name, keyring.English, hdPath.String(), password, hd.EthSecp256k1) + if err != nil { + return common.Address{}, err + } + + addr := common.BytesToAddress(info.GetPubKey().Address().Bytes()) + api.logger.Info("Your new key was generated", "address", addr.String()) + api.logger.Info("Please backup your key file!", "path", os.Getenv("HOME")+"/.stratos/"+name) // TODO: pass the correct binary + api.logger.Info("Please remember your password!") + return addr, nil +} + +// UnlockAccount will unlock the account associated with the given address with +// the given password for duration seconds. If duration is nil it will use a +// default of 300 seconds. It returns an indication if the account was unlocked. +func (api *PrivateAccountAPI) UnlockAccount(_ context.Context, addr common.Address, _ string, _ *uint64) (bool, error) { + api.logger.Debug("personal_unlockAccount", "address", addr.String()) + // TODO: Not supported. See underlying issue https://github.com/99designs/keyring/issues/85 + return false, nil +} + +// SendTransaction will create a transaction from the given arguments and +// tries to sign it with the key associated with args.To. If the given password isn't +// able to decrypt the key it fails. +func (api *PrivateAccountAPI) SendTransaction(_ context.Context, args evmtypes.TransactionArgs, _ string) (common.Hash, error) { + api.logger.Debug("personal_sendTransaction", "address", args.To.String()) + + if args.From == nil { + return common.Hash{}, fmt.Errorf("from address cannot be nil in send transaction") + } + + addr := sdk.AccAddress(args.From.Bytes()) + + // check if the key is on the keyring + _, err := api.clientCtx.Keyring.KeyByAddress(addr) + if err != nil { + return common.Hash{}, err + } + + return api.backend.SendTransaction(args) +} + +// Sign calculates an Ethereum ECDSA signature for: +// keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)) +// +// Note, the produced signature conforms to the secp256k1 curve R, S and V values, +// where the V value will be 27 or 28 for legacy reasons. +// +// The key used to calculate the signature is decrypted with the given password. +// +// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign +func (api *PrivateAccountAPI) Sign(_ context.Context, data hexutil.Bytes, addr common.Address, _ string) (hexutil.Bytes, error) { + api.logger.Debug("personal_sign", "data", data, "address", addr.String()) + + cosmosAddr := sdk.AccAddress(addr.Bytes()) + + sig, _, err := api.clientCtx.Keyring.SignByAddress(cosmosAddr, accounts.TextHash(data)) + if err != nil { + api.logger.Error("failed to sign with key", "data", data, "address", addr.String(), "error", err.Error()) + return nil, err + } + + sig[crypto.RecoveryIDOffset] += 27 // transform V from 0/1 to 27/28 + return sig, nil +} + +// EcRecover returns the address for the account that was used to create the signature. +// Note, this function is compatible with eth_sign and personal_sign. As such it recovers +// the address of: +// hash = keccak256("\x19Ethereum Signed Message:\n"${message length}${message}) +// addr = ecrecover(hash, signature) +// +// Note, the signature must conform to the secp256k1 curve R, S and V values, where +// the V value must be 27 or 28 for legacy reasons. +// +// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecove +func (api *PrivateAccountAPI) EcRecover(_ context.Context, data, sig hexutil.Bytes) (common.Address, error) { + api.logger.Debug("personal_ecRecover", "data", data, "sig", sig) + + if len(sig) != crypto.SignatureLength { + return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength) + } + + if sig[crypto.RecoveryIDOffset] != 27 && sig[crypto.RecoveryIDOffset] != 28 { + return common.Address{}, fmt.Errorf("invalid Ethereum signature (V is not 27 or 28)") + } + + sig[crypto.RecoveryIDOffset] -= 27 // Transform yellow paper V from 27/28 to 0/1 + + pubkey, err := crypto.SigToPub(accounts.TextHash(data), sig) + if err != nil { + return common.Address{}, err + } + + return crypto.PubkeyToAddress(*pubkey), nil +} + +// Unpair deletes a pairing between wallet and stratos. +func (api *PrivateAccountAPI) Unpair(_ context.Context, url, pin string) error { + api.logger.Debug("personal_unpair", "url", url, "pin", pin) + api.logger.Info("personal_unpair for smartcard wallet not supported") + // TODO: Smartcard wallet not supported yet, refer to: https://github.com/ethereum/go-ethereum/blob/master/accounts/scwallet/README.md + return fmt.Errorf("smartcard wallet not supported yet") +} + +// InitializeWallet initializes a new wallet at the provided URL, by generating and returning a new private key. +func (api *PrivateAccountAPI) InitializeWallet(_ context.Context, url string) (string, error) { + api.logger.Debug("personal_initializeWallet", "url", url) + api.logger.Info("personal_initializeWallet for smartcard wallet not supported") + // TODO: Smartcard wallet not supported yet, refer to: https://github.com/ethereum/go-ethereum/blob/master/accounts/scwallet/README.md + return "", fmt.Errorf("smartcard wallet not supported yet") +} + +// RawWallet is a JSON representation of an accounts.Wallet interface, with its +// data contents extracted into plain fields. +type RawWallet struct { + URL string `json:"url"` + Status string `json:"status"` + Failure string `json:"failure,omitempty"` + Accounts []accounts.Account `json:"accounts,omitempty"` +} + +// ListWallets will return a list of wallets this node manages. +func (api *PrivateAccountAPI) ListWallets() []RawWallet { + api.logger.Debug("personal_ListWallets") + api.logger.Info("currently wallet level that manages accounts is not supported") + return ([]RawWallet)(nil) +} diff --git a/rpc/ethereum/namespaces/txpool/api.go b/rpc/ethereum/namespaces/txpool/api.go new file mode 100644 index 00000000..223c2b05 --- /dev/null +++ b/rpc/ethereum/namespaces/txpool/api.go @@ -0,0 +1,51 @@ +package txpool + +import ( + "github.com/tendermint/tendermint/libs/log" + + "github.com/ethereum/go-ethereum/common/hexutil" + + "github.com/stratosnet/stratos-chain/rpc/ethereum/types" +) + +// PublicAPI offers and API for the transaction pool. It only operates on data that is non-confidential. +// NOTE: For more info about the current status of this endpoints see https://github.com/tharsis/ethermint/issues/124 +type PublicAPI struct { + logger log.Logger +} + +// NewPublicAPI creates a new tx pool service that gives information about the transaction pool. +func NewPublicAPI(logger log.Logger) *PublicAPI { + return &PublicAPI{ + logger: logger.With("module", "txpool"), + } +} + +// Content returns the transactions contained within the transaction pool +func (api *PublicAPI) Content() (map[string]map[string]map[string]*types.RPCTransaction, error) { + api.logger.Debug("txpool_content") + content := map[string]map[string]map[string]*types.RPCTransaction{ + "pending": make(map[string]map[string]*types.RPCTransaction), + "queued": make(map[string]map[string]*types.RPCTransaction), + } + return content, nil +} + +// Inspect returns the content of the transaction pool and flattens it into an +func (api *PublicAPI) Inspect() (map[string]map[string]map[string]string, error) { + api.logger.Debug("txpool_inspect") + content := map[string]map[string]map[string]string{ + "pending": make(map[string]map[string]string), + "queued": make(map[string]map[string]string), + } + return content, nil +} + +// Status returns the number of pending and queued transaction in the pool. +func (api *PublicAPI) Status() map[string]hexutil.Uint { + api.logger.Debug("txpool_status") + return map[string]hexutil.Uint{ + "pending": hexutil.Uint(0), + "queued": hexutil.Uint(0), + } +} diff --git a/rpc/ethereum/namespaces/web3/api.go b/rpc/ethereum/namespaces/web3/api.go new file mode 100644 index 00000000..b64cad7e --- /dev/null +++ b/rpc/ethereum/namespaces/web3/api.go @@ -0,0 +1,26 @@ +package web3 + +import ( + "github.com/cosmos/cosmos-sdk/version" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/crypto" +) + +// PublicAPI is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec. +type PublicAPI struct{} + +// NewPublicAPI creates an instance of the Web3 API. +func NewPublicAPI() *PublicAPI { + return &PublicAPI{} +} + +// ClientVersion returns the client version in the Web3 user agent format. +func (a *PublicAPI) ClientVersion() string { + return version.Version +} + +// Sha3 returns the keccak-256 hash of the passed-in input. +func (a *PublicAPI) Sha3(input hexutil.Bytes) hexutil.Bytes { + return crypto.Keccak256(input) +} diff --git a/rpc/ethereum/pubsub/pubsub.go b/rpc/ethereum/pubsub/pubsub.go new file mode 100644 index 00000000..4ac7f34c --- /dev/null +++ b/rpc/ethereum/pubsub/pubsub.go @@ -0,0 +1,143 @@ +package pubsub + +import ( + "sync" + "sync/atomic" + + "github.com/pkg/errors" + + coretypes "github.com/tendermint/tendermint/rpc/core/types" +) + +type UnsubscribeFunc func() + +type EventBus interface { + AddTopic(name string, src <-chan coretypes.ResultEvent) error + RemoveTopic(name string) + Subscribe(name string) (<-chan coretypes.ResultEvent, UnsubscribeFunc, error) + Topics() []string +} + +type memEventBus struct { + topics map[string]<-chan coretypes.ResultEvent + topicsMux *sync.RWMutex + subscribers map[string]map[uint64]chan<- coretypes.ResultEvent + subscribersMux *sync.RWMutex + currentUniqueID uint64 +} + +func NewEventBus() EventBus { + return &memEventBus{ + topics: make(map[string]<-chan coretypes.ResultEvent), + topicsMux: new(sync.RWMutex), + subscribers: make(map[string]map[uint64]chan<- coretypes.ResultEvent), + subscribersMux: new(sync.RWMutex), + } +} + +func (m *memEventBus) GenUniqueID() uint64 { + return atomic.AddUint64(&m.currentUniqueID, 1) +} + +func (m *memEventBus) Topics() (topics []string) { + m.topicsMux.RLock() + defer m.topicsMux.RUnlock() + + topics = make([]string, 0, len(m.topics)) + for topicName := range m.topics { + topics = append(topics, topicName) + } + + return topics +} + +func (m *memEventBus) AddTopic(name string, src <-chan coretypes.ResultEvent) error { + m.topicsMux.RLock() + _, ok := m.topics[name] + m.topicsMux.RUnlock() + + if ok { + return errors.New("topic already registered") + } + + m.topicsMux.Lock() + m.topics[name] = src + m.topicsMux.Unlock() + + go m.publishTopic(name, src) + + return nil +} + +func (m *memEventBus) RemoveTopic(name string) { + m.topicsMux.Lock() + delete(m.topics, name) + m.topicsMux.Unlock() +} + +func (m *memEventBus) Subscribe(name string) (<-chan coretypes.ResultEvent, UnsubscribeFunc, error) { + m.topicsMux.RLock() + _, ok := m.topics[name] + m.topicsMux.RUnlock() + + if !ok { + return nil, nil, errors.Errorf("topic not found: %s", name) + } + + ch := make(chan coretypes.ResultEvent) + m.subscribersMux.Lock() + defer m.subscribersMux.Unlock() + + id := m.GenUniqueID() + if _, ok := m.subscribers[name]; !ok { + m.subscribers[name] = make(map[uint64]chan<- coretypes.ResultEvent) + } + m.subscribers[name][id] = ch + + unsubscribe := func() { + m.subscribersMux.Lock() + defer m.subscribersMux.Unlock() + delete(m.subscribers[name], id) + } + + return ch, unsubscribe, nil +} + +func (m *memEventBus) publishTopic(name string, src <-chan coretypes.ResultEvent) { + for { + msg, ok := <-src + if !ok { + m.closeAllSubscribers(name) + m.topicsMux.Lock() + delete(m.topics, name) + m.topicsMux.Unlock() + return + } + m.publishAllSubscribers(name, msg) + } +} + +func (m *memEventBus) closeAllSubscribers(name string) { + m.subscribersMux.Lock() + defer m.subscribersMux.Unlock() + + subsribers := m.subscribers[name] + delete(m.subscribers, name) + + for _, sub := range subsribers { + close(sub) + } +} + +func (m *memEventBus) publishAllSubscribers(name string, msg coretypes.ResultEvent) { + m.subscribersMux.RLock() + subsribers := m.subscribers[name] + m.subscribersMux.RUnlock() + + for _, sub := range subsribers { + select { + case sub <- msg: + default: + } + } +} diff --git a/rpc/ethereum/types/addrlock.go b/rpc/ethereum/types/addrlock.go new file mode 100644 index 00000000..e512c03c --- /dev/null +++ b/rpc/ethereum/types/addrlock.go @@ -0,0 +1,38 @@ +package types + +import ( + "sync" + + "github.com/ethereum/go-ethereum/common" +) + +// AddrLocker is a mutex structure used to avoid querying outdated account data +type AddrLocker struct { + mu sync.Mutex + locks map[common.Address]*sync.Mutex +} + +// lock returns the lock of the given address. +func (l *AddrLocker) lock(address common.Address) *sync.Mutex { + l.mu.Lock() + defer l.mu.Unlock() + if l.locks == nil { + l.locks = make(map[common.Address]*sync.Mutex) + } + if _, ok := l.locks[address]; !ok { + l.locks[address] = new(sync.Mutex) + } + return l.locks[address] +} + +// LockAddr locks an account's mutex. This is used to prevent another tx getting the +// same nonce until the lock is released. The mutex prevents the (an identical nonce) from +// being read again during the time that the first transaction is being signed. +func (l *AddrLocker) LockAddr(address common.Address) { + l.lock(address).Lock() +} + +// UnlockAddr unlocks the mutex of the given account. +func (l *AddrLocker) UnlockAddr(address common.Address) { + l.lock(address).Unlock() +} diff --git a/rpc/ethereum/types/block.go b/rpc/ethereum/types/block.go new file mode 100644 index 00000000..0b3c6975 --- /dev/null +++ b/rpc/ethereum/types/block.go @@ -0,0 +1,193 @@ +package types + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "math" + "math/big" + "strings" + + "github.com/spf13/cast" + "google.golang.org/grpc/metadata" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + + stratos "github.com/stratosnet/stratos-chain/types" +) + +// BlockNumber represents decoding hex string to block values +type BlockNumber int64 + +const ( + EthPendingBlockNumber = BlockNumber(-2) + EthLatestBlockNumber = BlockNumber(-1) + EthEarliestBlockNumber = BlockNumber(0) +) + +const ( + BlockParamEarliest = "earliest" + BlockParamLatest = "latest" + BlockParamPending = "pending" +) + +// NewBlockNumber creates a new BlockNumber instance. +func NewBlockNumber(n *big.Int) BlockNumber { + if !n.IsInt64() { + // default to latest block if it overflows + return EthLatestBlockNumber + } + + return BlockNumber(n.Int64()) +} + +// ContextWithHeight wraps a context with the a gRPC block height header. If the provided height is +// 0, it will return an empty context and the gRPC query will use the latest block height for querying. +// Note that all metadata are processed and removed by tendermint layer, so it wont be accessible at gRPC server level. +func ContextWithHeight(height int64) context.Context { + if height == 0 { + return context.Background() + } + + return metadata.AppendToOutgoingContext(context.Background(), grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height)) +} + +// UnmarshalJSON parses the given JSON fragment into a BlockNumber. It supports: +// - "latest", "earliest" or "pending" as string arguments +// - the block number +// Returned errors: +// - an invalid block number error when the given argument isn't a known strings +// - an out of range error when the given block number is either too little or too large +func (bn *BlockNumber) UnmarshalJSON(data []byte) error { + input := strings.TrimSpace(string(data)) + if len(input) >= 2 && input[0] == '"' && input[len(input)-1] == '"' { + input = input[1 : len(input)-1] + } + + switch input { + case BlockParamEarliest: + *bn = EthEarliestBlockNumber + return nil + case BlockParamLatest: + *bn = EthLatestBlockNumber + return nil + case BlockParamPending: + *bn = EthPendingBlockNumber + return nil + } + + blckNum, err := hexutil.DecodeUint64(input) + if errors.Is(err, hexutil.ErrMissingPrefix) { + blckNum = cast.ToUint64(input) + } else if err != nil { + return err + } + + if blckNum > math.MaxInt64 { + return fmt.Errorf("block number larger than int64") + } + *bn = BlockNumber(blckNum) + + return nil +} + +// Int64 converts block number to primitive type +func (bn BlockNumber) Int64() int64 { + if bn < 0 { + return 0 + } else if bn == 0 { + return 1 + } + + return int64(bn) +} + +// TmHeight is a util function used for the Tendermint RPC client. It returns +// nil if the block number is "latest". Otherwise, it returns the pointer of the +// int64 value of the height. +func (bn BlockNumber) TmHeight() *int64 { + if bn < 0 { + return nil + } + + height := bn.Int64() + return &height +} + +// BlockNumberOrHash represents a block number or a block hash. +type BlockNumberOrHash struct { + BlockNumber *BlockNumber `json:"blockNumber,omitempty"` + BlockHash *common.Hash `json:"blockHash,omitempty"` +} + +func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error { + type erased BlockNumberOrHash + e := erased{} + err := json.Unmarshal(data, &e) + if err == nil { + return bnh.checkUnmarshal(BlockNumberOrHash(e)) + } + var input string + err = json.Unmarshal(data, &input) + if err != nil { + return err + } + err = bnh.decodeFromString(input) + if err != nil { + return err + } + + return nil +} + +func (bnh *BlockNumberOrHash) checkUnmarshal(e BlockNumberOrHash) error { + if e.BlockNumber != nil && e.BlockHash != nil { + return fmt.Errorf("cannot specify both BlockHash and BlockNumber, choose one or the other") + } + bnh.BlockNumber = e.BlockNumber + bnh.BlockHash = e.BlockHash + return nil +} + +func (bnh *BlockNumberOrHash) decodeFromString(input string) error { + switch input { + case BlockParamEarliest: + bn := EthEarliestBlockNumber + bnh.BlockNumber = &bn + case BlockParamLatest: + bn := EthLatestBlockNumber + bnh.BlockNumber = &bn + case BlockParamPending: + bn := EthPendingBlockNumber + bnh.BlockNumber = &bn + default: + // check if the input is a block hash + if len(input) == 66 { + hash := common.Hash{} + err := hash.UnmarshalText([]byte(input)) + if err != nil { + return err + } + bnh.BlockHash = &hash + break + } + // otherwise take the hex string has int64 value + blockNumber, err := hexutil.DecodeUint64(input) + if err != nil { + return err + } + + bnInt, err := stratos.SafeInt64(blockNumber) + if err != nil { + return err + } + + bn := BlockNumber(bnInt) + bnh.BlockNumber = &bn + } + return nil +} diff --git a/rpc/ethereum/types/query_client.go b/rpc/ethereum/types/query_client.go new file mode 100644 index 00000000..4edd0e43 --- /dev/null +++ b/rpc/ethereum/types/query_client.go @@ -0,0 +1,66 @@ +package types + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/types/tx" + + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/proto/tendermint/crypto" + + "github.com/cosmos/cosmos-sdk/client" + + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" + //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" +) + +// QueryClient defines a gRPC Client used for: +// - Transaction simulation +// - EVM module queries +// - Fee market module queries +type QueryClient struct { + tx.ServiceClient + evmtypes.QueryClient + //FeeMarket feemarkettypes.QueryClient +} + +// NewQueryClient creates a new gRPC query client +func NewQueryClient(clientCtx client.Context) *QueryClient { + return &QueryClient{ + ServiceClient: tx.NewServiceClient(clientCtx), + QueryClient: evmtypes.NewQueryClient(clientCtx), + //FeeMarket: feemarkettypes.NewQueryClient(clientCtx), + } +} + +// GetProof performs an ABCI query with the given key and returns a merkle proof. The desired +// tendermint height to perform the query should be set in the client context. The query will be +// performed at one below this height (at the IAVL version) in order to obtain the correct merkle +// proof. Proof queries at height less than or equal to 2 are not supported. +// Issue: https://github.com/cosmos/cosmos-sdk/issues/6567 +func (QueryClient) GetProof(clientCtx client.Context, storeKey string, key []byte) ([]byte, *crypto.ProofOps, error) { + height := clientCtx.Height + // ABCI queries at height less than or equal to 2 are not supported. + // Base app does not support queries for height less than or equal to 1. + // Therefore, a query at height 2 would be equivalent to a query at height 3 + if height <= 2 { + return nil, nil, fmt.Errorf("proof queries at height <= 2 are not supported") + } + + // Use the IAVL height if a valid tendermint height is passed in. + height-- + + abciReq := abci.RequestQuery{ + Path: fmt.Sprintf("store/%s/key", storeKey), + Data: key, + Height: height, + Prove: true, + } + + abciRes, err := clientCtx.QueryABCI(abciReq) + if err != nil { + return nil, nil, err + } + + return abciRes.Value, abciRes.ProofOps, nil +} diff --git a/rpc/ethereum/types/types.go b/rpc/ethereum/types/types.go new file mode 100644 index 00000000..9459cf8e --- /dev/null +++ b/rpc/ethereum/types/types.go @@ -0,0 +1,89 @@ +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// Copied the Account and StorageResult types since they are registered under an +// internal pkg on geth. + +// AccountResult struct for account proof +type AccountResult struct { + Address common.Address `json:"address"` + AccountProof []string `json:"accountProof"` + Balance *hexutil.Big `json:"balance"` + CodeHash common.Hash `json:"codeHash"` + Nonce hexutil.Uint64 `json:"nonce"` + StorageHash common.Hash `json:"storageHash"` + StorageProof []StorageResult `json:"storageProof"` +} + +// StorageResult defines the format for storage proof return +type StorageResult struct { + Key string `json:"key"` + Value *hexutil.Big `json:"value"` + Proof []string `json:"proof"` +} + +// RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction +type RPCTransaction struct { + BlockHash *common.Hash `json:"blockHash"` + BlockNumber *hexutil.Big `json:"blockNumber"` + From common.Address `json:"from"` + Gas hexutil.Uint64 `json:"gas"` + GasPrice *hexutil.Big `json:"gasPrice"` + GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"` + GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"` + Hash common.Hash `json:"hash"` + Input hexutil.Bytes `json:"input"` + Nonce hexutil.Uint64 `json:"nonce"` + To *common.Address `json:"to"` + TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` + Value *hexutil.Big `json:"value"` + Type hexutil.Uint64 `json:"type"` + Accesses *ethtypes.AccessList `json:"accessList,omitempty"` + ChainID *hexutil.Big `json:"chainId,omitempty"` + V *hexutil.Big `json:"v"` + R *hexutil.Big `json:"r"` + S *hexutil.Big `json:"s"` +} + +// StateOverride is the collection of overridden accounts. +type StateOverride map[common.Address]OverrideAccount + +// OverrideAccount indicates the overriding fields of account during the execution of +// a message call. +// Note, state and stateDiff can't be specified at the same time. If state is +// set, message execution will only use the data in the given state. Otherwise +// if statDiff is set, all diff will be applied first and then execute the call +// message. +type OverrideAccount struct { + Nonce *hexutil.Uint64 `json:"nonce"` + Code *hexutil.Bytes `json:"code"` + Balance **hexutil.Big `json:"balance"` + State *map[common.Hash]common.Hash `json:"state"` + StateDiff *map[common.Hash]common.Hash `json:"stateDiff"` +} + +type FeeHistoryResult struct { + OldestBlock *hexutil.Big `json:"oldestBlock"` + Reward [][]*hexutil.Big `json:"reward,omitempty"` + BaseFee []*hexutil.Big `json:"baseFeePerGas,omitempty"` + GasUsedRatio []float64 `json:"gasUsedRatio"` +} + +// SignTransactionResult represents a RLP encoded signed transaction. +type SignTransactionResult struct { + Raw hexutil.Bytes `json:"raw"` + Tx *ethtypes.Transaction `json:"tx"` +} + +type OneFeeHistory struct { + BaseFee *big.Int // base fee for each block + Reward []*big.Int // each element of the array will have the tip provided to miners for the percentile given + GasUsedRatio float64 // the ratio of gas used to the gas limit for each block +} diff --git a/rpc/ethereum/types/utils.go b/rpc/ethereum/types/utils.go new file mode 100644 index 00000000..29bb9280 --- /dev/null +++ b/rpc/ethereum/types/utils.go @@ -0,0 +1,359 @@ +package types + +import ( + "bytes" + "context" + "encoding/hex" + "fmt" + "math/big" + "strconv" + + abci "github.com/tendermint/tendermint/abci/types" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/client" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" + //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common/math" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// RawTxToEthTx returns a evm MsgEthereum transaction from raw tx bytes. +func RawTxToEthTx(clientCtx client.Context, txBz tmtypes.Tx) ([]*evmtypes.MsgEthereumTx, error) { + tx, err := clientCtx.TxConfig.TxDecoder()(txBz) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + } + + ethTxs := make([]*evmtypes.MsgEthereumTx, len(tx.GetMsgs())) + for i, msg := range tx.GetMsgs() { + ethTx, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return nil, fmt.Errorf("invalid message type %T, expected %T", msg, &evmtypes.MsgEthereumTx{}) + } + ethTxs[i] = ethTx + } + return ethTxs, nil +} + +// EthHeaderFromTendermint is an util function that returns an Ethereum Header +// from a tendermint Header. +func EthHeaderFromTendermint(header tmtypes.Header, bloom ethtypes.Bloom, baseFee *big.Int) *ethtypes.Header { + txHash := ethtypes.EmptyRootHash + if len(header.DataHash) == 0 { + txHash = common.BytesToHash(header.DataHash) + } + + return ðtypes.Header{ + ParentHash: common.BytesToHash(header.LastBlockID.Hash.Bytes()), + UncleHash: ethtypes.EmptyUncleHash, + Coinbase: common.BytesToAddress(header.ProposerAddress), + Root: common.BytesToHash(header.AppHash), + TxHash: txHash, + ReceiptHash: ethtypes.EmptyRootHash, + Bloom: bloom, + Difficulty: big.NewInt(0), + Number: big.NewInt(header.Height), + GasLimit: 0, + GasUsed: 0, + Time: uint64(header.Time.UTC().Unix()), + Extra: []byte{}, + MixDigest: common.Hash{}, + Nonce: ethtypes.BlockNonce{}, + BaseFee: baseFee, + } +} + +// BlockMaxGasFromConsensusParams returns the gas limit for the current block from the chain consensus params. +func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (int64, error) { + resConsParams, err := clientCtx.Client.ConsensusParams(goCtx, &blockHeight) + if err != nil { + return int64(^uint32(0)), err + } + + gasLimit := resConsParams.ConsensusParams.Block.MaxGas + if gasLimit == -1 { + // Sets gas limit to max uint32 to not error with javascript dev tooling + // This -1 value indicating no block gas limit is set to max uint64 with geth hexutils + // which errors certain javascript dev tooling which only supports up to 53 bits + gasLimit = int64(^uint32(0)) + } + + return gasLimit, nil +} + +// FormatBlock creates an ethereum block from a tendermint header and ethereum-formatted +// transactions. +func FormatBlock( + header tmtypes.Header, size int, gasLimit int64, + gasUsed *big.Int, transactions []interface{}, bloom ethtypes.Bloom, + validatorAddr common.Address, baseFee *big.Int, +) map[string]interface{} { + var transactionsRoot common.Hash + if len(transactions) == 0 { + transactionsRoot = ethtypes.EmptyRootHash + } else { + transactionsRoot = common.BytesToHash(header.DataHash) + } + + result := map[string]interface{}{ + "number": hexutil.Uint64(header.Height), + "hash": hexutil.Bytes(header.Hash()), + "parentHash": common.BytesToHash(header.LastBlockID.Hash.Bytes()), + "nonce": ethtypes.BlockNonce{}, // PoW specific + "sha3Uncles": ethtypes.EmptyUncleHash, // No uncles in Tendermint + "logsBloom": bloom, + "stateRoot": hexutil.Bytes(header.AppHash), + "miner": validatorAddr, + "mixHash": common.Hash{}, + "difficulty": (*hexutil.Big)(big.NewInt(0)), + "extraData": "0x", + "size": hexutil.Uint64(size), + "gasLimit": hexutil.Uint64(gasLimit), // Static gas limit + "gasUsed": (*hexutil.Big)(gasUsed), + "timestamp": hexutil.Uint64(header.Time.Unix()), + "transactionsRoot": transactionsRoot, + "receiptsRoot": ethtypes.EmptyRootHash, + + "uncles": []common.Hash{}, + "transactions": transactions, + "totalDifficulty": (*hexutil.Big)(big.NewInt(0)), + } + + if baseFee != nil { + result["baseFeePerGas"] = (*hexutil.Big)(baseFee) + } + + return result +} + +type DataError interface { + Error() string // returns the message + ErrorData() interface{} // returns the error data +} + +type dataError struct { + msg string + data string +} + +func (d *dataError) Error() string { + return d.msg +} + +func (d *dataError) ErrorData() interface{} { + return d.data +} + +type SDKTxLogs struct { + Log string `json:"log"` +} + +const LogRevertedFlag = "transaction reverted" + +func ErrRevertedWith(data []byte) DataError { + return &dataError{ + msg: "VM execution error.", + data: fmt.Sprintf("0x%s", hex.EncodeToString(data)), + } +} + +// NewTransactionFromMsg returns a transaction that will serialize to the RPC +// representation, with the given location metadata set (if available). +func NewTransactionFromMsg( + msg *evmtypes.MsgEthereumTx, + blockHash common.Hash, + blockNumber, index uint64, + baseFee *big.Int, +) (*RPCTransaction, error) { + tx := msg.AsTransaction() + return NewRPCTransaction(tx, blockHash, blockNumber, index, baseFee) +} + +// NewTransactionFromData returns a transaction that will serialize to the RPC +// representation, with the given location metadata set (if available). +func NewRPCTransaction( + tx *ethtypes.Transaction, blockHash common.Hash, blockNumber, index uint64, baseFee *big.Int, +) (*RPCTransaction, error) { + // Determine the signer. For replay-protected transactions, use the most permissive + // signer, because we assume that signers are backwards-compatible with old + // transactions. For non-protected transactions, the homestead signer signer is used + // because the return value of ChainId is zero for those transactions. + var signer ethtypes.Signer + if tx.Protected() { + signer = ethtypes.LatestSignerForChainID(tx.ChainId()) + } else { + signer = ethtypes.HomesteadSigner{} + } + from, _ := ethtypes.Sender(signer, tx) + v, r, s := tx.RawSignatureValues() + result := &RPCTransaction{ + Type: hexutil.Uint64(tx.Type()), + From: from, + Gas: hexutil.Uint64(tx.Gas()), + GasPrice: (*hexutil.Big)(tx.GasPrice()), + Hash: tx.Hash(), + Input: hexutil.Bytes(tx.Data()), + Nonce: hexutil.Uint64(tx.Nonce()), + To: tx.To(), + Value: (*hexutil.Big)(tx.Value()), + V: (*hexutil.Big)(v), + R: (*hexutil.Big)(r), + S: (*hexutil.Big)(s), + } + if blockHash != (common.Hash{}) { + result.BlockHash = &blockHash + result.BlockNumber = (*hexutil.Big)(new(big.Int).SetUint64(blockNumber)) + result.TransactionIndex = (*hexutil.Uint64)(&index) + } + switch tx.Type() { + case ethtypes.AccessListTxType: + al := tx.AccessList() + result.Accesses = &al + result.ChainID = (*hexutil.Big)(tx.ChainId()) + case ethtypes.DynamicFeeTxType: + al := tx.AccessList() + result.Accesses = &al + result.ChainID = (*hexutil.Big)(tx.ChainId()) + result.GasFeeCap = (*hexutil.Big)(tx.GasFeeCap()) + result.GasTipCap = (*hexutil.Big)(tx.GasTipCap()) + // if the transaction has been mined, compute the effective gas price + if baseFee != nil && blockHash != (common.Hash{}) { + // price = min(tip, gasFeeCap - baseFee) + baseFee + price := math.BigMin(new(big.Int).Add(tx.GasTipCap(), baseFee), tx.GasFeeCap()) + result.GasPrice = (*hexutil.Big)(price) + } else { + result.GasPrice = (*hexutil.Big)(tx.GasFeeCap()) + } + } + return result, nil +} + +// BaseFeeFromEvents parses the feemarket basefee from cosmos events +func BaseFeeFromEvents(events []abci.Event) *big.Int { + for _, event := range events { + if event.Type != evmtypes.EventTypeFeeMarket { + continue + } + + for _, attr := range event.Attributes { + if bytes.Equal(attr.Key, []byte(evmtypes.AttributeKeyBaseFee)) { + result, success := new(big.Int).SetString(string(attr.Value), 10) + if success { + return result + } + + return nil + } + } + } + return nil +} + +// FindTxAttributes returns the msg index of the eth tx in cosmos tx, and the attributes, +// returns -1 and nil if not found. +func FindTxAttributes(events []abci.Event, txHash string) (int, map[string]string) { + msgIndex := -1 + for _, event := range events { + if event.Type != evmtypes.EventTypeEthereumTx { + continue + } + + msgIndex++ + + value := FindAttribute(event.Attributes, []byte(evmtypes.AttributeKeyEthereumTxHash)) + if !bytes.Equal(value, []byte(txHash)) { + continue + } + + // found, convert attributes to map for later lookup + attrs := make(map[string]string, len(event.Attributes)) + for _, attr := range event.Attributes { + attrs[string(attr.Key)] = string(attr.Value) + } + return msgIndex, attrs + } + // not found + return -1, nil +} + +// FindTxAttributesByIndex search the msg in tx events by txIndex +// returns the msgIndex, returns -1 if not found. +func FindTxAttributesByIndex(events []abci.Event, txIndex uint64) int { + strIndex := []byte(strconv.FormatUint(txIndex, 10)) + txIndexKey := []byte(evmtypes.AttributeKeyTxIndex) + msgIndex := -1 + for _, event := range events { + if event.Type != evmtypes.EventTypeEthereumTx { + continue + } + + msgIndex++ + + value := FindAttribute(event.Attributes, txIndexKey) + if !bytes.Equal(value, strIndex) { + continue + } + + // found, convert attributes to map for later lookup + return msgIndex + } + // not found + return -1 +} + +// FindAttribute find event attribute with specified key, if not found returns nil. +func FindAttribute(attrs []abci.EventAttribute, key []byte) []byte { + for _, attr := range attrs { + if !bytes.Equal(attr.Key, key) { + continue + } + return attr.Value + } + return nil +} + +// GetUint64Attribute parses the uint64 value from event attributes +func GetUint64Attribute(attrs map[string]string, key string) (uint64, error) { + value, found := attrs[key] + if !found { + return 0, fmt.Errorf("tx index attribute not found: %s", key) + } + var result int64 + result, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return 0, err + } + if result < 0 { + return 0, fmt.Errorf("negative tx index: %d", result) + } + return uint64(result), nil +} + +// AccumulativeGasUsedOfMsg accumulate the gas used by msgs before `msgIndex`. +func AccumulativeGasUsedOfMsg(events []abci.Event, msgIndex int) (gasUsed uint64) { + for _, event := range events { + if event.Type != evmtypes.EventTypeEthereumTx { + continue + } + + if msgIndex < 0 { + break + } + msgIndex-- + + value := FindAttribute(event.Attributes, []byte(evmtypes.AttributeKeyTxGasUsed)) + var result int64 + result, err := strconv.ParseInt(string(value), 10, 64) + if err != nil { + continue + } + gasUsed += uint64(result) + } + return +} diff --git a/rpc/websockets.go b/rpc/websockets.go new file mode 100644 index 00000000..a072705f --- /dev/null +++ b/rpc/websockets.go @@ -0,0 +1,636 @@ +package rpc + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io/ioutil" + "math/big" + "net" + "net/http" + "sync" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/gorilla/mux" + "github.com/gorilla/websocket" + "github.com/pkg/errors" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/filters" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rpc" + + "github.com/tendermint/tendermint/libs/log" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + tmtypes "github.com/tendermint/tendermint/types" + + rpcfilters "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/eth/filters" + "github.com/stratosnet/stratos-chain/rpc/ethereum/pubsub" + "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/server/config" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +type WebsocketsServer interface { + Start() +} + +type SubscriptionResponseJSON struct { + Jsonrpc string `json:"jsonrpc"` + Result interface{} `json:"result"` + ID float64 `json:"id"` +} + +type SubscriptionNotification struct { + Jsonrpc string `json:"jsonrpc"` + Method string `json:"method"` + Params *SubscriptionResult `json:"params"` +} + +type SubscriptionResult struct { + Subscription rpc.ID `json:"subscription"` + Result interface{} `json:"result"` +} + +type ErrorResponseJSON struct { + Jsonrpc string `json:"jsonrpc"` + Error *ErrorMessageJSON `json:"error"` + ID *big.Int `json:"id"` +} + +type ErrorMessageJSON struct { + Code *big.Int `json:"code"` + Message string `json:"message"` +} + +type websocketsServer struct { + rpcAddr string // listen address of rest-server + wsAddr string // listen address of ws server + certFile string + keyFile string + api *pubSubAPI + logger log.Logger +} + +func NewWebsocketsServer(clientCtx client.Context, logger log.Logger, tmWSClient *rpcclient.WSClient, cfg config.Config) WebsocketsServer { + logger = logger.With("api", "websocket-server") + _, port, _ := net.SplitHostPort(cfg.JSONRPC.Address) + + return &websocketsServer{ + rpcAddr: "localhost:" + port, // FIXME: this shouldn't be hardcoded to localhost + wsAddr: cfg.JSONRPC.WsAddress, + certFile: cfg.TLS.CertificatePath, + keyFile: cfg.TLS.KeyPath, + api: newPubSubAPI(clientCtx, logger, tmWSClient), + logger: logger, + } +} + +func (s *websocketsServer) Start() { + ws := mux.NewRouter() + ws.Handle("/", s) + + go func() { + var err error + if s.certFile == "" || s.keyFile == "" { + err = http.ListenAndServe(s.wsAddr, ws) + } else { + err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws) + } + + if err != nil { + if err == http.ErrServerClosed { + return + } + + s.logger.Error("failed to start HTTP server for WS", "error", err.Error()) + } + }() +} + +func (s *websocketsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { + upgrader := websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + return true + }, + } + + conn, err := upgrader.Upgrade(w, r, nil) + if err != nil { + s.logger.Debug("websocket upgrade failed", "error", err.Error()) + return + } + + s.readLoop(&wsConn{ + mux: new(sync.Mutex), + conn: conn, + }) +} + +func (s *websocketsServer) sendErrResponse(wsConn *wsConn, msg string) { + res := &ErrorResponseJSON{ + Jsonrpc: "2.0", + Error: &ErrorMessageJSON{ + Code: big.NewInt(-32600), + Message: msg, + }, + ID: nil, + } + + _ = wsConn.WriteJSON(res) +} + +type wsConn struct { + conn *websocket.Conn + mux *sync.Mutex +} + +func (w *wsConn) WriteJSON(v interface{}) error { + w.mux.Lock() + defer w.mux.Unlock() + + return w.conn.WriteJSON(v) +} + +func (w *wsConn) Close() error { + w.mux.Lock() + defer w.mux.Unlock() + + return w.conn.Close() +} + +func (w *wsConn) ReadMessage() (messageType int, p []byte, err error) { + // not protected by write mutex + + return w.conn.ReadMessage() +} + +func (s *websocketsServer) readLoop(wsConn *wsConn) { + // subscriptions of current connection + subscriptions := make(map[rpc.ID]pubsub.UnsubscribeFunc) + defer func() { + // cancel all subscriptions when connection closed + for _, unsubFn := range subscriptions { + unsubFn() + } + }() + + for { + _, mb, err := wsConn.ReadMessage() + if err != nil { + _ = wsConn.Close() + return + } + + var msg map[string]interface{} + err = json.Unmarshal(mb, &msg) + if err != nil { + s.sendErrResponse(wsConn, "invalid request") + continue + } + + // check if method == eth_subscribe or eth_unsubscribe + method, ok := msg["method"].(string) + if !ok { + // otherwise, call the usual rpc server to respond + err = s.tcpGetAndSendResponse(wsConn, mb) + if err != nil { + s.sendErrResponse(wsConn, err.Error()) + } + + continue + } + + connID := msg["id"].(float64) + switch method { + case "eth_subscribe": + params := msg["params"].([]interface{}) + if len(params) == 0 { + s.sendErrResponse(wsConn, "invalid parameters") + continue + } + + subID := rpc.NewID() + unsubFn, err := s.api.subscribe(wsConn, subID, params) + if err != nil { + s.sendErrResponse(wsConn, err.Error()) + continue + } + subscriptions[subID] = unsubFn + + res := &SubscriptionResponseJSON{ + Jsonrpc: "2.0", + ID: connID, + Result: subID, + } + + if err := wsConn.WriteJSON(res); err != nil { + break + } + case "eth_unsubscribe": + params, ok := msg["params"].([]interface{}) + if !ok { + s.sendErrResponse(wsConn, "invalid parameters") + continue + } + id, ok := params[0].(string) + if !ok { + s.sendErrResponse(wsConn, "invalid parameters") + continue + } + + subID := rpc.ID(id) + unsubFn, ok := subscriptions[subID] + if ok { + delete(subscriptions, subID) + unsubFn() + } + res := &SubscriptionResponseJSON{ + Jsonrpc: "2.0", + ID: connID, + Result: ok, + } + + if err := wsConn.WriteJSON(res); err != nil { + break + } + default: + // otherwise, call the usual rpc server to respond + err = s.tcpGetAndSendResponse(wsConn, mb) + if err != nil { + s.sendErrResponse(wsConn, err.Error()) + } + } + } +} + +// tcpGetAndSendResponse connects to the rest-server over tcp, posts a JSON-RPC request, and sends the response +// to the client over websockets +func (s *websocketsServer) tcpGetAndSendResponse(wsConn *wsConn, mb []byte) error { + req, err := http.NewRequestWithContext(context.Background(), "POST", "http://"+s.rpcAddr, bytes.NewBuffer(mb)) + if err != nil { + return errors.Wrap(err, "Could not build request") + } + + req.Header.Set("Content-Type", "application/json") + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + return errors.Wrap(err, "Could not perform request") + } + + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return errors.Wrap(err, "could not read body from response") + } + + var wsSend interface{} + err = json.Unmarshal(body, &wsSend) + if err != nil { + return errors.Wrap(err, "failed to unmarshal rest-server response") + } + + return wsConn.WriteJSON(wsSend) +} + +// pubSubAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec +type pubSubAPI struct { + events *rpcfilters.EventSystem + logger log.Logger + clientCtx client.Context +} + +// newPubSubAPI creates an instance of the ethereum PubSub API. +func newPubSubAPI(clientCtx client.Context, logger log.Logger, tmWSClient *rpcclient.WSClient) *pubSubAPI { + logger = logger.With("module", "websocket-client") + return &pubSubAPI{ + events: rpcfilters.NewEventSystem(logger, tmWSClient), + logger: logger, + clientCtx: clientCtx, + } +} + +func (api *pubSubAPI) subscribe(wsConn *wsConn, subID rpc.ID, params []interface{}) (pubsub.UnsubscribeFunc, error) { + method, ok := params[0].(string) + if !ok { + return nil, errors.New("invalid parameters") + } + + switch method { + case "newHeads": + // TODO: handle extra params + return api.subscribeNewHeads(wsConn, subID) + case "logs": + if len(params) > 1 { + return api.subscribeLogs(wsConn, subID, params[1]) + } + return api.subscribeLogs(wsConn, subID, nil) + case "newPendingTransactions": + return api.subscribePendingTransactions(wsConn, subID) + case "syncing": + return api.subscribeSyncing(wsConn, subID) + default: + return nil, errors.Errorf("unsupported method %s", method) + } +} + +func (api *pubSubAPI) subscribeNewHeads(wsConn *wsConn, subID rpc.ID) (pubsub.UnsubscribeFunc, error) { + sub, unsubFn, err := api.events.SubscribeNewHeads() + if err != nil { + return nil, errors.Wrap(err, "error creating block filter") + } + + // TODO: use events + baseFee := big.NewInt(params.InitialBaseFee) + + go func() { + headersCh := sub.Event() + errCh := sub.Err() + for { + select { + case event, ok := <-headersCh: + if !ok { + return + } + + data, ok := event.Data.(tmtypes.EventDataNewBlockHeader) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", event.Data)) + continue + } + + header := types.EthHeaderFromTendermint(data.Header, ethtypes.Bloom{}, baseFee) + + // write to ws conn + res := &SubscriptionNotification{ + Jsonrpc: "2.0", + Method: "eth_subscription", + Params: &SubscriptionResult{ + Subscription: subID, + Result: header, + }, + } + + err = wsConn.WriteJSON(res) + if err != nil { + api.logger.Error("error writing header, will drop peer", "error", err.Error()) + + try(func() { + if err != websocket.ErrCloseSent { + _ = wsConn.Close() + } + }, api.logger, "closing websocket peer sub") + } + case err, ok := <-errCh: + if !ok { + return + } + api.logger.Debug("dropping NewHeads WebSocket subscription", "subscription-id", subID, "error", err.Error()) + } + } + }() + + return unsubFn, nil +} + +func try(fn func(), l log.Logger, desc string) { + defer func() { + if x := recover(); x != nil { + if err, ok := x.(error); ok { + // debug.PrintStack() + l.Debug("panic during "+desc, "error", err.Error()) + return + } + + l.Debug(fmt.Sprintf("panic during %s: %+v", desc, x)) + return + } + }() + + fn() +} + +func (api *pubSubAPI) subscribeLogs(wsConn *wsConn, subID rpc.ID, extra interface{}) (pubsub.UnsubscribeFunc, error) { + crit := filters.FilterCriteria{} + + if extra != nil { + params, ok := extra.(map[string]interface{}) + if !ok { + err := errors.New("invalid criteria") + api.logger.Debug("invalid criteria", "type", fmt.Sprintf("%T", extra)) + return nil, err + } + + if params["address"] != nil { + address, ok := params["address"].(string) + addresses, sok := params["address"].([]interface{}) + if !ok && !sok { + err := errors.New("invalid addresses; must be address or array of addresses") + api.logger.Debug("invalid addresses", "type", fmt.Sprintf("%T", params["address"])) + return nil, err + } + + if ok { + crit.Addresses = []common.Address{common.HexToAddress(address)} + } + + if sok { + crit.Addresses = []common.Address{} + for _, addr := range addresses { + address, ok := addr.(string) + if !ok { + err := errors.New("invalid address") + api.logger.Debug("invalid address", "type", fmt.Sprintf("%T", addr)) + return nil, err + } + + crit.Addresses = append(crit.Addresses, common.HexToAddress(address)) + } + } + } + + if params["topics"] != nil { + topics, ok := params["topics"].([]interface{}) + if !ok { + err := errors.Errorf("invalid topics: %s", topics) + api.logger.Error("invalid topics", "type", fmt.Sprintf("%T", topics)) + return nil, err + } + + crit.Topics = make([][]common.Hash, len(topics)) + + addCritTopic := func(topicIdx int, topic interface{}) error { + tstr, ok := topic.(string) + if !ok { + err := errors.Errorf("invalid topic: %s", topic) + api.logger.Error("invalid topic", "type", fmt.Sprintf("%T", topic)) + return err + } + + crit.Topics[topicIdx] = []common.Hash{common.HexToHash(tstr)} + return nil + } + + for topicIdx, subtopics := range topics { + if subtopics == nil { + continue + } + + // in case we don't have list, but a single topic value + if topic, ok := subtopics.(string); ok { + if err := addCritTopic(topicIdx, topic); err != nil { + return nil, err + } + + continue + } + + // in case we actually have a list of subtopics + subtopicsList, ok := subtopics.([]interface{}) + if !ok { + err := errors.New("invalid subtopics") + api.logger.Error("invalid subtopic", "type", fmt.Sprintf("%T", subtopics)) + return nil, err + } + + subtopicsCollect := make([]common.Hash, len(subtopicsList)) + for idx, subtopic := range subtopicsList { + tstr, ok := subtopic.(string) + if !ok { + err := errors.Errorf("invalid subtopic: %s", subtopic) + api.logger.Error("invalid subtopic", "type", fmt.Sprintf("%T", subtopic)) + return nil, err + } + + subtopicsCollect[idx] = common.HexToHash(tstr) + } + + crit.Topics[topicIdx] = subtopicsCollect + } + } + } + + sub, unsubFn, err := api.events.SubscribeLogs(crit) + if err != nil { + api.logger.Error("failed to subscribe logs", "error", err.Error()) + return nil, err + } + + go func() { + ch := sub.Event() + errCh := sub.Err() + for { + select { + case event, ok := <-ch: + if !ok { + return + } + + dataTx, ok := event.Data.(tmtypes.EventDataTx) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", event.Data)) + continue + } + + txResponse, err := evmtypes.DecodeTxResponse(dataTx.TxResult.Result.Data) + if err != nil { + api.logger.Error("failed to decode tx response", "error", err.Error()) + return + } + + logs := rpcfilters.FilterLogs(evmtypes.LogsToEthereum(txResponse.Logs), crit.FromBlock, crit.ToBlock, crit.Addresses, crit.Topics) + if len(logs) == 0 { + continue + } + + for _, ethLog := range logs { + res := &SubscriptionNotification{ + Jsonrpc: "2.0", + Method: "eth_subscription", + Params: &SubscriptionResult{ + Subscription: subID, + Result: ethLog, + }, + } + + err = wsConn.WriteJSON(res) + if err != nil { + try(func() { + if err != websocket.ErrCloseSent { + _ = wsConn.Close() + } + }, api.logger, "closing websocket peer sub") + } + } + case err, ok := <-errCh: + if !ok { + return + } + api.logger.Debug("dropping Logs WebSocket subscription", "subscription-id", subID, "error", err.Error()) + } + } + }() + + return unsubFn, nil +} + +func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn, subID rpc.ID) (pubsub.UnsubscribeFunc, error) { + sub, unsubFn, err := api.events.SubscribePendingTxs() + if err != nil { + return nil, errors.Wrap(err, "error creating block filter: %s") + } + + go func() { + txsCh := sub.Event() + errCh := sub.Err() + for { + select { + case ev := <-txsCh: + data, _ := ev.Data.(tmtypes.EventDataTx) + ethTxs, err := types.RawTxToEthTx(api.clientCtx, data.Tx) + if err != nil { + // not ethereum tx + continue + } + + for _, ethTx := range ethTxs { + // write to ws conn + res := &SubscriptionNotification{ + Jsonrpc: "2.0", + Method: "eth_subscription", + Params: &SubscriptionResult{ + Subscription: subID, + Result: ethTx.Hash, + }, + } + + err = wsConn.WriteJSON(res) + if err != nil { + api.logger.Debug("error writing header, will drop peer", "error", err.Error()) + + try(func() { + if err != websocket.ErrCloseSent { + _ = wsConn.Close() + } + }, api.logger, "closing websocket peer sub") + } + } + case err, ok := <-errCh: + if !ok { + return + } + api.logger.Debug("dropping PendingTransactions WebSocket subscription", subID, "error", err.Error()) + } + } + }() + + return unsubFn, nil +} + +func (api *pubSubAPI) subscribeSyncing(wsConn *wsConn, subID rpc.ID) (pubsub.UnsubscribeFunc, error) { + return nil, errors.New("syncing subscription is not implemented") +} diff --git a/scripts/proto-tools-installer.sh b/scripts/proto-tools-installer.sh new file mode 100644 index 00000000..6ea8b712 --- /dev/null +++ b/scripts/proto-tools-installer.sh @@ -0,0 +1,155 @@ +#!/bin/bash + +set -ue + +DESTDIR=${DESTDIR:-} +PREFIX=${PREFIX:-/usr/local} +UNAME_S="$(uname -s 2>/dev/null)" +UNAME_M="$(uname -m 2>/dev/null)" +BUF_VERSION=0.11.0 +PROTOC_VERSION=3.13.0 +PROTOC_GRPC_GATEWAY_VERSION=1.14.7 + +f_abort() { + local l_rc=$1 + shift + + echo $@ >&2 + exit ${l_rc} +} + +case "${UNAME_S}" in + Linux) + PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-x86_64.zip" + PROTOC_GRPC_GATEWAY_BIN="protoc-gen-grpc-gateway-v${PROTOC_GRPC_GATEWAY_VERSION}-linux-x86_64" + ;; + Darwin) + PROTOC_ZIP="protoc-${PROTOC_VERSION}-osx-x86_64.zip" + PROTOC_GRPC_GATEWAY_BIN="protoc-gen-grpc-gateway-v${PROTOC_GRPC_GATEWAY_VERSION}-darwin-x86_64" + ;; + *) + f_abort 1 "Unknown kernel name. Exiting." +esac + +TEMPDIR="$(mktemp -d)" + +trap "rm -rvf ${TEMPDIR}" EXIT + +f_print_installing_with_padding() { + printf "Installing %30s ..." "$1" >&2 +} + +f_print_done() { + echo -e "\tDONE" >&2 +} + +f_ensure_tools() { + ! which curl &>/dev/null && f_abort 2 "couldn't find curl, aborting" || true +} + +f_ensure_dirs() { + mkdir -p "${DESTDIR}/${PREFIX}/bin" + mkdir -p "${DESTDIR}/${PREFIX}/include" +} + +f_needs_install() { + if [ -x $1 ]; then + echo -e "\talready installed. Skipping." >&2 + return 1 + fi + + return 0 +} + +f_install_protoc() { + f_print_installing_with_padding proto_c + f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc" || return 0 + + pushd "${TEMPDIR}" >/dev/null + curl -o "${PROTOC_ZIP}" -sSL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" + unzip -q -o ${PROTOC_ZIP} -d ${DESTDIR}/${PREFIX} bin/protoc; \ + unzip -q -o ${PROTOC_ZIP} -d ${DESTDIR}/${PREFIX} 'include/*'; \ + rm -f ${PROTOC_ZIP} + popd >/dev/null + f_print_done +} + +f_install_buf() { + f_print_installing_with_padding buf + f_needs_install "${DESTDIR}/${PREFIX}/bin/buf" || return 0 + + curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" -o "${DESTDIR}/${PREFIX}/bin/buf" + chmod +x "${DESTDIR}/${PREFIX}/bin/buf" + f_print_done +} + +f_install_protoc_gen_gocosmos() { + f_print_installing_with_padding protoc-gen-gocosmos + + if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then + echo -e "\tPlease run this command from somewhere inside the stratos folder." + return 1 + fi + + go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null + f_print_done +} + +f_install_protoc_gen_grpc_gateway() { + f_print_installing_with_padding protoc-gen-grpc-gateway + f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc-gen-grpc-gateway" || return 0 + + curl -o "${DESTDIR}/${PREFIX}/bin/protoc-gen-grpc-gateway" -sSL "https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${PROTOC_GRPC_GATEWAY_VERSION}/${PROTOC_GRPC_GATEWAY_BIN}" + f_print_done +} + +f_install_protoc_gen_swagger() { + f_print_installing_with_padding protoc-gen-swagger + f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc-gen-swagger" || return 0 + + if ! which npm &>/dev/null ; then + echo -e "\tNPM is not installed. Skipping." + return 0 + fi + + pushd "${TEMPDIR}" >/dev/null + go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest + npm install -g swagger-combine + popd >/dev/null + f_print_done +} + +f_install_clang_format() { + f_print_installing_with_padding clang-format + + if which clang-format &>/dev/null ; then + echo -e "\talready installed. Skipping." + return 0 + fi + + case "${UNAME_S}" in + Linux) + if [ -e /etc/debian_version ]; then + echo -e "\tRun: sudo apt-get install clang-format" >&2 + elif [ -e /etc/fedora-release ]; then + echo -e "\tRun: sudo dnf install clang" >&2 + else + echo -e "\tRun (as root): subscription-manager repos --enable rhel-7-server-devtools-rpms ; yum install llvm-toolset-7" >&2 + fi + ;; + Darwin) + echo "\tRun: brew install clang-format" >&2 + ;; + *) + echo "\tunknown operating system. Skipping." >&2 + esac +} + +f_ensure_tools +f_ensure_dirs +f_install_protoc +f_install_buf +f_install_protoc_gen_gocosmos +f_install_protoc_gen_grpc_gateway +f_install_protoc_gen_swagger +f_install_clang_format \ No newline at end of file diff --git a/server/config/config.go b/server/config/config.go new file mode 100644 index 00000000..616480b2 --- /dev/null +++ b/server/config/config.go @@ -0,0 +1,308 @@ +package config + +import ( + "errors" + "fmt" + "path" + "time" + + "github.com/spf13/viper" + + "github.com/tendermint/tendermint/libs/strings" + + "github.com/cosmos/cosmos-sdk/server/config" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + // DefaultGRPCAddress is the default address the gRPC server binds to. + DefaultGRPCAddress = "0.0.0.0:9900" + + // DefaultJSONRPCAddress is the default address the JSON-RPC server binds to. + DefaultJSONRPCAddress = "0.0.0.0:8545" + + // DefaultJSONRPCWsAddress is the default address the JSON-RPC WebSocket server binds to. + DefaultJSONRPCWsAddress = "0.0.0.0:8546" + + // DefaultEVMTracer is the default vm.Tracer type + DefaultEVMTracer = "" + + DefaultGasCap uint64 = 25000000 + + DefaultFilterCap int32 = 200 + + DefaultFeeHistoryCap int32 = 100 + + DefaultLogsCap int32 = 10000 + + DefaultBlockRangeCap int32 = 10000 + + DefaultEVMTimeout = 5 * time.Second + // default 1.0 eth + DefaultTxFeeCap float64 = 1.0 +) + +var evmTracers = []string{"json", "markdown", "struct", "access_list"} + +// Config defines the server's top level configuration. It includes the default app config +// from the SDK as well as the EVM configuration to enable the JSON-RPC APIs. +type Config struct { + config.Config + + EVM EVMConfig `mapstructure:"evm"` + JSONRPC JSONRPCConfig `mapstructure:"json-rpc"` + TLS TLSConfig `mapstructure:"tls"` +} + +// EVMConfig defines the application configuration values for the EVM. +type EVMConfig struct { + // Tracer defines vm.Tracer type that the EVM will use if the node is run in + // trace mode. Default: 'json'. + Tracer string `mapstructure:"tracer"` +} + +// JSONRPCConfig defines configuration for the EVM RPC server. +type JSONRPCConfig struct { + // API defines a list of JSON-RPC namespaces that should be enabled + API []string `mapstructure:"api"` + // Address defines the HTTP server to listen on + Address string `mapstructure:"address"` + // WsAddress defines the WebSocket server to listen on + WsAddress string `mapstructure:"ws-address"` + // GasCap is the global gas cap for eth-call variants. + GasCap uint64 `mapstructure:"gas-cap"` + // EVMTimeout is the global timeout for eth-call. + EVMTimeout time.Duration `mapstructure:"evm-timeout"` + // TxFeeCap is the global tx-fee cap for send transaction + TxFeeCap float64 `mapstructure:"txfee-cap"` + // FilterCap is the global cap for total number of filters that can be created. + FilterCap int32 `mapstructure:"filter-cap"` + // FeeHistoryCap is the global cap for total number of blocks that can be fetched + FeeHistoryCap int32 `mapstructure:"feehistory-cap"` + // Enable defines if the EVM RPC server should be enabled. + Enable bool `mapstructure:"enable"` + // LogsCap defines the max number of results can be returned from single `eth_getLogs` query. + LogsCap int32 `mapstructure:"logs-cap"` + // BlockRangeCap defines the max block range allowed for `eth_getLogs` query. + BlockRangeCap int32 `mapstructure:"block-range-cap"` +} + +// TLSConfig defines the certificate and matching private key for the server. +type TLSConfig struct { + // CertificatePath the file path for the certificate .pem file + CertificatePath string `mapstructure:"certificate-path"` + // KeyPath the file path for the key .pem file + KeyPath string `mapstructure:"key-path"` +} + +// AppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func AppConfig(denom string) (string, interface{}) { + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := config.DefaultConfig() + + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In stratos, we set the min gas prices to 0. + if denom != "" { + srvCfg.MinGasPrices = "0" + denom + } + + customAppConfig := Config{ + Config: *srvCfg, + EVM: *DefaultEVMConfig(), + JSONRPC: *DefaultJSONRPCConfig(), + TLS: *DefaultTLSConfig(), + } + + customAppTemplate := config.DefaultConfigTemplate + DefaultConfigTemplate + + return customAppTemplate, customAppConfig +} + +// DefaultConfig returns server's default configuration. +func DefaultConfig() *Config { + return &Config{ + Config: *config.DefaultConfig(), + EVM: *DefaultEVMConfig(), + JSONRPC: *DefaultJSONRPCConfig(), + TLS: *DefaultTLSConfig(), + } +} + +// DefaultEVMConfig returns the default EVM configuration +func DefaultEVMConfig() *EVMConfig { + return &EVMConfig{ + Tracer: DefaultEVMTracer, + } +} + +// Validate returns an error if the tracer type is invalid. +func (c EVMConfig) Validate() error { + if c.Tracer != "" && !strings.StringInSlice(c.Tracer, evmTracers) { + return fmt.Errorf("invalid tracer type %s, available types: %v", c.Tracer, evmTracers) + } + + return nil +} + +// GetDefaultAPINamespaces returns the default list of JSON-RPC namespaces that should be enabled +func GetDefaultAPINamespaces() []string { + return []string{"eth", "net", "web3"} +} + +// GetAPINamespaces returns the all the available JSON-RPC API namespaces. +func GetAPINamespaces() []string { + return []string{"web3", "eth", "personal", "net", "txpool", "debug", "miner"} +} + +// DefaultJSONRPCConfig returns an EVM config with the JSON-RPC API enabled by default +func DefaultJSONRPCConfig() *JSONRPCConfig { + return &JSONRPCConfig{ + Enable: true, + API: GetDefaultAPINamespaces(), + Address: DefaultJSONRPCAddress, + WsAddress: DefaultJSONRPCWsAddress, + GasCap: DefaultGasCap, + EVMTimeout: DefaultEVMTimeout, + TxFeeCap: DefaultTxFeeCap, + FilterCap: DefaultFilterCap, + FeeHistoryCap: DefaultFeeHistoryCap, + BlockRangeCap: DefaultBlockRangeCap, + LogsCap: DefaultLogsCap, + } +} + +// Validate returns an error if the JSON-RPC configuration fields are invalid. +func (c JSONRPCConfig) Validate() error { + if c.Enable && len(c.API) == 0 { + return errors.New("cannot enable JSON-RPC without defining any API namespace") + } + + if c.FilterCap < 0 { + return errors.New("JSON-RPC filter-cap cannot be negative") + } + + if c.FeeHistoryCap <= 0 { + return errors.New("JSON-RPC feehistory-cap cannot be negative or 0") + } + + if c.TxFeeCap < 0 { + return errors.New("JSON-RPC tx fee cap cannot be negative") + } + + if c.EVMTimeout < 0 { + return errors.New("JSON-RPC EVM timeout duration cannot be negative") + } + + if c.LogsCap < 0 { + return errors.New("JSON-RPC logs cap cannot be negative") + } + + if c.BlockRangeCap < 0 { + return errors.New("JSON-RPC block range cap cannot be negative") + } + + // TODO: validate APIs + seenAPIs := make(map[string]bool) + for _, api := range c.API { + if seenAPIs[api] { + return fmt.Errorf("repeated API namespace '%s'", api) + } + + seenAPIs[api] = true + } + + return nil +} + +// DefaultTLSConfig returns the default TLS configuration +func DefaultTLSConfig() *TLSConfig { + return &TLSConfig{ + CertificatePath: "", + KeyPath: "", + } +} + +// Validate returns an error if the TLS certificate and key file extensions are invalid. +func (c TLSConfig) Validate() error { + certExt := path.Ext(c.CertificatePath) + + if c.CertificatePath != "" && certExt != ".pem" { + return fmt.Errorf("invalid extension %s for certificate path %s, expected '.pem'", certExt, c.CertificatePath) + } + + keyExt := path.Ext(c.KeyPath) + + if c.KeyPath != "" && keyExt != ".pem" { + return fmt.Errorf("invalid extension %s for key path %s, expected '.pem'", keyExt, c.KeyPath) + } + + return nil +} + +// GetConfig returns a fully parsed Config object. +func GetConfig(v *viper.Viper) Config { + cfg := config.GetConfig(v) + + return Config{ + Config: cfg, + EVM: EVMConfig{ + Tracer: v.GetString("evm.tracer"), + }, + JSONRPC: JSONRPCConfig{ + Enable: v.GetBool("json-rpc.enable"), + API: v.GetStringSlice("json-rpc.api"), + Address: v.GetString("json-rpc.address"), + WsAddress: v.GetString("json-rpc.ws-address"), + GasCap: v.GetUint64("json-rpc.gas-cap"), + FilterCap: v.GetInt32("json-rpc.filter-cap"), + FeeHistoryCap: v.GetInt32("json-rpc.feehistory-cap"), + TxFeeCap: v.GetFloat64("json-rpc.txfee-cap"), + EVMTimeout: v.GetDuration("json-rpc.evm-timeout"), + LogsCap: v.GetInt32("json-rpc.logs-cap"), + BlockRangeCap: v.GetInt32("json-rpc.block-range-cap"), + }, + TLS: TLSConfig{ + CertificatePath: v.GetString("tls.certificate-path"), + KeyPath: v.GetString("tls.key-path"), + }, + } +} + +// ParseConfig retrieves the default environment configuration for the +// application. +func ParseConfig(v *viper.Viper) (*Config, error) { + conf := DefaultConfig() + err := v.Unmarshal(conf) + + return conf, err +} + +// ValidateBasic returns an error any of the application configuration fields are invalid +func (c Config) ValidateBasic() error { + if err := c.EVM.Validate(); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrAppConfig, "invalid evm config value: %s", err.Error()) + } + + if err := c.JSONRPC.Validate(); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrAppConfig, "invalid json-rpc config value: %s", err.Error()) + } + + if err := c.TLS.Validate(); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrAppConfig, "invalid tls config value: %s", err.Error()) + } + + return c.Config.ValidateBasic() +} diff --git a/server/config/toml.go b/server/config/toml.go new file mode 100644 index 00000000..24233dcb --- /dev/null +++ b/server/config/toml.go @@ -0,0 +1,67 @@ +package config + +// DefaultConfigTemplate defines the configuration template for the EVM RPC configuration +const DefaultConfigTemplate = ` +############################################################################### +### EVM Configuration ### +############################################################################### + +[evm] + +# Tracer defines the 'vm.Tracer' type that the EVM will use when the node is run in +# debug mode. To enable tracing use the '--evm.tracer' flag when starting your node. +# Valid types are: json|struct|access_list|markdown +tracer = "{{ .EVM.Tracer }}" + +############################################################################### +### JSON RPC Configuration ### +############################################################################### + +[json-rpc] + +# Enable defines if the gRPC server should be enabled. +enable = {{ .JSONRPC.Enable }} + +# Address defines the EVM RPC HTTP server address to bind to. +address = "{{ .JSONRPC.Address }}" + +# Address defines the EVM WebSocket server address to bind to. +ws-address = "{{ .JSONRPC.WsAddress }}" + +# API defines a list of JSON-RPC namespaces that should be enabled +# Example: "eth,txpool,personal,net,debug,web3" +api = "{{range $index, $elmt := .JSONRPC.API}}{{if $index}},{{$elmt}}{{else}}{{$elmt}}{{end}}{{end}}" + +# GasCap sets a cap on gas that can be used in eth_call/estimateGas (0=infinite). Default: 25,000,000. +gas-cap = {{ .JSONRPC.GasCap }} + +# EVMTimeout is the global timeout for eth_call. Default: 5s. +evm-timeout = "{{ .JSONRPC.EVMTimeout }}" + +# TxFeeCap is the global tx-fee cap for send transaction. Default: 1eth. +txfee-cap = {{ .JSONRPC.TxFeeCap }} + +# FilterCap sets the global cap for total number of filters that can be created +filter-cap = {{ .JSONRPC.FilterCap }} + +# FeeHistoryCap sets the global cap for total number of blocks that can be fetched +feehistory-cap = {{ .JSONRPC.FeeHistoryCap }} + +# LogsCap defines the max number of results can be returned from single 'eth_getLogs' query. +logs-cap = {{ .JSONRPC.LogsCap }} + +# BlockRangeCap defines the max block range allowed for 'eth_getLogs' query. +block-range-cap = {{ .JSONRPC.BlockRangeCap }} + +############################################################################### +### TLS Configuration ### +############################################################################### + +[tls] + +# Certificate path defines the cert.pem file path for the TLS configuration. +certificate-path = "{{ .TLS.CertificatePath }}" + +# Key path defines the key.pem file path for the TLS configuration. +key-path = "{{ .TLS.KeyPath }}" +` diff --git a/third_party/proto/buf.yaml b/third_party/proto/buf.yaml new file mode 100644 index 00000000..a5b0d628 --- /dev/null +++ b/third_party/proto/buf.yaml @@ -0,0 +1,33 @@ +version: v1 +build: + excludes: + - google/protobuf +lint: + use: + - DEFAULT + - COMMENTS + - FILE_LOWER_SNAKE_CASE + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME + - RPC_REQUEST_RESPONSE_UNIQUE + - RPC_RESPONSE_STANDARD_NAME + - RPC_REQUEST_RESPONSE_UNIQUE + - COMMENT_MESSAGE + ignore: + - tendermint + - gogoproto + - cosmos_proto + - google + - confio +breaking: + use: + - FILE + ignore: + - tendermint + - gogoproto + - cosmos_proto + - google \ No newline at end of file diff --git a/third_party/proto/cosmos/auth/v1beta1/auth.proto b/third_party/proto/cosmos/auth/v1beta1/auth.proto new file mode 100644 index 00000000..72e1d9ec --- /dev/null +++ b/third_party/proto/cosmos/auth/v1beta1/auth.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +package cosmos.auth.v1beta1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; + +// BaseAccount defines a base account type. It contains all the necessary fields +// for basic account functionality. Any custom account type should extend this +// type for additional functionality (e.g. vesting). +message BaseAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + + option (cosmos_proto.implements_interface) = "AccountI"; + + string address = 1; + google.protobuf.Any pub_key = 2 + [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; + uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""]; + uint64 sequence = 4; +} + +// ModuleAccount defines an account for modules that holds coins on a pool. +message ModuleAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos_proto.implements_interface) = "ModuleAccountI"; + + BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; + string name = 2; + repeated string permissions = 3; +} + +// Params defines the parameters for the auth module. +message Params { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + uint64 max_memo_characters = 1 [(gogoproto.moretags) = "yaml:\"max_memo_characters\""]; + uint64 tx_sig_limit = 2 [(gogoproto.moretags) = "yaml:\"tx_sig_limit\""]; + uint64 tx_size_cost_per_byte = 3 [(gogoproto.moretags) = "yaml:\"tx_size_cost_per_byte\""]; + uint64 sig_verify_cost_ed25519 = 4 + [(gogoproto.customname) = "SigVerifyCostED25519", (gogoproto.moretags) = "yaml:\"sig_verify_cost_ed25519\""]; + uint64 sig_verify_cost_secp256k1 = 5 + [(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""]; +} diff --git a/third_party/proto/cosmos/auth/v1beta1/genesis.proto b/third_party/proto/cosmos/auth/v1beta1/genesis.proto new file mode 100644 index 00000000..c88b94ee --- /dev/null +++ b/third_party/proto/cosmos/auth/v1beta1/genesis.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package cosmos.auth.v1beta1; + +import "google/protobuf/any.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/auth/v1beta1/auth.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; + +// GenesisState defines the auth module's genesis state. +message GenesisState { + // params defines all the paramaters of the module. + Params params = 1 [(gogoproto.nullable) = false]; + + // accounts are the accounts present at genesis. + repeated google.protobuf.Any accounts = 2; +} diff --git a/third_party/proto/cosmos/auth/v1beta1/query.proto b/third_party/proto/cosmos/auth/v1beta1/query.proto new file mode 100644 index 00000000..76d30dd6 --- /dev/null +++ b/third_party/proto/cosmos/auth/v1beta1/query.proto @@ -0,0 +1,68 @@ +syntax = "proto3"; +package cosmos.auth.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; +import "cosmos/auth/v1beta1/auth.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; + +// Query defines the gRPC querier service. +service Query { + // Accounts returns all the existing accounts + rpc Accounts(QueryAccountsRequest) returns (QueryAccountsResponse) { + option (google.api.http).get = "/cosmos/auth/v1beta1/accounts"; + } + + // Account returns account details based on address. + rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { + option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}"; + } + + // Params queries all parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/auth/v1beta1/params"; + } +} + +// QueryAccountsRequest is the request type for the Query/Accounts RPC method. +message QueryAccountsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryAccountsResponse is the response type for the Query/Accounts RPC method. +message QueryAccountsResponse { + // accounts are the existing accounts + repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryAccountRequest is the request type for the Query/Account RPC method. +message QueryAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address defines the address to query for. + string address = 1; +} + +// QueryAccountResponse is the response type for the Query/Account RPC method. +message QueryAccountResponse { + // account defines the account of the corresponding address. + google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/authz/v1beta1/authz.proto b/third_party/proto/cosmos/authz/v1beta1/authz.proto new file mode 100644 index 00000000..c69a93c1 --- /dev/null +++ b/third_party/proto/cosmos/authz/v1beta1/authz.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package cosmos.authz.v1beta1; + +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; +option (gogoproto.goproto_getters_all) = false; + +// GenericAuthorization gives the grantee unrestricted permissions to execute +// the provided method on behalf of the granter's account. +message GenericAuthorization { + option (cosmos_proto.implements_interface) = "Authorization"; + + // Msg, identified by it's type URL, to grant unrestricted permissions to execute + string msg = 1; +} + +// Grant gives permissions to execute +// the provide method with expiration time. +message Grant { + google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Timestamp expiration = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/authz/v1beta1/event.proto b/third_party/proto/cosmos/authz/v1beta1/event.proto new file mode 100644 index 00000000..c77cea3e --- /dev/null +++ b/third_party/proto/cosmos/authz/v1beta1/event.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package cosmos.authz.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; + +// EventGrant is emitted on Msg/Grant +message EventGrant { + // Msg type URL for which an autorization is granted + string msg_type_url = 2; + // Granter account address + string granter = 3; + // Grantee account address + string grantee = 4; +} + +// EventRevoke is emitted on Msg/Revoke +message EventRevoke { + // Msg type URL for which an autorization is revoked + string msg_type_url = 2; + // Granter account address + string granter = 3; + // Grantee account address + string grantee = 4; +} diff --git a/third_party/proto/cosmos/authz/v1beta1/genesis.proto b/third_party/proto/cosmos/authz/v1beta1/genesis.proto new file mode 100644 index 00000000..411fd276 --- /dev/null +++ b/third_party/proto/cosmos/authz/v1beta1/genesis.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package cosmos.authz.v1beta1; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; + +// GenesisState defines the authz module's genesis state. +message GenesisState { + repeated GrantAuthorization authorization = 1 [(gogoproto.nullable) = false]; +} + +// GrantAuthorization defines the GenesisState/GrantAuthorization type. +message GrantAuthorization { + string granter = 1; + string grantee = 2; + + google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Timestamp expiration = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} diff --git a/third_party/proto/cosmos/authz/v1beta1/query.proto b/third_party/proto/cosmos/authz/v1beta1/query.proto new file mode 100644 index 00000000..3b66e031 --- /dev/null +++ b/third_party/proto/cosmos/authz/v1beta1/query.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package cosmos.authz.v1beta1; + +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/authz/v1beta1/authz.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; + +// Query defines the gRPC querier service. +service Query { + // Returns list of `Authorization`, granted to the grantee by the granter. + rpc Grants(QueryGrantsRequest) returns (QueryGrantsResponse) { + option (google.api.http).get = "/cosmos/authz/v1beta1/grants"; + } +} + +// QueryGrantsRequest is the request type for the Query/Grants RPC method. +message QueryGrantsRequest { + string granter = 1; + string grantee = 2; + // Optional, msg_type_url, when set, will query only grants matching given msg type. + string msg_type_url = 3; + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 4; +} + +// QueryGrantsResponse is the response type for the Query/Authorizations RPC method. +message QueryGrantsResponse { + // authorizations is a list of grants granted for grantee by granter. + repeated cosmos.authz.v1beta1.Grant grants = 1; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/third_party/proto/cosmos/authz/v1beta1/tx.proto b/third_party/proto/cosmos/authz/v1beta1/tx.proto new file mode 100644 index 00000000..1829b7af --- /dev/null +++ b/third_party/proto/cosmos/authz/v1beta1/tx.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; +package cosmos.authz.v1beta1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos/authz/v1beta1/authz.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; +option (gogoproto.goproto_getters_all) = false; + +// Msg defines the authz Msg service. +service Msg { + // Grant grants the provided authorization to the grantee on the granter's + // account with the provided expiration time. If there is already a grant + // for the given (granter, grantee, Authorization) triple, then the grant + // will be overwritten. + rpc Grant(MsgGrant) returns (MsgGrantResponse); + + // Exec attempts to execute the provided messages using + // authorizations granted to the grantee. Each message should have only + // one signer corresponding to the granter of the authorization. + rpc Exec(MsgExec) returns (MsgExecResponse); + + // Revoke revokes any authorization corresponding to the provided method name on the + // granter's account that has been granted to the grantee. + rpc Revoke(MsgRevoke) returns (MsgRevokeResponse); +} + +// MsgGrant is a request type for Grant method. It declares authorization to the grantee +// on behalf of the granter with the provided expiration time. +message MsgGrant { + string granter = 1; + string grantee = 2; + + cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false]; +} + +// MsgExecResponse defines the Msg/MsgExecResponse response type. +message MsgExecResponse { + repeated bytes results = 1; +} + +// MsgExec attempts to execute the provided messages using +// authorizations granted to the grantee. Each message should have only +// one signer corresponding to the granter of the authorization. +message MsgExec { + string grantee = 1; + // Authorization Msg requests to execute. Each msg must implement Authorization interface + // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + // triple and validate it. + repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "sdk.Msg, authz.Authorization"]; +} + +// MsgGrantResponse defines the Msg/MsgGrant response type. +message MsgGrantResponse {} + +// MsgRevoke revokes any authorization with the provided sdk.Msg type on the +// granter's account with that has been granted to the grantee. +message MsgRevoke { + string granter = 1; + string grantee = 2; + string msg_type_url = 3; +} + +// MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. +message MsgRevokeResponse {} diff --git a/third_party/proto/cosmos/bank/v1beta1/authz.proto b/third_party/proto/cosmos/bank/v1beta1/authz.proto new file mode 100644 index 00000000..f3505ad4 --- /dev/null +++ b/third_party/proto/cosmos/bank/v1beta1/authz.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; + +// SendAuthorization allows the grantee to spend up to spend_limit coins from +// the granter's account. +message SendAuthorization { + option (cosmos_proto.implements_interface) = "Authorization"; + + repeated cosmos.base.v1beta1.Coin spend_limit = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} diff --git a/third_party/proto/cosmos/bank/v1beta1/bank.proto b/third_party/proto/cosmos/bank/v1beta1/bank.proto new file mode 100644 index 00000000..eb843b2c --- /dev/null +++ b/third_party/proto/cosmos/bank/v1beta1/bank.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; + +// Params defines the parameters for the bank module. +message Params { + option (gogoproto.goproto_stringer) = false; + repeated SendEnabled send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled,omitempty\""]; + bool default_send_enabled = 2 [(gogoproto.moretags) = "yaml:\"default_send_enabled,omitempty\""]; +} + +// SendEnabled maps coin denom to a send_enabled status (whether a denom is +// sendable). +message SendEnabled { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + string denom = 1; + bool enabled = 2; +} + +// Input models transaction input. +message Input { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string address = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// Output models transaction outputs. +message Output { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string address = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// Supply represents a struct that passively keeps track of the total supply +// amounts in the network. +// This message is deprecated now that supply is indexed by denom. +message Supply { + option deprecated = true; + + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + + option (cosmos_proto.implements_interface) = "*github.com/cosmos/cosmos-sdk/x/bank/legacy/v040.SupplyI"; + + repeated cosmos.base.v1beta1.Coin total = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// 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 = 1^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 Metadata { + 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) + string name = 5; + // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + // be the same as the display. + string symbol = 6; +} diff --git a/third_party/proto/cosmos/bank/v1beta1/genesis.proto b/third_party/proto/cosmos/bank/v1beta1/genesis.proto new file mode 100644 index 00000000..8fd7329a --- /dev/null +++ b/third_party/proto/cosmos/bank/v1beta1/genesis.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; + +// GenesisState defines the bank module's genesis state. +message GenesisState { + // params defines all the paramaters of the module. + Params params = 1 [(gogoproto.nullable) = false]; + + // balances is an array containing the balances of all the accounts. + repeated Balance balances = 2 [(gogoproto.nullable) = false]; + + // supply represents the total supply. If it is left empty, then supply will be calculated based on the provided + // balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. + repeated cosmos.base.v1beta1.Coin supply = 3 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; + + // denom_metadata defines the metadata of the differents coins. + repeated Metadata denom_metadata = 4 [(gogoproto.moretags) = "yaml:\"denom_metadata\"", (gogoproto.nullable) = false]; +} + +// Balance defines an account address and balance pair used in the bank module's +// genesis state. +message Balance { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address of the balance holder. + string address = 1; + + // coins defines the different coins this balance holds. + repeated cosmos.base.v1beta1.Coin coins = 2 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/bank/v1beta1/query.proto b/third_party/proto/cosmos/bank/v1beta1/query.proto new file mode 100644 index 00000000..e3a464f8 --- /dev/null +++ b/third_party/proto/cosmos/bank/v1beta1/query.proto @@ -0,0 +1,159 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; + +// Query defines the gRPC querier service. +service Query { + // Balance queries the balance of a single coin for a single account. + rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/{denom}"; + } + + // AllBalances queries the balance of all coins for a single account. + rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; + } + + // TotalSupply queries the total supply of all coins. + rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; + } + + // SupplyOf queries the supply of a single coin. + rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/supply/{denom}"; + } + + // Params queries the parameters of x/bank module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/params"; + } + + // DenomsMetadata queries the client metadata of a given coin denomination. + rpc DenomMetadata(QueryDenomMetadataRequest) returns (QueryDenomMetadataResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom}"; + } + + // DenomsMetadata queries the client metadata for all registered coin denominations. + rpc DenomsMetadata(QueryDenomsMetadataRequest) returns (QueryDenomsMetadataResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata"; + } +} + +// QueryBalanceRequest is the request type for the Query/Balance RPC method. +message QueryBalanceRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address to query balances for. + string address = 1; + + // denom is the coin denom to query balances for. + string denom = 2; +} + +// QueryBalanceResponse is the response type for the Query/Balance RPC method. +message QueryBalanceResponse { + // balance is the balance of the coin. + cosmos.base.v1beta1.Coin balance = 1; +} + +// QueryBalanceRequest is the request type for the Query/AllBalances RPC method. +message QueryAllBalancesRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address to query balances for. + string address = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC +// method. +message QueryAllBalancesResponse { + // balances is the balances of all the coins. + repeated cosmos.base.v1beta1.Coin balances = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC +// method. +message QueryTotalSupplyRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC +// method +message QueryTotalSupplyResponse { + // supply is the supply of the coins + repeated cosmos.base.v1beta1.Coin supply = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. +message QuerySupplyOfRequest { + // denom is the coin denom to query balances for. + string denom = 1; +} + +// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. +message QuerySupplyOfResponse { + // amount is the supply of the coin. + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; +} + +// QueryParamsRequest defines the request type for querying x/bank parameters. +message QueryParamsRequest {} + +// QueryParamsResponse defines the response type for querying x/bank parameters. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. +message QueryDenomsMetadataRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC +// method. +message QueryDenomsMetadataResponse { + // metadata provides the client information for all the registered tokens. + repeated Metadata metadatas = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. +message QueryDenomMetadataRequest { + // denom is the coin denom to query the metadata for. + string denom = 1; +} + +// QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC +// method. +message QueryDenomMetadataResponse { + // metadata describes and provides all the client information for the requested token. + Metadata metadata = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/bank/v1beta1/tx.proto b/third_party/proto/cosmos/bank/v1beta1/tx.proto new file mode 100644 index 00000000..26b2ab41 --- /dev/null +++ b/third_party/proto/cosmos/bank/v1beta1/tx.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; + +// Msg defines the bank Msg service. +service Msg { + // Send defines a method for sending coins from one account to another account. + rpc Send(MsgSend) returns (MsgSendResponse); + + // MultiSend defines a method for sending coins from some accounts to other accounts. + rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse); +} + +// MsgSend represents a message to send coins from one account to another. +message MsgSend { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; + string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// MsgSendResponse defines the Msg/Send response type. +message MsgSendResponse {} + +// MsgMultiSend represents an arbitrary multi-in, multi-out send message. +message MsgMultiSend { + option (gogoproto.equal) = false; + + repeated Input inputs = 1 [(gogoproto.nullable) = false]; + repeated Output outputs = 2 [(gogoproto.nullable) = false]; +} + +// MsgMultiSendResponse defines the Msg/MultiSend response type. +message MsgMultiSendResponse {} diff --git a/third_party/proto/cosmos/base/abci/v1beta1/abci.proto b/third_party/proto/cosmos/base/abci/v1beta1/abci.proto new file mode 100644 index 00000000..72da2aac --- /dev/null +++ b/third_party/proto/cosmos/base/abci/v1beta1/abci.proto @@ -0,0 +1,137 @@ +syntax = "proto3"; +package cosmos.base.abci.v1beta1; + +import "gogoproto/gogo.proto"; +import "tendermint/abci/types.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; + +// TxResponse defines a structure containing relevant tx data and metadata. The +// tags are stringified and the log is JSON decoded. +message TxResponse { + option (gogoproto.goproto_getters) = false; + // The block height + int64 height = 1; + // The transaction hash. + string txhash = 2 [(gogoproto.customname) = "TxHash"]; + // Namespace for the Code + string codespace = 3; + // Response code. + uint32 code = 4; + // Result bytes, if any. + string data = 5; + // The output of the application's logger (raw string). May be + // non-deterministic. + string raw_log = 6; + // The output of the application's logger (typed). May be non-deterministic. + repeated ABCIMessageLog logs = 7 [(gogoproto.castrepeated) = "ABCIMessageLogs", (gogoproto.nullable) = false]; + // Additional information. May be non-deterministic. + string info = 8; + // Amount of gas requested for transaction. + int64 gas_wanted = 9; + // Amount of gas consumed by transaction. + int64 gas_used = 10; + // The request transaction bytes. + google.protobuf.Any tx = 11; + // Time of the previous block. For heights > 1, it's the weighted median of + // the timestamps of the valid votes in the block.LastCommit. For height == 1, + // it's genesis time. + string timestamp = 12; +} + +// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. +message ABCIMessageLog { + option (gogoproto.stringer) = true; + + uint32 msg_index = 1; + string log = 2; + + // Events contains a slice of Event objects that were emitted during some + // execution. + repeated StringEvent events = 3 [(gogoproto.castrepeated) = "StringEvents", (gogoproto.nullable) = false]; +} + +// StringEvent defines en Event object wrapper where all the attributes +// contain key/value pairs that are strings instead of raw bytes. +message StringEvent { + option (gogoproto.stringer) = true; + + string type = 1; + repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; +} + +// Attribute defines an attribute wrapper where the key and value are +// strings instead of raw bytes. +message Attribute { + string key = 1; + string value = 2; +} + +// GasInfo defines tx execution gas context. +message GasInfo { + // GasWanted is the maximum units of work we allow this tx to perform. + uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""]; + + // GasUsed is the amount of gas actually consumed. + uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""]; +} + +// Result is the union of ResponseFormat and ResponseCheckTx. +message Result { + option (gogoproto.goproto_getters) = false; + + // Data is any data returned from message or handler execution. It MUST be + // length prefixed in order to separate data from multiple message executions. + bytes data = 1; + + // Log contains the log information from message or handler execution. + string log = 2; + + // Events contains a slice of Event objects that were emitted during message + // or handler execution. + repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false]; +} + +// SimulationResponse defines the response generated when a transaction is +// successfully simulated. +message SimulationResponse { + GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Result result = 2; +} + +// MsgData defines the data returned in a Result object during message +// execution. +message MsgData { + option (gogoproto.stringer) = true; + + string msg_type = 1; + bytes data = 2; +} + +// TxMsgData defines a list of MsgData. A transaction will have a MsgData object +// for each message. +message TxMsgData { + option (gogoproto.stringer) = true; + + repeated MsgData data = 1; +} + +// SearchTxsResult defines a structure for querying txs pageable +message SearchTxsResult { + option (gogoproto.stringer) = true; + + // Count of all txs + uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"]; + // Count of txs in current page + uint64 count = 2; + // Index of current page, start from 1 + uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"]; + // Count of total pages + uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"]; + // Max count txs per page + uint64 limit = 5; + // List of txs in current page + repeated TxResponse txs = 6; +} diff --git a/third_party/proto/cosmos/base/kv/v1beta1/kv.proto b/third_party/proto/cosmos/base/kv/v1beta1/kv.proto new file mode 100644 index 00000000..4e9b8d28 --- /dev/null +++ b/third_party/proto/cosmos/base/kv/v1beta1/kv.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package cosmos.base.kv.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types/kv"; + +// Pairs defines a repeated slice of Pair objects. +message Pairs { + repeated Pair pairs = 1 [(gogoproto.nullable) = false]; +} + +// Pair defines a key/value bytes tuple. +message Pair { + bytes key = 1; + bytes value = 2; +} diff --git a/third_party/proto/cosmos/base/query/v1beta1/pagination.proto b/third_party/proto/cosmos/base/query/v1beta1/pagination.proto new file mode 100644 index 00000000..784c4795 --- /dev/null +++ b/third_party/proto/cosmos/base/query/v1beta1/pagination.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; +package cosmos.base.query.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/types/query"; + +// PageRequest is to be embedded in gRPC request messages for efficient +// pagination. Ex: +// +// message SomeRequest { +// Foo some_parameter = 1; +// PageRequest pagination = 2; +// } +message PageRequest { + // key is a value returned in PageResponse.next_key to begin + // querying the next page most efficiently. Only one of offset or key + // should be set. + bytes key = 1; + + // offset is a numeric offset that can be used when key is unavailable. + // It is less efficient than using key. Only one of offset or key should + // be set. + uint64 offset = 2; + + // limit is the total number of results to be returned in the result page. + // If left empty it will default to a value to be set by each app. + uint64 limit = 3; + + // count_total is set to true to indicate that the result set should include + // a count of the total number of items available for pagination in UIs. + // count_total is only respected when offset is used. It is ignored when key + // is set. + bool count_total = 4; + + // reverse is set to true if results are to be returned in the descending order. + bool reverse = 5; +} + +// PageResponse is to be embedded in gRPC response messages where the +// corresponding request message has used PageRequest. +// +// message SomeResponse { +// repeated Bar results = 1; +// PageResponse page = 2; +// } +message PageResponse { + // next_key is the key to be passed to PageRequest.key to + // query the next page most efficiently + bytes next_key = 1; + + // total is total number of results available if PageRequest.count_total + // was set, its value is undefined otherwise + uint64 total = 2; +} diff --git a/third_party/proto/cosmos/base/reflection/v1beta1/reflection.proto b/third_party/proto/cosmos/base/reflection/v1beta1/reflection.proto new file mode 100644 index 00000000..22670e72 --- /dev/null +++ b/third_party/proto/cosmos/base/reflection/v1beta1/reflection.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package cosmos.base.reflection.v1beta1; + +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/reflection"; + +// ReflectionService defines a service for interface reflection. +service ReflectionService { + // ListAllInterfaces lists all the interfaces registered in the interface + // registry. + rpc ListAllInterfaces(ListAllInterfacesRequest) returns (ListAllInterfacesResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces"; + }; + + // ListImplementations list all the concrete types that implement a given + // interface. + rpc ListImplementations(ListImplementationsRequest) returns (ListImplementationsResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/interfaces/" + "{interface_name}/implementations"; + }; +} + +// ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. +message ListAllInterfacesRequest {} + +// ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. +message ListAllInterfacesResponse { + // interface_names is an array of all the registered interfaces. + repeated string interface_names = 1; +} + +// ListImplementationsRequest is the request type of the ListImplementations +// RPC. +message ListImplementationsRequest { + // interface_name defines the interface to query the implementations for. + string interface_name = 1; +} + +// ListImplementationsResponse is the response type of the ListImplementations +// RPC. +message ListImplementationsResponse { + repeated string implementation_message_names = 1; +} diff --git a/third_party/proto/cosmos/base/reflection/v2alpha1/reflection.proto b/third_party/proto/cosmos/base/reflection/v2alpha1/reflection.proto new file mode 100644 index 00000000..3e8e9404 --- /dev/null +++ b/third_party/proto/cosmos/base/reflection/v2alpha1/reflection.proto @@ -0,0 +1,217 @@ +syntax = "proto3"; +package cosmos.base.reflection.v2alpha1; + +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/server/grpc/reflection/v2alpha1"; + +// AppDescriptor describes a cosmos-sdk based application +message AppDescriptor { + // AuthnDescriptor provides information on how to authenticate transactions on the application + // NOTE: experimental and subject to change in future releases. + AuthnDescriptor authn = 1; + // chain provides the chain descriptor + ChainDescriptor chain = 2; + // codec provides metadata information regarding codec related types + CodecDescriptor codec = 3; + // configuration provides metadata information regarding the sdk.Config type + ConfigurationDescriptor configuration = 4; + // query_services provides metadata information regarding the available queriable endpoints + QueryServicesDescriptor query_services = 5; + // tx provides metadata information regarding how to send transactions to the given application + TxDescriptor tx = 6; +} + +// TxDescriptor describes the accepted transaction type +message TxDescriptor { + // fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type) + // it is not meant to support polymorphism of transaction types, it is supposed to be used by + // reflection clients to understand if they can handle a specific transaction type in an application. + string fullname = 1; + // msgs lists the accepted application messages (sdk.Msg) + repeated MsgDescriptor msgs = 2; +} + +// AuthnDescriptor provides information on how to sign transactions without relying +// on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures +message AuthnDescriptor { + // sign_modes defines the supported signature algorithm + repeated SigningModeDescriptor sign_modes = 1; +} + +// SigningModeDescriptor provides information on a signing flow of the application +// NOTE(fdymylja): here we could go as far as providing an entire flow on how +// to sign a message given a SigningModeDescriptor, but it's better to think about +// this another time +message SigningModeDescriptor { + // name defines the unique name of the signing mode + string name = 1; + // number is the unique int32 identifier for the sign_mode enum + int32 number = 2; + // authn_info_provider_method_fullname defines the fullname of the method to call to get + // the metadata required to authenticate using the provided sign_modes + string authn_info_provider_method_fullname = 3; +} + +// ChainDescriptor describes chain information of the application +message ChainDescriptor { + // id is the chain id + string id = 1; +} + +// CodecDescriptor describes the registered interfaces and provides metadata information on the types +message CodecDescriptor { + // interfaces is a list of the registerted interfaces descriptors + repeated InterfaceDescriptor interfaces = 1; +} + +// InterfaceDescriptor describes the implementation of an interface +message InterfaceDescriptor { + // fullname is the name of the interface + string fullname = 1; + // interface_accepting_messages contains information regarding the proto messages which contain the interface as + // google.protobuf.Any field + repeated InterfaceAcceptingMessageDescriptor interface_accepting_messages = 2; + // interface_implementers is a list of the descriptors of the interface implementers + repeated InterfaceImplementerDescriptor interface_implementers = 3; +} + +// InterfaceImplementerDescriptor describes an interface implementer +message InterfaceImplementerDescriptor { + // fullname is the protobuf queryable name of the interface implementer + string fullname = 1; + // type_url defines the type URL used when marshalling the type as any + // this is required so we can provide type safe google.protobuf.Any marshalling and + // unmarshalling, making sure that we don't accept just 'any' type + // in our interface fields + string type_url = 2; +} + +// InterfaceAcceptingMessageDescriptor describes a protobuf message which contains +// an interface represented as a google.protobuf.Any +message InterfaceAcceptingMessageDescriptor { + // fullname is the protobuf fullname of the type containing the interface + string fullname = 1; + // field_descriptor_names is a list of the protobuf name (not fullname) of the field + // which contains the interface as google.protobuf.Any (the interface is the same, but + // it can be in multiple fields of the same proto message) + repeated string field_descriptor_names = 2; +} + +// ConfigurationDescriptor contains metadata information on the sdk.Config +message ConfigurationDescriptor { + // bech32_account_address_prefix is the account address prefix + string bech32_account_address_prefix = 1; +} + +// MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction +message MsgDescriptor { + // msg_type_url contains the TypeURL of a sdk.Msg. + string msg_type_url = 1; +} + +// ReflectionService defines a service for application reflection. +service ReflectionService { + // GetAuthnDescriptor returns information on how to authenticate transactions in the application + // NOTE: this RPC is still experimental and might be subject to breaking changes or removal in + // future releases of the cosmos-sdk. + rpc GetAuthnDescriptor(GetAuthnDescriptorRequest) returns (GetAuthnDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/authn"; + } + // GetChainDescriptor returns the description of the chain + rpc GetChainDescriptor(GetChainDescriptorRequest) returns (GetChainDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/chain"; + }; + // GetCodecDescriptor returns the descriptor of the codec of the application + rpc GetCodecDescriptor(GetCodecDescriptorRequest) returns (GetCodecDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/codec"; + } + // GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application + rpc GetConfigurationDescriptor(GetConfigurationDescriptorRequest) returns (GetConfigurationDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/configuration"; + } + // GetQueryServicesDescriptor returns the available gRPC queryable services of the application + rpc GetQueryServicesDescriptor(GetQueryServicesDescriptorRequest) returns (GetQueryServicesDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/query_services"; + } + // GetTxDescriptor returns information on the used transaction object and available msgs that can be used + rpc GetTxDescriptor(GetTxDescriptorRequest) returns (GetTxDescriptorResponse) { + option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/tx_descriptor"; + } +} + +// GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC +message GetAuthnDescriptorRequest {} +// GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC +message GetAuthnDescriptorResponse { + // authn describes how to authenticate to the application when sending transactions + AuthnDescriptor authn = 1; +} + +// GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC +message GetChainDescriptorRequest {} +// GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC +message GetChainDescriptorResponse { + // chain describes application chain information + ChainDescriptor chain = 1; +} + +// GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC +message GetCodecDescriptorRequest {} +// GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC +message GetCodecDescriptorResponse { + // codec describes the application codec such as registered interfaces and implementations + CodecDescriptor codec = 1; +} + +// GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC +message GetConfigurationDescriptorRequest {} +// GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC +message GetConfigurationDescriptorResponse { + // config describes the application's sdk.Config + ConfigurationDescriptor config = 1; +} + +// GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC +message GetQueryServicesDescriptorRequest {} +// GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC +message GetQueryServicesDescriptorResponse { + // queries provides information on the available queryable services + QueryServicesDescriptor queries = 1; +} + +// GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC +message GetTxDescriptorRequest {} +// GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC +message GetTxDescriptorResponse { + // tx provides information on msgs that can be forwarded to the application + // alongside the accepted transaction protobuf type + TxDescriptor tx = 1; +} + +// QueryServicesDescriptor contains the list of cosmos-sdk queriable services +message QueryServicesDescriptor { + // query_services is a list of cosmos-sdk QueryServiceDescriptor + repeated QueryServiceDescriptor query_services = 1; +} + +// QueryServiceDescriptor describes a cosmos-sdk queryable service +message QueryServiceDescriptor { + // fullname is the protobuf fullname of the service descriptor + string fullname = 1; + // is_module describes if this service is actually exposed by an application's module + bool is_module = 2; + // methods provides a list of query service methods + repeated QueryMethodDescriptor methods = 3; +} + +// QueryMethodDescriptor describes a queryable method of a query service +// no other info is provided beside method name and tendermint queryable path +// because it would be redundant with the grpc reflection service +message QueryMethodDescriptor { + // name is the protobuf name (not fullname) of the method + string name = 1; + // full_query_path is the path that can be used to query + // this method via tendermint abci.Query + string full_query_path = 2; +} diff --git a/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto new file mode 100644 index 00000000..9ac5a7c3 --- /dev/null +++ b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package cosmos.base.snapshots.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types"; + +// Snapshot contains Tendermint state sync snapshot info. +message Snapshot { + uint64 height = 1; + uint32 format = 2; + uint32 chunks = 3; + bytes hash = 4; + Metadata metadata = 5 [(gogoproto.nullable) = false]; +} + +// Metadata contains SDK-specific snapshot metadata. +message Metadata { + repeated bytes chunk_hashes = 1; // SHA-256 chunk hashes +} \ No newline at end of file diff --git a/third_party/proto/cosmos/base/store/v1beta1/commit_info.proto b/third_party/proto/cosmos/base/store/v1beta1/commit_info.proto new file mode 100644 index 00000000..98a33d30 --- /dev/null +++ b/third_party/proto/cosmos/base/store/v1beta1/commit_info.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package cosmos.base.store.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/store/types"; + +// CommitInfo defines commit information used by the multi-store when committing +// a version/height. +message CommitInfo { + int64 version = 1; + repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; +} + +// StoreInfo defines store-specific commit information. It contains a reference +// between a store name and the commit ID. +message StoreInfo { + string name = 1; + CommitID commit_id = 2 [(gogoproto.nullable) = false]; +} + +// CommitID defines the committment information when a specific store is +// committed. +message CommitID { + option (gogoproto.goproto_stringer) = false; + + int64 version = 1; + bytes hash = 2; +} diff --git a/third_party/proto/cosmos/base/store/v1beta1/listening.proto b/third_party/proto/cosmos/base/store/v1beta1/listening.proto new file mode 100644 index 00000000..186ecee4 --- /dev/null +++ b/third_party/proto/cosmos/base/store/v1beta1/listening.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package cosmos.base.store.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/store/types"; + +// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) +// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and +// Deletes +message StoreKVPair { + string store_key = 1; // the store key for the KVStore this pair originates from + bool delete = 2; // true indicates a delete operation, false indicates a set operation + bytes key = 3; + bytes value = 4; +} diff --git a/third_party/proto/cosmos/base/store/v1beta1/snapshot.proto b/third_party/proto/cosmos/base/store/v1beta1/snapshot.proto new file mode 100644 index 00000000..83485509 --- /dev/null +++ b/third_party/proto/cosmos/base/store/v1beta1/snapshot.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package cosmos.base.store.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/store/types"; + +// SnapshotItem is an item contained in a rootmulti.Store snapshot. +message SnapshotItem { + // item is the specific type of snapshot item. + oneof item { + SnapshotStoreItem store = 1; + SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"]; + } +} + +// SnapshotStoreItem contains metadata about a snapshotted store. +message SnapshotStoreItem { + string name = 1; +} + +// SnapshotIAVLItem is an exported IAVL node. +message SnapshotIAVLItem { + bytes key = 1; + bytes value = 2; + int64 version = 3; + int32 height = 4; +} \ No newline at end of file diff --git a/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto new file mode 100644 index 00000000..c98110cb --- /dev/null +++ b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto @@ -0,0 +1,136 @@ +syntax = "proto3"; +package cosmos.base.tendermint.v1beta1; + +import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; +import "tendermint/p2p/types.proto"; +import "tendermint/types/block.proto"; +import "tendermint/types/types.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; + +// Service defines the gRPC querier service for tendermint queries. +service Service { + // GetNodeInfo queries the current node info. + rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/node_info"; + } + // GetSyncing queries node syncing. + rpc GetSyncing(GetSyncingRequest) returns (GetSyncingResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/syncing"; + } + // GetLatestBlock returns the latest block. + rpc GetLatestBlock(GetLatestBlockRequest) returns (GetLatestBlockResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/latest"; + } + // GetBlockByHeight queries block for given height. + rpc GetBlockByHeight(GetBlockByHeightRequest) returns (GetBlockByHeightResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/{height}"; + } + + // GetLatestValidatorSet queries latest validator-set. + rpc GetLatestValidatorSet(GetLatestValidatorSetRequest) returns (GetLatestValidatorSetResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/latest"; + } + // GetValidatorSetByHeight queries validator-set at a given height. + rpc GetValidatorSetByHeight(GetValidatorSetByHeightRequest) returns (GetValidatorSetByHeightResponse) { + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/{height}"; + } +} + +// GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. +message GetValidatorSetByHeightRequest { + int64 height = 1; + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. +message GetValidatorSetByHeightResponse { + int64 block_height = 1; + repeated Validator validators = 2; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 3; +} + +// GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. +message GetLatestValidatorSetRequest { + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. +message GetLatestValidatorSetResponse { + int64 block_height = 1; + repeated Validator validators = 2; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 3; +} + +// Validator is the type for the validator-set. +message Validator { + string address = 1; + google.protobuf.Any pub_key = 2; + int64 voting_power = 3; + int64 proposer_priority = 4; +} + +// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. +message GetBlockByHeightRequest { + int64 height = 1; +} + +// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. +message GetBlockByHeightResponse { + .tendermint.types.BlockID block_id = 1; + .tendermint.types.Block block = 2; +} + +// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. +message GetLatestBlockRequest {} + +// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. +message GetLatestBlockResponse { + .tendermint.types.BlockID block_id = 1; + .tendermint.types.Block block = 2; +} + +// GetSyncingRequest is the request type for the Query/GetSyncing RPC method. +message GetSyncingRequest {} + +// GetSyncingResponse is the response type for the Query/GetSyncing RPC method. +message GetSyncingResponse { + bool syncing = 1; +} + +// GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. +message GetNodeInfoRequest {} + +// GetNodeInfoResponse is the request type for the Query/GetNodeInfo RPC method. +message GetNodeInfoResponse { + .tendermint.p2p.DefaultNodeInfo default_node_info = 1; + VersionInfo application_version = 2; +} + +// VersionInfo is the type for the GetNodeInfoResponse message. +message VersionInfo { + string name = 1; + string app_name = 2; + string version = 3; + string git_commit = 4; + string build_tags = 5; + string go_version = 6; + repeated Module build_deps = 7; + string cosmos_sdk_version = 8; +} + +// Module is the type for VersionInfo +message Module { + // module path + string path = 1; + // module version + string version = 2; + // checksum + string sum = 3; +} diff --git a/third_party/proto/cosmos/base/v1beta1/coin.proto b/third_party/proto/cosmos/base/v1beta1/coin.proto new file mode 100644 index 00000000..fab75284 --- /dev/null +++ b/third_party/proto/cosmos/base/v1beta1/coin.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package cosmos.base.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; + +// Coin defines a token with a denomination and an amount. +// +// NOTE: The amount field is an Int which implements the custom method +// signatures required by gogoproto. +message Coin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecCoin defines a token with a denomination and a decimal amount. +// +// NOTE: The amount field is an Dec which implements the custom method +// signatures required by gogoproto. +message DecCoin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} + +// IntProto defines a Protobuf wrapper around an Int object. +message IntProto { + string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecProto defines a Protobuf wrapper around a Dec object. +message DecProto { + string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/capability/v1beta1/capability.proto b/third_party/proto/cosmos/capability/v1beta1/capability.proto new file mode 100644 index 00000000..1c8332f3 --- /dev/null +++ b/third_party/proto/cosmos/capability/v1beta1/capability.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package cosmos.capability.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types"; + +import "gogoproto/gogo.proto"; + +// Capability defines an implementation of an object capability. The index +// provided to a Capability must be globally unique. +message Capability { + option (gogoproto.goproto_stringer) = false; + + uint64 index = 1 [(gogoproto.moretags) = "yaml:\"index\""]; +} + +// Owner defines a single capability owner. An owner is defined by the name of +// capability and the module name. +message Owner { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + + string module = 1 [(gogoproto.moretags) = "yaml:\"module\""]; + string name = 2 [(gogoproto.moretags) = "yaml:\"name\""]; +} + +// CapabilityOwners defines a set of owners of a single Capability. The set of +// owners must be unique. +message CapabilityOwners { + repeated Owner owners = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/capability/v1beta1/genesis.proto b/third_party/proto/cosmos/capability/v1beta1/genesis.proto new file mode 100644 index 00000000..05bb0afc --- /dev/null +++ b/third_party/proto/cosmos/capability/v1beta1/genesis.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package cosmos.capability.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/capability/v1beta1/capability.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types"; + +// GenesisOwners defines the capability owners with their corresponding index. +message GenesisOwners { + // index is the index of the capability owner. + uint64 index = 1; + + // index_owners are the owners at the given index. + CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"index_owners\""]; +} + +// GenesisState defines the capability module's genesis state. +message GenesisState { + // index is the capability global index. + uint64 index = 1; + + // owners represents a map from index to owners of the capability index + // index key is string to allow amino marshalling. + repeated GenesisOwners owners = 2 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/crisis/v1beta1/genesis.proto b/third_party/proto/cosmos/crisis/v1beta1/genesis.proto new file mode 100644 index 00000000..5b0ff7ec --- /dev/null +++ b/third_party/proto/cosmos/crisis/v1beta1/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package cosmos.crisis.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// GenesisState defines the crisis module's genesis state. +message GenesisState { + // constant_fee is the fee used to verify the invariant in the crisis + // module. + cosmos.base.v1beta1.Coin constant_fee = 3 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"constant_fee\""]; +} diff --git a/third_party/proto/cosmos/crisis/v1beta1/tx.proto b/third_party/proto/cosmos/crisis/v1beta1/tx.proto new file mode 100644 index 00000000..26457ad6 --- /dev/null +++ b/third_party/proto/cosmos/crisis/v1beta1/tx.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package cosmos.crisis.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types"; + +import "gogoproto/gogo.proto"; + +// Msg defines the bank Msg service. +service Msg { + // VerifyInvariant defines a method to verify a particular invariance. + rpc VerifyInvariant(MsgVerifyInvariant) returns (MsgVerifyInvariantResponse); +} + +// MsgVerifyInvariant represents a message to verify a particular invariance. +message MsgVerifyInvariant { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string sender = 1; + string invariant_module_name = 2 [(gogoproto.moretags) = "yaml:\"invariant_module_name\""]; + string invariant_route = 3 [(gogoproto.moretags) = "yaml:\"invariant_route\""]; +} + +// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. +message MsgVerifyInvariantResponse {} diff --git a/third_party/proto/cosmos/crypto/ed25519/keys.proto b/third_party/proto/cosmos/crypto/ed25519/keys.proto new file mode 100644 index 00000000..6ffec344 --- /dev/null +++ b/third_party/proto/cosmos/crypto/ed25519/keys.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package cosmos.crypto.ed25519; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"; + +// PubKey is an ed25519 public key for handling Tendermint keys in SDK. +// It's needed for Any serialization and SDK compatibility. +// It must not be used in a non Tendermint key context because it doesn't implement +// ADR-28. Nevertheless, you will like to use ed25519 in app user level +// then you must create a new proto message and follow ADR-28 for Address construction. +message PubKey { + option (gogoproto.goproto_stringer) = false; + + bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"]; +} + +// Deprecated: PrivKey defines a ed25519 private key. +// NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. +message PrivKey { + bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PrivateKey"]; +} diff --git a/third_party/proto/cosmos/crypto/multisig/keys.proto b/third_party/proto/cosmos/crypto/multisig/keys.proto new file mode 100644 index 00000000..f8398e80 --- /dev/null +++ b/third_party/proto/cosmos/crypto/multisig/keys.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package cosmos.crypto.multisig; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"; + +// LegacyAminoPubKey specifies a public key type +// which nests multiple public keys and a threshold, +// it uses legacy amino address rules. +message LegacyAminoPubKey { + option (gogoproto.goproto_getters) = false; + + uint32 threshold = 1 [(gogoproto.moretags) = "yaml:\"threshold\""]; + repeated google.protobuf.Any public_keys = 2 + [(gogoproto.customname) = "PubKeys", (gogoproto.moretags) = "yaml:\"pubkeys\""]; +} diff --git a/third_party/proto/cosmos/crypto/multisig/v1beta1/multisig.proto b/third_party/proto/cosmos/crypto/multisig/v1beta1/multisig.proto new file mode 100644 index 00000000..bf671f17 --- /dev/null +++ b/third_party/proto/cosmos/crypto/multisig/v1beta1/multisig.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package cosmos.crypto.multisig.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/crypto/types"; + +// MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. +// See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers +// signed and with which modes. +message MultiSignature { + option (gogoproto.goproto_unrecognized) = true; + repeated bytes signatures = 1; +} + +// CompactBitArray is an implementation of a space efficient bit array. +// This is used to ensure that the encoded data takes up a minimal amount of +// space after proto encoding. +// This is not thread safe, and is not intended for concurrent usage. +message CompactBitArray { + option (gogoproto.goproto_stringer) = false; + + uint32 extra_bits_stored = 1; + bytes elems = 2; +} diff --git a/third_party/proto/cosmos/crypto/secp256k1/keys.proto b/third_party/proto/cosmos/crypto/secp256k1/keys.proto new file mode 100644 index 00000000..a2272571 --- /dev/null +++ b/third_party/proto/cosmos/crypto/secp256k1/keys.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package cosmos.crypto.secp256k1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"; + +// PubKey defines a secp256k1 public key +// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte +// if the y-coordinate is the lexicographically largest of the two associated with +// the x-coordinate. Otherwise the first byte is a 0x03. +// This prefix is followed with the x-coordinate. +message PubKey { + option (gogoproto.goproto_stringer) = false; + + bytes key = 1; +} + +// PrivKey defines a secp256k1 private key. +message PrivKey { + bytes key = 1; +} diff --git a/third_party/proto/cosmos/crypto/secp256r1/keys.proto b/third_party/proto/cosmos/crypto/secp256r1/keys.proto new file mode 100644 index 00000000..b0aad99d --- /dev/null +++ b/third_party/proto/cosmos/crypto/secp256r1/keys.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package cosmos.crypto.secp256r1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1"; +option (gogoproto.messagename_all) = true; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.goproto_getters_all) = false; + +// PubKey defines a secp256r1 ECDSA public key. +message PubKey { + // Point on secp256r1 curve in a compressed representation as specified in section + // 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998 + bytes key = 1 [(gogoproto.customtype) = "ecdsaPK"]; +} + +// PrivKey defines a secp256r1 ECDSA private key. +message PrivKey { + // secret number serialized using big-endian encoding + bytes secret = 1 [(gogoproto.customtype) = "ecdsaSK"]; +} diff --git a/third_party/proto/cosmos/distribution/v1beta1/distribution.proto b/third_party/proto/cosmos/distribution/v1beta1/distribution.proto new file mode 100644 index 00000000..ae98ec0b --- /dev/null +++ b/third_party/proto/cosmos/distribution/v1beta1/distribution.proto @@ -0,0 +1,157 @@ +syntax = "proto3"; +package cosmos.distribution.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// Params defines the set of params for the distribution module. +message Params { + option (gogoproto.goproto_stringer) = false; + string community_tax = 1 [ + (gogoproto.moretags) = "yaml:\"community_tax\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string base_proposer_reward = 2 [ + (gogoproto.moretags) = "yaml:\"base_proposer_reward\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string bonus_proposer_reward = 3 [ + (gogoproto.moretags) = "yaml:\"bonus_proposer_reward\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + bool withdraw_addr_enabled = 4 [(gogoproto.moretags) = "yaml:\"withdraw_addr_enabled\""]; +} + +// ValidatorHistoricalRewards represents historical rewards for a validator. +// Height is implicit within the store key. +// Cumulative reward ratio is the sum from the zeroeth period +// until this period of rewards / tokens, per the spec. +// The reference count indicates the number of objects +// which might need to reference this historical entry at any point. +// ReferenceCount = +// number of outstanding delegations which ended the associated period (and +// might need to read that record) +// + number of slashes which ended the associated period (and might need to +// read that record) +// + one per validator for the zeroeth period, set on initialization +message ValidatorHistoricalRewards { + repeated cosmos.base.v1beta1.DecCoin cumulative_reward_ratio = 1 [ + (gogoproto.moretags) = "yaml:\"cumulative_reward_ratio\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; + uint32 reference_count = 2 [(gogoproto.moretags) = "yaml:\"reference_count\""]; +} + +// ValidatorCurrentRewards represents current rewards and current +// period for a validator kept as a running counter and incremented +// each block as long as the validator's tokens remain constant. +message ValidatorCurrentRewards { + repeated cosmos.base.v1beta1.DecCoin rewards = 1 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + uint64 period = 2; +} + +// ValidatorAccumulatedCommission represents accumulated commission +// for a validator kept as a running counter, can be withdrawn at any time. +message ValidatorAccumulatedCommission { + repeated cosmos.base.v1beta1.DecCoin commission = 1 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; +} + +// ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards +// for a validator inexpensive to track, allows simple sanity checks. +message ValidatorOutstandingRewards { + repeated cosmos.base.v1beta1.DecCoin rewards = 1 [ + (gogoproto.moretags) = "yaml:\"rewards\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; +} + +// ValidatorSlashEvent represents a validator slash event. +// Height is implicit within the store key. +// This is needed to calculate appropriate amount of staking tokens +// for delegations which are withdrawn after a slash has occurred. +message ValidatorSlashEvent { + uint64 validator_period = 1 [(gogoproto.moretags) = "yaml:\"validator_period\""]; + string fraction = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +// ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. +message ValidatorSlashEvents { + option (gogoproto.goproto_stringer) = false; + repeated ValidatorSlashEvent validator_slash_events = 1 + [(gogoproto.moretags) = "yaml:\"validator_slash_events\"", (gogoproto.nullable) = false]; +} + +// FeePool is the global fee pool for distribution. +message FeePool { + repeated cosmos.base.v1beta1.DecCoin community_pool = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.moretags) = "yaml:\"community_pool\"" + ]; +} + +// CommunityPoolSpendProposal details a proposal for use of community funds, +// together with how many coins are proposed to be spent, and to which +// recipient account. +message CommunityPoolSpendProposal { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + string recipient = 3; + repeated cosmos.base.v1beta1.Coin amount = 4 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// DelegatorStartingInfo represents the starting info for a delegator reward +// period. It tracks the previous validator period, the delegation's amount of +// staking token, and the creation height (to check later on if any slashes have +// occurred). NOTE: Even though validators are slashed to whole staking tokens, +// the delegators within the validator may be left with less than a full token, +// thus sdk.Dec is used. +message DelegatorStartingInfo { + uint64 previous_period = 1 [(gogoproto.moretags) = "yaml:\"previous_period\""]; + string stake = 2 [ + (gogoproto.moretags) = "yaml:\"stake\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + uint64 height = 3 [(gogoproto.moretags) = "yaml:\"creation_height\"", (gogoproto.jsontag) = "creation_height"]; +} + +// DelegationDelegatorReward represents the properties +// of a delegator's delegation reward. +message DelegationDelegatorReward { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = true; + + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + + repeated cosmos.base.v1beta1.DecCoin reward = 2 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; +} + +// CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal +// with a deposit +message CommunityPoolSpendProposalWithDeposit { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = true; + + string title = 1 [(gogoproto.moretags) = "yaml:\"title\""]; + string description = 2 [(gogoproto.moretags) = "yaml:\"description\""]; + string recipient = 3 [(gogoproto.moretags) = "yaml:\"recipient\""]; + string amount = 4 [(gogoproto.moretags) = "yaml:\"amount\""]; + string deposit = 5 [(gogoproto.moretags) = "yaml:\"deposit\""]; +} diff --git a/third_party/proto/cosmos/distribution/v1beta1/genesis.proto b/third_party/proto/cosmos/distribution/v1beta1/genesis.proto new file mode 100644 index 00000000..c0b17cdf --- /dev/null +++ b/third_party/proto/cosmos/distribution/v1beta1/genesis.proto @@ -0,0 +1,155 @@ +syntax = "proto3"; +package cosmos.distribution.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/distribution/v1beta1/distribution.proto"; + +// DelegatorWithdrawInfo is the address for where distributions rewards are +// withdrawn to by default this struct is only used at genesis to feed in +// default withdraw addresses. +message DelegatorWithdrawInfo { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_address is the address of the delegator. + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + + // withdraw_address is the address to withdraw the delegation rewards to. + string withdraw_address = 2 [(gogoproto.moretags) = "yaml:\"withdraw_address\""]; +} + +// ValidatorOutstandingRewardsRecord is used for import/export via genesis json. +message ValidatorOutstandingRewardsRecord { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // validator_address is the address of the validator. + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + + // outstanding_rewards represents the oustanding rewards of a validator. + repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"outstanding_rewards\"" + ]; +} + +// ValidatorAccumulatedCommissionRecord is used for import / export via genesis +// json. +message ValidatorAccumulatedCommissionRecord { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // validator_address is the address of the validator. + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + + // accumulated is the accumulated commission of a validator. + ValidatorAccumulatedCommission accumulated = 2 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"accumulated\""]; +} + +// ValidatorHistoricalRewardsRecord is used for import / export via genesis +// json. +message ValidatorHistoricalRewardsRecord { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // validator_address is the address of the validator. + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + + // period defines the period the historical rewards apply to. + uint64 period = 2; + + // rewards defines the historical rewards of a validator. + ValidatorHistoricalRewards rewards = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"rewards\""]; +} + +// ValidatorCurrentRewardsRecord is used for import / export via genesis json. +message ValidatorCurrentRewardsRecord { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // validator_address is the address of the validator. + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + + // rewards defines the current rewards of a validator. + ValidatorCurrentRewards rewards = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"rewards\""]; +} + +// DelegatorStartingInfoRecord used for import / export via genesis json. +message DelegatorStartingInfoRecord { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_address is the address of the delegator. + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + + // validator_address is the address of the validator. + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + + // starting_info defines the starting info of a delegator. + DelegatorStartingInfo starting_info = 3 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"starting_info\""]; +} + +// ValidatorSlashEventRecord is used for import / export via genesis json. +message ValidatorSlashEventRecord { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // validator_address is the address of the validator. + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + // height defines the block height at which the slash event occured. + uint64 height = 2; + // period is the period of the slash event. + uint64 period = 3; + // validator_slash_event describes the slash event. + ValidatorSlashEvent validator_slash_event = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"event\""]; +} + +// GenesisState defines the distribution module's genesis state. +message GenesisState { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // params defines all the paramaters of the module. + Params params = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"params\""]; + + // fee_pool defines the fee pool at genesis. + FeePool fee_pool = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"fee_pool\""]; + + // fee_pool defines the delegator withdraw infos at genesis. + repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"delegator_withdraw_infos\""]; + + // fee_pool defines the previous proposer at genesis. + string previous_proposer = 4 [(gogoproto.moretags) = "yaml:\"previous_proposer\""]; + + // fee_pool defines the outstanding rewards of all validators at genesis. + repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"outstanding_rewards\""]; + + // fee_pool defines the accumulated commisions of all validators at genesis. + repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_accumulated_commissions\""]; + + // fee_pool defines the historical rewards of all validators at genesis. + repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_historical_rewards\""]; + + // fee_pool defines the current rewards of all validators at genesis. + repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_current_rewards\""]; + + // fee_pool defines the delegator starting infos at genesis. + repeated DelegatorStartingInfoRecord delegator_starting_infos = 9 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"delegator_starting_infos\""]; + + // fee_pool defines the validator slash events at genesis. + repeated ValidatorSlashEventRecord validator_slash_events = 10 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_slash_events\""]; +} diff --git a/third_party/proto/cosmos/distribution/v1beta1/query.proto b/third_party/proto/cosmos/distribution/v1beta1/query.proto new file mode 100644 index 00000000..2991218d --- /dev/null +++ b/third_party/proto/cosmos/distribution/v1beta1/query.proto @@ -0,0 +1,218 @@ +syntax = "proto3"; +package cosmos.distribution.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/distribution/v1beta1/distribution.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types"; + +// Query defines the gRPC querier service for distribution module. +service Query { + // Params queries params of the distribution module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/params"; + } + + // ValidatorOutstandingRewards queries rewards of a validator address. + rpc ValidatorOutstandingRewards(QueryValidatorOutstandingRewardsRequest) + returns (QueryValidatorOutstandingRewardsResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/" + "{validator_address}/outstanding_rewards"; + } + + // ValidatorCommission queries accumulated commission for a validator. + rpc ValidatorCommission(QueryValidatorCommissionRequest) returns (QueryValidatorCommissionResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/" + "{validator_address}/commission"; + } + + // ValidatorSlashes queries slash events of a validator. + rpc ValidatorSlashes(QueryValidatorSlashesRequest) returns (QueryValidatorSlashesResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}/slashes"; + } + + // DelegationRewards queries the total rewards accrued by a delegation. + rpc DelegationRewards(QueryDelegationRewardsRequest) returns (QueryDelegationRewardsResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/" + "{validator_address}"; + } + + // DelegationTotalRewards queries the total rewards accrued by a each + // validator. + rpc DelegationTotalRewards(QueryDelegationTotalRewardsRequest) returns (QueryDelegationTotalRewardsResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards"; + } + + // DelegatorValidators queries the validators of a delegator. + rpc DelegatorValidators(QueryDelegatorValidatorsRequest) returns (QueryDelegatorValidatorsResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/" + "{delegator_address}/validators"; + } + + // DelegatorWithdrawAddress queries withdraw address of a delegator. + rpc DelegatorWithdrawAddress(QueryDelegatorWithdrawAddressRequest) returns (QueryDelegatorWithdrawAddressResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/" + "{delegator_address}/withdraw_address"; + } + + // CommunityPool queries the community pool coins. + rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/community_pool"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryValidatorOutstandingRewardsRequest is the request type for the +// Query/ValidatorOutstandingRewards RPC method. +message QueryValidatorOutstandingRewardsRequest { + // validator_address defines the validator address to query for. + string validator_address = 1; +} + +// QueryValidatorOutstandingRewardsResponse is the response type for the +// Query/ValidatorOutstandingRewards RPC method. +message QueryValidatorOutstandingRewardsResponse { + ValidatorOutstandingRewards rewards = 1 [(gogoproto.nullable) = false]; +} + +// QueryValidatorCommissionRequest is the request type for the +// Query/ValidatorCommission RPC method +message QueryValidatorCommissionRequest { + // validator_address defines the validator address to query for. + string validator_address = 1; +} + +// QueryValidatorCommissionResponse is the response type for the +// Query/ValidatorCommission RPC method +message QueryValidatorCommissionResponse { + // commission defines the commision the validator received. + ValidatorAccumulatedCommission commission = 1 [(gogoproto.nullable) = false]; +} + +// QueryValidatorSlashesRequest is the request type for the +// Query/ValidatorSlashes RPC method +message QueryValidatorSlashesRequest { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = true; + + // validator_address defines the validator address to query for. + string validator_address = 1; + // starting_height defines the optional starting height to query the slashes. + uint64 starting_height = 2; + // starting_height defines the optional ending height to query the slashes. + uint64 ending_height = 3; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 4; +} + +// QueryValidatorSlashesResponse is the response type for the +// Query/ValidatorSlashes RPC method. +message QueryValidatorSlashesResponse { + // slashes defines the slashes the validator received. + repeated ValidatorSlashEvent slashes = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegationRewardsRequest is the request type for the +// Query/DelegationRewards RPC method. +message QueryDelegationRewardsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_address defines the delegator address to query for. + string delegator_address = 1; + // validator_address defines the validator address to query for. + string validator_address = 2; +} + +// QueryDelegationRewardsResponse is the response type for the +// Query/DelegationRewards RPC method. +message QueryDelegationRewardsResponse { + // rewards defines the rewards accrued by a delegation. + repeated cosmos.base.v1beta1.DecCoin rewards = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; +} + +// QueryDelegationTotalRewardsRequest is the request type for the +// Query/DelegationTotalRewards RPC method. +message QueryDelegationTotalRewardsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // delegator_address defines the delegator address to query for. + string delegator_address = 1; +} + +// QueryDelegationTotalRewardsResponse is the response type for the +// Query/DelegationTotalRewards RPC method. +message QueryDelegationTotalRewardsResponse { + // rewards defines all the rewards accrued by a delegator. + repeated DelegationDelegatorReward rewards = 1 [(gogoproto.nullable) = false]; + // total defines the sum of all the rewards. + repeated cosmos.base.v1beta1.DecCoin total = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; +} + +// QueryDelegatorValidatorsRequest is the request type for the +// Query/DelegatorValidators RPC method. +message QueryDelegatorValidatorsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_address defines the delegator address to query for. + string delegator_address = 1; +} + +// QueryDelegatorValidatorsResponse is the response type for the +// Query/DelegatorValidators RPC method. +message QueryDelegatorValidatorsResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // validators defines the validators a delegator is delegating for. + repeated string validators = 1; +} + +// QueryDelegatorWithdrawAddressRequest is the request type for the +// Query/DelegatorWithdrawAddress RPC method. +message QueryDelegatorWithdrawAddressRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_address defines the delegator address to query for. + string delegator_address = 1; +} + +// QueryDelegatorWithdrawAddressResponse is the response type for the +// Query/DelegatorWithdrawAddress RPC method. +message QueryDelegatorWithdrawAddressResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // withdraw_address defines the delegator address to query for. + string withdraw_address = 1; +} + +// QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC +// method. +message QueryCommunityPoolRequest {} + +// QueryCommunityPoolResponse is the response type for the Query/CommunityPool +// RPC method. +message QueryCommunityPoolResponse { + // pool defines community pool's coins. + repeated cosmos.base.v1beta1.DecCoin pool = 1 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/distribution/v1beta1/tx.proto b/third_party/proto/cosmos/distribution/v1beta1/tx.proto new file mode 100644 index 00000000..e6ce478b --- /dev/null +++ b/third_party/proto/cosmos/distribution/v1beta1/tx.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; +package cosmos.distribution.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// Msg defines the distribution Msg service. +service Msg { + // SetWithdrawAddress defines a method to change the withdraw address + // for a delegator (or validator self-delegation). + rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse); + + // WithdrawDelegatorReward defines a method to withdraw rewards of delegator + // from a single validator. + rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse); + + // WithdrawValidatorCommission defines a method to withdraw the + // full commission to the validator address. + rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse); + + // FundCommunityPool defines a method to allow an account to directly + // fund the community pool. + rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse); +} + +// MsgSetWithdrawAddress sets the withdraw address for +// a delegator (or validator self-delegation). +message MsgSetWithdrawAddress { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string withdraw_address = 2 [(gogoproto.moretags) = "yaml:\"withdraw_address\""]; +} + +// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. +message MsgSetWithdrawAddressResponse {} + +// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator +// from a single validator. +message MsgWithdrawDelegatorReward { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; +} + +// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. +message MsgWithdrawDelegatorRewardResponse {} + +// MsgWithdrawValidatorCommission withdraws the full commission to the validator +// address. +message MsgWithdrawValidatorCommission { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; +} + +// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. +message MsgWithdrawValidatorCommissionResponse {} + +// MsgFundCommunityPool allows an account to directly +// fund the community pool. +message MsgFundCommunityPool { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + repeated cosmos.base.v1beta1.Coin amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + string depositor = 2; +} + +// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. +message MsgFundCommunityPoolResponse {} diff --git a/third_party/proto/cosmos/evidence/v1beta1/evidence.proto b/third_party/proto/cosmos/evidence/v1beta1/evidence.proto new file mode 100644 index 00000000..14612c31 --- /dev/null +++ b/third_party/proto/cosmos/evidence/v1beta1/evidence.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +package cosmos.evidence.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +// Equivocation implements the Evidence interface and defines evidence of double +// signing misbehavior. +message Equivocation { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + + int64 height = 1; + google.protobuf.Timestamp time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + int64 power = 3; + string consensus_address = 4 [(gogoproto.moretags) = "yaml:\"consensus_address\""]; +} \ No newline at end of file diff --git a/third_party/proto/cosmos/evidence/v1beta1/genesis.proto b/third_party/proto/cosmos/evidence/v1beta1/genesis.proto new file mode 100644 index 00000000..199f446f --- /dev/null +++ b/third_party/proto/cosmos/evidence/v1beta1/genesis.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package cosmos.evidence.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; + +import "google/protobuf/any.proto"; + +// GenesisState defines the evidence module's genesis state. +message GenesisState { + // evidence defines all the evidence at genesis. + repeated google.protobuf.Any evidence = 1; +} diff --git a/third_party/proto/cosmos/evidence/v1beta1/query.proto b/third_party/proto/cosmos/evidence/v1beta1/query.proto new file mode 100644 index 00000000..eda00544 --- /dev/null +++ b/third_party/proto/cosmos/evidence/v1beta1/query.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; +package cosmos.evidence.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; + +// Query defines the gRPC querier service. +service Query { + // Evidence queries evidence based on evidence hash. + rpc Evidence(QueryEvidenceRequest) returns (QueryEvidenceResponse) { + option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence/{evidence_hash}"; + } + + // AllEvidence queries all evidence. + rpc AllEvidence(QueryAllEvidenceRequest) returns (QueryAllEvidenceResponse) { + option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence"; + } +} + +// QueryEvidenceRequest is the request type for the Query/Evidence RPC method. +message QueryEvidenceRequest { + // evidence_hash defines the hash of the requested evidence. + bytes evidence_hash = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; +} + +// QueryEvidenceResponse is the response type for the Query/Evidence RPC method. +message QueryEvidenceResponse { + // evidence returns the requested evidence. + google.protobuf.Any evidence = 1; +} + +// QueryEvidenceRequest is the request type for the Query/AllEvidence RPC +// method. +message QueryAllEvidenceRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryAllEvidenceResponse is the response type for the Query/AllEvidence RPC +// method. +message QueryAllEvidenceResponse { + // evidence returns all evidences. + repeated google.protobuf.Any evidence = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/third_party/proto/cosmos/evidence/v1beta1/tx.proto b/third_party/proto/cosmos/evidence/v1beta1/tx.proto new file mode 100644 index 00000000..38795f25 --- /dev/null +++ b/third_party/proto/cosmos/evidence/v1beta1/tx.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package cosmos.evidence.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; + +// Msg defines the evidence Msg service. +service Msg { + // SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or + // counterfactual signing. + rpc SubmitEvidence(MsgSubmitEvidence) returns (MsgSubmitEvidenceResponse); +} + +// MsgSubmitEvidence represents a message that supports submitting arbitrary +// Evidence of misbehavior such as equivocation or counterfactual signing. +message MsgSubmitEvidence { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string submitter = 1; + google.protobuf.Any evidence = 2 [(cosmos_proto.accepts_interface) = "Evidence"]; +} + +// MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. +message MsgSubmitEvidenceResponse { + // hash defines the hash of the evidence. + bytes hash = 4; +} diff --git a/third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto b/third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto new file mode 100644 index 00000000..dfd9b782 --- /dev/null +++ b/third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; +package cosmos.feegrant.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; + +// BasicAllowance implements Allowance with a one-time grant of tokens +// that optionally expires. The grantee can use up to SpendLimit to cover fees. +message BasicAllowance { + option (cosmos_proto.implements_interface) = "FeeAllowanceI"; + + // spend_limit specifies the maximum amount of tokens that can be spent + // by this allowance and will be updated as tokens are spent. If it is + // empty, there is no spend limit and any amount of coins can be spent. + repeated cosmos.base.v1beta1.Coin spend_limit = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // expiration specifies an optional time when this allowance expires + google.protobuf.Timestamp expiration = 2 [(gogoproto.stdtime) = true]; +} + +// PeriodicAllowance extends Allowance to allow for both a maximum cap, +// as well as a limit per time period. +message PeriodicAllowance { + option (cosmos_proto.implements_interface) = "FeeAllowanceI"; + + // basic specifies a struct of `BasicAllowance` + BasicAllowance basic = 1 [(gogoproto.nullable) = false]; + + // period specifies the time duration in which period_spend_limit coins can + // be spent before that allowance is reset + google.protobuf.Duration period = 2 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; + + // period_spend_limit specifies the maximum number of coins that can be spent + // in the period + repeated cosmos.base.v1beta1.Coin period_spend_limit = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // period_can_spend is the number of coins left to be spent before the period_reset time + repeated cosmos.base.v1beta1.Coin period_can_spend = 4 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // period_reset is the time at which this period resets and a new one begins, + // it is calculated from the start time of the first transaction after the + // last period ended + google.protobuf.Timestamp period_reset = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} + +// AllowedMsgAllowance creates allowance only for specified message types. +message AllowedMsgAllowance { + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "FeeAllowanceI"; + + // allowance can be any of basic and filtered fee allowance. + google.protobuf.Any allowance = 1 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; + + // allowed_messages are the messages for which the grantee has the access. + repeated string allowed_messages = 2; +} + +// Grant is stored in the KVStore to record a grant with full context +message Grant { + // granter is the address of the user granting an allowance of their funds. + string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. + string grantee = 2; + + // allowance can be any of basic and filtered fee allowance. + google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; +} diff --git a/third_party/proto/cosmos/feegrant/v1beta1/genesis.proto b/third_party/proto/cosmos/feegrant/v1beta1/genesis.proto new file mode 100644 index 00000000..4c1e51fd --- /dev/null +++ b/third_party/proto/cosmos/feegrant/v1beta1/genesis.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package cosmos.feegrant.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/feegrant/v1beta1/feegrant.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; + +// GenesisState contains a set of fee allowances, persisted from the store +message GenesisState { + repeated Grant allowances = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/feegrant/v1beta1/query.proto b/third_party/proto/cosmos/feegrant/v1beta1/query.proto new file mode 100644 index 00000000..00ea598b --- /dev/null +++ b/third_party/proto/cosmos/feegrant/v1beta1/query.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; +package cosmos.feegrant.v1beta1; + +import "cosmos/feegrant/v1beta1/feegrant.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; + +// Query defines the gRPC querier service. +service Query { + + // Allowance returns fee granted to the grantee by the granter. + rpc Allowance(QueryAllowanceRequest) returns (QueryAllowanceResponse) { + option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}"; + } + + // Allowances returns all the grants for address. + rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) { + option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}"; + } +} + +// QueryAllowanceRequest is the request type for the Query/Allowance RPC method. +message QueryAllowanceRequest { + // granter is the address of the user granting an allowance of their funds. + string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. + string grantee = 2; +} + +// QueryAllowanceResponse is the response type for the Query/Allowance RPC method. +message QueryAllowanceResponse { + // allowance is a allowance granted for grantee by granter. + cosmos.feegrant.v1beta1.Grant allowance = 1; +} + +// QueryAllowancesRequest is the request type for the Query/Allowances RPC method. +message QueryAllowancesRequest { + string grantee = 1; + + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryAllowancesResponse is the response type for the Query/Allowances RPC method. +message QueryAllowancesResponse { + // allowances are allowance's granted for grantee by granter. + repeated cosmos.feegrant.v1beta1.Grant allowances = 1; + + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/third_party/proto/cosmos/feegrant/v1beta1/tx.proto b/third_party/proto/cosmos/feegrant/v1beta1/tx.proto new file mode 100644 index 00000000..e7134be2 --- /dev/null +++ b/third_party/proto/cosmos/feegrant/v1beta1/tx.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package cosmos.feegrant.v1beta1; + +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; + +// Msg defines the feegrant msg service. +service Msg { + + // GrantAllowance grants fee allowance to the grantee on the granter's + // account with the provided expiration time. + rpc GrantAllowance(MsgGrantAllowance) returns (MsgGrantAllowanceResponse); + + // RevokeAllowance revokes any fee allowance of granter's account that + // has been granted to the grantee. + rpc RevokeAllowance(MsgRevokeAllowance) returns (MsgRevokeAllowanceResponse); +} + +// MsgGrantAllowance adds permission for Grantee to spend up to Allowance +// of fees from the account of Granter. +message MsgGrantAllowance { + // granter is the address of the user granting an allowance of their funds. + string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. + string grantee = 2; + + // allowance can be any of basic and filtered fee allowance. + google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; +} + +// MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. +message MsgGrantAllowanceResponse {} + +// MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. +message MsgRevokeAllowance { + // granter is the address of the user granting an allowance of their funds. + string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. + string grantee = 2; +} + +// MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. +message MsgRevokeAllowanceResponse {} diff --git a/third_party/proto/cosmos/genutil/v1beta1/genesis.proto b/third_party/proto/cosmos/genutil/v1beta1/genesis.proto new file mode 100644 index 00000000..a0207793 --- /dev/null +++ b/third_party/proto/cosmos/genutil/v1beta1/genesis.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package cosmos.genutil.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/genutil/types"; + +// GenesisState defines the raw genesis transaction in JSON. +message GenesisState { + // gen_txs defines the genesis transactions. + repeated bytes gen_txs = 1 [ + (gogoproto.casttype) = "encoding/json.RawMessage", + (gogoproto.jsontag) = "gentxs", + (gogoproto.moretags) = "yaml:\"gentxs\"" + ]; +} diff --git a/third_party/proto/cosmos/gov/v1beta1/genesis.proto b/third_party/proto/cosmos/gov/v1beta1/genesis.proto new file mode 100644 index 00000000..a9995004 --- /dev/null +++ b/third_party/proto/cosmos/gov/v1beta1/genesis.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package cosmos.gov.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/gov/v1beta1/gov.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; + +// GenesisState defines the gov module's genesis state. +message GenesisState { + // starting_proposal_id is the ID of the starting proposal. + uint64 starting_proposal_id = 1 [(gogoproto.moretags) = "yaml:\"starting_proposal_id\""]; + // deposits defines all the deposits present at genesis. + repeated Deposit deposits = 2 [(gogoproto.castrepeated) = "Deposits", (gogoproto.nullable) = false]; + // votes defines all the votes present at genesis. + repeated Vote votes = 3 [(gogoproto.castrepeated) = "Votes", (gogoproto.nullable) = false]; + // proposals defines all the proposals present at genesis. + repeated Proposal proposals = 4 [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false]; + // params defines all the paramaters of related to deposit. + DepositParams deposit_params = 5 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_params\""]; + // params defines all the paramaters of related to voting. + VotingParams voting_params = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_params\""]; + // params defines all the paramaters of related to tally. + TallyParams tally_params = 7 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tally_params\""]; +} diff --git a/third_party/proto/cosmos/gov/v1beta1/gov.proto b/third_party/proto/cosmos/gov/v1beta1/gov.proto new file mode 100644 index 00000000..f040772e --- /dev/null +++ b/third_party/proto/cosmos/gov/v1beta1/gov.proto @@ -0,0 +1,197 @@ +syntax = "proto3"; +package cosmos.gov.v1beta1; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; +option (gogoproto.goproto_getters_all) = false; + +// VoteOption enumerates the valid vote options for a given governance proposal. +enum VoteOption { + option (gogoproto.goproto_enum_prefix) = false; + + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + VOTE_OPTION_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "OptionEmpty"]; + // VOTE_OPTION_YES defines a yes vote option. + VOTE_OPTION_YES = 1 [(gogoproto.enumvalue_customname) = "OptionYes"]; + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + VOTE_OPTION_ABSTAIN = 2 [(gogoproto.enumvalue_customname) = "OptionAbstain"]; + // VOTE_OPTION_NO defines a no vote option. + VOTE_OPTION_NO = 3 [(gogoproto.enumvalue_customname) = "OptionNo"]; + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + VOTE_OPTION_NO_WITH_VETO = 4 [(gogoproto.enumvalue_customname) = "OptionNoWithVeto"]; +} + +// WeightedVoteOption defines a unit of vote for vote split. +message WeightedVoteOption { + VoteOption option = 1; + string weight = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"weight\"" + ]; +} + +// TextProposal defines a standard text proposal whose changes need to be +// manually updated in case of approval. +message TextProposal { + option (cosmos_proto.implements_interface) = "Content"; + + option (gogoproto.equal) = true; + + string title = 1; + string description = 2; +} + +// Deposit defines an amount deposited by an account address to an active +// proposal. +message Deposit { + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string depositor = 2; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// Proposal defines the core field members of a governance proposal. +message Proposal { + option (gogoproto.equal) = true; + + uint64 proposal_id = 1 [(gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""]; + google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"]; + ProposalStatus status = 3 [(gogoproto.moretags) = "yaml:\"proposal_status\""]; + TallyResult final_tally_result = 4 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"final_tally_result\""]; + google.protobuf.Timestamp submit_time = 5 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"submit_time\""]; + google.protobuf.Timestamp deposit_end_time = 6 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_end_time\""]; + repeated cosmos.base.v1beta1.Coin total_deposit = 7 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"total_deposit\"" + ]; + google.protobuf.Timestamp voting_start_time = 8 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_start_time\""]; + google.protobuf.Timestamp voting_end_time = 9 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_end_time\""]; +} + +// ProposalStatus enumerates the valid statuses of a proposal. +enum ProposalStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + PROPOSAL_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusNil"]; + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + // period. + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1 [(gogoproto.enumvalue_customname) = "StatusDepositPeriod"]; + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + // period. + PROPOSAL_STATUS_VOTING_PERIOD = 2 [(gogoproto.enumvalue_customname) = "StatusVotingPeriod"]; + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + PROPOSAL_STATUS_PASSED = 3 [(gogoproto.enumvalue_customname) = "StatusPassed"]; + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + PROPOSAL_STATUS_REJECTED = 4 [(gogoproto.enumvalue_customname) = "StatusRejected"]; + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + PROPOSAL_STATUS_FAILED = 5 [(gogoproto.enumvalue_customname) = "StatusFailed"]; +} + +// TallyResult defines a standard tally for a governance proposal. +message TallyResult { + option (gogoproto.equal) = true; + + string yes = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string abstain = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string no = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string no_with_veto = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"no_with_veto\"" + ]; +} + +// Vote defines a vote on a governance proposal. +// A Vote consists of a proposal ID, the voter, and the vote option. +message Vote { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + // Deprecated: Prefer to use `options` instead. This field is set in queries + // if and only if `len(options) == 1` and that option has weight 1. In all + // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + VoteOption option = 3 [deprecated = true]; + repeated WeightedVoteOption options = 4 [(gogoproto.nullable) = false]; +} + +// DepositParams defines the params for deposits on governance proposals. +message DepositParams { + // Minimum deposit for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"min_deposit\"", + (gogoproto.jsontag) = "min_deposit,omitempty" + ]; + + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + google.protobuf.Duration max_deposit_period = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "max_deposit_period,omitempty", + (gogoproto.moretags) = "yaml:\"max_deposit_period\"" + ]; +} + +// VotingParams defines the params for voting on governance proposals. +message VotingParams { + // Length of the voting period. + google.protobuf.Duration voting_period = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "voting_period,omitempty", + (gogoproto.moretags) = "yaml:\"voting_period\"" + ]; +} + +// TallyParams defines the params for tallying votes on governance proposals. +message TallyParams { + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + bytes quorum = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "quorum,omitempty" + ]; + + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + bytes threshold = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "threshold,omitempty" + ]; + + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + bytes veto_threshold = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "veto_threshold,omitempty", + (gogoproto.moretags) = "yaml:\"veto_threshold\"" + ]; +} diff --git a/third_party/proto/cosmos/gov/v1beta1/query.proto b/third_party/proto/cosmos/gov/v1beta1/query.proto new file mode 100644 index 00000000..da62bdba --- /dev/null +++ b/third_party/proto/cosmos/gov/v1beta1/query.proto @@ -0,0 +1,190 @@ +syntax = "proto3"; +package cosmos.gov.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/gov/v1beta1/gov.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; + +// Query defines the gRPC querier service for gov module +service Query { + // Proposal queries proposal details based on ProposalID. + rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}"; + } + + // Proposals queries all proposals based on given status. + rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals"; + } + + // Vote queries voted information based on proposalID, voterAddr. + rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter}"; + } + + // Votes queries votes of a given proposal. + rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/votes"; + } + + // Params queries all parameters of the gov module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/params/{params_type}"; + } + + // Deposit queries single deposit information based proposalID, depositAddr. + rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}"; + } + + // Deposits queries all deposits of a single proposal. + rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits"; + } + + // TallyResult queries the tally of a proposal vote. + rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { + option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/tally"; + } +} + +// QueryProposalRequest is the request type for the Query/Proposal RPC method. +message QueryProposalRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} + +// QueryProposalResponse is the response type for the Query/Proposal RPC method. +message QueryProposalResponse { + Proposal proposal = 1 [(gogoproto.nullable) = false]; +} + +// QueryProposalsRequest is the request type for the Query/Proposals RPC method. +message QueryProposalsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // proposal_status defines the status of the proposals. + ProposalStatus proposal_status = 1; + + // voter defines the voter address for the proposals. + string voter = 2; + + // depositor defines the deposit addresses from the proposals. + string depositor = 3; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 4; +} + +// QueryProposalsResponse is the response type for the Query/Proposals RPC +// method. +message QueryProposalsResponse { + repeated Proposal proposals = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryVoteRequest is the request type for the Query/Vote RPC method. +message QueryVoteRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // voter defines the oter address for the proposals. + string voter = 2; +} + +// QueryVoteResponse is the response type for the Query/Vote RPC method. +message QueryVoteResponse { + // vote defined the queried vote. + Vote vote = 1 [(gogoproto.nullable) = false]; +} + +// QueryVotesRequest is the request type for the Query/Votes RPC method. +message QueryVotesRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryVotesResponse is the response type for the Query/Votes RPC method. +message QueryVotesResponse { + // votes defined the queried votes. + repeated Vote votes = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest { + // params_type defines which parameters to query for, can be one of "voting", + // "tallying" or "deposit". + string params_type = 1; +} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // voting_params defines the parameters related to voting. + VotingParams voting_params = 1 [(gogoproto.nullable) = false]; + // deposit_params defines the parameters related to deposit. + DepositParams deposit_params = 2 [(gogoproto.nullable) = false]; + // tally_params defines the parameters related to tally. + TallyParams tally_params = 3 [(gogoproto.nullable) = false]; +} + +// QueryDepositRequest is the request type for the Query/Deposit RPC method. +message QueryDepositRequest { + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // depositor defines the deposit addresses from the proposals. + string depositor = 2; +} + +// QueryDepositResponse is the response type for the Query/Deposit RPC method. +message QueryDepositResponse { + // deposit defines the requested deposit. + Deposit deposit = 1 [(gogoproto.nullable) = false]; +} + +// QueryDepositsRequest is the request type for the Query/Deposits RPC method. +message QueryDepositsRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDepositsResponse is the response type for the Query/Deposits RPC method. +message QueryDepositsResponse { + repeated Deposit deposits = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryTallyResultRequest is the request type for the Query/Tally RPC method. +message QueryTallyResultRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} + +// QueryTallyResultResponse is the response type for the Query/Tally RPC method. +message QueryTallyResultResponse { + // tally defines the requested tally. + TallyResult tally = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/gov/v1beta1/tx.proto b/third_party/proto/cosmos/gov/v1beta1/tx.proto new file mode 100644 index 00000000..ecb1cdfe --- /dev/null +++ b/third_party/proto/cosmos/gov/v1beta1/tx.proto @@ -0,0 +1,93 @@ +syntax = "proto3"; +package cosmos.gov.v1beta1; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/gov/v1beta1/gov.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; + +// Msg defines the bank Msg service. +service Msg { + // SubmitProposal defines a method to create new proposal given a content. + rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); + + // Vote defines a method to add a vote on a specific proposal. + rpc Vote(MsgVote) returns (MsgVoteResponse); + + // VoteWeighted defines a method to add a weighted vote on a specific proposal. + rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse); + + // Deposit defines a method to add deposit on a specific proposal. + rpc Deposit(MsgDeposit) returns (MsgDepositResponse); +} + +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary +// proposal Content. +message MsgSubmitProposal { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"initial_deposit\"" + ]; + string proposer = 3; +} + +// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. +message MsgSubmitProposalResponse { + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; +} + +// MsgVote defines a message to cast a vote. +message MsgVote { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + VoteOption option = 3; +} + +// MsgVoteResponse defines the Msg/Vote response type. +message MsgVoteResponse {} + +// MsgVoteWeighted defines a message to cast a vote. +message MsgVoteWeighted { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""]; + string voter = 2; + repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false]; +} + +// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. +message MsgVoteWeightedResponse {} + +// MsgDeposit defines a message to submit a deposit to an existing proposal. +message MsgDeposit { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; + string depositor = 2; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// MsgDepositResponse defines the Msg/Deposit response type. +message MsgDepositResponse {} diff --git a/third_party/proto/cosmos/mint/v1beta1/genesis.proto b/third_party/proto/cosmos/mint/v1beta1/genesis.proto new file mode 100644 index 00000000..4e783fb5 --- /dev/null +++ b/third_party/proto/cosmos/mint/v1beta1/genesis.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package cosmos.mint.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/mint/v1beta1/mint.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; + +// GenesisState defines the mint module's genesis state. +message GenesisState { + // minter is a space for holding current inflation information. + Minter minter = 1 [(gogoproto.nullable) = false]; + + // params defines all the paramaters of the module. + Params params = 2 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/mint/v1beta1/mint.proto b/third_party/proto/cosmos/mint/v1beta1/mint.proto new file mode 100644 index 00000000..f94d4ae2 --- /dev/null +++ b/third_party/proto/cosmos/mint/v1beta1/mint.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; +package cosmos.mint.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; + +import "gogoproto/gogo.proto"; + +// Minter represents the minting state. +message Minter { + // current annual inflation rate + string inflation = 1 + [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + // current annual expected provisions + string annual_provisions = 2 [ + (gogoproto.moretags) = "yaml:\"annual_provisions\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// Params holds parameters for the mint module. +message Params { + option (gogoproto.goproto_stringer) = false; + + // type of coin to mint + string mint_denom = 1; + // maximum annual change in inflation rate + string inflation_rate_change = 2 [ + (gogoproto.moretags) = "yaml:\"inflation_rate_change\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // maximum inflation rate + string inflation_max = 3 [ + (gogoproto.moretags) = "yaml:\"inflation_max\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // minimum inflation rate + string inflation_min = 4 [ + (gogoproto.moretags) = "yaml:\"inflation_min\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // goal of percent bonded atoms + string goal_bonded = 5 [ + (gogoproto.moretags) = "yaml:\"goal_bonded\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // expected blocks per year + uint64 blocks_per_year = 6 [(gogoproto.moretags) = "yaml:\"blocks_per_year\""]; +} diff --git a/third_party/proto/cosmos/mint/v1beta1/query.proto b/third_party/proto/cosmos/mint/v1beta1/query.proto new file mode 100644 index 00000000..acd341d7 --- /dev/null +++ b/third_party/proto/cosmos/mint/v1beta1/query.proto @@ -0,0 +1,57 @@ +syntax = "proto3"; +package cosmos.mint.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/mint/v1beta1/mint.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; + +// Query provides defines the gRPC querier service. +service Query { + // Params returns the total set of minting parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/mint/v1beta1/params"; + } + + // Inflation returns the current minting inflation value. + rpc Inflation(QueryInflationRequest) returns (QueryInflationResponse) { + option (google.api.http).get = "/cosmos/mint/v1beta1/inflation"; + } + + // AnnualProvisions current minting annual provisions value. + rpc AnnualProvisions(QueryAnnualProvisionsRequest) returns (QueryAnnualProvisionsResponse) { + option (google.api.http).get = "/cosmos/mint/v1beta1/annual_provisions"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryInflationRequest is the request type for the Query/Inflation RPC method. +message QueryInflationRequest {} + +// QueryInflationResponse is the response type for the Query/Inflation RPC +// method. +message QueryInflationResponse { + // inflation is the current minting inflation value. + bytes inflation = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +// QueryAnnualProvisionsRequest is the request type for the +// Query/AnnualProvisions RPC method. +message QueryAnnualProvisionsRequest {} + +// QueryAnnualProvisionsResponse is the response type for the +// Query/AnnualProvisions RPC method. +message QueryAnnualProvisionsResponse { + // annual_provisions is the current minting annual provisions value. + bytes annual_provisions = 1 + [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/params/v1beta1/params.proto b/third_party/proto/cosmos/params/v1beta1/params.proto new file mode 100644 index 00000000..5382fd79 --- /dev/null +++ b/third_party/proto/cosmos/params/v1beta1/params.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package cosmos.params.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/params/types/proposal"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; + +// ParameterChangeProposal defines a proposal to change one or more parameters. +message ParameterChangeProposal { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + repeated ParamChange changes = 3 [(gogoproto.nullable) = false]; +} + +// ParamChange defines an individual parameter change, for use in +// ParameterChangeProposal. +message ParamChange { + option (gogoproto.goproto_stringer) = false; + + string subspace = 1; + string key = 2; + string value = 3; +} diff --git a/third_party/proto/cosmos/params/v1beta1/query.proto b/third_party/proto/cosmos/params/v1beta1/query.proto new file mode 100644 index 00000000..1078e02a --- /dev/null +++ b/third_party/proto/cosmos/params/v1beta1/query.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package cosmos.params.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/params/v1beta1/params.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/params/types/proposal"; + +// Query defines the gRPC querier service. +service Query { + // Params queries a specific parameter of a module, given its subspace and + // key. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/params/v1beta1/params"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest { + // subspace defines the module to query the parameter for. + string subspace = 1; + + // key defines the key of the parameter in the subspace. + string key = 2; +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // param defines the queried parameter. + ParamChange param = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/slashing/v1beta1/genesis.proto b/third_party/proto/cosmos/slashing/v1beta1/genesis.proto new file mode 100644 index 00000000..a7aebcfb --- /dev/null +++ b/third_party/proto/cosmos/slashing/v1beta1/genesis.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +package cosmos.slashing.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/slashing/v1beta1/slashing.proto"; + +// GenesisState defines the slashing module's genesis state. +message GenesisState { + // params defines all the paramaters of related to deposit. + Params params = 1 [(gogoproto.nullable) = false]; + + // signing_infos represents a map between validator addresses and their + // signing infos. + repeated SigningInfo signing_infos = 2 + [(gogoproto.moretags) = "yaml:\"signing_infos\"", (gogoproto.nullable) = false]; + + // missed_blocks represents a map between validator addresses and their + // missed blocks. + repeated ValidatorMissedBlocks missed_blocks = 3 + [(gogoproto.moretags) = "yaml:\"missed_blocks\"", (gogoproto.nullable) = false]; +} + +// SigningInfo stores validator signing info of corresponding address. +message SigningInfo { + // address is the validator address. + string address = 1; + // validator_signing_info represents the signing info of this validator. + ValidatorSigningInfo validator_signing_info = 2 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_signing_info\""]; +} + +// ValidatorMissedBlocks contains array of missed blocks of corresponding +// address. +message ValidatorMissedBlocks { + // address is the validator address. + string address = 1; + // missed_blocks is an array of missed blocks by the validator. + repeated MissedBlock missed_blocks = 2 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"missed_blocks\""]; +} + +// MissedBlock contains height and missed status as boolean. +message MissedBlock { + // index is the height at which the block was missed. + int64 index = 1; + // missed is the missed status. + bool missed = 2; +} diff --git a/third_party/proto/cosmos/slashing/v1beta1/query.proto b/third_party/proto/cosmos/slashing/v1beta1/query.proto new file mode 100644 index 00000000..869049a0 --- /dev/null +++ b/third_party/proto/cosmos/slashing/v1beta1/query.proto @@ -0,0 +1,63 @@ +syntax = "proto3"; +package cosmos.slashing.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/slashing/v1beta1/slashing.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; + +// Query provides defines the gRPC querier service +service Query { + // Params queries the parameters of slashing module + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/slashing/v1beta1/params"; + } + + // SigningInfo queries the signing info of given cons address + rpc SigningInfo(QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { + option (google.api.http).get = "/cosmos/slashing/v1beta1/signing_infos/{cons_address}"; + } + + // SigningInfos queries signing info of all validators + rpc SigningInfos(QuerySigningInfosRequest) returns (QuerySigningInfosResponse) { + option (google.api.http).get = "/cosmos/slashing/v1beta1/signing_infos"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC +// method +message QuerySigningInfoRequest { + // cons_address is the address to query signing info of + string cons_address = 1; +} + +// QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC +// method +message QuerySigningInfoResponse { + // val_signing_info is the signing info of requested val cons address + ValidatorSigningInfo val_signing_info = 1 [(gogoproto.nullable) = false]; +} + +// QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC +// method +message QuerySigningInfosRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC +// method +message QuerySigningInfosResponse { + // info is the signing info of all validators + repeated cosmos.slashing.v1beta1.ValidatorSigningInfo info = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/third_party/proto/cosmos/slashing/v1beta1/slashing.proto b/third_party/proto/cosmos/slashing/v1beta1/slashing.proto new file mode 100644 index 00000000..882a0fb6 --- /dev/null +++ b/third_party/proto/cosmos/slashing/v1beta1/slashing.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; +package cosmos.slashing.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +// ValidatorSigningInfo defines a validator's signing info for monitoring their +// liveness activity. +message ValidatorSigningInfo { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + string address = 1; + // Height at which validator was first a candidate OR was unjailed + int64 start_height = 2 [(gogoproto.moretags) = "yaml:\"start_height\""]; + // Index which is incremented each time the validator was a bonded + // in a block and may have signed a precommit or not. This in conjunction with the + // `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + int64 index_offset = 3 [(gogoproto.moretags) = "yaml:\"index_offset\""]; + // Timestamp until which the validator is jailed due to liveness downtime. + google.protobuf.Timestamp jailed_until = 4 + [(gogoproto.moretags) = "yaml:\"jailed_until\"", (gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // Whether or not a validator has been tombstoned (killed out of validator set). It is set + // once the validator commits an equivocation or for any other configured misbehiavor. + bool tombstoned = 5; + // A counter kept to avoid unnecessary array reads. + // Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + int64 missed_blocks_counter = 6 [(gogoproto.moretags) = "yaml:\"missed_blocks_counter\""]; +} + +// Params represents the parameters used for by the slashing module. +message Params { + int64 signed_blocks_window = 1 [(gogoproto.moretags) = "yaml:\"signed_blocks_window\""]; + bytes min_signed_per_window = 2 [ + (gogoproto.moretags) = "yaml:\"min_signed_per_window\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + google.protobuf.Duration downtime_jail_duration = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"downtime_jail_duration\"" + ]; + bytes slash_fraction_double_sign = 4 [ + (gogoproto.moretags) = "yaml:\"slash_fraction_double_sign\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + bytes slash_fraction_downtime = 5 [ + (gogoproto.moretags) = "yaml:\"slash_fraction_downtime\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} diff --git a/third_party/proto/cosmos/slashing/v1beta1/tx.proto b/third_party/proto/cosmos/slashing/v1beta1/tx.proto new file mode 100644 index 00000000..4d63370e --- /dev/null +++ b/third_party/proto/cosmos/slashing/v1beta1/tx.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package cosmos.slashing.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; +option (gogoproto.equal_all) = true; + +import "gogoproto/gogo.proto"; + +// Msg defines the slashing Msg service. +service Msg { + // Unjail defines a method for unjailing a jailed validator, thus returning + // them into the bonded validator set, so they can begin receiving provisions + // and rewards again. + rpc Unjail(MsgUnjail) returns (MsgUnjailResponse); +} + +// MsgUnjail defines the Msg/Unjail request type +message MsgUnjail { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = true; + + string validator_addr = 1 [(gogoproto.moretags) = "yaml:\"address\"", (gogoproto.jsontag) = "address"]; +} + +// MsgUnjailResponse defines the Msg/Unjail response type +message MsgUnjailResponse {} \ No newline at end of file diff --git a/third_party/proto/cosmos/staking/v1beta1/authz.proto b/third_party/proto/cosmos/staking/v1beta1/authz.proto new file mode 100644 index 00000000..6345612f --- /dev/null +++ b/third_party/proto/cosmos/staking/v1beta1/authz.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package cosmos.staking.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; + +// StakeAuthorization defines authorization for delegate/undelegate/redelegate. +message StakeAuthorization { + option (cosmos_proto.implements_interface) = "Authorization"; + + // max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is + // empty, there is no spend limit and any amount of coins can be delegated. + cosmos.base.v1beta1.Coin max_tokens = 1 [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin"]; + // validators is the oneof that represents either allow_list or deny_list + oneof validators { + // allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + // account. + Validators allow_list = 2; + // deny_list specifies list of validator addresses to whom grantee can not delegate tokens. + Validators deny_list = 3; + } + // Validators defines list of validator addresses. + message Validators { + repeated string address = 1; + } + // authorization_type defines one of AuthorizationType. + AuthorizationType authorization_type = 4; +} + +// AuthorizationType defines the type of staking module authorization type +enum AuthorizationType { + // AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type + AUTHORIZATION_TYPE_UNSPECIFIED = 0; + // AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate + AUTHORIZATION_TYPE_DELEGATE = 1; + // AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate + AUTHORIZATION_TYPE_UNDELEGATE = 2; + // AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate + AUTHORIZATION_TYPE_REDELEGATE = 3; +} diff --git a/third_party/proto/cosmos/staking/v1beta1/genesis.proto b/third_party/proto/cosmos/staking/v1beta1/genesis.proto new file mode 100644 index 00000000..d1563dbc --- /dev/null +++ b/third_party/proto/cosmos/staking/v1beta1/genesis.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; +package cosmos.staking.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/staking/v1beta1/staking.proto"; + +// GenesisState defines the staking module's genesis state. +message GenesisState { + // params defines all the paramaters of related to deposit. + Params params = 1 [(gogoproto.nullable) = false]; + + // last_total_power tracks the total amounts of bonded tokens recorded during + // the previous end block. + bytes last_total_power = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"last_total_power\"", + (gogoproto.nullable) = false + ]; + + // last_validator_powers is a special index that provides a historical list + // of the last-block's bonded validators. + repeated LastValidatorPower last_validator_powers = 3 + [(gogoproto.moretags) = "yaml:\"last_validator_powers\"", (gogoproto.nullable) = false]; + + // delegations defines the validator set at genesis. + repeated Validator validators = 4 [(gogoproto.nullable) = false]; + + // delegations defines the delegations active at genesis. + repeated Delegation delegations = 5 [(gogoproto.nullable) = false]; + + // unbonding_delegations defines the unbonding delegations active at genesis. + repeated UnbondingDelegation unbonding_delegations = 6 + [(gogoproto.moretags) = "yaml:\"unbonding_delegations\"", (gogoproto.nullable) = false]; + + // redelegations defines the redelegations active at genesis. + repeated Redelegation redelegations = 7 [(gogoproto.nullable) = false]; + + bool exported = 8; +} + +// LastValidatorPower required for validator set update logic. +message LastValidatorPower { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address of the validator. + string address = 1; + + // power defines the power of the validator. + int64 power = 2; +} diff --git a/third_party/proto/cosmos/staking/v1beta1/query.proto b/third_party/proto/cosmos/staking/v1beta1/query.proto new file mode 100644 index 00000000..4852c535 --- /dev/null +++ b/third_party/proto/cosmos/staking/v1beta1/query.proto @@ -0,0 +1,348 @@ +syntax = "proto3"; +package cosmos.staking.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/staking/v1beta1/staking.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; + +// Query defines the gRPC querier service. +service Query { + // Validators queries all validators that match the given status. + rpc Validators(QueryValidatorsRequest) returns (QueryValidatorsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/validators"; + } + + // Validator queries validator info for given validator address. + rpc Validator(QueryValidatorRequest) returns (QueryValidatorResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}"; + } + + // ValidatorDelegations queries delegate info for given validator. + rpc ValidatorDelegations(QueryValidatorDelegationsRequest) returns (QueryValidatorDelegationsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations"; + } + + // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + rpc ValidatorUnbondingDelegations(QueryValidatorUnbondingDelegationsRequest) + returns (QueryValidatorUnbondingDelegationsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/" + "{validator_addr}/unbonding_delegations"; + } + + // Delegation queries delegate info for given validator delegator pair. + rpc Delegation(QueryDelegationRequest) returns (QueryDelegationResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" + "{delegator_addr}"; + } + + // UnbondingDelegation queries unbonding info for given validator delegator + // pair. + rpc UnbondingDelegation(QueryUnbondingDelegationRequest) returns (QueryUnbondingDelegationResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" + "{delegator_addr}/unbonding_delegation"; + } + + // DelegatorDelegations queries all delegations of a given delegator address. + rpc DelegatorDelegations(QueryDelegatorDelegationsRequest) returns (QueryDelegatorDelegationsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/delegations/{delegator_addr}"; + } + + // DelegatorUnbondingDelegations queries all unbonding delegations of a given + // delegator address. + rpc DelegatorUnbondingDelegations(QueryDelegatorUnbondingDelegationsRequest) + returns (QueryDelegatorUnbondingDelegationsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/" + "{delegator_addr}/unbonding_delegations"; + } + + // Redelegations queries redelegations of given address. + rpc Redelegations(QueryRedelegationsRequest) returns (QueryRedelegationsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations"; + } + + // DelegatorValidators queries all validators info for given delegator + // address. + rpc DelegatorValidators(QueryDelegatorValidatorsRequest) returns (QueryDelegatorValidatorsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators"; + } + + // DelegatorValidator queries validator info for given delegator validator + // pair. + rpc DelegatorValidator(QueryDelegatorValidatorRequest) returns (QueryDelegatorValidatorResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/" + "{validator_addr}"; + } + + // HistoricalInfo queries the historical info for given height. + rpc HistoricalInfo(QueryHistoricalInfoRequest) returns (QueryHistoricalInfoResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/historical_info/{height}"; + } + + // Pool queries the pool info. + rpc Pool(QueryPoolRequest) returns (QueryPoolResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/pool"; + } + + // Parameters queries the staking parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/staking/v1beta1/params"; + } +} + +// QueryValidatorsRequest is request type for Query/Validators RPC method. +message QueryValidatorsRequest { + // status enables to query for validators matching a given status. + string status = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryValidatorsResponse is response type for the Query/Validators RPC method +message QueryValidatorsResponse { + // validators contains all the queried validators. + repeated Validator validators = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryValidatorRequest is response type for the Query/Validator RPC method +message QueryValidatorRequest { + // validator_addr defines the validator address to query for. + string validator_addr = 1; +} + +// QueryValidatorResponse is response type for the Query/Validator RPC method +message QueryValidatorResponse { + // validator defines the the validator info. + Validator validator = 1 [(gogoproto.nullable) = false]; +} + +// QueryValidatorDelegationsRequest is request type for the +// Query/ValidatorDelegations RPC method +message QueryValidatorDelegationsRequest { + // validator_addr defines the validator address to query for. + string validator_addr = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryValidatorDelegationsResponse is response type for the +// Query/ValidatorDelegations RPC method +message QueryValidatorDelegationsResponse { + repeated DelegationResponse delegation_responses = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "DelegationResponses"]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryValidatorUnbondingDelegationsRequest is required type for the +// Query/ValidatorUnbondingDelegations RPC method +message QueryValidatorUnbondingDelegationsRequest { + // validator_addr defines the validator address to query for. + string validator_addr = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryValidatorUnbondingDelegationsResponse is response type for the +// Query/ValidatorUnbondingDelegations RPC method. +message QueryValidatorUnbondingDelegationsResponse { + repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegationRequest is request type for the Query/Delegation RPC method. +message QueryDelegationRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_addr defines the delegator address to query for. + string delegator_addr = 1; + + // validator_addr defines the validator address to query for. + string validator_addr = 2; +} + +// QueryDelegationResponse is response type for the Query/Delegation RPC method. +message QueryDelegationResponse { + // delegation_responses defines the delegation info of a delegation. + DelegationResponse delegation_response = 1; +} + +// QueryUnbondingDelegationRequest is request type for the +// Query/UnbondingDelegation RPC method. +message QueryUnbondingDelegationRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_addr defines the delegator address to query for. + string delegator_addr = 1; + + // validator_addr defines the validator address to query for. + string validator_addr = 2; +} + +// QueryDelegationResponse is response type for the Query/UnbondingDelegation +// RPC method. +message QueryUnbondingDelegationResponse { + // unbond defines the unbonding information of a delegation. + UnbondingDelegation unbond = 1 [(gogoproto.nullable) = false]; +} + +// QueryDelegatorDelegationsRequest is request type for the +// Query/DelegatorDelegations RPC method. +message QueryDelegatorDelegationsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_addr defines the delegator address to query for. + string delegator_addr = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorDelegationsResponse is response type for the +// Query/DelegatorDelegations RPC method. +message QueryDelegatorDelegationsResponse { + // delegation_responses defines all the delegations' info of a delegator. + repeated DelegationResponse delegation_responses = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorUnbondingDelegationsRequest is request type for the +// Query/DelegatorUnbondingDelegations RPC method. +message QueryDelegatorUnbondingDelegationsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_addr defines the delegator address to query for. + string delegator_addr = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryUnbondingDelegatorDelegationsResponse is response type for the +// Query/UnbondingDelegatorDelegations RPC method. +message QueryDelegatorUnbondingDelegationsResponse { + repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryRedelegationsRequest is request type for the Query/Redelegations RPC +// method. +message QueryRedelegationsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_addr defines the delegator address to query for. + string delegator_addr = 1; + + // src_validator_addr defines the validator address to redelegate from. + string src_validator_addr = 2; + + // dst_validator_addr defines the validator address to redelegate to. + string dst_validator_addr = 3; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 4; +} + +// QueryRedelegationsResponse is response type for the Query/Redelegations RPC +// method. +message QueryRedelegationsResponse { + repeated RedelegationResponse redelegation_responses = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorValidatorsRequest is request type for the +// Query/DelegatorValidators RPC method. +message QueryDelegatorValidatorsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_addr defines the delegator address to query for. + string delegator_addr = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorValidatorsResponse is response type for the +// Query/DelegatorValidators RPC method. +message QueryDelegatorValidatorsResponse { + // validators defines the the validators' info of a delegator. + repeated Validator validators = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorValidatorRequest is request type for the +// Query/DelegatorValidator RPC method. +message QueryDelegatorValidatorRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_addr defines the delegator address to query for. + string delegator_addr = 1; + + // validator_addr defines the validator address to query for. + string validator_addr = 2; +} + +// QueryDelegatorValidatorResponse response type for the +// Query/DelegatorValidator RPC method. +message QueryDelegatorValidatorResponse { + // validator defines the the validator info. + Validator validator = 1 [(gogoproto.nullable) = false]; +} + +// QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC +// method. +message QueryHistoricalInfoRequest { + // height defines at which height to query the historical info. + int64 height = 1; +} + +// QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC +// method. +message QueryHistoricalInfoResponse { + // hist defines the historical info at the given height. + HistoricalInfo hist = 1; +} + +// QueryPoolRequest is request type for the Query/Pool RPC method. +message QueryPoolRequest {} + +// QueryPoolResponse is response type for the Query/Pool RPC method. +message QueryPoolResponse { + // pool defines the pool info. + Pool pool = 1 [(gogoproto.nullable) = false]; +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/cosmos/staking/v1beta1/staking.proto b/third_party/proto/cosmos/staking/v1beta1/staking.proto new file mode 100644 index 00000000..76e9599e --- /dev/null +++ b/third_party/proto/cosmos/staking/v1beta1/staking.proto @@ -0,0 +1,334 @@ +syntax = "proto3"; +package cosmos.staking.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "tendermint/types/types.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; + +// HistoricalInfo contains header and validator information for a given block. +// It is stored as part of staking module's state, which persists the `n` most +// recent HistoricalInfo +// (`n` is set by the staking module's `historical_entries` parameter). +message HistoricalInfo { + tendermint.types.Header header = 1 [(gogoproto.nullable) = false]; + repeated Validator valset = 2 [(gogoproto.nullable) = false]; +} + +// CommissionRates defines the initial commission rates to be used for creating +// a validator. +message CommissionRates { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // rate is the commission rate charged to delegators, as a fraction. + string rate = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + // max_rate defines the maximum commission rate which validator can ever charge, as a fraction. + string max_rate = 2 [ + (gogoproto.moretags) = "yaml:\"max_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // max_change_rate defines the maximum daily increase of the validator commission, as a fraction. + string max_change_rate = 3 [ + (gogoproto.moretags) = "yaml:\"max_change_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// Commission defines commission parameters for a given validator. +message Commission { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // commission_rates defines the initial commission rates to be used for creating a validator. + CommissionRates commission_rates = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // update_time is the last time the commission rate was changed. + google.protobuf.Timestamp update_time = 2 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.moretags) = "yaml:\"update_time\""]; +} + +// Description defines a validator description. +message Description { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // moniker defines a human-readable name for the validator. + string moniker = 1; + // identity defines an optional identity signature (ex. UPort or Keybase). + string identity = 2; + // website defines an optional website link. + string website = 3; + // security_contact defines an optional email for security contact. + string security_contact = 4 [(gogoproto.moretags) = "yaml:\"security_contact\""]; + // details define other optional details. + string details = 5; +} + +// Validator defines a validator, together with the total amount of the +// Validator's bond shares and their exchange rate to coins. Slashing results in +// a decrease in the exchange rate, allowing correct calculation of future +// undelegations without iterating over delegators. When coins are delegated to +// this validator, the validator is credited with a delegation whose number of +// bond shares is based on the amount of coins delegated divided by the current +// exchange rate. Voting power can be calculated as total bonded shares +// multiplied by exchange rate. +message Validator { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + + // operator_address defines the address of the validator's operator; bech encoded in JSON. + string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""]; + // consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. + google.protobuf.Any consensus_pubkey = 2 + [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"consensus_pubkey\""]; + // jailed defined whether the validator has been jailed from bonded status or not. + bool jailed = 3; + // status is the validator status (bonded/unbonding/unbonded). + BondStatus status = 4; + // tokens define the delegated tokens (incl. self-delegation). + string tokens = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + // delegator_shares defines total shares issued to a validator's delegators. + string delegator_shares = 6 [ + (gogoproto.moretags) = "yaml:\"delegator_shares\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // description defines the description terms for the validator. + Description description = 7 [(gogoproto.nullable) = false]; + // unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. + int64 unbonding_height = 8 [(gogoproto.moretags) = "yaml:\"unbonding_height\""]; + // unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. + google.protobuf.Timestamp unbonding_time = 9 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.moretags) = "yaml:\"unbonding_time\""]; + // commission defines the commission parameters. + Commission commission = 10 [(gogoproto.nullable) = false]; + // min_self_delegation is the validator's self declared minimum self delegation. + string min_self_delegation = 11 [ + (gogoproto.moretags) = "yaml:\"min_self_delegation\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// BondStatus is the status of a validator. +enum BondStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // UNSPECIFIED defines an invalid validator status. + BOND_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "Unspecified"]; + // UNBONDED defines a validator that is not bonded. + BOND_STATUS_UNBONDED = 1 [(gogoproto.enumvalue_customname) = "Unbonded"]; + // UNBONDING defines a validator that is unbonding. + BOND_STATUS_UNBONDING = 2 [(gogoproto.enumvalue_customname) = "Unbonding"]; + // BONDED defines a validator that is bonded. + BOND_STATUS_BONDED = 3 [(gogoproto.enumvalue_customname) = "Bonded"]; +} + +// ValAddresses defines a repeated set of validator addresses. +message ValAddresses { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; + + repeated string addresses = 1; +} + +// DVPair is struct that just has a delegator-validator pair with no other data. +// It is intended to be used as a marshalable pointer. For example, a DVPair can +// be used to construct the key to getting an UnbondingDelegation from state. +message DVPair { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; +} + +// DVPairs defines an array of DVPair objects. +message DVPairs { + repeated DVPair pairs = 1 [(gogoproto.nullable) = false]; +} + +// DVVTriplet is struct that just has a delegator-validator-validator triplet +// with no other data. It is intended to be used as a marshalable pointer. For +// example, a DVVTriplet can be used to construct the key to getting a +// Redelegation from state. +message DVVTriplet { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_src_address = 2 [(gogoproto.moretags) = "yaml:\"validator_src_address\""]; + string validator_dst_address = 3 [(gogoproto.moretags) = "yaml:\"validator_dst_address\""]; +} + +// DVVTriplets defines an array of DVVTriplet objects. +message DVVTriplets { + repeated DVVTriplet triplets = 1 [(gogoproto.nullable) = false]; +} + +// Delegation represents the bond with tokens held by an account. It is +// owned by one delegator, and is associated with the voting power of one +// validator. +message Delegation { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + // delegator_address is the bech32-encoded address of the delegator. + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + // validator_address is the bech32-encoded address of the validator. + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + // shares define the delegation shares received. + string shares = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +// UnbondingDelegation stores all of a single delegator's unbonding bonds +// for a single validator in an time-ordered list. +message UnbondingDelegation { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + // delegator_address is the bech32-encoded address of the delegator. + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + // validator_address is the bech32-encoded address of the validator. + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + // entries are the unbonding delegation entries. + repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries +} + +// UnbondingDelegationEntry defines an unbonding object with relevant metadata. +message UnbondingDelegationEntry { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // creation_height is the height which the unbonding took place. + int64 creation_height = 1 [(gogoproto.moretags) = "yaml:\"creation_height\""]; + // completion_time is the unix time for unbonding completion. + google.protobuf.Timestamp completion_time = 2 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.moretags) = "yaml:\"completion_time\""]; + // initial_balance defines the tokens initially scheduled to receive at completion. + string initial_balance = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"initial_balance\"" + ]; + // balance defines the tokens to receive at completion. + string balance = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; +} + +// RedelegationEntry defines a redelegation object with relevant metadata. +message RedelegationEntry { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // creation_height defines the height which the redelegation took place. + int64 creation_height = 1 [(gogoproto.moretags) = "yaml:\"creation_height\""]; + // completion_time defines the unix time for redelegation completion. + google.protobuf.Timestamp completion_time = 2 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.moretags) = "yaml:\"completion_time\""]; + // initial_balance defines the initial balance when redelegation started. + string initial_balance = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"initial_balance\"" + ]; + // shares_dst is the amount of destination-validator shares created by redelegation. + string shares_dst = 4 + [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +// Redelegation contains the list of a particular delegator's redelegating bonds +// from a particular source validator to a particular destination validator. +message Redelegation { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + // delegator_address is the bech32-encoded address of the delegator. + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + // validator_src_address is the validator redelegation source operator address. + string validator_src_address = 2 [(gogoproto.moretags) = "yaml:\"validator_src_address\""]; + // validator_dst_address is the validator redelegation destination operator address. + string validator_dst_address = 3 [(gogoproto.moretags) = "yaml:\"validator_dst_address\""]; + // entries are the redelegation entries. + repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries +} + +// Params defines the parameters for the staking module. +message Params { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // unbonding_time is the time duration of unbonding. + google.protobuf.Duration unbonding_time = 1 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"unbonding_time\""]; + // max_validators is the maximum number of validators. + uint32 max_validators = 2 [(gogoproto.moretags) = "yaml:\"max_validators\""]; + // max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). + uint32 max_entries = 3 [(gogoproto.moretags) = "yaml:\"max_entries\""]; + // historical_entries is the number of historical entries to persist. + uint32 historical_entries = 4 [(gogoproto.moretags) = "yaml:\"historical_entries\""]; + // bond_denom defines the bondable coin denomination. + string bond_denom = 5 [(gogoproto.moretags) = "yaml:\"bond_denom\""]; +} + +// DelegationResponse is equivalent to Delegation except that it contains a +// balance in addition to shares which is more suitable for client responses. +message DelegationResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + + Delegation delegation = 1 [(gogoproto.nullable) = false]; + + cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false]; +} + +// RedelegationEntryResponse is equivalent to a RedelegationEntry except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +message RedelegationEntryResponse { + option (gogoproto.equal) = true; + + RedelegationEntry redelegation_entry = 1 [(gogoproto.nullable) = false]; + string balance = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; +} + +// RedelegationResponse is equivalent to a Redelegation except that its entries +// contain a balance in addition to shares which is more suitable for client +// responses. +message RedelegationResponse { + option (gogoproto.equal) = false; + + Redelegation redelegation = 1 [(gogoproto.nullable) = false]; + repeated RedelegationEntryResponse entries = 2 [(gogoproto.nullable) = false]; +} + +// Pool is used for tracking bonded and not-bonded token supply of the bond +// denomination. +message Pool { + option (gogoproto.description) = true; + option (gogoproto.equal) = true; + string not_bonded_tokens = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.jsontag) = "not_bonded_tokens", + (gogoproto.nullable) = false + ]; + string bonded_tokens = 2 [ + (gogoproto.jsontag) = "bonded_tokens", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"bonded_tokens\"" + ]; +} diff --git a/third_party/proto/cosmos/staking/v1beta1/tx.proto b/third_party/proto/cosmos/staking/v1beta1/tx.proto new file mode 100644 index 00000000..7b05d89e --- /dev/null +++ b/third_party/proto/cosmos/staking/v1beta1/tx.proto @@ -0,0 +1,126 @@ +syntax = "proto3"; +package cosmos.staking.v1beta1; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; + +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/staking/v1beta1/staking.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; + +// Msg defines the staking Msg service. +service Msg { + // CreateValidator defines a method for creating a new validator. + rpc CreateValidator(MsgCreateValidator) returns (MsgCreateValidatorResponse); + + // EditValidator defines a method for editing an existing validator. + rpc EditValidator(MsgEditValidator) returns (MsgEditValidatorResponse); + + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + rpc Delegate(MsgDelegate) returns (MsgDelegateResponse); + + // BeginRedelegate defines a method for performing a redelegation + // of coins from a delegator and source validator to a destination validator. + rpc BeginRedelegate(MsgBeginRedelegate) returns (MsgBeginRedelegateResponse); + + // Undelegate defines a method for performing an undelegation from a + // delegate and a validator. + rpc Undelegate(MsgUndelegate) returns (MsgUndelegateResponse); +} + +// MsgCreateValidator defines a SDK message for creating a new validator. +message MsgCreateValidator { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + Description description = 1 [(gogoproto.nullable) = false]; + CommissionRates commission = 2 [(gogoproto.nullable) = false]; + string min_self_delegation = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"min_self_delegation\"", + (gogoproto.nullable) = false + ]; + string delegator_address = 4 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 5 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; + cosmos.base.v1beta1.Coin value = 7 [(gogoproto.nullable) = false]; +} + +// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. +message MsgCreateValidatorResponse {} + +// MsgEditValidator defines a SDK message for editing an existing validator. +message MsgEditValidator { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + Description description = 1 [(gogoproto.nullable) = false]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"address\""]; + + // We pass a reference to the new commission rate and min self delegation as + // it's not mandatory to update. If not updated, the deserialized rate will be + // zero with no way to distinguish if an update was intended. + // REF: #2373 + string commission_rate = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.moretags) = "yaml:\"commission_rate\"" + ]; + string min_self_delegation = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"min_self_delegation\"" + ]; +} + +// MsgEditValidatorResponse defines the Msg/EditValidator response type. +message MsgEditValidatorResponse {} + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message MsgDelegate { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; +} + +// MsgDelegateResponse defines the Msg/Delegate response type. +message MsgDelegateResponse {} + +// MsgBeginRedelegate defines a SDK message for performing a redelegation +// of coins from a delegator and source validator to a destination validator. +message MsgBeginRedelegate { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_src_address = 2 [(gogoproto.moretags) = "yaml:\"validator_src_address\""]; + string validator_dst_address = 3 [(gogoproto.moretags) = "yaml:\"validator_dst_address\""]; + cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false]; +} + +// MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. +message MsgBeginRedelegateResponse { + google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// MsgUndelegate defines a SDK message for performing an undelegation from a +// delegate and a validator. +message MsgUndelegate { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""]; + string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; +} + +// MsgUndelegateResponse defines the Msg/Undelegate response type. +message MsgUndelegateResponse { + google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} diff --git a/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto b/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto new file mode 100644 index 00000000..4c1be405 --- /dev/null +++ b/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; +package cosmos.tx.signing.v1beta1; + +import "cosmos/crypto/multisig/v1beta1/multisig.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types/tx/signing"; + +// SignMode represents a signing mode with its own security guarantees. +enum SignMode { + // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + // rejected + SIGN_MODE_UNSPECIFIED = 0; + + // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + // verified with raw bytes from Tx + SIGN_MODE_DIRECT = 1; + + // SIGN_MODE_TEXTUAL is a future signing mode that will verify some + // human-readable textual representation on top of the binary representation + // from SIGN_MODE_DIRECT + SIGN_MODE_TEXTUAL = 2; + + // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + // Amino JSON and will be removed in the future + SIGN_MODE_LEGACY_AMINO_JSON = 127; +} + +// SignatureDescriptors wraps multiple SignatureDescriptor's. +message SignatureDescriptors { + // signatures are the signature descriptors + repeated SignatureDescriptor signatures = 1; +} + +// SignatureDescriptor is a convenience type which represents the full data for +// a signature including the public key of the signer, signing modes and the +// signature itself. It is primarily used for coordinating signatures between +// clients. +message SignatureDescriptor { + // public_key is the public key of the signer + google.protobuf.Any public_key = 1; + + Data data = 2; + + // sequence is the sequence of the account, which describes the + // number of committed transactions signed by a given address. It is used to prevent + // replay attacks. + uint64 sequence = 3; + + // Data represents signature data + message Data { + // sum is the oneof that specifies whether this represents single or multi-signature data + oneof sum { + // single represents a single signer + Single single = 1; + + // multi represents a multisig signer + Multi multi = 2; + } + + // Single is the signature data for a single signer + message Single { + // mode is the signing mode of the single signer + SignMode mode = 1; + + // signature is the raw signature bytes + bytes signature = 2; + } + + // Multi is the signature data for a multisig public key + message Multi { + // bitarray specifies which keys within the multisig are signing + cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; + + // signatures is the signatures of the multi-signature + repeated Data signatures = 2; + } + } +} diff --git a/third_party/proto/cosmos/tx/v1beta1/service.proto b/third_party/proto/cosmos/tx/v1beta1/service.proto new file mode 100644 index 00000000..646175c0 --- /dev/null +++ b/third_party/proto/cosmos/tx/v1beta1/service.proto @@ -0,0 +1,132 @@ +syntax = "proto3"; +package cosmos.tx.v1beta1; + +import "google/api/annotations.proto"; +import "cosmos/base/abci/v1beta1/abci.proto"; +import "cosmos/tx/v1beta1/tx.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option (gogoproto.goproto_registration) = true; +option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; + +// Service defines a gRPC service for interacting with transactions. +service Service { + // Simulate simulates executing a transaction for estimating gas usage. + rpc Simulate(SimulateRequest) returns (SimulateResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/simulate" + body: "*" + }; + } + // GetTx fetches a tx by hash. + rpc GetTx(GetTxRequest) returns (GetTxResponse) { + option (google.api.http).get = "/cosmos/tx/v1beta1/txs/{hash}"; + } + // BroadcastTx broadcast transaction. + rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/txs" + body: "*" + }; + } + // GetTxsEvent fetches txs by event. + rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) { + option (google.api.http).get = "/cosmos/tx/v1beta1/txs"; + } +} + +// GetTxsEventRequest is the request type for the Service.TxsByEvents +// RPC method. +message GetTxsEventRequest { + // events is the list of transaction event type. + repeated string events = 1; + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; + OrderBy order_by = 3; +} + +// OrderBy defines the sorting order +enum OrderBy { + // ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. + ORDER_BY_UNSPECIFIED = 0; + // ORDER_BY_ASC defines ascending order + ORDER_BY_ASC = 1; + // ORDER_BY_DESC defines descending order + ORDER_BY_DESC = 2; +} + +// GetTxsEventResponse is the response type for the Service.TxsByEvents +// RPC method. +message GetTxsEventResponse { + // txs is the list of queried transactions. + repeated cosmos.tx.v1beta1.Tx txs = 1; + // tx_responses is the list of queried TxResponses. + repeated cosmos.base.abci.v1beta1.TxResponse tx_responses = 2; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 3; +} + +// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest +// RPC method. +message BroadcastTxRequest { + // tx_bytes is the raw transaction. + bytes tx_bytes = 1; + BroadcastMode mode = 2; +} + +// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. +enum BroadcastMode { + // zero-value for mode ordering + BROADCAST_MODE_UNSPECIFIED = 0; + // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + // the tx to be committed in a block. + BROADCAST_MODE_BLOCK = 1; + // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + // a CheckTx execution response only. + BROADCAST_MODE_SYNC = 2; + // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + // immediately. + BROADCAST_MODE_ASYNC = 3; +} + +// BroadcastTxResponse is the response type for the +// Service.BroadcastTx method. +message BroadcastTxResponse { + // tx_response is the queried TxResponses. + cosmos.base.abci.v1beta1.TxResponse tx_response = 1; +} + +// SimulateRequest is the request type for the Service.Simulate +// RPC method. +message SimulateRequest { + // tx is the transaction to simulate. + // Deprecated. Send raw tx bytes instead. + cosmos.tx.v1beta1.Tx tx = 1 [deprecated = true]; + // tx_bytes is the raw transaction. + bytes tx_bytes = 2; +} + +// SimulateResponse is the response type for the +// Service.SimulateRPC method. +message SimulateResponse { + // gas_info is the information about gas used in the simulation. + cosmos.base.abci.v1beta1.GasInfo gas_info = 1; + // result is the result of the simulation. + cosmos.base.abci.v1beta1.Result result = 2; +} + +// GetTxRequest is the request type for the Service.GetTx +// RPC method. +message GetTxRequest { + // hash is the tx hash to query, encoded as a hex string. + string hash = 1; +} + +// GetTxResponse is the response type for the Service.GetTx method. +message GetTxResponse { + // tx is the queried transaction. + cosmos.tx.v1beta1.Tx tx = 1; + // tx_response is the queried TxResponses. + cosmos.base.abci.v1beta1.TxResponse tx_response = 2; +} \ No newline at end of file diff --git a/third_party/proto/cosmos/tx/v1beta1/tx.proto b/third_party/proto/cosmos/tx/v1beta1/tx.proto new file mode 100644 index 00000000..6d5caf12 --- /dev/null +++ b/third_party/proto/cosmos/tx/v1beta1/tx.proto @@ -0,0 +1,183 @@ +syntax = "proto3"; +package cosmos.tx.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/crypto/multisig/v1beta1/multisig.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/tx/signing/v1beta1/signing.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; + +// Tx is the standard type used for broadcasting transactions. +message Tx { + // body is the processable content of the transaction + TxBody body = 1; + + // auth_info is the authorization related content of the transaction, + // specifically signers, signer modes and fee + AuthInfo auth_info = 2; + + // signatures is a list of signatures that matches the length and order of + // AuthInfo's signer_infos to allow connecting signature meta information like + // public key and signing mode by position. + repeated bytes signatures = 3; +} + +// TxRaw is a variant of Tx that pins the signer's exact binary representation +// of body and auth_info. This is used for signing, broadcasting and +// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and +// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used +// as the transaction ID. +message TxRaw { + // body_bytes is a protobuf serialization of a TxBody that matches the + // representation in SignDoc. + bytes body_bytes = 1; + + // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + // representation in SignDoc. + bytes auth_info_bytes = 2; + + // signatures is a list of signatures that matches the length and order of + // AuthInfo's signer_infos to allow connecting signature meta information like + // public key and signing mode by position. + repeated bytes signatures = 3; +} + +// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. +message SignDoc { + // body_bytes is protobuf serialization of a TxBody that matches the + // representation in TxRaw. + bytes body_bytes = 1; + + // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + // representation in TxRaw. + bytes auth_info_bytes = 2; + + // chain_id is the unique identifier of the chain this transaction targets. + // It prevents signed transactions from being used on another chain by an + // attacker + string chain_id = 3; + + // account_number is the account number of the account in state + uint64 account_number = 4; +} + +// TxBody is the body of a transaction that all signers sign over. +message TxBody { + // messages is a list of messages to be executed. The required signers of + // those messages define the number and order of elements in AuthInfo's + // signer_infos and Tx's signatures. Each required signer address is added to + // the list only the first time it occurs. + // By convention, the first required signer (usually from the first message) + // is referred to as the primary signer and pays the fee for the whole + // transaction. + repeated google.protobuf.Any messages = 1; + + // memo is any arbitrary note/comment to be added to the transaction. + // WARNING: in clients, any publicly exposed text should not be called memo, + // but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + string memo = 2; + + // timeout is the block height after which this transaction will not + // be processed by the chain + uint64 timeout_height = 3; + + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, the transaction will be rejected + repeated google.protobuf.Any extension_options = 1023; + + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, they will be ignored + repeated google.protobuf.Any non_critical_extension_options = 2047; +} + +// AuthInfo describes the fee and signer modes that are used to sign a +// transaction. +message AuthInfo { + // signer_infos defines the signing modes for the required signers. The number + // and order of elements must match the required signers from TxBody's + // messages. The first element is the primary signer and the one which pays + // the fee. + repeated SignerInfo signer_infos = 1; + + // Fee is the fee and gas limit for the transaction. The first signer is the + // primary signer and the one which pays the fee. The fee can be calculated + // based on the cost of evaluating the body and doing signature verification + // of the signers. This can be estimated via simulation. + Fee fee = 2; +} + +// SignerInfo describes the public key and signing mode of a single top-level +// signer. +message SignerInfo { + // public_key is the public key of the signer. It is optional for accounts + // that already exist in state. If unset, the verifier can use the required \ + // signer address for this position and lookup the public key. + google.protobuf.Any public_key = 1; + + // mode_info describes the signing mode of the signer and is a nested + // structure to support nested multisig pubkey's + ModeInfo mode_info = 2; + + // sequence is the sequence of the account, which describes the + // number of committed transactions signed by a given address. It is used to + // prevent replay attacks. + uint64 sequence = 3; +} + +// ModeInfo describes the signing mode of a single or nested multisig signer. +message ModeInfo { + // sum is the oneof that specifies whether this represents a single or nested + // multisig signer + oneof sum { + // single represents a single signer + Single single = 1; + + // multi represents a nested multisig signer + Multi multi = 2; + } + + // Single is the mode info for a single signer. It is structured as a message + // to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + // future + message Single { + // mode is the signing mode of the single signer + cosmos.tx.signing.v1beta1.SignMode mode = 1; + } + + // Multi is the mode info for a multisig public key + message Multi { + // bitarray specifies which keys within the multisig are signing + cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; + + // mode_infos is the corresponding modes of the signers of the multisig + // which could include nested multisig public keys + repeated ModeInfo mode_infos = 2; + } +} + +// Fee includes the amount of coins paid in fees and the maximum +// gas to be used by the transaction. The ratio yields an effective "gasprice", +// which must be above some miminum to be accepted into the mempool. +message Fee { + // amount is the amount of coins to be paid as a fee + repeated cosmos.base.v1beta1.Coin amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // gas_limit is the maximum gas that can be used in transaction processing + // before an out of gas error occurs + uint64 gas_limit = 2; + + // if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + // the payer must be a tx signer (and thus have signed this field in AuthInfo). + // setting this field does *not* change the ordering of required signers for the transaction. + string payer = 3; + + // if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + // to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + // not support fee grants, this will fail + string granter = 4; +} diff --git a/third_party/proto/cosmos/upgrade/v1beta1/query.proto b/third_party/proto/cosmos/upgrade/v1beta1/query.proto new file mode 100644 index 00000000..3afb04e4 --- /dev/null +++ b/third_party/proto/cosmos/upgrade/v1beta1/query.proto @@ -0,0 +1,90 @@ +syntax = "proto3"; +package cosmos.upgrade.v1beta1; + +import "google/api/annotations.proto"; +import "cosmos/upgrade/v1beta1/upgrade.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; + +// Query defines the gRPC upgrade querier service. +service Query { + // CurrentPlan queries the current upgrade plan. + rpc CurrentPlan(QueryCurrentPlanRequest) returns (QueryCurrentPlanResponse) { + option (google.api.http).get = "/cosmos/upgrade/v1beta1/current_plan"; + } + + // AppliedPlan queries a previously applied upgrade plan by its name. + rpc AppliedPlan(QueryAppliedPlanRequest) returns (QueryAppliedPlanResponse) { + option (google.api.http).get = "/cosmos/upgrade/v1beta1/applied_plan/{name}"; + } + + // UpgradedConsensusState queries the consensus state that will serve + // as a trusted kernel for the next version of this chain. It will only be + // stored at the last height of this chain. + // UpgradedConsensusState RPC not supported with legacy querier + rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) { + option (google.api.http).get = "/cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height}"; + } + + // ModuleVersions queries the list of module versions from state. + rpc ModuleVersions(QueryModuleVersionsRequest) returns (QueryModuleVersionsResponse) { + option (google.api.http).get = "/cosmos/upgrade/v1beta1/module_versions"; + } +} + +// QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC +// method. +message QueryCurrentPlanRequest {} + +// QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC +// method. +message QueryCurrentPlanResponse { + // plan is the current upgrade plan. + Plan plan = 1; +} + +// QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC +// method. +message QueryAppliedPlanRequest { + // name is the name of the applied plan to query for. + string name = 1; +} + +// QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC +// method. +message QueryAppliedPlanResponse { + // height is the block height at which the plan was applied. + int64 height = 1; +} + +// QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState +// RPC method. +message QueryUpgradedConsensusStateRequest { + // last height of the current chain must be sent in request + // as this is the height under which next consensus state is stored + int64 last_height = 1; +} + +// QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState +// RPC method. +message QueryUpgradedConsensusStateResponse { + reserved 1; + + bytes upgraded_consensus_state = 2; +} + +// QueryModuleVersionsRequest is the request type for the Query/ModuleVersions +// RPC method. +message QueryModuleVersionsRequest { + // module_name is a field to query a specific module + // consensus version from state. Leaving this empty will + // fetch the full list of module versions from state + string module_name = 1; +} + +// QueryModuleVersionsResponse is the response type for the Query/ModuleVersions +// RPC method. +message QueryModuleVersionsResponse { + // module_versions is a list of module names with their consensus versions. + repeated ModuleVersion module_versions = 1; +} diff --git a/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto b/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto new file mode 100644 index 00000000..4e1d69aa --- /dev/null +++ b/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; +package cosmos.upgrade.v1beta1; + +import "google/protobuf/any.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option (gogoproto.goproto_getters_all) = false; + +// Plan specifies information about a planned upgrade and when it should occur. +message Plan { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // Sets the name for the upgrade. This name will be used by the upgraded + // version of the software to apply any special "on-upgrade" commands during + // the first BeginBlock method after the upgrade is applied. It is also used + // to detect whether a software version can handle a given upgrade. If no + // upgrade handler with this name has been set in the software, it will be + // assumed that the software is out-of-date when the upgrade Time or Height is + // reached and the software will exit. + string name = 1; + + // Deprecated: Time based upgrades have been deprecated. Time based upgrade logic + // has been removed from the SDK. + // If this field is not empty, an error will be thrown. + google.protobuf.Timestamp time = 2 [deprecated = true, (gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + + // The height at which the upgrade must be performed. + // Only used if Time is not set. + int64 height = 3; + + // Any application specific upgrade info to be included on-chain + // such as a git commit that validators could automatically upgrade to + string info = 4; + + // Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + // moved to the IBC module in the sub module 02-client. + // If this field is not empty, an error will be thrown. + google.protobuf.Any upgraded_client_state = 5 + [deprecated = true, (gogoproto.moretags) = "yaml:\"upgraded_client_state\""]; +} + +// SoftwareUpgradeProposal is a gov Content type for initiating a software +// upgrade. +message SoftwareUpgradeProposal { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + Plan plan = 3 [(gogoproto.nullable) = false]; +} + +// CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software +// upgrade. +message CancelSoftwareUpgradeProposal { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; +} + +// ModuleVersion specifies a module and its consensus version. +message ModuleVersion { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + + // name of the app module + string name = 1; + + // consensus version of the app module + uint64 version = 2; +} diff --git a/third_party/proto/cosmos/vesting/v1beta1/tx.proto b/third_party/proto/cosmos/vesting/v1beta1/tx.proto new file mode 100644 index 00000000..c49be802 --- /dev/null +++ b/third_party/proto/cosmos/vesting/v1beta1/tx.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package cosmos.vesting.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; + +// Msg defines the bank Msg service. +service Msg { + // CreateVestingAccount defines a method that enables creating a vesting + // account. + rpc CreateVestingAccount(MsgCreateVestingAccount) returns (MsgCreateVestingAccountResponse); +} + +// MsgCreateVestingAccount defines a message that enables creating a vesting +// account. +message MsgCreateVestingAccount { + option (gogoproto.equal) = true; + + string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; + string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + int64 end_time = 4 [(gogoproto.moretags) = "yaml:\"end_time\""]; + bool delayed = 5; +} + +// MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. +message MsgCreateVestingAccountResponse {} \ No newline at end of file diff --git a/third_party/proto/cosmos/vesting/v1beta1/vesting.proto b/third_party/proto/cosmos/vesting/v1beta1/vesting.proto new file mode 100644 index 00000000..26e78683 --- /dev/null +++ b/third_party/proto/cosmos/vesting/v1beta1/vesting.proto @@ -0,0 +1,83 @@ +syntax = "proto3"; +package cosmos.vesting.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/auth/v1beta1/auth.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; + +// BaseVestingAccount implements the VestingAccount interface. It contains all +// the necessary fields needed for any vesting account implementation. +message BaseVestingAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + cosmos.auth.v1beta1.BaseAccount base_account = 1 [(gogoproto.embed) = true]; + repeated cosmos.base.v1beta1.Coin original_vesting = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"original_vesting\"" + ]; + repeated cosmos.base.v1beta1.Coin delegated_free = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"delegated_free\"" + ]; + repeated cosmos.base.v1beta1.Coin delegated_vesting = 4 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"delegated_vesting\"" + ]; + int64 end_time = 5 [(gogoproto.moretags) = "yaml:\"end_time\""]; +} + +// ContinuousVestingAccount implements the VestingAccount interface. It +// continuously vests by unlocking coins linearly with respect to time. +message ContinuousVestingAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; + int64 start_time = 2 [(gogoproto.moretags) = "yaml:\"start_time\""]; +} + +// DelayedVestingAccount implements the VestingAccount interface. It vests all +// coins after a specific time, but non prior. In other words, it keeps them +// locked until a specified time. +message DelayedVestingAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; +} + +// Period defines a length of time and amount of coins that will vest. +message Period { + option (gogoproto.goproto_stringer) = false; + + int64 length = 1; + repeated cosmos.base.v1beta1.Coin amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// PeriodicVestingAccount implements the VestingAccount interface. It +// periodically vests by unlocking coins during each specified period. +message PeriodicVestingAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; + int64 start_time = 2 [(gogoproto.moretags) = "yaml:\"start_time\""]; + repeated Period vesting_periods = 3 [(gogoproto.moretags) = "yaml:\"vesting_periods\"", (gogoproto.nullable) = false]; +} + +// PermanentLockedAccount implements the VestingAccount interface. It does +// not ever release coins, locking them indefinitely. Coins in this account can +// still be used for delegating and for governance votes even while locked. +message PermanentLockedAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; +} diff --git a/third_party/proto/cosmos_proto/cosmos.proto b/third_party/proto/cosmos_proto/cosmos.proto new file mode 100644 index 00000000..167b1707 --- /dev/null +++ b/third_party/proto/cosmos_proto/cosmos.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package cosmos_proto; + +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/regen-network/cosmos-proto"; + +extend google.protobuf.MessageOptions { + string interface_type = 93001; + + string implements_interface = 93002; +} + +extend google.protobuf.FieldOptions { + string accepts_interface = 93001; +} diff --git a/third_party/proto/gogoproto/gogo.proto b/third_party/proto/gogoproto/gogo.proto new file mode 100644 index 00000000..49e78f99 --- /dev/null +++ b/third_party/proto/gogoproto/gogo.proto @@ -0,0 +1,145 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; +option go_package = "github.com/gogo/protobuf/gogoproto"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; + optional bool wktpointer = 65012; + + optional string castrepeated = 65013; +} diff --git a/third_party/proto/google/api/annotations.proto b/third_party/proto/google/api/annotations.proto new file mode 100644 index 00000000..7b67d584 --- /dev/null +++ b/third_party/proto/google/api/annotations.proto @@ -0,0 +1,31 @@ +// Copyright (c) 2015, Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} diff --git a/third_party/proto/google/api/http.proto b/third_party/proto/google/api/http.proto new file mode 100644 index 00000000..401fcb74 --- /dev/null +++ b/third_party/proto/google/api/http.proto @@ -0,0 +1,325 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; + + // When set to true, URL path parmeters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + bool fully_decode_reserved_expansion = 2; +} + +// `HttpRule` defines the mapping of an RPC method to one or more HTTP +// REST API methods. The mapping specifies how different portions of the RPC +// request message are mapped to URL path, URL query parameters, and +// HTTP request body. The mapping is typically specified as an +// `google.api.http` annotation on the RPC method, +// see "google/api/annotations.proto" for details. +// +// The mapping consists of a field specifying the path template and +// method kind. The path template can refer to fields in the request +// message, as in the example below which describes a REST GET +// operation on a resource collection of messages: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = +// "/v1/messages/{message_id}/{sub.subfield}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// SubMessage sub = 2; // `sub.subfield` is url-mapped +// } +// message Message { +// string text = 1; // content of the resource +// } +// +// The same http annotation can alternatively be expressed inside the +// `GRPC API Configuration` YAML file. +// +// http: +// rules: +// - selector: .Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// This definition enables an automatic, bidrectional mapping of HTTP +// JSON to RPC. Example: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: +// SubMessage(subfield: "foo"))` +// +// In general, not only fields but also field paths can be referenced +// from a path pattern. Fields mapped to the path pattern cannot be +// repeated and must have a primitive (non-message) type. +// +// Any fields in the request message which are not bound by the path +// pattern automatically become (optional) HTTP query +// parameters. Assume the following definition of the request message: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// int64 revision = 2; // becomes a parameter +// SubMessage sub = 3; // `sub.subfield` becomes a parameter +// } +// +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | +// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: +// "foo"))` +// +// Note that fields which are mapped to HTTP parameters must have a +// primitive type or a repeated primitive type. Message types are not +// allowed. In the case of a repeated type, the parameter can be +// repeated in the URL, as in `...?param=A¶m=B`. +// +// For HTTP method kinds which allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +// "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +// "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice of +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// +// This enables the following two alternative HTTP JSON to RPC +// mappings: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: +// "123456")` +// +// # Rules for HTTP mapping +// +// The rules for mapping HTTP path, query parameters, and body fields +// to the request message are as follows: +// +// 1. The `body` field specifies either `*` or a field path, or is +// omitted. If omitted, it indicates there is no HTTP request body. +// 2. Leaf fields (recursive expansion of nested messages in the +// request) can be classified into three types: +// (a) Matched in the URL template. +// (b) Covered by body (if body is `*`, everything except (a) fields; +// else everything under the body field) +// (c) All other fields. +// 3. URL query parameters found in the HTTP request are mapped to (c) fields. +// 4. Any body sent with an HTTP request can contain only (b) fields. +// +// The syntax of the path template is as follows: +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single path segment. The syntax `**` matches zero +// or more path segments, which must be the last part of the path except the +// `Verb`. The syntax `LITERAL` matches literal text in the path. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path, all characters +// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the +// Discovery Document as `{var}`. +// +// If a variable contains one or more path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path, all +// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables +// show up in the Discovery Document as `{+var}`. +// +// NOTE: While the single segment variable matches the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 +// Simple String Expansion, the multi segment variable **does not** match +// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. +// +// NOTE: the field paths in variables and in the `body` must not refer to +// repeated fields or map fields. +message HttpRule { + // Selects methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax + // details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Used for listing and getting information about resources. + string get = 2; + + // Used for updating a resource. + string put = 3; + + // Used for creating a resource. + string post = 4; + + // Used for deleting a resource. + string delete = 5; + + // Used for updating a resource. + string patch = 6; + + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP body, or + // `*` for mapping all fields not captured by the path pattern to the HTTP + // body. NOTE: the referred field must not be a repeated field and must be + // present at the top-level of request message type. + string body = 7; + + // Optional. The name of the response field whose value is mapped to the HTTP + // body of response. Other response fields are ignored. When + // not set, the response message will be used as HTTP body of response. + string response_body = 12; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} diff --git a/third_party/proto/google/api/httpbody.proto b/third_party/proto/google/api/httpbody.proto new file mode 100644 index 00000000..573f8d1b --- /dev/null +++ b/third_party/proto/google/api/httpbody.proto @@ -0,0 +1,78 @@ +// Copyright 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.api; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; +option java_multiple_files = true; +option java_outer_classname = "HttpBodyProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Message that represents an arbitrary HTTP body. It should only be used for +// payload formats that can't be represented as JSON, such as raw binary or +// an HTML page. +// +// +// This message can be used both in streaming and non-streaming API methods in +// the request as well as the response. +// +// It can be used as a top-level request field, which is convenient if one +// wants to extract parameters from either the URL or HTTP template into the +// request fields and also want access to the raw HTTP body. +// +// Example: +// +// message GetResourceRequest { +// // A unique request id. +// string request_id = 1; +// +// // The raw HTTP body is bound to this field. +// google.api.HttpBody http_body = 2; +// } +// +// service ResourceService { +// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +// rpc UpdateResource(google.api.HttpBody) returns +// (google.protobuf.Empty); +// } +// +// Example with streaming methods: +// +// service CaldavService { +// rpc GetCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// rpc UpdateCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// } +// +// Use of this type only changes how the request and response bodies are +// handled, all other features will continue to work unchanged. +message HttpBody { + // The HTTP Content-Type header value specifying the content type of the body. + string content_type = 1; + + // The HTTP request/response body as raw binary. + bytes data = 2; + + // Application specific response metadata. Must be set in the first response + // for streaming APIs. + repeated google.protobuf.Any extensions = 3; +} \ No newline at end of file diff --git a/third_party/proto/google/protobuf/any.proto b/third_party/proto/google/protobuf/any.proto new file mode 100644 index 00000000..e1faae47 --- /dev/null +++ b/third_party/proto/google/protobuf/any.proto @@ -0,0 +1,161 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package google.protobuf; + +import "gogoproto/gogo.proto"; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "AnyProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; + +// `Any` contains an arbitrary serialized protocol buffer message along with a +// URL that describes the type of the serialized message. +// +// Protobuf library provides support to pack/unpack Any values in the form +// of utility functions or additional generated methods of the Any type. +// +// Example 1: Pack and unpack a message in C++. +// +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } +// +// Example 2: Pack and unpack a message in Java. +// +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// +// Example 3: Pack and unpack a message in Python. +// +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... +// +// Example 4: Pack and unpack a message in Go +// +// foo := &pb.Foo{...} +// any, err := ptypes.MarshalAny(foo) +// ... +// foo := &pb.Foo{} +// if err := ptypes.UnmarshalAny(any, foo); err != nil { +// ... +// } +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +message Any { + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. This string must contain at least + // one "/" character. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). + // + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: + // + // * If no scheme is provided, `https` is assumed. + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + // + string type_url = 1; + + // Must be a valid serialized protocol buffer of the above specified type. + bytes value = 2; + + option (gogoproto.typedecl) = false; +} + +option (gogoproto.goproto_registration) = false; diff --git a/third_party/proto/google/protobuf/descriptor.proto b/third_party/proto/google/protobuf/descriptor.proto new file mode 100644 index 00000000..42832c97 --- /dev/null +++ b/third_party/proto/google/protobuf/descriptor.proto @@ -0,0 +1,895 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + +syntax = "proto2"; + +package google.protobuf; + +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + optional string syntax = 12; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + + optional ExtensionRangeOptions options = 3; + } + repeated ExtensionRange extension_range = 5; + + repeated OneofDescriptorProto oneof_decl = 8; + + optional MessageOptions options = 7; + + // Range of reserved tag numbers. Reserved tag numbers may not be used by + // fields or extension ranges in the same message. Reserved ranges may + // not overlap. + message ReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + repeated string reserved_name = 10; +} + +message ExtensionRangeOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + } + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + } + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10; + + optional FieldOptions options = 8; + + // If true, this is a proto3 "optional". When a proto3 field is optional, it + // tracks presence regardless of field type. + // + // When proto3_optional is true, this field must be belong to a oneof to + // signal to old proto3 clients that presence is tracked for this field. This + // oneof is known as a "synthetic" oneof, and this field must be its sole + // member (each proto3 optional field gets its own synthetic oneof). Synthetic + // oneofs exist in the descriptor only, and do not generate any API. Synthetic + // oneofs must be ordered after all "real" oneofs. + // + // For message fields, proto3_optional doesn't create any semantic change, + // since non-repeated message fields always track presence. However it still + // indicates the semantic detail of whether the user wrote "optional" or not. + // This can be useful for round-tripping the .proto file. For consistency we + // give message fields a synthetic oneof also, even though it is not required + // to track presence. This is especially important because the parser can't + // tell if a field is a message or an enum, so it must always create a + // synthetic oneof. + // + // Proto2 optional fields do not set this flag, because they already indicate + // optional with `LABEL_OPTIONAL`. + optional bool proto3_optional = 17; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default = false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default = false]; +} + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default = false]; + + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default = false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default = SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool php_generic_services = 42 [default = false]; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default = false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default = true]; + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40; + + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41; + + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be + // used for determining the namespace. + optional string php_metadata_namespace = 44; + + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + optional string ruby_package = 45; + + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. + extensions 1000 to max; + + reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default = false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default = false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default = false]; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementations still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + optional bool packed = 2; + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default = false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default = false]; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 4; // removed jtype +} + +message OneofOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default = false]; + + reserved 5; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default = false]; + + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendant. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed = true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed = true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed = true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + } +} diff --git a/third_party/proto/tendermint/abci/types.proto b/third_party/proto/tendermint/abci/types.proto new file mode 100644 index 00000000..8e3a9093 --- /dev/null +++ b/third_party/proto/tendermint/abci/types.proto @@ -0,0 +1,407 @@ +syntax = "proto3"; +package tendermint.abci; + +option go_package = "github.com/tendermint/tendermint/abci/types"; + +// For more information on gogo.proto, see: +// https://github.com/gogo/protobuf/blob/master/extensions.md +import "tendermint/crypto/proof.proto"; +import "tendermint/types/types.proto"; +import "tendermint/crypto/keys.proto"; +import "tendermint/types/params.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; + +// This file is copied from http://github.com/tendermint/abci +// NOTE: When using custom types, mind the warnings. +// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues + +//---------------------------------------- +// Request types + +message Request { + oneof value { + RequestEcho echo = 1; + RequestFlush flush = 2; + RequestInfo info = 3; + RequestSetOption set_option = 4; + RequestInitChain init_chain = 5; + RequestQuery query = 6; + RequestBeginBlock begin_block = 7; + RequestCheckTx check_tx = 8; + RequestDeliverTx deliver_tx = 9; + RequestEndBlock end_block = 10; + RequestCommit commit = 11; + RequestListSnapshots list_snapshots = 12; + RequestOfferSnapshot offer_snapshot = 13; + RequestLoadSnapshotChunk load_snapshot_chunk = 14; + RequestApplySnapshotChunk apply_snapshot_chunk = 15; + } +} + +message RequestEcho { + string message = 1; +} + +message RequestFlush {} + +message RequestInfo { + string version = 1; + uint64 block_version = 2; + uint64 p2p_version = 3; +} + +// nondeterministic +message RequestSetOption { + string key = 1; + string value = 2; +} + +message RequestInitChain { + google.protobuf.Timestamp time = 1 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 2; + ConsensusParams consensus_params = 3; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; + bytes app_state_bytes = 5; + int64 initial_height = 6; +} + +message RequestQuery { + bytes data = 1; + string path = 2; + int64 height = 3; + bool prove = 4; +} + +message RequestBeginBlock { + bytes hash = 1; + tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; + LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; + repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; +} + +enum CheckTxType { + NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; + RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"]; +} + +message RequestCheckTx { + bytes tx = 1; + CheckTxType type = 2; +} + +message RequestDeliverTx { + bytes tx = 1; +} + +message RequestEndBlock { + int64 height = 1; +} + +message RequestCommit {} + +// lists available snapshots +message RequestListSnapshots { +} + +// offers a snapshot to the application +message RequestOfferSnapshot { + Snapshot snapshot = 1; // snapshot offered by peers + bytes app_hash = 2; // light client-verified app hash for snapshot height +} + +// loads a snapshot chunk +message RequestLoadSnapshotChunk { + uint64 height = 1; + uint32 format = 2; + uint32 chunk = 3; +} + +// Applies a snapshot chunk +message RequestApplySnapshotChunk { + uint32 index = 1; + bytes chunk = 2; + string sender = 3; +} + +//---------------------------------------- +// Response types + +message Response { + oneof value { + ResponseException exception = 1; + ResponseEcho echo = 2; + ResponseFlush flush = 3; + ResponseInfo info = 4; + ResponseSetOption set_option = 5; + ResponseInitChain init_chain = 6; + ResponseQuery query = 7; + ResponseBeginBlock begin_block = 8; + ResponseCheckTx check_tx = 9; + ResponseDeliverTx deliver_tx = 10; + ResponseEndBlock end_block = 11; + ResponseCommit commit = 12; + ResponseListSnapshots list_snapshots = 13; + ResponseOfferSnapshot offer_snapshot = 14; + ResponseLoadSnapshotChunk load_snapshot_chunk = 15; + ResponseApplySnapshotChunk apply_snapshot_chunk = 16; + } +} + +// nondeterministic +message ResponseException { + string error = 1; +} + +message ResponseEcho { + string message = 1; +} + +message ResponseFlush {} + +message ResponseInfo { + string data = 1; + + string version = 2; + uint64 app_version = 3; + + int64 last_block_height = 4; + bytes last_block_app_hash = 5; +} + +// nondeterministic +message ResponseSetOption { + uint32 code = 1; + // bytes data = 2; + string log = 3; + string info = 4; +} + +message ResponseInitChain { + ConsensusParams consensus_params = 1; + repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false]; + bytes app_hash = 3; +} + +message ResponseQuery { + uint32 code = 1; + // bytes data = 2; // use "value" instead. + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 index = 5; + bytes key = 6; + bytes value = 7; + tendermint.crypto.ProofOps proof_ops = 8; + int64 height = 9; + string codespace = 10; +} + +message ResponseBeginBlock { + repeated Event events = 1 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; +} + +message ResponseCheckTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; +} + +message ResponseDeliverTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic + string codespace = 8; +} + +message ResponseEndBlock { + repeated ValidatorUpdate validator_updates = 1 + [(gogoproto.nullable) = false]; + ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; +} + +message ResponseCommit { + // reserve 1 + bytes data = 2; + int64 retain_height = 3; +} + +message ResponseListSnapshots { + repeated Snapshot snapshots = 1; +} + +message ResponseOfferSnapshot { + Result result = 1; + + enum Result { + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Snapshot accepted, apply chunks + ABORT = 2; // Abort all snapshot restoration + REJECT = 3; // Reject this specific snapshot, try others + REJECT_FORMAT = 4; // Reject all snapshots of this format, try others + REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others + } +} + +message ResponseLoadSnapshotChunk { + bytes chunk = 1; +} + +message ResponseApplySnapshotChunk { + Result result = 1; + repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply + repeated string reject_senders = 3; // Chunk senders to reject and ban + + enum Result { + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Chunk successfully accepted + ABORT = 2; // Abort all snapshot restoration + RETRY = 3; // Retry chunk (combine with refetch and reject) + RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) + REJECT_SNAPSHOT = 5; // Reject this snapshot, try others + } +} + +//---------------------------------------- +// Misc. + +// ConsensusParams contains all consensus-relevant parameters +// that can be adjusted by the abci app +message ConsensusParams { + BlockParams block = 1; + tendermint.types.EvidenceParams evidence = 2; + tendermint.types.ValidatorParams validator = 3; + tendermint.types.VersionParams version = 4; +} + +// BlockParams contains limits on the block size. +message BlockParams { + // Note: must be greater than 0 + int64 max_bytes = 1; + // Note: must be greater or equal to -1 + int64 max_gas = 2; +} + +message LastCommitInfo { + int32 round = 1; + repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; +} + +// Event allows application developers to attach additional information to +// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. +// Later, transactions may be queried using these events. +message Event { + string type = 1; + repeated EventAttribute attributes = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "attributes,omitempty" + ]; +} + +// EventAttribute is a single key-value pair, associated with an event. +message EventAttribute { + bytes key = 1; + bytes value = 2; + bool index = 3; // nondeterministic +} + +// TxResult contains results of executing the transaction. +// +// One usage is indexing transaction results. +message TxResult { + int64 height = 1; + uint32 index = 2; + bytes tx = 3; + ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; +} + +//---------------------------------------- +// Blockchain Types + +// Validator +message Validator { + bytes address = 1; // The first 20 bytes of SHA256(public key) + // PubKey pub_key = 2 [(gogoproto.nullable)=false]; + int64 power = 3; // The voting power +} + +// ValidatorUpdate +message ValidatorUpdate { + tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; + int64 power = 2; +} + +// VoteInfo +message VoteInfo { + Validator validator = 1 [(gogoproto.nullable) = false]; + bool signed_last_block = 2; +} + +enum EvidenceType { + UNKNOWN = 0; + DUPLICATE_VOTE = 1; + LIGHT_CLIENT_ATTACK = 2; +} + +message Evidence { + EvidenceType type = 1; + // The offending validator + Validator validator = 2 [(gogoproto.nullable) = false]; + // The height when the offense occurred + int64 height = 3; + // The corresponding time where the offense occurred + google.protobuf.Timestamp time = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + // Total voting power of the validator set in case the ABCI application does + // not store historical validators. + // https://github.com/tendermint/tendermint/issues/4581 + int64 total_voting_power = 5; +} + +//---------------------------------------- +// State Sync Types + +message Snapshot { + uint64 height = 1; // The height at which the snapshot was taken + uint32 format = 2; // The application-specific snapshot format + uint32 chunks = 3; // Number of chunks in the snapshot + bytes hash = 4; // Arbitrary snapshot hash, equal only if identical + bytes metadata = 5; // Arbitrary application metadata +} + +//---------------------------------------- +// Service Definition + +service ABCIApplication { + rpc Echo(RequestEcho) returns (ResponseEcho); + rpc Flush(RequestFlush) returns (ResponseFlush); + rpc Info(RequestInfo) returns (ResponseInfo); + rpc SetOption(RequestSetOption) returns (ResponseSetOption); + rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); + rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); + rpc Query(RequestQuery) returns (ResponseQuery); + rpc Commit(RequestCommit) returns (ResponseCommit); + rpc InitChain(RequestInitChain) returns (ResponseInitChain); + rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); + rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); + rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); + rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); + rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); + rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); +} diff --git a/third_party/proto/tendermint/crypto/keys.proto b/third_party/proto/tendermint/crypto/keys.proto new file mode 100644 index 00000000..16fd7adf --- /dev/null +++ b/third_party/proto/tendermint/crypto/keys.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package tendermint.crypto; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; + +import "gogoproto/gogo.proto"; + +// PublicKey defines the keys available for use with Tendermint Validators +message PublicKey { + option (gogoproto.compare) = true; + option (gogoproto.equal) = true; + + oneof sum { + bytes ed25519 = 1; + bytes secp256k1 = 2; + } +} diff --git a/third_party/proto/tendermint/crypto/proof.proto b/third_party/proto/tendermint/crypto/proof.proto new file mode 100644 index 00000000..975df768 --- /dev/null +++ b/third_party/proto/tendermint/crypto/proof.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package tendermint.crypto; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; + +import "gogoproto/gogo.proto"; + +message Proof { + int64 total = 1; + int64 index = 2; + bytes leaf_hash = 3; + repeated bytes aunts = 4; +} + +message ValueOp { + // Encoded in ProofOp.Key. + bytes key = 1; + + // To encode in ProofOp.Data + Proof proof = 2; +} + +message DominoOp { + string key = 1; + string input = 2; + string output = 3; +} + +// ProofOp defines an operation used for calculating Merkle root +// The data could be arbitrary format, providing nessecary data +// for example neighbouring node hash +message ProofOp { + string type = 1; + bytes key = 2; + bytes data = 3; +} + +// ProofOps is Merkle proof defined by the list of ProofOps +message ProofOps { + repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/tendermint/libs/bits/types.proto b/third_party/proto/tendermint/libs/bits/types.proto new file mode 100644 index 00000000..3111d113 --- /dev/null +++ b/third_party/proto/tendermint/libs/bits/types.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package tendermint.libs.bits; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/libs/bits"; + +message BitArray { + int64 bits = 1; + repeated uint64 elems = 2; +} diff --git a/third_party/proto/tendermint/p2p/types.proto b/third_party/proto/tendermint/p2p/types.proto new file mode 100644 index 00000000..0d42ea40 --- /dev/null +++ b/third_party/proto/tendermint/p2p/types.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package tendermint.p2p; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p"; + +import "gogoproto/gogo.proto"; + +message NetAddress { + string id = 1 [(gogoproto.customname) = "ID"]; + string ip = 2 [(gogoproto.customname) = "IP"]; + uint32 port = 3; +} + +message ProtocolVersion { + uint64 p2p = 1 [(gogoproto.customname) = "P2P"]; + uint64 block = 2; + uint64 app = 3; +} + +message DefaultNodeInfo { + ProtocolVersion protocol_version = 1 [(gogoproto.nullable) = false]; + string default_node_id = 2 [(gogoproto.customname) = "DefaultNodeID"]; + string listen_addr = 3; + string network = 4; + string version = 5; + bytes channels = 6; + string moniker = 7; + DefaultNodeInfoOther other = 8 [(gogoproto.nullable) = false]; +} + +message DefaultNodeInfoOther { + string tx_index = 1; + string rpc_address = 2 [(gogoproto.customname) = "RPCAddress"]; +} diff --git a/third_party/proto/tendermint/types/block.proto b/third_party/proto/tendermint/types/block.proto new file mode 100644 index 00000000..84e9bb15 --- /dev/null +++ b/third_party/proto/tendermint/types/block.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "tendermint/types/types.proto"; +import "tendermint/types/evidence.proto"; + +message Block { + Header header = 1 [(gogoproto.nullable) = false]; + Data data = 2 [(gogoproto.nullable) = false]; + tendermint.types.EvidenceList evidence = 3 [(gogoproto.nullable) = false]; + Commit last_commit = 4; +} diff --git a/third_party/proto/tendermint/types/evidence.proto b/third_party/proto/tendermint/types/evidence.proto new file mode 100644 index 00000000..3b234571 --- /dev/null +++ b/third_party/proto/tendermint/types/evidence.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "tendermint/types/types.proto"; +import "tendermint/types/validator.proto"; + +message Evidence { + oneof sum { + DuplicateVoteEvidence duplicate_vote_evidence = 1; + LightClientAttackEvidence light_client_attack_evidence = 2; + } +} + +// DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. +message DuplicateVoteEvidence { + tendermint.types.Vote vote_a = 1; + tendermint.types.Vote vote_b = 2; + int64 total_voting_power = 3; + int64 validator_power = 4; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. +message LightClientAttackEvidence { + tendermint.types.LightBlock conflicting_block = 1; + int64 common_height = 2; + repeated tendermint.types.Validator byzantine_validators = 3; + int64 total_voting_power = 4; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +message EvidenceList { + repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/tendermint/types/params.proto b/third_party/proto/tendermint/types/params.proto new file mode 100644 index 00000000..0de7d846 --- /dev/null +++ b/third_party/proto/tendermint/types/params.proto @@ -0,0 +1,80 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; + +option (gogoproto.equal_all) = true; + +// ConsensusParams contains consensus critical parameters that determine the +// validity of blocks. +message ConsensusParams { + BlockParams block = 1 [(gogoproto.nullable) = false]; + EvidenceParams evidence = 2 [(gogoproto.nullable) = false]; + ValidatorParams validator = 3 [(gogoproto.nullable) = false]; + VersionParams version = 4 [(gogoproto.nullable) = false]; +} + +// BlockParams contains limits on the block size. +message BlockParams { + // Max block size, in bytes. + // Note: must be greater than 0 + int64 max_bytes = 1; + // Max gas per block. + // Note: must be greater or equal to -1 + int64 max_gas = 2; + // Minimum time increment between consecutive blocks (in milliseconds) If the + // block header timestamp is ahead of the system clock, decrease this value. + // + // Not exposed to the application. + int64 time_iota_ms = 3; +} + +// EvidenceParams determine how we handle evidence of malfeasance. +message EvidenceParams { + // Max age of evidence, in blocks. + // + // The basic formula for calculating this is: MaxAgeDuration / {average block + // time}. + int64 max_age_num_blocks = 1; + + // Max age of evidence, in time. + // + // It should correspond with an app's "unbonding period" or other similar + // mechanism for handling [Nothing-At-Stake + // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + google.protobuf.Duration max_age_duration = 2 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + + // This sets the maximum size of total evidence in bytes that can be committed in a single block. + // and should fall comfortably under the max block bytes. + // Default is 1048576 or 1MB + int64 max_bytes = 3; +} + +// ValidatorParams restrict the public key types validators can use. +// NOTE: uses ABCI pubkey naming, not Amino names. +message ValidatorParams { + option (gogoproto.populate) = true; + option (gogoproto.equal) = true; + + repeated string pub_key_types = 1; +} + +// VersionParams contains the ABCI application version. +message VersionParams { + option (gogoproto.populate) = true; + option (gogoproto.equal) = true; + + uint64 app_version = 1; +} + +// HashedParams is a subset of ConsensusParams. +// +// It is hashed into the Header.ConsensusHash. +message HashedParams { + int64 block_max_bytes = 1; + int64 block_max_gas = 2; +} diff --git a/third_party/proto/tendermint/types/types.proto b/third_party/proto/tendermint/types/types.proto new file mode 100644 index 00000000..7f7ea74c --- /dev/null +++ b/third_party/proto/tendermint/types/types.proto @@ -0,0 +1,157 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "tendermint/crypto/proof.proto"; +import "tendermint/version/types.proto"; +import "tendermint/types/validator.proto"; + +// BlockIdFlag indicates which BlcokID the signature is for +enum BlockIDFlag { + option (gogoproto.goproto_enum_stringer) = true; + option (gogoproto.goproto_enum_prefix) = false; + + BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; + BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; + BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; + BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; +} + +// SignedMsgType is a type of signed message in the consensus. +enum SignedMsgType { + option (gogoproto.goproto_enum_stringer) = true; + option (gogoproto.goproto_enum_prefix) = false; + + SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"]; + // Votes + SIGNED_MSG_TYPE_PREVOTE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"]; + SIGNED_MSG_TYPE_PRECOMMIT = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"]; + + // Proposals + SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"]; +} + +// PartsetHeader +message PartSetHeader { + uint32 total = 1; + bytes hash = 2; +} + +message Part { + uint32 index = 1; + bytes bytes = 2; + tendermint.crypto.Proof proof = 3 [(gogoproto.nullable) = false]; +} + +// BlockID +message BlockID { + bytes hash = 1; + PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; +} + +// -------------------------------- + +// Header defines the structure of a Tendermint block header. +message Header { + // basic block info + tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false]; + string chain_id = 2 [(gogoproto.customname) = "ChainID"]; + int64 height = 3; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + + // prev block info + BlockID last_block_id = 5 [(gogoproto.nullable) = false]; + + // hashes of block data + bytes last_commit_hash = 6; // commit from validators from the last block + bytes data_hash = 7; // transactions + + // hashes from the app output from the prev block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = 12; // root hash of all results from the txs from the previous block + + // consensus info + bytes evidence_hash = 13; // evidence included in the block + bytes proposer_address = 14; // original proposer of the block +} + +// Data contains the set of transactions included in the block +message Data { + // Txs that will be applied by state @ block.Height+1. + // NOTE: not all txs here are valid. We're just agreeing on the order first. + // This means that block.AppHash does not include these txs. + repeated bytes txs = 1; +} + +// Vote represents a prevote, precommit, or commit vote from validators for +// consensus. +message Vote { + SignedMsgType type = 1; + int64 height = 2; + int32 round = 3; + BlockID block_id = 4 + [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. + google.protobuf.Timestamp timestamp = 5 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes validator_address = 6; + int32 validator_index = 7; + bytes signature = 8; +} + +// Commit contains the evidence that a block was committed by a set of validators. +message Commit { + int64 height = 1; + int32 round = 2; + BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; + repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; +} + +// CommitSig is a part of the Vote included in a Commit. +message CommitSig { + BlockIDFlag block_id_flag = 1; + bytes validator_address = 2; + google.protobuf.Timestamp timestamp = 3 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 4; +} + +message Proposal { + SignedMsgType type = 1; + int64 height = 2; + int32 round = 3; + int32 pol_round = 4; + BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + google.protobuf.Timestamp timestamp = 6 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 7; +} + +message SignedHeader { + Header header = 1; + Commit commit = 2; +} + +message LightBlock { + SignedHeader signed_header = 1; + tendermint.types.ValidatorSet validator_set = 2; +} + +message BlockMeta { + BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + int64 block_size = 2; + Header header = 3 [(gogoproto.nullable) = false]; + int64 num_txs = 4; +} + +// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. +message TxProof { + bytes root_hash = 1; + bytes data = 2; + tendermint.crypto.Proof proof = 3; +} diff --git a/third_party/proto/tendermint/types/validator.proto b/third_party/proto/tendermint/types/validator.proto new file mode 100644 index 00000000..49860b96 --- /dev/null +++ b/third_party/proto/tendermint/types/validator.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "tendermint/crypto/keys.proto"; + +message ValidatorSet { + repeated Validator validators = 1; + Validator proposer = 2; + int64 total_voting_power = 3; +} + +message Validator { + bytes address = 1; + tendermint.crypto.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; + int64 voting_power = 3; + int64 proposer_priority = 4; +} + +message SimpleValidator { + tendermint.crypto.PublicKey pub_key = 1; + int64 voting_power = 2; +} diff --git a/third_party/proto/tendermint/version/types.proto b/third_party/proto/tendermint/version/types.proto new file mode 100644 index 00000000..6061868b --- /dev/null +++ b/third_party/proto/tendermint/version/types.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package tendermint.version; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/version"; + +import "gogoproto/gogo.proto"; + +// App includes the protocol and software version for the application. +// This information is included in ResponseInfo. The App.Protocol can be +// updated in ResponseEndBlock. +message App { + uint64 protocol = 1; + string software = 2; +} + +// Consensus captures the consensus rules for processing a block in the blockchain, +// including all blockchain data structures and the rules of the application's +// state transition machine. +message Consensus { + option (gogoproto.equal) = true; + + uint64 block = 1; + uint64 app = 2; +} diff --git a/types/account.go b/types/account.go new file mode 100644 index 00000000..38152f0c --- /dev/null +++ b/types/account.go @@ -0,0 +1,19 @@ +package types + +import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/ethereum/go-ethereum/common" +) + +// EthAccountI represents the interface of an EVM compatible account +type EthAccountI interface { + authtypes.AccountI + // EthAddress returns the ethereum Address representation of the AccAddress + EthAddress() common.Address + // CodeHash is the keccak256 hash of the contract code (if any) + GetCodeHash() common.Hash + // SetCodeHash sets the code hash to the account fields + SetCodeHash(code common.Hash) error + // Type returns the type of Ethereum Account (EOA or Contract) + Type() int8 +} diff --git a/types/address.go b/types/address.go index 3098d3e5..4f48de4b 100644 --- a/types/address.go +++ b/types/address.go @@ -6,11 +6,13 @@ import ( "fmt" "strings" + "gopkg.in/yaml.v2" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" + + //tmamino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/crypto" - tmamino "github.com/tendermint/tendermint/crypto/encoding/amino" - "github.com/tendermint/tendermint/libs/bech32" - "gopkg.in/yaml.v2" ) // Bech32PubKeyType defines a string type alias for a Bech32 public key type. @@ -62,35 +64,35 @@ func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) (string, error) // GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with // a given key type. -func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (crypto.PubKey, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetConfig().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() - - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() - - case Bech32PubKeyTypeSdsP2PPub: - bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() - } - - bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) - if err != nil { - return nil, err - } - - pk, err := tmamino.PubKeyFromBytes(bz) - if err != nil { - return nil, err - } - - return pk, nil -} +//func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (crypto.PubKey, error) { +// var bech32Prefix string +// +// switch pkt { +// case Bech32PubKeyTypeAccPub: +// bech32Prefix = GetConfig().GetBech32AccountPubPrefix() +// +// case Bech32PubKeyTypeValPub: +// bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() +// +// case Bech32PubKeyTypeConsPub: +// bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() +// +// case Bech32PubKeyTypeSdsP2PPub: +// bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() +// } +// +// bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) +// if err != nil { +// return nil, err +// } +// +// pk, err := tmamino.PubKeyFromBytes(bz) +// if err != nil { +// return nil, err +// } +// +// return pk, nil +//} type SdsAddress []byte diff --git a/types/block.go b/types/block.go new file mode 100644 index 00000000..40d77bca --- /dev/null +++ b/types/block.go @@ -0,0 +1,28 @@ +package types + +import sdk "github.com/cosmos/cosmos-sdk/types" + +// BlockGasLimit returns the max gas (limit) defined in the block gas meter. If the meter is not +// set, it returns the max gas from the application consensus params. +// NOTE: see https://github.com/cosmos/cosmos-sdk/issues/9514 for full reference +func BlockGasLimit(ctx sdk.Context) uint64 { + blockGasMeter := ctx.BlockGasMeter() + + // Get the limit from the gas meter only if its not null and not an InfiniteGasMeter + if blockGasMeter != nil && blockGasMeter.Limit() != 0 { + return blockGasMeter.Limit() + } + + // Otherwise get from the consensus parameters + cp := ctx.ConsensusParams() + if cp == nil || cp.Block == nil { + return 0 + } + + maxGas := cp.Block.MaxGas + if maxGas > 0 { + return uint64(maxGas) + } + + return 0 +} diff --git a/types/chain_id.go b/types/chain_id.go new file mode 100644 index 00000000..3c5e766f --- /dev/null +++ b/types/chain_id.go @@ -0,0 +1,50 @@ +package types + +import ( + "fmt" + "math/big" + "regexp" + "strings" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + regexChainID = `[a-z]{1,}` + regexEIP155Separator = `_{1}` + regexEIP155 = `[1-9][0-9]*` + regexEpochSeparator = `-{1}` + regexEpoch = `[1-9][0-9]*` + stratosChainID = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)%s(%s)$`, regexChainID, regexEIP155Separator, regexEIP155, regexEpochSeparator, regexEpoch)) +) + +// IsValidChainID returns false if the given chain identifier is incorrectly formatted. +func IsValidChainID(chainID string) bool { + if len(chainID) > 48 { + return false + } + + return stratosChainID.MatchString(chainID) +} + +// ParseChainID 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 ParseChainID(chainID string) (*big.Int, error) { + chainID = strings.TrimSpace(chainID) + if len(chainID) > 48 { + return nil, sdkerrors.Wrapf(ErrInvalidChainID, "chain-id '%s' cannot exceed 48 chars", chainID) + } + + matches := stratosChainID.FindStringSubmatch(chainID) + if matches == nil || len(matches) != 4 || matches[1] == "" { + return nil, sdkerrors.Wrapf(ErrInvalidChainID, "%s: %v", chainID, matches) + } + + // verify that the chain-id entered is a base 10 integer + chainIDInt, ok := new(big.Int).SetString(matches[2], 10) + if !ok { + return nil, sdkerrors.Wrapf(ErrInvalidChainID, "epoch %s must be base-10 integer format", matches[2]) + } + + return chainIDInt, nil +} diff --git a/types/coin.go b/types/coin.go new file mode 100644 index 00000000..978b0fbb --- /dev/null +++ b/types/coin.go @@ -0,0 +1,12 @@ +package types + +const ( + USTOS string = "ustos" + + // BaseDenomUnit defines the base denomination unit for Photons. + // 1 photon = 1x10^{BaseDenomUnit} aphoton + BaseDenomUnit = 18 + + // DefaultGasPrice is default gas price for evm transactions + DefaultGasPrice = 20 +) diff --git a/types/errors.go b/types/errors.go new file mode 100644 index 00000000..28e286a0 --- /dev/null +++ b/types/errors.go @@ -0,0 +1,26 @@ +package types + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + // RootCodespace is the codespace for all errors defined in this package + RootCodespace = "stratos" +) + +// NOTE: We can't use 1 since that error code is reserved for internal errors. + +var ( + // ErrInvalidValue returns an error resulting from an invalid value. + ErrInvalidValue = sdkerrors.Register(RootCodespace, 2, "invalid value") + + // ErrInvalidChainID returns an error resulting from an invalid chain ID. + ErrInvalidChainID = sdkerrors.Register(RootCodespace, 3, "invalid chain ID") + + // ErrMarshalBigInt returns an error resulting from marshaling a big.Int to a string. + ErrMarshalBigInt = sdkerrors.Register(RootCodespace, 5, "cannot marshal big.Int to string") + + // ErrUnmarshalBigInt returns an error resulting from unmarshaling a big.Int from a string. + ErrUnmarshalBigInt = sdkerrors.Register(RootCodespace, 6, "cannot unmarshal big.Int from string") +) diff --git a/types/hdpath.go b/types/hdpath.go new file mode 100644 index 00000000..02732d92 --- /dev/null +++ b/types/hdpath.go @@ -0,0 +1,24 @@ +package types + +import ( + ethaccounts "github.com/ethereum/go-ethereum/accounts" +) + +type ( + HDPathIterator func() ethaccounts.DerivationPath +) + +// HDPathIterator receives a base path as a string and a boolean for the desired iterator type and +// returns a function that iterates over the base HD path, returning the string. +func NewHDPathIterator(basePath string, ledgerIter bool) (HDPathIterator, error) { + hdPath, err := ethaccounts.ParseDerivationPath(basePath) + if err != nil { + return nil, err + } + + if ledgerIter { + return ethaccounts.LedgerLiveIterator(hdPath), nil + } + + return ethaccounts.DefaultIterator(hdPath), nil +} diff --git a/types/protoco.go b/types/protoco.go new file mode 100644 index 00000000..580c344c --- /dev/null +++ b/types/protoco.go @@ -0,0 +1,9 @@ +package types + +// Constants to match up protocol versions and messages +const ( + eth65 = 65 + + // ProtocolVersion is the latest supported version of the eth protocol. + ProtocolVersion = eth65 +) diff --git a/types/validation.go b/types/validation.go new file mode 100644 index 00000000..15e27ee3 --- /dev/null +++ b/types/validation.go @@ -0,0 +1,39 @@ +package types + +import ( + "bytes" + "math" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" +) + +// IsEmptyHash returns true if the hash corresponds to an empty ethereum hex hash. +func IsEmptyHash(hash string) bool { + return bytes.Equal(common.HexToHash(hash).Bytes(), common.Hash{}.Bytes()) +} + +// IsZeroAddress returns true if the address corresponds to an empty ethereum hex address. +func IsZeroAddress(address string) bool { + return bytes.Equal(common.HexToAddress(address).Bytes(), common.Address{}.Bytes()) +} + +// ValidateAddress returns an error if the provided string is either not a hex formatted string address +func ValidateAddress(address string) error { + if !common.IsHexAddress(address) { + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidAddress, "address '%s' is not a valid ethereum hex address", + address, + ) + } + return nil +} + +// SafeInt64 checks for overflows while casting a uint64 to int64 value. +func SafeInt64(value uint64) (int64, error) { + if value > uint64(math.MaxInt64) { + return 0, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "uint64 value %v cannot exceed %v", value, int64(math.MaxInt64)) + } + + return int64(value), nil +} diff --git a/vue/.browserslistrc b/vue/.browserslistrc deleted file mode 100644 index 214388fe..00000000 --- a/vue/.browserslistrc +++ /dev/null @@ -1,3 +0,0 @@ -> 1% -last 2 versions -not dead diff --git a/vue/.env b/vue/.env deleted file mode 100644 index 3c61eef5..00000000 --- a/vue/.env +++ /dev/null @@ -1 +0,0 @@ -VUE_APP_ADDRESS_PREFIX=cosmos \ No newline at end of file diff --git a/vue/.gitignore b/vue/.gitignore deleted file mode 100644 index 11f5d714..00000000 --- a/vue/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -.DS_Store -node_modules -/dist - -# local env files -.env.local -.env.*.local - -# Log files -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* - -# Editor directories and files -.idea -.vscode -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? diff --git a/vue/README.md b/vue/README.md deleted file mode 100644 index 1de4c652..00000000 --- a/vue/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# stratoschain UI - -This is the [vuejs](https://vuejs.org/) user inteface to stratoschain. - -It provides UI components including login, and a template for you to do additonal development. - -## Project setup - -``` -npm install -``` - -### Compiles and hot-reloads for development - -``` -npm run serve -``` - -### Compiles and minifies for production - -``` -npm run build -``` - -### Customize configuration - -See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/vue/babel.config.js b/vue/babel.config.js deleted file mode 100644 index e9558405..00000000 --- a/vue/babel.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset' - ] -} diff --git a/vue/package-lock.json b/vue/package-lock.json deleted file mode 100644 index 34377973..00000000 --- a/vue/package-lock.json +++ /dev/null @@ -1,11792 +0,0 @@ -{ - "name": "frontend", - "version": "0.1.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/compat-data": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.11.0.tgz", - "integrity": "sha512-TPSvJfv73ng0pfnEOh17bYMPQbI95+nGWc71Ss4vZdRBHTDqmM9Z8ZV4rYz8Ks7sfzc95n30k6ODIq5UGnXcYQ==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "invariant": "^2.2.4", - "semver": "^5.5.0" - } - }, - "@babel/core": { - "version": "7.11.6", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.6.tgz", - "integrity": "sha512-Wpcv03AGnmkgm6uS6k8iwhIwTrcP0m17TL1n1sy7qD0qelDu4XNeW0dN0mHfa+Gei211yDaLoEe/VlbXQzM4Bg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.11.6", - "@babel/helper-module-transforms": "^7.11.0", - "@babel/helpers": "^7.10.4", - "@babel/parser": "^7.11.5", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.11.5", - "@babel/types": "^7.11.5", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.21", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.11.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.6.tgz", - "integrity": "sha512-DWtQ1PV3r+cLbySoHrwn9RWEgKMBLLma4OBQloPRyDYvc5msJM9kvTLo1YnlJd1P/ZuKbdli3ijr5q3FvAF3uA==", - "dev": true, - "requires": { - "@babel/types": "^7.11.5", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "@babel/helper-annotate-as-pure": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz", - "integrity": "sha512-XQlqKQP4vXFB7BN8fEEerrmYvHp3fK/rBkRFz9jaJbzK0B1DSfej9Kc7ZzE8Z/OnId1jpJdNAZ3BFQjWG68rcA==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz", - "integrity": "sha512-L0zGlFrGWZK4PbT8AszSfLTM5sDU1+Az/En9VrdT8/LmEiJt4zXt+Jve9DCAnQcbqDhCI+29y/L93mrDzddCcg==", - "dev": true, - "requires": { - "@babel/helper-explode-assignable-expression": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-compilation-targets": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.10.4.tgz", - "integrity": "sha512-a3rYhlsGV0UHNDvrtOXBg8/OpfV0OKTkxKPzIplS1zpx7CygDcWWxckxZeDd3gzPzC4kUT0A4nVFDK0wGMh4MQ==", - "dev": true, - "requires": { - "@babel/compat-data": "^7.10.4", - "browserslist": "^4.16.5", - "invariant": "^2.2.4", - "levenary": "^1.1.1", - "semver": "^5.5.0" - } - }, - "@babel/helper-create-class-features-plugin": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.5.tgz", - "integrity": "sha512-0nkdeijB7VlZoLT3r/mY3bUkw3T8WG/hNw+FATs/6+pG2039IJWjTYL0VTISqsNHMUTEnwbVnc89WIJX9Qed0A==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-member-expression-to-functions": "^7.10.5", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-replace-supers": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.10.4" - } - }, - "@babel/helper-create-regexp-features-plugin": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.10.4.tgz", - "integrity": "sha512-2/hu58IEPKeoLF45DBwx3XFqsbCXmkdAay4spVr2x0jYgRxrSNp+ePwvSsy9g6YSaNDcKIQVPXk1Ov8S2edk2g==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.10.4", - "@babel/helper-regex": "^7.10.4", - "regexpu-core": "^4.7.0" - } - }, - "@babel/helper-define-map": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz", - "integrity": "sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/types": "^7.10.5", - "lodash": "^4.17.21" - } - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.11.4", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.11.4.tgz", - "integrity": "sha512-ux9hm3zR4WV1Y3xXxXkdG/0gxF9nvI0YVmKVhvK9AfMoaQkemL3sJpXw+Xbz65azo8qJiEz2XVDUpK3KYhH3ZQ==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-function-name": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", - "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", - "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz", - "integrity": "sha512-wljroF5PgCk2juF69kanHVs6vrLwIPNp6DLD+Lrl3hoQ3PpPPikaDRNFA+0t81NOoMt2DL6WW/mdU8k4k6ZzuA==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz", - "integrity": "sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q==", - "dev": true, - "requires": { - "@babel/types": "^7.11.0" - } - }, - "@babel/helper-module-imports": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz", - "integrity": "sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-module-transforms": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz", - "integrity": "sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.10.4", - "@babel/helper-replace-supers": "^7.10.4", - "@babel/helper-simple-access": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/template": "^7.10.4", - "@babel/types": "^7.11.0", - "lodash": "^4.17.21" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz", - "integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz", - "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==", - "dev": true - }, - "@babel/helper-regex": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.10.5.tgz", - "integrity": "sha512-68kdUAzDrljqBrio7DYAEgCoJHxppJOERHOgOrDN7WjOzP0ZQ1LsSDRXcemzVZaLvjaJsJEESb6qt+znNuENDg==", - "dev": true, - "requires": { - "lodash": "^4.17.21" - } - }, - "@babel/helper-remap-async-to-generator": { - "version": "7.11.4", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.11.4.tgz", - "integrity": "sha512-tR5vJ/vBa9wFy3m5LLv2faapJLnDFxNWff2SAYkSE4rLUdbp7CdObYFgI7wK4T/Mj4UzpjPwzR8Pzmr5m7MHGA==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.10.4", - "@babel/helper-wrap-function": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-replace-supers": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz", - "integrity": "sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A==", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.10.4", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-simple-access": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz", - "integrity": "sha512-0fMy72ej/VEvF8ULmX6yb5MtHG4uH4Dbd6I/aHDb/JVg0bbivwt9Wg+h3uMvX+QSFtwr5MeItvazbrc4jtRAXw==", - "dev": true, - "requires": { - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.11.0.tgz", - "integrity": "sha512-0XIdiQln4Elglgjbwo9wuJpL/K7AGCY26kmEt0+pRP0TAj4jjyNq1MjoRvikrTVqKcx4Gysxt4cXvVFXP/JO2Q==", - "dev": true, - "requires": { - "@babel/types": "^7.11.0" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", - "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", - "dev": true, - "requires": { - "@babel/types": "^7.11.0" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", - "dev": true - }, - "@babel/helper-wrap-function": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.10.4.tgz", - "integrity": "sha512-6py45WvEF0MhiLrdxtRjKjufwLL1/ob2qDJgg5JgNdojBAZSAKnAjkyOCNug6n+OBl4VW76XjvgSFTdaMcW0Ug==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helpers": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.10.4.tgz", - "integrity": "sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA==", - "dev": true, - "requires": { - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.11.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.5.tgz", - "integrity": "sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==", - "dev": true - }, - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz", - "integrity": "sha512-cNMCVezQbrRGvXJwm9fu/1sJj9bHdGAgKodZdLqOQIpfoH3raqmRPBM17+lh7CzhiKRRBrGtZL9WcjxSoGYUSg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-remap-async-to-generator": "^7.10.4", - "@babel/plugin-syntax-async-generators": "^7.8.0" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.10.4.tgz", - "integrity": "sha512-vhwkEROxzcHGNu2mzUC0OFFNXdZ4M23ib8aRRcJSsW8BZK9pQMD7QB7csl97NBbgGZO7ZyHUyKDnxzOaP4IrCg==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-proposal-decorators": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.10.5.tgz", - "integrity": "sha512-Sc5TAQSZuLzgY0664mMDn24Vw2P8g/VhyLyGPaWiHahhgLqeZvcGeyBZOrJW0oSKIK2mvQ22a1ENXBIQLhrEiQ==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.10.5", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-decorators": "^7.10.4" - } - }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.10.4.tgz", - "integrity": "sha512-up6oID1LeidOOASNXgv/CFbgBqTuKJ0cJjz6An5tWD+NVBNlp3VNSBxv2ZdU7SYl3NxJC7agAQDApZusV6uFwQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-dynamic-import": "^7.8.0" - } - }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.10.4.tgz", - "integrity": "sha512-aNdf0LY6/3WXkhh0Fdb6Zk9j1NMD8ovj3F6r0+3j837Pn1S1PdNtcwJ5EG9WkVPNHPxyJDaxMaAOVq4eki0qbg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - } - }, - "@babel/plugin-proposal-json-strings": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.10.4.tgz", - "integrity": "sha512-fCL7QF0Jo83uy1K0P2YXrfX11tj3lkpN7l4dMv9Y9VkowkhkQDwFHFd8IiwyK5MZjE8UpbgokkgtcReH88Abaw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-json-strings": "^7.8.0" - } - }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.11.0.tgz", - "integrity": "sha512-/f8p4z+Auz0Uaf+i8Ekf1iM7wUNLcViFUGiPxKeXvxTSl63B875YPiVdUDdem7hREcI0E0kSpEhS8tF5RphK7Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.10.4.tgz", - "integrity": "sha512-wq5n1M3ZUlHl9sqT2ok1T2/MTt6AXE0e1Lz4WzWBr95LsAZ5qDXe4KnFuauYyEyLiohvXFMdbsOTMyLZs91Zlw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" - } - }, - "@babel/plugin-proposal-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.10.4.tgz", - "integrity": "sha512-73/G7QoRoeNkLZFxsoCCvlg4ezE4eM+57PnOqgaPOozd5myfj7p0muD1mRVJvbUWbOzD+q3No2bWbaKy+DJ8DA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.11.0.tgz", - "integrity": "sha512-wzch41N4yztwoRw0ak+37wxwJM2oiIiy6huGCoqkvSTA9acYWcPfn9Y4aJqmFFJ70KTJUu29f3DQ43uJ9HXzEA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.0", - "@babel/plugin-transform-parameters": "^7.10.4" - } - }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.10.4.tgz", - "integrity": "sha512-LflT6nPh+GK2MnFiKDyLiqSqVHkQnVf7hdoAvyTnnKj9xB3docGRsdPuxp6qqqW19ifK3xgc9U5/FwrSaCNX5g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.0" - } - }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.11.0.tgz", - "integrity": "sha512-v9fZIu3Y8562RRwhm1BbMRxtqZNFmFA2EG+pT2diuU8PT3H6T/KXoZ54KgYisfOFZHV6PfvAiBIZ9Rcz+/JCxA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-skip-transparent-expression-wrappers": "^7.11.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.0" - } - }, - "@babel/plugin-proposal-private-methods": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.10.4.tgz", - "integrity": "sha512-wh5GJleuI8k3emgTg5KkJK6kHNsGEr0uBTDBuQUBJwckk9xs1ez79ioheEVVxMLyPscB0LfkbVHslQqIzWV6Bw==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.10.4.tgz", - "integrity": "sha512-H+3fOgPnEXFL9zGYtKQe4IDOPKYlZdF1kqFDQRRb8PK4B8af1vAGK04tF5iQAAsui+mHNBQSAtd2/ndEDe9wuA==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-class-properties": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.10.4.tgz", - "integrity": "sha512-GCSBF7iUle6rNugfURwNmCGG3Z/2+opxAMLs1nND4bhEG5PuxTIggDBoeYYSujAlLtsupzOHYJQgPS3pivwXIA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-decorators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.10.4.tgz", - "integrity": "sha512-2NaoC6fAk2VMdhY1eerkfHV+lVYC1u8b+jmRJISqANCJlTxYy19HGdIkkQtix2UtkcPuPu+IlDgrVseZnU03bw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.3" - } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-jsx": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.10.4.tgz", - "integrity": "sha512-KCg9mio9jwiARCB7WAcQ7Y1q+qicILjoK8LP/VkPkEKaf5dkaZZK1EcTe91a3JJlZ3qy6L5s9X52boEYi8DM9g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.10.4.tgz", - "integrity": "sha512-ni1brg4lXEmWyafKr0ccFWkJG0CeMt4WV1oyeBW6EFObF4oOHclbkj5cARxAPQyAQ2UTuplJyK4nfkXIMMFvsQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-arrow-functions": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.10.4.tgz", - "integrity": "sha512-9J/oD1jV0ZCBcgnoFWFq1vJd4msoKb/TCpGNFyyLt0zABdcvgK3aYikZ8HjzB14c26bc7E3Q1yugpwGy2aTPNA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-async-to-generator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.10.4.tgz", - "integrity": "sha512-F6nREOan7J5UXTLsDsZG3DXmZSVofr2tGNwfdrVwkDWHfQckbQXnXSPfD7iO+c/2HGqycwyLST3DnZ16n+cBJQ==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-remap-async-to-generator": "^7.10.4" - } - }, - "@babel/plugin-transform-block-scoped-functions": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.10.4.tgz", - "integrity": "sha512-WzXDarQXYYfjaV1szJvN3AD7rZgZzC1JtjJZ8dMHUyiK8mxPRahynp14zzNjU3VkPqPsO38CzxiWO1c9ARZ8JA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-block-scoping": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.11.1.tgz", - "integrity": "sha512-00dYeDE0EVEHuuM+26+0w/SCL0BH2Qy7LwHuI4Hi4MH5gkC8/AqMN5uWFJIsoXZrAphiMm1iXzBw6L2T+eA0ew==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-classes": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.10.4.tgz", - "integrity": "sha512-2oZ9qLjt161dn1ZE0Ms66xBncQH4In8Sqw1YWgBUZuGVJJS5c0OFZXL6dP2MRHrkU/eKhWg8CzFJhRQl50rQxA==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.10.4", - "@babel/helper-define-map": "^7.10.4", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-replace-supers": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.10.4", - "globals": "^11.1.0" - } - }, - "@babel/plugin-transform-computed-properties": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.10.4.tgz", - "integrity": "sha512-JFwVDXcP/hM/TbyzGq3l/XWGut7p46Z3QvqFMXTfk6/09m7xZHJUN9xHfsv7vqqD4YnfI5ueYdSJtXqqBLyjBw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-destructuring": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.10.4.tgz", - "integrity": "sha512-+WmfvyfsyF603iPa6825mq6Qrb7uLjTOsa3XOFzlYcYDHSS4QmpOWOL0NNBY5qMbvrcf3tq0Cw+v4lxswOBpgA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-dotall-regex": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.10.4.tgz", - "integrity": "sha512-ZEAVvUTCMlMFAbASYSVQoxIbHm2OkG2MseW6bV2JjIygOjdVv8tuxrCTzj1+Rynh7ODb8GivUy7dzEXzEhuPaA==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-duplicate-keys": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.10.4.tgz", - "integrity": "sha512-GL0/fJnmgMclHiBTTWXNlYjYsA7rDrtsazHG6mglaGSTh0KsrW04qml+Bbz9FL0LcJIRwBWL5ZqlNHKTkU3xAA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-exponentiation-operator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.10.4.tgz", - "integrity": "sha512-S5HgLVgkBcRdyQAHbKj+7KyuWx8C6t5oETmUuwz1pt3WTWJhsUV0WIIXuVvfXMxl/QQyHKlSCNNtaIamG8fysw==", - "dev": true, - "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-for-of": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.10.4.tgz", - "integrity": "sha512-ItdQfAzu9AlEqmusA/65TqJ79eRcgGmpPPFvBnGILXZH975G0LNjP1yjHvGgfuCxqrPPueXOPe+FsvxmxKiHHQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-function-name": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.10.4.tgz", - "integrity": "sha512-OcDCq2y5+E0dVD5MagT5X+yTRbcvFjDI2ZVAottGH6tzqjx/LKpgkUepu3hp/u4tZBzxxpNGwLsAvGBvQ2mJzg==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-literals": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.10.4.tgz", - "integrity": "sha512-Xd/dFSTEVuUWnyZiMu76/InZxLTYilOSr1UlHV+p115Z/Le2Fi1KXkJUYz0b42DfndostYlPub3m8ZTQlMaiqQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-member-expression-literals": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.10.4.tgz", - "integrity": "sha512-0bFOvPyAoTBhtcJLr9VcwZqKmSjFml1iVxvPL0ReomGU53CX53HsM4h2SzckNdkQcHox1bpAqzxBI1Y09LlBSw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-modules-amd": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.5.tgz", - "integrity": "sha512-elm5uruNio7CTLFItVC/rIzKLfQ17+fX7EVz5W0TMgIHFo1zY0Ozzx+lgwhL4plzl8OzVn6Qasx5DeEFyoNiRw==", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.10.5", - "@babel/helper-plugin-utils": "^7.10.4", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-commonjs": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.10.4.tgz", - "integrity": "sha512-Xj7Uq5o80HDLlW64rVfDBhao6OX89HKUmb+9vWYaLXBZOma4gA6tw4Ni1O5qVDoZWUV0fxMYA0aYzOawz0l+1w==", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-simple-access": "^7.10.4", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-systemjs": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.5.tgz", - "integrity": "sha512-f4RLO/OL14/FP1AEbcsWMzpbUz6tssRaeQg11RH1BP/XnPpRoVwgeYViMFacnkaw4k4wjRSjn3ip1Uw9TaXuMw==", - "dev": true, - "requires": { - "@babel/helper-hoist-variables": "^7.10.4", - "@babel/helper-module-transforms": "^7.10.5", - "@babel/helper-plugin-utils": "^7.10.4", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-umd": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.10.4.tgz", - "integrity": "sha512-mohW5q3uAEt8T45YT7Qc5ws6mWgJAaL/8BfWD9Dodo1A3RKWli8wTS+WiQ/knF+tXlPirW/1/MqzzGfCExKECA==", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.10.4.tgz", - "integrity": "sha512-V6LuOnD31kTkxQPhKiVYzYC/Jgdq53irJC/xBSmqcNcqFGV+PER4l6rU5SH2Vl7bH9mLDHcc0+l9HUOe4RNGKA==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.10.4" - } - }, - "@babel/plugin-transform-new-target": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.10.4.tgz", - "integrity": "sha512-YXwWUDAH/J6dlfwqlWsztI2Puz1NtUAubXhOPLQ5gjR/qmQ5U96DY4FQO8At33JN4XPBhrjB8I4eMmLROjjLjw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-object-super": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.10.4.tgz", - "integrity": "sha512-5iTw0JkdRdJvr7sY0vHqTpnruUpTea32JHmq/atIWqsnNussbRzjEDyWep8UNztt1B5IusBYg8Irb0bLbiEBCQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-replace-supers": "^7.10.4" - } - }, - "@babel/plugin-transform-parameters": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.5.tgz", - "integrity": "sha512-xPHwUj5RdFV8l1wuYiu5S9fqWGM2DrYc24TMvUiRrPVm+SM3XeqU9BcokQX/kEUe+p2RBwy+yoiR1w/Blq6ubw==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-property-literals": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.10.4.tgz", - "integrity": "sha512-ofsAcKiUxQ8TY4sScgsGeR2vJIsfrzqvFb9GvJ5UdXDzl+MyYCaBj/FGzXuv7qE0aJcjWMILny1epqelnFlz8g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-regenerator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.10.4.tgz", - "integrity": "sha512-3thAHwtor39A7C04XucbMg17RcZ3Qppfxr22wYzZNcVIkPHfpM9J0SO8zuCV6SZa265kxBJSrfKTvDCYqBFXGw==", - "dev": true, - "requires": { - "regenerator-transform": "^0.14.2" - } - }, - "@babel/plugin-transform-reserved-words": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.10.4.tgz", - "integrity": "sha512-hGsw1O6Rew1fkFbDImZIEqA8GoidwTAilwCyWqLBM9f+e/u/sQMQu7uX6dyokfOayRuuVfKOW4O7HvaBWM+JlQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-runtime": { - "version": "7.11.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.11.5.tgz", - "integrity": "sha512-9aIoee+EhjySZ6vY5hnLjigHzunBlscx9ANKutkeWTJTx6m5Rbq6Ic01tLvO54lSusR+BxV7u4UDdCmXv5aagg==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "resolve": "^1.8.1", - "semver": "^5.5.1" - } - }, - "@babel/plugin-transform-shorthand-properties": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.10.4.tgz", - "integrity": "sha512-AC2K/t7o07KeTIxMoHneyX90v3zkm5cjHJEokrPEAGEy3UCp8sLKfnfOIGdZ194fyN4wfX/zZUWT9trJZ0qc+Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-spread": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.11.0.tgz", - "integrity": "sha512-UwQYGOqIdQJe4aWNyS7noqAnN2VbaczPLiEtln+zPowRNlD+79w3oi2TWfYe0eZgd+gjZCbsydN7lzWysDt+gw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-skip-transparent-expression-wrappers": "^7.11.0" - } - }, - "@babel/plugin-transform-sticky-regex": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.10.4.tgz", - "integrity": "sha512-Ddy3QZfIbEV0VYcVtFDCjeE4xwVTJWTmUtorAJkn6u/92Z/nWJNV+mILyqHKrUxXYKA2EoCilgoPePymKL4DvQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-regex": "^7.10.4" - } - }, - "@babel/plugin-transform-template-literals": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.5.tgz", - "integrity": "sha512-V/lnPGIb+KT12OQikDvgSuesRX14ck5FfJXt6+tXhdkJ+Vsd0lDCVtF6jcB4rNClYFzaB2jusZ+lNISDk2mMMw==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-typeof-symbol": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.10.4.tgz", - "integrity": "sha512-QqNgYwuuW0y0H+kUE/GWSR45t/ccRhe14Fs/4ZRouNNQsyd4o3PG4OtHiIrepbM2WKUBDAXKCAK/Lk4VhzTaGA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-unicode-escapes": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.10.4.tgz", - "integrity": "sha512-y5XJ9waMti2J+e7ij20e+aH+fho7Wb7W8rNuu72aKRwCHFqQdhkdU2lo3uZ9tQuboEJcUFayXdARhcxLQ3+6Fg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-unicode-regex": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.10.4.tgz", - "integrity": "sha512-wNfsc4s8N2qnIwpO/WP2ZiSyjfpTamT2C9V9FDH/Ljub9zw6P3SjkXcFmc0RQUt96k2fmIvtla2MMjgTwIAC+A==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/preset-env": { - "version": "7.11.5", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.11.5.tgz", - "integrity": "sha512-kXqmW1jVcnB2cdueV+fyBM8estd5mlNfaQi6lwLgRwCby4edpavgbFhiBNjmWA3JpB/yZGSISa7Srf+TwxDQoA==", - "dev": true, - "requires": { - "@babel/compat-data": "^7.11.0", - "@babel/helper-compilation-targets": "^7.10.4", - "@babel/helper-module-imports": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-proposal-async-generator-functions": "^7.10.4", - "@babel/plugin-proposal-class-properties": "^7.10.4", - "@babel/plugin-proposal-dynamic-import": "^7.10.4", - "@babel/plugin-proposal-export-namespace-from": "^7.10.4", - "@babel/plugin-proposal-json-strings": "^7.10.4", - "@babel/plugin-proposal-logical-assignment-operators": "^7.11.0", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", - "@babel/plugin-proposal-numeric-separator": "^7.10.4", - "@babel/plugin-proposal-object-rest-spread": "^7.11.0", - "@babel/plugin-proposal-optional-catch-binding": "^7.10.4", - "@babel/plugin-proposal-optional-chaining": "^7.11.0", - "@babel/plugin-proposal-private-methods": "^7.10.4", - "@babel/plugin-proposal-unicode-property-regex": "^7.10.4", - "@babel/plugin-syntax-async-generators": "^7.8.0", - "@babel/plugin-syntax-class-properties": "^7.10.4", - "@babel/plugin-syntax-dynamic-import": "^7.8.0", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.0", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.0", - "@babel/plugin-syntax-top-level-await": "^7.10.4", - "@babel/plugin-transform-arrow-functions": "^7.10.4", - "@babel/plugin-transform-async-to-generator": "^7.10.4", - "@babel/plugin-transform-block-scoped-functions": "^7.10.4", - "@babel/plugin-transform-block-scoping": "^7.10.4", - "@babel/plugin-transform-classes": "^7.10.4", - "@babel/plugin-transform-computed-properties": "^7.10.4", - "@babel/plugin-transform-destructuring": "^7.10.4", - "@babel/plugin-transform-dotall-regex": "^7.10.4", - "@babel/plugin-transform-duplicate-keys": "^7.10.4", - "@babel/plugin-transform-exponentiation-operator": "^7.10.4", - "@babel/plugin-transform-for-of": "^7.10.4", - "@babel/plugin-transform-function-name": "^7.10.4", - "@babel/plugin-transform-literals": "^7.10.4", - "@babel/plugin-transform-member-expression-literals": "^7.10.4", - "@babel/plugin-transform-modules-amd": "^7.10.4", - "@babel/plugin-transform-modules-commonjs": "^7.10.4", - "@babel/plugin-transform-modules-systemjs": "^7.10.4", - "@babel/plugin-transform-modules-umd": "^7.10.4", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.10.4", - "@babel/plugin-transform-new-target": "^7.10.4", - "@babel/plugin-transform-object-super": "^7.10.4", - "@babel/plugin-transform-parameters": "^7.10.4", - "@babel/plugin-transform-property-literals": "^7.10.4", - "@babel/plugin-transform-regenerator": "^7.10.4", - "@babel/plugin-transform-reserved-words": "^7.10.4", - "@babel/plugin-transform-shorthand-properties": "^7.10.4", - "@babel/plugin-transform-spread": "^7.11.0", - "@babel/plugin-transform-sticky-regex": "^7.10.4", - "@babel/plugin-transform-template-literals": "^7.10.4", - "@babel/plugin-transform-typeof-symbol": "^7.10.4", - "@babel/plugin-transform-unicode-escapes": "^7.10.4", - "@babel/plugin-transform-unicode-regex": "^7.10.4", - "@babel/preset-modules": "^0.1.3", - "@babel/types": "^7.11.5", - "browserslist": "^4.16.5", - "core-js-compat": "^3.6.2", - "invariant": "^2.2.2", - "levenary": "^1.1.1", - "semver": "^5.5.0" - } - }, - "@babel/preset-modules": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.4.tgz", - "integrity": "sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - } - }, - "@babel/runtime": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", - "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/template": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", - "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/parser": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/traverse": { - "version": "7.11.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.5.tgz", - "integrity": "sha512-EjiPXt+r7LiCZXEfRpSJd+jUMnBd4/9OUv7Nx3+0u9+eimMwJmG0Q98lw4/289JCoxSE8OolDMNZaaF/JZ69WQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.11.5", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.11.5", - "@babel/types": "^7.11.5", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.21" - }, - "dependencies": { - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "@babel/types": { - "version": "7.11.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", - "integrity": "sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.21", - "to-fast-properties": "^2.0.0" - } - }, - "@cosmjs/crypto": { - "version": "0.22.3", - "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.22.3.tgz", - "integrity": "sha512-QTWEXvJ9sO5RsGh5gHl1WDZ0aDVd49NdpCfeH+zVR/7wIYnJiCBhmJ/CHiil0XyM6yqTFTvsui24rV4rHGgA/A==", - "requires": { - "@cosmjs/encoding": "^0.22.3", - "@cosmjs/math": "^0.22.3", - "@cosmjs/utils": "^0.22.3", - "bip39": "^3.0.2", - "bn.js": "^4.11.8", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "libsodium-wrappers": "^0.7.6", - "pbkdf2": "^3.1.1", - "ripemd160": "^2.0.2", - "sha.js": "^2.4.11", - "type-tagger": "^1.0.0", - "unorm": "^1.5.0" - } - }, - "@cosmjs/encoding": { - "version": "0.22.3", - "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.22.3.tgz", - "integrity": "sha512-ziN8K0xzIW7xMo7YzXsobrSXztFZo2RyJnvVm5H7Ss/BcgiRQgnLM4lsZ+TAxj1hvUAmCEsyh1Y3SO59cEDTvg==", - "requires": { - "base64-js": "^1.3.0", - "bech32": "^1.1.4", - "readonly-date": "^1.0.0" - } - }, - "@cosmjs/launchpad": { - "version": "0.22.3", - "resolved": "https://registry.npmjs.org/@cosmjs/launchpad/-/launchpad-0.22.3.tgz", - "integrity": "sha512-np616xqyZ0s6QS/A4ifaD8lYpqR6RBo8x3i7a07jfdacMZRbNO8d8q3AKr3WNbiTSzRGcrtiPPmHA/W2NalnPg==", - "requires": { - "@cosmjs/crypto": "^0.22.3", - "@cosmjs/encoding": "^0.22.3", - "@cosmjs/math": "^0.22.3", - "@cosmjs/utils": "^0.22.3", - "axios": "^0.21.2" - }, - "dependencies": { - "axios": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz", - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", - "requires": { - "follow-redirects": "1.5.10" - } - } - } - }, - "@cosmjs/math": { - "version": "0.22.3", - "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.22.3.tgz", - "integrity": "sha512-+pFYiQ6m5QwEKQ+C+PrqkNQF0if3Rc7siTtECdp4GONX7hCu2kJBziBUnZYZ+KLZOa5oseFx4HktUCvXfqOnwg==", - "requires": { - "bn.js": "^4.11.8" - } - }, - "@cosmjs/utils": { - "version": "0.22.3", - "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.22.3.tgz", - "integrity": "sha512-WK1ZZJG57D8KJ6OViYgk5PDkGp08TvEyeebNKWuOqgHjHmO3z5aolVwRDh4A5dPeiHxPF12tGzTLn8/aICJ7KA==" - }, - "@hapi/address": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", - "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==", - "dev": true - }, - "@hapi/bourne": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz", - "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==", - "dev": true - }, - "@hapi/hoek": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz", - "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow==", - "dev": true - }, - "@hapi/joi": { - "version": "15.1.1", - "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz", - "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==", - "dev": true, - "requires": { - "@hapi/address": "2.x.x", - "@hapi/bourne": "1.x.x", - "@hapi/hoek": "8.x.x", - "@hapi/topo": "3.x.x" - } - }, - "@hapi/topo": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz", - "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==", - "dev": true, - "requires": { - "@hapi/hoek": "^8.3.0" - } - }, - "@intervolga/optimize-cssnano-plugin": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@intervolga/optimize-cssnano-plugin/-/optimize-cssnano-plugin-1.0.6.tgz", - "integrity": "sha512-zN69TnSr0viRSU6cEDIcuPcP67QcpQ6uHACg58FiN9PDrU6SLyGW3MR4tiISbYxy1kDWAVPwD+XwQTWE5cigAA==", - "dev": true, - "requires": { - "cssnano": "^4.0.0", - "cssnano-preset-default": "^4.0.0", - "postcss": "^7.0.36" - } - }, - "@mrmlnc/readdir-enhanced": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", - "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", - "dev": true, - "requires": { - "call-me-maybe": "^1.0.1", - "glob-to-regexp": "^0.3.0" - } - }, - "@nodelib/fs.stat": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", - "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", - "dev": true - }, - "@soda/friendly-errors-webpack-plugin": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.1.tgz", - "integrity": "sha512-cWKrGaFX+rfbMrAxVv56DzhPNqOJPZuNIS2HGMELtgGzb+vsMzyig9mml5gZ/hr2BGtSLV+dP2LUEuAL8aG2mQ==", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "error-stack-parser": "^2.0.0", - "string-width": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "@soda/get-current-script": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@soda/get-current-script/-/get-current-script-1.0.2.tgz", - "integrity": "sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==", - "dev": true - }, - "@tendermint/vue": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@tendermint/vue/-/vue-0.1.8.tgz", - "integrity": "sha512-i1vz5APhIauuS3K3fohRXobt9+bw5I5YCwhFO7HgtOj9cMJkSHfN2Bjt5qF1O2qZwmE/+mPMYg+3KN/netIOzg==", - "requires": { - "@cosmjs/encoding": "^0.22.3", - "@cosmjs/launchpad": "^0.22.2", - "axios": "^0.21.2", - "bip39": "^3.0.2", - "core-js": "^3.6.5", - "lodash": "^4.17.21", - "vue": "^2.6.11", - "vue-router": "^3.2.0", - "vuex": "^3.4.0" - } - }, - "@types/anymatch": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz", - "integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==", - "dev": true - }, - "@types/body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==", - "dev": true, - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/connect": { - "version": "3.4.33", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.33.tgz", - "integrity": "sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/connect-history-api-fallback": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.3.3.tgz", - "integrity": "sha512-7SxFCd+FLlxCfwVwbyPxbR4khL9aNikJhrorw8nUIOqeuooc9gifBuDQOJw5kzN7i6i3vLn9G8Wde/4QDihpYw==", - "dev": true, - "requires": { - "@types/express-serve-static-core": "*", - "@types/node": "*" - } - }, - "@types/express": { - "version": "4.17.8", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.8.tgz", - "integrity": "sha512-wLhcKh3PMlyA2cNAB9sjM1BntnhPMiM0JOBwPBqttjHev2428MLEB4AYVN+d8s2iyCVZac+o41Pflm/ZH5vLXQ==", - "dev": true, - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "*", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.13.tgz", - "integrity": "sha512-RgDi5a4nuzam073lRGKTUIaL3eF2+H7LJvJ8eUnCI0wA6SNjXc44DCmWNiTLs/AZ7QlsFWZiw/gTG3nSQGL0fA==", - "dev": true, - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "@types/glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", - "dev": true, - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/http-proxy": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.4.tgz", - "integrity": "sha512-IrSHl2u6AWXduUaDLqYpt45tLVCtYv7o4Z0s1KghBCDgIIS9oW5K1H8mZG/A2CfeLdEa7rTd1ACOiHBc1EMT2Q==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/http-proxy-middleware": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@types/http-proxy-middleware/-/http-proxy-middleware-0.19.3.tgz", - "integrity": "sha512-lnBTx6HCOUeIJMLbI/LaL5EmdKLhczJY5oeXZpX/cXE4rRqb3RmV7VcMpiEfYkmTjipv3h7IAyIINe4plEv7cA==", - "dev": true, - "requires": { - "@types/connect": "*", - "@types/http-proxy": "*", - "@types/node": "*" - } - }, - "@types/json-schema": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", - "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", - "dev": true - }, - "@types/mime": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", - "integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==", - "dev": true - }, - "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true - }, - "@types/minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=", - "dev": true - }, - "@types/node": { - "version": "11.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", - "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" - }, - "@types/normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", - "dev": true - }, - "@types/q": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz", - "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==", - "dev": true - }, - "@types/qs": { - "version": "6.9.5", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.5.tgz", - "integrity": "sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ==", - "dev": true - }, - "@types/range-parser": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", - "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==", - "dev": true - }, - "@types/serve-static": { - "version": "1.13.5", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.5.tgz", - "integrity": "sha512-6M64P58N+OXjU432WoLLBQxbA0LRGBCRm7aAGQJ+SMC1IMl0dgRVi9EFfoDcS2a7Xogygk/eGN94CfwU9UF7UQ==", - "dev": true, - "requires": { - "@types/express-serve-static-core": "*", - "@types/mime": "*" - } - }, - "@types/source-list-map": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz", - "integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==", - "dev": true - }, - "@types/tapable": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.6.tgz", - "integrity": "sha512-W+bw9ds02rAQaMvaLYxAbJ6cvguW/iJXNT6lTssS1ps6QdrMKttqEAMEG/b5CR8TZl3/L7/lH0ZV5nNR1LXikA==", - "dev": true - }, - "@types/uglify-js": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.11.0.tgz", - "integrity": "sha512-I0Yd8TUELTbgRHq2K65j8rnDPAzAP+DiaF/syLem7yXwYLsHZhPd+AM2iXsWmf9P2F2NlFCgl5erZPQx9IbM9Q==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "@types/webpack": { - "version": "4.41.22", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.22.tgz", - "integrity": "sha512-JQDJK6pj8OMV9gWOnN1dcLCyU9Hzs6lux0wBO4lr1+gyEhIBR9U3FMrz12t2GPkg110XAxEAw2WHF6g7nZIbRQ==", - "dev": true, - "requires": { - "@types/anymatch": "*", - "@types/node": "*", - "@types/tapable": "*", - "@types/uglify-js": "*", - "@types/webpack-sources": "*", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "@types/webpack-dev-server": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/@types/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz", - "integrity": "sha512-3+86AgSzl18n5P1iUP9/lz3G3GMztCp+wxdDvVuNhx1sr1jE79GpYfKHL8k+Vht3N74K2n98CuAEw4YPJCYtDA==", - "dev": true, - "requires": { - "@types/connect-history-api-fallback": "*", - "@types/express": "*", - "@types/http-proxy-middleware": "*", - "@types/serve-static": "*", - "@types/webpack": "*" - } - }, - "@types/webpack-sources": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-2.0.0.tgz", - "integrity": "sha512-a5kPx98CNFRKQ+wqawroFunvFqv7GHm/3KOI52NY9xWADgc8smu4R6prt4EU/M4QfVjvgBkMqU4fBhw3QfMVkg==", - "dev": true, - "requires": { - "@types/node": "*", - "@types/source-list-map": "*", - "source-map": "^0.7.3" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true - } - } - }, - "@vue/babel-helper-vue-jsx-merge-props": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0.tgz", - "integrity": "sha512-6tyf5Cqm4m6v7buITuwS+jHzPlIPxbFzEhXR5JGZpbrvOcp1hiQKckd305/3C7C36wFekNTQSxAtgeM0j0yoUw==", - "dev": true - }, - "@vue/babel-helper-vue-transform-on": { - "version": "1.0.0-rc.2", - "resolved": "https://registry.npmjs.org/@vue/babel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.0.0-rc.2.tgz", - "integrity": "sha512-1+7CwjQ0Kasml6rHoNQUmbISwqLNNfFVBUcZl6QBremUl296ZmLrVQPqJP5pyAAWjZke5bpI1hlj+LVVuT7Jcg==", - "dev": true - }, - "@vue/babel-plugin-jsx": { - "version": "1.0.0-rc.3", - "resolved": "https://registry.npmjs.org/@vue/babel-plugin-jsx/-/babel-plugin-jsx-1.0.0-rc.3.tgz", - "integrity": "sha512-/Ibq0hoKsidnHWPhgRpjcjYhYcHpqEm2fiKVAPO88OXZNHGwaGgS4yXkC6TDEvlZep4mBDo+2S5T81wpbVh90Q==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.0.0", - "@babel/traverse": "^7.0.0", - "@babel/types": "^7.0.0", - "@vue/babel-helper-vue-transform-on": "^1.0.0-rc.2", - "camelcase": "^6.0.0", - "html-tags": "^3.1.0", - "svg-tags": "^1.0.0" - } - }, - "@vue/babel-plugin-transform-vue-jsx": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@vue/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-1.1.2.tgz", - "integrity": "sha512-YfdaoSMvD1nj7+DsrwfTvTnhDXI7bsuh+Y5qWwvQXlD24uLgnsoww3qbiZvWf/EoviZMrvqkqN4CBw0W3BWUTQ==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0", - "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0", - "html-tags": "^2.0.0", - "lodash.kebabcase": "^4.1.1", - "svg-tags": "^1.0.0" - }, - "dependencies": { - "html-tags": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-2.0.0.tgz", - "integrity": "sha1-ELMKOGCF9Dzt41PMj6fLDe7qZos=", - "dev": true - } - } - }, - "@vue/babel-preset-app": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/@vue/babel-preset-app/-/babel-preset-app-4.5.7.tgz", - "integrity": "sha512-A9ujqmvR9wb8nWiMnEYZW/8QfGZbqxC/etzbKIDrUdsqJ27jx106leMHJc8nmAn58RqGd6iww6uZ3Sx7aYiG3A==", - "dev": true, - "requires": { - "@babel/core": "^7.11.0", - "@babel/helper-compilation-targets": "^7.9.6", - "@babel/helper-module-imports": "^7.8.3", - "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/plugin-proposal-decorators": "^7.8.3", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-jsx": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.11.0", - "@babel/preset-env": "^7.11.0", - "@babel/runtime": "^7.11.0", - "@vue/babel-plugin-jsx": "^1.0.0-0", - "@vue/babel-preset-jsx": "^1.1.2", - "babel-plugin-dynamic-import-node": "^2.3.3", - "core-js": "^3.6.5", - "core-js-compat": "^3.6.5", - "semver": "^6.1.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "@vue/babel-preset-jsx": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@vue/babel-preset-jsx/-/babel-preset-jsx-1.1.2.tgz", - "integrity": "sha512-zDpVnFpeC9YXmvGIDSsKNdL7qCG2rA3gjywLYHPCKDT10erjxF4U+6ay9X6TW5fl4GsDlJp9bVfAVQAAVzxxvQ==", - "dev": true, - "requires": { - "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0", - "@vue/babel-plugin-transform-vue-jsx": "^1.1.2", - "@vue/babel-sugar-functional-vue": "^1.1.2", - "@vue/babel-sugar-inject-h": "^1.1.2", - "@vue/babel-sugar-v-model": "^1.1.2", - "@vue/babel-sugar-v-on": "^1.1.2" - } - }, - "@vue/babel-sugar-functional-vue": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@vue/babel-sugar-functional-vue/-/babel-sugar-functional-vue-1.1.2.tgz", - "integrity": "sha512-YhmdJQSVEFF5ETJXzrMpj0nkCXEa39TvVxJTuVjzvP2rgKhdMmQzlJuMv/HpadhZaRVMCCF3AEjjJcK5q/cYzQ==", - "dev": true, - "requires": { - "@babel/plugin-syntax-jsx": "^7.2.0" - } - }, - "@vue/babel-sugar-inject-h": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@vue/babel-sugar-inject-h/-/babel-sugar-inject-h-1.1.2.tgz", - "integrity": "sha512-VRSENdTvD5htpnVp7i7DNuChR5rVMcORdXjvv5HVvpdKHzDZAYiLSD+GhnhxLm3/dMuk8pSzV+k28ECkiN5m8w==", - "dev": true, - "requires": { - "@babel/plugin-syntax-jsx": "^7.2.0" - } - }, - "@vue/babel-sugar-v-model": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@vue/babel-sugar-v-model/-/babel-sugar-v-model-1.1.2.tgz", - "integrity": "sha512-vLXPvNq8vDtt0u9LqFdpGM9W9IWDmCmCyJXuozlq4F4UYVleXJ2Fa+3JsnTZNJcG+pLjjfnEGHci2339Kj5sGg==", - "dev": true, - "requires": { - "@babel/plugin-syntax-jsx": "^7.2.0", - "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0", - "@vue/babel-plugin-transform-vue-jsx": "^1.1.2", - "camelcase": "^5.0.0", - "html-tags": "^2.0.0", - "svg-tags": "^1.0.0" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "html-tags": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-2.0.0.tgz", - "integrity": "sha1-ELMKOGCF9Dzt41PMj6fLDe7qZos=", - "dev": true - } - } - }, - "@vue/babel-sugar-v-on": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@vue/babel-sugar-v-on/-/babel-sugar-v-on-1.1.2.tgz", - "integrity": "sha512-T8ZCwC8Jp2uRtcZ88YwZtZXe7eQrJcfRq0uTFy6ShbwYJyz5qWskRFoVsdTi9o0WEhmQXxhQUewodOSCUPVmsQ==", - "dev": true, - "requires": { - "@babel/plugin-syntax-jsx": "^7.2.0", - "@vue/babel-plugin-transform-vue-jsx": "^1.1.2", - "camelcase": "^5.0.0" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - } - } - }, - "@vue/cli-overlay": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/@vue/cli-overlay/-/cli-overlay-4.5.7.tgz", - "integrity": "sha512-45BbVPR2dTa27QGaFap7eNYbJSzuIhGff1R5L50tWlpw/lf8fIyOuXSdSNQGZCVe+Y3NbcD2DK7mZryxOXWGmw==", - "dev": true - }, - "@vue/cli-plugin-babel": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/@vue/cli-plugin-babel/-/cli-plugin-babel-4.5.7.tgz", - "integrity": "sha512-cqtHoXWHxtMj8qyN0A2TvFRuEQsqtDlYeKaOT1XDwbfHZwWXlD4BBsqXZBnqQkQI0hijMOA0QOnqA63/x0lpMg==", - "dev": true, - "requires": { - "@babel/core": "^7.11.0", - "@vue/babel-preset-app": "^4.5.7", - "@vue/cli-shared-utils": "^4.5.7", - "babel-loader": "^8.1.0", - "cache-loader": "^4.1.0", - "thread-loader": "^2.1.3", - "webpack": "^4.0.0" - } - }, - "@vue/cli-plugin-router": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/@vue/cli-plugin-router/-/cli-plugin-router-4.5.7.tgz", - "integrity": "sha512-wzKz8+qOXNqVglcw90lYHbu5UJQo8QoyNXHAiM0RIX4r3W8KqiHrvu7MZFCOVKM3ojRFbDofumorypN2yieSXA==", - "dev": true, - "requires": { - "@vue/cli-shared-utils": "^4.5.7" - } - }, - "@vue/cli-plugin-vuex": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/@vue/cli-plugin-vuex/-/cli-plugin-vuex-4.5.7.tgz", - "integrity": "sha512-bHH2JSAd/S9fABtZdr3xVSgbIPm3PGcan56adMt0hGlm6HG/QxDNuPLppMleuBLr9uHoHX5x7sQmbtZvzIYjxw==", - "dev": true - }, - "@vue/cli-service": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/@vue/cli-service/-/cli-service-4.5.7.tgz", - "integrity": "sha512-iT5wb5JbF/kbJCY7HR8qabWEiaMvZP4/KPezsnEp/6vNGAF0Akx0FGvCuU9sm7uf6w0UKzIJ38I6JJBtkOMvJA==", - "dev": true, - "requires": { - "@intervolga/optimize-cssnano-plugin": "^1.0.5", - "@soda/friendly-errors-webpack-plugin": "^1.7.1", - "@soda/get-current-script": "^1.0.0", - "@types/minimist": "^1.2.0", - "@types/webpack": "^4.0.0", - "@types/webpack-dev-server": "^3.11.0", - "@vue/cli-overlay": "^4.5.7", - "@vue/cli-plugin-router": "^4.5.7", - "@vue/cli-plugin-vuex": "^4.5.7", - "@vue/cli-shared-utils": "^4.5.7", - "@vue/component-compiler-utils": "^3.1.2", - "@vue/preload-webpack-plugin": "^1.1.0", - "@vue/web-component-wrapper": "^1.2.0", - "acorn": "^7.4.0", - "acorn-walk": "^7.1.1", - "address": "^1.1.2", - "autoprefixer": "^9.8.6", - "browserslist": "^4.16.5", - "cache-loader": "^4.1.0", - "case-sensitive-paths-webpack-plugin": "^2.3.0", - "cli-highlight": "^2.1.4", - "clipboardy": "^2.3.0", - "cliui": "^6.0.0", - "copy-webpack-plugin": "^5.1.1", - "css-loader": "^3.5.3", - "cssnano": "^4.1.10", - "debug": "^4.1.1", - "default-gateway": "^5.0.5", - "dotenv": "^8.2.0", - "dotenv-expand": "^5.1.0", - "file-loader": "^4.2.0", - "fs-extra": "^7.0.1", - "globby": "^9.2.0", - "hash-sum": "^2.0.0", - "html-webpack-plugin": "^3.2.0", - "launch-editor-middleware": "^2.2.1", - "lodash.defaultsdeep": "^4.6.1", - "lodash.mapvalues": "^4.6.0", - "lodash.transform": "^4.6.0", - "mini-css-extract-plugin": "^0.9.0", - "minimist": "^1.2.5", - "pnp-webpack-plugin": "^1.6.4", - "portfinder": "^1.0.26", - "postcss-loader": "^3.0.0", - "ssri": "^7.1.0", - "terser-webpack-plugin": "^2.3.6", - "thread-loader": "^2.1.3", - "url-loader": "^2.2.0", - "vue-loader": "^15.9.2", - "vue-loader-v16": "npm:vue-loader@^16.0.0-beta.7", - "vue-style-loader": "^4.1.2", - "webpack": "^4.0.0", - "webpack-bundle-analyzer": "^3.8.0", - "webpack-chain": "^6.4.0", - "webpack-dev-server": "^3.11.0", - "webpack-merge": "^4.2.2" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - }, - "cacache": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", - "integrity": "sha512-5ZvAxd05HDDU+y9BVvcqYu2LLXmPnQ0hW62h32g4xBTgL/MppR4/04NHfj/ycM2y6lmTnbw6HVi+1eN0Psba6w==", - "dev": true, - "requires": { - "chownr": "^1.1.2", - "figgy-pudding": "^3.5.1", - "fs-minipass": "^2.0.0", - "glob": "^7.1.4", - "graceful-fs": "^4.2.2", - "infer-owner": "^1.0.4", - "lru-cache": "^5.1.1", - "minipass": "^3.0.0", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.2", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "p-map": "^3.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^2.7.1", - "ssri": "^7.0.0", - "unique-filename": "^1.1.1" - } - }, - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "ssri": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz", - "integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1", - "minipass": "^3.1.1" - } - }, - "terser-webpack-plugin": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz", - "integrity": "sha512-/fKw3R+hWyHfYx7Bv6oPqmk4HGQcrWLtV3X6ggvPuwPNHSnzvVV51z6OaaCOus4YLjutYGOz3pEpbhe6Up2s1w==", - "dev": true, - "requires": { - "cacache": "^13.0.1", - "find-cache-dir": "^3.3.1", - "jest-worker": "^25.4.0", - "p-limit": "^2.3.0", - "schema-utils": "^2.6.6", - "serialize-javascript": "^4.0.0", - "source-map": "^0.6.1", - "terser": "^4.6.12", - "webpack-sources": "^1.4.3" - } - } - } - }, - "@vue/cli-shared-utils": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/@vue/cli-shared-utils/-/cli-shared-utils-4.5.7.tgz", - "integrity": "sha512-oicFfx9PvgupxN/LW0s2ktdn1U6bBu8J4lPcW2xj6TtTWUkkxwzis4Tm+XOvgvZnu44+d7216y0Y4TX90q645w==", - "dev": true, - "requires": { - "@hapi/joi": "^15.0.1", - "chalk": "^2.4.2", - "execa": "^1.0.0", - "launch-editor": "^2.2.1", - "lru-cache": "^5.1.1", - "node-ipc": "^9.1.1", - "open": "^6.3.0", - "ora": "^3.4.0", - "read-pkg": "^5.1.1", - "request": "^2.88.2", - "semver": "^6.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "@vue/component-compiler-utils": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-3.2.0.tgz", - "integrity": "sha512-lejBLa7xAMsfiZfNp7Kv51zOzifnb29FwdnMLa96z26kXErPFioSf9BMcePVIQ6/Gc6/mC0UrPpxAWIHyae0vw==", - "dev": true, - "requires": { - "consolidate": "^0.15.1", - "hash-sum": "^1.0.2", - "lru-cache": "^4.1.2", - "merge-source-map": "^1.1.0", - "postcss": "^7.0.36", - "postcss-selector-parser": "^6.0.2", - "prettier": "^1.18.2", - "source-map": "~0.6.1", - "vue-template-es2015-compiler": "^1.9.0" - }, - "dependencies": { - "hash-sum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", - "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", - "dev": true - }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - } - } - }, - "@vue/preload-webpack-plugin": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@vue/preload-webpack-plugin/-/preload-webpack-plugin-1.1.2.tgz", - "integrity": "sha512-LIZMuJk38pk9U9Ur4YzHjlIyMuxPlACdBIHH9/nGYVTsaGKOSnSuELiE8vS9wa+dJpIYspYUOqk+L1Q4pgHQHQ==", - "dev": true - }, - "@vue/web-component-wrapper": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@vue/web-component-wrapper/-/web-component-wrapper-1.2.0.tgz", - "integrity": "sha512-Xn/+vdm9CjuC9p3Ae+lTClNutrVhsXpzxvoTXXtoys6kVRX9FkueSUAqSWAyZntmVLlR4DosBV4pH8y5Z/HbUw==", - "dev": true - }, - "@webassemblyjs/ast": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", - "integrity": "sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==", - "dev": true, - "requires": { - "@webassemblyjs/helper-module-context": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/wast-parser": "1.9.0" - } - }, - "@webassemblyjs/floating-point-hex-parser": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz", - "integrity": "sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA==", - "dev": true - }, - "@webassemblyjs/helper-api-error": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.0.tgz", - "integrity": "sha512-NcMLjoFMXpsASZFxJ5h2HZRcEhDkvnNFOAKneP5RbKRzaWJN36NC4jqQHKwStIhGXu5mUWlUUk7ygdtrO8lbmw==", - "dev": true - }, - "@webassemblyjs/helper-buffer": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.0.tgz", - "integrity": "sha512-qZol43oqhq6yBPx7YM3m9Bv7WMV9Eevj6kMi6InKOuZxhw+q9hOkvq5e/PpKSiLfyetpaBnogSbNCfBwyB00CA==", - "dev": true - }, - "@webassemblyjs/helper-code-frame": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.0.tgz", - "integrity": "sha512-ERCYdJBkD9Vu4vtjUYe8LZruWuNIToYq/ME22igL+2vj2dQ2OOujIZr3MEFvfEaqKoVqpsFKAGsRdBSBjrIvZA==", - "dev": true, - "requires": { - "@webassemblyjs/wast-printer": "1.9.0" - } - }, - "@webassemblyjs/helper-fsm": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.0.tgz", - "integrity": "sha512-OPRowhGbshCb5PxJ8LocpdX9Kl0uB4XsAjl6jH/dWKlk/mzsANvhwbiULsaiqT5GZGT9qinTICdj6PLuM5gslw==", - "dev": true - }, - "@webassemblyjs/helper-module-context": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.0.tgz", - "integrity": "sha512-MJCW8iGC08tMk2enck1aPW+BE5Cw8/7ph/VGZxwyvGbJwjktKkDK7vy7gAmMDx88D7mhDTCNKAW5tED+gZ0W8g==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0" - } - }, - "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.0.tgz", - "integrity": "sha512-R7FStIzyNcd7xKxCZH5lE0Bqy+hGTwS3LJjuv1ZVxd9O7eHCedSdrId/hMOd20I+v8wDXEn+bjfKDLzTepoaUw==", - "dev": true - }, - "@webassemblyjs/helper-wasm-section": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.0.tgz", - "integrity": "sha512-XnMB8l3ek4tvrKUUku+IVaXNHz2YsJyOOmz+MMkZvh8h1uSJpSen6vYnw3IoQ7WwEuAhL8Efjms1ZWjqh2agvw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0" - } - }, - "@webassemblyjs/ieee754": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz", - "integrity": "sha512-dcX8JuYU/gvymzIHc9DgxTzUUTLexWwt8uCTWP3otys596io0L5aW02Gb1RjYpx2+0Jus1h4ZFqjla7umFniTg==", - "dev": true, - "requires": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "@webassemblyjs/leb128": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.9.0.tgz", - "integrity": "sha512-ENVzM5VwV1ojs9jam6vPys97B/S65YQtv/aanqnU7D8aSoHFX8GyhGg0CMfyKNIHBuAVjy3tlzd5QMMINa7wpw==", - "dev": true, - "requires": { - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/utf8": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.9.0.tgz", - "integrity": "sha512-GZbQlWtopBTP0u7cHrEx+73yZKrQoBMpwkGEIqlacljhXCkVM1kMQge/Mf+csMJAjEdSwhOyLAS0AoR3AG5P8w==", - "dev": true - }, - "@webassemblyjs/wasm-edit": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.0.tgz", - "integrity": "sha512-FgHzBm80uwz5M8WKnMTn6j/sVbqilPdQXTWraSjBwFXSYGirpkSWE2R9Qvz9tNiTKQvoKILpCuTjBKzOIm0nxw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/helper-wasm-section": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0", - "@webassemblyjs/wasm-opt": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0", - "@webassemblyjs/wast-printer": "1.9.0" - } - }, - "@webassemblyjs/wasm-gen": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.0.tgz", - "integrity": "sha512-cPE3o44YzOOHvlsb4+E9qSqjc9Qf9Na1OO/BHFy4OI91XDE14MjFN4lTMezzaIWdPqHnsTodGGNP+iRSYfGkjA==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/ieee754": "1.9.0", - "@webassemblyjs/leb128": "1.9.0", - "@webassemblyjs/utf8": "1.9.0" - } - }, - "@webassemblyjs/wasm-opt": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.0.tgz", - "integrity": "sha512-Qkjgm6Anhm+OMbIL0iokO7meajkzQD71ioelnfPEj6r4eOFuqm4YC3VBPqXjFyyNwowzbMD+hizmprP/Fwkl2A==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0" - } - }, - "@webassemblyjs/wasm-parser": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.0.tgz", - "integrity": "sha512-9+wkMowR2AmdSWQzsPEjFU7njh8HTO5MqO8vjwEHuM+AMHioNqSBONRdr0NQQ3dVQrzp0s8lTcYqzUdb7YgELA==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-api-error": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/ieee754": "1.9.0", - "@webassemblyjs/leb128": "1.9.0", - "@webassemblyjs/utf8": "1.9.0" - } - }, - "@webassemblyjs/wast-parser": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.9.0.tgz", - "integrity": "sha512-qsqSAP3QQ3LyZjNC/0jBJ/ToSxfYJ8kYyuiGvtn/8MK89VrNEfwj7BPQzJVHi0jGTRK2dGdJ5PRqhtjzoww+bw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/floating-point-hex-parser": "1.9.0", - "@webassemblyjs/helper-api-error": "1.9.0", - "@webassemblyjs/helper-code-frame": "1.9.0", - "@webassemblyjs/helper-fsm": "1.9.0", - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/wast-printer": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.9.0.tgz", - "integrity": "sha512-2J0nE95rHXHyQ24cWjMKJ1tqB/ds8z/cyeOZxJhcb+rW+SQASVjuznUSmdz5GpVJTzU8JkhYut0D3siFDD6wsA==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/wast-parser": "1.9.0", - "@xtuc/long": "4.2.2" - } - }, - "@xtuc/ieee754": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true - }, - "@xtuc/long": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true - }, - "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", - "dev": true, - "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - } - }, - "acorn": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", - "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", - "dev": true - }, - "acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true - }, - "address": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/address/-/address-1.1.2.tgz", - "integrity": "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==", - "dev": true - }, - "aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - } - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-errors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", - "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", - "dev": true - }, - "ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true - }, - "alphanum-sort": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", - "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", - "dev": true - }, - "ansi-colors": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", - "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", - "dev": true - }, - "ansi-html": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.8.tgz", - "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=", - "dev": true - }, - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=", - "dev": true - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "optional": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true - }, - "arch": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.1.2.tgz", - "integrity": "sha512-NTBIIbAfkJeIletyABbVtdPgeKfDafR+1mZV/AyyfC1UkVkp9iUjV+wwmqtUgphHYajbI86jejBJp5e+jkGTiQ==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", - "dev": true - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - } - }, - "assert": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", - "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", - "dev": true, - "requires": { - "object-assign": "^4.1.1", - "util": "0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - } - } - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "dev": true, - "requires": { - "lodash": "^4.17.21" - } - }, - "async-each": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", - "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", - "dev": true - }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true - }, - "autoprefixer": { - "version": "9.8.6", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.6.tgz", - "integrity": "sha512-XrvP4VVHdRBCdX1S3WXVD8+RyG9qeb1D5Sn1DeLiG2xfSpzellk5k54xbUERJ3M5DggQxes39UGOTP8CFrEGbg==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "caniuse-lite": "^1.0.30001109", - "colorette": "^1.2.1", - "normalize-range": "^0.1.2", - "num2fraction": "^1.2.2", - "postcss": "^7.0.36", - "postcss-value-parser": "^4.1.0" - } - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz", - "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==", - "dev": true - }, - "axios": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz", - "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==", - "requires": { - "follow-redirects": "^1.10.0" - }, - "dependencies": { - "follow-redirects": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", - "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==" - } - } - }, - "babel-loader": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.1.0.tgz", - "integrity": "sha512-7q7nC1tYOrqvUrN3LQK4GwSk/TQorZSOlO9C+RZDZpODgyN4ZlCqE5q9cDsyWOliN+aU9B4JX01xK9eJXowJLw==", - "dev": true, - "requires": { - "find-cache-dir": "^2.1.0", - "loader-utils": "^1.4.0", - "mkdirp": "^0.5.3", - "pify": "^4.0.1", - "schema-utils": "^2.6.5" - } - }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" - }, - "batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, - "bfj": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/bfj/-/bfj-6.1.2.tgz", - "integrity": "sha512-BmBJa4Lip6BPRINSZ0BPEIfB1wUY/9rwbwvIHQA1KjX9om29B6id0wnWXq7m3bn5JrUVjeOTnVuhPT1FiHwPGw==", - "dev": true, - "requires": { - "bluebird": "^3.5.5", - "check-types": "^8.0.3", - "hoopy": "^0.1.4", - "tryer": "^1.0.1" - } - }, - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true - }, - "binary-extensions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", - "dev": true, - "optional": true - }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, - "bip39": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.3.tgz", - "integrity": "sha512-P0dKrz4g0V0BjXfx7d9QNkJ/Txcz/k+hM9TnjqjUaXtuOfAvxXSw2rJw8DX0e3ZPwnK/IgDxoRqf0bvoVCqbMg==", - "requires": { - "@types/node": "11.11.6", - "create-hash": "^1.1.0", - "pbkdf2": "^3.0.9", - "randombytes": "^2.0.1" - } - }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true - }, - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" - }, - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "dev": true, - "requires": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "dev": true - } - } - }, - "bonjour": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz", - "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", - "dev": true, - "requires": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "^2.0.2", - "multicast-dns": "^6.0.1", - "multicast-dns-service-types": "^1.1.0" - }, - "dependencies": { - "array-flatten": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", - "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", - "dev": true - } - } - }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", - "dev": true, - "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.4", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "dependencies": { - "bn.js": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", - "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==", - "dev": true - } - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "browserslist": { - "version": "4.16.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.5.tgz", - "integrity": "sha512-Z+vsCZIvCBvqLoYkBFTwEYH3v5MCQbsAjp50ERycpOjnPmolg1Gjy4+KaWWpm8QOJt9GHkhdqAl14NpCX73CWA==", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001135", - "electron-to-chromium": "^1.3.571", - "escalade": "^3.1.0", - "node-releases": "^1.1.61" - } - }, - "buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "dev": true, - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "buffer-indexof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", - "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==", - "dev": true - }, - "buffer-json": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/buffer-json/-/buffer-json-2.0.0.tgz", - "integrity": "sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw==", - "dev": true - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", - "dev": true - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "dev": true - }, - "cacache": { - "version": "12.0.4", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", - "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", - "dev": true, - "requires": { - "bluebird": "^3.5.5", - "chownr": "^1.1.1", - "figgy-pudding": "^3.5.1", - "glob": "^7.1.4", - "graceful-fs": "^4.1.15", - "infer-owner": "^1.0.3", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.3", - "ssri": "^6.0.2", - "unique-filename": "^1.1.1", - "y18n": "^4.0.1" - } - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "cache-loader": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cache-loader/-/cache-loader-4.1.0.tgz", - "integrity": "sha512-ftOayxve0PwKzBF/GLsZNC9fJBXl8lkZE3TOsjkboHfVHVkL39iUEs1FO07A33mizmci5Dudt38UZrrYXDtbhw==", - "dev": true, - "requires": { - "buffer-json": "^2.0.0", - "find-cache-dir": "^3.0.0", - "loader-utils": "^1.2.3", - "mkdirp": "^0.5.1", - "neo-async": "^2.6.1", - "schema-utils": "^2.0.0" - }, - "dependencies": { - "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "call-me-maybe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", - "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", - "dev": true - }, - "caller-callsite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", - "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", - "dev": true, - "requires": { - "callsites": "^2.0.0" - } - }, - "caller-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", - "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", - "dev": true, - "requires": { - "caller-callsite": "^2.0.0" - } - }, - "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "dev": true - }, - "camel-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", - "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", - "dev": true, - "requires": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" - } - }, - "camelcase": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.1.0.tgz", - "integrity": "sha512-WCMml9ivU60+8rEJgELlFp1gxFcEGxwYleE3bziHEDeqsqAWGHdimB7beBFGjLzVNgPGyDsfgXLQEYMpmIFnVQ==", - "dev": true - }, - "caniuse-api": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", - "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "caniuse-lite": "^1.0.0", - "lodash.memoize": "^4.1.2", - "lodash.uniq": "^4.5.0" - } - }, - "caniuse-lite": { - "version": "1.0.30001148", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001148.tgz", - "integrity": "sha512-E66qcd0KMKZHNJQt9hiLZGE3J4zuTqE1OnU53miEVtylFbwOEmeA5OsRu90noZful+XGSQOni1aT2tiqu/9yYw==", - "dev": true - }, - "case-sensitive-paths-webpack-plugin": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.3.0.tgz", - "integrity": "sha512-/4YgnZS8y1UXXmC02xD5rRrBEu6T5ub+mQHLNRj0fzTRbgdBYhsNo2V5EqwgqrExjxsjtF/OpAKAMkKsxbD5XQ==", - "dev": true - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "check-types": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/check-types/-/check-types-8.0.3.tgz", - "integrity": "sha512-YpeKZngUmG65rLudJ4taU7VLkOCTMhNl/u4ctNC56LQS/zJTyNH0Lrtwm1tfTsbLlwvlfsA2d1c8vCf/Kh2KwQ==", - "dev": true - }, - "chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", - "dev": true, - "optional": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.1.2", - "glob-parent": "^5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" - }, - "dependencies": { - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "optional": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "optional": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "optional": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "optional": true, - "requires": { - "is-number": "^7.0.0" - } - } - } - }, - "chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "dev": true - }, - "chrome-trace-event": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", - "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "clean-css": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.3.tgz", - "integrity": "sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==", - "dev": true, - "requires": { - "source-map": "~0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-highlight": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.4.tgz", - "integrity": "sha512-s7Zofobm20qriqDoU9sXptQx0t2R9PEgac92mENNm7xaEe1hn71IIMsXMK+6encA6WRCWWxIGQbipr3q998tlQ==", - "dev": true, - "requires": { - "chalk": "^3.0.0", - "highlight.js": "^10.4.1", - "mz": "^2.4.0", - "parse5": "^5.1.1", - "parse5-htmlparser2-tree-adapter": "^5.1.1", - "yargs": "^15.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "cli-spinners": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.5.0.tgz", - "integrity": "sha512-PC+AmIuK04E6aeSs/pUccSujsTzBhu4HzC2dL+CfJB/Jcc2qTRbEwZQDfIUpt2Xl8BodYBEq8w4fc0kU2I9DjQ==", - "dev": true - }, - "clipboardy": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-2.3.0.tgz", - "integrity": "sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==", - "dev": true, - "requires": { - "arch": "^2.1.1", - "execa": "^1.0.0", - "is-wsl": "^2.1.1" - }, - "dependencies": { - "is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "requires": { - "is-docker": "^2.0.0" - } - } - } - }, - "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - } - } - }, - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - }, - "coa": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.2.tgz", - "integrity": "sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA==", - "dev": true, - "requires": { - "@types/q": "^1.5.1", - "chalk": "^2.4.1", - "q": "^1.1.2" - } - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/color/-/color-3.1.3.tgz", - "integrity": "sha512-xgXAcTHa2HeFCGLE9Xs/R82hujGtu9Jd9x4NW3T34+OMs7VoPsjwzRczKHvTAHeJwWFwX5j15+MgAppE8ztObQ==", - "dev": true, - "requires": { - "color-convert": "^1.9.1", - "color-string": "^1.5.5" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "color-string": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.5.tgz", - "integrity": "sha512-57yF5yt8Xa3czSEW1jfQDE79Idk0+AkN/4KWad6tbdxUmAs3MvjxlWSWD4deYytcRfoZ9nhKyFl1kj5tBvidbw==", - "dev": true, - "requires": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } - }, - "colorette": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz", - "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true - }, - "compressible": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", - "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", - "dev": true, - "requires": { - "mime-db": ">= 1.43.0 < 2" - } - }, - "compression": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", - "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", - "dev": true, - "requires": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", - "debug": "2.6.9", - "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "dependencies": { - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "connect-history-api-fallback": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", - "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", - "dev": true - }, - "console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", - "dev": true - }, - "consolidate": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/consolidate/-/consolidate-0.15.1.tgz", - "integrity": "sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==", - "dev": true, - "requires": { - "bluebird": "^3.1.1" - } - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", - "dev": true, - "requires": { - "safe-buffer": "5.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "dev": true - }, - "convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, - "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", - "dev": true - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", - "dev": true - }, - "copy-concurrently": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", - "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - } - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "copy-webpack-plugin": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.2.tgz", - "integrity": "sha512-Uh7crJAco3AjBvgAy9Z75CjK8IG+gxaErro71THQ+vv/bl4HaQcpkexAY8KVW/T6D2W2IRr+couF/knIRkZMIQ==", - "dev": true, - "requires": { - "cacache": "^12.0.3", - "find-cache-dir": "^2.1.0", - "glob-parent": "^5.1.2", - "globby": "^7.1.1", - "is-glob": "^4.0.1", - "loader-utils": "^1.2.3", - "minimatch": "^3.0.4", - "normalize-path": "^3.0.0", - "p-limit": "^2.2.1", - "schema-utils": "^1.0.0", - "serialize-javascript": "^4.0.0", - "webpack-log": "^2.0.0" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "globby": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", - "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "dir-glob": "^2.0.0", - "glob": "^7.1.2", - "ignore": "^3.3.5", - "pify": "^3.0.0", - "slash": "^1.0.0" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "schema-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", - "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "core-js": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz", - "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==" - }, - "core-js-compat": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.6.5.tgz", - "integrity": "sha512-7ItTKOhOZbznhXAQ2g/slGg1PJV5zDO/WdkTwi7UEOJmkvsE32PWvx6mKtDjiMpjnR2CNf6BAD6sSxIlv7ptng==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "semver": "7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true - } - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cosmiconfig": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", - "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", - "dev": true, - "requires": { - "import-fresh": "^2.0.0", - "is-directory": "^0.3.1", - "js-yaml": "^3.13.1", - "parse-json": "^4.0.0" - }, - "dependencies": { - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - } - } - }, - "create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.4" - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "css-color-names": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", - "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=", - "dev": true - }, - "css-declaration-sorter": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-4.0.1.tgz", - "integrity": "sha512-BcxQSKTSEEQUftYpBVnsH4SF05NTuBokb19/sBt6asXGKZ/6VP7PLG1CBCkFDYOnhXhPh0jMhO6xZ71oYHXHBA==", - "dev": true, - "requires": { - "postcss": "^7.0.36", - "timsort": "^0.3.0" - } - }, - "css-loader": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-3.6.0.tgz", - "integrity": "sha512-M5lSukoWi1If8dhQAUCvj4H8vUt3vOnwbQBH9DdTm/s4Ym2B/3dPMtYZeJmq7Q3S3Pa+I94DcZ7pc9bP14cWIQ==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "cssesc": "^3.0.0", - "icss-utils": "^4.1.1", - "loader-utils": "^1.2.3", - "normalize-path": "^3.0.0", - "postcss": "^7.0.36", - "postcss-modules-extract-imports": "^2.0.0", - "postcss-modules-local-by-default": "^3.0.2", - "postcss-modules-scope": "^2.2.0", - "postcss-modules-values": "^3.0.0", - "postcss-value-parser": "^4.1.0", - "schema-utils": "^2.7.0", - "semver": "^6.3.0" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "css-select": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz", - "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==", - "dev": true, - "requires": { - "boolbase": "^1.0.0", - "css-what": "^3.2.1", - "domutils": "^1.7.0", - "nth-check": "^1.0.2" - } - }, - "css-select-base-adapter": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz", - "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==", - "dev": true - }, - "css-tree": { - "version": "1.0.0-alpha.37", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz", - "integrity": "sha512-DMxWJg0rnz7UgxKT0Q1HU/L9BeJI0M6ksor0OgqOnF+aRCDWg/N2641HmVyU9KVIu0OVVWOb2IpC9A+BJRnejg==", - "dev": true, - "requires": { - "mdn-data": "2.0.4", - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "css-what": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.4.2.tgz", - "integrity": "sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ==", - "dev": true - }, - "cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "dev": true - }, - "cssnano": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz", - "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==", - "dev": true, - "requires": { - "cosmiconfig": "^5.0.0", - "cssnano-preset-default": "^4.0.7", - "is-resolvable": "^1.0.0", - "postcss": "^7.0.36" - } - }, - "cssnano-preset-default": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-4.0.7.tgz", - "integrity": "sha512-x0YHHx2h6p0fCl1zY9L9roD7rnlltugGu7zXSKQx6k2rYw0Hi3IqxcoAGF7u9Q5w1nt7vK0ulxV8Lo+EvllGsA==", - "dev": true, - "requires": { - "css-declaration-sorter": "^4.0.1", - "cssnano-util-raw-cache": "^4.0.1", - "postcss": "^7.0.36", - "postcss-calc": "^7.0.1", - "postcss-colormin": "^4.0.3", - "postcss-convert-values": "^4.0.1", - "postcss-discard-comments": "^4.0.2", - "postcss-discard-duplicates": "^4.0.2", - "postcss-discard-empty": "^4.0.1", - "postcss-discard-overridden": "^4.0.1", - "postcss-merge-longhand": "^4.0.11", - "postcss-merge-rules": "^4.0.3", - "postcss-minify-font-values": "^4.0.2", - "postcss-minify-gradients": "^4.0.2", - "postcss-minify-params": "^4.0.2", - "postcss-minify-selectors": "^4.0.2", - "postcss-normalize-charset": "^4.0.1", - "postcss-normalize-display-values": "^4.0.2", - "postcss-normalize-positions": "^4.0.2", - "postcss-normalize-repeat-style": "^4.0.2", - "postcss-normalize-string": "^4.0.2", - "postcss-normalize-timing-functions": "^4.0.2", - "postcss-normalize-unicode": "^4.0.1", - "postcss-normalize-url": "^4.0.1", - "postcss-normalize-whitespace": "^4.0.2", - "postcss-ordered-values": "^4.1.2", - "postcss-reduce-initial": "^4.0.3", - "postcss-reduce-transforms": "^4.0.2", - "postcss-svgo": "^4.0.2", - "postcss-unique-selectors": "^4.0.1" - } - }, - "cssnano-util-get-arguments": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz", - "integrity": "sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8=", - "dev": true - }, - "cssnano-util-get-match": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz", - "integrity": "sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0=", - "dev": true - }, - "cssnano-util-raw-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.1.tgz", - "integrity": "sha512-qLuYtWK2b2Dy55I8ZX3ky1Z16WYsx544Q0UWViebptpwn/xDBmog2TLg4f+DBMg1rJ6JDWtn96WHbOKDWt1WQA==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "cssnano-util-same-parent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz", - "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==", - "dev": true - }, - "csso": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.0.3.tgz", - "integrity": "sha512-NL3spysxUkcrOgnpsT4Xdl2aiEiBG6bXswAABQVHcMrfjjBisFOKwLDOmf4wf32aPdcJws1zds2B0Rg+jqMyHQ==", - "dev": true, - "requires": { - "css-tree": "1.0.0-alpha.39" - }, - "dependencies": { - "css-tree": { - "version": "1.0.0-alpha.39", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.39.tgz", - "integrity": "sha512-7UvkEYgBAHRG9Nt980lYxjsTrCyHFN53ky3wVsDkiMdVqylqRt+Zc+jm5qw7/qyOvN2dHSYtX0e4MbCCExSvnA==", - "dev": true, - "requires": { - "mdn-data": "2.0.6", - "source-map": "^0.6.1" - } - }, - "mdn-data": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.6.tgz", - "integrity": "sha512-rQvjv71olwNHgiTbfPZFkJtjNMciWgswYeciZhtvWLO8bmX3TnhyA62I6sTWOyZssWHJJjY6/KiWwqQsWWsqOA==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "cyclist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", - "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", - "dev": true - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "de-indent": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", - "integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "deep-equal": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz", - "integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==", - "dev": true, - "requires": { - "is-arguments": "^1.0.4", - "is-date-object": "^1.0.1", - "is-regex": "^1.0.4", - "object-is": "^1.0.1", - "object-keys": "^1.1.1", - "regexp.prototype.flags": "^1.2.0" - } - }, - "deepmerge": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", - "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "dev": true - }, - "default-gateway": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-5.0.5.tgz", - "integrity": "sha512-z2RnruVmj8hVMmAnEJMTIJNijhKCDiGjbLP+BHJFOT7ld3Bo5qcIBpVYDniqhbMIIf+jZDlkP2MkPXiQy/DBLA==", - "dev": true, - "requires": { - "execa": "^3.3.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "execa": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", - "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "p-finally": "^2.0.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "p-finally": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", - "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "del": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", - "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "globby": "^6.1.0", - "is-path-cwd": "^2.0.0", - "is-path-in-cwd": "^2.0.0", - "p-map": "^2.0.0", - "pify": "^4.0.1", - "rimraf": "^2.6.3" - }, - "dependencies": { - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, - "p-map": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", - "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", - "dev": true - } - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, - "des.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", - "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", - "dev": true - }, - "detect-node": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz", - "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==", - "dev": true - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "dir-glob": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", - "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", - "dev": true, - "requires": { - "path-type": "^3.0.0" - } - }, - "dns-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", - "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=", - "dev": true - }, - "dns-packet": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.2.tgz", - "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", - "dev": true, - "requires": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, - "dns-txt": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", - "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", - "dev": true, - "requires": { - "buffer-indexof": "^1.0.0" - } - }, - "dom-converter": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", - "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==", - "dev": true, - "requires": { - "utila": "~0.4" - } - }, - "dom-serializer": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", - "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - }, - "dependencies": { - "domelementtype": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.2.tgz", - "integrity": "sha512-wFwTwCVebUrMgGeAwRL/NhZtHAUyT9n9yg4IMDwf10+6iCMxSkVq9MGCVEH+QZWo1nNidy8kNvwmv4zWHDTqvA==", - "dev": true - } - } - }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "requires": { - "is-obj": "^2.0.0" - } - }, - "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", - "dev": true - }, - "dotenv-expand": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", - "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==", - "dev": true - }, - "duplexer": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", - "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", - "dev": true - }, - "duplexify": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", - "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", - "dev": true, - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "easy-stack": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/easy-stack/-/easy-stack-1.0.0.tgz", - "integrity": "sha1-EskbMIWjfwuqM26UhurEv5Tj54g=", - "dev": true - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true - }, - "ejs": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz", - "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==", - "dev": true - }, - "electron-to-chromium": { - "version": "1.3.578", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.578.tgz", - "integrity": "sha512-z4gU6dA1CbBJsAErW5swTGAaU2TBzc2mPAonJb00zqW1rOraDo2zfBMDRvaz9cVic+0JEZiYbHWPw/fTaZlG2Q==", - "dev": true - }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "enhanced-resolve": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.3.0.tgz", - "integrity": "sha512-3e87LvavsdxyoCfGusJnrZ5G8SLPOFeHSNpZI/ATL9a5leXo2k0w6MKnbqhdBad9qTobSfB20Ld7UmgoNbAZkQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.5.0", - "tapable": "^1.0.0" - }, - "dependencies": { - "memory-fs": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", - "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "entities": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz", - "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==", - "dev": true - }, - "errno": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", - "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", - "dev": true, - "requires": { - "prr": "~1.0.1" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "error-stack-parser": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.6.tgz", - "integrity": "sha512-d51brTeqC+BHlwF0BhPtcYgF5nlzf9ZZ0ZIUQNZpc9ZB9qw5IJ2diTrBY9jlCJkTLITYPjmiX6OWCwH+fuyNgQ==", - "dev": true, - "requires": { - "stackframe": "^1.1.1" - } - }, - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escalade": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.0.tgz", - "integrity": "sha512-mAk+hPSO8fLDkhV7V0dXazH5pDc6MrjBTPyD3VeKzxnVFjH1MIxbCdqGZB9O8+EwWakZs3ZCbDS4IpRt79V1ig==", - "dev": true - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint-scope": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", - "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "dev": true - }, - "event-pubsub": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/event-pubsub/-/event-pubsub-4.3.0.tgz", - "integrity": "sha512-z7IyloorXvKbFx9Bpie2+vMJKKx1fH1EN5yiTfp8CiLOTptSYy1g8H4yDpGlEdshL1PBiFtBHepF2cNsqeEeFQ==", - "dev": true - }, - "eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true - }, - "events": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", - "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", - "dev": true - }, - "eventsource": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz", - "integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==", - "dev": true, - "requires": { - "original": "^1.0.0" - } - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", - "dev": true, - "requires": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "content-type": "~1.0.4", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "dev": true - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-glob": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", - "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", - "dev": true, - "requires": { - "@mrmlnc/readdir-enhanced": "^2.2.1", - "@nodelib/fs.stat": "^1.1.2", - "glob-parent": "^5.1.2", - "is-glob": "^4.0.0", - "merge2": "^1.2.3", - "micromatch": "^3.1.10" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - } - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "faye-websocket": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", - "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", - "dev": true, - "requires": { - "websocket-driver": ">=0.5.1" - } - }, - "figgy-pudding": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", - "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", - "dev": true - }, - "file-loader": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-4.3.0.tgz", - "integrity": "sha512-aKrYPYjF1yG3oX0kWRrqrSMfgftm7oJW5M+m4owoldH5C51C0RkIwB++JbRvEW3IU6/ZG5n8UvEcdgwOt2UOWA==", - "dev": true, - "requires": { - "loader-utils": "^1.2.3", - "schema-utils": "^2.5.0" - } - }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, - "filesize": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz", - "integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==", - "dev": true - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "find-cache-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", - "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "flush-write-stream": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", - "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "readable-stream": "^2.3.6" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "requires": { - "debug": "=3.1.0" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", - "dev": true - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "dev": true - }, - "from2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "fs-write-stream-atomic": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", - "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", - "dev": true, - "optional": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "glob-to-regexp": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", - "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", - "dev": true - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "globby": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz", - "integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "array-union": "^1.0.2", - "dir-glob": "^2.2.2", - "fast-glob": "^2.2.6", - "glob": "^7.1.3", - "ignore": "^4.0.3", - "pify": "^4.0.1", - "slash": "^2.0.0" - }, - "dependencies": { - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true - } - } - }, - "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", - "dev": true - }, - "gzip-size": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.1.1.tgz", - "integrity": "sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA==", - "dev": true, - "requires": { - "duplexer": "^0.1.1", - "pify": "^4.0.1" - } - }, - "handle-thing": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", - "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", - "dev": true - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dev": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - } - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "hash-sum": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-2.0.0.tgz", - "integrity": "sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==", - "dev": true - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "hex-color-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", - "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==", - "dev": true - }, - "highlight.js": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz", - "integrity": "sha512-zBZAmhSupHIl5sITeMqIJnYCDfAEc3Gdkqj65wC1lpI468MMQeeQkhcIAvk+RylAkxrCcI9xy9piHiXeQ1BdzQ==", - "dev": true - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "hoopy": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz", - "integrity": "sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ==", - "dev": true - }, - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", - "dev": true - }, - "hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "hsl-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz", - "integrity": "sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4=", - "dev": true - }, - "hsla-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hsla-regex/-/hsla-regex-1.0.0.tgz", - "integrity": "sha1-wc56MWjIxmFAM6S194d/OyJfnDg=", - "dev": true - }, - "html-comment-regex": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.2.tgz", - "integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==", - "dev": true - }, - "html-entities": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.3.1.tgz", - "integrity": "sha512-rhE/4Z3hIhzHAUKbW8jVcCyuT5oJCXXqhN/6mXXVCpzTmvJnoH2HL/bt3EZ6p55jbFJBeAe1ZNpL5BugLujxNA==", - "dev": true - }, - "html-minifier": { - "version": "3.5.21", - "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.21.tgz", - "integrity": "sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA==", - "dev": true, - "requires": { - "camel-case": "3.0.x", - "clean-css": "4.2.x", - "commander": "2.17.x", - "he": "1.2.x", - "param-case": "2.1.x", - "relateurl": "0.2.x", - "uglify-js": "3.4.x" - }, - "dependencies": { - "commander": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", - "dev": true - } - } - }, - "html-tags": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.1.0.tgz", - "integrity": "sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg==", - "dev": true - }, - "html-webpack-plugin": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", - "integrity": "sha1-sBq71yOsqqeze2r0SS69oD2d03s=", - "dev": true, - "requires": { - "html-minifier": "^3.2.3", - "loader-utils": "^0.2.16", - "lodash": "^4.17.21", - "pretty-error": "^2.0.2", - "tapable": "^1.0.0", - "toposort": "^1.0.0", - "util.promisify": "1.0.0" - }, - "dependencies": { - "big.js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", - "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", - "dev": true - }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", - "dev": true - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, - "loader-utils": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", - "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", - "dev": true, - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0", - "object-assign": "^4.0.1" - } - }, - "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - } - } - }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dev": true, - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true - } - } - }, - "http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", - "dev": true - }, - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - } - } - }, - "http-proxy": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", - "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", - "dev": true, - "requires": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - } - }, - "http-proxy-middleware": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz", - "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==", - "dev": true, - "requires": { - "http-proxy": "^1.17.0", - "is-glob": "^4.0.0", - "lodash": "^4.17.21", - "micromatch": "^3.1.10" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, - "human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "icss-utils": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-4.1.1.tgz", - "integrity": "sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", - "dev": true - }, - "iferr": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", - "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", - "dev": true - }, - "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", - "dev": true - }, - "import-cwd": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", - "integrity": "sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk=", - "dev": true, - "requires": { - "import-from": "^2.1.0" - } - }, - "import-fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", - "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", - "dev": true, - "requires": { - "caller-path": "^2.0.0", - "resolve-from": "^3.0.0" - } - }, - "import-from": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-from/-/import-from-2.1.0.tgz", - "integrity": "sha1-M1238qev/VOqpHHUuAId7ja387E=", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, - "import-local": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", - "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", - "dev": true, - "requires": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true - }, - "indexes-of": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", - "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", - "dev": true - }, - "infer-owner": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "internal-ip": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.3.0.tgz", - "integrity": "sha512-S1zBo1D6zcsyuC6PMmY5+55YMILQ9av8lotMx447Bq6SAgo/sDK6y6uUKmuYhW7eacnIhFfsPmCNYdDzsnnDCg==", - "dev": true, - "requires": { - "default-gateway": "^4.2.0", - "ipaddr.js": "^1.9.0" - }, - "dependencies": { - "default-gateway": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz", - "integrity": "sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "ip-regex": "^2.1.0" - } - } - } - }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", - "dev": true - }, - "ip-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", - "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", - "dev": true - }, - "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "dev": true - }, - "is-absolute-url": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", - "integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=", - "dev": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-arguments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", - "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "optional": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-callable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", - "dev": true - }, - "is-color-stop": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-color-stop/-/is-color-stop-1.1.0.tgz", - "integrity": "sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=", - "dev": true, - "requires": { - "css-color-names": "^0.0.4", - "hex-color-regex": "^1.1.0", - "hsl-regex": "^1.0.0", - "hsla-regex": "^1.0.0", - "rgb-regex": "^1.0.1", - "rgba-regex": "^1.0.0" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "is-directory": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", - "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", - "dev": true - }, - "is-docker": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", - "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==", - "dev": true - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-negative-zero": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", - "dev": true - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true - }, - "is-path-cwd": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", - "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", - "dev": true - }, - "is-path-in-cwd": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz", - "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==", - "dev": true, - "requires": { - "is-path-inside": "^2.1.0" - } - }, - "is-path-inside": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz", - "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==", - "dev": true, - "requires": { - "path-is-inside": "^1.0.2" - } - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-regex": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", - "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "is-resolvable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", - "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-svg": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-4.2.2.tgz", - "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==", - "dev": true, - "requires": { - "html-comment-regex": "^1.1.0" - } - }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "is-wsl": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", - "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "javascript-stringify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.0.1.tgz", - "integrity": "sha512-yV+gqbd5vaOYjqlbk16EG89xB5udgjqQF3C5FAORDg4f/IS1Yc5ERCv5e/57yBcfJYw05V5JyIXabhwb75Xxow==", - "dev": true - }, - "jest-worker": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.5.0.tgz", - "integrity": "sha512-/dsSmUkIy5EBGfv/IjjqmFxrNAUpBERfGs1oHROyD7yxjG/w+t0GOJDX8O1k32ySmd7+a5IhnJU2qQFcJ4n1vw==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "js-message": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/js-message/-/js-message-1.0.5.tgz", - "integrity": "sha1-IwDSSxrwjondCVvBpMnJz8uJLRU=", - "dev": true - }, - "js-queue": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/js-queue/-/js-queue-2.0.0.tgz", - "integrity": "sha1-NiITz4YPRo8BJfxslqvBdCUx+Ug=", - "dev": true, - "requires": { - "easy-stack": "^1.0.0" - } - }, - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "json3": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz", - "integrity": "sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==", - "dev": true - }, - "json5": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", - "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "killable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", - "integrity": "sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg==", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - }, - "launch-editor": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.2.1.tgz", - "integrity": "sha512-On+V7K2uZK6wK7x691ycSUbLD/FyKKelArkbaAMSSJU8JmqmhwN2+mnJDNINuJWSrh2L0kDk+ZQtbC/gOWUwLw==", - "dev": true, - "requires": { - "chalk": "^2.3.0", - "shell-quote": "^1.6.1" - } - }, - "launch-editor-middleware": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/launch-editor-middleware/-/launch-editor-middleware-2.2.1.tgz", - "integrity": "sha512-s0UO2/gEGiCgei3/2UN3SMuUj1phjQN8lcpnvgLSz26fAzNWPQ6Nf/kF5IFClnfU2ehp6LrmKdMU/beveO+2jg==", - "dev": true, - "requires": { - "launch-editor": "^2.2.1" - } - }, - "leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true - }, - "levenary": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/levenary/-/levenary-1.1.1.tgz", - "integrity": "sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ==", - "dev": true, - "requires": { - "leven": "^3.1.0" - } - }, - "libsodium": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.8.tgz", - "integrity": "sha512-/Qc+APf0jbeWSaeEruH0L1/tbbT+sbf884ZL0/zV/0JXaDPBzYkKbyb/wmxMHgAHzm3t6gqe7bOOXAVwfqVikQ==" - }, - "libsodium-wrappers": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.8.tgz", - "integrity": "sha512-PDhPWXBqd/SaqAFUBgH2Ux7b3VEEJgyD6BQB+VdNFJb9PbExGr/T/myc/MBoSvl8qLzfm0W0IVByOQS5L1MrCg==", - "requires": { - "libsodium": "0.7.8" - } - }, - "lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", - "dev": true - }, - "loader-runner": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", - "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==", - "dev": true - }, - "loader-utils": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", - "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^1.0.1" - }, - "dependencies": { - "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - } - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, - "lodash.defaultsdeep": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz", - "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", - "dev": true - }, - "lodash.kebabcase": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", - "integrity": "sha1-hImxyw0p/4gZXM7KRI/21swpXDY=", - "dev": true - }, - "lodash.mapvalues": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz", - "integrity": "sha1-G6+lAF3p3W9PJmaMMMo3IwzJaJw=", - "dev": true - }, - "lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", - "dev": true - }, - "lodash.transform": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.transform/-/lodash.transform-4.6.0.tgz", - "integrity": "sha1-EjBkIvYzJK7YSD0/ODMrX2cFR6A=", - "dev": true - }, - "lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", - "dev": true - }, - "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "dev": true, - "requires": { - "chalk": "^2.0.1" - } - }, - "loglevel": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.7.0.tgz", - "integrity": "sha512-i2sY04nal5jDcagM3FMfG++T69GEEM8CYuOfeOIvmXzOIcwE9a/CJPR0MFM97pYMj/u10lzz7/zd7+qwhrBTqQ==", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", - "dev": true - }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "mdn-data": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz", - "integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==", - "dev": true - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "dev": true - }, - "memory-fs": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", - "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", - "dev": true - }, - "merge-source-map": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", - "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - } - }, - "mime": { - "version": "2.4.6", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", - "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==", - "dev": true - }, - "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", - "dev": true - }, - "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", - "dev": true, - "requires": { - "mime-db": "1.44.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, - "mini-css-extract-plugin": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz", - "integrity": "sha512-lp3GeY7ygcgAmVIcRPBVhIkf8Us7FZjA+ILpal44qLdSu11wmjKQ3d9k15lfD7pO4esu9eUIAW7qiYIBppv40A==", - "dev": true, - "requires": { - "loader-utils": "^1.1.0", - "normalize-url": "1.9.1", - "schema-utils": "^1.0.0", - "webpack-sources": "^1.1.0" - }, - "dependencies": { - "normalize-url": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz", - "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", - "dev": true, - "requires": { - "object-assign": "^4.0.1", - "prepend-http": "^1.0.0", - "query-string": "^4.1.0", - "sort-keys": "^1.0.0" - } - }, - "schema-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", - "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, - "minipass": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz", - "integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - }, - "dependencies": { - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "minipass-collect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-flush": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", - "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "minipass-pipeline": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", - "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", - "dev": true, - "requires": { - "minipass": "^3.0.0" - } - }, - "mississippi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", - "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", - "dev": true, - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^3.0.0", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - } - }, - "mixin-deep": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", - "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "move-concurrently": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", - "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "multicast-dns": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", - "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", - "dev": true, - "requires": { - "dns-packet": "^1.3.2", - "thunky": "^1.0.2" - } - }, - "multicast-dns-service-types": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", - "dev": true - }, - "mz": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "dev": true, - "requires": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "nan": { - "version": "2.14.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", - "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", - "dev": true, - "optional": true - }, - "nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", - "dev": true - }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", - "dev": true, - "requires": { - "lower-case": "^1.1.1" - } - }, - "node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "dev": true - }, - "node-ipc": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/node-ipc/-/node-ipc-9.1.1.tgz", - "integrity": "sha512-FAyICv0sIRJxVp3GW5fzgaf9jwwRQxAKDJlmNFUL5hOy+W4X/I5AypyHoq0DXXbo9o/gt79gj++4cMr4jVWE/w==", - "dev": true, - "requires": { - "event-pubsub": "4.3.0", - "js-message": "1.0.5", - "js-queue": "2.0.0" - } - }, - "node-libs-browser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", - "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==", - "dev": true, - "requires": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^3.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.1", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.11.0", - "vm-browserify": "^1.0.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, - "node-releases": { - "version": "1.1.61", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.61.tgz", - "integrity": "sha512-DD5vebQLg8jLCOzwupn954fbIiZht05DAZs0k2u8NStSe6h9XdsuIQL8hSRKYiU8WUQRznmSDrKGbv3ObOmC7g==", - "dev": true - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.8.9", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "normalize-range": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", - "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", - "dev": true - }, - "normalize-url": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", - "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "nth-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", - "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", - "dev": true, - "requires": { - "boolbase": "~1.0.0" - } - }, - "num2fraction": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", - "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", - "dev": true - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", - "dev": true - }, - "object-is": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.3.tgz", - "integrity": "sha512-teyqLvFWzLkq5B9ki8FVWA902UER2qkxmdA4nLf+wjOLAWgxzCWZNCxpDq9MvE8MmhWNr+I8w3BN49Vx36Y6Xg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", - "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.0", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", - "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "object.values": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", - "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "open": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/open/-/open-6.4.0.tgz", - "integrity": "sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==", - "dev": true, - "requires": { - "is-wsl": "^1.1.0" - } - }, - "opener": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", - "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", - "dev": true - }, - "opn": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/opn/-/opn-5.5.0.tgz", - "integrity": "sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA==", - "dev": true, - "requires": { - "is-wsl": "^1.1.0" - } - }, - "ora": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz", - "integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==", - "dev": true, - "requires": { - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", - "cli-spinners": "^2.0.0", - "log-symbols": "^2.2.0", - "strip-ansi": "^5.2.0", - "wcwidth": "^1.0.1" - }, - "dependencies": { - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "original": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", - "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==", - "dev": true, - "requires": { - "url-parse": "^1.5.2" - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-map": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", - "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", - "dev": true, - "requires": { - "aggregate-error": "^3.0.0" - } - }, - "p-retry": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-3.0.1.tgz", - "integrity": "sha512-XE6G4+YTTkT2a0UWb2kjZe8xNwf8bIbnqpc/IS/idOBVhyves0mK5OJgeocjx7q5pvX/6m23xuzVPYT1uGM73w==", - "dev": true, - "requires": { - "retry": "^0.12.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true - }, - "parallel-transform": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz", - "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==", - "dev": true, - "requires": { - "cyclist": "^1.0.1", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "param-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", - "integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=", - "dev": true, - "requires": { - "no-case": "^2.2.0" - } - }, - "parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dev": true, - "requires": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "parse-json": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", - "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "parse5": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", - "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", - "dev": true - }, - "parse5-htmlparser2-tree-adapter": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-5.1.1.tgz", - "integrity": "sha512-CF+TKjXqoqyDwHqBhFQ+3l5t83xYi6fVT1tQNg+Ye0JRLnTxWvIroCjEp1A0k4lneHNBGnICUf0cfYVYGEazqw==", - "dev": true, - "requires": { - "parse5": "^5.1.1" - } - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", - "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", - "dev": true - }, - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } - } - }, - "pbkdf2": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", - "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, - "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", - "dev": true, - "optional": true - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - }, - "pnp-webpack-plugin": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/pnp-webpack-plugin/-/pnp-webpack-plugin-1.6.4.tgz", - "integrity": "sha512-7Wjy+9E3WwLOEL30D+m8TSTF7qJJUJLONBnwQp0518siuMxUQUbgZwssaFX+QKlZkjHZcw/IpZCt/H0srrntSg==", - "dev": true, - "requires": { - "ts-pnp": "^1.1.6" - } - }, - "portfinder": { - "version": "1.0.28", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", - "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", - "dev": true, - "requires": { - "async": "^2.6.2", - "debug": "^3.1.1", - "mkdirp": "^0.5.5" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "postcss": { - "version": "7.0.36", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz", - "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", - "dev": true, - "requires": { - "chalk": "^2.4.2", - "source-map": "^0.6.1", - "supports-color": "^6.1.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "postcss-calc": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-7.0.5.tgz", - "integrity": "sha512-1tKHutbGtLtEZF6PT4JSihCHfIVldU72mZ8SdZHIYriIZ9fh9k9aWSppaT8rHsyI3dX+KSR+W+Ix9BMY3AODrg==", - "dev": true, - "requires": { - "postcss": "^7.0.36", - "postcss-selector-parser": "^6.0.2", - "postcss-value-parser": "^4.0.2" - } - }, - "postcss-colormin": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-4.0.3.tgz", - "integrity": "sha512-WyQFAdDZpExQh32j0U0feWisZ0dmOtPl44qYmJKkq9xFWY3p+4qnRzCHeNrkeRhwPHz9bQ3mo0/yVkaply0MNw==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "color": "^3.0.0", - "has": "^1.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-convert-values": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-4.0.1.tgz", - "integrity": "sha512-Kisdo1y77KUC0Jmn0OXU/COOJbzM8cImvw1ZFsBgBgMgb1iL23Zs/LXRe3r+EZqM3vGYKdQ2YJVQ5VkJI+zEJQ==", - "dev": true, - "requires": { - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-discard-comments": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-4.0.2.tgz", - "integrity": "sha512-RJutN259iuRf3IW7GZyLM5Sw4GLTOH8FmsXBnv8Ab/Tc2k4SR4qbV4DNbyyY4+Sjo362SyDmW2DQ7lBSChrpkg==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "postcss-discard-duplicates": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz", - "integrity": "sha512-ZNQfR1gPNAiXZhgENFfEglF93pciw0WxMkJeVmw8eF+JZBbMD7jp6C67GqJAXVZP2BWbOztKfbsdmMp/k8c6oQ==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "postcss-discard-empty": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-4.0.1.tgz", - "integrity": "sha512-B9miTzbznhDjTfjvipfHoqbWKwd0Mj+/fL5s1QOz06wufguil+Xheo4XpOnc4NqKYBCNqqEzgPv2aPBIJLox0w==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "postcss-discard-overridden": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-4.0.1.tgz", - "integrity": "sha512-IYY2bEDD7g1XM1IDEsUT4//iEYCxAmP5oDSFMVU/JVvT7gh+l4fmjciLqGgwjdWpQIdb0Che2VX00QObS5+cTg==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "postcss-load-config": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-2.1.2.tgz", - "integrity": "sha512-/rDeGV6vMUo3mwJZmeHfEDvwnTKKqQ0S7OHUi/kJvvtx3aWtyWG2/0ZWnzCt2keEclwN6Tf0DST2v9kITdOKYw==", - "dev": true, - "requires": { - "cosmiconfig": "^5.0.0", - "import-cwd": "^2.0.0" - } - }, - "postcss-loader": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-3.0.0.tgz", - "integrity": "sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA==", - "dev": true, - "requires": { - "loader-utils": "^1.1.0", - "postcss": "^7.0.36", - "postcss-load-config": "^2.0.0", - "schema-utils": "^1.0.0" - }, - "dependencies": { - "schema-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", - "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "postcss-merge-longhand": { - "version": "4.0.11", - "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-4.0.11.tgz", - "integrity": "sha512-alx/zmoeXvJjp7L4mxEMjh8lxVlDFX1gqWHzaaQewwMZiVhLo42TEClKaeHbRf6J7j82ZOdTJ808RtN0ZOZwvw==", - "dev": true, - "requires": { - "css-color-names": "0.0.4", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0", - "stylehacks": "^4.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-merge-rules": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-4.0.3.tgz", - "integrity": "sha512-U7e3r1SbvYzO0Jr3UT/zKBVgYYyhAz0aitvGIYOYK5CPmkNih+WDSsS5tvPrJ8YMQYlEMvsZIiqmn7HdFUaeEQ==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "caniuse-api": "^3.0.0", - "cssnano-util-same-parent": "^4.0.0", - "postcss": "^7.0.36", - "postcss-selector-parser": "^3.0.0", - "vendors": "^1.0.0" - }, - "dependencies": { - "postcss-selector-parser": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz", - "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==", - "dev": true, - "requires": { - "dot-prop": "^5.2.0", - "indexes-of": "^1.0.1", - "uniq": "^1.0.1" - } - } - } - }, - "postcss-minify-font-values": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-4.0.2.tgz", - "integrity": "sha512-j85oO6OnRU9zPf04+PZv1LYIYOprWm6IA6zkXkrJXyRveDEuQggG6tvoy8ir8ZwjLxLuGfNkCZEQG7zan+Hbtg==", - "dev": true, - "requires": { - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-minify-gradients": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-4.0.2.tgz", - "integrity": "sha512-qKPfwlONdcf/AndP1U8SJ/uzIJtowHlMaSioKzebAXSG4iJthlWC9iSWznQcX4f66gIWX44RSA841HTHj3wK+Q==", - "dev": true, - "requires": { - "cssnano-util-get-arguments": "^4.0.0", - "is-color-stop": "^1.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-minify-params": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz", - "integrity": "sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhPet/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg==", - "dev": true, - "requires": { - "alphanum-sort": "^1.0.0", - "browserslist": "^4.16.5", - "cssnano-util-get-arguments": "^4.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0", - "uniqs": "^2.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-minify-selectors": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-4.0.2.tgz", - "integrity": "sha512-D5S1iViljXBj9kflQo4YutWnJmwm8VvIsU1GeXJGiG9j8CIg9zs4voPMdQDUmIxetUOh60VilsNzCiAFTOqu3g==", - "dev": true, - "requires": { - "alphanum-sort": "^1.0.0", - "has": "^1.0.0", - "postcss": "^7.0.36", - "postcss-selector-parser": "^3.0.0" - }, - "dependencies": { - "postcss-selector-parser": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz", - "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==", - "dev": true, - "requires": { - "dot-prop": "^5.2.0", - "indexes-of": "^1.0.1", - "uniq": "^1.0.1" - } - } - } - }, - "postcss-modules-extract-imports": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz", - "integrity": "sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "postcss-modules-local-by-default": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.3.tgz", - "integrity": "sha512-e3xDq+LotiGesympRlKNgaJ0PCzoUIdpH0dj47iWAui/kyTgh3CiAr1qP54uodmJhl6p9rN6BoNcdEDVJx9RDw==", - "dev": true, - "requires": { - "icss-utils": "^4.1.1", - "postcss": "^7.0.36", - "postcss-selector-parser": "^6.0.2", - "postcss-value-parser": "^4.1.0" - } - }, - "postcss-modules-scope": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-2.2.0.tgz", - "integrity": "sha512-YyEgsTMRpNd+HmyC7H/mh3y+MeFWevy7V1evVhJWewmMbjDHIbZbOXICC2y+m1xI1UVfIT1HMW/O04Hxyu9oXQ==", - "dev": true, - "requires": { - "postcss": "^7.0.36", - "postcss-selector-parser": "^6.0.0" - } - }, - "postcss-modules-values": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz", - "integrity": "sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg==", - "dev": true, - "requires": { - "icss-utils": "^4.0.0", - "postcss": "^7.0.36" - } - }, - "postcss-normalize-charset": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-4.0.1.tgz", - "integrity": "sha512-gMXCrrlWh6G27U0hF3vNvR3w8I1s2wOBILvA87iNXaPvSNo5uZAMYsZG7XjCUf1eVxuPfyL4TJ7++SGZLc9A3g==", - "dev": true, - "requires": { - "postcss": "^7.0.36" - } - }, - "postcss-normalize-display-values": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.2.tgz", - "integrity": "sha512-3F2jcsaMW7+VtRMAqf/3m4cPFhPD3EFRgNs18u+k3lTJJlVe7d0YPO+bnwqo2xg8YiRpDXJI2u8A0wqJxMsQuQ==", - "dev": true, - "requires": { - "cssnano-util-get-match": "^4.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-normalize-positions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-4.0.2.tgz", - "integrity": "sha512-Dlf3/9AxpxE+NF1fJxYDeggi5WwV35MXGFnnoccP/9qDtFrTArZ0D0R+iKcg5WsUd8nUYMIl8yXDCtcrT8JrdA==", - "dev": true, - "requires": { - "cssnano-util-get-arguments": "^4.0.0", - "has": "^1.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-normalize-repeat-style": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.2.tgz", - "integrity": "sha512-qvigdYYMpSuoFs3Is/f5nHdRLJN/ITA7huIoCyqqENJe9PvPmLhNLMu7QTjPdtnVf6OcYYO5SHonx4+fbJE1+Q==", - "dev": true, - "requires": { - "cssnano-util-get-arguments": "^4.0.0", - "cssnano-util-get-match": "^4.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-normalize-string": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-4.0.2.tgz", - "integrity": "sha512-RrERod97Dnwqq49WNz8qo66ps0swYZDSb6rM57kN2J+aoyEAJfZ6bMx0sx/F9TIEX0xthPGCmeyiam/jXif0eA==", - "dev": true, - "requires": { - "has": "^1.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-normalize-timing-functions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.2.tgz", - "integrity": "sha512-acwJY95edP762e++00Ehq9L4sZCEcOPyaHwoaFOhIwWCDfik6YvqsYNxckee65JHLKzuNSSmAdxwD2Cud1Z54A==", - "dev": true, - "requires": { - "cssnano-util-get-match": "^4.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-normalize-unicode": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.1.tgz", - "integrity": "sha512-od18Uq2wCYn+vZ/qCOeutvHjB5jm57ToxRaMeNuf0nWVHaP9Hua56QyMF6fs/4FSUnVIw0CBPsU0K4LnBPwYwg==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-normalize-url": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-4.0.1.tgz", - "integrity": "sha512-p5oVaF4+IHwu7VpMan/SSpmpYxcJMtkGppYf0VbdH5B6hN8YNmVyJLuY9FmLQTzY3fag5ESUUHDqM+heid0UVA==", - "dev": true, - "requires": { - "is-absolute-url": "^2.0.0", - "normalize-url": "^3.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-normalize-whitespace": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.2.tgz", - "integrity": "sha512-tO8QIgrsI3p95r8fyqKV+ufKlSHh9hMJqACqbv2XknufqEDhDvbguXGBBqxw9nsQoXWf0qOqppziKJKHMD4GtA==", - "dev": true, - "requires": { - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-ordered-values": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-4.1.2.tgz", - "integrity": "sha512-2fCObh5UanxvSxeXrtLtlwVThBvHn6MQcu4ksNT2tsaV2Fg76R2CV98W7wNSlX+5/pFwEyaDwKLLoEV7uRybAw==", - "dev": true, - "requires": { - "cssnano-util-get-arguments": "^4.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-reduce-initial": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-4.0.3.tgz", - "integrity": "sha512-gKWmR5aUulSjbzOfD9AlJiHCGH6AEVLaM0AV+aSioxUDd16qXP1PCh8d1/BGVvpdWn8k/HiK7n6TjeoXN1F7DA==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "caniuse-api": "^3.0.0", - "has": "^1.0.0", - "postcss": "^7.0.36" - } - }, - "postcss-reduce-transforms": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.2.tgz", - "integrity": "sha512-EEVig1Q2QJ4ELpJXMZR8Vt5DQx8/mo+dGWSR7vWXqcob2gQLyQGsionYcGKATXvQzMPn6DSN1vTN7yFximdIAg==", - "dev": true, - "requires": { - "cssnano-util-get-match": "^4.0.0", - "has": "^1.0.0", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-selector-parser": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.4.tgz", - "integrity": "sha512-gjMeXBempyInaBqpp8gODmwZ52WaYsVOsfr4L4lDQ7n3ncD6mEyySiDtgzCT+NYC0mmeOLvtsF8iaEf0YT6dBw==", - "dev": true, - "requires": { - "cssesc": "^3.0.0", - "indexes-of": "^1.0.1", - "uniq": "^1.0.1", - "util-deprecate": "^1.0.2" - } - }, - "postcss-svgo": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-4.0.2.tgz", - "integrity": "sha512-C6wyjo3VwFm0QgBy+Fu7gCYOkCmgmClghO+pjcxvrcBKtiKt0uCF+hvbMO1fyv5BMImRK90SMb+dwUnfbGd+jw==", - "dev": true, - "requires": { - "is-svg": "^4.2.2", - "postcss": "^7.0.36", - "postcss-value-parser": "^3.0.0", - "svgo": "^1.0.0" - }, - "dependencies": { - "postcss-value-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", - "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", - "dev": true - } - } - }, - "postcss-unique-selectors": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-4.0.1.tgz", - "integrity": "sha512-+JanVaryLo9QwZjKrmJgkI4Fn8SBgRO6WXQBJi7KiAVPlmxikB5Jzc4EvXMT2H0/m0RjrVVm9rGNhZddm/8Spg==", - "dev": true, - "requires": { - "alphanum-sort": "^1.0.0", - "postcss": "^7.0.36", - "uniqs": "^2.0.0" - } - }, - "postcss-value-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", - "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", - "dev": true - }, - "prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", - "dev": true - }, - "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "dev": true, - "optional": true - }, - "pretty-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", - "integrity": "sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM=", - "dev": true, - "requires": { - "renderkid": "^2.0.1", - "utila": "~0.4" - } - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", - "dev": true - }, - "proxy-addr": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", - "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", - "dev": true, - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.9.1" - } - }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true - }, - "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "dev": true, - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - }, - "dependencies": { - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", - "dev": true - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - }, - "query-string": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", - "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", - "dev": true, - "requires": { - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "dev": true, - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", - "dev": true, - "optional": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "readonly-date": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz", - "integrity": "sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==" - }, - "regenerate": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.1.tgz", - "integrity": "sha512-j2+C8+NtXQgEKWk49MMP5P/u2GhnahTtVkRIHr5R5lVRlbKvmQ+oS+A5aLKWp2ma5VkT8sh6v+v4hbH0YHR66A==", - "dev": true - }, - "regenerate-unicode-properties": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", - "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", - "dev": true, - "requires": { - "regenerate": "^1.4.0" - } - }, - "regenerator-runtime": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", - "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", - "dev": true - }, - "regenerator-transform": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", - "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", - "dev": true, - "requires": { - "@babel/runtime": "^7.8.4" - } - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexp.prototype.flags": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", - "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "regexpu-core": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.1.tgz", - "integrity": "sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ==", - "dev": true, - "requires": { - "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^8.2.0", - "regjsgen": "^0.5.1", - "regjsparser": "^0.6.4", - "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.2.0" - } - }, - "regjsgen": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", - "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", - "dev": true - }, - "regjsparser": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.4.tgz", - "integrity": "sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw==", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - } - } - }, - "relateurl": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", - "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", - "dev": true - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "renderkid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-2.0.3.tgz", - "integrity": "sha512-z8CLQp7EZBPCwCnncgf9C4XAi3WR0dv+uWu/PjIyhhAb5d6IJ/QZqlHFprHeKT+59//V6BNUsLbvN8+2LarxGA==", - "dev": true, - "requires": { - "css-select": "^1.1.0", - "dom-converter": "^0.2", - "htmlparser2": "^3.3.0", - "strip-ansi": "^3.0.0", - "utila": "^0.4.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "css-select": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", - "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", - "dev": true, - "requires": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", - "dev": true - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", - "dev": true - }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.7" - } - }, - "resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", - "dev": true - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true - }, - "retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", - "dev": true - }, - "rgb-regex": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz", - "integrity": "sha1-wODWiC3w4jviVKR16O3UGRX+rrE=", - "dev": true - }, - "rgba-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/rgba-regex/-/rgba-regex-1.0.0.tgz", - "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=", - "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "run-queue": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", - "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", - "dev": true, - "requires": { - "aproba": "^1.1.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", - "dev": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true - }, - "schema-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", - "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" - } - }, - "select-hose": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", - "dev": true - }, - "selfsigned": { - "version": "1.10.8", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz", - "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==", - "dev": true, - "requires": { - "node-forge": "^0.10.0" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", - "dev": true, - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.7.2", - "mime": "1.6.0", - "ms": "2.1.1", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, - "serialize-javascript": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", - "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "serve-index": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", - "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", - "dev": true, - "requires": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true - } - } - }, - "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", - "dev": true, - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.1" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "set-value": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", - "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", - "dev": true - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", - "dev": true - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shell-quote": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", - "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==", - "dev": true - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, - "simple-swizzle": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", - "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", - "dev": true, - "requires": { - "is-arrayish": "^0.3.1" - }, - "dependencies": { - "is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", - "dev": true - } - } - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "sockjs": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.20.tgz", - "integrity": "sha512-SpmVOVpdq0DJc0qArhF3E5xsxvaiqGNb73XfgBpK1y3UD5gs8DSo8aCTsuT5pX8rssdc2NDIzANwP9eCAiSdTA==", - "dev": true, - "requires": { - "faye-websocket": "^0.10.0", - "uuid": "^3.4.0", - "websocket-driver": "0.6.5" - } - }, - "sockjs-client": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.4.0.tgz", - "integrity": "sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g==", - "dev": true, - "requires": { - "debug": "^3.2.5", - "eventsource": "^1.0.7", - "faye-websocket": "~0.11.1", - "inherits": "^2.0.3", - "json3": "^3.3.2", - "url-parse": "^1.5.2" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "faye-websocket": { - "version": "0.11.3", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.3.tgz", - "integrity": "sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA==", - "dev": true, - "requires": { - "websocket-driver": ">=0.5.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "sort-keys": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", - "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", - "dev": true, - "requires": { - "is-plain-obj": "^1.0.0" - } - }, - "source-list-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", - "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", - "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", - "dev": true, - "requires": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", - "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", - "dev": true - }, - "spdy": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", - "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", - "dev": true, - "requires": { - "debug": "^4.1.0", - "handle-thing": "^2.0.0", - "http-deceiver": "^1.2.7", - "select-hose": "^2.0.0", - "spdy-transport": "^3.0.0" - }, - "dependencies": { - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "spdy-transport": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", - "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", - "dev": true, - "requires": { - "debug": "^4.1.0", - "detect-node": "^2.0.4", - "hpack.js": "^2.1.6", - "obuf": "^1.1.2", - "readable-stream": "^3.0.6", - "wbuf": "^1.7.3" - }, - "dependencies": { - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "ssri": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.2.tgz", - "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1" - } - }, - "stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "dev": true - }, - "stackframe": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.2.0.tgz", - "integrity": "sha512-GrdeshiRmS1YLMYgzF16olf2jJ/IzxXY9lhKOskuVziubpTYcYqyOwYeJKzQkwy7uN0fYSsbsC4RQaXf9LCrYA==", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "dev": true - }, - "stream-browserify": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", - "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", - "dev": true, - "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "stream-each": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", - "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" - } - }, - "stream-http": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", - "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", - "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "stream-shift": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", - "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", - "dev": true - }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "string.prototype.trimend": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", - "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - } - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - }, - "stylehacks": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", - "integrity": "sha512-7GlLk9JwlElY4Y6a/rmbH2MhVlTyVmiJd1PfTCqFaIBEGMYNsrO/v3SeGTdhBThLg4Z+NbOk/qFMwCa+J+3p/g==", - "dev": true, - "requires": { - "browserslist": "^4.16.5", - "postcss": "^7.0.36", - "postcss-selector-parser": "^3.0.0" - }, - "dependencies": { - "postcss-selector-parser": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz", - "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==", - "dev": true, - "requires": { - "dot-prop": "^5.2.0", - "indexes-of": "^1.0.1", - "uniq": "^1.0.1" - } - } - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "svg-tags": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz", - "integrity": "sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=", - "dev": true - }, - "svgo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz", - "integrity": "sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "coa": "^2.0.2", - "css-select": "^2.0.0", - "css-select-base-adapter": "^0.1.1", - "css-tree": "1.0.0-alpha.37", - "csso": "^4.0.2", - "js-yaml": "^3.13.1", - "mkdirp": "~0.5.1", - "object.values": "^1.1.0", - "sax": "~1.2.4", - "stable": "^0.1.8", - "unquote": "~1.1.1", - "util.promisify": "~1.0.0" - } - }, - "tapable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", - "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", - "dev": true - }, - "terser": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", - "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", - "dev": true, - "requires": { - "commander": "^2.20.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.12" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "terser-webpack-plugin": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.5.tgz", - "integrity": "sha512-04Rfe496lN8EYruwi6oPQkG0vo8C+HT49X687FZnpPF0qMAIHONI6HEXYPKDOE8e5HjXTyKfqRd/agHtH0kOtw==", - "dev": true, - "requires": { - "cacache": "^12.0.2", - "find-cache-dir": "^2.1.0", - "is-wsl": "^1.1.0", - "schema-utils": "^1.0.0", - "serialize-javascript": "^4.0.0", - "source-map": "^0.6.1", - "terser": "^4.1.2", - "webpack-sources": "^1.4.0", - "worker-farm": "^1.7.0" - }, - "dependencies": { - "schema-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", - "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "thenify": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", - "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", - "dev": true, - "requires": { - "any-promise": "^1.0.0" - } - }, - "thenify-all": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", - "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=", - "dev": true, - "requires": { - "thenify": ">= 3.1.0 < 4" - } - }, - "thread-loader": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/thread-loader/-/thread-loader-2.1.3.tgz", - "integrity": "sha512-wNrVKH2Lcf8ZrWxDF/khdlLlsTMczdcwPA9VEK4c2exlEPynYWxi9op3nPTo5lAnDIkE0rQEB3VBP+4Zncc9Hg==", - "dev": true, - "requires": { - "loader-runner": "^2.3.1", - "loader-utils": "^1.1.0", - "neo-async": "^2.6.0" - } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "thunky": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", - "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", - "dev": true - }, - "timers-browserify": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", - "integrity": "sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ==", - "dev": true, - "requires": { - "setimmediate": "^1.0.4" - } - }, - "timsort": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", - "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", - "dev": true - }, - "to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "dev": true - }, - "toposort": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/toposort/-/toposort-1.0.7.tgz", - "integrity": "sha1-LmhELZ9k7HILjMieZEOsbKqVACk=", - "dev": true - }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, - "tryer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz", - "integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==", - "dev": true - }, - "ts-pnp": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", - "integrity": "sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==", - "dev": true - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", - "dev": true - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true - }, - "type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dev": true, - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "type-tagger": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/type-tagger/-/type-tagger-1.0.0.tgz", - "integrity": "sha512-FIPqqpmDgdaulCnRoKv1/d3U4xVBUrYn42QXWNP3XYmgfPUDuBUsgFOb9ntT0aIe0UsUP+lknpQ5d9Kn36RssA==" - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "uglify-js": { - "version": "3.4.10", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.10.tgz", - "integrity": "sha512-Y2VsbPVs0FIshJztycsO2SfPk7/KAF/T72qzv9u5EpQ4kB2hQoHlhNQTsNyy6ul7lQtqJN/AoWeS23OzEiEFxw==", - "dev": true, - "requires": { - "commander": "~2.19.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", - "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "unicode-canonical-property-names-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", - "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", - "dev": true - }, - "unicode-match-property-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", - "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", - "dev": true, - "requires": { - "unicode-canonical-property-names-ecmascript": "^1.0.4", - "unicode-property-aliases-ecmascript": "^1.0.4" - } - }, - "unicode-match-property-value-ecmascript": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", - "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", - "dev": true - }, - "unicode-property-aliases-ecmascript": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", - "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", - "dev": true - }, - "union-value": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", - "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - } - }, - "uniq": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", - "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", - "dev": true - }, - "uniqs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", - "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", - "dev": true - }, - "unique-filename": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", - "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", - "dev": true, - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", - "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - }, - "unorm": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", - "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==" - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "dev": true - }, - "unquote": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", - "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=", - "dev": true - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - } - } - }, - "upath": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", - "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", - "dev": true - }, - "upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", - "dev": true - }, - "uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } - } - }, - "url-loader": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-2.3.0.tgz", - "integrity": "sha512-goSdg8VY+7nPZKUEChZSEtW5gjbS66USIGCeSJ1OVOJ7Yfuh/36YxCwMi5HVEJh6mqUYOoy3NJ0vlOMrWsSHog==", - "dev": true, - "requires": { - "loader-utils": "^1.2.3", - "mime": "^2.4.4", - "schema-utils": "^2.5.0" - } - }, - "url-parse": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.2.tgz", - "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", - "dev": true, - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "use": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true - }, - "util": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", - "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", - "dev": true, - "requires": { - "inherits": "2.0.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - } - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "util.promisify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", - "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.2", - "has-symbols": "^1.0.1", - "object.getownpropertydescriptors": "^2.1.0" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "utila": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", - "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=", - "dev": true - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "dev": true - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", - "dev": true - }, - "vendors": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.4.tgz", - "integrity": "sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w==", - "dev": true - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", - "dev": true - }, - "vue": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz", - "integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==" - }, - "vue-hot-reload-api": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", - "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", - "dev": true - }, - "vue-loader": { - "version": "15.9.3", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.3.tgz", - "integrity": "sha512-Y67VnGGgVLH5Voostx8JBZgPQTlDQeOVBLOEsjc2cXbCYBKexSKEpOA56x0YZofoDOTszrLnIShyOX1p9uCEHA==", - "dev": true, - "requires": { - "@vue/component-compiler-utils": "^3.1.0", - "hash-sum": "^1.0.2", - "loader-utils": "^1.1.0", - "vue-hot-reload-api": "^2.3.0", - "vue-style-loader": "^4.1.0" - }, - "dependencies": { - "hash-sum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", - "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", - "dev": true - } - } - }, - "vue-loader-v16": { - "version": "npm:vue-loader@16.2.0", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz", - "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.0", - "hash-sum": "^2.0.0", - "loader-utils": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "optional": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "vue-router": { - "version": "3.4.6", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.6.tgz", - "integrity": "sha512-kaXnB3pfFxhAJl/Mp+XG1HJMyFqrL/xPqV7oXlpXn4AwMmm6VNgf0nllW8ksflmZANfI4kdo0bVn/FYSsAolPQ==" - }, - "vue-style-loader": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz", - "integrity": "sha512-0ip8ge6Gzz/Bk0iHovU9XAUQaFt/G2B61bnWa2tCcqqdgfHs1lF9xXorFbE55Gmy92okFT+8bfmySuUOu13vxQ==", - "dev": true, - "requires": { - "hash-sum": "^1.0.2", - "loader-utils": "^1.0.2" - }, - "dependencies": { - "hash-sum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", - "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", - "dev": true - } - } - }, - "vue-template-compiler": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.12.tgz", - "integrity": "sha512-OzzZ52zS41YUbkCBfdXShQTe69j1gQDZ9HIX8miuC9C3rBCk9wIRjLiZZLrmX9V+Ftq/YEyv1JaVr5Y/hNtByg==", - "dev": true, - "requires": { - "de-indent": "^1.0.2", - "he": "^1.1.0" - } - }, - "vue-template-es2015-compiler": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz", - "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", - "dev": true - }, - "vuex": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.5.1.tgz", - "integrity": "sha512-w7oJzmHQs0FM9LXodfskhw9wgKBiaB+totOdb8sNzbTB2KDCEEwEs29NzBZFh/lmEK1t5tDmM1vtsO7ubG1DFw==" - }, - "watchpack": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.4.tgz", - "integrity": "sha512-aWAgTW4MoSJzZPAicljkO1hsi1oKj/RRq/OJQh2PKI2UKL04c2Bs+MBOB+BBABHTXJpf9mCwHN7ANCvYsvY2sg==", - "dev": true, - "requires": { - "chokidar": "^3.4.1", - "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0", - "watchpack-chokidar2": "^2.0.0" - } - }, - "watchpack-chokidar2": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.0.tgz", - "integrity": "sha512-9TyfOyN/zLUbA288wZ8IsMZ+6cbzvsNyEzSBp6e/zkifi6xxbl8SmQ/CxQq32k8NNqrdVEVUVSEf56L4rQ/ZxA==", - "dev": true, - "optional": true, - "requires": { - "chokidar": "^2.1.8" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "optional": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "optional": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true, - "optional": true - }, - "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "dev": true, - "optional": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^5.1.2", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - } - }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "optional": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "optional": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "optional": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", - "dev": true, - "requires": { - "minimalistic-assert": "^1.0.0" - } - }, - "wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "dev": true, - "requires": { - "defaults": "^1.0.3" - } - }, - "webpack": { - "version": "4.44.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.44.2.tgz", - "integrity": "sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-module-context": "1.9.0", - "@webassemblyjs/wasm-edit": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0", - "acorn": "^6.4.1", - "ajv": "^6.10.2", - "ajv-keywords": "^3.4.1", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^4.3.0", - "eslint-scope": "^4.0.3", - "json-parse-better-errors": "^1.0.2", - "loader-runner": "^2.4.0", - "loader-utils": "^1.2.3", - "memory-fs": "^0.4.1", - "micromatch": "^3.1.10", - "mkdirp": "^0.5.3", - "neo-async": "^2.6.1", - "node-libs-browser": "^2.2.1", - "schema-utils": "^1.0.0", - "tapable": "^1.1.3", - "terser-webpack-plugin": "^1.4.3", - "watchpack": "^1.7.4", - "webpack-sources": "^1.4.1" - }, - "dependencies": { - "schema-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", - "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "webpack-bundle-analyzer": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.9.0.tgz", - "integrity": "sha512-Ob8amZfCm3rMB1ScjQVlbYYUEJyEjdEtQ92jqiFUYt5VkEeO2v5UMbv49P/gnmCZm3A6yaFQzCBvpZqN4MUsdA==", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1", - "bfj": "^6.1.1", - "chalk": "^2.4.1", - "commander": "^2.18.0", - "ejs": "^2.6.1", - "express": "^4.16.3", - "filesize": "^3.6.1", - "gzip-size": "^5.0.0", - "lodash": "^4.17.21", - "mkdirp": "^0.5.1", - "opener": "^1.5.1", - "ws": "^6.2.2" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - } - } - }, - "webpack-chain": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/webpack-chain/-/webpack-chain-6.5.1.tgz", - "integrity": "sha512-7doO/SRtLu8q5WM0s7vPKPWX580qhi0/yBHkOxNkv50f6qB76Zy9o2wRTrrPULqYTvQlVHuvbA8v+G5ayuUDsA==", - "dev": true, - "requires": { - "deepmerge": "^1.5.2", - "javascript-stringify": "^2.0.1" - } - }, - "webpack-dev-middleware": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz", - "integrity": "sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw==", - "dev": true, - "requires": { - "memory-fs": "^0.4.1", - "mime": "^2.4.4", - "mkdirp": "^0.5.1", - "range-parser": "^1.2.1", - "webpack-log": "^2.0.0" - } - }, - "webpack-dev-server": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz", - "integrity": "sha512-PUxZ+oSTxogFQgkTtFndEtJIPNmml7ExwufBZ9L2/Xyyd5PnOL5UreWe5ZT7IU25DSdykL9p1MLQzmLh2ljSeg==", - "dev": true, - "requires": { - "ansi-html": "0.0.8", - "bonjour": "^3.5.0", - "chokidar": "^2.1.8", - "compression": "^1.7.4", - "connect-history-api-fallback": "^1.6.0", - "debug": "^4.1.1", - "del": "^4.1.1", - "express": "^4.17.1", - "html-entities": "^1.3.1", - "http-proxy-middleware": "0.19.1", - "import-local": "^2.0.0", - "internal-ip": "^4.3.0", - "ip": "^1.1.5", - "is-absolute-url": "^3.0.3", - "killable": "^1.0.1", - "loglevel": "^1.6.8", - "opn": "^5.5.0", - "p-retry": "^3.0.1", - "portfinder": "^1.0.26", - "schema-utils": "^1.0.0", - "selfsigned": "^1.10.7", - "semver": "^6.3.0", - "serve-index": "^1.9.1", - "sockjs": "0.3.20", - "sockjs-client": "1.4.0", - "spdy": "^4.0.2", - "strip-ansi": "^3.0.1", - "supports-color": "^6.1.0", - "url": "^0.11.0", - "webpack-dev-middleware": "^3.7.2", - "webpack-log": "^2.0.0", - "ws": "^6.2.2", - "yargs": "^13.3.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^5.1.2", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "is-absolute-url": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-3.0.3.tgz", - "integrity": "sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q==", - "dev": true - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "schema-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", - "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.1", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "webpack-log": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz", - "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==", - "dev": true, - "requires": { - "ansi-colors": "^3.0.0", - "uuid": "^3.3.2" - } - }, - "webpack-merge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz", - "integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==", - "dev": true, - "requires": { - "lodash": "^4.17.21" - } - }, - "webpack-sources": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", - "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", - "dev": true, - "requires": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "websocket-driver": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.6.5.tgz", - "integrity": "sha1-XLJVbOuF9Dc8bYI4qmkchFThOjY=", - "dev": true, - "requires": { - "websocket-extensions": ">=0.1.1" - } - }, - "websocket-extensions": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", - "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", - "dev": true - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "worker-farm": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", - "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==", - "dev": true, - "requires": { - "errno": "~0.1.7" - } - }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "ws": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", - "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true - }, - "y18n": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, - "yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.1", - "yargs-parser": "^18.1.2" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - } - } - }, - "yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - } - } - } - } -} diff --git a/vue/package.json b/vue/package.json deleted file mode 100644 index 1a752aee..00000000 --- a/vue/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "frontend", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "npm install && vue-cli-service serve", - "serve": "vue-cli-service serve", - "build": "vue-cli-service build" - }, - "dependencies": { - "@tendermint/vue": "0.1.8", - "core-js": "^3.6.5", - "vue": "^2.6.11", - "vue-router": "^3.2.0", - "vuex": "^3.4.0" - }, - "devDependencies": { - "@vue/cli-plugin-babel": "^4.4.0", - "@vue/cli-plugin-router": "^4.4.0", - "@vue/cli-plugin-vuex": "^4.4.6", - "@vue/cli-service": "^4.4.0", - "vue-template-compiler": "^2.6.11" - } -} diff --git a/vue/public/favicon.ico b/vue/public/favicon.ico deleted file mode 100644 index df36fcfb72584e00488330b560ebcf34a41c64c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S diff --git a/vue/public/index.html b/vue/public/index.html deleted file mode 100644 index 41235286..00000000 --- a/vue/public/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - <%= htmlWebpackPlugin.options.title %> - - - -
- - - diff --git a/vue/src/App.vue b/vue/src/App.vue deleted file mode 100644 index ecb03ad4..00000000 --- a/vue/src/App.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/vue/src/main.js b/vue/src/main.js deleted file mode 100644 index 6c9e622b..00000000 --- a/vue/src/main.js +++ /dev/null @@ -1,12 +0,0 @@ -import Vue from "vue"; -import App from "./App.vue"; -import router from "./router"; -import store from "./store"; - -Vue.config.productionTip = false; - -new Vue({ - router, - store, - render: (h) => h(App), -}).$mount("#app"); diff --git a/vue/src/router/index.js b/vue/src/router/index.js deleted file mode 100644 index 960715b7..00000000 --- a/vue/src/router/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import Vue from "vue"; -import VueRouter from "vue-router"; -import Index from "../views/Index.vue"; - -Vue.use(VueRouter); - -const routes = [ - { - path: "/", - component: Index, - }, -]; - -const router = new VueRouter({ - mode: "history", - base: process.env.BASE_URL, - routes, -}); - -export default router; diff --git a/vue/src/store/index.js b/vue/src/store/index.js deleted file mode 100644 index 475276f3..00000000 --- a/vue/src/store/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import Vue from "vue"; -import Vuex from "vuex"; -import cosmos from "@tendermint/vue/src/store/cosmos.js"; - -Vue.use(Vuex); - -export default new Vuex.Store({ - modules: { cosmos }, -}); diff --git a/vue/src/views/Index.vue b/vue/src/views/Index.vue deleted file mode 100644 index f4ded058..00000000 --- a/vue/src/views/Index.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/vue/vue.config.js b/vue/vue.config.js deleted file mode 100644 index dfb35997..00000000 --- a/vue/vue.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - devServer: { - disableHostCheck: true, - }, -}; diff --git a/x/evm/client/cli/feemarket_query.go b/x/evm/client/cli/feemarket_query.go new file mode 100644 index 00000000..62f532cd --- /dev/null +++ b/x/evm/client/cli/feemarket_query.go @@ -0,0 +1,145 @@ +package cli + +import ( + "context" + "fmt" + "strconv" + + "github.com/spf13/cobra" + "github.com/stratosnet/stratos-chain/x/evm/types" + "google.golang.org/grpc/metadata" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + //"github.com/stratosnet/stratos-chain/x/feemarket/types" +) + +//// GetQueryCmd returns the parent command for all x/feemarket CLI query commands. +//func GetQueryCmd() *cobra.Command { +// cmd := &cobra.Command{ +// Use: types.ModuleName, +// Short: "Querying commands for the fee market module", +// DisableFlagParsing: true, +// SuggestionsMinimumDistance: 2, +// RunE: client.ValidateCmd, +// } +// +// cmd.AddCommand( +// GetBlockGasCmd(), +// GetBaseFeeCmd(), +// GetParamsCmd(), +// ) +// return cmd +//} + +// GetBlockGasCmd queries the gas used in a block +func GetBlockGasCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "block-gas [height]", + Short: "Get the block gas used at a given block height", + Long: `Get the block gas used at a given block height. +If the height is not provided, it will use the latest height from context`, + Args: cobra.RangeArgs(0, 1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + ctx := cmd.Context() + if len(args) == 1 { + ctx, err = getContextHeight(ctx, args[0]) + if err != nil { + return err + } + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.BlockGas(ctx, &types.QueryBlockGasRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetParamsCmd queries the fee market params +func GetParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Get the fee market params", + Long: "Get the fee market parameter values.", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetBaseFeeCmd queries the base fee at a given height +func GetBaseFeeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "base-fee [height]", + Short: "Get the base fee amount at a given block height", + Long: `Get the base fee amount at a given block height. +If the height is not provided, it will use the latest height from context.`, + Args: cobra.RangeArgs(0, 1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + ctx := cmd.Context() + if len(args) == 1 { + ctx, err = getContextHeight(ctx, args[0]) + if err != nil { + return err + } + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryBaseFee(ctx, &types.QueryBaseFeeRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func getContextHeight(ctx context.Context, height string) (context.Context, error) { + _, err := strconv.ParseInt(height, 10, 64) + if err != nil { + return ctx, fmt.Errorf("invalid height: %w", err) + } + + return metadata.AppendToOutgoingContext(ctx, grpctypes.GRPCBlockHeightHeader, height), nil +} diff --git a/x/evm/client/cli/query.go b/x/evm/client/cli/query.go new file mode 100644 index 00000000..e15f61d7 --- /dev/null +++ b/x/evm/client/cli/query.go @@ -0,0 +1,108 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + + rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// GetQueryCmd returns the parent command for all x/bank CLi query commands. +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the evm module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + GetStorageCmd(), + GetCodeCmd(), + GetBlockGasCmd(), + GetBaseFeeCmd(), + GetParamsCmd(), + ) + return cmd +} + +// GetStorageCmd queries a key in an accounts storage +func GetStorageCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "storage [address] [key]", + Short: "Gets storage for an account with a given key and height", + Long: "Gets storage for an account with a given key and height. If the height is not provided, it will use the latest height from context.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + address, err := accountToHex(args[0]) + if err != nil { + return err + } + + key := formatKeyToHash(args[1]) + + req := &types.QueryStorageRequest{ + Address: address, + Key: key, + } + + res, err := queryClient.Storage(rpctypes.ContextWithHeight(clientCtx.Height), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCodeCmd queries the code field of a given address +func GetCodeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "code [address]", + Short: "Gets code from an account", + Long: "Gets code from an account. If the height is not provided, it will use the latest height from context.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + address, err := accountToHex(args[0]) + if err != nil { + return err + } + + req := &types.QueryCodeRequest{ + Address: address, + } + + res, err := queryClient.Code(rpctypes.ContextWithHeight(clientCtx.Height), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/evm/client/cli/tx.go b/x/evm/client/cli/tx.go new file mode 100644 index 00000000..50cca48e --- /dev/null +++ b/x/evm/client/cli/tx.go @@ -0,0 +1,111 @@ +package cli + +import ( + "bufio" + "fmt" + "os" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/input" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/pkg/errors" + "github.com/spf13/cobra" + + rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// 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(NewRawTxCmd()) + return cmd +} + +// NewRawTxCmd command build cosmos transaction from raw ethereum transaction +func NewRawTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "raw [tx-hex]", + Short: "Build cosmos transaction from raw ethereum transaction", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + data, err := hexutil.Decode(args[0]) + if err != nil { + return errors.Wrap(err, "failed to decode ethereum tx hex bytes") + } + + msg := &types.MsgEthereumTx{} + if err := msg.UnmarshalBinary(data); err != nil { + return err + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + rsp, err := rpctypes.NewQueryClient(clientCtx).Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + tx, err := msg.BuildTx(clientCtx.TxConfig.NewTxBuilder(), rsp.Params.EvmDenom) + if err != nil { + return err + } + + if clientCtx.GenerateOnly { + json, err := clientCtx.TxConfig.TxJSONEncoder()(tx) + if err != nil { + return err + } + + return clientCtx.PrintString(fmt.Sprintf("%s\n", json)) + } + + if !clientCtx.SkipConfirm { + out, err := clientCtx.TxConfig.TxJSONEncoder()(tx) + if err != nil { + return err + } + + _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", out) + + buf := bufio.NewReader(os.Stdin) + ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf, os.Stderr) + + if err != nil || !ok { + _, _ = fmt.Fprintf(os.Stderr, "%s\n", "canceled transaction") + return err + } + } + + txBytes, err := clientCtx.TxConfig.TxEncoder()(tx) + if err != nil { + return err + } + + // broadcast to a Tendermint node + res, err := clientCtx.BroadcastTx(txBytes) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/evm/client/cli/utils.go b/x/evm/client/cli/utils.go new file mode 100644 index 00000000..7277cdae --- /dev/null +++ b/x/evm/client/cli/utils.go @@ -0,0 +1,47 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/pkg/errors" + + "github.com/ethereum/go-ethereum/common" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func accountToHex(addr string) (string, error) { + if strings.HasPrefix(addr, sdk.GetConfig().GetBech32AccountAddrPrefix()) { + // Check to see if address is Cosmos bech32 formatted + toAddr, err := sdk.AccAddressFromBech32(addr) + if err != nil { + return "", errors.Wrap(err, "must provide a valid Bech32 address") + } + ethAddr := common.BytesToAddress(toAddr.Bytes()) + return ethAddr.Hex(), nil + } + + if !strings.HasPrefix(addr, "0x") { + addr = "0x" + addr + } + + valid := common.IsHexAddress(addr) + if !valid { + return "", fmt.Errorf("%s is not a valid Ethereum or Cosmos address", addr) + } + + ethAddr := common.HexToAddress(addr) + + return ethAddr.Hex(), nil +} + +func formatKeyToHash(key string) string { + if !strings.HasPrefix(key, "0x") { + key = "0x" + key + } + + ethkey := common.HexToHash(key) + + return ethkey.Hex() +} diff --git a/x/evm/client/rest/rest.go b/x/evm/client/rest/rest.go new file mode 100644 index 00000000..c11457ef --- /dev/null +++ b/x/evm/client/rest/rest.go @@ -0,0 +1,117 @@ +package rest + +import ( + "context" + "encoding/hex" + "encoding/json" + "errors" + "math/big" + "net/http" + "strings" + + "github.com/gorilla/mux" + "github.com/stratosnet/stratos-chain/x/evm/types" + + "github.com/cosmos/cosmos-sdk/client" + clientrest "github.com/cosmos/cosmos-sdk/client/rest" + "github.com/cosmos/cosmos-sdk/types/rest" + authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" + + "github.com/ethereum/go-ethereum/common" + + rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" +) + +// RegisterTxRoutes - Central function to define routes that get registered by the main application +func RegisterTxRoutes(clientCtx client.Context, rtr *mux.Router) { + r := clientrest.WithHTTPDeprecationHeaders(rtr) + r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(clientCtx)).Methods("GET") + r.HandleFunc("/txs", authrest.QueryTxsRequestHandlerFn(clientCtx)).Methods("GET") + r.HandleFunc("/txs/decode", authrest.DecodeTxRequestHandlerFn(clientCtx)).Methods("POST") +} + +// QueryTxRequestHandlerFn implements a REST handler that queries a transaction +// by hash in a committed block. +func QueryTxRequestHandlerFn(clientCtx client.Context) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + hashHexStr := vars["hash"] + + clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) + if !ok { + return + } + + ethHashPrefix := "0x" + if !strings.HasPrefix(hashHexStr, ethHashPrefix) { + authrest.QueryTxRequestHandlerFn(clientCtx) + return + } + + // eth Tx + ethHashPrefixLength := len(ethHashPrefix) + output, err := getEthTransactionByHash(clientCtx, hashHexStr[ethHashPrefixLength:]) + if err != nil { + rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) + return + } + + rest.PostProcessResponseBare(w, clientCtx, output) + } +} + +// GetTransactionByHash returns the transaction identified by hash. +func getEthTransactionByHash(clientCtx client.Context, hashHex string) ([]byte, error) { + hash, err := hex.DecodeString(hashHex) + if err != nil { + return nil, err + } + node, err := clientCtx.GetNode() + if err != nil { + return nil, err + } + + tx, err := node.Tx(context.Background(), hash, false) + if err != nil { + return nil, err + } + + // Can either cache or just leave this out if not necessary + block, err := node.Block(context.Background(), &tx.Height) + if err != nil { + return nil, err + } + + client := types.NewQueryClient(clientCtx) + res, err := client.QueryBaseFee(context.Background(), &types.QueryBaseFeeRequest{}) + if err != nil { + return nil, err + } + + var baseFee *big.Int + if res.BaseFee != nil { + baseFee = res.BaseFee.BigInt() + } + + blockHash := common.BytesToHash(block.Block.Header.Hash()) + + ethTxs, err := rpctypes.RawTxToEthTx(clientCtx, tx.Tx) + if err != nil { + return nil, err + } + + height := uint64(tx.Height) + + for _, ethTx := range ethTxs { + if common.HexToHash(ethTx.Hash) == common.BytesToHash(hash) { + rpcTx, err := rpctypes.NewRPCTransaction(ethTx.AsTransaction(), blockHash, height, uint64(tx.Index), baseFee) + if err != nil { + return nil, err + } + return json.Marshal(rpcTx) + } + } + + return nil, errors.New("eth tx not found") +} diff --git a/x/evm/genesis.go b/x/evm/genesis.go new file mode 100644 index 00000000..e6a8bbcd --- /dev/null +++ b/x/evm/genesis.go @@ -0,0 +1,99 @@ +package evm + +import ( + "bytes" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + + abci "github.com/tendermint/tendermint/abci/types" + + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/evm/keeper" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// InitGenesis initializes genesis state based on exported genesis +func InitGenesis( + ctx sdk.Context, + k *keeper.Keeper, + accountKeeper types.AccountKeeper, + data types.GenesisState, +) []abci.ValidatorUpdate { + k.SetBlockGasUsed(ctx, data.BlockGas) + k.WithChainID(ctx) + + k.SetParams(ctx, data.Params) + + // ensure evm module account is set + if addr := accountKeeper.GetModuleAddress(types.ModuleName); addr == nil { + panic("the EVM module account has not been set") + } + + for _, account := range data.Accounts { + address := common.HexToAddress(account.Address) + accAddress := sdk.AccAddress(address.Bytes()) + // check that the EVM balance the matches the account balance + acc := accountKeeper.GetAccount(ctx, accAddress) + if acc == nil { + panic(fmt.Errorf("account not found for address %s", account.Address)) + } + + ethAcct, ok := acc.(stratos.EthAccountI) + if !ok { + panic( + fmt.Errorf("account %s must be an EthAccount interface, got %T", + account.Address, acc, + ), + ) + } + + code := common.Hex2Bytes(account.Code) + codeHash := crypto.Keccak256Hash(code) + if !bytes.Equal(ethAcct.GetCodeHash().Bytes(), codeHash.Bytes()) { + panic("code don't match codeHash") + } + + k.SetCode(ctx, codeHash.Bytes(), code) + + for _, storage := range account.Storage { + k.SetState(ctx, address, common.HexToHash(storage.Key), common.HexToHash(storage.Value).Bytes()) + } + } + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis exports genesis state of the EVM module +func ExportGenesis(ctx sdk.Context, k *keeper.Keeper, ak types.AccountKeeper) *types.GenesisState { + var ethGenAccounts []types.GenesisAccount + ak.IterateAccounts(ctx, func(account authtypes.AccountI) bool { + ethAccount, ok := account.(stratos.EthAccountI) + if !ok { + // ignore non EthAccounts + return false + } + + addr := ethAccount.EthAddress() + + storage := k.GetAccountStorage(ctx, addr) + + genAccount := types.GenesisAccount{ + Address: addr.String(), + Code: common.Bytes2Hex(k.GetCode(ctx, ethAccount.GetCodeHash())), + Storage: storage, + } + + ethGenAccounts = append(ethGenAccounts, genAccount) + return false + }) + + return &types.GenesisState{ + Accounts: ethGenAccounts, + Params: k.GetParams(ctx), + BlockGas: k.GetBlockGasUsed(ctx), + } +} diff --git a/x/evm/handler.go b/x/evm/handler.go new file mode 100644 index 00000000..aed99744 --- /dev/null +++ b/x/evm/handler.go @@ -0,0 +1,26 @@ +package evm + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// NewHandler returns a handler for stratos type messages. +func NewHandler(server types.MsgServer) sdk.Handler { + return func(ctx sdk.Context, msg sdk.Msg) (result *sdk.Result, err error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + + switch msg := msg.(type) { + case *types.MsgEthereumTx: + // execute state transition + res, err := server.EthereumTx(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + default: + err := sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, err + } + } +} diff --git a/x/evm/keeper/abci.go b/x/evm/keeper/abci.go new file mode 100644 index 00000000..63a5d12a --- /dev/null +++ b/x/evm/keeper/abci.go @@ -0,0 +1,62 @@ +package keeper + +import ( + "fmt" + + "github.com/stratosnet/stratos-chain/x/evm/types" + abci "github.com/tendermint/tendermint/abci/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// BeginBlock sets the sdk Context and EIP155 chain id to the Keeper. +func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { + k.WithChainID(ctx) + + baseFee := k.CalculateBaseFee(ctx) + + // return immediately if base fee is nil + if baseFee == nil { + return + } + + k.SetBaseFee(ctx, baseFee) + + // Store current base fee in event + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeFeeMarket, + sdk.NewAttribute(types.AttributeKeyBaseFee, baseFee.String()), + ), + }) +} + +// EndBlock also retrieves the bloom filter value from the transient store and commits it to the +// KVStore. The EVM end block logic doesn't update the validator set, thus it returns +// an empty slice. +func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { + if ctx.BlockGasMeter() == nil { + k.Logger(ctx).Error("block gas meter is nil when setting block gas used") + panic("block gas meter is nil when setting block gas used") + } + + gasUsed := ctx.BlockGasMeter().GasConsumedToLimit() + + k.SetBlockGasUsed(ctx, gasUsed) + + ctx.EventManager().EmitEvent(sdk.NewEvent( + "block_gas", + sdk.NewAttribute("height", fmt.Sprintf("%d", ctx.BlockHeight())), + sdk.NewAttribute("amount", fmt.Sprintf("%d", ctx.BlockGasMeter().GasConsumedToLimit())), + )) + + // Gas costs are handled within msg handler so costs should be ignored + infCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + + bloom := ethtypes.BytesToBloom(k.GetBlockBloomTransient(infCtx).Bytes()) + k.EmitBlockBloomEvent(infCtx, bloom) + + return []abci.ValidatorUpdate{} +} diff --git a/x/evm/keeper/eip1559.go b/x/evm/keeper/eip1559.go new file mode 100644 index 00000000..f5d985fd --- /dev/null +++ b/x/evm/keeper/eip1559.go @@ -0,0 +1,80 @@ +package keeper + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/math" +) + +// CalculateBaseFee calculates the base fee for the current block. This is only calculated once per +// block during BeginBlock. If the NoBaseFee parameter is enabled or below activation height, this function returns nil. +// NOTE: This code is inspired from the go-ethereum EIP1559 implementation and adapted to Cosmos SDK-based +// chains. For the canonical code refer to: https://github.com/ethereum/go-ethereum/blob/master/consensus/misc/eip1559.go +func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int { + params := k.GetParams(ctx) + + // Ignore the calculation if not enable + if !params.FeeMarketParams.IsBaseFeeEnabled(ctx.BlockHeight()) { + return nil + } + + consParams := ctx.ConsensusParams() + + // If the current block is the first EIP-1559 block, return the InitialBaseFee. + if ctx.BlockHeight() == params.FeeMarketParams.EnableHeight { + return params.FeeMarketParams.BaseFee.BigInt() + } + + // get the block gas used and the base fee values for the parent block. + parentBaseFee := params.FeeMarketParams.BaseFee.BigInt() + if parentBaseFee == nil { + return nil + } + + parentGasUsed := k.GetBlockGasUsed(ctx) + + gasLimit := new(big.Int).SetUint64(math.MaxUint64) + if consParams != nil && consParams.Block.MaxGas > -1 { + gasLimit = big.NewInt(consParams.Block.MaxGas) + } + + parentGasTargetBig := new(big.Int).Div(gasLimit, new(big.Int).SetUint64(uint64(params.FeeMarketParams.ElasticityMultiplier))) + if !parentGasTargetBig.IsUint64() { + return nil + } + + parentGasTarget := parentGasTargetBig.Uint64() + baseFeeChangeDenominator := new(big.Int).SetUint64(uint64(params.FeeMarketParams.BaseFeeChangeDenominator)) + + // If the parent gasUsed is the same as the target, the baseFee remains unchanged. + if parentGasUsed == parentGasTarget { + return new(big.Int).Set(parentBaseFee) + } + + if parentGasUsed > parentGasTarget { + // If the parent block used more gas than its target, the baseFee should increase. + gasUsedDelta := new(big.Int).SetUint64(parentGasUsed - parentGasTarget) + x := new(big.Int).Mul(parentBaseFee, gasUsedDelta) + y := x.Div(x, parentGasTargetBig) + baseFeeDelta := math.BigMax( + x.Div(y, baseFeeChangeDenominator), + common.Big1, + ) + + return x.Add(parentBaseFee, baseFeeDelta) + } + + // Otherwise if the parent block used less gas than its target, the baseFee should decrease. + gasUsedDelta := new(big.Int).SetUint64(parentGasTarget - parentGasUsed) + x := new(big.Int).Mul(parentBaseFee, gasUsedDelta) + y := x.Div(x, parentGasTargetBig) + baseFeeDelta := x.Div(y, baseFeeChangeDenominator) + + return math.BigMax( + x.Sub(parentBaseFee, baseFeeDelta), + common.Big0, + ) +} diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go new file mode 100644 index 00000000..336b8c6c --- /dev/null +++ b/x/evm/keeper/grpc_query.go @@ -0,0 +1,594 @@ +package keeper + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "math/big" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/eth/tracers" + "github.com/ethereum/go-ethereum/eth/tracers/logger" + ethparams "github.com/ethereum/go-ethereum/params" + + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/evm/statedb" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +var _ types.QueryServer = Keeper{} + +const ( + defaultTraceTimeout = 5 * time.Second +) + +// Account implements the Query/Account gRPC method +func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*types.QueryAccountResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := stratos.ValidateAddress(req.Address); err != nil { + return nil, status.Error( + codes.InvalidArgument, err.Error(), + ) + } + + addr := common.HexToAddress(req.Address) + + ctx := sdk.UnwrapSDKContext(c) + acct := k.GetAccountOrEmpty(ctx, addr) + + return &types.QueryAccountResponse{ + Balance: acct.Balance.String(), + CodeHash: common.BytesToHash(acct.CodeHash).Hex(), + Nonce: acct.Nonce, + }, nil +} + +func (k Keeper) CosmosAccount(c context.Context, req *types.QueryCosmosAccountRequest) (*types.QueryCosmosAccountResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := stratos.ValidateAddress(req.Address); err != nil { + return nil, status.Error( + codes.InvalidArgument, err.Error(), + ) + } + + ctx := sdk.UnwrapSDKContext(c) + + ethAddr := common.HexToAddress(req.Address) + cosmosAddr := sdk.AccAddress(ethAddr.Bytes()) + + account := k.accountKeeper.GetAccount(ctx, cosmosAddr) + res := types.QueryCosmosAccountResponse{ + CosmosAddress: cosmosAddr.String(), + } + + if account != nil { + res.Sequence = account.GetSequence() + res.AccountNumber = account.GetAccountNumber() + } + + return &res, nil +} + +func (k Keeper) ValidatorAccount(c context.Context, req *types.QueryValidatorAccountRequest) (*types.QueryValidatorAccountResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + consAddr, err := sdk.ConsAddressFromBech32(req.ConsAddress) + if err != nil { + return nil, status.Error( + codes.InvalidArgument, err.Error(), + ) + } + + ctx := sdk.UnwrapSDKContext(c) + + validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr) + if !found { + return nil, nil + } + + accAddr := sdk.AccAddress(validator.GetOperator()) + + res := types.QueryValidatorAccountResponse{ + AccountAddress: accAddr.String(), + } + + account := k.accountKeeper.GetAccount(ctx, accAddr) + if account != nil { + res.Sequence = account.GetSequence() + res.AccountNumber = account.GetAccountNumber() + } + + return &res, nil +} + +// Balance implements the Query/Balance gRPC method +func (k Keeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := stratos.ValidateAddress(req.Address); err != nil { + return nil, status.Error( + codes.InvalidArgument, + types.ErrZeroAddress.Error(), + ) + } + + ctx := sdk.UnwrapSDKContext(c) + + balanceInt := k.GetBalance(ctx, common.HexToAddress(req.Address)) + + return &types.QueryBalanceResponse{ + Balance: balanceInt.String(), + }, nil +} + +// Storage implements the Query/Storage gRPC method +func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*types.QueryStorageResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := stratos.ValidateAddress(req.Address); err != nil { + return nil, status.Error( + codes.InvalidArgument, + types.ErrZeroAddress.Error(), + ) + } + + ctx := sdk.UnwrapSDKContext(c) + + address := common.HexToAddress(req.Address) + key := common.HexToHash(req.Key) + + state := k.GetState(ctx, address, key) + stateHex := state.Hex() + + return &types.QueryStorageResponse{ + Value: stateHex, + }, nil +} + +// Code implements the Query/Code gRPC method +func (k Keeper) Code(c context.Context, req *types.QueryCodeRequest) (*types.QueryCodeResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := stratos.ValidateAddress(req.Address); err != nil { + return nil, status.Error( + codes.InvalidArgument, + types.ErrZeroAddress.Error(), + ) + } + + ctx := sdk.UnwrapSDKContext(c) + + address := common.HexToAddress(req.Address) + acct := k.GetAccountWithoutBalance(ctx, address) + + var code []byte + if acct != nil && acct.IsContract() { + code = k.GetCode(ctx, common.BytesToHash(acct.CodeHash)) + } + + return &types.QueryCodeResponse{ + Code: code, + }, nil +} + +// Params implements the Query/Params gRPC method +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{ + Params: params, + }, nil +} + +// EthCall implements eth_call rpc api. +func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.MsgEthereumTxResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + + var args types.TransactionArgs + err := json.Unmarshal(req.Args, &args) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + cfg, err := k.EVMConfig(ctx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + // ApplyMessageWithConfig expect correct nonce set in msg + nonce := k.GetNonce(ctx, args.GetFrom()) + args.Nonce = (*hexutil.Uint64)(&nonce) + + msg, err := args.ToMessage(req.GasCap, cfg.BaseFee) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash())) + + // pass false to not commit StateDB + res, err := k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return res, nil +} + +// EstimateGas implements eth_estimateGas rpc api. +func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*types.EstimateGasResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + + if req.GasCap < ethparams.TxGas { + return nil, status.Error(codes.InvalidArgument, "gas cap cannot be lower than 21,000") + } + + var args types.TransactionArgs + err := json.Unmarshal(req.Args, &args) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + // Binary search the gas requirement, as it may be higher than the amount used + var ( + lo = ethparams.TxGas - 1 + hi uint64 + cap uint64 + ) + + // Determine the highest gas limit can be used during the estimation. + if args.Gas != nil && uint64(*args.Gas) >= ethparams.TxGas { + hi = uint64(*args.Gas) + } else { + // Query block gas limit + params := ctx.ConsensusParams() + if params != nil && params.Block != nil && params.Block.MaxGas > 0 { + hi = uint64(params.Block.MaxGas) + } else { + hi = req.GasCap + } + } + + // TODO: Recap the highest gas limit with account's available balance. + + // Recap the highest gas allowance with specified gascap. + if req.GasCap != 0 && hi > req.GasCap { + hi = req.GasCap + } + cap = hi + + cfg, err := k.EVMConfig(ctx) + if err != nil { + return nil, status.Error(codes.Internal, "failed to load evm config") + } + + // ApplyMessageWithConfig expect correct nonce set in msg + nonce := k.GetNonce(ctx, args.GetFrom()) + args.Nonce = (*hexutil.Uint64)(&nonce) + + txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash().Bytes())) + + // Create a helper to check if a gas allowance results in an executable transaction + executable := func(gas uint64) (vmerror bool, rsp *types.MsgEthereumTxResponse, err error) { + args.Gas = (*hexutil.Uint64)(&gas) + + msg, err := args.ToMessage(req.GasCap, cfg.BaseFee) + if err != nil { + return false, nil, err + } + + // pass false to not commit StateDB + rsp, err = k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig) + if err != nil { + if errors.Is(err, core.ErrIntrinsicGas) { + return true, nil, nil // Special case, raise gas limit + } + return true, nil, err // Bail out + } + return len(rsp.VmError) > 0, rsp, nil + } + + // Execute the binary search and hone in on an executable gas limit + hi, err = types.BinSearch(lo, hi, executable) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + // Reject the transaction as invalid if it still fails at the highest allowance + if hi == cap { + failed, result, err := executable(hi) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + if failed { + if result != nil && result.VmError != vm.ErrOutOfGas.Error() { + if result.VmError == vm.ErrExecutionReverted.Error() { + return nil, types.NewExecErrorWithReason(result.Ret) + } + return nil, status.Error(codes.Internal, result.VmError) + } + // Otherwise, the specified gas cap is too low + return nil, status.Error(codes.Internal, fmt.Sprintf("gas required exceeds allowance (%d)", cap)) + } + } + return &types.EstimateGasResponse{Gas: hi}, nil +} + +// TraceTx configures a new tracer according to the provided configuration, and +// executes the given message in the provided environment. The return value will +// be tracer dependent. +func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*types.QueryTraceTxResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.TraceConfig != nil && req.TraceConfig.Limit < 0 { + return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit) + } + + ctx := sdk.UnwrapSDKContext(c) + ctx = ctx.WithBlockHeight(req.BlockNumber) + ctx = ctx.WithBlockTime(req.BlockTime) + ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash)) + + cfg, err := k.EVMConfig(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to load evm config: %s", err.Error()) + } + signer := ethtypes.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) + + txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash().Bytes())) + for i, tx := range req.Predecessors { + ethTx := tx.AsTransaction() + msg, err := ethTx.AsMessage(signer, cfg.BaseFee) + if err != nil { + continue + } + txConfig.TxHash = ethTx.Hash() + txConfig.TxIndex = uint(i) + rsp, err := k.ApplyMessageWithConfig(ctx, msg, types.NewNoOpTracer(), true, cfg, txConfig) + if err != nil { + continue + } + txConfig.LogIndex += uint(len(rsp.Logs)) + } + + tx := req.Msg.AsTransaction() + txConfig.TxHash = tx.Hash() + txConfig.TxIndex++ + result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false) + if err != nil { + // error will be returned with detail status from traceTx + return nil, err + } + + resultData, err := json.Marshal(result) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryTraceTxResponse{ + Data: resultData, + }, nil +} + +// TraceBlock configures a new tracer according to the provided configuration, and +// executes the given message in the provided environment for all the transactions in the queried block. +// The return value will be tracer dependent. +func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest) (*types.QueryTraceBlockResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.TraceConfig != nil && req.TraceConfig.Limit < 0 { + return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit) + } + + ctx := sdk.UnwrapSDKContext(c) + ctx = ctx.WithBlockHeight(req.BlockNumber) + ctx = ctx.WithBlockTime(req.BlockTime) + ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash)) + + cfg, err := k.EVMConfig(ctx) + if err != nil { + return nil, status.Error(codes.Internal, "failed to load evm config") + } + signer := ethtypes.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) + txsLength := len(req.Txs) + results := make([]*types.TxTraceResult, 0, txsLength) + + txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash().Bytes())) + for i, tx := range req.Txs { + result := types.TxTraceResult{} + ethTx := tx.AsTransaction() + txConfig.TxHash = ethTx.Hash() + txConfig.TxIndex = uint(i) + traceResult, logIndex, err := k.traceTx(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true) + if err != nil { + result.Error = err.Error() + continue + } + txConfig.LogIndex = logIndex + result.Result = traceResult + results = append(results, &result) + } + + resultData, err := json.Marshal(results) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryTraceBlockResponse{ + Data: resultData, + }, nil +} + +// traceTx do trace on one transaction, it returns a tuple: (traceResult, nextLogIndex, error). +func (k *Keeper) traceTx( + ctx sdk.Context, + cfg *types.EVMConfig, + txConfig statedb.TxConfig, + signer ethtypes.Signer, + tx *ethtypes.Transaction, + traceConfig *types.TraceConfig, + commitMessage bool, +) (*interface{}, uint, error) { + // Assemble the structured logger or the JavaScript tracer + var ( + tracer vm.EVMLogger + overrides *ethparams.ChainConfig + err error + ) + + msg, err := tx.AsMessage(signer, cfg.BaseFee) + if err != nil { + return nil, 0, status.Error(codes.Internal, err.Error()) + } + + if traceConfig != nil && traceConfig.Overrides != nil { + overrides = traceConfig.Overrides.EthereumConfig(cfg.ChainConfig.ChainID) + } + + switch { + case traceConfig != nil && traceConfig.Tracer != "": + timeout := defaultTraceTimeout + // TODO: change timeout to time.duration + // Used string to comply with go ethereum + if traceConfig.Timeout != "" { + timeout, err = time.ParseDuration(traceConfig.Timeout) + if err != nil { + return nil, 0, status.Errorf(codes.InvalidArgument, "timeout value: %s", err.Error()) + } + } + + tCtx := &tracers.Context{ + BlockHash: txConfig.BlockHash, + TxIndex: int(txConfig.TxIndex), + TxHash: txConfig.TxHash, + } + + // Construct the JavaScript tracer to execute with + if tracer, err = tracers.New(traceConfig.Tracer, tCtx); err != nil { + return nil, 0, status.Error(codes.Internal, err.Error()) + } + + // Handle timeouts and RPC cancellations + deadlineCtx, cancel := context.WithTimeout(ctx.Context(), timeout) + defer cancel() + + go func() { + <-deadlineCtx.Done() + if errors.Is(deadlineCtx.Err(), context.DeadlineExceeded) { + tracer.(tracers.Tracer).Stop(errors.New("execution timeout")) + } + }() + + case traceConfig != nil: + logConfig := logger.Config{ + EnableMemory: traceConfig.EnableMemory, + DisableStorage: traceConfig.DisableStorage, + DisableStack: traceConfig.DisableStack, + EnableReturnData: traceConfig.EnableReturnData, + Debug: traceConfig.Debug, + Limit: int(traceConfig.Limit), + Overrides: overrides, + } + tracer = logger.NewStructLogger(&logConfig) + default: + tracer = types.NewTracer(types.TracerStruct, msg, cfg.ChainConfig, ctx.BlockHeight()) + } + + res, err := k.ApplyMessageWithConfig(ctx, msg, tracer, commitMessage, cfg, txConfig) + if err != nil { + return nil, 0, status.Error(codes.Internal, err.Error()) + } + + var result interface{} + + // Depending on the tracer type, format and return the trace result data. + switch tracer := tracer.(type) { + case *logger.StructLogger: + returnVal := "" + revert := res.Revert() + if len(revert) > 0 { + returnVal = fmt.Sprintf("%x", revert) + } else { + returnVal = fmt.Sprintf("%x", res.Return()) + } + result = types.ExecutionResult{ + Gas: res.GasUsed, + Failed: res.Failed(), + ReturnValue: returnVal, + StructLogs: types.FormatLogs(tracer.StructLogs()), + } + case tracers.Tracer: + result, err = tracer.GetResult() + if err != nil { + return nil, 0, status.Error(codes.Internal, err.Error()) + } + + default: + return nil, 0, status.Errorf(codes.InvalidArgument, "invalid tracer type %T", tracer) + } + + return &result, txConfig.LogIndex + uint(len(res.Logs)), nil +} + +// BaseFee implements the Query/BaseFee gRPC method +func (k Keeper) QueryBaseFee(c context.Context, _ *types.QueryBaseFeeRequest) (*types.QueryBaseFeeResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + res := &types.QueryBaseFeeResponse{} + baseFee := k.GetBaseFee(ctx) + + if baseFee != nil { + aux := sdk.NewIntFromBigInt(baseFee) + res.BaseFee = &aux + } + + return res, nil +} + +// BlockGas implements the Query/BlockGas gRPC method +func (k Keeper) BlockGas(c context.Context, _ *types.QueryBlockGasRequest) (*types.QueryBlockGasResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + gas := k.GetBlockGasUsed(ctx) + + return &types.QueryBlockGasResponse{ + Gas: int64(gas), + }, nil +} diff --git a/x/evm/keeper/hooks.go b/x/evm/keeper/hooks.go new file mode 100644 index 00000000..f8269f36 --- /dev/null +++ b/x/evm/keeper/hooks.go @@ -0,0 +1,31 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +var _ types.EvmHooks = MultiEvmHooks{} + +// MultiEvmHooks combine multiple evm hooks, all hook functions are run in array sequence +type MultiEvmHooks []types.EvmHooks + +// NewMultiEvmHooks combine multiple evm hooks +func NewMultiEvmHooks(hooks ...types.EvmHooks) MultiEvmHooks { + return hooks +} + +// PostTxProcessing delegate the call to underlying hooks +func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error { + for i := range mh { + if err := mh[i].PostTxProcessing(ctx, from, to, receipt); err != nil { + return sdkerrors.Wrapf(err, "EVM hook %T failed", mh[i]) + } + } + return nil +} diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go new file mode 100644 index 00000000..064b5fc0 --- /dev/null +++ b/x/evm/keeper/keeper.go @@ -0,0 +1,359 @@ +package keeper + +import ( + "math/big" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" + + "github.com/tendermint/tendermint/libs/log" + + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/evm/statedb" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// Keeper grants access to the EVM module state and implements the go-ethereum StateDB interface. +type Keeper struct { + // Protobuf codec + cdc codec.BinaryCodec + // Store key required for the EVM Prefix KVStore. It is required by: + // - storing account's Storage State + // - storing account's Code + // - storing transaction Logs + // - storing Bloom filters by block height. Needed for the Web3 API. + storeKey sdk.StoreKey + + // key to access the transient store, which is reset on every block during Commit + transientKey sdk.StoreKey + + // module specific parameter space that can be configured through governance + paramSpace paramtypes.Subspace + // access to account state + accountKeeper types.AccountKeeper + // update balance and accounting operations with coins + bankKeeper types.BankKeeper + // access historical headers for EVM state transition execution + stakingKeeper types.StakingKeeper + + // chain ID number obtained from the context's chain id + eip155ChainID *big.Int + + // Tracer used to collect execution traces from the EVM transaction execution + tracer string + + // EVM Hooks for tx post-processing + hooks types.EvmHooks +} + +// NewKeeper generates new evm module keeper +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, transientKey sdk.StoreKey, paramSpace paramtypes.Subspace, + ak types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, + tracer string, +) *Keeper { + // ensure evm module account is set + if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { + panic("the EVM module account has not been set") + } + + // set KeyTable if it has not already been set + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + + // NOTE: we pass in the parameter space to the CommitStateDB in order to use custom denominations for the EVM operations + return &Keeper{ + cdc: cdc, + paramSpace: paramSpace, + accountKeeper: ak, + bankKeeper: bankKeeper, + stakingKeeper: sk, + storeKey: storeKey, + transientKey: transientKey, + tracer: tracer, + } +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", types.ModuleName) +} + +// WithChainID sets the chain id to the local variable in the keeper +func (k *Keeper) WithChainID(ctx sdk.Context) { + chainID, err := stratos.ParseChainID(ctx.ChainID()) + if err != nil { + panic(err) + } + + if k.eip155ChainID != nil && k.eip155ChainID.Cmp(chainID) != 0 { + panic("chain id already set") + } + + k.eip155ChainID = chainID +} + +// ChainID returns the EIP155 chain ID for the EVM context +func (k Keeper) ChainID() *big.Int { + return k.eip155ChainID +} + +// ---------------------------------------------------------------------------- +// Block Bloom +// Required by Web3 API. +// ---------------------------------------------------------------------------- + +// EmitBlockBloomEvent emit block bloom events +func (k Keeper) EmitBlockBloomEvent(ctx sdk.Context, bloom ethtypes.Bloom) { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeBlockBloom, + sdk.NewAttribute(types.AttributeKeyEthereumBloom, string(bloom.Bytes())), + ), + ) +} + +// GetBlockBloomTransient returns bloom bytes for the current block height +func (k Keeper) GetBlockBloomTransient(ctx sdk.Context) *big.Int { + store := prefix.NewStore(ctx.TransientStore(k.transientKey), types.KeyPrefixTransientBloom) + heightBz := sdk.Uint64ToBigEndian(uint64(ctx.BlockHeight())) + bz := store.Get(heightBz) + if len(bz) == 0 { + return big.NewInt(0) + } + + return new(big.Int).SetBytes(bz) +} + +// SetBlockBloomTransient sets the given bloom bytes to the transient store. This value is reset on +// every block. +func (k Keeper) SetBlockBloomTransient(ctx sdk.Context, bloom *big.Int) { + store := prefix.NewStore(ctx.TransientStore(k.transientKey), types.KeyPrefixTransientBloom) + heightBz := sdk.Uint64ToBigEndian(uint64(ctx.BlockHeight())) + store.Set(heightBz, bloom.Bytes()) +} + +// ---------------------------------------------------------------------------- +// Tx +// ---------------------------------------------------------------------------- + +// SetTxIndexTransient set the index of processing transaction +func (k Keeper) SetTxIndexTransient(ctx sdk.Context, index uint64) { + store := ctx.TransientStore(k.transientKey) + store.Set(types.KeyPrefixTransientTxIndex, sdk.Uint64ToBigEndian(index)) +} + +// GetTxIndexTransient returns EVM transaction index on the current block. +func (k Keeper) GetTxIndexTransient(ctx sdk.Context) uint64 { + store := ctx.TransientStore(k.transientKey) + bz := store.Get(types.KeyPrefixTransientTxIndex) + if len(bz) == 0 { + return 0 + } + + return sdk.BigEndianToUint64(bz) +} + +// ---------------------------------------------------------------------------- +// Log +// ---------------------------------------------------------------------------- + +// GetLogSizeTransient returns EVM log index on the current block. +func (k Keeper) GetLogSizeTransient(ctx sdk.Context) uint64 { + store := ctx.TransientStore(k.transientKey) + bz := store.Get(types.KeyPrefixTransientLogSize) + if len(bz) == 0 { + return 0 + } + + return sdk.BigEndianToUint64(bz) +} + +// SetLogSizeTransient fetches the current EVM log index from the transient store, increases its +// value by one and then sets the new index back to the transient store. +func (k Keeper) SetLogSizeTransient(ctx sdk.Context, logSize uint64) { + store := ctx.TransientStore(k.transientKey) + store.Set(types.KeyPrefixTransientLogSize, sdk.Uint64ToBigEndian(logSize)) +} + +// ---------------------------------------------------------------------------- +// Storage +// ---------------------------------------------------------------------------- + +// GetAccountStorage return state storage associated with an account +func (k Keeper) GetAccountStorage(ctx sdk.Context, address common.Address) types.Storage { + storage := types.Storage{} + + k.ForEachStorage(ctx, address, func(key, value common.Hash) bool { + storage = append(storage, types.NewState(key, value)) + return true + }) + + return storage +} + +// ---------------------------------------------------------------------------- +// Account +// ---------------------------------------------------------------------------- + +// SetHooks sets the hooks for the EVM module +// It should be called only once during initialization, it panic if called more than once. +func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper { + if k.hooks != nil { + panic("cannot set evm hooks twice") + } + + k.hooks = eh + return k +} + +// PostTxProcessing delegate the call to the hooks. If no hook has been registered, this function returns with a `nil` error +func (k *Keeper) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error { + if k.hooks == nil { + return nil + } + return k.hooks.PostTxProcessing(ctx, from, to, receipt) +} + +// Tracer return a default vm.Tracer based on current keeper state +func (k Keeper) Tracer(ctx sdk.Context, msg core.Message, ethCfg *params.ChainConfig) vm.EVMLogger { + return types.NewTracer(k.tracer, msg, ethCfg, ctx.BlockHeight()) +} + +// GetAccountWithoutBalance load nonce and codehash without balance, +// more efficient in cases where balance is not needed. +func (k *Keeper) GetAccountWithoutBalance(ctx sdk.Context, addr common.Address) *statedb.Account { + cosmosAddr := sdk.AccAddress(addr.Bytes()) + acct := k.accountKeeper.GetAccount(ctx, cosmosAddr) + if acct == nil { + return nil + } + + codeHash := types.EmptyCodeHash + ethAcct, ok := acct.(stratos.EthAccountI) + if ok { + codeHash = ethAcct.GetCodeHash().Bytes() + } + + return &statedb.Account{ + Nonce: acct.GetSequence(), + CodeHash: codeHash, + } +} + +// GetAccountOrEmpty returns empty account if not exist, returns error if it's not `EthAccount` +func (k *Keeper) GetAccountOrEmpty(ctx sdk.Context, addr common.Address) statedb.Account { + acct := k.GetAccount(ctx, addr) + if acct != nil { + return *acct + } + + // empty account + return statedb.Account{ + Balance: new(big.Int), + CodeHash: types.EmptyCodeHash, + } +} + +// GetNonce returns the sequence number of an account, returns 0 if not exists. +func (k *Keeper) GetNonce(ctx sdk.Context, addr common.Address) uint64 { + cosmosAddr := sdk.AccAddress(addr.Bytes()) + acct := k.accountKeeper.GetAccount(ctx, cosmosAddr) + if acct == nil { + return 0 + } + + return acct.GetSequence() +} + +// GetBalance load account's balance of gas token +func (k *Keeper) GetBalance(ctx sdk.Context, addr common.Address) *big.Int { + cosmosAddr := sdk.AccAddress(addr.Bytes()) + params := k.GetParams(ctx) + coin := k.bankKeeper.GetBalance(ctx, cosmosAddr, params.EvmDenom) + return coin.Amount.BigInt() +} + +// BaseFee returns current base fee, return values: +// - `nil`: london hardfork not enabled. +// - `0`: london hardfork enabled but feemarket is not enabled. +// - `n`: both london hardfork and feemarket are enabled. +func (k Keeper) BaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int { + if !types.IsLondon(ethCfg, ctx.BlockHeight()) { + return nil + } + baseFee := k.GetBaseFee(ctx) + if baseFee == nil { + // return 0 if feemarket not enabled. + baseFee = big.NewInt(0) + } + return baseFee +} + +// ResetTransientGasUsed reset gas used to prepare for execution of current cosmos tx, called in ante handler. +func (k Keeper) ResetTransientGasUsed(ctx sdk.Context) { + store := ctx.TransientStore(k.transientKey) + store.Delete(types.KeyPrefixTransientGasUsed) +} + +// GetTransientGasUsed returns the gas used by current cosmos tx. +func (k Keeper) GetTransientGasUsed(ctx sdk.Context) uint64 { + store := ctx.TransientStore(k.transientKey) + bz := store.Get(types.KeyPrefixTransientGasUsed) + if len(bz) == 0 { + return 0 + } + return sdk.BigEndianToUint64(bz) +} + +// SetTransientGasUsed sets the gas used by current cosmos tx. +func (k Keeper) SetTransientGasUsed(ctx sdk.Context, gasUsed uint64) { + store := ctx.TransientStore(k.transientKey) + bz := sdk.Uint64ToBigEndian(gasUsed) + store.Set(types.KeyPrefixTransientGasUsed, bz) +} + +// AddTransientGasUsed accumulate gas used by each eth msgs included in current cosmos tx. +func (k Keeper) AddTransientGasUsed(ctx sdk.Context, gasUsed uint64) (uint64, error) { + result := k.GetTransientGasUsed(ctx) + gasUsed + if result < gasUsed { + return 0, sdkerrors.Wrap(types.ErrGasOverflow, "transient gas used") + } + k.SetTransientGasUsed(ctx, result) + return result, nil +} + +// ---------------------------------------------------------------------------- +// Parent Block Gas Used +// Required by EIP1559 base fee calculation. +// ---------------------------------------------------------------------------- + +// GetBlockGasUsed returns the last block gas used value from the store. +func (k Keeper) GetBlockGasUsed(ctx sdk.Context) uint64 { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.KeyPrefixBlockGasUsed) + if len(bz) == 0 { + return 0 + } + + return sdk.BigEndianToUint64(bz) +} + +// SetBlockGasUsed gets the block gas consumed to the store. +// CONTRACT: this should be only called during EndBlock. +func (k Keeper) SetBlockGasUsed(ctx sdk.Context, gas uint64) { + store := ctx.KVStore(k.storeKey) + gasBz := sdk.Uint64ToBigEndian(gas) + store.Set(types.KeyPrefixBlockGasUsed, gasBz) +} diff --git a/x/evm/keeper/migrations.go b/x/evm/keeper/migrations.go new file mode 100644 index 00000000..3be1ada6 --- /dev/null +++ b/x/evm/keeper/migrations.go @@ -0,0 +1,13 @@ +package keeper + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{ + keeper: keeper, + } +} diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go new file mode 100644 index 00000000..c9477573 --- /dev/null +++ b/x/evm/keeper/msg_server.go @@ -0,0 +1,88 @@ +package keeper + +import ( + "context" + "encoding/json" + "fmt" + "strconv" + + tmbytes "github.com/tendermint/tendermint/libs/bytes" + tmtypes "github.com/tendermint/tendermint/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +var _ types.MsgServer = &Keeper{} + +// EthereumTx implements the gRPC MsgServer interface. It receives a transaction which is then +// executed (i.e applied) against the go-ethereum EVM. The provided SDK Context is set to the Keeper +// so that it can implements and call the StateDB methods without receiving it as a function +// parameter. +func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*types.MsgEthereumTxResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + sender := msg.From + tx := msg.AsTransaction() + txIndex := k.GetTxIndexTransient(ctx) + + response, err := k.ApplyTransaction(ctx, tx) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to apply transaction") + } + + attrs := []sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyAmount, tx.Value().String()), + // add event for ethereum transaction hash format + sdk.NewAttribute(types.AttributeKeyEthereumTxHash, response.Hash), + // add event for index of valid ethereum tx + sdk.NewAttribute(types.AttributeKeyTxIndex, strconv.FormatUint(txIndex, 10)), + // add event for eth tx gas used, we can't get it from cosmos tx result when it contains multiple eth tx msgs. + sdk.NewAttribute(types.AttributeKeyTxGasUsed, strconv.FormatUint(response.GasUsed, 10)), + } + + if len(ctx.TxBytes()) > 0 { + // add event for tendermint transaction hash format + hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()) + attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyTxHash, hash.String())) + } + + if to := tx.To(); to != nil { + attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyRecipient, to.Hex())) + } + + if response.Failed() { + attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyEthereumTxFailed, response.VmError)) + } + + txLogAttrs := make([]sdk.Attribute, len(response.Logs)) + for i, log := range response.Logs { + value, err := json.Marshal(log) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to encode log") + } + txLogAttrs[i] = sdk.NewAttribute(types.AttributeKeyTxLog, string(value)) + } + + // emit events + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeEthereumTx, + attrs..., + ), + sdk.NewEvent( + types.EventTypeTxLog, + txLogAttrs..., + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, sender), + sdk.NewAttribute(types.AttributeKeyTxType, fmt.Sprintf("%d", tx.Type())), + ), + }) + + return response, nil +} diff --git a/x/evm/keeper/params.go b/x/evm/keeper/params.go new file mode 100644 index 00000000..04dd23e6 --- /dev/null +++ b/x/evm/keeper/params.go @@ -0,0 +1,41 @@ +package keeper + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// GetParams returns the total set of evm parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSpace.GetParamSet(ctx, ¶ms) + return params +} + +// SetParams sets the evm parameters to the param space. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSpace.SetParamSet(ctx, ¶ms) +} + +// ---------------------------------------------------------------------------- +// Parent Base Fee +// Required by EIP1559 base fee calculation. +// ---------------------------------------------------------------------------- + +// GetBaseFee get's the base fee from the paramSpace +// return nil if base fee is not enabled +func (k Keeper) GetBaseFee(ctx sdk.Context) *big.Int { + params := k.GetParams(ctx) + if params.FeeMarketParams.NoBaseFee { + return nil + } + + return params.FeeMarketParams.BaseFee.BigInt() +} + +// SetBaseFee set's the base fee in the paramSpace +func (k Keeper) SetBaseFee(ctx sdk.Context, baseFee *big.Int) { + k.paramSpace.Set(ctx, types.ParamStoreKeyBaseFee, sdk.NewIntFromBigInt(baseFee)) +} diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go new file mode 100644 index 00000000..cf2f3b8d --- /dev/null +++ b/x/evm/keeper/state_transition.go @@ -0,0 +1,500 @@ +package keeper + +import ( + "math" + "math/big" + + tmtypes "github.com/tendermint/tendermint/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" + + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/evm/statedb" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// GasToRefund calculates the amount of gas the state machine should refund to the sender. It is +// capped by the refund quotient value. +// Note: do not pass 0 to refundQuotient +func GasToRefund(availableRefund, gasConsumed, refundQuotient uint64) uint64 { + // Apply refund counter + refund := gasConsumed / refundQuotient + if refund > availableRefund { + return availableRefund + } + return refund +} + +// EVMConfig creates the EVMConfig based on current state +func (k *Keeper) EVMConfig(ctx sdk.Context) (*types.EVMConfig, error) { + params := k.GetParams(ctx) + ethCfg := params.ChainConfig.EthereumConfig(k.eip155ChainID) + + // get the coinbase address from the block proposer + coinbase, err := k.GetCoinbaseAddress(ctx) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to obtain coinbase address") + } + + baseFee := k.BaseFee(ctx, ethCfg) + return &types.EVMConfig{ + Params: params, + ChainConfig: ethCfg, + CoinBase: coinbase, + BaseFee: baseFee, + }, nil +} + +// TxConfig load `TxConfig` from current transient storage +func (k *Keeper) TxConfig(ctx sdk.Context, txHash common.Hash) statedb.TxConfig { + return statedb.NewTxConfig( + common.BytesToHash(ctx.HeaderHash()), // BlockHash + txHash, // TxHash + uint(k.GetTxIndexTransient(ctx)), // TxIndex + uint(k.GetLogSizeTransient(ctx)), // LogIndex + ) +} + +// NewEVM generates a go-ethereum VM from the provided Message fields and the chain parameters +// (ChainConfig and module Params). It additionally sets the validator operator address as the +// coinbase address to make it available for the COINBASE opcode, even though there is no +// beneficiary of the coinbase transaction (since we're not mining). +func (k *Keeper) NewEVM( + ctx sdk.Context, + msg core.Message, + cfg *types.EVMConfig, + tracer vm.EVMLogger, + stateDB vm.StateDB, +) *vm.EVM { + blockCtx := vm.BlockContext{ + CanTransfer: core.CanTransfer, + Transfer: core.Transfer, + GetHash: k.GetHashFn(ctx), + Coinbase: cfg.CoinBase, + GasLimit: stratos.BlockGasLimit(ctx), + BlockNumber: big.NewInt(ctx.BlockHeight()), + Time: big.NewInt(ctx.BlockHeader().Time.Unix()), + Difficulty: big.NewInt(0), // unused. Only required in PoW context + BaseFee: cfg.BaseFee, + } + + txCtx := core.NewEVMTxContext(msg) + if tracer == nil { + tracer = k.Tracer(ctx, msg, cfg.ChainConfig) + } + vmConfig := k.VMConfig(ctx, msg, cfg, tracer) + return vm.NewEVM(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig) +} + +// VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the +// module parameters. The config generated uses the default JumpTable from the EVM. +func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, cfg *types.EVMConfig, tracer vm.EVMLogger) vm.Config { + noBaseFee := true + if types.IsLondon(cfg.ChainConfig, ctx.BlockHeight()) { + noBaseFee = k.GetParams(ctx).FeeMarketParams.NoBaseFee + } + + var debug bool + if _, ok := tracer.(types.NoOpTracer); !ok { + debug = true + } + + return vm.Config{ + Debug: debug, + Tracer: tracer, + NoBaseFee: noBaseFee, + ExtraEips: cfg.Params.EIPs(), + } +} + +// GetHashFn implements vm.GetHashFunc for stratos. It handles 3 cases: +// 1. The requested height matches the current height from context (and thus same epoch number) +// 2. The requested height is from an previous height from the same chain epoch +// 3. The requested height is from a height greater than the latest one +func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc { + return func(height uint64) common.Hash { + h, err := stratos.SafeInt64(height) + if err != nil { + k.Logger(ctx).Error("failed to cast height to int64", "error", err) + return common.Hash{} + } + + switch { + case ctx.BlockHeight() == h: + // Case 1: The requested height matches the one from the context so we can retrieve the header + // hash directly from the context. + // Note: The headerHash is only set at begin block, it will be nil in case of a query context + headerHash := ctx.HeaderHash() + if len(headerHash) != 0 { + return common.BytesToHash(headerHash) + } + + // only recompute the hash if not set (eg: checkTxState) + contextBlockHeader := ctx.BlockHeader() + header, err := tmtypes.HeaderFromProto(&contextBlockHeader) + if err != nil { + k.Logger(ctx).Error("failed to cast tendermint header from proto", "error", err) + return common.Hash{} + } + + headerHash = header.Hash() + return common.BytesToHash(headerHash) + + case ctx.BlockHeight() > h: + // Case 2: if the chain is not the current height we need to retrieve the hash from the store for the + // current chain epoch. This only applies if the current height is greater than the requested height. + histInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, h) + if !found { + k.Logger(ctx).Debug("historical info not found", "height", h) + return common.Hash{} + } + + header, err := tmtypes.HeaderFromProto(&histInfo.Header) + if err != nil { + k.Logger(ctx).Error("failed to cast tendermint header from proto", "error", err) + return common.Hash{} + } + + return common.BytesToHash(header.Hash()) + default: + // Case 3: heights greater than the current one returns an empty hash. + return common.Hash{} + } + } +} + +// ApplyTransaction runs and attempts to perform a state transition with the given transaction (i.e Message), that will +// only be persisted (committed) to the underlying KVStore if the transaction does not fail. +// +// Gas tracking +// +// Ethereum consumes gas according to the EVM opcodes instead of general reads and writes to store. Because of this, the +// state transition needs to ignore the SDK gas consumption mechanism defined by the GasKVStore and instead consume the +// amount of gas used by the VM execution. The amount of gas used is tracked by the EVM and returned in the execution +// result. +// +// Prior to the execution, the starting tx gas meter is saved and replaced with an infinite gas meter in a new context +// in order to ignore the SDK gas consumption config values (read, write, has, delete). +// After the execution, the gas used from the message execution will be added to the starting gas consumed, taking into +// consideration the amount of gas returned. Finally, the context is updated with the EVM gas consumed value prior to +// returning. +// +// For relevant discussion see: https://github.com/cosmos/cosmos-sdk/discussions/9072 +func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*types.MsgEthereumTxResponse, error) { + var ( + bloom *big.Int + bloomReceipt ethtypes.Bloom + ) + + cfg, err := k.EVMConfig(ctx) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to load evm config") + } + txConfig := k.TxConfig(ctx, tx.Hash()) + + // get the signer according to the chain rules from the config and block height + signer := ethtypes.MakeSigner(cfg.ChainConfig, big.NewInt(ctx.BlockHeight())) + msg, err := tx.AsMessage(signer, cfg.BaseFee) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to return ethereum transaction as core message") + } + + // snapshot to contain the tx processing and post processing in same scope + var commit func() + tmpCtx := ctx + if k.hooks != nil { + // Create a cache context to revert state when tx hooks fails, + // the cache context is only committed when both tx and hooks executed successfully. + // Didn't use `Snapshot` because the context stack has exponential complexity on certain operations, + // thus restricted to be used only inside `ApplyMessage`. + tmpCtx, commit = ctx.CacheContext() + } + + // pass true to commit the StateDB + res, err := k.ApplyMessageWithConfig(tmpCtx, msg, nil, true, cfg, txConfig) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to apply ethereum core message") + } + + logs := types.LogsToEthereum(res.Logs) + + // Compute block bloom filter + if len(logs) > 0 { + bloom = k.GetBlockBloomTransient(ctx) + bloom.Or(bloom, big.NewInt(0).SetBytes(ethtypes.LogsBloom(logs))) + bloomReceipt = ethtypes.BytesToBloom(bloom.Bytes()) + } + + if !res.Failed() { + cumulativeGasUsed := res.GasUsed + if ctx.BlockGasMeter() != nil { + limit := ctx.BlockGasMeter().Limit() + consumed := ctx.BlockGasMeter().GasConsumed() + cumulativeGasUsed = uint64(math.Min(float64(cumulativeGasUsed+consumed), float64(limit))) + } + + var contractAddr common.Address + if msg.To() == nil { + contractAddr = crypto.CreateAddress(msg.From(), msg.Nonce()) + } + + receipt := ðtypes.Receipt{ + Type: tx.Type(), + PostState: nil, // TODO: intermediate state root + Status: ethtypes.ReceiptStatusSuccessful, + CumulativeGasUsed: cumulativeGasUsed, + Bloom: bloomReceipt, + Logs: logs, + TxHash: txConfig.TxHash, + ContractAddress: contractAddr, + GasUsed: res.GasUsed, + BlockHash: txConfig.BlockHash, + BlockNumber: big.NewInt(ctx.BlockHeight()), + TransactionIndex: txConfig.TxIndex, + } + + // Only call hooks if tx executed successfully. + if err = k.PostTxProcessing(tmpCtx, msg.From(), tx.To(), receipt); err != nil { + // If hooks return error, revert the whole tx. + res.VmError = types.ErrPostTxProcessing.Error() + k.Logger(ctx).Error("tx post processing failed", "error", err) + } else if commit != nil { + // PostTxProcessing is successful, commit the tmpCtx + commit() + ctx.EventManager().EmitEvents(tmpCtx.EventManager().Events()) + } + } + + // refund gas in order to match the Ethereum gas consumption instead of the default SDK one. + if err = k.RefundGas(ctx, msg, msg.Gas()-res.GasUsed, cfg.Params.EvmDenom); err != nil { + return nil, sdkerrors.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From()) + } + + if len(logs) > 0 { + // Update transient block bloom filter + k.SetBlockBloomTransient(ctx, bloom) + + k.SetLogSizeTransient(ctx, uint64(txConfig.LogIndex)+uint64(len(logs))) + } + + k.SetTxIndexTransient(ctx, uint64(txConfig.TxIndex)+1) + + totalGasUsed, err := k.AddTransientGasUsed(ctx, res.GasUsed) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to add transient gas used") + } + + // reset the gas meter for current cosmos transaction + k.ResetGasMeterAndConsumeGas(ctx, totalGasUsed) + return res, nil +} + +// ApplyMessageWithConfig computes the new state by applying the given message against the existing state. +// If the message fails, the VM execution error with the reason will be returned to the client +// and the transaction won't be committed to the store. +// +// Reverted state +// +// The snapshot and rollback are supported by the `statedb.StateDB`. +// +// Different Callers +// +// It's called in three scenarios: +// 1. `ApplyTransaction`, in the transaction processing flow. +// 2. `EthCall/EthEstimateGas` grpc query handler. +// 3. Called by other native modules directly. +// +// Prechecks and Preprocessing +// +// All relevant state transition prechecks for the MsgEthereumTx are performed on the AnteHandler, +// prior to running the transaction against the state. The prechecks run are the following: +// +// 1. the nonce of the message caller is correct +// 2. caller has enough balance to cover transaction fee(gaslimit * gasprice) +// 3. the amount of gas required is available in the block +// 4. the purchased gas is enough to cover intrinsic usage +// 5. there is no overflow when calculating intrinsic gas +// 6. caller has enough balance to cover asset transfer for **topmost** call +// +// The preprocessing steps performed by the AnteHandler are: +// +// 1. set up the initial access list (iff fork > Berlin) +// +// Tracer parameter +// +// It should be a `vm.Tracer` object or nil, if pass `nil`, it'll create a default one based on keeper options. +// +// Commit parameter +// +// If commit is true, the `StateDB` will be committed, otherwise discarded. +func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool, cfg *types.EVMConfig, txConfig statedb.TxConfig) (*types.MsgEthereumTxResponse, error) { + var ( + ret []byte // return bytes from evm execution + vmErr error // vm errors do not effect consensus and are therefore not assigned to err + ) + + // return error if contract creation or call are disabled through governance + if !cfg.Params.EnableCreate && msg.To() == nil { + return nil, sdkerrors.Wrap(types.ErrCreateDisabled, "failed to create new contract") + } else if !cfg.Params.EnableCall && msg.To() != nil { + return nil, sdkerrors.Wrap(types.ErrCallDisabled, "failed to call contract") + } + + stateDB := statedb.New(ctx, k, txConfig) + evm := k.NewEVM(ctx, msg, cfg, tracer, stateDB) + + sender := vm.AccountRef(msg.From()) + contractCreation := msg.To() == nil + isLondon := cfg.ChainConfig.IsLondon(evm.Context.BlockNumber) + + intrinsicGas, err := k.GetEthIntrinsicGas(ctx, msg, cfg.ChainConfig, contractCreation) + if err != nil { + // should have already been checked on Ante Handler + return nil, sdkerrors.Wrap(err, "intrinsic gas failed") + } + // Should check again even if it is checked on Ante Handler, because eth_call don't go through Ante Handler. + if msg.Gas() < intrinsicGas { + // eth_estimateGas will check for this exact error + return nil, sdkerrors.Wrap(core.ErrIntrinsicGas, "apply message") + } + leftoverGas := msg.Gas() - intrinsicGas + + // access list preparation is moved from ante handler to here, because it's needed when `ApplyMessage` is called + // under contexts where ante handlers are not run, for example `eth_call` and `eth_estimateGas`. + if rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeForkBlock != nil); rules.IsBerlin { + stateDB.PrepareAccessList(msg.From(), msg.To(), vm.ActivePrecompiles(rules), msg.AccessList()) + } + + if contractCreation { + // take over the nonce management from evm: + // - reset sender's nonce to msg.Nonce() before calling evm. + // - increase sender's nonce by one no matter the result. + stateDB.SetNonce(sender.Address(), msg.Nonce()) + ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data(), leftoverGas, msg.Value()) + stateDB.SetNonce(sender.Address(), msg.Nonce()+1) + } else { + ret, leftoverGas, vmErr = evm.Call(sender, *msg.To(), msg.Data(), leftoverGas, msg.Value()) + } + + refundQuotient := params.RefundQuotient + + // After EIP-3529: refunds are capped to gasUsed / 5 + if isLondon { + refundQuotient = params.RefundQuotientEIP3529 + } + + // calculate gas refund + if msg.Gas() < leftoverGas { + return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message") + } + gasUsed := msg.Gas() - leftoverGas + refund := GasToRefund(stateDB.GetRefund(), gasUsed, refundQuotient) + if refund > gasUsed { + return nil, sdkerrors.Wrap(types.ErrGasOverflow, "apply message") + } + gasUsed -= refund + + // EVM execution error needs to be available for the JSON-RPC client + var vmError string + if vmErr != nil { + vmError = vmErr.Error() + } + + // The dirty states in `StateDB` is either committed or discarded after return + if commit { + if err := stateDB.Commit(); err != nil { + return nil, sdkerrors.Wrap(err, "failed to commit stateDB") + } + } + + return &types.MsgEthereumTxResponse{ + GasUsed: gasUsed, + VmError: vmError, + Ret: ret, + Logs: types.NewLogsFromEth(stateDB.Logs()), + Hash: txConfig.TxHash.Hex(), + }, nil +} + +// ApplyMessage calls ApplyMessageWithConfig with default EVMConfig +func (k *Keeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*types.MsgEthereumTxResponse, error) { + cfg, err := k.EVMConfig(ctx) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to load evm config") + } + txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash())) + return k.ApplyMessageWithConfig(ctx, msg, tracer, commit, cfg, txConfig) +} + +// GetEthIntrinsicGas returns the intrinsic gas cost for the transaction +func (k *Keeper) GetEthIntrinsicGas(ctx sdk.Context, msg core.Message, cfg *params.ChainConfig, isContractCreation bool) (uint64, error) { + height := big.NewInt(ctx.BlockHeight()) + homestead := cfg.IsHomestead(height) + istanbul := cfg.IsIstanbul(height) + + return core.IntrinsicGas(msg.Data(), msg.AccessList(), isContractCreation, homestead, istanbul) +} + +// RefundGas transfers the leftover gas to the sender of the message, caped to half of the total gas +// consumed in the transaction. Additionally, the function sets the total gas consumed to the value +// returned by the EVM execution, thus ignoring the previous intrinsic gas consumed during in the +// AnteHandler. +func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64, denom string) error { + // Return EVM tokens for remaining gas, exchanged at the original rate. + remaining := new(big.Int).Mul(new(big.Int).SetUint64(leftoverGas), msg.GasPrice()) + + switch remaining.Sign() { + case -1: + // negative refund errors + return sdkerrors.Wrapf(types.ErrInvalidRefund, "refunded amount value cannot be negative %d", remaining.Int64()) + case 1: + // positive amount refund + refundedCoins := sdk.Coins{sdk.NewCoin(denom, sdk.NewIntFromBigInt(remaining))} + + // refund to sender from the fee collector module account, which is the escrow account in charge of collecting tx fees + + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, msg.From().Bytes(), refundedCoins) + if err != nil { + err = sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "fee collector account failed to refund fees: %s", err.Error()) + return sdkerrors.Wrapf(err, "failed to refund %d leftover gas (%s)", leftoverGas, refundedCoins.String()) + } + default: + // no refund, consume gas and update the tx gas meter + } + + return nil +} + +// ResetGasMeterAndConsumeGas reset first the gas meter consumed value to zero and set it back to the new value +// 'gasUsed' +func (k *Keeper) ResetGasMeterAndConsumeGas(ctx sdk.Context, gasUsed uint64) { + // reset the gas count + ctx.GasMeter().RefundGas(ctx.GasMeter().GasConsumed(), "reset the gas count") + ctx.GasMeter().ConsumeGas(gasUsed, "apply evm transaction") +} + +// GetCoinbaseAddress returns the block proposer's validator operator address. +func (k Keeper) GetCoinbaseAddress(ctx sdk.Context) (common.Address, error) { + consAddr := sdk.ConsAddress(ctx.BlockHeader().ProposerAddress) + validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr) + if !found { + return common.Address{}, sdkerrors.Wrapf( + stakingtypes.ErrNoValidatorFound, + "failed to retrieve validator from block proposer address %s", + consAddr.String(), + ) + } + + coinbase := common.BytesToAddress(validator.GetOperator()) + return coinbase, nil +} diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go new file mode 100644 index 00000000..bb4c9ae8 --- /dev/null +++ b/x/evm/keeper/statedb.go @@ -0,0 +1,223 @@ +package keeper + +import ( + "bytes" + "fmt" + "math/big" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/evm/statedb" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +var _ statedb.Keeper = &Keeper{} + +// ---------------------------------------------------------------------------- +// StateDB Keeper implementation +// ---------------------------------------------------------------------------- + +// GetAccount returns nil if account is not exist, returns error if it's not `EthAccountI` +func (k *Keeper) GetAccount(ctx sdk.Context, addr common.Address) *statedb.Account { + acct := k.GetAccountWithoutBalance(ctx, addr) + if acct == nil { + return nil + } + + acct.Balance = k.GetBalance(ctx, addr) + return acct +} + +// GetState loads contract state from database, implements `statedb.Keeper` interface. +func (k *Keeper) GetState(ctx sdk.Context, addr common.Address, key common.Hash) common.Hash { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AddressStoragePrefix(addr)) + + value := store.Get(key.Bytes()) + if len(value) == 0 { + return common.Hash{} + } + + return common.BytesToHash(value) +} + +// GetCode loads contract code from database, implements `statedb.Keeper` interface. +func (k *Keeper) GetCode(ctx sdk.Context, codeHash common.Hash) []byte { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixCode) + return store.Get(codeHash.Bytes()) +} + +// ForEachStorage iterate contract storage, callback return false to break early +func (k *Keeper) ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key, value common.Hash) bool) { + store := ctx.KVStore(k.storeKey) + prefix := types.AddressStoragePrefix(addr) + + iterator := sdk.KVStorePrefixIterator(store, prefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + key := common.BytesToHash(iterator.Key()) + value := common.BytesToHash(iterator.Value()) + + // check if iteration stops + if !cb(key, value) { + return + } + } +} + +// SetBalance update account's balance, compare with current balance first, then decide to mint or burn. +func (k *Keeper) SetBalance(ctx sdk.Context, addr common.Address, amount *big.Int) error { + cosmosAddr := sdk.AccAddress(addr.Bytes()) + + params := k.GetParams(ctx) + coin := k.bankKeeper.GetBalance(ctx, cosmosAddr, params.EvmDenom) + balance := coin.Amount.BigInt() + delta := new(big.Int).Sub(amount, balance) + switch delta.Sign() { + case 1: + // mint + coins := sdk.NewCoins(sdk.NewCoin(params.EvmDenom, sdk.NewIntFromBigInt(delta))) + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins); err != nil { + return err + } + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, cosmosAddr, coins); err != nil { + return err + } + case -1: + // burn + coins := sdk.NewCoins(sdk.NewCoin(params.EvmDenom, sdk.NewIntFromBigInt(new(big.Int).Neg(delta)))) + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, cosmosAddr, types.ModuleName, coins); err != nil { + return err + } + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins); err != nil { + return err + } + default: + // not changed + } + return nil +} + +// SetAccount updates nonce/balance/codeHash together. +func (k *Keeper) SetAccount(ctx sdk.Context, addr common.Address, account statedb.Account) error { + // update account + cosmosAddr := sdk.AccAddress(addr.Bytes()) + acct := k.accountKeeper.GetAccount(ctx, cosmosAddr) + if acct == nil { + acct = k.accountKeeper.NewAccountWithAddress(ctx, cosmosAddr) + } + + if err := acct.SetSequence(account.Nonce); err != nil { + return err + } + + codeHash := common.BytesToHash(account.CodeHash) + + if ethAcct, ok := acct.(stratos.EthAccountI); ok { + if err := ethAcct.SetCodeHash(codeHash); err != nil { + return err + } + } + + k.accountKeeper.SetAccount(ctx, acct) + + if err := k.SetBalance(ctx, addr, account.Balance); err != nil { + return err + } + + k.Logger(ctx).Debug( + "account updated", + "ethereum-address", addr.Hex(), + "nonce", account.Nonce, + "codeHash", codeHash.Hex(), + "balance", account.Balance, + ) + return nil +} + +// SetState update contract storage, delete if value is empty. +func (k *Keeper) SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AddressStoragePrefix(addr)) + action := "updated" + if len(value) == 0 { + store.Delete(key.Bytes()) + action = "deleted" + } else { + store.Set(key.Bytes(), value) + } + k.Logger(ctx).Debug( + fmt.Sprintf("state %s", action), + "ethereum-address", addr.Hex(), + "key", key.Hex(), + ) +} + +// SetCode set contract code, delete if code is empty. +func (k *Keeper) SetCode(ctx sdk.Context, codeHash, code []byte) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixCode) + + // store or delete code + action := "updated" + if len(code) == 0 { + store.Delete(codeHash) + action = "deleted" + } else { + store.Set(codeHash, code) + } + k.Logger(ctx).Debug( + fmt.Sprintf("code %s", action), + "code-hash", common.BytesToHash(codeHash).Hex(), + ) +} + +// DeleteAccount handles contract's suicide call: +// - clear balance +// - remove code +// - remove states +// - remove auth account +func (k *Keeper) DeleteAccount(ctx sdk.Context, addr common.Address) error { + cosmosAddr := sdk.AccAddress(addr.Bytes()) + acct := k.accountKeeper.GetAccount(ctx, cosmosAddr) + if acct == nil { + return nil + } + + // NOTE: only Ethereum accounts (contracts) can be selfdestructed + ethAcct, ok := acct.(stratos.EthAccountI) + if !ok { + return sdkerrors.Wrapf(types.ErrInvalidAccount, "type %T, address %s", acct, addr) + } + + // clear balance + if err := k.SetBalance(ctx, addr, new(big.Int)); err != nil { + return err + } + + // remove code + codeHashBz := ethAcct.GetCodeHash().Bytes() + if !bytes.Equal(codeHashBz, types.EmptyCodeHash) { + k.SetCode(ctx, codeHashBz, nil) + } + + // clear storage + k.ForEachStorage(ctx, addr, func(key, _ common.Hash) bool { + k.SetState(ctx, addr, key, nil) + return true + }) + + // remove auth account + k.accountKeeper.RemoveAccount(ctx, acct) + + k.Logger(ctx).Debug( + "account suicided", + "ethereum-address", addr.Hex(), + "cosmos-address", cosmosAddr.String(), + ) + + return nil +} diff --git a/x/evm/keeper/utils.go b/x/evm/keeper/utils.go new file mode 100644 index 00000000..ec1095d7 --- /dev/null +++ b/x/evm/keeper/utils.go @@ -0,0 +1,109 @@ +package keeper + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// DeductTxCostsFromUserBalance it calculates the tx costs and deducts the fees +func (k Keeper) DeductTxCostsFromUserBalance( + ctx sdk.Context, + msgEthTx evmtypes.MsgEthereumTx, + txData evmtypes.TxData, + denom string, + homestead, istanbul, london bool, +) (sdk.Coins, error) { + isContractCreation := txData.GetTo() == nil + + // fetch sender account from signature + signerAcc, err := authante.GetSignerAcc(ctx, k.accountKeeper, msgEthTx.GetFrom()) + if err != nil { + return nil, sdkerrors.Wrapf(err, "account not found for sender %s", msgEthTx.From) + } + + gasLimit := txData.GetGas() + + var accessList ethtypes.AccessList + if txData.GetAccessList() != nil { + accessList = txData.GetAccessList() + } + + intrinsicGas, err := core.IntrinsicGas(txData.GetData(), accessList, isContractCreation, homestead, istanbul) + if err != nil { + return nil, sdkerrors.Wrapf( + err, + "failed to retrieve intrinsic gas, contract creation = %t; homestead = %t, istanbul = %t", + isContractCreation, homestead, istanbul, + ) + } + + // intrinsic gas verification during CheckTx + if ctx.IsCheckTx() && gasLimit < intrinsicGas { + return nil, sdkerrors.Wrapf( + sdkerrors.ErrOutOfGas, + "gas limit too low: %d (gas limit) < %d (intrinsic gas)", gasLimit, intrinsicGas, + ) + } + + var feeAmt *big.Int + + feeMktParams := k.feeMarketKeeper.GetParams(ctx) + if london && !feeMktParams.NoBaseFee && txData.TxType() == ethtypes.DynamicFeeTxType { + baseFee := k.feeMarketKeeper.GetBaseFee(ctx) + if txData.GetGasFeeCap().Cmp(baseFee) < 0 { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "the tx gasfeecap is lower than the tx baseFee: %s (gasfeecap), %s (basefee) ", txData.GetGasFeeCap(), baseFee) + } + feeAmt = txData.EffectiveFee(baseFee) + } else { + feeAmt = txData.Fee() + } + + if feeAmt.Sign() == 0 { + // zero fee, no need to deduct + return sdk.NewCoins(), nil + } + + fees := sdk.Coins{sdk.NewCoin(denom, sdk.NewIntFromBigInt(feeAmt))} + + // deduct the full gas cost from the user balance + if err := authante.DeductFees(k.bankKeeper, ctx, signerAcc, fees); err != nil { + return nil, sdkerrors.Wrapf( + err, + "failed to deduct full gas cost %s from the user %s balance", + fees, msgEthTx.From, + ) + } + return fees, nil +} + +// CheckSenderBalance validates that the tx cost value is positive and that the +// sender has enough funds to pay for the fees and value of the transaction. +func CheckSenderBalance( + balance sdk.Int, + txData evmtypes.TxData, +) error { + cost := txData.Cost() + + if cost.Sign() < 0 { + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidCoins, + "tx cost (%s) is negative and invalid", cost, + ) + } + + if balance.IsNegative() || balance.BigInt().Cmp(cost) < 0 { + return sdkerrors.Wrapf( + sdkerrors.ErrInsufficientFunds, + "sender balance < tx cost (%s < %s)", balance, txData.Cost(), + ) + } + return nil +} diff --git a/x/evm/module.go b/x/evm/module.go new file mode 100644 index 00000000..9d144c6d --- /dev/null +++ b/x/evm/module.go @@ -0,0 +1,192 @@ +package evm + +import ( + "context" + "encoding/json" + "fmt" + "math/rand" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/stratosnet/stratos-chain/x/evm/client/cli" + "github.com/stratosnet/stratos-chain/x/evm/keeper" + "github.com/stratosnet/stratos-chain/x/evm/simulation" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// AppModuleBasic defines the basic application module used by the evm module. +type AppModuleBasic struct{} + +// Name returns the evm module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec performs a no-op as the evm module doesn't support amino. +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { +} + +// ConsensusVersion returns the consensus state-breaking version for the module. +func (AppModuleBasic) ConsensusVersion() uint64 { + return 1 +} + +// DefaultGenesis returns default genesis state as raw bytes for the evm +// module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis is the validation check of the Genesis +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var genesisState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return genesisState.Validate() +} + +// RegisterRESTRoutes performs a no-op as the EVM module doesn't expose REST +// endpoints +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the root tx command for the evm module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns no root query command for the evm module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// RegisterInterfaces registers interfaces and implementations of the evm module. +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +// ____________________________________________________________________________ + +// AppModule implements an application module for the evm module. +type AppModule struct { + AppModuleBasic + keeper *keeper.Keeper + ak types.AccountKeeper +} + +// NewAppModule creates a new AppModule object +func NewAppModule(k *keeper.Keeper, ak types.AccountKeeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{}, + keeper: k, + ak: ak, + } +} + +// Name returns the evm module's name. +func (AppModule) Name() string { + return types.ModuleName +} + +// RegisterInvariants interface for registering invariants. Performs a no-op +// as the evm module doesn't expose invariants. +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { +} + +// RegisterQueryService registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), am.keeper) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + + _ = keeper.NewMigrator(*am.keeper) +} + +// Route returns the message routing key for the evm module. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the evm module's querier route name. +func (AppModule) QuerierRoute() string { return types.RouterKey } + +// LegacyQuerierHandler returns nil as the evm module doesn't expose a legacy +// Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// BeginBlock returns the begin block for the evm module. +func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { + am.keeper.BeginBlock(ctx, req) +} + +// EndBlock returns the end blocker for the evm module. It returns no validator +// updates. +func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { + return am.keeper.EndBlock(ctx, req) +} + +// InitGenesis performs genesis initialization for the evm module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, am.ak, genesisState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the evm +// module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper, am.ak) + return cdc.MustMarshalJSON(gs) +} + +// RandomizedParams creates randomized evm param changes for the simulator. +func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { + return nil +} + +// RegisterStoreDecoder registers a decoder for evm module's types +func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// GenerateGenesisState creates a randomized GenState of the evm module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + simulation.RandomizedGenState(simState) +} + +// WeightedOperations returns the all the evm module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + return nil +} diff --git a/x/evm/simulation/genesis.go b/x/evm/simulation/genesis.go new file mode 100644 index 00000000..1bd5235f --- /dev/null +++ b/x/evm/simulation/genesis.go @@ -0,0 +1,30 @@ +package simulation + +import ( + "encoding/json" + "fmt" + + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// RandomizedGenState generates a random GenesisState for nft +func RandomizedGenState(simState *module.SimulationState) { + feeMarketParams := types.NewFeeMarketParams(simState.Rand.Uint32()%2 == 0, simState.Rand.Uint32(), simState.Rand.Uint32(), simState.Rand.Uint64(), simState.Rand.Int63()) + blockGas := simState.Rand.Uint64() + + params := types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), feeMarketParams) + if simState.Rand.Uint32()%2 == 0 { + params = types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), feeMarketParams, 1344, 1884, 2200, 2929, 3198, 3529) + } + evmGenesis := types.NewGenesisState(params, []types.GenesisAccount{}, blockGas) + + bz, err := json.MarshalIndent(evmGenesis, "", " ") + if err != nil { + panic(err) + } + fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz) + + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(evmGenesis) +} diff --git a/x/evm/statedb/access_list.go b/x/evm/statedb/access_list.go new file mode 100644 index 00000000..4513a916 --- /dev/null +++ b/x/evm/statedb/access_list.go @@ -0,0 +1,118 @@ +// Copyright 2020 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package statedb + +import ( + "github.com/ethereum/go-ethereum/common" +) + +type accessList struct { + addresses map[common.Address]int + slots []map[common.Hash]struct{} +} + +// ContainsAddress returns true if the address is in the access list. +func (al *accessList) ContainsAddress(address common.Address) bool { + _, ok := al.addresses[address] + return ok +} + +// Contains checks if a slot within an account is present in the access list, returning +// separate flags for the presence of the account and the slot respectively. +func (al *accessList) Contains(address common.Address, slot common.Hash) (addressPresent bool, slotPresent bool) { + idx, ok := al.addresses[address] + if !ok { + // no such address (and hence zero slots) + return false, false + } + if idx == -1 { + // address yes, but no slots + return true, false + } + _, slotPresent = al.slots[idx][slot] + return true, slotPresent +} + +// newAccessList creates a new accessList. +func newAccessList() *accessList { + return &accessList{ + addresses: make(map[common.Address]int), + } +} + +// AddAddress adds an address to the access list, and returns 'true' if the operation +// caused a change (addr was not previously in the list). +func (al *accessList) AddAddress(address common.Address) bool { + if _, present := al.addresses[address]; present { + return false + } + al.addresses[address] = -1 + return true +} + +// AddSlot adds the specified (addr, slot) combo to the access list. +// Return values are: +// - address added +// - slot added +// For any 'true' value returned, a corresponding journal entry must be made. +func (al *accessList) AddSlot(address common.Address, slot common.Hash) (addrChange bool, slotChange bool) { + idx, addrPresent := al.addresses[address] + if !addrPresent || idx == -1 { + // Address not present, or addr present but no slots there + al.addresses[address] = len(al.slots) + slotmap := map[common.Hash]struct{}{slot: {}} + al.slots = append(al.slots, slotmap) + return !addrPresent, true + } + // There is already an (address,slot) mapping + slotmap := al.slots[idx] + if _, ok := slotmap[slot]; !ok { + slotmap[slot] = struct{}{} + // Journal add slot change + return false, true + } + // No changes required + return false, false +} + +// DeleteSlot removes an (address, slot)-tuple from the access list. +// This operation needs to be performed in the same order as the addition happened. +// This method is meant to be used by the journal, which maintains ordering of +// operations. +func (al *accessList) DeleteSlot(address common.Address, slot common.Hash) { + idx, addrOk := al.addresses[address] + if !addrOk { + panic("reverting slot change, address not present in list") + } + slotmap := al.slots[idx] + delete(slotmap, slot) + // If that was the last (first) slot, remove it + // Since additions and rollbacks are always performed in order, + // we can delete the item without worrying about screwing up later indices + if len(slotmap) == 0 { + al.slots = al.slots[:idx] + al.addresses[address] = -1 + } +} + +// DeleteAddress removes an address from the access list. This operation +// needs to be performed in the same order as the addition happened. +// This method is meant to be used by the journal, which maintains ordering of +// operations. +func (al *accessList) DeleteAddress(address common.Address) { + delete(al.addresses, address) +} diff --git a/x/evm/statedb/config.go b/x/evm/statedb/config.go new file mode 100644 index 00000000..9932b7b5 --- /dev/null +++ b/x/evm/statedb/config.go @@ -0,0 +1,32 @@ +package statedb + +import "github.com/ethereum/go-ethereum/common" + +// TxConfig encapulates the readonly information of current tx for `StateDB`. +type TxConfig struct { + BlockHash common.Hash // hash of current block + TxHash common.Hash // hash of current tx + TxIndex uint // the index of current transaction + LogIndex uint // the index of next log within current block +} + +// NewTxConfig returns a TxConfig +func NewTxConfig(bhash, thash common.Hash, txIndex, logIndex uint) TxConfig { + return TxConfig{ + BlockHash: bhash, + TxHash: thash, + TxIndex: txIndex, + LogIndex: logIndex, + } +} + +// NewEmptyTxConfig construct an empty TxConfig, +// used in context where there's no transaction, e.g. `eth_call`/`eth_estimateGas`. +func NewEmptyTxConfig(bhash common.Hash) TxConfig { + return TxConfig{ + BlockHash: bhash, + TxHash: common.Hash{}, + TxIndex: 0, + LogIndex: 0, + } +} diff --git a/x/evm/statedb/interfaces.go b/x/evm/statedb/interfaces.go new file mode 100644 index 00000000..8dd7ce72 --- /dev/null +++ b/x/evm/statedb/interfaces.go @@ -0,0 +1,22 @@ +package statedb + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" +) + +// Keeper provide underlying storage of StateDB +type Keeper interface { + // Read methods + GetAccount(ctx sdk.Context, addr common.Address) *Account + GetState(ctx sdk.Context, addr common.Address, key common.Hash) common.Hash + GetCode(ctx sdk.Context, codeHash common.Hash) []byte + // the callback returns false to break early + ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key, value common.Hash) bool) + + // Write methods, only called by `StateDB.Commit()` + SetAccount(ctx sdk.Context, addr common.Address, account Account) error + SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte) + SetCode(ctx sdk.Context, codeHash []byte, code []byte) + DeleteAccount(ctx sdk.Context, addr common.Address) error +} diff --git a/x/evm/statedb/journal.go b/x/evm/statedb/journal.go new file mode 100644 index 00000000..c3f692f9 --- /dev/null +++ b/x/evm/statedb/journal.go @@ -0,0 +1,243 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package statedb + +import ( + "bytes" + "math/big" + "sort" + + "github.com/ethereum/go-ethereum/common" +) + +// journalEntry is a modification entry in the state change journal that can be +// reverted on demand. +type journalEntry interface { + // revert undoes the changes introduced by this journal entry. + revert(*StateDB) + + // dirtied returns the Ethereum address modified by this journal entry. + dirtied() *common.Address +} + +// journal contains the list of state modifications applied since the last state +// commit. These are tracked to be able to be reverted in the case of an execution +// exception or request for reversal. +type journal struct { + entries []journalEntry // Current changes tracked by the journal + dirties map[common.Address]int // Dirty accounts and the number of changes +} + +// newJournal creates a new initialized journal. +func newJournal() *journal { + return &journal{ + dirties: make(map[common.Address]int), + } +} + +// sortedDirties sort the dirty addresses for deterministic iteration +func (j *journal) sortedDirties() []common.Address { + keys := make([]common.Address, len(j.dirties)) + i := 0 + for k := range j.dirties { + keys[i] = k + i++ + } + sort.Slice(keys, func(i, j int) bool { + return bytes.Compare(keys[i].Bytes(), keys[j].Bytes()) < 0 + }) + return keys +} + +// append inserts a new modification entry to the end of the change journal. +func (j *journal) append(entry journalEntry) { + j.entries = append(j.entries, entry) + if addr := entry.dirtied(); addr != nil { + j.dirties[*addr]++ + } +} + +// revert undoes a batch of journalled modifications along with any reverted +// dirty handling too. +func (j *journal) revert(statedb *StateDB, snapshot int) { + for i := len(j.entries) - 1; i >= snapshot; i-- { + // Undo the changes made by the operation + j.entries[i].revert(statedb) + + // Drop any dirty tracking induced by the change + if addr := j.entries[i].dirtied(); addr != nil { + if j.dirties[*addr]--; j.dirties[*addr] == 0 { + delete(j.dirties, *addr) + } + } + } + j.entries = j.entries[:snapshot] +} + +// length returns the current number of entries in the journal. +func (j *journal) length() int { + return len(j.entries) +} + +type ( + // Changes to the account trie. + createObjectChange struct { + account *common.Address + } + resetObjectChange struct { + prev *stateObject + } + suicideChange struct { + account *common.Address + prev bool // whether account had already suicided + prevbalance *big.Int + } + + // Changes to individual accounts. + balanceChange struct { + account *common.Address + prev *big.Int + } + nonceChange struct { + account *common.Address + prev uint64 + } + storageChange struct { + account *common.Address + key, prevalue common.Hash + } + codeChange struct { + account *common.Address + prevcode, prevhash []byte + } + + // Changes to other state values. + refundChange struct { + prev uint64 + } + addLogChange struct{} + + // Changes to the access list + accessListAddAccountChange struct { + address *common.Address + } + accessListAddSlotChange struct { + address *common.Address + slot *common.Hash + } +) + +func (ch createObjectChange) revert(s *StateDB) { + delete(s.stateObjects, *ch.account) +} + +func (ch createObjectChange) dirtied() *common.Address { + return ch.account +} + +func (ch resetObjectChange) revert(s *StateDB) { + s.setStateObject(ch.prev) +} + +func (ch resetObjectChange) dirtied() *common.Address { + return nil +} + +func (ch suicideChange) revert(s *StateDB) { + obj := s.getStateObject(*ch.account) + if obj != nil { + obj.suicided = ch.prev + obj.setBalance(ch.prevbalance) + } +} + +func (ch suicideChange) dirtied() *common.Address { + return ch.account +} + +func (ch balanceChange) revert(s *StateDB) { + s.getStateObject(*ch.account).setBalance(ch.prev) +} + +func (ch balanceChange) dirtied() *common.Address { + return ch.account +} + +func (ch nonceChange) revert(s *StateDB) { + s.getStateObject(*ch.account).setNonce(ch.prev) +} + +func (ch nonceChange) dirtied() *common.Address { + return ch.account +} + +func (ch codeChange) revert(s *StateDB) { + s.getStateObject(*ch.account).setCode(common.BytesToHash(ch.prevhash), ch.prevcode) +} + +func (ch codeChange) dirtied() *common.Address { + return ch.account +} + +func (ch storageChange) revert(s *StateDB) { + s.getStateObject(*ch.account).setState(ch.key, ch.prevalue) +} + +func (ch storageChange) dirtied() *common.Address { + return ch.account +} + +func (ch refundChange) revert(s *StateDB) { + s.refund = ch.prev +} + +func (ch refundChange) dirtied() *common.Address { + return nil +} + +func (ch addLogChange) revert(s *StateDB) { + s.logs = s.logs[:len(s.logs)-1] +} + +func (ch addLogChange) dirtied() *common.Address { + return nil +} + +func (ch accessListAddAccountChange) revert(s *StateDB) { + /* + One important invariant here, is that whenever a (addr, slot) is added, if the + addr is not already present, the add causes two journal entries: + - one for the address, + - one for the (address,slot) + Therefore, when unrolling the change, we can always blindly delete the + (addr) at this point, since no storage adds can remain when come upon + a single (addr) change. + */ + s.accessList.DeleteAddress(*ch.address) +} + +func (ch accessListAddAccountChange) dirtied() *common.Address { + return nil +} + +func (ch accessListAddSlotChange) revert(s *StateDB) { + s.accessList.DeleteSlot(*ch.address, *ch.slot) +} + +func (ch accessListAddSlotChange) dirtied() *common.Address { + return nil +} diff --git a/x/evm/statedb/state_object.go b/x/evm/statedb/state_object.go new file mode 100644 index 00000000..3ebb800c --- /dev/null +++ b/x/evm/statedb/state_object.go @@ -0,0 +1,237 @@ +package statedb + +import ( + "bytes" + "math/big" + "sort" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" +) + +var emptyCodeHash = crypto.Keccak256(nil) + +// Account is the Ethereum consensus representation of accounts. +// These objects are stored in the storage of auth module. +type Account struct { + Nonce uint64 + Balance *big.Int + CodeHash []byte +} + +// NewEmptyAccount returns an empty account. +func NewEmptyAccount() *Account { + return &Account{ + Balance: new(big.Int), + CodeHash: emptyCodeHash, + } +} + +// IsContract returns if the account contains contract code. +func (acct Account) IsContract() bool { + return !bytes.Equal(acct.CodeHash, emptyCodeHash) +} + +// Storage represents in-memory cache/buffer of contract storage. +type Storage map[common.Hash]common.Hash + +// SortedKeys sort the keys for deterministic iteration +func (s Storage) SortedKeys() []common.Hash { + keys := make([]common.Hash, len(s)) + i := 0 + for k := range s { + keys[i] = k + i++ + } + sort.Slice(keys, func(i, j int) bool { + return bytes.Compare(keys[i].Bytes(), keys[j].Bytes()) < 0 + }) + return keys +} + +// stateObject is the state of an acount +type stateObject struct { + db *StateDB + + account Account + code []byte + + // state storage + originStorage Storage + dirtyStorage Storage + + address common.Address + + // flags + dirtyCode bool + suicided bool +} + +// newObject creates a state object. +func newObject(db *StateDB, address common.Address, account Account) *stateObject { + if account.Balance == nil { + account.Balance = new(big.Int) + } + if account.CodeHash == nil { + account.CodeHash = emptyCodeHash + } + return &stateObject{ + db: db, + address: address, + account: account, + originStorage: make(Storage), + dirtyStorage: make(Storage), + } +} + +// empty returns whether the account is considered empty. +func (s *stateObject) empty() bool { + return s.account.Nonce == 0 && s.account.Balance.Sign() == 0 && bytes.Equal(s.account.CodeHash, emptyCodeHash) +} + +func (s *stateObject) markSuicided() { + s.suicided = true +} + +// AddBalance adds amount to s's balance. +// It is used to add funds to the destination account of a transfer. +func (s *stateObject) AddBalance(amount *big.Int) { + if amount.Sign() == 0 { + return + } + s.SetBalance(new(big.Int).Add(s.Balance(), amount)) +} + +// SubBalance removes amount from s's balance. +// It is used to remove funds from the origin account of a transfer. +func (s *stateObject) SubBalance(amount *big.Int) { + if amount.Sign() == 0 { + return + } + s.SetBalance(new(big.Int).Sub(s.Balance(), amount)) +} + +// SetBalance update account balance. +func (s *stateObject) SetBalance(amount *big.Int) { + s.db.journal.append(balanceChange{ + account: &s.address, + prev: new(big.Int).Set(s.account.Balance), + }) + s.setBalance(amount) +} + +func (s *stateObject) setBalance(amount *big.Int) { + s.account.Balance = amount +} + +// +// Attribute accessors +// + +// Returns the address of the contract/account +func (s *stateObject) Address() common.Address { + return s.address +} + +// Code returns the contract code associated with this object, if any. +func (s *stateObject) Code() []byte { + if s.code != nil { + return s.code + } + if bytes.Equal(s.CodeHash(), emptyCodeHash) { + return nil + } + code := s.db.keeper.GetCode(s.db.ctx, common.BytesToHash(s.CodeHash())) + s.code = code + return code +} + +// CodeSize returns the size of the contract code associated with this object, +// or zero if none. +func (s *stateObject) CodeSize() int { + return len(s.Code()) +} + +// SetCode set contract code to account +func (s *stateObject) SetCode(codeHash common.Hash, code []byte) { + prevcode := s.Code() + s.db.journal.append(codeChange{ + account: &s.address, + prevhash: s.CodeHash(), + prevcode: prevcode, + }) + s.setCode(codeHash, code) +} + +func (s *stateObject) setCode(codeHash common.Hash, code []byte) { + s.code = code + s.account.CodeHash = codeHash[:] + s.dirtyCode = true +} + +// SetCode set nonce to account +func (s *stateObject) SetNonce(nonce uint64) { + s.db.journal.append(nonceChange{ + account: &s.address, + prev: s.account.Nonce, + }) + s.setNonce(nonce) +} + +func (s *stateObject) setNonce(nonce uint64) { + s.account.Nonce = nonce +} + +// CodeHash returns the code hash of account +func (s *stateObject) CodeHash() []byte { + return s.account.CodeHash +} + +// Balance returns the balance of account +func (s *stateObject) Balance() *big.Int { + return s.account.Balance +} + +// Nonce returns the nonce of account +func (s *stateObject) Nonce() uint64 { + return s.account.Nonce +} + +// GetCommittedState query the committed state +func (s *stateObject) GetCommittedState(key common.Hash) common.Hash { + if value, cached := s.originStorage[key]; cached { + return value + } + // If no live objects are available, load it from keeper + value := s.db.keeper.GetState(s.db.ctx, s.Address(), key) + s.originStorage[key] = value + return value +} + +// GetState query the current state (including dirty state) +func (s *stateObject) GetState(key common.Hash) common.Hash { + if value, dirty := s.dirtyStorage[key]; dirty { + return value + } + return s.GetCommittedState(key) +} + +// SetState sets the contract state +func (s *stateObject) SetState(key common.Hash, value common.Hash) { + // If the new value is the same as old, don't set + prev := s.GetState(key) + if prev == value { + return + } + // New value is different, update and journal the change + s.db.journal.append(storageChange{ + account: &s.address, + key: key, + prevalue: prev, + }) + s.setState(key, value) +} + +func (s *stateObject) setState(key, value common.Hash) { + s.dirtyStorage[key] = value +} diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go new file mode 100644 index 00000000..f8c892d2 --- /dev/null +++ b/x/evm/statedb/statedb.go @@ -0,0 +1,463 @@ +package statedb + +import ( + "fmt" + "math/big" + "sort" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/crypto" +) + +// revision is the identifier of a version of state. +// it consists of an auto-increment id and a journal index. +// it's safer to use than using journal index alone. +type revision struct { + id int + journalIndex int +} + +var _ vm.StateDB = &StateDB{} + +// StateDB structs within the ethereum protocol are used to store anything +// within the merkle trie. StateDBs take care of caching and storing +// nested states. It's the general query interface to retrieve: +// * Contracts +// * Accounts +type StateDB struct { + keeper Keeper + ctx sdk.Context + + // Journal of state modifications. This is the backbone of + // Snapshot and RevertToSnapshot. + journal *journal + validRevisions []revision + nextRevisionID int + + stateObjects map[common.Address]*stateObject + + txConfig TxConfig + + // The refund counter, also used by state transitioning. + refund uint64 + + // Per-transaction logs + logs []*ethtypes.Log + + // Per-transaction access list + accessList *accessList +} + +// New creates a new state from a given trie. +func New(ctx sdk.Context, keeper Keeper, txConfig TxConfig) *StateDB { + return &StateDB{ + keeper: keeper, + ctx: ctx, + stateObjects: make(map[common.Address]*stateObject), + journal: newJournal(), + accessList: newAccessList(), + + txConfig: txConfig, + } +} + +// Keeper returns the underlying `Keeper` +func (s *StateDB) Keeper() Keeper { + return s.keeper +} + +// AddLog adds a log, called by evm. +func (s *StateDB) AddLog(log *ethtypes.Log) { + s.journal.append(addLogChange{}) + + log.TxHash = s.txConfig.TxHash + log.BlockHash = s.txConfig.BlockHash + log.TxIndex = s.txConfig.TxIndex + log.Index = s.txConfig.LogIndex + uint(len(s.logs)) + s.logs = append(s.logs, log) +} + +// Logs returns the logs of current transaction. +func (s *StateDB) Logs() []*ethtypes.Log { + return s.logs +} + +// AddRefund adds gas to the refund counter +func (s *StateDB) AddRefund(gas uint64) { + s.journal.append(refundChange{prev: s.refund}) + s.refund += gas +} + +// SubRefund removes gas from the refund counter. +// This method will panic if the refund counter goes below zero +func (s *StateDB) SubRefund(gas uint64) { + s.journal.append(refundChange{prev: s.refund}) + if gas > s.refund { + panic(fmt.Sprintf("Refund counter below zero (gas: %d > refund: %d)", gas, s.refund)) + } + s.refund -= gas +} + +// Exist reports whether the given account address exists in the state. +// Notably this also returns true for suicided accounts. +func (s *StateDB) Exist(addr common.Address) bool { + return s.getStateObject(addr) != nil +} + +// Empty returns whether the state object is either non-existent +// or empty according to the EIP161 specification (balance = nonce = code = 0) +func (s *StateDB) Empty(addr common.Address) bool { + so := s.getStateObject(addr) + return so == nil || so.empty() +} + +// GetBalance retrieves the balance from the given address or 0 if object not found +func (s *StateDB) GetBalance(addr common.Address) *big.Int { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return stateObject.Balance() + } + return common.Big0 +} + +// GetNonce returns the nonce of account, 0 if not exists. +func (s *StateDB) GetNonce(addr common.Address) uint64 { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return stateObject.Nonce() + } + + return 0 +} + +// GetCode returns the code of account, nil if not exists. +func (s *StateDB) GetCode(addr common.Address) []byte { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return stateObject.Code() + } + return nil +} + +// GetCodeSize returns the code size of account. +func (s *StateDB) GetCodeSize(addr common.Address) int { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return stateObject.CodeSize() + } + return 0 +} + +// GetCodeHash returns the code hash of account. +func (s *StateDB) GetCodeHash(addr common.Address) common.Hash { + stateObject := s.getStateObject(addr) + if stateObject == nil { + return common.Hash{} + } + return common.BytesToHash(stateObject.CodeHash()) +} + +// GetState retrieves a value from the given account's storage trie. +func (s *StateDB) GetState(addr common.Address, hash common.Hash) common.Hash { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return stateObject.GetState(hash) + } + return common.Hash{} +} + +// GetCommittedState retrieves a value from the given account's committed storage trie. +func (s *StateDB) GetCommittedState(addr common.Address, hash common.Hash) common.Hash { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return stateObject.GetCommittedState(hash) + } + return common.Hash{} +} + +// GetRefund returns the current value of the refund counter. +func (s *StateDB) GetRefund() uint64 { + return s.refund +} + +// HasSuicided returns if the contract is suicided in current transaction. +func (s *StateDB) HasSuicided(addr common.Address) bool { + stateObject := s.getStateObject(addr) + if stateObject != nil { + return stateObject.suicided + } + return false +} + +// AddPreimage records a SHA3 preimage seen by the VM. +// AddPreimage performs a no-op since the EnablePreimageRecording flag is disabled +// on the vm.Config during state transitions. No store trie preimages are written +// to the database. +func (s *StateDB) AddPreimage(hash common.Hash, preimage []byte) {} + +// getStateObject retrieves a state object given by the address, returning nil if +// the object is not found. +func (s *StateDB) getStateObject(addr common.Address) *stateObject { + // Prefer live objects if any is available + if obj := s.stateObjects[addr]; obj != nil { + return obj + } + // If no live objects are available, load it from keeper + account := s.keeper.GetAccount(s.ctx, addr) + if account == nil { + return nil + } + // Insert into the live set + obj := newObject(s, addr, *account) + s.setStateObject(obj) + return obj +} + +// getOrNewStateObject retrieves a state object or create a new state object if nil. +func (s *StateDB) getOrNewStateObject(addr common.Address) *stateObject { + stateObject := s.getStateObject(addr) + if stateObject == nil { + stateObject, _ = s.createObject(addr) + } + return stateObject +} + +// createObject creates a new state object. If there is an existing account with +// the given address, it is overwritten and returned as the second return value. +func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject) { + prev = s.getStateObject(addr) + + newobj = newObject(s, addr, Account{}) + if prev == nil { + s.journal.append(createObjectChange{account: &addr}) + } else { + s.journal.append(resetObjectChange{prev: prev}) + } + s.setStateObject(newobj) + if prev != nil { + return newobj, prev + } + return newobj, nil +} + +// CreateAccount explicitly creates a state object. If a state object with the address +// already exists the balance is carried over to the new account. +// +// CreateAccount is called during the EVM CREATE operation. The situation might arise that +// a contract does the following: +// +// 1. sends funds to sha(account ++ (nonce + 1)) +// 2. tx_create(sha(account ++ nonce)) (note that this gets the address of 1) +// +// Carrying over the balance ensures that Ether doesn't disappear. +func (s *StateDB) CreateAccount(addr common.Address) { + newObj, prev := s.createObject(addr) + if prev != nil { + newObj.setBalance(prev.account.Balance) + } +} + +// ForEachStorage iterate the contract storage, the iteration order is not defined. +func (s *StateDB) ForEachStorage(addr common.Address, cb func(key, value common.Hash) bool) error { + so := s.getStateObject(addr) + if so == nil { + return nil + } + s.keeper.ForEachStorage(s.ctx, addr, func(key, value common.Hash) bool { + if value, dirty := so.dirtyStorage[key]; dirty { + return cb(key, value) + } + if len(value) > 0 { + return cb(key, value) + } + return true + }) + return nil +} + +func (s *StateDB) setStateObject(object *stateObject) { + s.stateObjects[object.Address()] = object +} + +/* + * SETTERS + */ + +// AddBalance adds amount to the account associated with addr. +func (s *StateDB) AddBalance(addr common.Address, amount *big.Int) { + stateObject := s.getOrNewStateObject(addr) + if stateObject != nil { + stateObject.AddBalance(amount) + } +} + +// SubBalance subtracts amount from the account associated with addr. +func (s *StateDB) SubBalance(addr common.Address, amount *big.Int) { + stateObject := s.getOrNewStateObject(addr) + if stateObject != nil { + stateObject.SubBalance(amount) + } +} + +// SetNonce sets the nonce of account. +func (s *StateDB) SetNonce(addr common.Address, nonce uint64) { + stateObject := s.getOrNewStateObject(addr) + if stateObject != nil { + stateObject.SetNonce(nonce) + } +} + +// SetCode sets the code of account. +func (s *StateDB) SetCode(addr common.Address, code []byte) { + stateObject := s.getOrNewStateObject(addr) + if stateObject != nil { + stateObject.SetCode(crypto.Keccak256Hash(code), code) + } +} + +// SetState sets the contract state. +func (s *StateDB) SetState(addr common.Address, key, value common.Hash) { + stateObject := s.getOrNewStateObject(addr) + if stateObject != nil { + stateObject.SetState(key, value) + } +} + +// Suicide marks the given account as suicided. +// This clears the account balance. +// +// The account's state object is still available until the state is committed, +// getStateObject will return a non-nil account after Suicide. +func (s *StateDB) Suicide(addr common.Address) bool { + stateObject := s.getStateObject(addr) + if stateObject == nil { + return false + } + s.journal.append(suicideChange{ + account: &addr, + prev: stateObject.suicided, + prevbalance: new(big.Int).Set(stateObject.Balance()), + }) + stateObject.markSuicided() + stateObject.account.Balance = new(big.Int) + + return true +} + +// PrepareAccessList handles the preparatory steps for executing a state transition with +// regards to both EIP-2929 and EIP-2930: +// +// - Add sender to access list (2929) +// - Add destination to access list (2929) +// - Add precompiles to access list (2929) +// - Add the contents of the optional tx access list (2930) +// +// This method should only be called if Yolov3/Berlin/2929+2930 is applicable at the current number. +func (s *StateDB) PrepareAccessList(sender common.Address, dst *common.Address, precompiles []common.Address, list ethtypes.AccessList) { + s.AddAddressToAccessList(sender) + if dst != nil { + s.AddAddressToAccessList(*dst) + // If it's a create-tx, the destination will be added inside evm.create + } + for _, addr := range precompiles { + s.AddAddressToAccessList(addr) + } + for _, el := range list { + s.AddAddressToAccessList(el.Address) + for _, key := range el.StorageKeys { + s.AddSlotToAccessList(el.Address, key) + } + } +} + +// AddAddressToAccessList adds the given address to the access list +func (s *StateDB) AddAddressToAccessList(addr common.Address) { + if s.accessList.AddAddress(addr) { + s.journal.append(accessListAddAccountChange{&addr}) + } +} + +// AddSlotToAccessList adds the given (address, slot)-tuple to the access list +func (s *StateDB) AddSlotToAccessList(addr common.Address, slot common.Hash) { + addrMod, slotMod := s.accessList.AddSlot(addr, slot) + if addrMod { + // In practice, this should not happen, since there is no way to enter the + // scope of 'address' without having the 'address' become already added + // to the access list (via call-variant, create, etc). + // Better safe than sorry, though + s.journal.append(accessListAddAccountChange{&addr}) + } + if slotMod { + s.journal.append(accessListAddSlotChange{ + address: &addr, + slot: &slot, + }) + } +} + +// AddressInAccessList returns true if the given address is in the access list. +func (s *StateDB) AddressInAccessList(addr common.Address) bool { + return s.accessList.ContainsAddress(addr) +} + +// SlotInAccessList returns true if the given (address, slot)-tuple is in the access list. +func (s *StateDB) SlotInAccessList(addr common.Address, slot common.Hash) (addressPresent bool, slotPresent bool) { + return s.accessList.Contains(addr, slot) +} + +// Snapshot returns an identifier for the current revision of the state. +func (s *StateDB) Snapshot() int { + id := s.nextRevisionID + s.nextRevisionID++ + s.validRevisions = append(s.validRevisions, revision{id, s.journal.length()}) + return id +} + +// RevertToSnapshot reverts all state changes made since the given revision. +func (s *StateDB) RevertToSnapshot(revid int) { + // Find the snapshot in the stack of valid snapshots. + idx := sort.Search(len(s.validRevisions), func(i int) bool { + return s.validRevisions[i].id >= revid + }) + if idx == len(s.validRevisions) || s.validRevisions[idx].id != revid { + panic(fmt.Errorf("revision id %v cannot be reverted", revid)) + } + snapshot := s.validRevisions[idx].journalIndex + + // Replay the journal to undo changes and remove invalidated snapshots + s.journal.revert(s, snapshot) + s.validRevisions = s.validRevisions[:idx] +} + +// Commit writes the dirty states to keeper +// the StateDB object should be discarded after committed. +func (s *StateDB) Commit() error { + for _, addr := range s.journal.sortedDirties() { + obj := s.stateObjects[addr] + if obj.suicided { + if err := s.keeper.DeleteAccount(s.ctx, obj.Address()); err != nil { + return sdkerrors.Wrap(err, "failed to delete account") + } + } else { + if obj.code != nil && obj.dirtyCode { + s.keeper.SetCode(s.ctx, obj.CodeHash(), obj.code) + } + if err := s.keeper.SetAccount(s.ctx, obj.Address(), obj.account); err != nil { + return sdkerrors.Wrap(err, "failed to set account") + } + for _, key := range obj.dirtyStorage.SortedKeys() { + value := obj.dirtyStorage[key] + // Skip noop changes, persist actual changes + if value == obj.originStorage[key] { + continue + } + s.keeper.SetState(s.ctx, obj.Address(), key, value.Bytes()) + } + } + } + return nil +} diff --git a/x/evm/types/ERC20Contract.json b/x/evm/types/ERC20Contract.json new file mode 100644 index 00000000..50764e3d --- /dev/null +++ b/x/evm/types/ERC20Contract.json @@ -0,0 +1,4 @@ +{ + "abi": "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialAccount\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialBalance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"TestLog\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"benchmarkLogs\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseApproval\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseApproval\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + "bin": "608060405234801561001057600080fd5b506040516114543803806114548339818101604052604081101561003357600080fd5b810190808051906020019092919080519060200190929190505050806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508060028190555050506113ab806100a96000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80636618846311610066578063661884631461022957806370a082311461028f578063a9059cbb146102e7578063d73dd6231461034d578063dd62ed3e146103b35761009e565b8063095ea7b3146100a357806318160ddd1461010957806323b872dd1461012757806340c10f19146101ad57806357807d7f146101fb575b600080fd5b6100ef600480360360408110156100b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061042b565b604051808215151515815260200191505060405180910390f35b61011161051d565b6040518082815260200191505060405180910390f35b6101936004803603606081101561013d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610527565b604051808215151515815260200191505060405180910390f35b6101f9600480360360408110156101c357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108dc565b005b6102276004803603602081101561021157600080fd5b810190808035906020019092919050505061098e565b005b6102756004803603604081101561023f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a18565b604051808215151515815260200191505060405180910390f35b6102d1600480360360208110156102a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca8565b6040518082815260200191505060405180910390f35b610333600480360360408110156102fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cf0565b604051808215151515815260200191505060405180910390f35b6103996004803603604081101561036357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0c565b604051808215151515815260200191505060405180910390f35b610415600480360360408110156103c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611108565b6040518082815260200191505060405180910390f35b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561057457600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156105fd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561063757600080fd5b610688826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461118f90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061071b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461128390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107ec82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461118f90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b61092d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461128390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109848160025461128390919063ffffffff16565b6002819055505050565b60008090505b81811015610a14577fb2abdf6dca7f5665e93ea2262744f2159b5c45ff1a9dacadb090ceb00c2a302f3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a18080600101915050610994565b5050565b600080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310610b28576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bbc565b610b3b838261118f90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610d3d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d7757600080fd5b610dc8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461118f90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e5b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461128390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000610f9d82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461128390919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000828211156040518060400160405280601281526020017f4d4154485f5355425f554e444552464c4f57000000000000000000000000000081525090611271576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561123657808201518184015260208101905061121b565b50505050905090810190601f1680156112635780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600082840390508091505092915050565b6000808284019050838110156040518060400160405280601181526020017f4d4154485f4144445f4f564552464c4f570000000000000000000000000000008152509061136b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611330578082015181840152602081019050611315565b50505050905090810190601f16801561135d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50809150509291505056fea265627a7a723158201835ad3fdb84f43ad0d79c6875a0f5521dc5110fc373c9f0597547aff6d9971764736f6c63430005110032" +} diff --git a/x/evm/types/SimpleStorageContract.json b/x/evm/types/SimpleStorageContract.json new file mode 100644 index 00000000..4d8bb0af --- /dev/null +++ b/x/evm/types/SimpleStorageContract.json @@ -0,0 +1,4 @@ +{ + "abi": "[\n\t{\n\t\t\"inputs\": [],\n\t\t\"name\": \"get\",\n\t\t\"outputs\": [\n\t\t\t{\n\t\t\t\t\"internalType\": \"uint160\",\n\t\t\t\t\"name\": \"\",\n\t\t\t\t\"type\": \"uint160\"\n\t\t\t}\n\t\t],\n\t\t\"stateMutability\": \"view\",\n\t\t\"type\": \"function\"\n\t},\n\t{\n\t\t\"inputs\": [\n\t\t\t{\n\t\t\t\t\"internalType\": \"uint160\",\n\t\t\t\t\"name\": \"input\",\n\t\t\t\t\"type\": \"uint160\"\n\t\t\t}\n\t\t],\n\t\t\"name\": \"store\",\n\t\t\"outputs\": [],\n\t\t\"stateMutability\": \"nonpayable\",\n\t\t\"type\": \"function\"\n\t}\n]", + "bin": "608060405234801561001057600080fd5b506101bf806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80636d4ce63c1461003b578063d04ad49514610059575b600080fd5b610043610075565b6040516100509190610132565b60405180910390f35b610073600480360381019061006e91906100f6565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000813590506100f081610172565b92915050565b60006020828403121561010c5761010b61016d565b5b600061011a848285016100e1565b91505092915050565b61012c8161014d565b82525050565b60006020820190506101476000830184610123565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b61017b8161014d565b811461018657600080fd5b5056fea26469706673582212204c98c8f28598d29acc328cb34578de54cbed70b20bf9364897d48b2381f0c78b64736f6c63430008070033" +} diff --git a/x/evm/types/TestMessageCall.json b/x/evm/types/TestMessageCall.json new file mode 100644 index 00000000..616ae16a --- /dev/null +++ b/x/evm/types/TestMessageCall.json @@ -0,0 +1,4 @@ +{ + "abi": "[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"iterations\",\"type\":\"uint256\"}],\"name\":\"benchmarkMessageCall\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + "bin": "608060405234801561001057600080fd5b5060405161001d9061007e565b604051809103906000f080158015610039573d6000803e3d6000fd5b506000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061008a565b60dd8061021483390190565b61017b806100996000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806376e489f014610030575b600080fd5b61005c6004803603602081101561004657600080fd5b8101908080359060200190929190505050610072565b6040518082815260200191505060405180910390f35b6000806000905060008090505b8381101561013c576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8a8fd6d6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156100f057600080fd5b505af1158015610104573d6000803e3d6000fd5b505050506040513d602081101561011a57600080fd5b810190808051906020019092919050505082019150808060010191505061007f565b508091505091905056fea265627a7a723158203bb5ea1d2b128eb07e834f8b4cab93aab73270ef20cb80c1d5e0e2ee4f10b7c264736f6c634300051100326080604052348015600f57600080fd5b5060bf8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063f8a8fd6d14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b60007f1440c4dd67b4344ea1905ec0318995133b550f168b4ee959a0da6b503d7d2414602a6040518082815260200191505060405180910390a1602a90509056fea265627a7a723158209236549244199cceaef9525385c8b6fccaf6390440ece080e2046d9f4a0035f564736f6c63430005110032" +} diff --git a/x/evm/types/access_list.go b/x/evm/types/access_list.go new file mode 100644 index 00000000..7ebc63fd --- /dev/null +++ b/x/evm/types/access_list.go @@ -0,0 +1,55 @@ +package types + +import ( + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// AccessList is an EIP-2930 access list that represents the slice of +// the protobuf AccessTuples. +type AccessList []AccessTuple + +// NewAccessList creates a new protobuf-compatible AccessList from an ethereum +// core AccessList type +func NewAccessList(ethAccessList *ethtypes.AccessList) AccessList { + if ethAccessList == nil { + return nil + } + + al := AccessList{} + for _, tuple := range *ethAccessList { + storageKeys := make([]string, len(tuple.StorageKeys)) + + for i := range tuple.StorageKeys { + storageKeys[i] = tuple.StorageKeys[i].String() + } + + al = append(al, AccessTuple{ + Address: tuple.Address.String(), + StorageKeys: storageKeys, + }) + } + + return al +} + +// ToEthAccessList is an utility function to convert the protobuf compatible +// AccessList to eth core AccessList from go-ethereum +func (al AccessList) ToEthAccessList() *ethtypes.AccessList { + var ethAccessList ethtypes.AccessList + + for _, tuple := range al { + storageKeys := make([]common.Hash, len(tuple.StorageKeys)) + + for i := range tuple.StorageKeys { + storageKeys[i] = common.HexToHash(tuple.StorageKeys[i]) + } + + ethAccessList = append(ethAccessList, ethtypes.AccessTuple{ + Address: common.HexToAddress(tuple.Address), + StorageKeys: storageKeys, + }) + } + + return ðAccessList +} diff --git a/x/evm/types/access_list_tx.go b/x/evm/types/access_list_tx.go new file mode 100644 index 00000000..103777e7 --- /dev/null +++ b/x/evm/types/access_list_tx.go @@ -0,0 +1,243 @@ +package types + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/stratosnet/stratos-chain/types" +) + +func newAccessListTx(tx *ethtypes.Transaction) (*AccessListTx, error) { + txData := &AccessListTx{ + Nonce: tx.Nonce(), + Data: tx.Data(), + GasLimit: tx.Gas(), + } + + v, r, s := tx.RawSignatureValues() + if to := tx.To(); to != nil { + txData.To = to.Hex() + } + + if tx.Value() != nil { + amountInt, err := SafeNewIntFromBigInt(tx.Value()) + if err != nil { + return nil, err + } + txData.Amount = &amountInt + } + + if tx.GasPrice() != nil { + gasPriceInt, err := SafeNewIntFromBigInt(tx.GasPrice()) + if err != nil { + return nil, err + } + txData.GasPrice = &gasPriceInt + } + + if tx.AccessList() != nil { + al := tx.AccessList() + txData.Accesses = NewAccessList(&al) + } + + txData.SetSignatureValues(tx.ChainId(), v, r, s) + return txData, nil +} + +// TxType returns the tx type +func (tx *AccessListTx) TxType() uint8 { + return ethtypes.AccessListTxType +} + +// Copy returns an instance with the same field values +func (tx *AccessListTx) Copy() TxData { + return &AccessListTx{ + ChainID: tx.ChainID, + Nonce: tx.Nonce, + GasPrice: tx.GasPrice, + GasLimit: tx.GasLimit, + To: tx.To, + Amount: tx.Amount, + Data: common.CopyBytes(tx.Data), + Accesses: tx.Accesses, + V: common.CopyBytes(tx.V), + R: common.CopyBytes(tx.R), + S: common.CopyBytes(tx.S), + } +} + +// GetChainID returns the chain id field from the AccessListTx +func (tx *AccessListTx) GetChainID() *big.Int { + if tx.ChainID == nil { + return nil + } + + return tx.ChainID.BigInt() +} + +// GetAccessList returns the AccessList field. +func (tx *AccessListTx) GetAccessList() ethtypes.AccessList { + if tx.Accesses == nil { + return nil + } + return *tx.Accesses.ToEthAccessList() +} + +// GetData returns the a copy of the input data bytes. +func (tx *AccessListTx) GetData() []byte { + return common.CopyBytes(tx.Data) +} + +// GetGas returns the gas limit. +func (tx *AccessListTx) GetGas() uint64 { + return tx.GasLimit +} + +// GetGasPrice returns the gas price field. +func (tx *AccessListTx) GetGasPrice() *big.Int { + if tx.GasPrice == nil { + return nil + } + return tx.GasPrice.BigInt() +} + +// GetGasTipCap returns the gas price field. +func (tx *AccessListTx) GetGasTipCap() *big.Int { + return tx.GetGasPrice() +} + +// GetGasFeeCap returns the gas price field. +func (tx *AccessListTx) GetGasFeeCap() *big.Int { + return tx.GetGasPrice() +} + +// GetValue returns the tx amount. +func (tx *AccessListTx) GetValue() *big.Int { + if tx.Amount == nil { + return nil + } + + return tx.Amount.BigInt() +} + +// GetNonce returns the account sequence for the transaction. +func (tx *AccessListTx) GetNonce() uint64 { return tx.Nonce } + +// GetTo returns the pointer to the recipient address. +func (tx *AccessListTx) GetTo() *common.Address { + if tx.To == "" { + return nil + } + to := common.HexToAddress(tx.To) + return &to +} + +// AsEthereumData returns an AccessListTx transaction tx from the proto-formatted +// TxData defined on the Cosmos EVM. +func (tx *AccessListTx) AsEthereumData() ethtypes.TxData { + v, r, s := tx.GetRawSignatureValues() + return ðtypes.AccessListTx{ + ChainID: tx.GetChainID(), + Nonce: tx.GetNonce(), + GasPrice: tx.GetGasPrice(), + Gas: tx.GetGas(), + To: tx.GetTo(), + Value: tx.GetValue(), + Data: tx.GetData(), + AccessList: tx.GetAccessList(), + V: v, + R: r, + S: s, + } +} + +// GetRawSignatureValues returns the V, R, S signature values of the transaction. +// The return values should not be modified by the caller. +func (tx *AccessListTx) GetRawSignatureValues() (v, r, s *big.Int) { + return rawSignatureValues(tx.V, tx.R, tx.S) +} + +// SetSignatureValues sets the signature values to the transaction. +func (tx *AccessListTx) SetSignatureValues(chainID, v, r, s *big.Int) { + if v != nil { + tx.V = v.Bytes() + } + if r != nil { + tx.R = r.Bytes() + } + if s != nil { + tx.S = s.Bytes() + } + if chainID != nil { + chainIDInt := sdk.NewIntFromBigInt(chainID) + tx.ChainID = &chainIDInt + } +} + +// Validate performs a stateless validation of the tx fields. +func (tx AccessListTx) Validate() error { + gasPrice := tx.GetGasPrice() + if gasPrice == nil { + return sdkerrors.Wrap(ErrInvalidGasPrice, "cannot be nil") + } + if !IsValidInt256(gasPrice) { + return sdkerrors.Wrap(ErrInvalidGasPrice, "out of bound") + } + + if gasPrice.Sign() == -1 { + return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice) + } + + amount := tx.GetValue() + // Amount can be 0 + if amount != nil && amount.Sign() == -1 { + return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) + } + if !IsValidInt256(amount) { + return sdkerrors.Wrap(ErrInvalidAmount, "out of bound") + } + + if !IsValidInt256(tx.Fee()) { + return sdkerrors.Wrap(ErrInvalidGasFee, "out of bound") + } + + if tx.To != "" { + if err := types.ValidateAddress(tx.To); err != nil { + return sdkerrors.Wrap(err, "invalid to address") + } + } + + if tx.GetChainID() == nil { + return sdkerrors.Wrap( + sdkerrors.ErrInvalidChainID, + "chain ID must be present on AccessList txs", + ) + } + + return nil +} + +// Fee returns gasprice * gaslimit. +func (tx AccessListTx) Fee() *big.Int { + return fee(tx.GetGasPrice(), tx.GetGas()) +} + +// Cost returns amount + gasprice * gaslimit. +func (tx AccessListTx) Cost() *big.Int { + return cost(tx.Fee(), tx.GetValue()) +} + +// EffectiveFee is the same as Fee for AccessListTx +func (tx AccessListTx) EffectiveFee(baseFee *big.Int) *big.Int { + return tx.Fee() +} + +// EffectiveCost is the same as Cost for AccessListTx +func (tx AccessListTx) EffectiveCost(baseFee *big.Int) *big.Int { + return tx.Cost() +} diff --git a/x/evm/types/chain_config.go b/x/evm/types/chain_config.go new file mode 100644 index 00000000..fbc0288f --- /dev/null +++ b/x/evm/types/chain_config.go @@ -0,0 +1,163 @@ +package types + +import ( + "math/big" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/params" +) + +// EthereumConfig returns an Ethereum ChainConfig for EVM state transitions. +// All the negative or nil values are converted to nil +func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { + return ¶ms.ChainConfig{ + ChainID: chainID, + HomesteadBlock: getBlockValue(cc.HomesteadBlock), + DAOForkBlock: getBlockValue(cc.DAOForkBlock), + DAOForkSupport: cc.DAOForkSupport, + EIP150Block: getBlockValue(cc.EIP150Block), + EIP150Hash: common.HexToHash(cc.EIP150Hash), + EIP155Block: getBlockValue(cc.EIP155Block), + EIP158Block: getBlockValue(cc.EIP158Block), + ByzantiumBlock: getBlockValue(cc.ByzantiumBlock), + ConstantinopleBlock: getBlockValue(cc.ConstantinopleBlock), + PetersburgBlock: getBlockValue(cc.PetersburgBlock), + IstanbulBlock: getBlockValue(cc.IstanbulBlock), + MuirGlacierBlock: getBlockValue(cc.MuirGlacierBlock), + BerlinBlock: getBlockValue(cc.BerlinBlock), + LondonBlock: getBlockValue(cc.LondonBlock), + ArrowGlacierBlock: getBlockValue(cc.ArrowGlacierBlock), + MergeForkBlock: getBlockValue(cc.MergeForkBlock), + TerminalTotalDifficulty: nil, + Ethash: nil, + Clique: nil, + } +} + +// DefaultChainConfig returns default evm parameters. +func DefaultChainConfig() ChainConfig { + homesteadBlock := sdk.ZeroInt() + daoForkBlock := sdk.ZeroInt() + eip150Block := sdk.ZeroInt() + eip155Block := sdk.ZeroInt() + eip158Block := sdk.ZeroInt() + byzantiumBlock := sdk.ZeroInt() + constantinopleBlock := sdk.ZeroInt() + petersburgBlock := sdk.ZeroInt() + istanbulBlock := sdk.ZeroInt() + muirGlacierBlock := sdk.ZeroInt() + berlinBlock := sdk.ZeroInt() + londonBlock := sdk.ZeroInt() + arrowGlacierBlock := sdk.ZeroInt() + mergeForkBlock := sdk.ZeroInt() + + return ChainConfig{ + HomesteadBlock: &homesteadBlock, + DAOForkBlock: &daoForkBlock, + DAOForkSupport: true, + EIP150Block: &eip150Block, + EIP150Hash: common.Hash{}.String(), + EIP155Block: &eip155Block, + EIP158Block: &eip158Block, + ByzantiumBlock: &byzantiumBlock, + ConstantinopleBlock: &constantinopleBlock, + PetersburgBlock: &petersburgBlock, + IstanbulBlock: &istanbulBlock, + MuirGlacierBlock: &muirGlacierBlock, + BerlinBlock: &berlinBlock, + LondonBlock: &londonBlock, + ArrowGlacierBlock: &arrowGlacierBlock, + MergeForkBlock: &mergeForkBlock, + } +} + +func getBlockValue(block *sdk.Int) *big.Int { + if block == nil || block.IsNegative() { + return nil + } + + return block.BigInt() +} + +// Validate performs a basic validation of the ChainConfig params. The function will return an error +// if any of the block values is uninitialized (i.e nil) or if the EIP150Hash is an invalid hash. +func (cc ChainConfig) Validate() error { + if err := validateBlock(cc.HomesteadBlock); err != nil { + return sdkerrors.Wrap(err, "homesteadBlock") + } + if err := validateBlock(cc.DAOForkBlock); err != nil { + return sdkerrors.Wrap(err, "daoForkBlock") + } + if err := validateBlock(cc.EIP150Block); err != nil { + return sdkerrors.Wrap(err, "eip150Block") + } + if err := validateHash(cc.EIP150Hash); err != nil { + return err + } + if err := validateBlock(cc.EIP155Block); err != nil { + return sdkerrors.Wrap(err, "eip155Block") + } + if err := validateBlock(cc.EIP158Block); err != nil { + return sdkerrors.Wrap(err, "eip158Block") + } + if err := validateBlock(cc.ByzantiumBlock); err != nil { + return sdkerrors.Wrap(err, "byzantiumBlock") + } + if err := validateBlock(cc.ConstantinopleBlock); err != nil { + return sdkerrors.Wrap(err, "constantinopleBlock") + } + if err := validateBlock(cc.PetersburgBlock); err != nil { + return sdkerrors.Wrap(err, "petersburgBlock") + } + if err := validateBlock(cc.IstanbulBlock); err != nil { + return sdkerrors.Wrap(err, "istanbulBlock") + } + if err := validateBlock(cc.MuirGlacierBlock); err != nil { + return sdkerrors.Wrap(err, "muirGlacierBlock") + } + if err := validateBlock(cc.BerlinBlock); err != nil { + return sdkerrors.Wrap(err, "berlinBlock") + } + if err := validateBlock(cc.LondonBlock); err != nil { + return sdkerrors.Wrap(err, "londonBlock") + } + if err := validateBlock(cc.ArrowGlacierBlock); err != nil { + return sdkerrors.Wrap(err, "arrowGlacierBlock") + } + if err := validateBlock(cc.MergeForkBlock); err != nil { + return sdkerrors.Wrap(err, "mergeForkBlock") + } + + // NOTE: chain ID is not needed to check config order + if err := cc.EthereumConfig(nil).CheckConfigForkOrder(); err != nil { + return sdkerrors.Wrap(err, "invalid config fork order") + } + return nil +} + +func validateHash(hex string) error { + if hex != "" && strings.TrimSpace(hex) == "" { + return sdkerrors.Wrap(ErrInvalidChainConfig, "hash cannot be blank") + } + + return nil +} + +func validateBlock(block *sdk.Int) error { + // nil value means that the fork has not yet been applied + if block == nil { + return nil + } + + if block.IsNegative() { + return sdkerrors.Wrapf( + ErrInvalidChainConfig, "block value cannot be negative: %s", block, + ) + } + + return nil +} diff --git a/x/evm/types/codec.go b/x/evm/types/codec.go new file mode 100644 index 00000000..0e0af3cd --- /dev/null +++ b/x/evm/types/codec.go @@ -0,0 +1,70 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/gogo/protobuf/proto" +) + +var ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + +type ( + ExtensionOptionsEthereumTxI interface{} +) + +// RegisterInterfaces registers the client interfaces to protobuf Any. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgEthereumTx{}, + ) + registry.RegisterInterface( + "stratos.evm.v1.ExtensionOptionsEthereumTx", + (*ExtensionOptionsEthereumTxI)(nil), + &ExtensionOptionsEthereumTx{}, + ) + registry.RegisterInterface( + "stratos.evm.v1.TxData", + (*TxData)(nil), + &DynamicFeeTx{}, + &AccessListTx{}, + &LegacyTx{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +// PackClientState constructs a new Any packed with the given tx data value. It returns +// an error if the client state can't be casted to a protobuf message or if the concrete +// implemention is not registered to the protobuf codec. +func PackTxData(txData TxData) (*codectypes.Any, error) { + msg, ok := txData.(proto.Message) + if !ok { + return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", txData) + } + + anyTxData, err := codectypes.NewAnyWithValue(msg) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrPackAny, err.Error()) + } + + return anyTxData, nil +} + +// UnpackTxData unpacks an Any into a TxData. It returns an error if the +// client state can't be unpacked into a TxData. +func UnpackTxData(any *codectypes.Any) (TxData, error) { + if any == nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnpackAny, "protobuf Any message cannot be nil") + } + + txData, ok := any.GetCachedValue().(TxData) + if !ok { + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnpackAny, "cannot unpack Any into TxData %T", any) + } + + return txData, nil +} diff --git a/x/evm/types/compiled_contract.go b/x/evm/types/compiled_contract.go new file mode 100644 index 00000000..081d815b --- /dev/null +++ b/x/evm/types/compiled_contract.go @@ -0,0 +1,117 @@ +package types + +import ( + // embed compiled smart contract + _ "embed" + "encoding/hex" + "encoding/json" + "fmt" + + "github.com/ethereum/go-ethereum/accounts/abi" +) + +// HexString is a byte array that serializes to hex +type HexString []byte + +// MarshalJSON serializes ByteArray to hex +func (s HexString) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("%x", string(s))) +} + +// UnmarshalJSON deserializes ByteArray to hex +func (s *HexString) UnmarshalJSON(data []byte) error { + var x string + if err := json.Unmarshal(data, &x); err != nil { + return err + } + str, err := hex.DecodeString(x) + if err != nil { + return err + } + *s = str + return nil +} + +// CompiledContract contains compiled bytecode and abi +type CompiledContract struct { + ABI abi.ABI + Bin HexString +} + +type jsonCompiledContract struct { + ABI string + Bin HexString +} + +// MarshalJSON serializes ByteArray to hex +func (s CompiledContract) MarshalJSON() ([]byte, error) { + abi1, err := json.Marshal(s.ABI) + if err != nil { + return nil, err + } + return json.Marshal(jsonCompiledContract{ABI: string(abi1), Bin: s.Bin}) +} + +// UnmarshalJSON deserializes ByteArray to hex +func (s *CompiledContract) UnmarshalJSON(data []byte) error { + var x jsonCompiledContract + if err := json.Unmarshal(data, &x); err != nil { + return err + } + + s.Bin = x.Bin + if err := json.Unmarshal([]byte(x.ABI), &s.ABI); err != nil { + return fmt.Errorf("failed to unmarshal ABI: %w", err) + } + + return nil +} + +var ( + //go:embed ERC20Contract.json + erc20JSON []byte + + // ERC20Contract is the compiled test erc20 contract + ERC20Contract CompiledContract + + //go:embed SimpleStorageContract.json + simpleStorageJSON []byte + + // SimpleStorageContract is the compiled test simple storage contract + SimpleStorageContract CompiledContract + + //go:embed TestMessageCall.json + testMessageCallJSON []byte + + // TestMessageCall is the compiled message call benchmark contract + TestMessageCall CompiledContract +) + +func init() { + err := json.Unmarshal(erc20JSON, &ERC20Contract) + if err != nil { + panic(err) + } + + if len(ERC20Contract.Bin) == 0 { + panic("load contract failed") + } + + err = json.Unmarshal(testMessageCallJSON, &TestMessageCall) + if err != nil { + panic(err) + } + + if len(TestMessageCall.Bin) == 0 { + panic("load contract failed") + } + + err = json.Unmarshal(simpleStorageJSON, &SimpleStorageContract) + if err != nil { + panic(err) + } + + if len(TestMessageCall.Bin) == 0 { + panic("load contract failed") + } +} diff --git a/x/evm/types/config.go b/x/evm/types/config.go new file mode 100644 index 00000000..338f630a --- /dev/null +++ b/x/evm/types/config.go @@ -0,0 +1,17 @@ +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/params" +) + +// EVMConfig encapulates common parameters needed to create an EVM to execute a message +// It's mainly to reduce the number of method parameters +type EVMConfig struct { + Params Params + ChainConfig *params.ChainConfig + CoinBase common.Address + BaseFee *big.Int +} diff --git a/x/evm/types/dynamic_fee_tx.go b/x/evm/types/dynamic_fee_tx.go new file mode 100644 index 00000000..7f51a48d --- /dev/null +++ b/x/evm/types/dynamic_fee_tx.go @@ -0,0 +1,281 @@ +package types + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/math" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/stratosnet/stratos-chain/types" +) + +func newDynamicFeeTx(tx *ethtypes.Transaction) (*DynamicFeeTx, error) { + txData := &DynamicFeeTx{ + Nonce: tx.Nonce(), + Data: tx.Data(), + GasLimit: tx.Gas(), + } + + v, r, s := tx.RawSignatureValues() + if to := tx.To(); to != nil { + txData.To = to.Hex() + } + + if tx.Value() != nil { + amountInt, err := SafeNewIntFromBigInt(tx.Value()) + if err != nil { + return nil, err + } + txData.Amount = &amountInt + } + + if tx.GasFeeCap() != nil { + gasFeeCapInt, err := SafeNewIntFromBigInt(tx.GasFeeCap()) + if err != nil { + return nil, err + } + txData.GasFeeCap = &gasFeeCapInt + } + + if tx.GasTipCap() != nil { + gasTipCapInt, err := SafeNewIntFromBigInt(tx.GasTipCap()) + if err != nil { + return nil, err + } + txData.GasTipCap = &gasTipCapInt + } + + if tx.AccessList() != nil { + al := tx.AccessList() + txData.Accesses = NewAccessList(&al) + } + + txData.SetSignatureValues(tx.ChainId(), v, r, s) + return txData, nil +} + +// TxType returns the tx type +func (tx *DynamicFeeTx) TxType() uint8 { + return ethtypes.DynamicFeeTxType +} + +// Copy returns an instance with the same field values +func (tx *DynamicFeeTx) Copy() TxData { + return &DynamicFeeTx{ + ChainID: tx.ChainID, + Nonce: tx.Nonce, + GasTipCap: tx.GasTipCap, + GasFeeCap: tx.GasFeeCap, + GasLimit: tx.GasLimit, + To: tx.To, + Amount: tx.Amount, + Data: common.CopyBytes(tx.Data), + Accesses: tx.Accesses, + V: common.CopyBytes(tx.V), + R: common.CopyBytes(tx.R), + S: common.CopyBytes(tx.S), + } +} + +// GetChainID returns the chain id field from the DynamicFeeTx +func (tx *DynamicFeeTx) GetChainID() *big.Int { + if tx.ChainID == nil { + return nil + } + + return tx.ChainID.BigInt() +} + +// GetAccessList returns the AccessList field. +func (tx *DynamicFeeTx) GetAccessList() ethtypes.AccessList { + if tx.Accesses == nil { + return nil + } + return *tx.Accesses.ToEthAccessList() +} + +// GetData returns the a copy of the input data bytes. +func (tx *DynamicFeeTx) GetData() []byte { + return common.CopyBytes(tx.Data) +} + +// GetGas returns the gas limit. +func (tx *DynamicFeeTx) GetGas() uint64 { + return tx.GasLimit +} + +// GetGasPrice returns the gas fee cap field. +func (tx *DynamicFeeTx) GetGasPrice() *big.Int { + return tx.GetGasFeeCap() +} + +// GetGasTipCap returns the gas tip cap field. +func (tx *DynamicFeeTx) GetGasTipCap() *big.Int { + if tx.GasTipCap == nil { + return nil + } + return tx.GasTipCap.BigInt() +} + +// GetGasFeeCap returns the gas fee cap field. +func (tx *DynamicFeeTx) GetGasFeeCap() *big.Int { + if tx.GasFeeCap == nil { + return nil + } + return tx.GasFeeCap.BigInt() +} + +// GetValue returns the tx amount. +func (tx *DynamicFeeTx) GetValue() *big.Int { + if tx.Amount == nil { + return nil + } + + return tx.Amount.BigInt() +} + +// GetNonce returns the account sequence for the transaction. +func (tx *DynamicFeeTx) GetNonce() uint64 { return tx.Nonce } + +// GetTo returns the pointer to the recipient address. +func (tx *DynamicFeeTx) GetTo() *common.Address { + if tx.To == "" { + return nil + } + to := common.HexToAddress(tx.To) + return &to +} + +// AsEthereumData returns an DynamicFeeTx transaction tx from the proto-formatted +// TxData defined on the Cosmos EVM. +func (tx *DynamicFeeTx) AsEthereumData() ethtypes.TxData { + v, r, s := tx.GetRawSignatureValues() + return ðtypes.DynamicFeeTx{ + ChainID: tx.GetChainID(), + Nonce: tx.GetNonce(), + GasTipCap: tx.GetGasTipCap(), + GasFeeCap: tx.GetGasFeeCap(), + Gas: tx.GetGas(), + To: tx.GetTo(), + Value: tx.GetValue(), + Data: tx.GetData(), + AccessList: tx.GetAccessList(), + V: v, + R: r, + S: s, + } +} + +// GetRawSignatureValues returns the V, R, S signature values of the transaction. +// The return values should not be modified by the caller. +func (tx *DynamicFeeTx) GetRawSignatureValues() (v, r, s *big.Int) { + return rawSignatureValues(tx.V, tx.R, tx.S) +} + +// SetSignatureValues sets the signature values to the transaction. +func (tx *DynamicFeeTx) SetSignatureValues(chainID, v, r, s *big.Int) { + if v != nil { + tx.V = v.Bytes() + } + if r != nil { + tx.R = r.Bytes() + } + if s != nil { + tx.S = s.Bytes() + } + if chainID != nil { + chainIDInt := sdk.NewIntFromBigInt(chainID) + tx.ChainID = &chainIDInt + } +} + +// Validate performs a stateless validation of the tx fields. +func (tx DynamicFeeTx) Validate() error { + if tx.GasTipCap == nil { + return sdkerrors.Wrap(ErrInvalidGasCap, "gas tip cap cannot nil") + } + + if tx.GasFeeCap == nil { + return sdkerrors.Wrap(ErrInvalidGasCap, "gas fee cap cannot nil") + } + + if tx.GasTipCap.IsNegative() { + return sdkerrors.Wrapf(ErrInvalidGasCap, "gas tip cap cannot be negative %s", tx.GasTipCap) + } + + if tx.GasFeeCap.IsNegative() { + return sdkerrors.Wrapf(ErrInvalidGasCap, "gas fee cap cannot be negative %s", tx.GasFeeCap) + } + + if !IsValidInt256(tx.GetGasTipCap()) { + return sdkerrors.Wrap(ErrInvalidGasCap, "out of bound") + } + + if !IsValidInt256(tx.GetGasFeeCap()) { + return sdkerrors.Wrap(ErrInvalidGasCap, "out of bound") + } + + if tx.GasFeeCap.LT(*tx.GasTipCap) { + return sdkerrors.Wrapf( + ErrInvalidGasCap, "max priority fee per gas higher than max fee per gas (%s > %s)", + tx.GasTipCap, tx.GasFeeCap, + ) + } + + if !IsValidInt256(tx.Fee()) { + return sdkerrors.Wrap(ErrInvalidGasFee, "out of bound") + } + + amount := tx.GetValue() + // Amount can be 0 + if amount != nil && amount.Sign() == -1 { + return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) + } + if !IsValidInt256(amount) { + return sdkerrors.Wrap(ErrInvalidAmount, "out of bound") + } + + if tx.To != "" { + if err := types.ValidateAddress(tx.To); err != nil { + return sdkerrors.Wrap(err, "invalid to address") + } + } + + if tx.GetChainID() == nil { + return sdkerrors.Wrap( + sdkerrors.ErrInvalidChainID, + "chain ID must be present on AccessList txs", + ) + } + + return nil +} + +// Fee returns gasprice * gaslimit. +func (tx DynamicFeeTx) Fee() *big.Int { + return fee(tx.GetGasFeeCap(), tx.GasLimit) +} + +// Cost returns amount + gasprice * gaslimit. +func (tx DynamicFeeTx) Cost() *big.Int { + return cost(tx.Fee(), tx.GetValue()) +} + +// GetEffectiveGasPrice returns the effective gas price +func (tx *DynamicFeeTx) GetEffectiveGasPrice(baseFee *big.Int) *big.Int { + return math.BigMin(new(big.Int).Add(tx.GasTipCap.BigInt(), baseFee), tx.GasFeeCap.BigInt()) +} + +// EffectiveFee returns effective_gasprice * gaslimit. +func (tx DynamicFeeTx) EffectiveFee(baseFee *big.Int) *big.Int { + return fee(tx.GetEffectiveGasPrice(baseFee), tx.GasLimit) +} + +// EffectiveCost returns amount + effective_gasprice * gaslimit. +func (tx DynamicFeeTx) EffectiveCost(baseFee *big.Int) *big.Int { + return cost(tx.EffectiveFee(baseFee), tx.GetValue()) +} diff --git a/x/evm/types/errors.go b/x/evm/types/errors.go new file mode 100644 index 00000000..4d6d1250 --- /dev/null +++ b/x/evm/types/errors.go @@ -0,0 +1,133 @@ +package types + +import ( + "errors" + "fmt" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/vm" +) + +const ( + codeErrInvalidState = uint32(iota) + 2 // NOTE: code 1 is reserved for internal errors + codeErrExecutionReverted // IMPORTANT: Do not move this error as it complies with the JSON-RPC error standard + codeErrChainConfigNotFound + codeErrInvalidChainConfig + codeErrZeroAddress + codeErrEmptyHash + codeErrBloomNotFound + codeErrTxReceiptNotFound + codeErrCreateDisabled + codeErrCallDisabled + codeErrInvalidAmount + codeErrInvalidGasPrice + codeErrInvalidGasFee + codeErrVMExecution + codeErrInvalidRefund + codeErrInconsistentGas + codeErrInvalidGasCap + codeErrInvalidBaseFee + codeErrGasOverflow + codeErrInvalidAccount +) + +var ErrPostTxProcessing = errors.New("failed to execute post processing") + +var ( + // ErrInvalidState returns an error resulting from an invalid Storage State. + ErrInvalidState = sdkerrors.Register(ModuleName, codeErrInvalidState, "invalid storage state") + + // ErrExecutionReverted returns an error resulting from an error in EVM execution. + ErrExecutionReverted = sdkerrors.Register(ModuleName, codeErrExecutionReverted, vm.ErrExecutionReverted.Error()) + + // ErrChainConfigNotFound returns an error if the chain config cannot be found on the store. + ErrChainConfigNotFound = sdkerrors.Register(ModuleName, codeErrChainConfigNotFound, "chain configuration not found") + + // ErrInvalidChainConfig returns an error resulting from an invalid ChainConfig. + ErrInvalidChainConfig = sdkerrors.Register(ModuleName, codeErrInvalidChainConfig, "invalid chain configuration") + + // ErrZeroAddress returns an error resulting from an zero (empty) ethereum Address. + ErrZeroAddress = sdkerrors.Register(ModuleName, codeErrZeroAddress, "invalid zero address") + + // ErrEmptyHash returns an error resulting from an empty ethereum Hash. + ErrEmptyHash = sdkerrors.Register(ModuleName, codeErrEmptyHash, "empty hash") + + // ErrBloomNotFound returns an error if the block bloom cannot be found on the store. + ErrBloomNotFound = sdkerrors.Register(ModuleName, codeErrBloomNotFound, "block bloom not found") + + // ErrTxReceiptNotFound returns an error if the transaction receipt could not be found + ErrTxReceiptNotFound = sdkerrors.Register(ModuleName, codeErrTxReceiptNotFound, "transaction receipt not found") + + // ErrCreateDisabled returns an error if the EnableCreate parameter is false. + ErrCreateDisabled = sdkerrors.Register(ModuleName, codeErrCreateDisabled, "EVM Create operation is disabled") + + // ErrCallDisabled returns an error if the EnableCall parameter is false. + ErrCallDisabled = sdkerrors.Register(ModuleName, codeErrCallDisabled, "EVM Call operation is disabled") + + // ErrInvalidAmount returns an error if a tx contains an invalid amount. + ErrInvalidAmount = sdkerrors.Register(ModuleName, codeErrInvalidAmount, "invalid transaction amount") + + // ErrInvalidGasPrice returns an error if an invalid gas price is provided to the tx. + ErrInvalidGasPrice = sdkerrors.Register(ModuleName, codeErrInvalidGasPrice, "invalid gas price") + + // ErrInvalidGasFee returns an error if the tx gas fee is out of bound. + ErrInvalidGasFee = sdkerrors.Register(ModuleName, codeErrInvalidGasFee, "invalid gas fee") + + // ErrVMExecution returns an error resulting from an error in EVM execution. + ErrVMExecution = sdkerrors.Register(ModuleName, codeErrVMExecution, "evm transaction execution failed") + + // ErrInvalidRefund returns an error if a the gas refund value is invalid. + ErrInvalidRefund = sdkerrors.Register(ModuleName, codeErrInvalidRefund, "invalid gas refund amount") + + // ErrInconsistentGas returns an error if a the gas differs from the expected one. + ErrInconsistentGas = sdkerrors.Register(ModuleName, codeErrInconsistentGas, "inconsistent gas") + + // ErrInvalidGasCap returns an error if a the gas cap value is negative or invalid + ErrInvalidGasCap = sdkerrors.Register(ModuleName, codeErrInvalidGasCap, "invalid gas cap") + + // ErrInvalidBaseFee returns an error if a the base fee cap value is invalid + ErrInvalidBaseFee = sdkerrors.Register(ModuleName, codeErrInvalidBaseFee, "invalid base fee") + + // ErrGasOverflow returns an error if gas computation overlow/underflow + ErrGasOverflow = sdkerrors.Register(ModuleName, codeErrGasOverflow, "gas computation overflow/underflow") + + // ErrInvalidAccount returns an error if the account is not an EVM compatible account + ErrInvalidAccount = sdkerrors.Register(ModuleName, codeErrInvalidAccount, "account type is not a valid ethereum account") +) + +// NewExecErrorWithReason unpacks the revert return bytes and returns a wrapped error +// with the return reason. +func NewExecErrorWithReason(revertReason []byte) *RevertError { + result := common.CopyBytes(revertReason) + reason, errUnpack := abi.UnpackRevert(result) + err := errors.New("execution reverted") + if errUnpack == nil { + err = fmt.Errorf("execution reverted: %v", reason) + } + return &RevertError{ + error: err, + reason: hexutil.Encode(result), + } +} + +// RevertError is an API error that encompass an EVM revert with JSON error +// code and a binary data blob. +type RevertError struct { + error + reason string // revert reason hex encoded +} + +// ErrorCode returns the JSON error code for a revert. +// See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal +func (e *RevertError) ErrorCode() int { + return 3 +} + +// ErrorData returns the hex encoded revert reason. +func (e *RevertError) ErrorData() interface{} { + return e.reason +} diff --git a/x/evm/types/events.go b/x/evm/types/events.go new file mode 100644 index 00000000..ddccb98b --- /dev/null +++ b/x/evm/types/events.go @@ -0,0 +1,27 @@ +package types + +// Evm module events +const ( + EventTypeEthereumTx = TypeMsgEthereumTx + EventTypeBlockBloom = "block_bloom" + EventTypeTxLog = "tx_log" + + AttributeKeyContractAddress = "contract" + AttributeKeyRecipient = "recipient" + AttributeKeyTxHash = "txHash" + AttributeKeyEthereumTxHash = "ethereumTxHash" + AttributeKeyTxIndex = "txIndex" + AttributeKeyTxGasUsed = "txGasUsed" + AttributeKeyTxType = "txType" + AttributeKeyTxLog = "txLog" + // tx failed in eth vm execution + AttributeKeyEthereumTxFailed = "ethereumTxFailed" + AttributeValueCategory = ModuleName + AttributeKeyEthereumBloom = "bloom" + + MetricKeyTransitionDB = "transition_db" + MetricKeyStaticCall = "static_call" + + EventTypeFeeMarket = "fee_market" + AttributeKeyBaseFee = "base_fee" +) diff --git a/x/evm/types/evm.pb.go b/x/evm/types/evm.pb.go new file mode 100644 index 00000000..ff544635 --- /dev/null +++ b/x/evm/types/evm.pb.go @@ -0,0 +1,4164 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/evm/v1/evm.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the EVM module parameters +type Params struct { + // evm denom represents the token denomination used to run the EVM state + // transitions. + EvmDenom string `protobuf:"bytes,1,opt,name=evm_denom,json=evmDenom,proto3" json:"evm_denom,omitempty" yaml:"evm_denom"` + // enable create toggles state transitions that use the vm.Create function + EnableCreate bool `protobuf:"varint,2,opt,name=enable_create,json=enableCreate,proto3" json:"enable_create,omitempty" yaml:"enable_create"` + // enable call toggles state transitions that use the vm.Call function + EnableCall bool `protobuf:"varint,3,opt,name=enable_call,json=enableCall,proto3" json:"enable_call,omitempty" yaml:"enable_call"` + // extra eips defines the additional EIPs for the vm.Config + ExtraEIPs []int64 `protobuf:"varint,4,rep,packed,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty" yaml:"extra_eips"` + // chain config defines the EVM chain configuration parameters + ChainConfig ChainConfig `protobuf:"bytes,5,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config" yaml:"chain_config"` + FeeMarketParams FeeMarketParams `protobuf:"bytes,6,opt,name=fee_market_params,json=feeMarketParams,proto3" json:"fee_market_params" yaml:"fee_market_params"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetEvmDenom() string { + if m != nil { + return m.EvmDenom + } + return "" +} + +func (m *Params) GetEnableCreate() bool { + if m != nil { + return m.EnableCreate + } + return false +} + +func (m *Params) GetEnableCall() bool { + if m != nil { + return m.EnableCall + } + return false +} + +func (m *Params) GetExtraEIPs() []int64 { + if m != nil { + return m.ExtraEIPs + } + return nil +} + +func (m *Params) GetChainConfig() ChainConfig { + if m != nil { + return m.ChainConfig + } + return ChainConfig{} +} + +func (m *Params) GetFeeMarketParams() FeeMarketParams { + if m != nil { + return m.FeeMarketParams + } + return FeeMarketParams{} +} + +// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values +// instead of *big.Int. +type ChainConfig struct { + // Homestead switch block (nil no fork, 0 = already homestead) + HomesteadBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=homestead_block,json=homesteadBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"homestead_block,omitempty" yaml:"homestead_block"` + // TheDAO hard-fork switch block (nil no fork) + DAOForkBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=dao_fork_block,json=daoForkBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"dao_fork_block,omitempty" yaml:"dao_fork_block"` + // Whether the nodes supports or opposes the DAO hard-fork + DAOForkSupport bool `protobuf:"varint,3,opt,name=dao_fork_support,json=daoForkSupport,proto3" json:"dao_fork_support,omitempty" yaml:"dao_fork_support"` + // EIP150 implements the Gas price changes + // (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork) + EIP150Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=eip150_block,json=eip150Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip150_block,omitempty" yaml:"eip150_block"` + // EIP150 HF hash (needed for header only clients as only gas pricing changed) + EIP150Hash string `protobuf:"bytes,5,opt,name=eip150_hash,json=eip150Hash,proto3" json:"eip150_hash,omitempty" yaml:"byzantium_block"` + // EIP155Block HF block + EIP155Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=eip155_block,json=eip155Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip155_block,omitempty" yaml:"eip155_block"` + // EIP158 HF block + EIP158Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=eip158_block,json=eip158Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip158_block,omitempty" yaml:"eip158_block"` + // Byzantium switch block (nil no fork, 0 = already on byzantium) + ByzantiumBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=byzantium_block,json=byzantiumBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"byzantium_block,omitempty" yaml:"byzantium_block"` + // Constantinople switch block (nil no fork, 0 = already activated) + ConstantinopleBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=constantinople_block,json=constantinopleBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"constantinople_block,omitempty" yaml:"constantinople_block"` + // Petersburg switch block (nil same as Constantinople) + PetersburgBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=petersburg_block,json=petersburgBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"petersburg_block,omitempty" yaml:"petersburg_block"` + // Istanbul switch block (nil no fork, 0 = already on istanbul) + IstanbulBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=istanbul_block,json=istanbulBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"istanbul_block,omitempty" yaml:"istanbul_block"` + // Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated) + MuirGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,12,opt,name=muir_glacier_block,json=muirGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"muir_glacier_block,omitempty" yaml:"muir_glacier_block"` + // Berlin switch block (nil = no fork, 0 = already on berlin) + BerlinBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,13,opt,name=berlin_block,json=berlinBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"berlin_block,omitempty" yaml:"berlin_block"` + // London switch block (nil = no fork, 0 = already on london) + LondonBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,17,opt,name=london_block,json=londonBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"london_block,omitempty" yaml:"london_block"` + // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) + ArrowGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,18,opt,name=arrow_glacier_block,json=arrowGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"arrow_glacier_block,omitempty" yaml:"arrow_glacier_block"` + // EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in merge proceedings) + MergeForkBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,19,opt,name=merge_fork_block,json=mergeForkBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"merge_fork_block,omitempty" yaml:"merge_fork_block"` +} + +func (m *ChainConfig) Reset() { *m = ChainConfig{} } +func (m *ChainConfig) String() string { return proto.CompactTextString(m) } +func (*ChainConfig) ProtoMessage() {} +func (*ChainConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{1} +} +func (m *ChainConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChainConfig.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 *ChainConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChainConfig.Merge(m, src) +} +func (m *ChainConfig) XXX_Size() int { + return m.Size() +} +func (m *ChainConfig) XXX_DiscardUnknown() { + xxx_messageInfo_ChainConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_ChainConfig proto.InternalMessageInfo + +func (m *ChainConfig) GetDAOForkSupport() bool { + if m != nil { + return m.DAOForkSupport + } + return false +} + +func (m *ChainConfig) GetEIP150Hash() string { + if m != nil { + return m.EIP150Hash + } + return "" +} + +// State represents a single Storage key value pair item. +type State struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *State) Reset() { *m = State{} } +func (m *State) String() string { return proto.CompactTextString(m) } +func (*State) ProtoMessage() {} +func (*State) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{2} +} +func (m *State) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_State.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 *State) XXX_Merge(src proto.Message) { + xxx_messageInfo_State.Merge(m, src) +} +func (m *State) XXX_Size() int { + return m.Size() +} +func (m *State) XXX_DiscardUnknown() { + xxx_messageInfo_State.DiscardUnknown(m) +} + +var xxx_messageInfo_State proto.InternalMessageInfo + +func (m *State) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *State) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// TransactionLogs define the logs generated from a transaction execution +// with a given hash. It it used for import/export data as transactions are not +// persisted on blockchain state after an upgrade. +type TransactionLogs struct { + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` +} + +func (m *TransactionLogs) Reset() { *m = TransactionLogs{} } +func (m *TransactionLogs) String() string { return proto.CompactTextString(m) } +func (*TransactionLogs) ProtoMessage() {} +func (*TransactionLogs) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{3} +} +func (m *TransactionLogs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TransactionLogs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TransactionLogs.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 *TransactionLogs) XXX_Merge(src proto.Message) { + xxx_messageInfo_TransactionLogs.Merge(m, src) +} +func (m *TransactionLogs) XXX_Size() int { + return m.Size() +} +func (m *TransactionLogs) XXX_DiscardUnknown() { + xxx_messageInfo_TransactionLogs.DiscardUnknown(m) +} + +var xxx_messageInfo_TransactionLogs proto.InternalMessageInfo + +func (m *TransactionLogs) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + +func (m *TransactionLogs) GetLogs() []*Log { + if m != nil { + return m.Logs + } + return nil +} + +// Log represents an protobuf compatible Ethereum Log that defines a contract +// log event. These events are generated by the LOG opcode and stored/indexed by +// the node. +type Log struct { + // address of the contract that generated the event + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // list of topics provided by the contract. + Topics []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"` + // supplied by the contract, usually ABI-encoded + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + // block in which the transaction was included + BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"` + // hash of the transaction + TxHash string `protobuf:"bytes,5,opt,name=tx_hash,json=txHash,proto3" json:"transactionHash"` + // index of the transaction in the block + TxIndex uint64 `protobuf:"varint,6,opt,name=tx_index,json=txIndex,proto3" json:"transactionIndex"` + // hash of the block in which the transaction was included + BlockHash string `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` + // index of the log in the block + Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"logIndex"` + // The Removed field is true if this log was reverted due to a chain + // reorganisation. You must pay attention to this field if you receive logs + // through a filter query. + Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed,omitempty"` +} + +func (m *Log) Reset() { *m = Log{} } +func (m *Log) String() string { return proto.CompactTextString(m) } +func (*Log) ProtoMessage() {} +func (*Log) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{4} +} +func (m *Log) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Log.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 *Log) XXX_Merge(src proto.Message) { + xxx_messageInfo_Log.Merge(m, src) +} +func (m *Log) XXX_Size() int { + return m.Size() +} +func (m *Log) XXX_DiscardUnknown() { + xxx_messageInfo_Log.DiscardUnknown(m) +} + +var xxx_messageInfo_Log proto.InternalMessageInfo + +func (m *Log) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Log) GetTopics() []string { + if m != nil { + return m.Topics + } + return nil +} + +func (m *Log) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *Log) GetBlockNumber() uint64 { + if m != nil { + return m.BlockNumber + } + return 0 +} + +func (m *Log) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + +func (m *Log) GetTxIndex() uint64 { + if m != nil { + return m.TxIndex + } + return 0 +} + +func (m *Log) GetBlockHash() string { + if m != nil { + return m.BlockHash + } + return "" +} + +func (m *Log) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *Log) GetRemoved() bool { + if m != nil { + return m.Removed + } + return false +} + +// TxResult stores results of Tx execution. +type TxResult struct { + // contract_address contains the ethereum address of the created contract (if + // any). If the state transition is an evm.Call, the contract address will be + // empty. + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty" yaml:"contract_address"` + // bloom represents the bloom filter bytes + Bloom []byte `protobuf:"bytes,2,opt,name=bloom,proto3" json:"bloom,omitempty"` + // tx_logs contains the transaction hash and the proto-compatible ethereum + // logs. + TxLogs TransactionLogs `protobuf:"bytes,3,opt,name=tx_logs,json=txLogs,proto3" json:"tx_logs" yaml:"tx_logs"` + // ret defines the bytes from the execution. + Ret []byte `protobuf:"bytes,4,opt,name=ret,proto3" json:"ret,omitempty"` + // reverted flag is set to true when the call has been reverted + Reverted bool `protobuf:"varint,5,opt,name=reverted,proto3" json:"reverted,omitempty"` + // gas_used notes the amount of gas consumed while execution + GasUsed uint64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` +} + +func (m *TxResult) Reset() { *m = TxResult{} } +func (m *TxResult) String() string { return proto.CompactTextString(m) } +func (*TxResult) ProtoMessage() {} +func (*TxResult) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{5} +} +func (m *TxResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxResult.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 *TxResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxResult.Merge(m, src) +} +func (m *TxResult) XXX_Size() int { + return m.Size() +} +func (m *TxResult) XXX_DiscardUnknown() { + xxx_messageInfo_TxResult.DiscardUnknown(m) +} + +var xxx_messageInfo_TxResult proto.InternalMessageInfo + +// AccessTuple is the element type of an access list. +type AccessTuple struct { + // hex formatted ethereum address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // hex formatted hashes of the storage keys + StorageKeys []string `protobuf:"bytes,2,rep,name=storage_keys,json=storageKeys,proto3" json:"storageKeys"` +} + +func (m *AccessTuple) Reset() { *m = AccessTuple{} } +func (m *AccessTuple) String() string { return proto.CompactTextString(m) } +func (*AccessTuple) ProtoMessage() {} +func (*AccessTuple) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{6} +} +func (m *AccessTuple) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessTuple.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 *AccessTuple) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessTuple.Merge(m, src) +} +func (m *AccessTuple) XXX_Size() int { + return m.Size() +} +func (m *AccessTuple) XXX_DiscardUnknown() { + xxx_messageInfo_AccessTuple.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessTuple proto.InternalMessageInfo + +// TraceConfig holds extra parameters to trace functions. +type TraceConfig struct { + // custom javascript tracer + Tracer string `protobuf:"bytes,1,opt,name=tracer,proto3" json:"tracer,omitempty"` + // overrides the default timeout of 5 seconds for JavaScript-based tracing + // calls + Timeout string `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"` + // number of blocks the tracer is willing to go back + Reexec uint64 `protobuf:"varint,3,opt,name=reexec,proto3" json:"reexec,omitempty"` + // disable stack capture + DisableStack bool `protobuf:"varint,5,opt,name=disable_stack,json=disableStack,proto3" json:"disableStack"` + // disable storage capture + DisableStorage bool `protobuf:"varint,6,opt,name=disable_storage,json=disableStorage,proto3" json:"disableStorage"` + // print output during capture end + Debug bool `protobuf:"varint,8,opt,name=debug,proto3" json:"debug,omitempty"` + // maximum length of output, but zero means unlimited + Limit int32 `protobuf:"varint,9,opt,name=limit,proto3" json:"limit,omitempty"` + // Chain overrides, can be used to execute a trace using future fork rules + Overrides *ChainConfig `protobuf:"bytes,10,opt,name=overrides,proto3" json:"overrides,omitempty"` + // enable memory capture + EnableMemory bool `protobuf:"varint,11,opt,name=enable_memory,json=enableMemory,proto3" json:"enableMemory"` + // enable return data capture + EnableReturnData bool `protobuf:"varint,12,opt,name=enable_return_data,json=enableReturnData,proto3" json:"enableReturnData"` +} + +func (m *TraceConfig) Reset() { *m = TraceConfig{} } +func (m *TraceConfig) String() string { return proto.CompactTextString(m) } +func (*TraceConfig) ProtoMessage() {} +func (*TraceConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{7} +} +func (m *TraceConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TraceConfig.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 *TraceConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_TraceConfig.Merge(m, src) +} +func (m *TraceConfig) XXX_Size() int { + return m.Size() +} +func (m *TraceConfig) XXX_DiscardUnknown() { + xxx_messageInfo_TraceConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_TraceConfig proto.InternalMessageInfo + +func (m *TraceConfig) GetTracer() string { + if m != nil { + return m.Tracer + } + return "" +} + +func (m *TraceConfig) GetTimeout() string { + if m != nil { + return m.Timeout + } + return "" +} + +func (m *TraceConfig) GetReexec() uint64 { + if m != nil { + return m.Reexec + } + return 0 +} + +func (m *TraceConfig) GetDisableStack() bool { + if m != nil { + return m.DisableStack + } + return false +} + +func (m *TraceConfig) GetDisableStorage() bool { + if m != nil { + return m.DisableStorage + } + return false +} + +func (m *TraceConfig) GetDebug() bool { + if m != nil { + return m.Debug + } + return false +} + +func (m *TraceConfig) GetLimit() int32 { + if m != nil { + return m.Limit + } + return 0 +} + +func (m *TraceConfig) GetOverrides() *ChainConfig { + if m != nil { + return m.Overrides + } + return nil +} + +func (m *TraceConfig) GetEnableMemory() bool { + if m != nil { + return m.EnableMemory + } + return false +} + +func (m *TraceConfig) GetEnableReturnData() bool { + if m != nil { + return m.EnableReturnData + } + return false +} + +// Params defines the EVM module parameters +type FeeMarketParams struct { + // no base fee forces the EIP-1559 base fee to 0 (needed for 0 price calls) + NoBaseFee bool `protobuf:"varint,1,opt,name=no_base_fee,json=noBaseFee,proto3" json:"no_base_fee,omitempty"` + // base fee change denominator bounds the amount the base fee can change + // between blocks. + BaseFeeChangeDenominator uint32 `protobuf:"varint,2,opt,name=base_fee_change_denominator,json=baseFeeChangeDenominator,proto3" json:"base_fee_change_denominator,omitempty"` + // elasticity multiplier bounds the maximum gas limit an EIP-1559 block may + // have. + ElasticityMultiplier uint32 `protobuf:"varint,3,opt,name=elasticity_multiplier,json=elasticityMultiplier,proto3" json:"elasticity_multiplier,omitempty"` + // height at which the base fee calculation is enabled. + EnableHeight int64 `protobuf:"varint,5,opt,name=enable_height,json=enableHeight,proto3" json:"enable_height,omitempty"` + // base fee for EIP-1559 blocks. + BaseFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=base_fee,json=baseFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"base_fee"` +} + +func (m *FeeMarketParams) Reset() { *m = FeeMarketParams{} } +func (m *FeeMarketParams) String() string { return proto.CompactTextString(m) } +func (*FeeMarketParams) ProtoMessage() {} +func (*FeeMarketParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6ee18d4714e9d670, []int{8} +} +func (m *FeeMarketParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FeeMarketParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FeeMarketParams.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 *FeeMarketParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_FeeMarketParams.Merge(m, src) +} +func (m *FeeMarketParams) XXX_Size() int { + return m.Size() +} +func (m *FeeMarketParams) XXX_DiscardUnknown() { + xxx_messageInfo_FeeMarketParams.DiscardUnknown(m) +} + +var xxx_messageInfo_FeeMarketParams proto.InternalMessageInfo + +func (m *FeeMarketParams) GetNoBaseFee() bool { + if m != nil { + return m.NoBaseFee + } + return false +} + +func (m *FeeMarketParams) GetBaseFeeChangeDenominator() uint32 { + if m != nil { + return m.BaseFeeChangeDenominator + } + return 0 +} + +func (m *FeeMarketParams) GetElasticityMultiplier() uint32 { + if m != nil { + return m.ElasticityMultiplier + } + return 0 +} + +func (m *FeeMarketParams) GetEnableHeight() int64 { + if m != nil { + return m.EnableHeight + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "stratos.evm.v1.Params") + proto.RegisterType((*ChainConfig)(nil), "stratos.evm.v1.ChainConfig") + proto.RegisterType((*State)(nil), "stratos.evm.v1.State") + proto.RegisterType((*TransactionLogs)(nil), "stratos.evm.v1.TransactionLogs") + proto.RegisterType((*Log)(nil), "stratos.evm.v1.Log") + proto.RegisterType((*TxResult)(nil), "stratos.evm.v1.TxResult") + proto.RegisterType((*AccessTuple)(nil), "stratos.evm.v1.AccessTuple") + proto.RegisterType((*TraceConfig)(nil), "stratos.evm.v1.TraceConfig") + proto.RegisterType((*FeeMarketParams)(nil), "stratos.evm.v1.FeeMarketParams") +} + +func init() { proto.RegisterFile("stratos/evm/v1/evm.proto", fileDescriptor_6ee18d4714e9d670) } + +var fileDescriptor_6ee18d4714e9d670 = []byte{ + // 1643 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6e, 0xe3, 0xb8, + 0x19, 0x4f, 0x62, 0x27, 0x91, 0x69, 0xc7, 0x56, 0x98, 0xec, 0xd4, 0x3b, 0x01, 0xa2, 0x40, 0x05, + 0xda, 0x1c, 0x76, 0xe2, 0xcd, 0x0c, 0x82, 0x4e, 0xb7, 0xd8, 0x43, 0x9c, 0x64, 0x76, 0x92, 0xce, + 0x6c, 0x03, 0xce, 0x14, 0x05, 0xda, 0x83, 0x40, 0x4b, 0x8c, 0xac, 0x46, 0x12, 0x0d, 0x92, 0xf2, + 0xda, 0x45, 0x1f, 0xa0, 0xbd, 0xf5, 0x11, 0xfa, 0x02, 0x3d, 0xf4, 0x15, 0x7a,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, 0x0d, 0xff, 0xb4, 0xcc, 0x69, + 0x9f, 0x45, 0x61, 0x5f, 0x41, 0xb9, 0x54, 0x26, 0x19, 0x7c, 0x0d, 0x3a, 0x7c, 0x8e, 0xac, 0x72, + 0xd6, 0xfa, 0x1e, 0x7c, 0x50, 0x9c, 0xc8, 0x4f, 0xef, 0x4a, 0x64, 0xdd, 0xcc, 0x5a, 0x27, 0x92, + 0xd8, 0x51, 0x1a, 0xa9, 0x88, 0xc6, 0x65, 0x32, 0xba, 0xe7, 0xdf, 0xdf, 0xec, 0x2e, 0xff, 0x70, + 0xb3, 0xbb, 0xfc, 0xbf, 0x9b, 0xdd, 0xe5, 0xbf, 0x7d, 0xd8, 0x5d, 0xfa, 0xe1, 0xc3, 0xee, 0xd2, + 0x7f, 0x3e, 0xec, 0x2e, 0xfd, 0xbe, 0x33, 0x43, 0x61, 0xea, 0x24, 0x65, 0x6a, 0x32, 0x7c, 0x06, + 0xaf, 0xc6, 0xce, 0x08, 0x9e, 0xef, 0xc0, 0xd7, 0x5b, 0x83, 0x87, 0xf9, 0x8b, 0xff, 0x07, 0x00, + 0x00, 0xff, 0xff, 0xfb, 0x04, 0x5c, 0x3f, 0xda, 0x0f, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.FeeMarketParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size, err := m.ChainConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.ExtraEIPs) > 0 { + dAtA4 := make([]byte, len(m.ExtraEIPs)*10) + var j3 int + for _, num1 := range m.ExtraEIPs { + num := uint64(num1) + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintEvm(dAtA, i, uint64(j3)) + i-- + dAtA[i] = 0x22 + } + if m.EnableCall { + i-- + if m.EnableCall { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.EnableCreate { + i-- + if m.EnableCreate { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.EvmDenom) > 0 { + i -= len(m.EvmDenom) + copy(dAtA[i:], m.EvmDenom) + i = encodeVarintEvm(dAtA, i, uint64(len(m.EvmDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ChainConfig) 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 *ChainConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MergeForkBlock != nil { + { + size := m.MergeForkBlock.Size() + i -= size + if _, err := m.MergeForkBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } + if m.ArrowGlacierBlock != nil { + { + size := m.ArrowGlacierBlock.Size() + i -= size + if _, err := m.ArrowGlacierBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if m.LondonBlock != nil { + { + size := m.LondonBlock.Size() + i -= size + if _, err := m.LondonBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + if m.BerlinBlock != nil { + { + size := m.BerlinBlock.Size() + i -= size + if _, err := m.BerlinBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + if m.MuirGlacierBlock != nil { + { + size := m.MuirGlacierBlock.Size() + i -= size + if _, err := m.MuirGlacierBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + if m.IstanbulBlock != nil { + { + size := m.IstanbulBlock.Size() + i -= size + if _, err := m.IstanbulBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + if m.PetersburgBlock != nil { + { + size := m.PetersburgBlock.Size() + i -= size + if _, err := m.PetersburgBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + if m.ConstantinopleBlock != nil { + { + size := m.ConstantinopleBlock.Size() + i -= size + if _, err := m.ConstantinopleBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if m.ByzantiumBlock != nil { + { + size := m.ByzantiumBlock.Size() + i -= size + if _, err := m.ByzantiumBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if m.EIP158Block != nil { + { + size := m.EIP158Block.Size() + i -= size + if _, err := m.EIP158Block.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.EIP155Block != nil { + { + size := m.EIP155Block.Size() + i -= size + if _, err := m.EIP155Block.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if len(m.EIP150Hash) > 0 { + i -= len(m.EIP150Hash) + copy(dAtA[i:], m.EIP150Hash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.EIP150Hash))) + i-- + dAtA[i] = 0x2a + } + if m.EIP150Block != nil { + { + size := m.EIP150Block.Size() + i -= size + if _, err := m.EIP150Block.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.DAOForkSupport { + i-- + if m.DAOForkSupport { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.DAOForkBlock != nil { + { + size := m.DAOForkBlock.Size() + i -= size + if _, err := m.DAOForkBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.HomesteadBlock != nil { + { + size := m.HomesteadBlock.Size() + i -= size + if _, err := m.HomesteadBlock.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *State) 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 *State) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TransactionLogs) 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 *TransactionLogs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TransactionLogs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Log) 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 *Log) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Removed { + i-- + if m.Removed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if m.Index != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x40 + } + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x3a + } + if m.TxIndex != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.TxIndex)) + i-- + dAtA[i] = 0x30 + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintEvm(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x2a + } + if m.BlockNumber != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x20 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.Topics) > 0 { + for iNdEx := len(m.Topics) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Topics[iNdEx]) + copy(dAtA[i:], m.Topics[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Topics[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TxResult) 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 *TxResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasUsed != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x30 + } + if m.Reverted { + i-- + if m.Reverted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if len(m.Ret) > 0 { + i -= len(m.Ret) + copy(dAtA[i:], m.Ret) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Ret))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.TxLogs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Bloom) > 0 { + i -= len(m.Bloom) + copy(dAtA[i:], m.Bloom) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Bloom))) + i-- + dAtA[i] = 0x12 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintEvm(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AccessTuple) 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 *AccessTuple) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StorageKeys) > 0 { + for iNdEx := len(m.StorageKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StorageKeys[iNdEx]) + copy(dAtA[i:], m.StorageKeys[iNdEx]) + i = encodeVarintEvm(dAtA, i, uint64(len(m.StorageKeys[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TraceConfig) 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 *TraceConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EnableReturnData { + i-- + if m.EnableReturnData { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x60 + } + if m.EnableMemory { + i-- + if m.EnableMemory { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.Overrides != nil { + { + size, err := m.Overrides.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + if m.Limit != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.Limit)) + i-- + dAtA[i] = 0x48 + } + if m.Debug { + i-- + if m.Debug { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.DisableStorage { + i-- + if m.DisableStorage { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.DisableStack { + i-- + if m.DisableStack { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.Reexec != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.Reexec)) + i-- + dAtA[i] = 0x18 + } + if len(m.Timeout) > 0 { + i -= len(m.Timeout) + copy(dAtA[i:], m.Timeout) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Timeout))) + i-- + dAtA[i] = 0x12 + } + if len(m.Tracer) > 0 { + i -= len(m.Tracer) + copy(dAtA[i:], m.Tracer) + i = encodeVarintEvm(dAtA, i, uint64(len(m.Tracer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FeeMarketParams) 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 *FeeMarketParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FeeMarketParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.BaseFee.Size() + i -= size + if _, err := m.BaseFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.EnableHeight != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.EnableHeight)) + i-- + dAtA[i] = 0x28 + } + if m.ElasticityMultiplier != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.ElasticityMultiplier)) + i-- + dAtA[i] = 0x18 + } + if m.BaseFeeChangeDenominator != 0 { + i = encodeVarintEvm(dAtA, i, uint64(m.BaseFeeChangeDenominator)) + i-- + dAtA[i] = 0x10 + } + if m.NoBaseFee { + i-- + if m.NoBaseFee { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintEvm(dAtA []byte, offset int, v uint64) int { + offset -= sovEvm(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.EvmDenom) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.EnableCreate { + n += 2 + } + if m.EnableCall { + n += 2 + } + if len(m.ExtraEIPs) > 0 { + l = 0 + for _, e := range m.ExtraEIPs { + l += sovEvm(uint64(e)) + } + n += 1 + sovEvm(uint64(l)) + l + } + l = m.ChainConfig.Size() + n += 1 + l + sovEvm(uint64(l)) + l = m.FeeMarketParams.Size() + n += 1 + l + sovEvm(uint64(l)) + return n +} + +func (m *ChainConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HomesteadBlock != nil { + l = m.HomesteadBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.DAOForkBlock != nil { + l = m.DAOForkBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.DAOForkSupport { + n += 2 + } + if m.EIP150Block != nil { + l = m.EIP150Block.Size() + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.EIP150Hash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.EIP155Block != nil { + l = m.EIP155Block.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.EIP158Block != nil { + l = m.EIP158Block.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.ByzantiumBlock != nil { + l = m.ByzantiumBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.ConstantinopleBlock != nil { + l = m.ConstantinopleBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.PetersburgBlock != nil { + l = m.PetersburgBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.IstanbulBlock != nil { + l = m.IstanbulBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.MuirGlacierBlock != nil { + l = m.MuirGlacierBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.BerlinBlock != nil { + l = m.BerlinBlock.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.LondonBlock != nil { + l = m.LondonBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + if m.ArrowGlacierBlock != nil { + l = m.ArrowGlacierBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + if m.MergeForkBlock != nil { + l = m.MergeForkBlock.Size() + n += 2 + l + sovEvm(uint64(l)) + } + return n +} + +func (m *State) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + return n +} + +func (m *TransactionLogs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovEvm(uint64(l)) + } + } + return n +} + +func (m *Log) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if len(m.Topics) > 0 { + for _, s := range m.Topics { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.BlockNumber != 0 { + n += 1 + sovEvm(uint64(m.BlockNumber)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.TxIndex != 0 { + n += 1 + sovEvm(uint64(m.TxIndex)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovEvm(uint64(m.Index)) + } + if m.Removed { + n += 2 + } + return n +} + +func (m *TxResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.Bloom) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = m.TxLogs.Size() + n += 1 + l + sovEvm(uint64(l)) + l = len(m.Ret) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.Reverted { + n += 2 + } + if m.GasUsed != 0 { + n += 1 + sovEvm(uint64(m.GasUsed)) + } + return n +} + +func (m *AccessTuple) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if len(m.StorageKeys) > 0 { + for _, s := range m.StorageKeys { + l = len(s) + n += 1 + l + sovEvm(uint64(l)) + } + } + return n +} + +func (m *TraceConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Tracer) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + l = len(m.Timeout) + if l > 0 { + n += 1 + l + sovEvm(uint64(l)) + } + if m.Reexec != 0 { + n += 1 + sovEvm(uint64(m.Reexec)) + } + if m.DisableStack { + n += 2 + } + if m.DisableStorage { + n += 2 + } + if m.Debug { + n += 2 + } + if m.Limit != 0 { + n += 1 + sovEvm(uint64(m.Limit)) + } + if m.Overrides != nil { + l = m.Overrides.Size() + n += 1 + l + sovEvm(uint64(l)) + } + if m.EnableMemory { + n += 2 + } + if m.EnableReturnData { + n += 2 + } + return n +} + +func (m *FeeMarketParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NoBaseFee { + n += 2 + } + if m.BaseFeeChangeDenominator != 0 { + n += 1 + sovEvm(uint64(m.BaseFeeChangeDenominator)) + } + if m.ElasticityMultiplier != 0 { + n += 1 + sovEvm(uint64(m.ElasticityMultiplier)) + } + if m.EnableHeight != 0 { + n += 1 + sovEvm(uint64(m.EnableHeight)) + } + l = m.BaseFee.Size() + n += 1 + l + sovEvm(uint64(l)) + return n +} + +func sovEvm(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvm(x uint64) (n int) { + return sovEvm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EvmDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EvmDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableCreate", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableCreate = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableCall", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableCall = bool(v != 0) + case 4: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ExtraEIPs = append(m.ExtraEIPs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.ExtraEIPs) == 0 { + m.ExtraEIPs = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ExtraEIPs = append(m.ExtraEIPs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraEIPs", wireType) + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ChainConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeMarketParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FeeMarketParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChainConfig) 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 ErrIntOverflowEvm + } + 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: ChainConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChainConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HomesteadBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.HomesteadBlock = &v + if err := m.HomesteadBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DAOForkBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.DAOForkBlock = &v + if err := m.DAOForkBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DAOForkSupport", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DAOForkSupport = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP150Block", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.EIP150Block = &v + if err := m.EIP150Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP150Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EIP150Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP155Block", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.EIP155Block = &v + if err := m.EIP155Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EIP158Block", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.EIP158Block = &v + if err := m.EIP158Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ByzantiumBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.ByzantiumBlock = &v + if err := m.ByzantiumBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConstantinopleBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.ConstantinopleBlock = &v + if err := m.ConstantinopleBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PetersburgBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.PetersburgBlock = &v + if err := m.PetersburgBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IstanbulBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.IstanbulBlock = &v + if err := m.IstanbulBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MuirGlacierBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.MuirGlacierBlock = &v + if err := m.MuirGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BerlinBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.BerlinBlock = &v + if err := m.BerlinBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LondonBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.LondonBlock = &v + if err := m.LondonBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ArrowGlacierBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.ArrowGlacierBlock = &v + if err := m.ArrowGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MergeForkBlock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.MergeForkBlock = &v + if err := m.MergeForkBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *State) 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 ErrIntOverflowEvm + } + 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: State: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: State: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TransactionLogs) 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 ErrIntOverflowEvm + } + 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: TransactionLogs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransactionLogs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, &Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Log) 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 ErrIntOverflowEvm + } + 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: Log: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Log: 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 ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + 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 Topics", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topics = append(m.Topics, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) + } + m.TxIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TxIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + 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 ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Removed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Removed = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxResult) 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 ErrIntOverflowEvm + } + 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: TxResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bloom", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bloom = append(m.Bloom[:0], dAtA[iNdEx:postIndex]...) + if m.Bloom == nil { + m.Bloom = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxLogs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TxLogs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ret", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ret = append(m.Ret[:0], dAtA[iNdEx:postIndex]...) + if m.Ret == nil { + m.Ret = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Reverted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Reverted = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + } + m.GasUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasUsed |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AccessTuple) 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 ErrIntOverflowEvm + } + 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: AccessTuple: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessTuple: 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 ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + 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 StorageKeys", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StorageKeys = append(m.StorageKeys, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TraceConfig) 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 ErrIntOverflowEvm + } + 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: TraceConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TraceConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tracer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tracer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Timeout = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Reexec", wireType) + } + m.Reexec = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Reexec |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableStack", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableStack = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableStorage", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableStorage = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Debug", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Debug = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Overrides", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Overrides == nil { + m.Overrides = &ChainConfig{} + } + if err := m.Overrides.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableMemory", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableMemory = bool(v != 0) + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableReturnData", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableReturnData = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FeeMarketParams) 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 ErrIntOverflowEvm + } + 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: FeeMarketParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FeeMarketParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NoBaseFee", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.NoBaseFee = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseFeeChangeDenominator", wireType) + } + m.BaseFeeChangeDenominator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaseFeeChangeDenominator |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ElasticityMultiplier", wireType) + } + m.ElasticityMultiplier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ElasticityMultiplier |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableHeight", wireType) + } + m.EnableHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EnableHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvm + } + 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 ErrInvalidLengthEvm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BaseFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvm(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, ErrIntOverflowEvm + } + 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, ErrIntOverflowEvm + } + 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, ErrIntOverflowEvm + } + 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, ErrInvalidLengthEvm + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvm + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvm + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvm = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvm = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvm = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/evm/types/genesis.go b/x/evm/types/genesis.go new file mode 100644 index 00000000..bbb5bc94 --- /dev/null +++ b/x/evm/types/genesis.go @@ -0,0 +1,51 @@ +package types + +import ( + "fmt" + + stratos "github.com/stratosnet/stratos-chain/types" +) + +// Validate performs a basic validation of a GenesisAccount fields. +func (ga GenesisAccount) Validate() error { + if err := stratos.ValidateAddress(ga.Address); err != nil { + return err + } + return ga.Storage.Validate() +} + +// DefaultGenesisState sets default evm genesis state with empty accounts and default params and +// chain config values. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Accounts: []GenesisAccount{}, + Params: DefaultParams(), + BlockGas: 0, + } +} + +// NewGenesisState creates a new genesis state. +func NewGenesisState(params Params, accounts []GenesisAccount, blockGas uint64) *GenesisState { + return &GenesisState{ + Accounts: accounts, + Params: params, + BlockGas: blockGas, + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + seenAccounts := make(map[string]bool) + for _, acc := range gs.Accounts { + if seenAccounts[acc.Address] { + return fmt.Errorf("duplicated genesis account %s", acc.Address) + } + if err := acc.Validate(); err != nil { + return fmt.Errorf("invalid genesis account %s: %w", acc.Address, err) + } + seenAccounts[acc.Address] = true + } + + return gs.Params.Validate() +} diff --git a/x/evm/types/genesis.pb.go b/x/evm/types/genesis.pb.go new file mode 100644 index 00000000..ece05581 --- /dev/null +++ b/x/evm/types/genesis.pb.go @@ -0,0 +1,719 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/evm/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the evm module's genesis state. +type GenesisState struct { + // accounts is an array containing the ethereum genesis accounts. + Accounts []GenesisAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` + // params defines all the parameters of the module. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` + // block gas is the amount of gas used on the last block before the upgrade. + // Zero by default. + BlockGas uint64 `protobuf:"varint,3,opt,name=block_gas,json=blockGas,proto3" json:"block_gas,omitempty"` +} + +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_8bfc0e5ccf7131d4, []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) GetAccounts() []GenesisAccount { + if m != nil { + return m.Accounts + } + return nil +} + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetBlockGas() uint64 { + if m != nil { + return m.BlockGas + } + return 0 +} + +// GenesisAccount defines an account to be initialized in the genesis state. +// Its main difference between with Geth's GenesisAccount is that it uses a +// custom storage type and that it doesn't contain the private key field. +type GenesisAccount struct { + // address defines an ethereum hex formated address of an account + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // code defines the hex bytes of the account code. + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` + // storage defines the set of state key values for the account. + Storage Storage `protobuf:"bytes,3,rep,name=storage,proto3,castrepeated=Storage" json:"storage"` +} + +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_8bfc0e5ccf7131d4, []int{1} +} +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) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *GenesisAccount) GetCode() string { + if m != nil { + return m.Code + } + return "" +} + +func (m *GenesisAccount) GetStorage() Storage { + if m != nil { + return m.Storage + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "stratos.evm.v1.GenesisState") + proto.RegisterType((*GenesisAccount)(nil), "stratos.evm.v1.GenesisAccount") +} + +func init() { proto.RegisterFile("stratos/evm/v1/genesis.proto", fileDescriptor_8bfc0e5ccf7131d4) } + +var fileDescriptor_8bfc0e5ccf7131d4 = []byte{ + // 327 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x4f, 0x4e, 0x02, 0x31, + 0x14, 0xc6, 0xa7, 0x42, 0xf8, 0x53, 0x0c, 0x26, 0x8d, 0x9a, 0x06, 0x4d, 0x21, 0xac, 0x66, 0x63, + 0x1b, 0xd0, 0x03, 0x20, 0x1b, 0xe2, 0xce, 0x0c, 0x3b, 0x37, 0xa6, 0x94, 0xa6, 0x10, 0x9d, 0x29, + 0x99, 0x96, 0x89, 0xee, 0x3c, 0x82, 0x77, 0x70, 0xe7, 0x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x95, + 0xc4, 0x15, 0xb7, 0xd4, 0x59, 0x39, 0x94, 0xdb, 0x7e, 0x7c, 0x92, 0x66, 0xfa, 0xfc, 0xe9, 0xd6, + 0xa7, 0x19, 0x1d, 0x14, 0xb6, 0xf1, 0xdd, 0x66, 0x47, 0xc0, 0x76, 0x47, 0xc0, 0xef, 0x8e, 0x80, + 0xf7, 0x3d, 0xf1, 0xb6, 0x7b, 0xe2, 0x7d, 0xed, 0x89, 0xf7, 0xc0, 0xd4, 0xd2, 0x2e, 0xd6, 0x33, + 0x2a, 0x74, 0xc8, 0xf2, 0xa6, 0x91, 0xb4, 0x45, 0x79, 0x25, 0x16, 0x7c, 0x19, 0xb1, 0x17, 0x77, + 0x7a, 0xfb, 0xba, 0x92, 0x66, 0x56, 0x73, 0xa7, 0xbf, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x55, + 0xe9, 0xf9, 0xe4, 0xda, 0x01, 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 m.BlockGas != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.BlockGas)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *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.Storage) > 0 { + for iNdEx := len(m.Storage) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Storage[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.Code) > 0 { + i -= len(m.Code) + copy(dAtA[i:], m.Code) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Code))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + 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 + if len(m.Accounts) > 0 { + for _, e := range m.Accounts { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if m.BlockGas != 0 { + n += 1 + sovGenesis(uint64(m.BlockGas)) + } + return n +} + +func (m *GenesisAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.Code) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.Storage) > 0 { + for _, e := range m.Storage { + 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 Accounts", 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.Accounts = append(m.Accounts, GenesisAccount{}) + if err := m.Accounts[len(m.Accounts)-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 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 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockGas", wireType) + } + m.BlockGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *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 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: 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 Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Code = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Storage", 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.Storage = append(m.Storage, State{}) + if err := m.Storage[len(m.Storage)-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/evm/types/interfaces.go b/x/evm/types/interfaces.go new file mode 100644 index 00000000..c8776310 --- /dev/null +++ b/x/evm/types/interfaces.go @@ -0,0 +1,49 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + + ethtypes "github.com/ethereum/go-ethereum/core/types" + //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" +) + +// AccountKeeper defines the expected account keeper interface +type AccountKeeper interface { + NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + GetModuleAddress(moduleName string) sdk.AccAddress + GetAllAccounts(ctx sdk.Context) (accounts []authtypes.AccountI) + IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) bool) + GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) + GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + SetAccount(ctx sdk.Context, account authtypes.AccountI) + RemoveAccount(ctx sdk.Context, account authtypes.AccountI) + GetParams(ctx sdk.Context) (params authtypes.Params) +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + // SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error +} + +// StakingKeeper returns the historical headers kept in store. +type StakingKeeper interface { + GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool) + GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, found bool) +} + +// Event Hooks +// These can be utilized to customize evm transaction processing. + +// EvmHooks event hooks for evm tx processing +type EvmHooks interface { + // Must be called after tx is processed successfully, if return an error, the whole transaction is reverted. + PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error +} diff --git a/x/evm/types/key.go b/x/evm/types/key.go new file mode 100644 index 00000000..54cb8847 --- /dev/null +++ b/x/evm/types/key.go @@ -0,0 +1,62 @@ +package types + +import ( + "github.com/ethereum/go-ethereum/common" +) + +const ( + // ModuleName string name of module + ModuleName = "evm" + + // StoreKey key for ethereum storage data, account code (StateDB) or block + // related data for Web3. + // The EVM module should use a prefix store. + StoreKey = ModuleName + + // TransientKey is the key to access the EVM transient store, that is reset + // during the Commit phase. + TransientKey = "transient_" + ModuleName + + // RouterKey uses module name for routing + RouterKey = ModuleName +) + +// prefix bytes for the EVM persistent store +const ( + prefixCode = iota + 1 + prefixStorage +) + +// prefix bytes for the EVM transient store +const ( + prefixTransientBloom = iota + 1 + prefixTransientTxIndex + prefixTransientLogSize + prefixTransientGasUsed + prefixBlockGasUsed +) + +// KVStore key prefixes +var ( + KeyPrefixCode = []byte{prefixCode} + KeyPrefixStorage = []byte{prefixStorage} +) + +// Transient Store key prefixes +var ( + KeyPrefixTransientBloom = []byte{prefixTransientBloom} + KeyPrefixTransientTxIndex = []byte{prefixTransientTxIndex} + KeyPrefixTransientLogSize = []byte{prefixTransientLogSize} + KeyPrefixTransientGasUsed = []byte{prefixTransientGasUsed} + KeyPrefixBlockGasUsed = []byte{prefixBlockGasUsed} +) + +// AddressStoragePrefix returns a prefix to iterate over a given account storage. +func AddressStoragePrefix(address common.Address) []byte { + return append(KeyPrefixStorage, address.Bytes()...) +} + +// StateKey defines the full key under which an account state is stored. +func StateKey(address common.Address, key []byte) []byte { + return append(AddressStoragePrefix(address), key...) +} diff --git a/x/evm/types/legacy_tx.go b/x/evm/types/legacy_tx.go new file mode 100644 index 00000000..4eeadea3 --- /dev/null +++ b/x/evm/types/legacy_tx.go @@ -0,0 +1,213 @@ +package types + +import ( + "math/big" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/stratosnet/stratos-chain/types" +) + +func newLegacyTx(tx *ethtypes.Transaction) (*LegacyTx, error) { + txData := &LegacyTx{ + Nonce: tx.Nonce(), + Data: tx.Data(), + GasLimit: tx.Gas(), + } + + v, r, s := tx.RawSignatureValues() + if to := tx.To(); to != nil { + txData.To = to.Hex() + } + + if tx.Value() != nil { + amountInt, err := SafeNewIntFromBigInt(tx.Value()) + if err != nil { + return nil, err + } + txData.Amount = &amountInt + } + + if tx.GasPrice() != nil { + gasPriceInt, err := SafeNewIntFromBigInt(tx.GasPrice()) + if err != nil { + return nil, err + } + txData.GasPrice = &gasPriceInt + } + + txData.SetSignatureValues(tx.ChainId(), v, r, s) + return txData, nil +} + +// TxType returns the tx type +func (tx *LegacyTx) TxType() uint8 { + return ethtypes.LegacyTxType +} + +// Copy returns an instance with the same field values +func (tx *LegacyTx) Copy() TxData { + return &LegacyTx{ + Nonce: tx.Nonce, + GasPrice: tx.GasPrice, + GasLimit: tx.GasLimit, + To: tx.To, + Amount: tx.Amount, + Data: common.CopyBytes(tx.Data), + V: common.CopyBytes(tx.V), + R: common.CopyBytes(tx.R), + S: common.CopyBytes(tx.S), + } +} + +// GetChainID returns the chain id field from the derived signature values +func (tx *LegacyTx) GetChainID() *big.Int { + v, _, _ := tx.GetRawSignatureValues() + return DeriveChainID(v) +} + +// GetAccessList returns nil +func (tx *LegacyTx) GetAccessList() ethtypes.AccessList { + return nil +} + +// GetData returns the a copy of the input data bytes. +func (tx *LegacyTx) GetData() []byte { + return common.CopyBytes(tx.Data) +} + +// GetGas returns the gas limit. +func (tx *LegacyTx) GetGas() uint64 { + return tx.GasLimit +} + +// GetGasPrice returns the gas price field. +func (tx *LegacyTx) GetGasPrice() *big.Int { + if tx.GasPrice == nil { + return nil + } + return tx.GasPrice.BigInt() +} + +// GetGasTipCap returns the gas price field. +func (tx *LegacyTx) GetGasTipCap() *big.Int { + return tx.GetGasPrice() +} + +// GetGasFeeCap returns the gas price field. +func (tx *LegacyTx) GetGasFeeCap() *big.Int { + return tx.GetGasPrice() +} + +// GetValue returns the tx amount. +func (tx *LegacyTx) GetValue() *big.Int { + if tx.Amount == nil { + return nil + } + return tx.Amount.BigInt() +} + +// GetNonce returns the account sequence for the transaction. +func (tx *LegacyTx) GetNonce() uint64 { return tx.Nonce } + +// GetTo returns the pointer to the recipient address. +func (tx *LegacyTx) GetTo() *common.Address { + if tx.To == "" { + return nil + } + to := common.HexToAddress(tx.To) + return &to +} + +// AsEthereumData returns an AccessListTx transaction tx from the proto-formatted +// TxData defined on the Cosmos EVM. +func (tx *LegacyTx) AsEthereumData() ethtypes.TxData { + v, r, s := tx.GetRawSignatureValues() + return ðtypes.LegacyTx{ + Nonce: tx.GetNonce(), + GasPrice: tx.GetGasPrice(), + Gas: tx.GetGas(), + To: tx.GetTo(), + Value: tx.GetValue(), + Data: tx.GetData(), + V: v, + R: r, + S: s, + } +} + +// GetRawSignatureValues returns the V, R, S signature values of the transaction. +// The return values should not be modified by the caller. +func (tx *LegacyTx) GetRawSignatureValues() (v, r, s *big.Int) { + return rawSignatureValues(tx.V, tx.R, tx.S) +} + +// SetSignatureValues sets the signature values to the transaction. +func (tx *LegacyTx) SetSignatureValues(_, v, r, s *big.Int) { + if v != nil { + tx.V = v.Bytes() + } + if r != nil { + tx.R = r.Bytes() + } + if s != nil { + tx.S = s.Bytes() + } +} + +// Validate performs a stateless validation of the tx fields. +func (tx LegacyTx) Validate() error { + gasPrice := tx.GetGasPrice() + if gasPrice == nil { + return sdkerrors.Wrap(ErrInvalidGasPrice, "gas price cannot be nil") + } + + if gasPrice.Sign() == -1 { + return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice) + } + if !IsValidInt256(gasPrice) { + return sdkerrors.Wrap(ErrInvalidGasPrice, "out of bound") + } + if !IsValidInt256(tx.Fee()) { + return sdkerrors.Wrap(ErrInvalidGasFee, "out of bound") + } + + amount := tx.GetValue() + // Amount can be 0 + if amount != nil && amount.Sign() == -1 { + return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) + } + if !IsValidInt256(amount) { + return sdkerrors.Wrap(ErrInvalidAmount, "out of bound") + } + + if tx.To != "" { + if err := types.ValidateAddress(tx.To); err != nil { + return sdkerrors.Wrap(err, "invalid to address") + } + } + + return nil +} + +// Fee returns gasprice * gaslimit. +func (tx LegacyTx) Fee() *big.Int { + return fee(tx.GetGasPrice(), tx.GetGas()) +} + +// Cost returns amount + gasprice * gaslimit. +func (tx LegacyTx) Cost() *big.Int { + return cost(tx.Fee(), tx.GetValue()) +} + +// EffectiveFee is the same as Fee for LegacyTx +func (tx LegacyTx) EffectiveFee(baseFee *big.Int) *big.Int { + return tx.Fee() +} + +// EffectiveCost is the same as Cost for LegacyTx +func (tx LegacyTx) EffectiveCost(baseFee *big.Int) *big.Int { + return tx.Cost() +} diff --git a/x/evm/types/logs.go b/x/evm/types/logs.go new file mode 100644 index 00000000..41086048 --- /dev/null +++ b/x/evm/types/logs.go @@ -0,0 +1,127 @@ +package types + +import ( + "errors" + "fmt" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + stratos "github.com/stratosnet/stratos-chain/types" +) + +// NewTransactionLogs creates a new NewTransactionLogs instance. +func NewTransactionLogs(hash common.Hash, logs []*Log) TransactionLogs { + return TransactionLogs{ + Hash: hash.String(), + Logs: logs, + } +} + +// NewTransactionLogsFromEth creates a new NewTransactionLogs instance using []*ethtypes.Log. +func NewTransactionLogsFromEth(hash common.Hash, ethlogs []*ethtypes.Log) TransactionLogs { + return TransactionLogs{ + Hash: hash.String(), + Logs: NewLogsFromEth(ethlogs), + } +} + +// Validate performs a basic validation of a GenesisAccount fields. +func (tx TransactionLogs) Validate() error { + if stratos.IsEmptyHash(tx.Hash) { + return fmt.Errorf("hash cannot be the empty %s", tx.Hash) + } + + for i, log := range tx.Logs { + if log == nil { + return fmt.Errorf("log %d cannot be nil", i) + } + if err := log.Validate(); err != nil { + return fmt.Errorf("invalid log %d: %w", i, err) + } + if log.TxHash != tx.Hash { + return fmt.Errorf("log tx hash mismatch (%s ≠ %s)", log.TxHash, tx.Hash) + } + } + return nil +} + +// EthLogs returns the Ethereum type Logs from the Transaction Logs. +func (tx TransactionLogs) EthLogs() []*ethtypes.Log { + return LogsToEthereum(tx.Logs) +} + +// Validate performs a basic validation of an ethereum Log fields. +func (log *Log) Validate() error { + if err := stratos.ValidateAddress(log.Address); err != nil { + return fmt.Errorf("invalid log address %w", err) + } + if stratos.IsEmptyHash(log.BlockHash) { + return fmt.Errorf("block hash cannot be the empty %s", log.BlockHash) + } + if log.BlockNumber == 0 { + return errors.New("block number cannot be zero") + } + if stratos.IsEmptyHash(log.TxHash) { + return fmt.Errorf("tx hash cannot be the empty %s", log.TxHash) + } + return nil +} + +// ToEthereum returns the Ethereum type Log from a stratos proto compatible Log. +func (log *Log) ToEthereum() *ethtypes.Log { + topics := make([]common.Hash, len(log.Topics)) + for i, topic := range log.Topics { + topics[i] = common.HexToHash(topic) + } + + return ðtypes.Log{ + Address: common.HexToAddress(log.Address), + Topics: topics, + Data: log.Data, + BlockNumber: log.BlockNumber, + TxHash: common.HexToHash(log.TxHash), + TxIndex: uint(log.TxIndex), + Index: uint(log.Index), + BlockHash: common.HexToHash(log.BlockHash), + Removed: log.Removed, + } +} + +func NewLogsFromEth(ethlogs []*ethtypes.Log) []*Log { + var logs []*Log // nolint: prealloc + for _, ethlog := range ethlogs { + logs = append(logs, NewLogFromEth(ethlog)) + } + + return logs +} + +// LogsToEthereum casts the stratos Logs to a slice of Ethereum Logs. +func LogsToEthereum(logs []*Log) []*ethtypes.Log { + var ethLogs []*ethtypes.Log // nolint: prealloc + for i := range logs { + ethLogs = append(ethLogs, logs[i].ToEthereum()) + } + return ethLogs +} + +// NewLogFromEth creates a new Log instance from a Ethereum type Log. +func NewLogFromEth(log *ethtypes.Log) *Log { + topics := make([]string, len(log.Topics)) + for i, topic := range log.Topics { + topics[i] = topic.String() + } + + return &Log{ + Address: log.Address.String(), + Topics: topics, + Data: log.Data, + BlockNumber: log.BlockNumber, + TxHash: log.TxHash.String(), + TxIndex: uint64(log.TxIndex), + Index: uint64(log.Index), + BlockHash: log.BlockHash.String(), + Removed: log.Removed, + } +} diff --git a/x/evm/types/msg.go b/x/evm/types/msg.go new file mode 100644 index 00000000..f3d2b077 --- /dev/null +++ b/x/evm/types/msg.go @@ -0,0 +1,348 @@ +package types + +import ( + "errors" + "fmt" + "math/big" + + "github.com/cosmos/cosmos-sdk/client" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/stratosnet/stratos-chain/types" +) + +var ( + _ sdk.Msg = &MsgEthereumTx{} + _ sdk.Tx = &MsgEthereumTx{} + _ ante.GasTx = &MsgEthereumTx{} + + _ codectypes.UnpackInterfacesMessage = MsgEthereumTx{} +) + +// message type and route constants +const ( + // TypeMsgEthereumTx defines the type string of an Ethereum transaction + TypeMsgEthereumTx = "ethereum_tx" +) + +// NewTx returns a reference to a new Ethereum transaction message. +func NewTx( + chainID *big.Int, nonce uint64, to *common.Address, amount *big.Int, + gasLimit uint64, gasPrice, gasFeeCap, gasTipCap *big.Int, input []byte, accesses *ethtypes.AccessList, +) *MsgEthereumTx { + return newMsgEthereumTx(chainID, nonce, to, amount, gasLimit, gasPrice, gasFeeCap, gasTipCap, input, accesses) +} + +// NewTxContract returns a reference to a new Ethereum transaction +// message designated for contract creation. +func NewTxContract( + chainID *big.Int, + nonce uint64, + amount *big.Int, + gasLimit uint64, + gasPrice, gasFeeCap, gasTipCap *big.Int, + input []byte, + accesses *ethtypes.AccessList, +) *MsgEthereumTx { + return newMsgEthereumTx(chainID, nonce, nil, amount, gasLimit, gasPrice, gasFeeCap, gasTipCap, input, accesses) +} + +func newMsgEthereumTx( + chainID *big.Int, nonce uint64, to *common.Address, amount *big.Int, + gasLimit uint64, gasPrice, gasFeeCap, gasTipCap *big.Int, input []byte, accesses *ethtypes.AccessList, +) *MsgEthereumTx { + var ( + cid, amt, gp *sdk.Int + toAddr string + txData TxData + ) + + if to != nil { + toAddr = to.Hex() + } + + if amount != nil { + amountInt := sdk.NewIntFromBigInt(amount) + amt = &amountInt + } + + if chainID != nil { + chainIDInt := sdk.NewIntFromBigInt(chainID) + cid = &chainIDInt + } + + if gasPrice != nil { + gasPriceInt := sdk.NewIntFromBigInt(gasPrice) + gp = &gasPriceInt + } + + switch { + case accesses == nil: + txData = &LegacyTx{ + Nonce: nonce, + To: toAddr, + Amount: amt, + GasLimit: gasLimit, + GasPrice: gp, + Data: input, + } + case accesses != nil && gasFeeCap != nil && gasTipCap != nil: + gtc := sdk.NewIntFromBigInt(gasTipCap) + gfc := sdk.NewIntFromBigInt(gasFeeCap) + + txData = &DynamicFeeTx{ + ChainID: cid, + Nonce: nonce, + To: toAddr, + Amount: amt, + GasLimit: gasLimit, + GasTipCap: >c, + GasFeeCap: &gfc, + Data: input, + Accesses: NewAccessList(accesses), + } + case accesses != nil: + txData = &AccessListTx{ + ChainID: cid, + Nonce: nonce, + To: toAddr, + Amount: amt, + GasLimit: gasLimit, + GasPrice: gp, + Data: input, + Accesses: NewAccessList(accesses), + } + default: + } + + dataAny, err := PackTxData(txData) + if err != nil { + panic(err) + } + + return &MsgEthereumTx{Data: dataAny} +} + +// fromEthereumTx populates the message fields from the given ethereum transaction +func (msg *MsgEthereumTx) FromEthereumTx(tx *ethtypes.Transaction) error { + txData, err := NewTxDataFromTx(tx) + if err != nil { + return err + } + + anyTxData, err := PackTxData(txData) + if err != nil { + return err + } + + msg.Data = anyTxData + msg.Size_ = float64(tx.Size()) + msg.Hash = tx.Hash().Hex() + return nil +} + +// Route returns the route value of an MsgEthereumTx. +func (msg MsgEthereumTx) Route() string { return RouterKey } + +// Type returns the type value of an MsgEthereumTx. +func (msg MsgEthereumTx) Type() string { return TypeMsgEthereumTx } + +// ValidateBasic implements the sdk.Msg interface. It performs basic validation +// checks of a Transaction. If returns an error if validation fails. +func (msg MsgEthereumTx) ValidateBasic() error { + if msg.From != "" { + if err := types.ValidateAddress(msg.From); err != nil { + return sdkerrors.Wrap(err, "invalid from address") + } + } + + txData, err := UnpackTxData(msg.Data) + if err != nil { + return sdkerrors.Wrap(err, "failed to unpack tx data") + } + + return txData.Validate() +} + +// GetMsgs returns a single MsgEthereumTx as an sdk.Msg. +func (msg *MsgEthereumTx) GetMsgs() []sdk.Msg { + return []sdk.Msg{msg} +} + +// GetSigners returns the expected signers for an Ethereum transaction message. +// For such a message, there should exist only a single 'signer'. +// +// NOTE: This method panics if 'Sign' hasn't been called first. +func (msg *MsgEthereumTx) GetSigners() []sdk.AccAddress { + data, err := UnpackTxData(msg.Data) + if err != nil { + panic(err) + } + + sender, err := msg.GetSender(data.GetChainID()) + if err != nil { + panic(err) + } + + signer := sdk.AccAddress(sender.Bytes()) + return []sdk.AccAddress{signer} +} + +// GetSignBytes returns the Amino bytes of an Ethereum transaction message used +// for signing. +// +// NOTE: This method cannot be used as a chain ID is needed to create valid bytes +// to sign over. Use 'RLPSignBytes' instead. +func (msg MsgEthereumTx) GetSignBytes() []byte { + panic("must use 'RLPSignBytes' with a chain ID to get the valid bytes to sign") +} + +// Sign calculates a secp256k1 ECDSA signature and signs the transaction. It +// takes a keyring signer and the chainID to sign an Ethereum transaction according to +// EIP155 standard. +// This method mutates the transaction as it populates the V, R, S +// fields of the Transaction's Signature. +// The function will fail if the sender address is not defined for the msg or if +// the sender is not registered on the keyring +func (msg *MsgEthereumTx) Sign(ethSigner ethtypes.Signer, keyringSigner keyring.Signer) error { + from := msg.GetFrom() + if from.Empty() { + return fmt.Errorf("sender address not defined for message") + } + + tx := msg.AsTransaction() + txHash := ethSigner.Hash(tx) + + sig, _, err := keyringSigner.SignByAddress(from, txHash.Bytes()) + if err != nil { + return err + } + + tx, err = tx.WithSignature(ethSigner, sig) + if err != nil { + return err + } + + return msg.FromEthereumTx(tx) +} + +// GetGas implements the GasTx interface. It returns the GasLimit of the transaction. +func (msg MsgEthereumTx) GetGas() uint64 { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return 0 + } + return txData.GetGas() +} + +// GetFee returns the fee for non dynamic fee tx +func (msg MsgEthereumTx) GetFee() *big.Int { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil + } + return txData.Fee() +} + +// GetEffectiveFee returns the fee for dynamic fee tx +func (msg MsgEthereumTx) GetEffectiveFee(baseFee *big.Int) *big.Int { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil + } + return txData.EffectiveFee(baseFee) +} + +// GetFrom loads the ethereum sender address from the sigcache and returns an +// sdk.AccAddress from its bytes +func (msg *MsgEthereumTx) GetFrom() sdk.AccAddress { + if msg.From == "" { + return nil + } + + return common.HexToAddress(msg.From).Bytes() +} + +// AsTransaction creates an Ethereum Transaction type from the msg fields +func (msg MsgEthereumTx) AsTransaction() *ethtypes.Transaction { + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil + } + + return ethtypes.NewTx(txData.AsEthereumData()) +} + +// AsMessage creates an Ethereum core.Message from the msg fields +func (msg MsgEthereumTx) AsMessage(signer ethtypes.Signer, baseFee *big.Int) (core.Message, error) { + return msg.AsTransaction().AsMessage(signer, baseFee) +} + +// GetSender extracts the sender address from the signature values using the latest signer for the given chainID. +func (msg *MsgEthereumTx) GetSender(chainID *big.Int) (common.Address, error) { + signer := ethtypes.LatestSignerForChainID(chainID) + from, err := signer.Sender(msg.AsTransaction()) + if err != nil { + return common.Address{}, err + } + + msg.From = from.Hex() + return from, nil +} + +// UnpackInterfaces implements UnpackInterfacesMesssage.UnpackInterfaces +func (msg MsgEthereumTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + return unpacker.UnpackAny(msg.Data, new(TxData)) +} + +// UnmarshalBinary decodes the canonical encoding of transactions. +func (msg *MsgEthereumTx) UnmarshalBinary(b []byte) error { + tx := ðtypes.Transaction{} + if err := tx.UnmarshalBinary(b); err != nil { + return err + } + return msg.FromEthereumTx(tx) +} + +// BuildTx builds the canonical cosmos tx from ethereum msg +func (msg *MsgEthereumTx) BuildTx(b client.TxBuilder, evmDenom string) (signing.Tx, error) { + builder, ok := b.(authtx.ExtensionOptionsTxBuilder) + if !ok { + return nil, errors.New("unsupported builder") + } + + option, err := codectypes.NewAnyWithValue(&ExtensionOptionsEthereumTx{}) + if err != nil { + return nil, err + } + + txData, err := UnpackTxData(msg.Data) + if err != nil { + return nil, err + } + fees := make(sdk.Coins, 0) + feeAmt := sdk.NewIntFromBigInt(txData.Fee()) + if feeAmt.Sign() > 0 { + fees = append(fees, sdk.NewCoin(evmDenom, feeAmt)) + } + + builder.SetExtensionOptions(option) + err = builder.SetMsgs(msg) + if err != nil { + return nil, err + } + builder.SetFeeAmount(fees) + builder.SetGasLimit(msg.GetGas()) + tx := builder.GetTx() + return tx, nil +} diff --git a/x/evm/types/params.go b/x/evm/types/params.go new file mode 100644 index 00000000..07dbe827 --- /dev/null +++ b/x/evm/types/params.go @@ -0,0 +1,252 @@ +package types + +import ( + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/stratosnet/stratos-chain/types" +) + +var _ paramtypes.ParamSet = &Params{} + +const ( + DefaultEVMDenom = types.USTOS +) + +// Parameter keys +var ( + ParamStoreKeyEVMDenom = []byte("EVMDenom") + ParamStoreKeyEnableCreate = []byte("EnableCreate") + ParamStoreKeyEnableCall = []byte("EnableCall") + ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs") + ParamStoreKeyChainConfig = []byte("ChainConfig") + + // AvailableExtraEIPs define the list of all EIPs that can be enabled by the + // EVM interpreter. These EIPs are applied in order and can override the + // instruction sets from the latest hard fork enabled by the ChainConfig. For + // more info check: + // https://github.com/ethereum/go-ethereum/blob/master/core/vm/interpreter.go#L97 + AvailableExtraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529} + + // fee market + ParamStoreKeyNoBaseFee = []byte("NoBaseFee") + ParamStoreKeyBaseFeeChangeDenominator = []byte("BaseFeeChangeDenominator") + ParamStoreKeyElasticityMultiplier = []byte("ElasticityMultiplier") + ParamStoreKeyBaseFee = []byte("BaseFee") + ParamStoreKeyEnableHeight = []byte("EnableHeight") +) + +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams(evmDenom string, enableCreate, enableCall bool, config ChainConfig, feeMarketParams FeeMarketParams, extraEIPs ...int64) Params { + return Params{ + EvmDenom: evmDenom, + EnableCreate: enableCreate, + EnableCall: enableCall, + ExtraEIPs: extraEIPs, + ChainConfig: config, + FeeMarketParams: feeMarketParams, + } +} + +// DefaultParams returns default evm parameters +// ExtraEIPs is empty to prevent overriding the latest hard fork instruction set +func DefaultParams() Params { + return Params{ + EvmDenom: DefaultEVMDenom, + EnableCreate: true, + EnableCall: true, + ChainConfig: DefaultChainConfig(), + ExtraEIPs: nil, + FeeMarketParams: DefaultFeeMarketParams(), + } +} + +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(ParamStoreKeyEVMDenom, &p.EvmDenom, validateEVMDenom), + paramtypes.NewParamSetPair(ParamStoreKeyEnableCreate, &p.EnableCreate, validateBool), + paramtypes.NewParamSetPair(ParamStoreKeyEnableCall, &p.EnableCall, validateBool), + paramtypes.NewParamSetPair(ParamStoreKeyExtraEIPs, &p.ExtraEIPs, validateEIPs), + paramtypes.NewParamSetPair(ParamStoreKeyChainConfig, &p.ChainConfig, validateChainConfig), + //fee market + paramtypes.NewParamSetPair(ParamStoreKeyNoBaseFee, &p.FeeMarketParams.NoBaseFee, validateBool), + paramtypes.NewParamSetPair(ParamStoreKeyBaseFeeChangeDenominator, &p.FeeMarketParams.BaseFeeChangeDenominator, validateBaseFeeChangeDenominator), + paramtypes.NewParamSetPair(ParamStoreKeyElasticityMultiplier, &p.FeeMarketParams.ElasticityMultiplier, validateElasticityMultiplier), + paramtypes.NewParamSetPair(ParamStoreKeyBaseFee, &p.FeeMarketParams.BaseFee, validateBaseFee), + paramtypes.NewParamSetPair(ParamStoreKeyEnableHeight, &p.FeeMarketParams.EnableHeight, validateEnableHeight), + } +} + +// Validate performs basic validation on evm parameters. +func (p Params) Validate() error { + if err := sdk.ValidateDenom(p.EvmDenom); err != nil { + return err + } + + if err := validateEIPs(p.ExtraEIPs); err != nil { + return err + } + + if err := p.FeeMarketParams.Validate(); err != nil { + return err + } + + return p.ChainConfig.Validate() +} + +// EIPs returns the ExtraEips as a int slice +func (p Params) EIPs() []int { + eips := make([]int, len(p.ExtraEIPs)) + for i, eip := range p.ExtraEIPs { + eips[i] = int(eip) + } + return eips +} + +func validateEVMDenom(i interface{}) error { + denom, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter EVM denom type: %T", i) + } + + return sdk.ValidateDenom(denom) +} + +func validateBool(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil +} + +func validateEIPs(i interface{}) error { + eips, ok := i.([]int64) + if !ok { + return fmt.Errorf("invalid EIP slice type: %T", i) + } + + for _, eip := range eips { + if !vm.ValidEip(int(eip)) { + return fmt.Errorf("EIP %d is not activateable, valid EIPS are: %s", eip, vm.ActivateableEips()) + } + } + + return nil +} + +func validateChainConfig(i interface{}) error { + cfg, ok := i.(ChainConfig) + if !ok { + return fmt.Errorf("invalid chain config type: %T", i) + } + + return cfg.Validate() +} + +// IsLondon returns if london hardfork is enabled. +func IsLondon(ethConfig *params.ChainConfig, height int64) bool { + return ethConfig.IsLondon(big.NewInt(height)) +} + +// creates a new FeeMarketParams instance +func NewFeeMarketParams(noBaseFee bool, baseFeeChangeDenom, elasticityMultiplier uint32, baseFee uint64, enableHeight int64) FeeMarketParams { + return FeeMarketParams{ + NoBaseFee: noBaseFee, + BaseFeeChangeDenominator: baseFeeChangeDenom, + ElasticityMultiplier: elasticityMultiplier, + BaseFee: sdk.NewIntFromUint64(baseFee), + EnableHeight: enableHeight, + } +} + +// DefaultParams returns default evm parameters +func DefaultFeeMarketParams() FeeMarketParams { + return FeeMarketParams{ + NoBaseFee: false, + BaseFeeChangeDenominator: params.BaseFeeChangeDenominator, + ElasticityMultiplier: params.ElasticityMultiplier, + BaseFee: sdk.NewIntFromUint64(params.InitialBaseFee), + EnableHeight: 0, + } +} + +// Validate performs basic validation on fee market parameters. +func (p FeeMarketParams) Validate() error { + if p.BaseFeeChangeDenominator == 0 { + return fmt.Errorf("base fee change denominator cannot be 0") + } + + if p.BaseFee.IsNegative() { + return fmt.Errorf("initial base fee cannot be negative: %s", p.BaseFee) + } + + if p.EnableHeight < 0 { + return fmt.Errorf("enable height cannot be negative: %d", p.EnableHeight) + } + + return nil +} + +func (p *FeeMarketParams) IsBaseFeeEnabled(height int64) bool { + return !p.NoBaseFee && height >= p.EnableHeight +} + +func validateBaseFeeChangeDenominator(i interface{}) error { + value, ok := i.(uint32) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if value == 0 { + return fmt.Errorf("base fee change denominator cannot be 0") + } + + return nil +} + +func validateElasticityMultiplier(i interface{}) error { + _, ok := i.(uint32) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil +} + +func validateBaseFee(i interface{}) error { + value, ok := i.(sdk.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if value.IsNegative() { + return fmt.Errorf("base fee cannot be negative") + } + + return nil +} + +func validateEnableHeight(i interface{}) error { + value, ok := i.(int64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if value < 0 { + return fmt.Errorf("enable height cannot be negative: %d", value) + } + + return nil +} diff --git a/x/evm/types/query.go b/x/evm/types/query.go new file mode 100644 index 00000000..677d918c --- /dev/null +++ b/x/evm/types/query.go @@ -0,0 +1,24 @@ +package types + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" +) + +// UnpackInterfaces implements UnpackInterfacesMesssage.UnpackInterfaces +func (m QueryTraceTxRequest) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + for _, msg := range m.Predecessors { + if err := msg.UnpackInterfaces(unpacker); err != nil { + return err + } + } + return m.Msg.UnpackInterfaces(unpacker) +} + +func (m QueryTraceBlockRequest) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + for _, msg := range m.Txs { + if err := msg.UnpackInterfaces(unpacker); err != nil { + return err + } + } + return nil +} diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go new file mode 100644 index 00000000..a273db66 --- /dev/null +++ b/x/evm/types/query.pb.go @@ -0,0 +1,5985 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/evm/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// QueryAccountRequest is the request type for the Query/Account RPC method. +type QueryAccountRequest struct { + // address is the ethereum hex address to query the account for. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryAccountRequest) Reset() { *m = QueryAccountRequest{} } +func (m *QueryAccountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAccountRequest) ProtoMessage() {} +func (*QueryAccountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{0} +} +func (m *QueryAccountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAccountRequest.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 *QueryAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAccountRequest.Merge(m, src) +} +func (m *QueryAccountRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAccountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAccountRequest proto.InternalMessageInfo + +// QueryAccountResponse is the response type for the Query/Account RPC method. +type QueryAccountResponse struct { + // balance is the balance of the EVM denomination. + Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` + // code hash is the hex-formatted code bytes from the EOA. + CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + // nonce is the account's sequence number. + Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` +} + +func (m *QueryAccountResponse) Reset() { *m = QueryAccountResponse{} } +func (m *QueryAccountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAccountResponse) ProtoMessage() {} +func (*QueryAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{1} +} +func (m *QueryAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAccountResponse.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 *QueryAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAccountResponse.Merge(m, src) +} +func (m *QueryAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAccountResponse proto.InternalMessageInfo + +func (m *QueryAccountResponse) GetBalance() string { + if m != nil { + return m.Balance + } + return "" +} + +func (m *QueryAccountResponse) GetCodeHash() string { + if m != nil { + return m.CodeHash + } + return "" +} + +func (m *QueryAccountResponse) GetNonce() uint64 { + if m != nil { + return m.Nonce + } + return 0 +} + +// QueryCosmosAccountRequest is the request type for the Query/CosmosAccount RPC +// method. +type QueryCosmosAccountRequest struct { + // address is the ethereum hex address to query the account for. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryCosmosAccountRequest) Reset() { *m = QueryCosmosAccountRequest{} } +func (m *QueryCosmosAccountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCosmosAccountRequest) ProtoMessage() {} +func (*QueryCosmosAccountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{2} +} +func (m *QueryCosmosAccountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCosmosAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCosmosAccountRequest.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 *QueryCosmosAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCosmosAccountRequest.Merge(m, src) +} +func (m *QueryCosmosAccountRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCosmosAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCosmosAccountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCosmosAccountRequest proto.InternalMessageInfo + +// QueryCosmosAccountResponse is the response type for the Query/CosmosAccount +// RPC method. +type QueryCosmosAccountResponse struct { + // cosmos_address is the cosmos address of the account. + CosmosAddress string `protobuf:"bytes,1,opt,name=cosmos_address,json=cosmosAddress,proto3" json:"cosmos_address,omitempty"` + // sequence is the account's sequence number. + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` + // account_number is the account numbert + AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"` +} + +func (m *QueryCosmosAccountResponse) Reset() { *m = QueryCosmosAccountResponse{} } +func (m *QueryCosmosAccountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCosmosAccountResponse) ProtoMessage() {} +func (*QueryCosmosAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{3} +} +func (m *QueryCosmosAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCosmosAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCosmosAccountResponse.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 *QueryCosmosAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCosmosAccountResponse.Merge(m, src) +} +func (m *QueryCosmosAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCosmosAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCosmosAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCosmosAccountResponse proto.InternalMessageInfo + +func (m *QueryCosmosAccountResponse) GetCosmosAddress() string { + if m != nil { + return m.CosmosAddress + } + return "" +} + +func (m *QueryCosmosAccountResponse) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +func (m *QueryCosmosAccountResponse) GetAccountNumber() uint64 { + if m != nil { + return m.AccountNumber + } + return 0 +} + +// QueryValidatorAccountRequest is the request type for the +// Query/ValidatorAccount RPC method. +type QueryValidatorAccountRequest struct { + // cons_address is the validator cons address to query the account for. + ConsAddress string `protobuf:"bytes,1,opt,name=cons_address,json=consAddress,proto3" json:"cons_address,omitempty"` +} + +func (m *QueryValidatorAccountRequest) Reset() { *m = QueryValidatorAccountRequest{} } +func (m *QueryValidatorAccountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorAccountRequest) ProtoMessage() {} +func (*QueryValidatorAccountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{4} +} +func (m *QueryValidatorAccountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorAccountRequest.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 *QueryValidatorAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorAccountRequest.Merge(m, src) +} +func (m *QueryValidatorAccountRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorAccountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorAccountRequest proto.InternalMessageInfo + +// QueryValidatorAccountResponse is the response type for the +// Query/ValidatorAccount RPC method. +type QueryValidatorAccountResponse struct { + // account_address is the cosmos address of the account in bech32 format. + AccountAddress string `protobuf:"bytes,1,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"` + // sequence is the account's sequence number. + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` + // account_number is the account number + AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"` +} + +func (m *QueryValidatorAccountResponse) Reset() { *m = QueryValidatorAccountResponse{} } +func (m *QueryValidatorAccountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorAccountResponse) ProtoMessage() {} +func (*QueryValidatorAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{5} +} +func (m *QueryValidatorAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorAccountResponse.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 *QueryValidatorAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorAccountResponse.Merge(m, src) +} +func (m *QueryValidatorAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorAccountResponse proto.InternalMessageInfo + +func (m *QueryValidatorAccountResponse) GetAccountAddress() string { + if m != nil { + return m.AccountAddress + } + return "" +} + +func (m *QueryValidatorAccountResponse) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +func (m *QueryValidatorAccountResponse) GetAccountNumber() uint64 { + if m != nil { + return m.AccountNumber + } + return 0 +} + +// QueryBalanceRequest is the request type for the Query/Balance RPC method. +type QueryBalanceRequest struct { + // address is the ethereum hex address to query the balance for. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryBalanceRequest) Reset() { *m = QueryBalanceRequest{} } +func (m *QueryBalanceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBalanceRequest) ProtoMessage() {} +func (*QueryBalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{6} +} +func (m *QueryBalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBalanceRequest.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 *QueryBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBalanceRequest.Merge(m, src) +} +func (m *QueryBalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBalanceRequest proto.InternalMessageInfo + +// QueryBalanceResponse is the response type for the Query/Balance RPC method. +type QueryBalanceResponse struct { + // balance is the balance of the EVM denomination. + Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` +} + +func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} } +func (m *QueryBalanceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBalanceResponse) ProtoMessage() {} +func (*QueryBalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{7} +} +func (m *QueryBalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBalanceResponse.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 *QueryBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBalanceResponse.Merge(m, src) +} +func (m *QueryBalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo + +func (m *QueryBalanceResponse) GetBalance() string { + if m != nil { + return m.Balance + } + return "" +} + +// QueryStorageRequest is the request type for the Query/Storage RPC method. +type QueryStorageRequest struct { + /// address is the ethereum hex address to query the storage state for. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // key defines the key of the storage state + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *QueryStorageRequest) Reset() { *m = QueryStorageRequest{} } +func (m *QueryStorageRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStorageRequest) ProtoMessage() {} +func (*QueryStorageRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{8} +} +func (m *QueryStorageRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStorageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStorageRequest.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 *QueryStorageRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStorageRequest.Merge(m, src) +} +func (m *QueryStorageRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStorageRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStorageRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStorageRequest proto.InternalMessageInfo + +// QueryStorageResponse is the response type for the Query/Storage RPC +// method. +type QueryStorageResponse struct { + // key defines the storage state value hash associated with the given key. + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *QueryStorageResponse) Reset() { *m = QueryStorageResponse{} } +func (m *QueryStorageResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStorageResponse) ProtoMessage() {} +func (*QueryStorageResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{9} +} +func (m *QueryStorageResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStorageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStorageResponse.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 *QueryStorageResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStorageResponse.Merge(m, src) +} +func (m *QueryStorageResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStorageResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStorageResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStorageResponse proto.InternalMessageInfo + +func (m *QueryStorageResponse) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// QueryCodeRequest is the request type for the Query/Code RPC method. +type QueryCodeRequest struct { + // address is the ethereum hex address to query the code for. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryCodeRequest) Reset() { *m = QueryCodeRequest{} } +func (m *QueryCodeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCodeRequest) ProtoMessage() {} +func (*QueryCodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{10} +} +func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCodeRequest.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 *QueryCodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeRequest.Merge(m, src) +} +func (m *QueryCodeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCodeRequest proto.InternalMessageInfo + +// QueryCodeResponse is the response type for the Query/Code RPC +// method. +type QueryCodeResponse struct { + // code represents the code bytes from an ethereum address. + Code []byte `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` +} + +func (m *QueryCodeResponse) Reset() { *m = QueryCodeResponse{} } +func (m *QueryCodeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCodeResponse) ProtoMessage() {} +func (*QueryCodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{11} +} +func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCodeResponse.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 *QueryCodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeResponse.Merge(m, src) +} +func (m *QueryCodeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCodeResponse proto.InternalMessageInfo + +func (m *QueryCodeResponse) GetCode() []byte { + if m != nil { + return m.Code + } + return nil +} + +// QueryTxLogsRequest is the request type for the Query/TxLogs RPC method. +type QueryTxLogsRequest struct { + // hash is the ethereum transaction hex hash to query the logs for. + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryTxLogsRequest) Reset() { *m = QueryTxLogsRequest{} } +func (m *QueryTxLogsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTxLogsRequest) ProtoMessage() {} +func (*QueryTxLogsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{12} +} +func (m *QueryTxLogsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTxLogsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTxLogsRequest.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 *QueryTxLogsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTxLogsRequest.Merge(m, src) +} +func (m *QueryTxLogsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTxLogsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTxLogsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTxLogsRequest proto.InternalMessageInfo + +// QueryTxLogs is the response type for the Query/TxLogs RPC method. +type QueryTxLogsResponse struct { + // logs represents the ethereum logs generated from the given transaction. + Logs []*Log `protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryTxLogsResponse) Reset() { *m = QueryTxLogsResponse{} } +func (m *QueryTxLogsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTxLogsResponse) ProtoMessage() {} +func (*QueryTxLogsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{13} +} +func (m *QueryTxLogsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTxLogsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTxLogsResponse.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 *QueryTxLogsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTxLogsResponse.Merge(m, src) +} +func (m *QueryTxLogsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTxLogsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTxLogsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTxLogsResponse proto.InternalMessageInfo + +func (m *QueryTxLogsResponse) GetLogs() []*Log { + if m != nil { + return m.Logs + } + return nil +} + +func (m *QueryTxLogsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryParamsRequest defines the request type for querying x/evm parameters. +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_f35039d5386d306b, []int{14} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse defines the response type for querying x/evm parameters. +type QueryParamsResponse struct { + // params define the evm module parameters. + 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_f35039d5386d306b, []int{15} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// EthCallRequest defines EthCall request +type EthCallRequest struct { + // same json format as the json rpc api. + Args []byte `protobuf:"bytes,1,opt,name=args,proto3" json:"args,omitempty"` + // the default gas cap to be used + GasCap uint64 `protobuf:"varint,2,opt,name=gas_cap,json=gasCap,proto3" json:"gas_cap,omitempty"` +} + +func (m *EthCallRequest) Reset() { *m = EthCallRequest{} } +func (m *EthCallRequest) String() string { return proto.CompactTextString(m) } +func (*EthCallRequest) ProtoMessage() {} +func (*EthCallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{16} +} +func (m *EthCallRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EthCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EthCallRequest.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 *EthCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_EthCallRequest.Merge(m, src) +} +func (m *EthCallRequest) XXX_Size() int { + return m.Size() +} +func (m *EthCallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_EthCallRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_EthCallRequest proto.InternalMessageInfo + +func (m *EthCallRequest) GetArgs() []byte { + if m != nil { + return m.Args + } + return nil +} + +func (m *EthCallRequest) GetGasCap() uint64 { + if m != nil { + return m.GasCap + } + return 0 +} + +// EstimateGasResponse defines EstimateGas response +type EstimateGasResponse struct { + // the estimated gas + Gas uint64 `protobuf:"varint,1,opt,name=gas,proto3" json:"gas,omitempty"` +} + +func (m *EstimateGasResponse) Reset() { *m = EstimateGasResponse{} } +func (m *EstimateGasResponse) String() string { return proto.CompactTextString(m) } +func (*EstimateGasResponse) ProtoMessage() {} +func (*EstimateGasResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{17} +} +func (m *EstimateGasResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EstimateGasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EstimateGasResponse.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 *EstimateGasResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_EstimateGasResponse.Merge(m, src) +} +func (m *EstimateGasResponse) XXX_Size() int { + return m.Size() +} +func (m *EstimateGasResponse) XXX_DiscardUnknown() { + xxx_messageInfo_EstimateGasResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_EstimateGasResponse proto.InternalMessageInfo + +func (m *EstimateGasResponse) GetGas() uint64 { + if m != nil { + return m.Gas + } + return 0 +} + +// QueryTraceTxRequest defines TraceTx request +type QueryTraceTxRequest struct { + // msgEthereumTx for the requested transaction + Msg *MsgEthereumTx `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` + // transaction index + TxIndex uint64 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` + // TraceConfig holds extra parameters to trace functions. + TraceConfig *TraceConfig `protobuf:"bytes,3,opt,name=trace_config,json=traceConfig,proto3" json:"trace_config,omitempty"` + // the predecessor transactions included in the same block + // need to be replayed first to get correct context for tracing. + Predecessors []*MsgEthereumTx `protobuf:"bytes,4,rep,name=predecessors,proto3" json:"predecessors,omitempty"` + // block number of requested transaction + BlockNumber int64 `protobuf:"varint,5,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // block hex hash of requested transaction + BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + // block time of requested transaction + BlockTime time.Time `protobuf:"bytes,7,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time"` +} + +func (m *QueryTraceTxRequest) Reset() { *m = QueryTraceTxRequest{} } +func (m *QueryTraceTxRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTraceTxRequest) ProtoMessage() {} +func (*QueryTraceTxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{18} +} +func (m *QueryTraceTxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTraceTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTraceTxRequest.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 *QueryTraceTxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTraceTxRequest.Merge(m, src) +} +func (m *QueryTraceTxRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTraceTxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTraceTxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTraceTxRequest proto.InternalMessageInfo + +func (m *QueryTraceTxRequest) GetMsg() *MsgEthereumTx { + if m != nil { + return m.Msg + } + return nil +} + +func (m *QueryTraceTxRequest) GetTxIndex() uint64 { + if m != nil { + return m.TxIndex + } + return 0 +} + +func (m *QueryTraceTxRequest) GetTraceConfig() *TraceConfig { + if m != nil { + return m.TraceConfig + } + return nil +} + +func (m *QueryTraceTxRequest) GetPredecessors() []*MsgEthereumTx { + if m != nil { + return m.Predecessors + } + return nil +} + +func (m *QueryTraceTxRequest) GetBlockNumber() int64 { + if m != nil { + return m.BlockNumber + } + return 0 +} + +func (m *QueryTraceTxRequest) GetBlockHash() string { + if m != nil { + return m.BlockHash + } + return "" +} + +func (m *QueryTraceTxRequest) GetBlockTime() time.Time { + if m != nil { + return m.BlockTime + } + return time.Time{} +} + +// QueryTraceTxResponse defines TraceTx response +type QueryTraceTxResponse struct { + // response serialized in bytes + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *QueryTraceTxResponse) Reset() { *m = QueryTraceTxResponse{} } +func (m *QueryTraceTxResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTraceTxResponse) ProtoMessage() {} +func (*QueryTraceTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{19} +} +func (m *QueryTraceTxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTraceTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTraceTxResponse.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 *QueryTraceTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTraceTxResponse.Merge(m, src) +} +func (m *QueryTraceTxResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTraceTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTraceTxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTraceTxResponse proto.InternalMessageInfo + +func (m *QueryTraceTxResponse) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +// QueryTraceBlockRequest defines TraceTx request +type QueryTraceBlockRequest struct { + // txs messages in the block + Txs []*MsgEthereumTx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` + // TraceConfig holds extra parameters to trace functions. + TraceConfig *TraceConfig `protobuf:"bytes,3,opt,name=trace_config,json=traceConfig,proto3" json:"trace_config,omitempty"` + // block number + BlockNumber int64 `protobuf:"varint,5,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // block hex hash + BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + // block time + BlockTime time.Time `protobuf:"bytes,7,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time"` +} + +func (m *QueryTraceBlockRequest) Reset() { *m = QueryTraceBlockRequest{} } +func (m *QueryTraceBlockRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTraceBlockRequest) ProtoMessage() {} +func (*QueryTraceBlockRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{20} +} +func (m *QueryTraceBlockRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTraceBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTraceBlockRequest.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 *QueryTraceBlockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTraceBlockRequest.Merge(m, src) +} +func (m *QueryTraceBlockRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTraceBlockRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTraceBlockRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTraceBlockRequest proto.InternalMessageInfo + +func (m *QueryTraceBlockRequest) GetTxs() []*MsgEthereumTx { + if m != nil { + return m.Txs + } + return nil +} + +func (m *QueryTraceBlockRequest) GetTraceConfig() *TraceConfig { + if m != nil { + return m.TraceConfig + } + return nil +} + +func (m *QueryTraceBlockRequest) GetBlockNumber() int64 { + if m != nil { + return m.BlockNumber + } + return 0 +} + +func (m *QueryTraceBlockRequest) GetBlockHash() string { + if m != nil { + return m.BlockHash + } + return "" +} + +func (m *QueryTraceBlockRequest) GetBlockTime() time.Time { + if m != nil { + return m.BlockTime + } + return time.Time{} +} + +// QueryTraceBlockResponse defines TraceBlock response +type QueryTraceBlockResponse struct { + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *QueryTraceBlockResponse) Reset() { *m = QueryTraceBlockResponse{} } +func (m *QueryTraceBlockResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTraceBlockResponse) ProtoMessage() {} +func (*QueryTraceBlockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{21} +} +func (m *QueryTraceBlockResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTraceBlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTraceBlockResponse.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 *QueryTraceBlockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTraceBlockResponse.Merge(m, src) +} +func (m *QueryTraceBlockResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTraceBlockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTraceBlockResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTraceBlockResponse proto.InternalMessageInfo + +func (m *QueryTraceBlockResponse) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +// QueryBaseFeeRequest defines the request type for querying the EIP1559 base +// fee. +type QueryBaseFeeRequest struct { +} + +func (m *QueryBaseFeeRequest) Reset() { *m = QueryBaseFeeRequest{} } +func (m *QueryBaseFeeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBaseFeeRequest) ProtoMessage() {} +func (*QueryBaseFeeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{22} +} +func (m *QueryBaseFeeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBaseFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBaseFeeRequest.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 *QueryBaseFeeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBaseFeeRequest.Merge(m, src) +} +func (m *QueryBaseFeeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBaseFeeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBaseFeeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBaseFeeRequest proto.InternalMessageInfo + +// BaseFeeResponse returns the EIP1559 base fee. +type QueryBaseFeeResponse struct { + BaseFee *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=base_fee,json=baseFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"base_fee,omitempty"` +} + +func (m *QueryBaseFeeResponse) Reset() { *m = QueryBaseFeeResponse{} } +func (m *QueryBaseFeeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBaseFeeResponse) ProtoMessage() {} +func (*QueryBaseFeeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{23} +} +func (m *QueryBaseFeeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBaseFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBaseFeeResponse.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 *QueryBaseFeeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBaseFeeResponse.Merge(m, src) +} +func (m *QueryBaseFeeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBaseFeeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBaseFeeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBaseFeeResponse proto.InternalMessageInfo + +// QueryBlockGasRequest defines the request type for querying the EIP1559 base +// fee. +type QueryBlockGasRequest struct { +} + +func (m *QueryBlockGasRequest) Reset() { *m = QueryBlockGasRequest{} } +func (m *QueryBlockGasRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlockGasRequest) ProtoMessage() {} +func (*QueryBlockGasRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{24} +} +func (m *QueryBlockGasRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockGasRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockGasRequest.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 *QueryBlockGasRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockGasRequest.Merge(m, src) +} +func (m *QueryBlockGasRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockGasRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockGasRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlockGasRequest proto.InternalMessageInfo + +// QueryBlockGasResponse returns block gas used for a given height. +type QueryBlockGasResponse struct { + Gas int64 `protobuf:"varint,1,opt,name=gas,proto3" json:"gas,omitempty"` +} + +func (m *QueryBlockGasResponse) Reset() { *m = QueryBlockGasResponse{} } +func (m *QueryBlockGasResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlockGasResponse) ProtoMessage() {} +func (*QueryBlockGasResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f35039d5386d306b, []int{25} +} +func (m *QueryBlockGasResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockGasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockGasResponse.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 *QueryBlockGasResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockGasResponse.Merge(m, src) +} +func (m *QueryBlockGasResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockGasResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockGasResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlockGasResponse proto.InternalMessageInfo + +func (m *QueryBlockGasResponse) GetGas() int64 { + if m != nil { + return m.Gas + } + return 0 +} + +func init() { + proto.RegisterType((*QueryAccountRequest)(nil), "stratos.evm.v1.QueryAccountRequest") + proto.RegisterType((*QueryAccountResponse)(nil), "stratos.evm.v1.QueryAccountResponse") + proto.RegisterType((*QueryCosmosAccountRequest)(nil), "stratos.evm.v1.QueryCosmosAccountRequest") + proto.RegisterType((*QueryCosmosAccountResponse)(nil), "stratos.evm.v1.QueryCosmosAccountResponse") + proto.RegisterType((*QueryValidatorAccountRequest)(nil), "stratos.evm.v1.QueryValidatorAccountRequest") + proto.RegisterType((*QueryValidatorAccountResponse)(nil), "stratos.evm.v1.QueryValidatorAccountResponse") + proto.RegisterType((*QueryBalanceRequest)(nil), "stratos.evm.v1.QueryBalanceRequest") + proto.RegisterType((*QueryBalanceResponse)(nil), "stratos.evm.v1.QueryBalanceResponse") + proto.RegisterType((*QueryStorageRequest)(nil), "stratos.evm.v1.QueryStorageRequest") + proto.RegisterType((*QueryStorageResponse)(nil), "stratos.evm.v1.QueryStorageResponse") + proto.RegisterType((*QueryCodeRequest)(nil), "stratos.evm.v1.QueryCodeRequest") + proto.RegisterType((*QueryCodeResponse)(nil), "stratos.evm.v1.QueryCodeResponse") + proto.RegisterType((*QueryTxLogsRequest)(nil), "stratos.evm.v1.QueryTxLogsRequest") + proto.RegisterType((*QueryTxLogsResponse)(nil), "stratos.evm.v1.QueryTxLogsResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "stratos.evm.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "stratos.evm.v1.QueryParamsResponse") + proto.RegisterType((*EthCallRequest)(nil), "stratos.evm.v1.EthCallRequest") + proto.RegisterType((*EstimateGasResponse)(nil), "stratos.evm.v1.EstimateGasResponse") + proto.RegisterType((*QueryTraceTxRequest)(nil), "stratos.evm.v1.QueryTraceTxRequest") + proto.RegisterType((*QueryTraceTxResponse)(nil), "stratos.evm.v1.QueryTraceTxResponse") + proto.RegisterType((*QueryTraceBlockRequest)(nil), "stratos.evm.v1.QueryTraceBlockRequest") + proto.RegisterType((*QueryTraceBlockResponse)(nil), "stratos.evm.v1.QueryTraceBlockResponse") + proto.RegisterType((*QueryBaseFeeRequest)(nil), "stratos.evm.v1.QueryBaseFeeRequest") + proto.RegisterType((*QueryBaseFeeResponse)(nil), "stratos.evm.v1.QueryBaseFeeResponse") + proto.RegisterType((*QueryBlockGasRequest)(nil), "stratos.evm.v1.QueryBlockGasRequest") + proto.RegisterType((*QueryBlockGasResponse)(nil), "stratos.evm.v1.QueryBlockGasResponse") +} + +func init() { proto.RegisterFile("stratos/evm/v1/query.proto", fileDescriptor_f35039d5386d306b) } + +var fileDescriptor_f35039d5386d306b = []byte{ + // 1421 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x26, 0x4e, 0x9c, 0x3e, 0x27, 0xfd, 0xe6, 0x3b, 0x4d, 0x53, 0x77, 0xd3, 0x38, 0xc9, + 0xa6, 0xad, 0x93, 0xa8, 0xd9, 0x6d, 0x02, 0x42, 0x80, 0x04, 0x28, 0x89, 0xd2, 0x52, 0xb5, 0xa0, + 0x62, 0x22, 0x0e, 0x48, 0xc8, 0x1a, 0xaf, 0xa7, 0x6b, 0x2b, 0xf6, 0xae, 0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 0xf8, 0x28, 0x27, 0xc4, + 0xa3, 0xdc, 0xf9, 0x61, 0x16, 0x26, 0x85, 0x2d, 0xfa, 0x1c, 0xb2, 0x4a, 0x37, 0xd1, 0x5a, 0x32, + 0x5a, 0x43, 0xda, 0x22, 0xf3, 0xe2, 0xc9, 0x46, 0x12, 0xd1, 0xda, 0x78, 0xf8, 0xd3, 0xef, 0xdf, + 0x8d, 0xaf, 0xa1, 0x55, 0x27, 0xd1, 0x96, 0x29, 0xd5, 0x74, 0xee, 0x2b, 0x89, 0x78, 0x80, 0xbe, + 0x37, 0x60, 0x36, 0xd6, 0x98, 0xa0, 0x8d, 0xa1, 0x10, 0xc3, 0xda, 0x1f, 0x73, 0xf3, 0x65, 0x4c, + 0x15, 0xa7, 0xab, 0x82, 0xd3, 0x26, 0x5a, 0x4f, 0x72, 0xd2, 0xdd, 0xcf, 0x00, 0xb5, 0x1f, 0x0d, + 0x98, 0x4b, 0x76, 0x17, 0xe8, 0xca, 0x50, 0xc8, 0x94, 0x96, 0xc6, 0xdc, 0x7a, 0x49, 0x6b, 0xc5, + 0xf1, 0x4d, 0xc1, 0x71, 0x07, 0x5d, 0x4d, 0x72, 0xec, 0xe8, 0x1d, 0x7d, 0x9a, 0xd1, 0x56, 0xe9, + 0x01, 0xfa, 0xc2, 0x80, 0xac, 0xea, 0x20, 0x52, 0x02, 0x19, 0x6f, 0x4d, 0x52, 0x02, 0x99, 0x68, + 0x42, 0xac, 0x4d, 0x41, 0xe8, 0x22, 0xb2, 0x92, 0x84, 0x54, 0x2f, 0x42, 0x23, 0xd7, 0xf5, 0xa5, + 0x01, 0x59, 0xd5, 0x45, 0xa4, 0x50, 0x88, 0x37, 0x2c, 0x29, 0x14, 0x12, 0x8d, 0x88, 0xe5, 0x08, + 0x0a, 0x1b, 0xa8, 0x98, 0xa4, 0x40, 0xa5, 0x61, 0x9f, 0x81, 0x73, 0xff, 0x88, 0x1c, 0x3f, 0x40, + 0x0c, 0x32, 0xbc, 0xcd, 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0x74, 0x1b, 0x2a, 0x4c, 0xd6, + 0xaa, 0x80, 0x5e, 0x44, 0xe7, 0x07, 0xa0, 0x85, 0x92, 0x7b, 0x98, 0xee, 0xdd, 0x78, 0xf2, 0xbc, + 0x60, 0x3c, 0x7d, 0x5e, 0x30, 0x7e, 0x7b, 0x5e, 0x30, 0x1e, 0xbd, 0x28, 0x8c, 0x3d, 0x7d, 0x51, + 0x18, 0xfb, 0xf9, 0x45, 0x61, 0xec, 0x53, 0x27, 0xa2, 0x9b, 0x6a, 0xbb, 0x4f, 0x98, 0xfe, 0xdd, + 0x72, 0x6b, 0xb8, 0xee, 0x3b, 0x5d, 0xe1, 0x51, 0x88, 0x68, 0x65, 0x4a, 0x74, 0x01, 0xaf, 0xfd, + 0x15, 0x00, 0x00, 0xff, 0xff, 0xce, 0xc9, 0x54, 0xe9, 0xd1, 0x10, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Account queries an Ethereum account. + Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) + // CosmosAccount queries an Ethereum account's Cosmos Address. + CosmosAccount(ctx context.Context, in *QueryCosmosAccountRequest, opts ...grpc.CallOption) (*QueryCosmosAccountResponse, error) + // ValidatorAccount queries an Ethereum account's from a validator consensus + // Address. + ValidatorAccount(ctx context.Context, in *QueryValidatorAccountRequest, opts ...grpc.CallOption) (*QueryValidatorAccountResponse, error) + // Balance queries the balance of a the EVM denomination for a single + // EthAccount. + Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) + // Storage queries the balance of all coins for a single account. + Storage(ctx context.Context, in *QueryStorageRequest, opts ...grpc.CallOption) (*QueryStorageResponse, error) + // Code queries the balance of all coins for a single account. + Code(ctx context.Context, in *QueryCodeRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) + // Params queries the parameters of x/evm module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // EthCall implements the `eth_call` rpc api + EthCall(ctx context.Context, in *EthCallRequest, opts ...grpc.CallOption) (*MsgEthereumTxResponse, error) + // EstimateGas implements the `eth_estimateGas` rpc api + EstimateGas(ctx context.Context, in *EthCallRequest, opts ...grpc.CallOption) (*EstimateGasResponse, error) + // TraceTx implements the `debug_traceTransaction` rpc api + TraceTx(ctx context.Context, in *QueryTraceTxRequest, opts ...grpc.CallOption) (*QueryTraceTxResponse, error) + // TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api + TraceBlock(ctx context.Context, in *QueryTraceBlockRequest, opts ...grpc.CallOption) (*QueryTraceBlockResponse, error) + // BaseFee queries the base fee of the parent block of the current block. + QueryBaseFee(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) + // BlockGas queries the gas used at a given block height + BlockGas(ctx context.Context, in *QueryBlockGasRequest, opts ...grpc.CallOption) (*QueryBlockGasResponse, error) +} + +type queryClient struct { + cc *grpc.ClientConn +} + +func NewQueryClient(cc *grpc.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) { + out := new(QueryAccountResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/Account", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) CosmosAccount(ctx context.Context, in *QueryCosmosAccountRequest, opts ...grpc.CallOption) (*QueryCosmosAccountResponse, error) { + out := new(QueryCosmosAccountResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/CosmosAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ValidatorAccount(ctx context.Context, in *QueryValidatorAccountRequest, opts ...grpc.CallOption) (*QueryValidatorAccountResponse, error) { + out := new(QueryValidatorAccountResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/ValidatorAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) { + out := new(QueryBalanceResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/Balance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Storage(ctx context.Context, in *QueryStorageRequest, opts ...grpc.CallOption) (*QueryStorageResponse, error) { + out := new(QueryStorageResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/Storage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Code(ctx context.Context, in *QueryCodeRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) { + out := new(QueryCodeResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/Code", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) EthCall(ctx context.Context, in *EthCallRequest, opts ...grpc.CallOption) (*MsgEthereumTxResponse, error) { + out := new(MsgEthereumTxResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/EthCall", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) EstimateGas(ctx context.Context, in *EthCallRequest, opts ...grpc.CallOption) (*EstimateGasResponse, error) { + out := new(EstimateGasResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/EstimateGas", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TraceTx(ctx context.Context, in *QueryTraceTxRequest, opts ...grpc.CallOption) (*QueryTraceTxResponse, error) { + out := new(QueryTraceTxResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/TraceTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TraceBlock(ctx context.Context, in *QueryTraceBlockRequest, opts ...grpc.CallOption) (*QueryTraceBlockResponse, error) { + out := new(QueryTraceBlockResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/TraceBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryBaseFee(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) { + out := new(QueryBaseFeeResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/QueryBaseFee", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BlockGas(ctx context.Context, in *QueryBlockGasRequest, opts ...grpc.CallOption) (*QueryBlockGasResponse, error) { + out := new(QueryBlockGasResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/BlockGas", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Account queries an Ethereum account. + Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error) + // CosmosAccount queries an Ethereum account's Cosmos Address. + CosmosAccount(context.Context, *QueryCosmosAccountRequest) (*QueryCosmosAccountResponse, error) + // ValidatorAccount queries an Ethereum account's from a validator consensus + // Address. + ValidatorAccount(context.Context, *QueryValidatorAccountRequest) (*QueryValidatorAccountResponse, error) + // Balance queries the balance of a the EVM denomination for a single + // EthAccount. + Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) + // Storage queries the balance of all coins for a single account. + Storage(context.Context, *QueryStorageRequest) (*QueryStorageResponse, error) + // Code queries the balance of all coins for a single account. + Code(context.Context, *QueryCodeRequest) (*QueryCodeResponse, error) + // Params queries the parameters of x/evm module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // EthCall implements the `eth_call` rpc api + EthCall(context.Context, *EthCallRequest) (*MsgEthereumTxResponse, error) + // EstimateGas implements the `eth_estimateGas` rpc api + EstimateGas(context.Context, *EthCallRequest) (*EstimateGasResponse, error) + // TraceTx implements the `debug_traceTransaction` rpc api + TraceTx(context.Context, *QueryTraceTxRequest) (*QueryTraceTxResponse, error) + // TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api + TraceBlock(context.Context, *QueryTraceBlockRequest) (*QueryTraceBlockResponse, error) + // BaseFee queries the base fee of the parent block of the current block. + QueryBaseFee(context.Context, *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) + // BlockGas queries the gas used at a given block height + BlockGas(context.Context, *QueryBlockGasRequest) (*QueryBlockGasResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Account(ctx context.Context, req *QueryAccountRequest) (*QueryAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Account not implemented") +} +func (*UnimplementedQueryServer) CosmosAccount(ctx context.Context, req *QueryCosmosAccountRequest) (*QueryCosmosAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CosmosAccount not implemented") +} +func (*UnimplementedQueryServer) ValidatorAccount(ctx context.Context, req *QueryValidatorAccountRequest) (*QueryValidatorAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidatorAccount not implemented") +} +func (*UnimplementedQueryServer) Balance(ctx context.Context, req *QueryBalanceRequest) (*QueryBalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") +} +func (*UnimplementedQueryServer) Storage(ctx context.Context, req *QueryStorageRequest) (*QueryStorageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Storage not implemented") +} +func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) EthCall(ctx context.Context, req *EthCallRequest) (*MsgEthereumTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EthCall not implemented") +} +func (*UnimplementedQueryServer) EstimateGas(ctx context.Context, req *EthCallRequest) (*EstimateGasResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EstimateGas not implemented") +} +func (*UnimplementedQueryServer) TraceTx(ctx context.Context, req *QueryTraceTxRequest) (*QueryTraceTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TraceTx not implemented") +} +func (*UnimplementedQueryServer) TraceBlock(ctx context.Context, req *QueryTraceBlockRequest) (*QueryTraceBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TraceBlock not implemented") +} +func (*UnimplementedQueryServer) QueryBaseFee(ctx context.Context, req *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryBaseFee not implemented") +} +func (*UnimplementedQueryServer) BlockGas(ctx context.Context, req *QueryBlockGasRequest) (*QueryBlockGasResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlockGas not implemented") +} + +func RegisterQueryServer(s *grpc.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Account_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Account(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/Account", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Account(ctx, req.(*QueryAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_CosmosAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCosmosAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CosmosAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/CosmosAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CosmosAccount(ctx, req.(*QueryCosmosAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ValidatorAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ValidatorAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/ValidatorAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ValidatorAccount(ctx, req.(*QueryValidatorAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/Balance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Balance(ctx, req.(*QueryBalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Storage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Storage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/Storage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Storage(ctx, req.(*QueryStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Code_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Code(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/Code", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Code(ctx, req.(*QueryCodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_EthCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EthCallRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EthCall(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/EthCall", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EthCall(ctx, req.(*EthCallRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_EstimateGas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EthCallRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EstimateGas(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/EstimateGas", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EstimateGas(ctx, req.(*EthCallRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TraceTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTraceTxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TraceTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/TraceTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TraceTx(ctx, req.(*QueryTraceTxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TraceBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTraceBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TraceBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/TraceBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TraceBlock(ctx, req.(*QueryTraceBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryBaseFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBaseFeeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryBaseFee(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/QueryBaseFee", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryBaseFee(ctx, req.(*QueryBaseFeeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BlockGas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlockGasRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BlockGas(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/BlockGas", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlockGas(ctx, req.(*QueryBlockGasRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.evm.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Account", + Handler: _Query_Account_Handler, + }, + { + MethodName: "CosmosAccount", + Handler: _Query_CosmosAccount_Handler, + }, + { + MethodName: "ValidatorAccount", + Handler: _Query_ValidatorAccount_Handler, + }, + { + MethodName: "Balance", + Handler: _Query_Balance_Handler, + }, + { + MethodName: "Storage", + Handler: _Query_Storage_Handler, + }, + { + MethodName: "Code", + Handler: _Query_Code_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "EthCall", + Handler: _Query_EthCall_Handler, + }, + { + MethodName: "EstimateGas", + Handler: _Query_EstimateGas_Handler, + }, + { + MethodName: "TraceTx", + Handler: _Query_TraceTx_Handler, + }, + { + MethodName: "TraceBlock", + Handler: _Query_TraceBlock_Handler, + }, + { + MethodName: "QueryBaseFee", + Handler: _Query_QueryBaseFee_Handler, + }, + { + MethodName: "BlockGas", + Handler: _Query_BlockGas_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/evm/v1/query.proto", +} + +func (m *QueryAccountRequest) 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 *QueryAccountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAccountRequest) 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 = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAccountResponse) 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 *QueryAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Nonce != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x18 + } + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x12 + } + if len(m.Balance) > 0 { + i -= len(m.Balance) + copy(dAtA[i:], m.Balance) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCosmosAccountRequest) 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 *QueryCosmosAccountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCosmosAccountRequest) 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 = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCosmosAccountResponse) 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 *QueryCosmosAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCosmosAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AccountNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.AccountNumber)) + i-- + dAtA[i] = 0x18 + } + if m.Sequence != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x10 + } + if len(m.CosmosAddress) > 0 { + i -= len(m.CosmosAddress) + copy(dAtA[i:], m.CosmosAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmosAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorAccountRequest) 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 *QueryValidatorAccountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConsAddress) > 0 { + i -= len(m.ConsAddress) + copy(dAtA[i:], m.ConsAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorAccountResponse) 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 *QueryValidatorAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AccountNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.AccountNumber)) + i-- + dAtA[i] = 0x18 + } + if m.Sequence != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x10 + } + if len(m.AccountAddress) > 0 { + i -= len(m.AccountAddress) + copy(dAtA[i:], m.AccountAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AccountAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBalanceRequest) 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 *QueryBalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBalanceRequest) 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 = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBalanceResponse) 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 *QueryBalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + i -= len(m.Balance) + copy(dAtA[i:], m.Balance) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryStorageRequest) 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 *QueryStorageRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStorageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryStorageResponse) 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 *QueryStorageResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStorageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCodeRequest) 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 *QueryCodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeRequest) 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 = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCodeResponse) 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 *QueryCodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Code) > 0 { + i -= len(m.Code) + copy(dAtA[i:], m.Code) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Code))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTxLogsRequest) 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 *QueryTxLogsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTxLogsRequest) 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.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTxLogsResponse) 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 *QueryTxLogsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTxLogsResponse) 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.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EthCallRequest) 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 *EthCallRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EthCallRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasCap != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.GasCap)) + i-- + dAtA[i] = 0x10 + } + if len(m.Args) > 0 { + i -= len(m.Args) + copy(dAtA[i:], m.Args) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Args))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EstimateGasResponse) 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 *EstimateGasResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EstimateGasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gas != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Gas)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTraceTxRequest) 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 *QueryTraceTxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTraceTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintQuery(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x3a + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x32 + } + if m.BlockNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x28 + } + if len(m.Predecessors) > 0 { + for iNdEx := len(m.Predecessors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Predecessors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.TraceConfig != nil { + { + size, err := m.TraceConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.TxIndex != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex)) + i-- + dAtA[i] = 0x10 + } + if m.Msg != nil { + { + size, err := m.Msg.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 *QueryTraceTxResponse) 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 *QueryTraceTxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTraceTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTraceBlockRequest) 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 *QueryTraceBlockRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTraceBlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintQuery(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x3a + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x32 + } + if m.BlockNumber != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x28 + } + if m.TraceConfig != nil { + { + size, err := m.TraceConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Txs) > 0 { + for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Txs[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 *QueryTraceBlockResponse) 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 *QueryTraceBlockResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTraceBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBaseFeeRequest) 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 *QueryBaseFeeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBaseFeeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryBaseFeeResponse) 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 *QueryBaseFeeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBaseFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BaseFee != nil { + if len(m.BaseFee) > 0 { + i -= len(m.BaseFee) + copy(dAtA[i:], m.BaseFee) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseFee))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockGasRequest) 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 *QueryBlockGasRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockGasRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryBlockGasResponse) 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 *QueryBlockGasResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockGasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gas != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Gas)) + i-- + dAtA[i] = 0x8 + } + 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 *QueryAccountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Balance) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Nonce != 0 { + n += 1 + sovQuery(uint64(m.Nonce)) + } + return n +} + +func (m *QueryCosmosAccountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCosmosAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CosmosAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Sequence != 0 { + n += 1 + sovQuery(uint64(m.Sequence)) + } + if m.AccountNumber != 0 { + n += 1 + sovQuery(uint64(m.AccountNumber)) + } + return n +} + +func (m *QueryValidatorAccountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AccountAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Sequence != 0 { + n += 1 + sovQuery(uint64(m.Sequence)) + } + if m.AccountNumber != 0 { + n += 1 + sovQuery(uint64(m.AccountNumber)) + } + return n +} + +func (m *QueryBalanceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Balance) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStorageRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStorageResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Code) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTxLogsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTxLogsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *EthCallRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Args) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.GasCap != 0 { + n += 1 + sovQuery(uint64(m.GasCap)) + } + return n +} + +func (m *EstimateGasResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Gas != 0 { + n += 1 + sovQuery(uint64(m.Gas)) + } + return n +} + +func (m *QueryTraceTxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Msg != nil { + l = m.Msg.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.TxIndex != 0 { + n += 1 + sovQuery(uint64(m.TxIndex)) + } + if m.TraceConfig != nil { + l = m.TraceConfig.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Predecessors) > 0 { + for _, e := range m.Predecessors { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.BlockNumber != 0 { + n += 1 + sovQuery(uint64(m.BlockNumber)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime) + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTraceTxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTraceBlockRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Txs) > 0 { + for _, e := range m.Txs { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.TraceConfig != nil { + l = m.TraceConfig.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.BlockNumber != 0 { + n += 1 + sovQuery(uint64(m.BlockNumber)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.BlockTime) + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTraceBlockResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBaseFeeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryBaseFeeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BaseFee != nil { + l = len(m.BaseFee) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryBlockGasRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryBlockGasResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Gas != 0 { + n += 1 + sovQuery(uint64(m.Gas)) + } + 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 *QueryAccountRequest) 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: QueryAccountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAccountRequest: 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 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.Address = 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 *QueryAccountResponse) 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: QueryAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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.Balance = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", 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.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= 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 *QueryCosmosAccountRequest) 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: QueryCosmosAccountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCosmosAccountRequest: 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 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.Address = 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 *QueryCosmosAccountResponse) 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: QueryCosmosAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCosmosAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CosmosAddress", 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.CosmosAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) + } + m.AccountNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountNumber |= 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 *QueryValidatorAccountRequest) 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: QueryValidatorAccountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsAddress", wireType) + } + var 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.ConsAddress = 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 *QueryValidatorAccountResponse) 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: QueryValidatorAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountAddress", 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.AccountAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) + } + m.AccountNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountNumber |= 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 *QueryBalanceRequest) 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: QueryBalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBalanceRequest: 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 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.Address = 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 *QueryBalanceResponse) 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: QueryBalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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.Balance = 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 *QueryStorageRequest) 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: QueryStorageRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStorageRequest: 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 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", 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.Key = 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 *QueryStorageResponse) 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: QueryStorageResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStorageResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value = 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 *QueryCodeRequest) 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: QueryCodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeRequest: 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 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.Address = 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 *QueryCodeResponse) 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: QueryCodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Code = append(m.Code[:0], dAtA[iNdEx:postIndex]...) + if m.Code == nil { + m.Code = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTxLogsRequest) 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: QueryTxLogsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTxLogsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = string(dAtA[iNdEx:postIndex]) + 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.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 *QueryTxLogsResponse) 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: QueryTxLogsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTxLogsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", 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.Logs = append(m.Logs, &Log{}) + if err := m.Logs[len(m.Logs)-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 *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 *EthCallRequest) 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: EthCallRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EthCallRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Args = append(m.Args[:0], dAtA[iNdEx:postIndex]...) + if m.Args == nil { + m.Args = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasCap", wireType) + } + m.GasCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasCap |= 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 *EstimateGasResponse) 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: EstimateGasResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EstimateGasResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Gas", wireType) + } + m.Gas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Gas |= 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 *QueryTraceTxRequest) 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: QueryTraceTxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTraceTxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", 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.Msg == nil { + m.Msg = &MsgEthereumTx{} + } + if err := m.Msg.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) + } + m.TxIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TxIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TraceConfig", 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.TraceConfig == nil { + m.TraceConfig = &TraceConfig{} + } + if err := m.TraceConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Predecessors", 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.Predecessors = append(m.Predecessors, &MsgEthereumTx{}) + if err := m.Predecessors[len(m.Predecessors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", 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.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.BlockTime, 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 *QueryTraceTxResponse) 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: QueryTraceTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTraceTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTraceBlockRequest) 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: QueryTraceBlockRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTraceBlockRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Txs", 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.Txs = append(m.Txs, &MsgEthereumTx{}) + if err := m.Txs[len(m.Txs)-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 TraceConfig", 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.TraceConfig == nil { + m.TraceConfig = &TraceConfig{} + } + if err := m.TraceConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", 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.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.BlockTime, 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 *QueryTraceBlockResponse) 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: QueryTraceBlockResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTraceBlockResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBaseFeeRequest) 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: QueryBaseFeeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBaseFeeRequest: 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 *QueryBaseFeeResponse) 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: QueryBaseFeeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBaseFeeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseFee", 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.BaseFee = github_com_cosmos_cosmos_sdk_types.Int(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 *QueryBlockGasRequest) 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: QueryBlockGasRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlockGasRequest: 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 *QueryBlockGasResponse) 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: QueryBlockGasResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlockGasResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Gas", wireType) + } + m.Gas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Gas |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func 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/evm/types/query.pb.gw.go b/x/evm/types/query.pb.gw.go new file mode 100644 index 00000000..e4b4c17c --- /dev/null +++ b/x/evm/types/query.pb.gw.go @@ -0,0 +1,1202 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/evm/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/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 + +func request_Query_Account_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAccountRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.Account(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Account_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAccountRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.Account(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_CosmosAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCosmosAccountRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.CosmosAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CosmosAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCosmosAccountRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.CosmosAccount(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ValidatorAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorAccountRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cons_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cons_address") + } + + protoReq.ConsAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cons_address", err) + } + + msg, err := client.ValidatorAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ValidatorAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorAccountRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cons_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cons_address") + } + + protoReq.ConsAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cons_address", err) + } + + msg, err := server.ValidatorAccount(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBalanceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.Balance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBalanceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.Balance(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Storage_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStorageRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + val, ok = pathParams["key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "key") + } + + protoReq.Key, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key", err) + } + + msg, err := client.Storage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Storage_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStorageRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + val, ok = pathParams["key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "key") + } + + protoReq.Key, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key", err) + } + + msg, err := server.Storage(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.Code(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + 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 + +} + +var ( + filter_Query_EthCall_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_EthCall_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EthCallRequest + 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_EthCall_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EthCall(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EthCall_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EthCallRequest + 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_EthCall_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EthCall(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EstimateGas_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_EstimateGas_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EthCallRequest + 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_EstimateGas_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EstimateGas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EstimateGas_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EthCallRequest + 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_EstimateGas_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EstimateGas(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_TraceTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TraceTx_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTraceTxRequest + 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_TraceTx_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TraceTx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TraceTx_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTraceTxRequest + 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_TraceTx_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TraceTx(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_TraceBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TraceBlock_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTraceBlockRequest + 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_TraceBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TraceBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TraceBlock_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTraceBlockRequest + 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_TraceBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TraceBlock(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryBaseFee_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBaseFeeRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryBaseFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryBaseFee_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBaseFeeRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryBaseFee(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockGasRequest + var metadata runtime.ServerMetadata + + msg, err := client.BlockGas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockGasRequest + var metadata runtime.ServerMetadata + + msg, err := server.BlockGas(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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Account_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Account_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Account_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CosmosAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_CosmosAccount_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_CosmosAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ValidatorAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ValidatorAccount_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ValidatorAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Balance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Balance_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Balance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Storage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Storage_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Storage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + 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) + 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_EthCall_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_EthCall_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EthCall_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EstimateGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_EstimateGas_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EstimateGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TraceTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TraceTx_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TraceTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TraceBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TraceBlock_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TraceBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryBaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryBaseFee_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryBaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BlockGas_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlockGas_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_Account_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_Account_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_Account_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CosmosAccount_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_CosmosAccount_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_CosmosAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ValidatorAccount_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_ValidatorAccount_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_ValidatorAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Balance_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_Balance_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_Balance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Storage_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_Storage_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_Storage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Code_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_Code_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_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + 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_EthCall_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_EthCall_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_EthCall_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EstimateGas_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_EstimateGas_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_EstimateGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TraceTx_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_TraceTx_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_TraceTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TraceBlock_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_TraceBlock_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_TraceBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryBaseFee_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_QueryBaseFee_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_QueryBaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockGas_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_BlockGas_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_BlockGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Account_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "evm", "v1", "account", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_CosmosAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "evm", "v1", "cosmos_account", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ValidatorAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "evm", "v1", "validator_account", "cons_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Balance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "evm", "v1", "balances", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Storage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"stratos", "evm", "v1", "storage", "address", "key"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "evm", "v1", "codes", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_EthCall_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "eth_call"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_EstimateGas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "estimate_gas"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_TraceTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "trace_tx"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_TraceBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "trace_block"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_QueryBaseFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "base_fee"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_BlockGas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "block_gas"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Account_0 = runtime.ForwardResponseMessage + + forward_Query_CosmosAccount_0 = runtime.ForwardResponseMessage + + forward_Query_ValidatorAccount_0 = runtime.ForwardResponseMessage + + forward_Query_Balance_0 = runtime.ForwardResponseMessage + + forward_Query_Storage_0 = runtime.ForwardResponseMessage + + forward_Query_Code_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_EthCall_0 = runtime.ForwardResponseMessage + + forward_Query_EstimateGas_0 = runtime.ForwardResponseMessage + + forward_Query_TraceTx_0 = runtime.ForwardResponseMessage + + forward_Query_TraceBlock_0 = runtime.ForwardResponseMessage + + forward_Query_QueryBaseFee_0 = runtime.ForwardResponseMessage + + forward_Query_BlockGas_0 = runtime.ForwardResponseMessage +) diff --git a/x/evm/types/storage.go b/x/evm/types/storage.go new file mode 100644 index 00000000..40c5bcc0 --- /dev/null +++ b/x/evm/types/storage.go @@ -0,0 +1,66 @@ +package types + +import ( + "fmt" + "strings" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" +) + +// Storage represents the account Storage map as a slice of single key value +// State pairs. This is to prevent non determinism at genesis initialization or export. +type Storage []State + +// Validate performs a basic validation of the Storage fields. +func (s Storage) Validate() error { + seenStorage := make(map[string]bool) + for i, state := range s { + if seenStorage[state.Key] { + return sdkerrors.Wrapf(ErrInvalidState, "duplicate state key %d: %s", i, state.Key) + } + + if err := state.Validate(); err != nil { + return err + } + + seenStorage[state.Key] = true + } + return nil +} + +// String implements the stringer interface +func (s Storage) String() string { + var str string + for _, state := range s { + str += fmt.Sprintf("%s\n", state.String()) + } + + return str +} + +// Copy returns a copy of storage. +func (s Storage) Copy() Storage { + cpy := make(Storage, len(s)) + copy(cpy, s) + + return cpy +} + +// Validate performs a basic validation of the State fields. +// NOTE: state value can be empty +func (s State) Validate() error { + if strings.TrimSpace(s.Key) == "" { + return sdkerrors.Wrap(ErrInvalidState, "state key hash cannot be blank") + } + + return nil +} + +// NewState creates a new State instance +func NewState(key, value common.Hash) State { + return State{ + Key: key.String(), + Value: value.String(), + } +} diff --git a/x/evm/types/tracer.go b/x/evm/types/tracer.go new file mode 100644 index 00000000..7b262489 --- /dev/null +++ b/x/evm/types/tracer.go @@ -0,0 +1,157 @@ +package types + +import ( + "fmt" + "math/big" + "os" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/eth/tracers/logger" + "github.com/ethereum/go-ethereum/params" +) + +const ( + TracerAccessList = "access_list" + TracerJSON = "json" + TracerStruct = "struct" + TracerMarkdown = "markdown" +) + +// NewTracer creates a new Logger tracer to collect execution traces from an +// EVM transaction. +func NewTracer(tracer string, msg core.Message, cfg *params.ChainConfig, height int64) vm.EVMLogger { + // TODO: enable additional log configuration + logCfg := &logger.Config{ + Debug: true, + } + + switch tracer { + case TracerAccessList: + preCompiles := vm.ActivePrecompiles(cfg.Rules(big.NewInt(height), cfg.MergeForkBlock != nil)) + return logger.NewAccessListTracer(msg.AccessList(), msg.From(), *msg.To(), preCompiles) + case TracerJSON: + return logger.NewJSONLogger(logCfg, os.Stderr) + case TracerMarkdown: + return logger.NewMarkdownLogger(logCfg, os.Stdout) // TODO: Stderr ? + case TracerStruct: + return logger.NewStructLogger(logCfg) + default: + return NewNoOpTracer() + } +} + +// TxTraceTask represents a single transaction trace task when an entire block +// is being traced. +type TxTraceTask struct { + Index int // Transaction offset in the block +} + +// TxTraceResult is the result of a single transaction trace during a block trace. +type TxTraceResult struct { + Result interface{} `json:"result,omitempty"` // Trace results produced by the tracer + Error string `json:"error,omitempty"` // Trace failure produced by the tracer +} + +// ExecutionResult groups all structured logs emitted by the EVM +// while replaying a transaction in debug mode as well as transaction +// execution status, the amount of gas used and the return value +type ExecutionResult struct { + Gas uint64 `json:"gas"` + Failed bool `json:"failed"` + ReturnValue string `json:"returnValue"` + StructLogs []StructLogRes `json:"structLogs"` +} + +// StructLogRes stores a structured log emitted by the EVM while replaying a +// transaction in debug mode. Taken from go-ethereum +type StructLogRes struct { + Pc uint64 `json:"pc"` + Op string `json:"op"` + Gas uint64 `json:"gas"` + GasCost uint64 `json:"gasCost"` + Depth int `json:"depth"` + Error string `json:"error,omitempty"` + Stack *[]string `json:"stack,omitempty"` + Memory *[]string `json:"memory,omitempty"` + Storage *map[string]string `json:"storage,omitempty"` +} + +// FormatLogs formats EVM returned structured logs for json output +func FormatLogs(logs []logger.StructLog) []StructLogRes { + formatted := make([]StructLogRes, len(logs)) + for index, trace := range logs { + formatted[index] = StructLogRes{ + Pc: trace.Pc, + Op: trace.Op.String(), + Gas: trace.Gas, + GasCost: trace.GasCost, + Depth: trace.Depth, + Error: trace.ErrorString(), + } + + if trace.Stack != nil { + stack := make([]string, len(trace.Stack)) + for i, stackValue := range trace.Stack { + stack[i] = fmt.Sprintf("%x", stackValue) + } + formatted[index].Stack = &stack + } + + if trace.Memory != nil { + memory := make([]string, 0, (len(trace.Memory)+31)/32) + for i, n := 0, len(trace.Memory); i < n; { + end := i + 32 + if end >= n { + end = n + } + memory = append(memory, fmt.Sprintf("%x", trace.Memory[i:end])) + i = end + } + formatted[index].Memory = &memory + } + + if trace.Storage != nil { + storage := make(map[string]string) + for i, storageValue := range trace.Storage { + storage[fmt.Sprintf("%x", i)] = fmt.Sprintf("%x", storageValue) + } + formatted[index].Storage = &storage + } + } + return formatted +} + +var _ vm.EVMLogger = &NoOpTracer{} + +// NoOpTracer is an empty implementation of vm.Tracer interface +type NoOpTracer struct{} + +// NewNoOpTracer creates a no-op vm.Tracer +func NewNoOpTracer() *NoOpTracer { + return &NoOpTracer{} +} + +// CaptureStart implements vm.Tracer interface +func (dt NoOpTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) { +} + +// CaptureState implements vm.Tracer interface +func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) { +} + +// CaptureFault implements vm.Tracer interface +func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) { +} + +// CaptureEnd implements vm.Tracer interface +func (dt NoOpTracer) CaptureEnd(output []byte, gasUsed uint64, tm time.Duration, err error) {} + +// CaptureEnter implements vm.Tracer interface +func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { +} + +// CaptureExit implements vm.Tracer interface +func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error) {} diff --git a/x/evm/types/tx.go b/x/evm/types/tx.go new file mode 100644 index 00000000..f5cfccb9 --- /dev/null +++ b/x/evm/types/tx.go @@ -0,0 +1,29 @@ +package types + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/vm" +) + +// Failed returns if the contract execution failed in vm errors +func (m *MsgEthereumTxResponse) Failed() bool { + return len(m.VmError) > 0 +} + +// Return is a helper function to help caller distinguish between revert reason +// and function return. Return returns the data after execution if no error occurs. +func (m *MsgEthereumTxResponse) Return() []byte { + if m.Failed() { + return nil + } + return common.CopyBytes(m.Ret) +} + +// Revert returns the concrete revert reason if the execution is aborted by `REVERT` +// opcode. Note the reason can be nil if no data supplied with revert opcode. +func (m *MsgEthereumTxResponse) Revert() []byte { + if m.VmError != vm.ErrExecutionReverted.Error() { + return nil + } + return common.CopyBytes(m.Ret) +} diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go new file mode 100644 index 00000000..95859127 --- /dev/null +++ b/x/evm/types/tx.pb.go @@ -0,0 +1,2817 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/evm/v1/tx.proto + +package types + +import ( + context "context" + encoding_binary "encoding/binary" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/regen-network/cosmos-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 + +// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message. +type MsgEthereumTx struct { + // inner transaction data + Data *types.Any `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + // encoded storage size of the transaction + Size_ float64 `protobuf:"fixed64,2,opt,name=size,proto3" json:"-"` + // transaction hash in hex format + Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty" rlp:"-"` + // ethereum signer address in hex format. This address value is checked + // against the address derived from the signature (V, R, S) using the + // secp256k1 elliptic curve + From string `protobuf:"bytes,4,opt,name=from,proto3" json:"from,omitempty"` +} + +func (m *MsgEthereumTx) Reset() { *m = MsgEthereumTx{} } +func (m *MsgEthereumTx) String() string { return proto.CompactTextString(m) } +func (*MsgEthereumTx) ProtoMessage() {} +func (*MsgEthereumTx) Descriptor() ([]byte, []int) { + return fileDescriptor_8aaa626562d93f7b, []int{0} +} +func (m *MsgEthereumTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEthereumTx.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 *MsgEthereumTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEthereumTx.Merge(m, src) +} +func (m *MsgEthereumTx) XXX_Size() int { + return m.Size() +} +func (m *MsgEthereumTx) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEthereumTx.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEthereumTx proto.InternalMessageInfo + +// LegacyTx is the transaction data of regular Ethereum transactions. +type LegacyTx struct { + // nonce corresponds to the account nonce (transaction sequence). + Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` + // gas price defines the value for each gas unit + GasPrice *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=gas_price,json=gasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_price,omitempty"` + // gas defines the gas limit defined for the transaction. + GasLimit uint64 `protobuf:"varint,3,opt,name=gas,proto3" json:"gas,omitempty"` + // hex formatted address of the recipient + To string `protobuf:"bytes,4,opt,name=to,proto3" json:"to,omitempty"` + // value defines the unsigned integer value of the transaction amount. + Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"` + // input defines the data payload bytes of the transaction. + Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` + // v defines the signature value + V []byte `protobuf:"bytes,7,opt,name=v,proto3" json:"v,omitempty"` + // r defines the signature value + R []byte `protobuf:"bytes,8,opt,name=r,proto3" json:"r,omitempty"` + // s define the signature value + S []byte `protobuf:"bytes,9,opt,name=s,proto3" json:"s,omitempty"` +} + +func (m *LegacyTx) Reset() { *m = LegacyTx{} } +func (m *LegacyTx) String() string { return proto.CompactTextString(m) } +func (*LegacyTx) ProtoMessage() {} +func (*LegacyTx) Descriptor() ([]byte, []int) { + return fileDescriptor_8aaa626562d93f7b, []int{1} +} +func (m *LegacyTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LegacyTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LegacyTx.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 *LegacyTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_LegacyTx.Merge(m, src) +} +func (m *LegacyTx) XXX_Size() int { + return m.Size() +} +func (m *LegacyTx) XXX_DiscardUnknown() { + xxx_messageInfo_LegacyTx.DiscardUnknown(m) +} + +var xxx_messageInfo_LegacyTx proto.InternalMessageInfo + +// AccessListTx is the data of EIP-2930 access list transactions. +type AccessListTx struct { + // destination EVM chain ID + ChainID *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"chainID"` + // nonce corresponds to the account nonce (transaction sequence). + Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + // gas price defines the value for each gas unit + GasPrice *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_price,omitempty"` + // gas defines the gas limit defined for the transaction. + GasLimit uint64 `protobuf:"varint,4,opt,name=gas,proto3" json:"gas,omitempty"` + // hex formatted address of the recipient + To string `protobuf:"bytes,5,opt,name=to,proto3" json:"to,omitempty"` + // value defines the unsigned integer value of the transaction amount. + Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"` + // input defines the data payload bytes of the transaction. + Data []byte `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"` + Accesses []AccessTuple `protobuf:"bytes,8,rep,name=accesses,proto3" json:"accessList"` + // v defines the signature value + V []byte `protobuf:"bytes,9,opt,name=v,proto3" json:"v,omitempty"` + // r defines the signature value + R []byte `protobuf:"bytes,10,opt,name=r,proto3" json:"r,omitempty"` + // s define the signature value + S []byte `protobuf:"bytes,11,opt,name=s,proto3" json:"s,omitempty"` +} + +func (m *AccessListTx) Reset() { *m = AccessListTx{} } +func (m *AccessListTx) String() string { return proto.CompactTextString(m) } +func (*AccessListTx) ProtoMessage() {} +func (*AccessListTx) Descriptor() ([]byte, []int) { + return fileDescriptor_8aaa626562d93f7b, []int{2} +} +func (m *AccessListTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccessListTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessListTx.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 *AccessListTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessListTx.Merge(m, src) +} +func (m *AccessListTx) XXX_Size() int { + return m.Size() +} +func (m *AccessListTx) XXX_DiscardUnknown() { + xxx_messageInfo_AccessListTx.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessListTx proto.InternalMessageInfo + +// DynamicFeeTx is the data of EIP-1559 dinamic fee transactions. +type DynamicFeeTx struct { + // destination EVM chain ID + ChainID *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"chainID"` + // nonce corresponds to the account nonce (transaction sequence). + Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + // gas tip cap defines the max value for the gas tip + GasTipCap *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=gas_tip_cap,json=gasTipCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_tip_cap,omitempty"` + // gas fee cap defines the max value for the gas fee + GasFeeCap *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=gas_fee_cap,json=gasFeeCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_fee_cap,omitempty"` + // gas defines the gas limit defined for the transaction. + GasLimit uint64 `protobuf:"varint,5,opt,name=gas,proto3" json:"gas,omitempty"` + // hex formatted address of the recipient + To string `protobuf:"bytes,6,opt,name=to,proto3" json:"to,omitempty"` + // value defines the the transaction amount. + Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"` + // input defines the data payload bytes of the transaction. + Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` + Accesses []AccessTuple `protobuf:"bytes,9,rep,name=accesses,proto3" json:"accessList"` + // v defines the signature value + V []byte `protobuf:"bytes,10,opt,name=v,proto3" json:"v,omitempty"` + // r defines the signature value + R []byte `protobuf:"bytes,11,opt,name=r,proto3" json:"r,omitempty"` + // s define the signature value + S []byte `protobuf:"bytes,12,opt,name=s,proto3" json:"s,omitempty"` +} + +func (m *DynamicFeeTx) Reset() { *m = DynamicFeeTx{} } +func (m *DynamicFeeTx) String() string { return proto.CompactTextString(m) } +func (*DynamicFeeTx) ProtoMessage() {} +func (*DynamicFeeTx) Descriptor() ([]byte, []int) { + return fileDescriptor_8aaa626562d93f7b, []int{3} +} +func (m *DynamicFeeTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DynamicFeeTx.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 *DynamicFeeTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_DynamicFeeTx.Merge(m, src) +} +func (m *DynamicFeeTx) XXX_Size() int { + return m.Size() +} +func (m *DynamicFeeTx) XXX_DiscardUnknown() { + xxx_messageInfo_DynamicFeeTx.DiscardUnknown(m) +} + +var xxx_messageInfo_DynamicFeeTx proto.InternalMessageInfo + +type ExtensionOptionsEthereumTx struct { +} + +func (m *ExtensionOptionsEthereumTx) Reset() { *m = ExtensionOptionsEthereumTx{} } +func (m *ExtensionOptionsEthereumTx) String() string { return proto.CompactTextString(m) } +func (*ExtensionOptionsEthereumTx) ProtoMessage() {} +func (*ExtensionOptionsEthereumTx) Descriptor() ([]byte, []int) { + return fileDescriptor_8aaa626562d93f7b, []int{4} +} +func (m *ExtensionOptionsEthereumTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExtensionOptionsEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExtensionOptionsEthereumTx.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 *ExtensionOptionsEthereumTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionOptionsEthereumTx.Merge(m, src) +} +func (m *ExtensionOptionsEthereumTx) XXX_Size() int { + return m.Size() +} +func (m *ExtensionOptionsEthereumTx) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionOptionsEthereumTx.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionOptionsEthereumTx proto.InternalMessageInfo + +// MsgEthereumTxResponse defines the Msg/EthereumTx response type. +type MsgEthereumTxResponse struct { + // ethereum transaction hash in hex format. This hash differs from the + // Tendermint sha256 hash of the transaction bytes. See + // https://github.com/tendermint/tendermint/issues/6539 for reference + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // logs contains the transaction hash and the proto-compatible ethereum + // logs. + Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` + // returned data from evm function (result or data supplied with revert + // opcode) + Ret []byte `protobuf:"bytes,3,opt,name=ret,proto3" json:"ret,omitempty"` + // vm error is the error returned by vm execution + VmError string `protobuf:"bytes,4,opt,name=vm_error,json=vmError,proto3" json:"vm_error,omitempty"` + // gas consumed by the transaction + GasUsed uint64 `protobuf:"varint,5,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` +} + +func (m *MsgEthereumTxResponse) Reset() { *m = MsgEthereumTxResponse{} } +func (m *MsgEthereumTxResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEthereumTxResponse) ProtoMessage() {} +func (*MsgEthereumTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_8aaa626562d93f7b, []int{5} +} +func (m *MsgEthereumTxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEthereumTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEthereumTxResponse.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 *MsgEthereumTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEthereumTxResponse.Merge(m, src) +} +func (m *MsgEthereumTxResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEthereumTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEthereumTxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEthereumTxResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgEthereumTx)(nil), "stratos.evm.v1.MsgEthereumTx") + proto.RegisterType((*LegacyTx)(nil), "stratos.evm.v1.LegacyTx") + proto.RegisterType((*AccessListTx)(nil), "stratos.evm.v1.AccessListTx") + proto.RegisterType((*DynamicFeeTx)(nil), "stratos.evm.v1.DynamicFeeTx") + proto.RegisterType((*ExtensionOptionsEthereumTx)(nil), "stratos.evm.v1.ExtensionOptionsEthereumTx") + proto.RegisterType((*MsgEthereumTxResponse)(nil), "stratos.evm.v1.MsgEthereumTxResponse") +} + +func init() { proto.RegisterFile("stratos/evm/v1/tx.proto", fileDescriptor_8aaa626562d93f7b) } + +var fileDescriptor_8aaa626562d93f7b = []byte{ + // 854 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0x13, 0x27, 0x76, 0x26, 0xa1, 0x42, 0xa6, 0x08, 0x37, 0xa5, 0x71, 0x64, 0x04, 0x44, + 0x48, 0xb1, 0xd5, 0xc2, 0xa9, 0x27, 0x9a, 0xfe, 0x52, 0xab, 0x54, 0x20, 0x2b, 0x1c, 0x80, 0x43, + 0x34, 0x75, 0xa6, 0x8e, 0x45, 0xec, 0xb1, 0x3c, 0x13, 0xe3, 0x70, 0xe0, 0xc0, 0x89, 0x1b, 0x48, + 0xfc, 0x03, 0x88, 0x23, 0x57, 0x38, 0x73, 0xee, 0xb1, 0x62, 0x2f, 0xab, 0x3d, 0x78, 0x57, 0xe9, + 0x9e, 0x7a, 0x59, 0x69, 0xff, 0x82, 0xd5, 0x8c, 0x9d, 0xb6, 0x49, 0x95, 0x6a, 0xb7, 0xdb, 0xd5, + 0x9e, 0xfc, 0x9e, 0xbf, 0xf1, 0xfb, 0xf5, 0x7d, 0x9e, 0x07, 0x3e, 0x20, 0x34, 0x84, 0x14, 0x13, + 0x13, 0x45, 0x9e, 0x19, 0xad, 0x9b, 0x34, 0x36, 0x82, 0x10, 0x53, 0xac, 0x2c, 0x65, 0x80, 0x81, + 0x22, 0xcf, 0x88, 0xd6, 0x6b, 0xcb, 0x0e, 0x76, 0x30, 0x87, 0x4c, 0x66,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, + 0xa9, 0x7f, 0x0a, 0xc4, 0x21, 0x76, 0x88, 0x9a, 0xe7, 0x2d, 0xbe, 0x37, 0xdf, 0x62, 0x07, 0x3b, + 0x16, 0x3f, 0xa0, 0xbc, 0x0b, 0x0a, 0x21, 0xa2, 0x5c, 0x2f, 0x55, 0x8b, 0x99, 0xca, 0x0a, 0x90, + 0x23, 0xaf, 0x87, 0xc2, 0x10, 0x87, 0xd9, 0x7d, 0x2b, 0x45, 0xde, 0x2e, 0x73, 0x19, 0xc4, 0x84, + 0x31, 0x22, 0xa8, 0x9f, 0x32, 0x6a, 0x49, 0x0e, 0x24, 0xdf, 0x10, 0xd4, 0x4f, 0x8b, 0xdc, 0xf8, + 0x19, 0x14, 0x8e, 0x88, 0xa3, 0xfc, 0x08, 0xc0, 0xb5, 0x35, 0xb6, 0x36, 0x9f, 0x7d, 0xa6, 0x8d, + 0xda, 0xc7, 0xb7, 0xc2, 0xd3, 0x2e, 0xf5, 0x8f, 0x7e, 0x79, 0xf0, 0xf4, 0x8f, 0xfc, 0x9a, 0xbe, + 0x6a, 0xce, 0x6f, 0xd0, 0xec, 0x6c, 0x8f, 0xc6, 0xed, 0x83, 0xd3, 0x49, 0x5d, 0x38, 0x9b, 0xd4, + 0x85, 0x27, 0x93, 0xba, 0xf0, 0xfb, 0x79, 0x3d, 0x77, 0x76, 0x5e, 0xcf, 0x3d, 0x3c, 0xaf, 0xe7, + 0xbe, 0x33, 0xaf, 0x89, 0x28, 0x0b, 0xe0, 0x23, 0x3a, 0x35, 0x5b, 0xfc, 0xe7, 0x32, 0x63, 0x1e, + 0x93, 0x2b, 0xea, 0xb8, 0xc4, 0xd7, 0xec, 0xe7, 0x2f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x35, + 0x72, 0x7c, 0x44, 0x08, 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 { + // EthereumTx defines a method submitting Ethereum transactions. + EthereumTx(ctx context.Context, in *MsgEthereumTx, opts ...grpc.CallOption) (*MsgEthereumTxResponse, error) +} + +type msgClient struct { + cc *grpc.ClientConn +} + +func NewMsgClient(cc *grpc.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) EthereumTx(ctx context.Context, in *MsgEthereumTx, opts ...grpc.CallOption) (*MsgEthereumTxResponse, error) { + out := new(MsgEthereumTxResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Msg/EthereumTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // EthereumTx defines a method submitting Ethereum transactions. + EthereumTx(context.Context, *MsgEthereumTx) (*MsgEthereumTxResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) EthereumTx(ctx context.Context, req *MsgEthereumTx) (*MsgEthereumTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EthereumTx not implemented") +} + +func RegisterMsgServer(s *grpc.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_EthereumTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEthereumTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EthereumTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Msg/EthereumTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EthereumTx(ctx, req.(*MsgEthereumTx)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.evm.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "EthereumTx", + Handler: _Msg_EthereumTx_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/evm/v1/tx.proto", +} + +func (m *MsgEthereumTx) 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 *MsgEthereumTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEthereumTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0x22 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x1a + } + if m.Size_ != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Size_)))) + i-- + dAtA[i] = 0x11 + } + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LegacyTx) 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 *LegacyTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LegacyTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarintTx(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0x4a + } + if len(m.R) > 0 { + i -= len(m.R) + copy(dAtA[i:], m.R) + i = encodeVarintTx(dAtA, i, uint64(len(m.R))) + i-- + dAtA[i] = 0x42 + } + if len(m.V) > 0 { + i -= len(m.V) + copy(dAtA[i:], m.V) + i = encodeVarintTx(dAtA, i, uint64(len(m.V))) + i-- + dAtA[i] = 0x3a + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x32 + } + if m.Amount != nil { + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTx(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x22 + } + if m.GasLimit != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x18 + } + if m.GasPrice != nil { + if len(m.GasPrice) > 0 { + i -= len(m.GasPrice) + copy(dAtA[i:], m.GasPrice) + i = encodeVarintTx(dAtA, i, uint64(len(m.GasPrice))) + i-- + dAtA[i] = 0x12 + } + } + if m.Nonce != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *AccessListTx) 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 *AccessListTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessListTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarintTx(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0x5a + } + if len(m.R) > 0 { + i -= len(m.R) + copy(dAtA[i:], m.R) + i = encodeVarintTx(dAtA, i, uint64(len(m.R))) + i-- + dAtA[i] = 0x52 + } + if len(m.V) > 0 { + i -= len(m.V) + copy(dAtA[i:], m.V) + i = encodeVarintTx(dAtA, i, uint64(len(m.V))) + i-- + dAtA[i] = 0x4a + } + if len(m.Accesses) > 0 { + for iNdEx := len(m.Accesses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accesses[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.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x3a + } + if m.Amount != nil { + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x32 + } + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTx(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x2a + } + if m.GasLimit != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x20 + } + if m.GasPrice != nil { + if len(m.GasPrice) > 0 { + i -= len(m.GasPrice) + copy(dAtA[i:], m.GasPrice) + i = encodeVarintTx(dAtA, i, uint64(len(m.GasPrice))) + i-- + dAtA[i] = 0x1a + } + } + if m.Nonce != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x10 + } + if m.ChainID != nil { + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *DynamicFeeTx) 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 *DynamicFeeTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.S) > 0 { + i -= len(m.S) + copy(dAtA[i:], m.S) + i = encodeVarintTx(dAtA, i, uint64(len(m.S))) + i-- + dAtA[i] = 0x62 + } + if len(m.R) > 0 { + i -= len(m.R) + copy(dAtA[i:], m.R) + i = encodeVarintTx(dAtA, i, uint64(len(m.R))) + i-- + dAtA[i] = 0x5a + } + if len(m.V) > 0 { + i -= len(m.V) + copy(dAtA[i:], m.V) + i = encodeVarintTx(dAtA, i, uint64(len(m.V))) + i-- + dAtA[i] = 0x52 + } + if len(m.Accesses) > 0 { + for iNdEx := len(m.Accesses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accesses[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.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x42 + } + if m.Amount != nil { + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x3a + } + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTx(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x32 + } + if m.GasLimit != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x28 + } + if m.GasFeeCap != nil { + if len(m.GasFeeCap) > 0 { + i -= len(m.GasFeeCap) + copy(dAtA[i:], m.GasFeeCap) + i = encodeVarintTx(dAtA, i, uint64(len(m.GasFeeCap))) + i-- + dAtA[i] = 0x22 + } + } + if m.GasTipCap != nil { + if len(m.GasTipCap) > 0 { + i -= len(m.GasTipCap) + copy(dAtA[i:], m.GasTipCap) + i = encodeVarintTx(dAtA, i, uint64(len(m.GasTipCap))) + i-- + dAtA[i] = 0x1a + } + } + if m.Nonce != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x10 + } + if m.ChainID != nil { + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ExtensionOptionsEthereumTx) 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 *ExtensionOptionsEthereumTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExtensionOptionsEthereumTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEthereumTxResponse) 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 *MsgEthereumTxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEthereumTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasUsed != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x28 + } + if len(m.VmError) > 0 { + i -= len(m.VmError) + copy(dAtA[i:], m.VmError) + i = encodeVarintTx(dAtA, i, uint64(len(m.VmError))) + i-- + dAtA[i] = 0x22 + } + if len(m.Ret) > 0 { + i -= len(m.Ret) + copy(dAtA[i:], m.Ret) + i = encodeVarintTx(dAtA, i, uint64(len(m.Ret))) + i-- + dAtA[i] = 0x1a + } + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + 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 *MsgEthereumTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Size_ != 0 { + n += 9 + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *LegacyTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Nonce != 0 { + n += 1 + sovTx(uint64(m.Nonce)) + } + if m.GasPrice != nil { + l = len(m.GasPrice) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + if m.GasLimit != 0 { + n += 1 + sovTx(uint64(m.GasLimit)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != nil { + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.V) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.R) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.S) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *AccessListTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainID != nil { + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Nonce != 0 { + n += 1 + sovTx(uint64(m.Nonce)) + } + if m.GasPrice != nil { + l = len(m.GasPrice) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + if m.GasLimit != 0 { + n += 1 + sovTx(uint64(m.GasLimit)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != nil { + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Accesses) > 0 { + for _, e := range m.Accesses { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.V) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.R) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.S) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *DynamicFeeTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainID != nil { + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Nonce != 0 { + n += 1 + sovTx(uint64(m.Nonce)) + } + if m.GasTipCap != nil { + l = len(m.GasTipCap) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + if m.GasFeeCap != nil { + l = len(m.GasFeeCap) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + if m.GasLimit != 0 { + n += 1 + sovTx(uint64(m.GasLimit)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != nil { + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Accesses) > 0 { + for _, e := range m.Accesses { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.V) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.R) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.S) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *ExtensionOptionsEthereumTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEthereumTxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Ret) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.VmError) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.GasUsed != 0 { + n += 1 + sovTx(uint64(m.GasUsed)) + } + 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 *MsgEthereumTx) 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: MsgEthereumTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEthereumTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &types.Any{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Size_ = float64(math.Float64frombits(v)) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", 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.From = 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 *LegacyTx) 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: LegacyTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LegacyTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", 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.GasPrice = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + } + m.GasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.V = append(m.V[:0], dAtA[iNdEx:postIndex]...) + if m.V == nil { + m.V = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field R", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.R = append(m.R[:0], dAtA[iNdEx:postIndex]...) + if m.R == nil { + m.R = []byte{} + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...) + if m.S == nil { + m.S = []byte{} + } + 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 *AccessListTx) 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: AccessListTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessListTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", 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.ChainID = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", 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.GasPrice = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + } + m.GasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accesses", 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.Accesses = append(m.Accesses, AccessTuple{}) + if err := m.Accesses[len(m.Accesses)-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 V", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.V = append(m.V[:0], dAtA[iNdEx:postIndex]...) + if m.V == nil { + m.V = []byte{} + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field R", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.R = append(m.R[:0], dAtA[iNdEx:postIndex]...) + if m.R == nil { + m.R = []byte{} + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...) + if m.S == nil { + m.S = []byte{} + } + 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 *DynamicFeeTx) 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: DynamicFeeTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DynamicFeeTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", 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.ChainID = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + m.Nonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasTipCap", 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.GasTipCap = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasFeeCap", 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.GasFeeCap = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + } + m.GasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accesses", 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.Accesses = append(m.Accesses, AccessTuple{}) + if err := m.Accesses[len(m.Accesses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.V = append(m.V[:0], dAtA[iNdEx:postIndex]...) + if m.V == nil { + m.V = []byte{} + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field R", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.R = append(m.R[:0], dAtA[iNdEx:postIndex]...) + if m.R == nil { + m.R = []byte{} + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...) + if m.S == nil { + m.S = []byte{} + } + 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 *ExtensionOptionsEthereumTx) 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: ExtensionOptionsEthereumTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtensionOptionsEthereumTx: 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 *MsgEthereumTxResponse) 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: MsgEthereumTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEthereumTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", 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.Logs = append(m.Logs, &Log{}) + if err := m.Logs[len(m.Logs)-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 Ret", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ret = append(m.Ret[:0], dAtA[iNdEx:postIndex]...) + if m.Ret == nil { + m.Ret = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VmError", 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.VmError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + } + m.GasUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasUsed |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/evm/types/tx.pb.gw.go b/x/evm/types/tx.pb.gw.go new file mode 100644 index 00000000..0b4b03ea --- /dev/null +++ b/x/evm/types/tx.pb.gw.go @@ -0,0 +1,166 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/evm/v1/tx.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/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 ( + filter_Msg_EthereumTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgEthereumTx + 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_Msg_EthereumTx_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EthereumTx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgEthereumTx + 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_Msg_EthereumTx_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EthereumTx(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". +// UnaryRPC :call MsgServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. +func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + + mux.Handle("POST", pattern_Msg_EthereumTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_EthereumTx_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_EthereumTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMsgHandlerFromEndpoint(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 RegisterMsgHandler(ctx, mux, conn) +} + +// RegisterMsgHandler registers the http handlers for service Msg to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn)) +} + +// RegisterMsgHandlerClient registers the http handlers for service Msg +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MsgClient" to call the correct interceptors. +func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + + mux.Handle("POST", pattern_Msg_EthereumTx_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_Msg_EthereumTx_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_EthereumTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Msg_EthereumTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "ethereum_tx"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Msg_EthereumTx_0 = runtime.ForwardResponseMessage +) diff --git a/x/evm/types/tx_args.go b/x/evm/types/tx_args.go new file mode 100644 index 00000000..63b030ff --- /dev/null +++ b/x/evm/types/tx_args.go @@ -0,0 +1,246 @@ +package types + +import ( + "errors" + "fmt" + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/common/math" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +// TransactionArgs represents the arguments to construct a new transaction +// or a message call using JSON-RPC. +// Duplicate struct definition since geth struct is in internal package +// Ref: https://github.com/ethereum/go-ethereum/blob/release/1.10.4/internal/ethapi/transaction_args.go#L36 +type TransactionArgs struct { + From *common.Address `json:"from"` + To *common.Address `json:"to"` + Gas *hexutil.Uint64 `json:"gas"` + GasPrice *hexutil.Big `json:"gasPrice"` + MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` + MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` + Value *hexutil.Big `json:"value"` + Nonce *hexutil.Uint64 `json:"nonce"` + + // We accept "data" and "input" for backwards-compatibility reasons. + // "input" is the newer name and should be preferred by clients. + // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 + Data *hexutil.Bytes `json:"data"` + Input *hexutil.Bytes `json:"input"` + + // Introduced by AccessListTxType transaction. + AccessList *ethtypes.AccessList `json:"accessList,omitempty"` + ChainID *hexutil.Big `json:"chainId,omitempty"` +} + +// String return the struct in a string format +func (args *TransactionArgs) String() string { + // Todo: There is currently a bug with hexutil.Big when the value its nil, printing would trigger an exception + return fmt.Sprintf("TransactionArgs{From:%v, To:%v, Gas:%v,"+ + " Nonce:%v, Data:%v, Input:%v, AccessList:%v}", + args.From, + args.To, + args.Gas, + args.Nonce, + args.Data, + args.Input, + args.AccessList) +} + +// ToTransaction converts the arguments to an ethereum transaction. +// This assumes that setTxDefaults has been called. +func (args *TransactionArgs) ToTransaction() *MsgEthereumTx { + var ( + chainID, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas sdk.Int + gas, nonce uint64 + from, to string + ) + + // Set sender address or use zero address if none specified. + if args.ChainID != nil { + chainID = sdk.NewIntFromBigInt(args.ChainID.ToInt()) + } + + if args.Nonce != nil { + nonce = uint64(*args.Nonce) + } + + if args.Gas != nil { + gas = uint64(*args.Gas) + } + + if args.GasPrice != nil { + gasPrice = sdk.NewIntFromBigInt(args.GasPrice.ToInt()) + } + + if args.MaxFeePerGas != nil { + maxFeePerGas = sdk.NewIntFromBigInt(args.MaxFeePerGas.ToInt()) + } + + if args.MaxPriorityFeePerGas != nil { + maxPriorityFeePerGas = sdk.NewIntFromBigInt(args.MaxPriorityFeePerGas.ToInt()) + } + + if args.Value != nil { + value = sdk.NewIntFromBigInt(args.Value.ToInt()) + } + + if args.To != nil { + to = args.To.Hex() + } + + var data TxData + switch { + case args.MaxFeePerGas != nil: + al := AccessList{} + if args.AccessList != nil { + al = NewAccessList(args.AccessList) + } + + data = &DynamicFeeTx{ + To: to, + ChainID: &chainID, + Nonce: nonce, + GasLimit: gas, + GasFeeCap: &maxFeePerGas, + GasTipCap: &maxPriorityFeePerGas, + Amount: &value, + Data: args.GetData(), + Accesses: al, + } + case args.AccessList != nil: + data = &AccessListTx{ + To: to, + ChainID: &chainID, + Nonce: nonce, + GasLimit: gas, + GasPrice: &gasPrice, + Amount: &value, + Data: args.GetData(), + Accesses: NewAccessList(args.AccessList), + } + default: + data = &LegacyTx{ + To: to, + Nonce: nonce, + GasLimit: gas, + GasPrice: &gasPrice, + Amount: &value, + Data: args.GetData(), + } + } + + any, err := PackTxData(data) + if err != nil { + return nil + } + + if args.From != nil { + from = args.From.Hex() + } + + return &MsgEthereumTx{ + Data: any, + From: from, + } +} + +// ToMessage converts the arguments to the Message type used by the core evm. +// This assumes that setTxDefaults has been called. +func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (ethtypes.Message, error) { + // Reject invalid combinations of pre- and post-1559 fee styles + if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { + return ethtypes.Message{}, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") + } + + // Set sender address or use zero address if none specified. + addr := args.GetFrom() + + // Set default gas & gas price if none were set + gas := globalGasCap + if gas == 0 { + gas = uint64(math.MaxUint64 / 2) + } + if args.Gas != nil { + gas = uint64(*args.Gas) + } + if globalGasCap != 0 && globalGasCap < gas { + gas = globalGasCap + } + var ( + gasPrice *big.Int + gasFeeCap *big.Int + gasTipCap *big.Int + ) + if baseFee == nil { + // If there's no basefee, then it must be a non-1559 execution + gasPrice = new(big.Int) + if args.GasPrice != nil { + gasPrice = args.GasPrice.ToInt() + } + gasFeeCap, gasTipCap = gasPrice, gasPrice + } else { + // A basefee is provided, necessitating 1559-type execution + if args.GasPrice != nil { + // User specified the legacy gas field, convert to 1559 gas typing + gasPrice = args.GasPrice.ToInt() + gasFeeCap, gasTipCap = gasPrice, gasPrice + } else { + // User specified 1559 gas feilds (or none), use those + gasFeeCap = new(big.Int) + if args.MaxFeePerGas != nil { + gasFeeCap = args.MaxFeePerGas.ToInt() + } + gasTipCap = new(big.Int) + if args.MaxPriorityFeePerGas != nil { + gasTipCap = args.MaxPriorityFeePerGas.ToInt() + } + // Backfill the legacy gasPrice for EVM execution, unless we're all zeroes + gasPrice = new(big.Int) + if gasFeeCap.BitLen() > 0 || gasTipCap.BitLen() > 0 { + gasPrice = math.BigMin(new(big.Int).Add(gasTipCap, baseFee), gasFeeCap) + } + } + } + value := new(big.Int) + if args.Value != nil { + value = args.Value.ToInt() + } + data := args.GetData() + var accessList ethtypes.AccessList + if args.AccessList != nil { + accessList = *args.AccessList + } + + nonce := uint64(0) + if args.Nonce != nil { + nonce = uint64(*args.Nonce) + } + + msg := ethtypes.NewMessage(addr, args.To, nonce, value, gas, gasPrice, gasFeeCap, gasTipCap, data, accessList, true) + return msg, nil +} + +// GetFrom retrieves the transaction sender address. +func (args *TransactionArgs) GetFrom() common.Address { + if args.From == nil { + return common.Address{} + } + return *args.From +} + +// GetData retrieves the transaction calldata. Input field is preferred. +func (args *TransactionArgs) GetData() []byte { + if args.Input != nil { + return *args.Input + } + if args.Data != nil { + return *args.Data + } + return nil +} diff --git a/x/evm/types/tx_data.go b/x/evm/types/tx_data.go new file mode 100644 index 00000000..1f78ad26 --- /dev/null +++ b/x/evm/types/tx_data.go @@ -0,0 +1,119 @@ +package types + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" +) + +var ( + _ TxData = &LegacyTx{} + _ TxData = &AccessListTx{} + _ TxData = &DynamicFeeTx{} +) + +// TxData implements the Ethereum transaction tx structure. It is used +// solely as intended in Ethereum abiding by the protocol. +type TxData interface { + // TODO: embed ethtypes.TxData. See https://github.com/ethereum/go-ethereum/issues/23154 + + TxType() byte + Copy() TxData + GetChainID() *big.Int + GetAccessList() ethtypes.AccessList + GetData() []byte + GetNonce() uint64 + GetGas() uint64 + GetGasPrice() *big.Int + GetGasTipCap() *big.Int + GetGasFeeCap() *big.Int + GetValue() *big.Int + GetTo() *common.Address + + GetRawSignatureValues() (v, r, s *big.Int) + SetSignatureValues(chainID, v, r, s *big.Int) + + AsEthereumData() ethtypes.TxData + Validate() error + + // static fee + Fee() *big.Int + Cost() *big.Int + + // effective fee according to current base fee + EffectiveFee(baseFee *big.Int) *big.Int + EffectiveCost(baseFee *big.Int) *big.Int +} + +func NewTxDataFromTx(tx *ethtypes.Transaction) (TxData, error) { + var txData TxData + var err error + switch tx.Type() { + case ethtypes.DynamicFeeTxType: + txData, err = newDynamicFeeTx(tx) + case ethtypes.AccessListTxType: + txData, err = newAccessListTx(tx) + default: + txData, err = newLegacyTx(tx) + } + if err != nil { + return nil, err + } + + return txData, nil +} + +// DeriveChainID derives the chain id from the given v parameter. +// +// CONTRACT: v value is either: +// +// - {0,1} + CHAIN_ID * 2 + 35, if EIP155 is used +// - {0,1} + 27, otherwise +// Ref: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md +func DeriveChainID(v *big.Int) *big.Int { + if v == nil || v.Sign() < 1 { + return nil + } + + if v.BitLen() <= 64 { + v := v.Uint64() + if v == 27 || v == 28 { + return new(big.Int) + } + + if v < 35 { + return nil + } + + // V MUST be of the form {0,1} + CHAIN_ID * 2 + 35 + return new(big.Int).SetUint64((v - 35) / 2) + } + v = new(big.Int).Sub(v, big.NewInt(35)) + return v.Div(v, big.NewInt(2)) +} + +func rawSignatureValues(vBz, rBz, sBz []byte) (v, r, s *big.Int) { + if len(vBz) > 0 { + v = new(big.Int).SetBytes(vBz) + } + if len(rBz) > 0 { + r = new(big.Int).SetBytes(rBz) + } + if len(sBz) > 0 { + s = new(big.Int).SetBytes(sBz) + } + return v, r, s +} + +func fee(gasPrice *big.Int, gas uint64) *big.Int { + gasLimit := new(big.Int).SetUint64(gas) + return new(big.Int).Mul(gasPrice, gasLimit) +} + +func cost(fee, value *big.Int) *big.Int { + if value != nil { + return new(big.Int).Add(fee, value) + } + return fee +} diff --git a/x/evm/types/utils.go b/x/evm/types/utils.go new file mode 100644 index 00000000..16b1c780 --- /dev/null +++ b/x/evm/types/utils.go @@ -0,0 +1,107 @@ +package types + +import ( + "fmt" + "math/big" + + "github.com/gogo/protobuf/proto" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" +) + +const maxBitLen = 256 + +var EmptyCodeHash = crypto.Keccak256(nil) + +// DecodeTxResponse decodes an protobuf-encoded byte slice into TxResponse +func DecodeTxResponse(in []byte) (*MsgEthereumTxResponse, error) { + var txMsgData sdk.TxMsgData + if err := proto.Unmarshal(in, &txMsgData); err != nil { + return nil, err + } + + data := txMsgData.GetData() + if len(data) == 0 { + return &MsgEthereumTxResponse{}, nil + } + + var res MsgEthereumTxResponse + + err := proto.Unmarshal(data[0].GetData(), &res) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to unmarshal tx response message data") + } + + return &res, nil +} + +// EncodeTransactionLogs encodes TransactionLogs slice into a protobuf-encoded byte slice. +func EncodeTransactionLogs(res *TransactionLogs) ([]byte, error) { + return proto.Marshal(res) +} + +// DecodeTxResponse decodes an protobuf-encoded byte slice into TransactionLogs +func DecodeTransactionLogs(data []byte) (TransactionLogs, error) { + var logs TransactionLogs + err := proto.Unmarshal(data, &logs) + if err != nil { + return TransactionLogs{}, err + } + return logs, nil +} + +// UnwrapEthereumMsg extract MsgEthereumTx from wrapping sdk.Tx +func UnwrapEthereumMsg(tx *sdk.Tx, ethHash common.Hash) (*MsgEthereumTx, error) { + if tx == nil { + return nil, fmt.Errorf("invalid tx: nil") + } + + for _, msg := range (*tx).GetMsgs() { + ethMsg, ok := msg.(*MsgEthereumTx) + if !ok { + return nil, fmt.Errorf("invalid tx type: %T", tx) + } + if ethMsg.AsTransaction().Hash() == ethHash { + return ethMsg, nil + } + } + + return nil, fmt.Errorf("eth tx not found: %s", ethHash) +} + +// BinSearch execute the binary search and hone in on an executable gas limit +func BinSearch(lo, hi uint64, executable func(uint64) (bool, *MsgEthereumTxResponse, error)) (uint64, error) { + for lo+1 < hi { + mid := (hi + lo) / 2 + failed, _, err := executable(mid) + // If the error is not nil(consensus error), it means the provided message + // call or transaction will never be accepted no matter how much gas it is + // assigned. Return the error directly, don't struggle any more. + if err != nil { + return 0, err + } + if failed { + lo = mid + } else { + hi = mid + } + } + return hi, nil +} + +// SafeNewIntFromBigInt constructs Int from big.Int, return error if more than 256bits +func SafeNewIntFromBigInt(i *big.Int) (sdk.Int, error) { + if !IsValidInt256(i) { + return sdk.NewInt(0), fmt.Errorf("big int out of bound: %s", i) + } + return sdk.NewIntFromBigInt(i), nil +} + +// IsValidInt256 check the bound of 256 bit number +func IsValidInt256(i *big.Int) bool { + return i == nil || i.BitLen() <= maxBitLen +} From 88bbc42aa9eae1fbe5bc6a7288417c6f2071e13f Mon Sep 17 00:00:00 2001 From: Xiong Date: Fri, 22 Apr 2022 15:58:00 -0400 Subject: [PATCH 003/113] protobuf issue fix --- go.mod | 65 +++--- go.sum | 431 +++++++++++++++++++++++++++++++--------- x/evm/keeper/utils.go | 4 +- x/evm/types/query.pb.go | 34 ++-- x/evm/types/tx.pb.go | 258 ++++++++++++++---------- 5 files changed, 545 insertions(+), 247 deletions(-) diff --git a/go.mod b/go.mod index c3f51efb..3b71e34d 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( github.com/btcsuite/btcd v0.22.0-beta github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce - github.com/cosmos/cosmos-sdk v0.45.1 + github.com/cosmos/cosmos-sdk v0.45.3 github.com/cosmos/ibc-go/v3 v3.0.0 github.com/davecgh/go-spew v1.1.1 github.com/ethereum/go-ethereum v1.10.16 @@ -19,12 +19,12 @@ require ( github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.4.1 github.com/spf13/cobra v1.4.0 - github.com/spf13/viper v1.10.1 - github.com/tendermint/tendermint v0.34.14 + github.com/spf13/viper v1.11.0 + github.com/tendermint/tendermint v0.34.19 github.com/tendermint/tm-db v0.6.7 github.com/tyler-smith/go-bip39 v1.1.0 - google.golang.org/genproto v0.0.0-20220211171837-173942840c17 - google.golang.org/grpc v1.44.0 + google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 + google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -36,10 +36,12 @@ require ( github.com/DataDog/zstd v1.4.5 // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect - github.com/Workiva/go-datastructures v1.0.52 // indirect + github.com/Workiva/go-datastructures v1.0.53 // indirect + github.com/allegro/bigcache v1.2.1 // indirect github.com/armon/go-metrics v0.3.10 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/cenkalti/backoff/v4 v4.1.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect @@ -62,18 +64,18 @@ require ( github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect - github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-kit/kit v0.10.0 // indirect - github.com/go-logfmt/logfmt v0.5.0 // indirect + github.com/go-kit/kit v0.12.0 // indirect + github.com/go-kit/log v0.2.0 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-playground/validator/v10 v10.4.1 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/gateway v1.1.0 // indirect - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/uuid v1.1.5 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -86,42 +88,43 @@ require ( github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.0 // indirect github.com/huin/goupnp v1.0.2 // indirect - github.com/improbable-eng/grpc-web v0.14.1 // indirect + github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect - github.com/klauspost/compress v1.11.7 // indirect - github.com/lib/pq v1.10.2 // indirect + github.com/klauspost/compress v1.13.6 // indirect + github.com/lib/pq v1.10.4 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect - github.com/magiconair/properties v1.8.5 // indirect + github.com/magiconair/properties v1.8.6 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect - github.com/minio/highwayhash v1.0.1 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect github.com/pelletier/go-toml v1.9.4 // indirect + github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.29.0 // indirect - github.com/prometheus/procfs v0.6.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect github.com/rjeczalik/notify v0.9.1 // indirect - github.com/rs/cors v1.7.0 // indirect + github.com/rs/cors v1.8.2 // indirect github.com/rs/zerolog v1.23.0 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/afero v1.8.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect + github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 // indirect github.com/stretchr/testify v1.7.1 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect @@ -132,16 +135,20 @@ require ( github.com/tklauser/numcpus v0.2.2 // indirect github.com/zondax/hid v0.9.0 // indirect go.etcd.io/bbolt v1.3.6 // indirect - golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect - golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect + golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect + golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 // indirect - golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect + golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect - gopkg.in/ini.v1 v1.66.2 // indirect + gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect nhooyr.io/websocket v1.8.6 // indirect ) -replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +replace ( + github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + google.golang.org/grpc => google.golang.org/grpc v1.33.2 +) diff --git a/go.sum b/go.sum index 90f8c56b..795169e4 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,10 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -17,9 +18,20 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -27,9 +39,13 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= +cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -39,14 +55,16 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI= filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o= -github.com/99designs/keyring v1.1.6 h1:kVDC2uCgVwecxCk+9zoCt2uEL6dt+dfVzMvGgnVcIuM= -github.com/99designs/keyring v1.1.6/go.mod h1:16e0ds7LGQQcT59QqkTg72Hh5ShM51Byv5PEmW6uoRU= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= @@ -62,18 +80,23 @@ github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= +github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -87,11 +110,13 @@ github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= +github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= -github.com/adlio/schema v1.1.13 h1:LeNMVg5Z1FX+Qgz8tJUijBLRdcpbFUElz+d1489On98= github.com/adlio/schema v1.1.13/go.mod h1:L5Z7tw+7lRK1Fnpi/LT/ooCP1elkXn0krMWBQHUhEDE= +github.com/adlio/schema v1.3.0 h1:eSVYLxYWbm/6ReZBCkLw4Fz7uqC+ZNoPvA39bOwi52A= +github.com/adlio/schema v1.3.0/go.mod h1:51QzxkpeFs6lRY11kPye26IaFPOV+HqEj01t5aXXKfs= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -100,8 +125,9 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= +github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= @@ -115,20 +141,26 @@ github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4 github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= +github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= +github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -163,9 +195,13 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= @@ -180,18 +216,15 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= @@ -202,8 +235,9 @@ github.com/confio/ics23/go v0.7.0/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4ur github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= -github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 h1:NmTXa/uVnDyp0TY5MKi197+3HWcnYWfnHGyaFthlnGw= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.2.1 h1:/EeEo2EtN3umhbbgCveyjifoMYg0pS+nMMEemaYw634= +github.com/containerd/continuity v0.2.1/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -217,8 +251,9 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= -github.com/cosmos/cosmos-sdk v0.45.1 h1:PY79YxPea5qlRLExRnzg8/rT1Scc8GGgRs22p7DX99Q= github.com/cosmos/cosmos-sdk v0.45.1/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= +github.com/cosmos/cosmos-sdk v0.45.3 h1:PiVSU3IkNEDPhoxOZHk2lPnhwBBJgEYAtAR0jGXRN4g= +github.com/cosmos/cosmos-sdk v0.45.3/go.mod h1:qYm5JEr0ZlbnmoP/Q3b+dYMOliHf4ddHirpILiwZzqg= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -228,6 +263,8 @@ github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= github.com/cosmos/ibc-go/v3 v3.0.0 h1:XUNplHVS51Q2gMnTFsFsH9QJ7flsovMamnltKbEgPQ4= github.com/cosmos/ibc-go/v3 v3.0.0/go.mod h1:Mb+1NXiPOLd+CPFlOC6BKeAUaxXlhuWenMmRiUiSmwY= +github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= +github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -253,6 +290,7 @@ github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS3 github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= +github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= @@ -268,6 +306,7 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUn github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= @@ -289,28 +328,27 @@ github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7j github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= github.com/ethereum/go-ethereum v1.10.16 h1:3oPrumn0bCW/idjcxMn5YYVCdK7VzJYIvwGZUGLEaoc= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= @@ -320,6 +358,7 @@ github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -330,12 +369,12 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqG github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= +github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= @@ -344,13 +383,17 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= +github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -360,15 +403,18 @@ github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8c github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -381,17 +427,18 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= @@ -442,7 +489,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -450,6 +499,7 @@ github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6 github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -461,16 +511,26 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= +github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= @@ -481,6 +541,7 @@ github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -509,20 +570,31 @@ github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uM github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -539,8 +611,15 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM= github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= @@ -550,14 +629,17 @@ github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.2 h1:RfGLP+h3mvisuWEyybxNq5Eft3NWhHLPeUN72kpKZoI= github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= +github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= +github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= @@ -565,6 +647,7 @@ github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZ github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= @@ -596,6 +679,7 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= @@ -614,8 +698,10 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.7 h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -639,27 +725,33 @@ github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= +github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -667,6 +759,8 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= @@ -676,17 +770,22 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= +github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= @@ -695,6 +794,7 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= @@ -706,6 +806,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= @@ -718,10 +820,16 @@ github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= +github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= @@ -742,8 +850,9 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= @@ -751,13 +860,16 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runc v1.0.3 h1:1hbqejyQWCJBvtKAfdO0b1FmaEf2z/bxnjqbARass5k= +github.com/opencontainers/runc v1.0.3/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -765,10 +877,12 @@ github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKw github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= @@ -788,24 +902,31 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= +github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= @@ -814,8 +935,9 @@ github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeD github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -834,8 +956,10 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.29.0 h1:3jqPBvKT4OHAbje2Ql7KeaaSicDBCxMYwEJU1zRJceE= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -844,8 +968,9 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= @@ -865,8 +990,9 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= +github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.23.0 h1:UskrK+saS9P9Y789yNNulYKdARjPZuS35B8gJF2x60g= @@ -875,6 +1001,9 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= +github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= +github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= @@ -904,16 +1033,20 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= +github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -924,18 +1057,24 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= +github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= +github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 h1:Oo2KZNP70KE0+IUJSidPj/BFS/RXNHmKIJOdckzml2E= +github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= @@ -962,9 +1101,11 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RM github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.34.14 h1:GCXmlS8Bqd2Ix3TQCpwYLUNHe+Y+QyJsm5YE+S/FkPo= github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= +github.com/tendermint/tendermint v0.34.19 h1:y0P1qI5wSa9IRuhKnTDA6IUcOrLi1hXJuALR+R7HFEk= +github.com/tendermint/tendermint v0.34.19/go.mod h1:R5+wgIwSxMdKQcmOaeudL0Cjkr3HDkhpcdum6VeU3R4= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= @@ -972,17 +1113,21 @@ github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JT github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/sjson v1.1.4/go.mod h1:wXpKXu8CtDjKAZ+3DrKY5ROCorDFahq8l0tey/Lx1fg= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -1018,8 +1163,15 @@ go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= +go.etcd.io/etcd/client/v2 v2.305.2/go.mod h1:2D7ZejHVMIfog1221iLSYlQRzrtECw3kz4I4VAQm3qI= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -1034,14 +1186,18 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1053,18 +1209,27 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1083,7 +1248,6 @@ golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8H golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -1108,9 +1272,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1124,6 +1288,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1159,11 +1324,23 @@ golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f h1:w6wWR0H+nyVpbSAQbzVEIACVyr/h8l/BEkY6Sokc7Eg= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1177,6 +1354,14 @@ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1190,7 +1375,6 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1215,13 +1399,16 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1229,6 +1416,7 @@ golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1259,6 +1447,8 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1268,19 +1458,39 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 h1:A9i04dxx7Cribqbs8jf3FQLogkL/CV2YN7hj9KWJCkc= -golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1295,12 +1505,12 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -1314,6 +1524,7 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1351,24 +1562,30 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= @@ -1395,7 +1612,22 @@ google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjR google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1445,48 +1677,53 @@ google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20220211171837-173942840c17 h1:2X+CNIheCutWRyKRte8szGxrE5ggtV4U+NKAbh/oLhg= -google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 h1:myaecH64R0bIEDjNORIel4iXubqzaHU1K2z8ajBwWcM= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1507,6 +1744,7 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -1516,8 +1754,9 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= @@ -1541,7 +1780,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1557,4 +1795,5 @@ rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/x/evm/keeper/utils.go b/x/evm/keeper/utils.go index ec1095d7..8e1ad026 100644 --- a/x/evm/keeper/utils.go +++ b/x/evm/keeper/utils.go @@ -55,9 +55,9 @@ func (k Keeper) DeductTxCostsFromUserBalance( var feeAmt *big.Int - feeMktParams := k.feeMarketKeeper.GetParams(ctx) + feeMktParams := k.GetParams(ctx).FeeMarketParams if london && !feeMktParams.NoBaseFee && txData.TxType() == ethtypes.DynamicFeeTxType { - baseFee := k.feeMarketKeeper.GetBaseFee(ctx) + baseFee := k.GetBaseFee(ctx) if txData.GetGasFeeCap().Cmp(baseFee) < 0 { return nil, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "the tx gasfeecap is lower than the tx baseFee: %s (gasfeecap), %s (basefee) ", txData.GetGasFeeCap(), baseFee) } diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index a273db66..2ebaaea2 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -9,6 +9,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -1486,10 +1487,10 @@ type QueryClient interface { } type queryClient struct { - cc *grpc.ClientConn + cc grpc1.ClientConn } -func NewQueryClient(cc *grpc.ClientConn) QueryClient { +func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } @@ -1686,7 +1687,7 @@ func (*UnimplementedQueryServer) BlockGas(ctx context.Context, req *QueryBlockGa return nil, status.Errorf(codes.Unimplemented, "method BlockGas not implemented") } -func RegisterQueryServer(s *grpc.Server, srv QueryServer) { +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } @@ -2853,13 +2854,16 @@ func (m *QueryBaseFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.BaseFee != nil { - if len(m.BaseFee) > 0 { - i -= len(m.BaseFee) - copy(dAtA[i:], m.BaseFee) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseFee))) - i-- - dAtA[i] = 0xa + { + size := m.BaseFee.Size() + i -= size + if _, err := m.BaseFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -3294,10 +3298,8 @@ func (m *QueryBaseFeeResponse) Size() (n int) { var l int _ = l if m.BaseFee != nil { - l = len(m.BaseFee) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } + l = m.BaseFee.Size() + n += 1 + l + sovQuery(uint64(l)) } return n } @@ -5757,7 +5759,11 @@ func (m *QueryBaseFeeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BaseFee = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.BaseFee = &v + if err := m.BaseFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go index 95859127..d23a9490 100644 --- a/x/evm/types/tx.pb.go +++ b/x/evm/types/tx.pb.go @@ -10,6 +10,7 @@ import ( types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -149,8 +150,8 @@ type AccessListTx struct { // value defines the unsigned integer value of the transaction amount. Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"` // input defines the data payload bytes of the transaction. - Data []byte `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"` - Accesses []AccessTuple `protobuf:"bytes,8,rep,name=accesses,proto3" json:"accessList"` + Data []byte `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"` + Accesses AccessList `protobuf:"bytes,8,rep,name=accesses,proto3,castrepeated=AccessList" json:"accessList"` // v defines the signature value V []byte `protobuf:"bytes,9,opt,name=v,proto3" json:"v,omitempty"` // r defines the signature value @@ -209,8 +210,8 @@ type DynamicFeeTx struct { // value defines the the transaction amount. Amount *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"value,omitempty"` // input defines the data payload bytes of the transaction. - Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` - Accesses []AccessTuple `protobuf:"bytes,9,rep,name=accesses,proto3" json:"accessList"` + Data []byte `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"` + Accesses AccessList `protobuf:"bytes,9,rep,name=accesses,proto3,castrepeated=AccessList" json:"accessList"` // v defines the signature value V []byte `protobuf:"bytes,10,opt,name=v,proto3" json:"v,omitempty"` // r defines the signature value @@ -425,10 +426,10 @@ type MsgClient interface { } type msgClient struct { - cc *grpc.ClientConn + cc grpc1.ClientConn } -func NewMsgClient(cc *grpc.ClientConn) MsgClient { +func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } @@ -455,7 +456,7 @@ func (*UnimplementedMsgServer) EthereumTx(ctx context.Context, req *MsgEthereumT return nil, status.Errorf(codes.Unimplemented, "method EthereumTx not implemented") } -func RegisterMsgServer(s *grpc.Server, srv MsgServer) { +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } @@ -594,13 +595,16 @@ func (m *LegacyTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x32 } if m.Amount != nil { - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x2a + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a } if len(m.To) > 0 { i -= len(m.To) @@ -615,13 +619,16 @@ func (m *LegacyTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x18 } if m.GasPrice != nil { - if len(m.GasPrice) > 0 { - i -= len(m.GasPrice) - copy(dAtA[i:], m.GasPrice) - i = encodeVarintTx(dAtA, i, uint64(len(m.GasPrice))) - i-- - dAtA[i] = 0x12 + { + size := m.GasPrice.Size() + i -= size + if _, err := m.GasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } if m.Nonce != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) @@ -694,13 +701,16 @@ func (m *AccessListTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x3a } if m.Amount != nil { - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x32 + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x32 } if len(m.To) > 0 { i -= len(m.To) @@ -715,13 +725,16 @@ func (m *AccessListTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x20 } if m.GasPrice != nil { - if len(m.GasPrice) > 0 { - i -= len(m.GasPrice) - copy(dAtA[i:], m.GasPrice) - i = encodeVarintTx(dAtA, i, uint64(len(m.GasPrice))) - i-- - dAtA[i] = 0x1a + { + size := m.GasPrice.Size() + i -= size + if _, err := m.GasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a } if m.Nonce != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) @@ -729,13 +742,16 @@ func (m *AccessListTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x10 } if m.ChainID != nil { - if len(m.ChainID) > 0 { - i -= len(m.ChainID) - copy(dAtA[i:], m.ChainID) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainID))) - i-- - dAtA[i] = 0xa + { + size := m.ChainID.Size() + i -= size + if _, err := m.ChainID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -803,13 +819,16 @@ func (m *DynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x42 } if m.Amount != nil { - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x3a + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x3a } if len(m.To) > 0 { i -= len(m.To) @@ -824,22 +843,28 @@ func (m *DynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x28 } if m.GasFeeCap != nil { - if len(m.GasFeeCap) > 0 { - i -= len(m.GasFeeCap) - copy(dAtA[i:], m.GasFeeCap) - i = encodeVarintTx(dAtA, i, uint64(len(m.GasFeeCap))) - i-- - dAtA[i] = 0x22 + { + size := m.GasFeeCap.Size() + i -= size + if _, err := m.GasFeeCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x22 } if m.GasTipCap != nil { - if len(m.GasTipCap) > 0 { - i -= len(m.GasTipCap) - copy(dAtA[i:], m.GasTipCap) - i = encodeVarintTx(dAtA, i, uint64(len(m.GasTipCap))) - i-- - dAtA[i] = 0x1a + { + size := m.GasTipCap.Size() + i -= size + if _, err := m.GasTipCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a } if m.Nonce != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) @@ -847,13 +872,16 @@ func (m *DynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x10 } if m.ChainID != nil { - if len(m.ChainID) > 0 { - i -= len(m.ChainID) - copy(dAtA[i:], m.ChainID) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainID))) - i-- - dAtA[i] = 0xa + { + size := m.ChainID.Size() + i -= size + if _, err := m.ChainID.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -989,10 +1017,8 @@ func (m *LegacyTx) Size() (n int) { n += 1 + sovTx(uint64(m.Nonce)) } if m.GasPrice != nil { - l = len(m.GasPrice) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.GasPrice.Size() + n += 1 + l + sovTx(uint64(l)) } if m.GasLimit != 0 { n += 1 + sovTx(uint64(m.GasLimit)) @@ -1002,10 +1028,8 @@ func (m *LegacyTx) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } if m.Amount != nil { - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) } l = len(m.Data) if l > 0 { @@ -1033,19 +1057,15 @@ func (m *AccessListTx) Size() (n int) { var l int _ = l if m.ChainID != nil { - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.ChainID.Size() + n += 1 + l + sovTx(uint64(l)) } if m.Nonce != 0 { n += 1 + sovTx(uint64(m.Nonce)) } if m.GasPrice != nil { - l = len(m.GasPrice) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.GasPrice.Size() + n += 1 + l + sovTx(uint64(l)) } if m.GasLimit != 0 { n += 1 + sovTx(uint64(m.GasLimit)) @@ -1055,10 +1075,8 @@ func (m *AccessListTx) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } if m.Amount != nil { - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) } l = len(m.Data) if l > 0 { @@ -1092,25 +1110,19 @@ func (m *DynamicFeeTx) Size() (n int) { var l int _ = l if m.ChainID != nil { - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.ChainID.Size() + n += 1 + l + sovTx(uint64(l)) } if m.Nonce != 0 { n += 1 + sovTx(uint64(m.Nonce)) } if m.GasTipCap != nil { - l = len(m.GasTipCap) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.GasTipCap.Size() + n += 1 + l + sovTx(uint64(l)) } if m.GasFeeCap != nil { - l = len(m.GasFeeCap) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.GasFeeCap.Size() + n += 1 + l + sovTx(uint64(l)) } if m.GasLimit != 0 { n += 1 + sovTx(uint64(m.GasLimit)) @@ -1120,10 +1132,8 @@ func (m *DynamicFeeTx) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } if m.Amount != nil { - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) } l = len(m.Data) if l > 0 { @@ -1434,7 +1444,11 @@ func (m *LegacyTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.GasPrice = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.GasPrice = &v + if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 0 { @@ -1517,7 +1531,11 @@ func (m *LegacyTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.Amount = &v + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 6: if wireType != 2 { @@ -1735,7 +1753,11 @@ func (m *AccessListTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainID = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.ChainID = &v + if err := m.ChainID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 0 { @@ -1786,7 +1808,11 @@ func (m *AccessListTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.GasPrice = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.GasPrice = &v + if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: if wireType != 0 { @@ -1869,7 +1895,11 @@ func (m *AccessListTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.Amount = &v + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 7: if wireType != 2 { @@ -2121,7 +2151,11 @@ func (m *DynamicFeeTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainID = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.ChainID = &v + if err := m.ChainID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 0 { @@ -2172,7 +2206,11 @@ func (m *DynamicFeeTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.GasTipCap = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.GasTipCap = &v + if err := m.GasTipCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: if wireType != 2 { @@ -2204,7 +2242,11 @@ func (m *DynamicFeeTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.GasFeeCap = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.GasFeeCap = &v + if err := m.GasFeeCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 5: if wireType != 0 { @@ -2287,7 +2329,11 @@ func (m *DynamicFeeTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = github_com_cosmos_cosmos_sdk_types.Int(dAtA[iNdEx:postIndex]) + var v github_com_cosmos_cosmos_sdk_types.Int + m.Amount = &v + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 8: if wireType != 2 { From bed6fde562f67372ff324cbdda0b5230c82720ac Mon Sep 17 00:00:00 2001 From: Xiong Date: Fri, 22 Apr 2022 19:03:25 -0400 Subject: [PATCH 004/113] upgrade protobuf compiled file fix several issues --- proto/stratos/evm/v1/query.proto | 12 +- rpc/apis.go | 119 ++++---- rpc/ethereum/backend/backend.go | 4 +- rpc/ethereum/backend/feebackend.go | 14 +- rpc/ethereum/namespaces/debug/api.go | 1 - rpc/ethereum/namespaces/eth/filters/api.go | 13 +- rpc/websockets.go | 52 ++-- server/config/config.go | 2 +- tests/signer.go | 74 +++++ x/evm/keeper/grpc_query.go | 18 +- x/evm/keeper/hooks.go | 6 +- x/evm/keeper/keeper.go | 4 +- x/evm/keeper/state_transition.go | 59 ++-- x/evm/module.go | 10 +- x/evm/simulation/decoder.go | 33 +++ x/evm/simulation/genesis.go | 16 +- x/evm/simulation/operations.go | 300 +++++++++++++++++++++ x/evm/simulation/params.go | 29 ++ x/evm/types/interfaces.go | 4 +- x/evm/types/query.pb.go | 244 +++++++---------- 20 files changed, 745 insertions(+), 269 deletions(-) create mode 100644 tests/signer.go create mode 100644 x/evm/simulation/decoder.go create mode 100644 x/evm/simulation/operations.go create mode 100644 x/evm/simulation/params.go diff --git a/proto/stratos/evm/v1/query.proto b/proto/stratos/evm/v1/query.proto index 9ff792a9..51c49f63 100644 --- a/proto/stratos/evm/v1/query.proto +++ b/proto/stratos/evm/v1/query.proto @@ -240,19 +240,17 @@ message EstimateGasResponse { message QueryTraceTxRequest { // msgEthereumTx for the requested transaction MsgEthereumTx msg = 1; - // transaction index - uint64 tx_index = 2; // TraceConfig holds extra parameters to trace functions. - TraceConfig trace_config = 3; + TraceConfig trace_config = 2; // the predecessor transactions included in the same block // need to be replayed first to get correct context for tracing. - repeated MsgEthereumTx predecessors = 4; + repeated MsgEthereumTx predecessors = 3; // block number of requested transaction - int64 block_number = 5; + int64 block_number = 4; // block hex hash of requested transaction - string block_hash = 6; + string block_hash = 5; // block time of requested transaction - google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp block_time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } // QueryTraceTxResponse defines TraceTx response diff --git a/rpc/apis.go b/rpc/apis.go index 2e13c0a8..05e7bc2a 100644 --- a/rpc/apis.go +++ b/rpc/apis.go @@ -3,6 +3,8 @@ package rpc import ( + "fmt" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" @@ -35,102 +37,119 @@ const ( apiVersion = "1.0" ) -// GetRPCAPIs returns the list of all APIs -func GetRPCAPIs(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient, selectedAPIs []string) []rpc.API { - nonceLock := new(types.AddrLocker) - evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) +// APICreator creates the json-rpc api implementations. +type APICreator = func(*server.Context, client.Context, *rpcclient.WSClient) []rpc.API - var apis []rpc.API - // remove duplicates - selectedAPIs = unique(selectedAPIs) +// apiCreators defines the json-rpc api namespaces. +var apiCreators map[string]APICreator - for index := range selectedAPIs { - switch selectedAPIs[index] { - case EthNamespace: - apis = append(apis, - rpc.API{ +func init() { + apiCreators = map[string]APICreator{ + EthNamespace: func(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient) []rpc.API { + nonceLock := new(types.AddrLocker) + evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + return []rpc.API{ + { Namespace: EthNamespace, Version: apiVersion, Service: eth.NewPublicAPI(ctx.Logger, clientCtx, evmBackend, nonceLock), Public: true, }, - rpc.API{ + { Namespace: EthNamespace, Version: apiVersion, - Service: filters.NewPublicAPI(ctx.Logger, tmWSClient, evmBackend), + Service: filters.NewPublicAPI(ctx.Logger, clientCtx, tmWSClient, evmBackend), Public: true, }, - ) - case Web3Namespace: - apis = append(apis, - rpc.API{ + } + }, + Web3Namespace: func(*server.Context, client.Context, *rpcclient.WSClient) []rpc.API { + return []rpc.API{ + { Namespace: Web3Namespace, Version: apiVersion, Service: web3.NewPublicAPI(), Public: true, }, - ) - case NetNamespace: - apis = append(apis, - rpc.API{ + } + }, + NetNamespace: func(_ *server.Context, clientCtx client.Context, _ *rpcclient.WSClient) []rpc.API { + return []rpc.API{ + { Namespace: NetNamespace, Version: apiVersion, Service: net.NewPublicAPI(clientCtx), Public: true, }, - ) - case PersonalNamespace: - apis = append(apis, - rpc.API{ + } + }, + PersonalNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient) []rpc.API { + evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + return []rpc.API{ + { Namespace: PersonalNamespace, Version: apiVersion, Service: personal.NewAPI(ctx.Logger, clientCtx, evmBackend), Public: false, }, - ) - case TxPoolNamespace: - apis = append(apis, - rpc.API{ + } + }, + TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient) []rpc.API { + return []rpc.API{ + { Namespace: TxPoolNamespace, Version: apiVersion, Service: txpool.NewPublicAPI(ctx.Logger), Public: true, }, - ) - case DebugNamespace: - apis = append(apis, - rpc.API{ + } + }, + DebugNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient) []rpc.API { + evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + return []rpc.API{ + { Namespace: DebugNamespace, Version: apiVersion, Service: debug.NewAPI(ctx, evmBackend, clientCtx), Public: true, }, - ) - case MinerNamespace: - apis = append(apis, - rpc.API{ + } + }, + MinerNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient) []rpc.API { + evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + return []rpc.API{ + { Namespace: MinerNamespace, Version: apiVersion, Service: miner.NewPrivateAPI(ctx, clientCtx, evmBackend), Public: false, }, - ) - default: - ctx.Logger.Error("invalid namespace value", "namespace", selectedAPIs[index]) + } + }, + } +} + +// GetRPCAPIs returns the list of all APIs +func GetRPCAPIs(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient, selectedAPIs []string) []rpc.API { + var apis []rpc.API + + for _, ns := range selectedAPIs { + if creator, ok := apiCreators[ns]; ok { + apis = append(apis, creator(ctx, clientCtx, tmWSClient)...) + } else { + ctx.Logger.Error("invalid namespace value", "namespace", ns) } } return apis } -func unique(intSlice []string) []string { - keys := make(map[string]bool) - var list []string - for _, entry := range intSlice { - if _, value := keys[entry]; !value { - keys[entry] = true - list = append(list, entry) - } +// RegisterAPINamespace registers a new API namespace with the API creator. +// This function fails if the namespace is already registered. +func RegisterAPINamespace(ns string, creator APICreator) error { + if _, ok := apiCreators[ns]; ok { + return fmt.Errorf("duplicated api namespace %s", ns) } - return list + apiCreators[ns] = creator + return nil } diff --git a/rpc/ethereum/backend/backend.go b/rpc/ethereum/backend/backend.go index 43ed8c35..f6d9b766 100644 --- a/rpc/ethereum/backend/backend.go +++ b/rpc/ethereum/backend/backend.go @@ -362,6 +362,7 @@ func (e *EVMBackend) EthBlockFromTendermint( } txResults := resBlockResult.TxsResults + txIndex := uint64(0) for i, txBz := range block.Txs { tx, err := e.clientCtx.TxConfig.TxDecoder()(txBz) @@ -394,7 +395,7 @@ func (e *EVMBackend) EthBlockFromTendermint( tx, common.BytesToHash(block.Hash()), uint64(block.Height), - uint64(i), + txIndex, baseFee, ) if err != nil { @@ -402,6 +403,7 @@ func (e *EVMBackend) EthBlockFromTendermint( continue } ethRPCTxs = append(ethRPCTxs, rpcTx) + txIndex++ } } diff --git a/rpc/ethereum/backend/feebackend.go b/rpc/ethereum/backend/feebackend.go index 9c60cc92..e9926431 100644 --- a/rpc/ethereum/backend/feebackend.go +++ b/rpc/ethereum/backend/feebackend.go @@ -47,9 +47,17 @@ func (e *EVMBackend) processBlock( // set basefee targetOneFeeHistory.BaseFee = blockBaseFee - // set gasused ratio - gasLimitUint64 := (*ethBlock)["gasLimit"].(hexutil.Uint64) - gasUsedBig := (*ethBlock)["gasUsed"].(*hexutil.Big) + // set gas used ratio + gasLimitUint64, ok := (*ethBlock)["gasLimit"].(hexutil.Uint64) + if !ok { + return fmt.Errorf("invalid gas limit type: %T", (*ethBlock)["gasLimit"]) + } + + gasUsedBig, ok := (*ethBlock)["gasUsed"].(*hexutil.Big) + if !ok { + return fmt.Errorf("invalid gas used type: %T", (*ethBlock)["gasUsed"]) + } + gasusedfloat, _ := new(big.Float).SetInt(gasUsedBig.ToInt()).Float64() if gasLimitUint64 <= 0 { diff --git a/rpc/ethereum/namespaces/debug/api.go b/rpc/ethereum/namespaces/debug/api.go index 26dd4a3c..1f782738 100644 --- a/rpc/ethereum/namespaces/debug/api.go +++ b/rpc/ethereum/namespaces/debug/api.go @@ -140,7 +140,6 @@ func (a *API) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfig) ( traceTxRequest := evmtypes.QueryTraceTxRequest{ Msg: ethMessage, - TxIndex: uint64(transaction.Index), Predecessors: predecessors, BlockNumber: blk.Block.Height, BlockTime: blk.Block.Time, diff --git a/rpc/ethereum/namespaces/eth/filters/api.go b/rpc/ethereum/namespaces/eth/filters/api.go index 44d7568d..b0a458c1 100644 --- a/rpc/ethereum/namespaces/eth/filters/api.go +++ b/rpc/ethereum/namespaces/eth/filters/api.go @@ -6,6 +6,7 @@ import ( "sync" "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/stratosnet/stratos-chain/rpc/ethereum/types" "github.com/tendermint/tendermint/libs/log" @@ -56,6 +57,7 @@ type filter struct { // information related to the Ethereum protocol such as blocks, transactions and logs. type PublicFilterAPI struct { logger log.Logger + clientCtx client.Context backend Backend events *EventSystem filtersMu sync.Mutex @@ -63,13 +65,14 @@ type PublicFilterAPI struct { } // NewPublicAPI returns a new PublicFilterAPI instance. -func NewPublicAPI(logger log.Logger, tmWSClient *rpcclient.WSClient, backend Backend) *PublicFilterAPI { +func NewPublicAPI(logger log.Logger, clientCtx client.Context, tmWSClient *rpcclient.WSClient, backend Backend) *PublicFilterAPI { logger = logger.With("api", "filter") api := &PublicFilterAPI{ - logger: logger, - backend: backend, - filters: make(map[rpc.ID]*filter), - events: NewEventSystem(logger, tmWSClient), + logger: logger, + clientCtx: clientCtx, + backend: backend, + filters: make(map[rpc.ID]*filter), + events: NewEventSystem(logger, tmWSClient), } go api.timeoutLoop() diff --git a/rpc/websockets.go b/rpc/websockets.go index a072705f..46b9fba7 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -185,9 +185,8 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) { } var msg map[string]interface{} - err = json.Unmarshal(mb, &msg) - if err != nil { - s.sendErrResponse(wsConn, "invalid request") + if err = json.Unmarshal(mb, &msg); err != nil { + s.sendErrResponse(wsConn, err.Error()) continue } @@ -195,23 +194,35 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) { method, ok := msg["method"].(string) if !ok { // otherwise, call the usual rpc server to respond - err = s.tcpGetAndSendResponse(wsConn, mb) - if err != nil { + if err := s.tcpGetAndSendResponse(wsConn, mb); err != nil { s.sendErrResponse(wsConn, err.Error()) } continue } - connID := msg["id"].(float64) + connID, ok := msg["id"].(float64) + if !ok { + s.sendErrResponse( + wsConn, + fmt.Errorf("invalid type for connection ID: %T", msg["id"]).Error(), + ) + continue + } + switch method { case "eth_subscribe": - params := msg["params"].([]interface{}) - if len(params) == 0 { + params, ok := msg["params"].([]interface{}) + if !ok { s.sendErrResponse(wsConn, "invalid parameters") continue } + if len(params) == 0 { + s.sendErrResponse(wsConn, "empty parameters") + continue + } + subID := rpc.NewID() unsubFn, err := s.api.subscribe(wsConn, subID, params) if err != nil { @@ -235,6 +246,12 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) { s.sendErrResponse(wsConn, "invalid parameters") continue } + + if len(params) == 0 { + s.sendErrResponse(wsConn, "empty parameters") + continue + } + id, ok := params[0].(string) if !ok { s.sendErrResponse(wsConn, "invalid parameters") @@ -247,6 +264,7 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) { delete(subscriptions, subID) unsubFn() } + res := &SubscriptionResponseJSON{ Jsonrpc: "2.0", ID: connID, @@ -258,8 +276,7 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) { } default: // otherwise, call the usual rpc server to respond - err = s.tcpGetAndSendResponse(wsConn, mb) - if err != nil { + if err := s.tcpGetAndSendResponse(wsConn, mb); err != nil { s.sendErrResponse(wsConn, err.Error()) } } @@ -426,9 +443,9 @@ func (api *pubSubAPI) subscribeLogs(wsConn *wsConn, subID rpc.ID, extra interfac } if params["address"] != nil { - address, ok := params["address"].(string) - addresses, sok := params["address"].([]interface{}) - if !ok && !sok { + address, isString := params["address"].(string) + addresses, isSlice := params["address"].([]interface{}) + if !isString && !isSlice { err := errors.New("invalid addresses; must be address or array of addresses") api.logger.Debug("invalid addresses", "type", fmt.Sprintf("%T", params["address"])) return nil, err @@ -438,7 +455,7 @@ func (api *pubSubAPI) subscribeLogs(wsConn *wsConn, subID rpc.ID, extra interfac crit.Addresses = []common.Address{common.HexToAddress(address)} } - if sok { + if isSlice { crit.Addresses = []common.Address{} for _, addr := range addresses { address, ok := addr.(string) @@ -590,7 +607,12 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn, subID rpc.ID) for { select { case ev := <-txsCh: - data, _ := ev.Data.(tmtypes.EventDataTx) + data, ok := ev.Data.(tmtypes.EventDataTx) + if !ok { + api.logger.Debug("event data type mismatch", "type", fmt.Sprintf("%T", ev.Data)) + continue + } + ethTxs, err := types.RawTxToEthTx(api.clientCtx, data.Tx) if err != nil { // not ethereum tx diff --git a/server/config/config.go b/server/config/config.go index 616480b2..84e47435 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -214,7 +214,7 @@ func (c JSONRPCConfig) Validate() error { return errors.New("JSON-RPC block range cap cannot be negative") } - // TODO: validate APIs + // check for duplicates seenAPIs := make(map[string]bool) for _, api := range c.API { if seenAPIs[api] { diff --git a/tests/signer.go b/tests/signer.go new file mode 100644 index 00000000..ea882abd --- /dev/null +++ b/tests/signer.go @@ -0,0 +1,74 @@ +package tests + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/cosmos/cosmos-sdk/crypto/keyring" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" +) + +// NewAddrKey generates an Ethereum address and its corresponding private key. +func NewAddrKey() (common.Address, cryptotypes.PrivKey) { + privkey, _ := ethsecp256k1.GenerateKey() + key, err := privkey.ToECDSA() + if err != nil { + return common.Address{}, nil + } + + addr := crypto.PubkeyToAddress(key.PublicKey) + + return addr, privkey +} + +// GenerateAddress generates an Ethereum address. +func GenerateAddress() common.Address { + addr, _ := NewAddrKey() + return addr +} + +var _ keyring.Signer = &Signer{} + +// Signer defines a type that is used on testing for signing MsgEthereumTx +type Signer struct { + privKey cryptotypes.PrivKey +} + +func NewSigner(sk cryptotypes.PrivKey) keyring.Signer { + return &Signer{ + privKey: sk, + } +} + +// Sign signs the message using the underlying private key +func (s Signer) Sign(_ string, msg []byte) ([]byte, cryptotypes.PubKey, error) { + if s.privKey.Type() != ethsecp256k1.KeyType { + return nil, nil, fmt.Errorf( + "invalid private key type for signing ethereum tx; expected %s, got %s", + ethsecp256k1.KeyType, + s.privKey.Type(), + ) + } + + sig, err := s.privKey.Sign(msg) + if err != nil { + return nil, nil, err + } + + return sig, s.privKey.PubKey(), nil +} + +// SignByAddress sign byte messages with a user key providing the address. +func (s Signer) SignByAddress(address sdk.Address, msg []byte) ([]byte, cryptotypes.PubKey, error) { + signer := sdk.AccAddress(s.privKey.PubKey().Address()) + if !signer.Equals(address) { + return nil, nil, fmt.Errorf("address mismatch: signer %s ≠ given address %s", signer, address) + } + + return s.Sign("", msg) +} diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 336b8c6c..cf0b51f2 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -360,8 +360,15 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit) } + // minus one to get the context of block beginning + contextHeight := req.BlockNumber - 1 + if contextHeight < 1 { + // 0 is a special value in `ContextWithHeight` + contextHeight = 1 + } + ctx := sdk.UnwrapSDKContext(c) - ctx = ctx.WithBlockHeight(req.BlockNumber) + ctx = ctx.WithBlockHeight(contextHeight) ctx = ctx.WithBlockTime(req.BlockTime) ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash)) @@ -418,8 +425,15 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest) return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit) } + // minus one to get the context of block beginning + contextHeight := req.BlockNumber - 1 + if contextHeight < 1 { + // 0 is a special value in `ContextWithHeight` + contextHeight = 1 + } + ctx := sdk.UnwrapSDKContext(c) - ctx = ctx.WithBlockHeight(req.BlockNumber) + ctx = ctx.WithBlockHeight(contextHeight) ctx = ctx.WithBlockTime(req.BlockTime) ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash)) diff --git a/x/evm/keeper/hooks.go b/x/evm/keeper/hooks.go index f8269f36..adf8bbb2 100644 --- a/x/evm/keeper/hooks.go +++ b/x/evm/keeper/hooks.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/stratosnet/stratos-chain/x/evm/types" @@ -21,9 +21,9 @@ func NewMultiEvmHooks(hooks ...types.EvmHooks) MultiEvmHooks { } // PostTxProcessing delegate the call to underlying hooks -func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error { +func (mh MultiEvmHooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { for i := range mh { - if err := mh[i].PostTxProcessing(ctx, from, to, receipt); err != nil { + if err := mh[i].PostTxProcessing(ctx, msg, receipt); err != nil { return sdkerrors.Wrapf(err, "EVM hook %T failed", mh[i]) } } diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 064b5fc0..d40d5411 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -219,11 +219,11 @@ func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper { } // PostTxProcessing delegate the call to the hooks. If no hook has been registered, this function returns with a `nil` error -func (k *Keeper) PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error { +func (k *Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { if k.hooks == nil { return nil } - return k.hooks.PostTxProcessing(ctx, from, to, receipt) + return k.hooks.PostTxProcessing(ctx, msg, receipt) } // Tracer return a default vm.Tracer based on current keeper state diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index cf2f3b8d..f1920cc7 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -235,36 +235,36 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t bloomReceipt = ethtypes.BytesToBloom(bloom.Bytes()) } - if !res.Failed() { - cumulativeGasUsed := res.GasUsed - if ctx.BlockGasMeter() != nil { - limit := ctx.BlockGasMeter().Limit() - consumed := ctx.BlockGasMeter().GasConsumed() - cumulativeGasUsed = uint64(math.Min(float64(cumulativeGasUsed+consumed), float64(limit))) - } + cumulativeGasUsed := res.GasUsed + if ctx.BlockGasMeter() != nil { + limit := ctx.BlockGasMeter().Limit() + consumed := ctx.BlockGasMeter().GasConsumed() + cumulativeGasUsed = uint64(math.Min(float64(cumulativeGasUsed+consumed), float64(limit))) + } - var contractAddr common.Address - if msg.To() == nil { - contractAddr = crypto.CreateAddress(msg.From(), msg.Nonce()) - } + var contractAddr common.Address + if msg.To() == nil { + contractAddr = crypto.CreateAddress(msg.From(), msg.Nonce()) + } - receipt := ðtypes.Receipt{ - Type: tx.Type(), - PostState: nil, // TODO: intermediate state root - Status: ethtypes.ReceiptStatusSuccessful, - CumulativeGasUsed: cumulativeGasUsed, - Bloom: bloomReceipt, - Logs: logs, - TxHash: txConfig.TxHash, - ContractAddress: contractAddr, - GasUsed: res.GasUsed, - BlockHash: txConfig.BlockHash, - BlockNumber: big.NewInt(ctx.BlockHeight()), - TransactionIndex: txConfig.TxIndex, - } + receipt := ðtypes.Receipt{ + Type: tx.Type(), + PostState: nil, // TODO: intermediate state root + CumulativeGasUsed: cumulativeGasUsed, + Bloom: bloomReceipt, + Logs: logs, + TxHash: txConfig.TxHash, + ContractAddress: contractAddr, + GasUsed: res.GasUsed, + BlockHash: txConfig.BlockHash, + BlockNumber: big.NewInt(ctx.BlockHeight()), + TransactionIndex: txConfig.TxIndex, + } + if !res.Failed() { + receipt.Status = ethtypes.ReceiptStatusSuccessful // Only call hooks if tx executed successfully. - if err = k.PostTxProcessing(tmpCtx, msg.From(), tx.To(), receipt); err != nil { + if err = k.PostTxProcessing(tmpCtx, msg, receipt); err != nil { // If hooks return error, revert the whole tx. res.VmError = types.ErrPostTxProcessing.Error() k.Logger(ctx).Error("tx post processing failed", "error", err) @@ -280,11 +280,10 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t return nil, sdkerrors.Wrapf(err, "failed to refund gas leftover gas to sender %s", msg.From()) } - if len(logs) > 0 { + if len(receipt.Logs) > 0 { // Update transient block bloom filter - k.SetBlockBloomTransient(ctx, bloom) - - k.SetLogSizeTransient(ctx, uint64(txConfig.LogIndex)+uint64(len(logs))) + k.SetBlockBloomTransient(ctx, receipt.Bloom.Big()) + k.SetLogSizeTransient(ctx, uint64(txConfig.LogIndex)+uint64(len(receipt.Logs))) } k.SetTxIndexTransient(ctx, uint64(txConfig.TxIndex)+1) diff --git a/x/evm/module.go b/x/evm/module.go index 9d144c6d..621ad21d 100644 --- a/x/evm/module.go +++ b/x/evm/module.go @@ -170,11 +170,13 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // RandomizedParams creates randomized evm param changes for the simulator. func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil + return simulation.ParamChanges(r) } // RegisterStoreDecoder registers a decoder for evm module's types -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {} +func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { + sdr[types.StoreKey] = simulation.NewDecodeStore() +} // ProposalContents doesn't return any content functions for governance proposals. func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { @@ -188,5 +190,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // WeightedOperations returns the all the evm module operations with their respective weights. func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return nil + return simulation.WeightedOperations( + simState.AppParams, simState.Cdc, am.ak, am.keeper, + ) } diff --git a/x/evm/simulation/decoder.go b/x/evm/simulation/decoder.go new file mode 100644 index 00000000..8e4d206a --- /dev/null +++ b/x/evm/simulation/decoder.go @@ -0,0 +1,33 @@ +package simulation + +import ( + "bytes" + "fmt" + + "github.com/cosmos/cosmos-sdk/types/kv" + + "github.com/ethereum/go-ethereum/common" + + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's +// Value to the corresponding evm type. +func NewDecodeStore() func(kvA, kvB kv.Pair) string { + return func(kvA, kvB kv.Pair) string { + switch { + case bytes.Equal(kvA.Key[:1], types.KeyPrefixStorage): + storageHashA := common.BytesToHash(kvA.Value).Hex() + storageHashB := common.BytesToHash(kvB.Value).Hex() + + return fmt.Sprintf("%v\n%v", storageHashA, storageHashB) + case bytes.Equal(kvA.Key[:1], types.KeyPrefixCode): + codeHashA := common.BytesToHash(kvA.Value).Hex() + codeHashB := common.BytesToHash(kvB.Value).Hex() + + return fmt.Sprintf("%v\n%v", codeHashA, codeHashB) + default: + panic(fmt.Sprintf("invalid evm key prefix %X", kvA.Key[:1])) + } + } +} diff --git a/x/evm/simulation/genesis.go b/x/evm/simulation/genesis.go index 1bd5235f..5fc3b122 100644 --- a/x/evm/simulation/genesis.go +++ b/x/evm/simulation/genesis.go @@ -3,21 +3,29 @@ package simulation import ( "encoding/json" "fmt" + "math/rand" "github.com/cosmos/cosmos-sdk/types/module" "github.com/stratosnet/stratos-chain/x/evm/types" ) +// GenExtraEIPs randomly generates specific extra eips or not. +func genExtraEIPs(r *rand.Rand) []int64 { + var extraEIPs []int64 + if r.Uint32()%2 == 0 { + extraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529} + } + return extraEIPs +} + // RandomizedGenState generates a random GenesisState for nft func RandomizedGenState(simState *module.SimulationState) { feeMarketParams := types.NewFeeMarketParams(simState.Rand.Uint32()%2 == 0, simState.Rand.Uint32(), simState.Rand.Uint32(), simState.Rand.Uint64(), simState.Rand.Int63()) blockGas := simState.Rand.Uint64() - params := types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), feeMarketParams) - if simState.Rand.Uint32()%2 == 0 { - params = types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), feeMarketParams, 1344, 1884, 2200, 2929, 3198, 3529) - } + extraEIPs := genExtraEIPs(simState.Rand) + params := types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), feeMarketParams, extraEIPs...) evmGenesis := types.NewGenesisState(params, []types.GenesisAccount{}, blockGas) bz, err := json.MarshalIndent(evmGenesis, "", " ") diff --git a/x/evm/simulation/operations.go b/x/evm/simulation/operations.go new file mode 100644 index 00000000..2b050c68 --- /dev/null +++ b/x/evm/simulation/operations.go @@ -0,0 +1,300 @@ +package simulation + +import ( + "encoding/json" + "fmt" + "math/big" + "math/rand" + "time" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + sdktx "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/cosmos/cosmos-sdk/x/auth/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/stratosnet/stratos-chain/encoding" + "github.com/stratosnet/stratos-chain/server/config" + "github.com/stratosnet/stratos-chain/tests" + "github.com/stratosnet/stratos-chain/x/evm/keeper" + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +const ( + /* #nosec */ + OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" + /* #nosec */ + OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" + /* #nosec */ + OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" +) + +const ( + WeightMsgEthSimpleTransfer = 50 + WeightMsgEthCreateContract = 50 +) + +var ErrNoEnoughBalance = fmt.Errorf("no enough balance") + +var maxWaitSeconds = 10 + +type simulateContext struct { + context sdk.Context + bapp *baseapp.BaseApp + rand *rand.Rand + keeper *keeper.Keeper +} + +// WeightedOperations generate Two kinds of operations: SimulateEthSimpleTransfer, SimulateEthCreateContract. +// Contract call operations work as the future operations of SimulateEthCreateContract. +func WeightedOperations( + appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper, k *keeper.Keeper, +) simulation.WeightedOperations { + var ( + weightMsgEthSimpleTransfer int + weightMsgEthCreateContract int + ) + + appParams.GetOrGenerate(cdc, OpWeightMsgEthSimpleTransfer, &weightMsgEthSimpleTransfer, nil, + func(_ *rand.Rand) { + weightMsgEthSimpleTransfer = WeightMsgEthSimpleTransfer + }, + ) + + appParams.GetOrGenerate(cdc, OpWeightMsgEthCreateContract, &weightMsgEthCreateContract, nil, + func(_ *rand.Rand) { + weightMsgEthCreateContract = WeightMsgEthCreateContract + }, + ) + + return simulation.WeightedOperations{ + simulation.NewWeightedOperation( + weightMsgEthSimpleTransfer, + SimulateEthSimpleTransfer(ak, k), + ), + simulation.NewWeightedOperation( + weightMsgEthCreateContract, + SimulateEthCreateContract(ak, k), + ), + } +} + +// SimulateEthSimpleTransfer simulate simple eth account transferring gas token. +// It randomly choose sender, recipient and transferable amount. +// Other tx details like nonce, gasprice, gaslimit are calculated to get valid value. +func SimulateEthSimpleTransfer(ak types.AccountKeeper, k *keeper.Keeper) simtypes.Operation { + return func( + r *rand.Rand, bapp *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + var recipient simtypes.Account + if r.Intn(2) == 1 { + recipient, _ = simtypes.RandomAcc(r, accs) + } else { + recipient = simtypes.RandomAccounts(r, 1)[0] + } + from := common.BytesToAddress(simAccount.Address) + to := common.BytesToAddress(recipient.Address) + + simulateContext := &simulateContext{ctx, bapp, r, k} + + return SimulateEthTx(simulateContext, &from, &to, nil, (*hexutil.Bytes)(&[]byte{}), simAccount.PrivKey, nil) + } +} + +// SimulateEthCreateContract simulate create an ERC20 contract. +// It makes operationSimulateEthCallContract the future operations of SimulateEthCreateContract to ensure valid contract call. +func SimulateEthCreateContract(ak types.AccountKeeper, k *keeper.Keeper) simtypes.Operation { + return func( + r *rand.Rand, bapp *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + + from := common.BytesToAddress(simAccount.Address) + nonce := k.GetNonce(ctx, from) + + ctorArgs, err := types.ERC20Contract.ABI.Pack("", from, sdk.NewIntWithDecimal(1000, 18).BigInt()) + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "can not pack owner and supply"), nil, err + } + data := types.ERC20Contract.Bin + data = append(data, ctorArgs...) + + simulateContext := &simulateContext{ctx, bapp, r, k} + + fops := make([]simtypes.FutureOperation, 1) + whenCall := ctx.BlockHeader().Time.Add(time.Duration(r.Intn(maxWaitSeconds)+1) * time.Second) + contractAddr := crypto.CreateAddress(from, nonce) + var tokenReceipient simtypes.Account + if r.Intn(2) == 1 { + tokenReceipient, _ = simtypes.RandomAcc(r, accs) + } else { + tokenReceipient = simtypes.RandomAccounts(r, 1)[0] + } + receipientAddr := common.BytesToAddress(tokenReceipient.Address) + fops[0] = simtypes.FutureOperation{ + BlockTime: whenCall, + Op: operationSimulateEthCallContract(k, &contractAddr, &receipientAddr, nil), + } + return SimulateEthTx(simulateContext, &from, nil, nil, (*hexutil.Bytes)(&data), simAccount.PrivKey, fops) + } +} + +// operationSimulateEthCallContract simulate calling an contract. +// It is always calling an ERC20 contract. +func operationSimulateEthCallContract(k *keeper.Keeper, contractAddr, to *common.Address, amount *big.Int) simtypes.Operation { + return func( + r *rand.Rand, bapp *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + + from := common.BytesToAddress(simAccount.Address) + + ctorArgs, err := types.ERC20Contract.ABI.Pack("transfer", to, amount) + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "can not pack method and args"), nil, err + } + data := types.ERC20Contract.Bin + data = append(data, ctorArgs...) + + simulateContext := &simulateContext{ctx, bapp, r, k} + + return SimulateEthTx(simulateContext, &from, contractAddr, nil, (*hexutil.Bytes)(&data), simAccount.PrivKey, nil) + } +} + +// SimulateEthTx creates valid ethereum tx and pack it as cosmos tx, and deliver it. +func SimulateEthTx( + ctx *simulateContext, from, to *common.Address, amount *big.Int, data *hexutil.Bytes, prv cryptotypes.PrivKey, fops []simtypes.FutureOperation, +) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + ethTx, err := CreateRandomValidEthTx(ctx, from, nil, nil, data) + if err == ErrNoEnoughBalance { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "no enough balance"), nil, nil + } + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "can not create valid eth tx"), nil, err + } + + txConfig := encoding.MakeConfig(module.NewBasicManager()).TxConfig + txBuilder := txConfig.NewTxBuilder() + signedTx, err := GetSignedTx(ctx, txBuilder, ethTx, prv) + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "can not sign ethereum tx"), nil, err + } + + _, _, err = ctx.bapp.Deliver(txConfig.TxEncoder(), signedTx) + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgEthereumTx, "failed to deliver tx"), nil, err + } + + return simtypes.OperationMsg{}, fops, nil +} + +// CreateRandomValidEthTx create the ethereum tx with valid random values +func CreateRandomValidEthTx(ctx *simulateContext, from, to *common.Address, amount *big.Int, data *hexutil.Bytes) (ethTx *types.MsgEthereumTx, err error) { + estimateGas, err := EstimateGas(ctx, from, to, data) + if err != nil { + return nil, err + } + gasLimit := estimateGas + uint64(ctx.rand.Intn(int(sdktx.MaxGasWanted-estimateGas))) + ethChainID := ctx.keeper.ChainID() + chainConfig := ctx.keeper.GetParams(ctx.context).ChainConfig.EthereumConfig(ethChainID) + gasPrice := ctx.keeper.BaseFee(ctx.context, chainConfig) + gasFeeCap := new(big.Int).Add(gasPrice, big.NewInt(int64(ctx.rand.Int()))) + gasTipCap := big.NewInt(int64(ctx.rand.Int())) + nonce := ctx.keeper.GetNonce(ctx.context, *from) + + if amount == nil { + amount, err = RandomTransferableAmount(ctx, *from, gasLimit, gasFeeCap) + if err != nil { + return nil, err + } + } + + ethTx = types.NewTx(ethChainID, nonce, to, amount, gasLimit, gasPrice, gasFeeCap, gasTipCap, *data, nil) + ethTx.From = from.String() + return ethTx, nil +} + +// EstimateGas estimates the gas used by quering the keeper. +func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.Bytes) (gas uint64, err error) { + args, err := json.Marshal(&types.TransactionArgs{To: to, From: from, Data: data}) + if err != nil { + return 0, err + } + + res, err := ctx.keeper.EstimateGas(sdk.WrapSDKContext(ctx.context), &types.EthCallRequest{ + Args: args, + GasCap: config.DefaultGasCap, + }) + if err != nil { + return 0, err + } + return res.Gas, nil +} + +// RandomTransferableAmount generates a random valid transferable amount. +// Transferable amount is between the range [0, spendable), spendable = balance - gasFeeCap * GasLimit. +func RandomTransferableAmount(ctx *simulateContext, address common.Address, gasLimit uint64, gasFeeCap *big.Int) (amount *big.Int, err error) { + balance := ctx.keeper.GetBalance(ctx.context, address) + feeLimit := new(big.Int).Mul(gasFeeCap, big.NewInt(int64(gasLimit))) + if (feeLimit.Cmp(balance)) > 0 { + return nil, ErrNoEnoughBalance + } + spendable := new(big.Int).Sub(balance, feeLimit) + if spendable.Cmp(big.NewInt(0)) == 0 { + amount = new(big.Int).Set(spendable) + return amount, nil + } + simAmount, err := simtypes.RandPositiveInt(ctx.rand, sdk.NewIntFromBigInt(spendable)) + if err != nil { + return nil, err + } + amount = simAmount.BigInt() + return amount, nil +} + +// GetSignedTx sign the ethereum tx and packs it as a signing.Tx . +func GetSignedTx(ctx *simulateContext, txBuilder client.TxBuilder, msg *types.MsgEthereumTx, prv cryptotypes.PrivKey) (signedTx signing.Tx, err error) { + builder, ok := txBuilder.(tx.ExtensionOptionsTxBuilder) + if !ok { + return nil, fmt.Errorf("can not initiate ExtensionOptionsTxBuilder") + } + option, err := codectypes.NewAnyWithValue(&types.ExtensionOptionsEthereumTx{}) + if err != nil { + return nil, err + } + builder.SetExtensionOptions(option) + + if err := msg.Sign(ethtypes.LatestSignerForChainID(ctx.keeper.ChainID()), tests.NewSigner(prv)); err != nil { + return nil, err + } + + if err = builder.SetMsgs(msg); err != nil { + return nil, err + } + + txData, err := types.UnpackTxData(msg.Data) + if err != nil { + return nil, err + } + + fees := sdk.NewCoins(sdk.NewCoin(ctx.keeper.GetParams(ctx.context).EvmDenom, sdk.NewIntFromBigInt(txData.Fee()))) + builder.SetFeeAmount(fees) + builder.SetGasLimit(msg.GetGas()) + + signedTx = builder.GetTx() + return signedTx, nil +} diff --git a/x/evm/simulation/params.go b/x/evm/simulation/params.go new file mode 100644 index 00000000..1770b8d7 --- /dev/null +++ b/x/evm/simulation/params.go @@ -0,0 +1,29 @@ +package simulation + +// DONTCOVER + +import ( + "fmt" + "math/rand" + + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/stratosnet/stratos-chain/x/evm/types" +) + +const ( + keyExtraEIPs = "ExtraEIPs" +) + +// ParamChanges defines the parameters that can be modified by param change proposals +// on the simulation. +func ParamChanges(r *rand.Rand) []simtypes.ParamChange { + return []simtypes.ParamChange{ + simulation.NewSimParamChange(types.ModuleName, keyExtraEIPs, + func(r *rand.Rand) string { + return fmt.Sprintf("\"%d\"", genExtraEIPs(r)) + }, + ), + } +} diff --git a/x/evm/types/interfaces.go b/x/evm/types/interfaces.go index c8776310..c32f7811 100644 --- a/x/evm/types/interfaces.go +++ b/x/evm/types/interfaces.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" ) @@ -45,5 +45,5 @@ type StakingKeeper interface { // EvmHooks event hooks for evm tx processing type EvmHooks interface { // Must be called after tx is processed successfully, if return an error, the whole transaction is reverted. - PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error + PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error } diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index 2ebaaea2..5020ad23 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -891,19 +891,17 @@ func (m *EstimateGasResponse) GetGas() uint64 { type QueryTraceTxRequest struct { // msgEthereumTx for the requested transaction Msg *MsgEthereumTx `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` - // transaction index - TxIndex uint64 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` // TraceConfig holds extra parameters to trace functions. - TraceConfig *TraceConfig `protobuf:"bytes,3,opt,name=trace_config,json=traceConfig,proto3" json:"trace_config,omitempty"` + TraceConfig *TraceConfig `protobuf:"bytes,2,opt,name=trace_config,json=traceConfig,proto3" json:"trace_config,omitempty"` // the predecessor transactions included in the same block // need to be replayed first to get correct context for tracing. - Predecessors []*MsgEthereumTx `protobuf:"bytes,4,rep,name=predecessors,proto3" json:"predecessors,omitempty"` + Predecessors []*MsgEthereumTx `protobuf:"bytes,3,rep,name=predecessors,proto3" json:"predecessors,omitempty"` // block number of requested transaction - BlockNumber int64 `protobuf:"varint,5,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` // block hex hash of requested transaction - BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + BlockHash string `protobuf:"bytes,5,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` // block time of requested transaction - BlockTime time.Time `protobuf:"bytes,7,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time"` + BlockTime time.Time `protobuf:"bytes,6,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time"` } func (m *QueryTraceTxRequest) Reset() { *m = QueryTraceTxRequest{} } @@ -946,13 +944,6 @@ func (m *QueryTraceTxRequest) GetMsg() *MsgEthereumTx { return nil } -func (m *QueryTraceTxRequest) GetTxIndex() uint64 { - if m != nil { - return m.TxIndex - } - return 0 -} - func (m *QueryTraceTxRequest) GetTraceConfig() *TraceConfig { if m != nil { return m.TraceConfig @@ -1352,96 +1343,96 @@ func init() { func init() { proto.RegisterFile("stratos/evm/v1/query.proto", fileDescriptor_f35039d5386d306b) } var fileDescriptor_f35039d5386d306b = []byte{ - // 1421 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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 0x77, 0x1b, 0x95, 0x50, 0xb3, 0x38, 0xd2, 0x4e, - 0x31, 0x58, 0x13, 0x0c, 0x96, 0xd0, 0xe2, 0x70, 0x06, 0x42, 0x9c, 0xd0, 0x7d, 0x98, 0x89, 0x4a, - 0x4a, 0xea, 0x13, 0x8f, 0xea, 0x50, 0xea, 0x13, 0x8f, 0xa9, 0x52, 0xfa, 0x0d, 0x68, 0xad, 0x42, - 0xf7, 0x60, 0x5a, 0x6b, 0x0a, 0x4a, 0xf1, 0x19, 0x97, 0xa2, 0xc1, 0x74, 0x1b, 0x2a, 0x4c, 0xd6, - 0xaa, 0x80, 0x5e, 0x44, 0xe7, 0x07, 0xa0, 0x85, 0x92, 0x7b, 0x98, 0xee, 0xdd, 0x78, 0xf2, 0xbc, - 0x60, 0x3c, 0x7d, 0x5e, 0x30, 0x7e, 0x7b, 0x5e, 0x30, 0x1e, 0xbd, 0x28, 0x8c, 0x3d, 0x7d, 0x51, - 0x18, 0xfb, 0xf9, 0x45, 0x61, 0xec, 0x53, 0x27, 0xa2, 0x9b, 0x6a, 0xbb, 0x4f, 0x98, 0xfe, 0xdd, - 0x72, 0x6b, 0xb8, 0xee, 0x3b, 0x5d, 0xe1, 0x51, 0x88, 0x68, 0x65, 0x4a, 0x74, 0x01, 0xaf, 0xfd, - 0x15, 0x00, 0x00, 0xff, 0xff, 0xce, 0xc9, 0x54, 0xe9, 0xd1, 0x10, 0x00, 0x00, + // 1414 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdf, 0x6f, 0x13, 0xc7, + 0x16, 0xce, 0xc6, 0x4e, 0x1c, 0x4e, 0x12, 0x6e, 0xee, 0x10, 0x82, 0xd9, 0x10, 0x3b, 0xd9, 0x00, + 0x4e, 0x22, 0xb2, 0x4b, 0x72, 0xaf, 0xae, 0x6e, 0x2b, 0xb5, 0x55, 0x12, 0x05, 0x8a, 0xa0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, 0x94, 0xe2, + 0x33, 0x2e, 0x45, 0xc3, 0xe9, 0x36, 0x52, 0x98, 0xac, 0x35, 0x01, 0xbd, 0x8c, 0x2e, 0x0e, 0x41, + 0x0b, 0x25, 0xf7, 0x30, 0xdd, 0xbf, 0xf5, 0xec, 0x65, 0xc1, 0x78, 0xfe, 0xb2, 0x60, 0xfc, 0xf1, + 0xb2, 0x60, 0x3c, 0x79, 0x55, 0x98, 0x78, 0xfe, 0xaa, 0x30, 0xf1, 0xeb, 0xab, 0xc2, 0xc4, 0xe7, + 0x4e, 0x44, 0x37, 0xd5, 0x76, 0x9f, 0x30, 0x3d, 0xdc, 0x76, 0xeb, 0xb8, 0xe1, 0x3b, 0x3d, 0xe1, + 0x51, 0x88, 0x68, 0x75, 0x5a, 0x74, 0x01, 0xff, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x71, 0xef, + 0x53, 0x77, 0xb6, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2622,18 +2613,18 @@ func (m *QueryTraceTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n4 i = encodeVarintQuery(dAtA, i, uint64(n4)) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 if len(m.BlockHash) > 0 { i -= len(m.BlockHash) copy(dAtA[i:], m.BlockHash) i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if m.BlockNumber != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.BlockNumber)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x20 } if len(m.Predecessors) > 0 { for iNdEx := len(m.Predecessors) - 1; iNdEx >= 0; iNdEx-- { @@ -2646,7 +2637,7 @@ func (m *QueryTraceTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } } if m.TraceConfig != nil { @@ -2659,12 +2650,7 @@ func (m *QueryTraceTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - } - if m.TxIndex != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if m.Msg != nil { { @@ -3203,9 +3189,6 @@ func (m *QueryTraceTxRequest) Size() (n int) { l = m.Msg.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.TxIndex != 0 { - n += 1 + sovQuery(uint64(m.TxIndex)) - } if m.TraceConfig != nil { l = m.TraceConfig.Size() n += 1 + l + sovQuery(uint64(l)) @@ -5085,25 +5068,6 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) - } - m.TxIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TraceConfig", wireType) } @@ -5139,7 +5103,7 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Predecessors", wireType) } @@ -5173,7 +5137,7 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) } @@ -5192,7 +5156,7 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { break } } - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) } @@ -5224,7 +5188,7 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { } m.BlockHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BlockTime", wireType) } From 4882553a109e36a1d9367a6d4ccc356753ad8835 Mon Sep 17 00:00:00 2001 From: Xiong Date: Tue, 26 Apr 2022 14:34:40 -0400 Subject: [PATCH 005/113] upgrade chain start related code --- app/app.go | 8 +- app/encoding.go | 33 --- app/params/encoding.go | 17 -- app/prefix.go | 11 - client/export.go | 97 +++++++ client/import.go | 58 +++++ client/keys.go | 106 ++++++++ client/keys/add.go | 327 ++++++++++++++++++++++++ client/keys/keys.go | 61 +++++ client/keys/utils.go | 72 ++++++ cmd/stchaind/genaccounts.go | 357 +++++++++++++++----------- cmd/stchaind/main.go | 136 ++-------- cmd/stchaind/main_new.go | 24 -- cmd/stchaind/root.go | 94 ++----- encoding/codec/codec.go | 6 + server/config/config.go | 75 ++++-- server/config/toml.go | 9 + server/flags/flags.go | 86 +++++++ server/json_rpc.go | 98 +++++++ server/start.go | 495 ++++++++++++++++++++++++++++++++++++ server/util.go | 98 +++++++ types/account.pb.go | 374 +++++++++++++++++++++++++++ types/codec.go | 23 +- types/web3.pb.go | 397 +++++++++++++++++++++++++++++ 24 files changed, 2618 insertions(+), 444 deletions(-) delete mode 100644 app/encoding.go delete mode 100644 app/params/encoding.go delete mode 100644 app/prefix.go create mode 100644 client/export.go create mode 100644 client/import.go create mode 100644 client/keys.go create mode 100644 client/keys/add.go create mode 100644 client/keys/keys.go create mode 100644 client/keys/utils.go delete mode 100644 cmd/stchaind/main_new.go create mode 100644 server/flags/flags.go create mode 100644 server/json_rpc.go create mode 100644 server/start.go create mode 100644 server/util.go create mode 100644 types/account.pb.go create mode 100644 types/web3.pb.go diff --git a/app/app.go b/app/app.go index d861635d..a5fa070f 100644 --- a/app/app.go +++ b/app/app.go @@ -5,6 +5,7 @@ import ( "net/http" "os" + sdkparams "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" @@ -90,7 +91,6 @@ import ( ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" - stratosparams "github.com/stratosnet/stratos-chain/app/params" "github.com/stratosnet/stratos-chain/helpers" //"github.com/stratosnet/stratos-chain/x/pot" //pottypes "github.com/stratosnet/stratos-chain/x/pot/types" @@ -105,9 +105,9 @@ const ( ) var ( - DefaultCLIHome = os.ExpandEnv("$HOME/.stchaincli") DefaultNodeHome = os.ExpandEnv("$HOME/.stchaind") - ModuleBasics = module.NewBasicManager( + + ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.AppModuleBasic{}, bank.AppModuleBasic{}, @@ -216,7 +216,7 @@ func NewInitApp( skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, - encodingConfig stratosparams.EncodingConfig, + encodingConfig sdkparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *NewApp { diff --git a/app/encoding.go b/app/encoding.go deleted file mode 100644 index e5c9b037..00000000 --- a/app/encoding.go +++ /dev/null @@ -1,33 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/std" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - - "github.com/stratosnet/stratos-chain/app/params" -) - -// MakeEncodingConfig creates an EncodingConfig for testing. This function -// should be used only in tests or when creating a new app instance (NewApp*()). -// App user shouldn't create new codecs - use the app.AppCodec instead. -// [DEPRECATED] -func MakeConfig() params.EncodingConfig { - cdc := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) - - encodingConfig := params.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, - TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes), - Amino: cdc, - } - - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} diff --git a/app/params/encoding.go b/app/params/encoding.go deleted file mode 100644 index 2cd16263..00000000 --- a/app/params/encoding.go +++ /dev/null @@ -1,17 +0,0 @@ -package params - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" -) - -// EncodingConfig specifies the concrete encoding types to use for a given app. -// This is provided for compatibility between protobuf and amino implementations. -type EncodingConfig struct { - InterfaceRegistry types.InterfaceRegistry - // NOTE: this field will be renamed to Codec - Marshaler codec.Codec - TxConfig client.TxConfig - Amino *codec.LegacyAmino -} diff --git a/app/prefix.go b/app/prefix.go deleted file mode 100644 index 8a1b94bf..00000000 --- a/app/prefix.go +++ /dev/null @@ -1,11 +0,0 @@ -package app - -import ( - stratos "github.com/stratosnet/stratos-chain/types" -) - -func SetConfig() { - config := stratos.GetConfig() - - config.Seal() -} diff --git a/client/export.go b/client/export.go new file mode 100644 index 00000000..5b34f0c8 --- /dev/null +++ b/client/export.go @@ -0,0 +1,97 @@ +package client + +import ( + "bufio" + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/input" + "github.com/cosmos/cosmos-sdk/crypto" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" + ethcrypto "github.com/ethereum/go-ethereum/crypto" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" + "github.com/stratosnet/stratos-chain/crypto/hd" +) + +// UnsafeExportEthKeyCommand exports a key with the given name as a private key in hex format. +func UnsafeExportEthKeyCommand() *cobra.Command { + return &cobra.Command{ + Use: "unsafe-export-eth-key [name]", + Short: "**UNSAFE** Export an Ethereum private key", + Long: `**UNSAFE** Export an Ethereum private key unencrypted to use in dev tooling`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + inBuf := bufio.NewReader(cmd.InOrStdin()) + + keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend) + rootDir, _ := cmd.Flags().GetString(flags.FlagHome) + + kr, err := keyring.New( + sdk.KeyringServiceName(), + keyringBackend, + rootDir, + inBuf, + hd.EthSecp256k1Option(), + ) + if err != nil { + return err + } + + decryptPassword := "" + conf := true + + switch keyringBackend { + case keyring.BackendFile: + decryptPassword, err = input.GetPassword( + "**WARNING this is an unsafe way to export your unencrypted private key**\nEnter key password:", + inBuf) + case keyring.BackendOS: + conf, err = input.GetConfirmation( + "**WARNING** this is an unsafe way to export your unencrypted private key, are you sure?", + inBuf, cmd.ErrOrStderr()) + } + if err != nil || !conf { + return err + } + + // Exports private key from keybase using password + armor, err := kr.ExportPrivKeyArmor(args[0], decryptPassword) + if err != nil { + return err + } + + privKey, algo, err := crypto.UnarmorDecryptPrivKey(armor, decryptPassword) + if err != nil { + return err + } + + if algo != ethsecp256k1.KeyType { + return fmt.Errorf("invalid key algorithm, got %s, expected %s", algo, ethsecp256k1.KeyType) + } + + // Converts key to stratos secp256k1 implementation + ethPrivKey, ok := privKey.(*ethsecp256k1.PrivKey) + if !ok { + return fmt.Errorf("invalid private key type %T, expected %T", privKey, ðsecp256k1.PrivKey{}) + } + + key, err := ethPrivKey.ToECDSA() + if err != nil { + return err + } + + // Formats key for output + privB := ethcrypto.FromECDSA(key) + keyS := strings.ToUpper(hexutil.Encode(privB)[2:]) + + fmt.Println(keyS) + + return nil + }, + } +} diff --git a/client/import.go b/client/import.go new file mode 100644 index 00000000..2c04bb41 --- /dev/null +++ b/client/import.go @@ -0,0 +1,58 @@ +package client + +import ( + "bufio" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/input" + "github.com/cosmos/cosmos-sdk/crypto" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" + "github.com/stratosnet/stratos-chain/crypto/hd" +) + +// UnsafeImportKeyCommand imports private keys from a keyfile. +func UnsafeImportKeyCommand() *cobra.Command { + return &cobra.Command{ + Use: "unsafe-import-eth-key ", + Short: "**UNSAFE** Import Ethereum private keys into the local keybase", + Long: "**UNSAFE** Import a hex-encoded Ethereum private key into the local keybase.", + Args: cobra.ExactArgs(2), + RunE: runImportCmd, + } +} + +func runImportCmd(cmd *cobra.Command, args []string) error { + inBuf := bufio.NewReader(cmd.InOrStdin()) + keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend) + rootDir, _ := cmd.Flags().GetString(flags.FlagHome) + + kb, err := keyring.New( + sdk.KeyringServiceName(), + keyringBackend, + rootDir, + inBuf, + hd.EthSecp256k1Option(), + ) + if err != nil { + return err + } + + passphrase, err := input.GetPassword("Enter passphrase to encrypt your key:", inBuf) + if err != nil { + return err + } + + privKey := ðsecp256k1.PrivKey{ + Key: common.FromHex(args[1]), + } + + armor := crypto.EncryptArmorPrivKey(privKey, passphrase, "eth_secp256k1") + + return kb.ImportPrivKey(args[0], armor, passphrase) +} diff --git a/client/keys.go b/client/keys.go new file mode 100644 index 00000000..66b81fe1 --- /dev/null +++ b/client/keys.go @@ -0,0 +1,106 @@ +package client + +import ( + "bufio" + + "github.com/spf13/cobra" + + "github.com/tendermint/tendermint/libs/cli" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + + clientkeys "github.com/stratosnet/stratos-chain/client/keys" + "github.com/stratosnet/stratos-chain/crypto/hd" +) + +// KeyCommands registers a sub-tree of commands to interact with +// local private key storage. +func KeyCommands(defaultNodeHome string) *cobra.Command { + cmd := &cobra.Command{ + Use: "keys", + Short: "Manage your application's keys", + Long: `Keyring management commands. These keys may be in any format supported by the +Tendermint crypto library and can be used by light-clients, full nodes, or any other application +that needs to sign with a private key. + +The keyring supports the following backends: + + os Uses the operating system's default credentials store. + file Uses encrypted file-based keystore within the app's configuration directory. + This keyring will request a password each time it is accessed, which may occur + multiple times in a single command resulting in repeated password prompts. + kwallet Uses KDE Wallet Manager as a credentials management application. + pass Uses the pass command line utility to store and retrieve keys. + test Stores keys insecurely to disk. It does not prompt for a password to be unlocked + and it should be use only for testing purposes. + +kwallet and pass backends depend on external tools. Refer to their respective documentation for more +information: + KWallet https://github.com/KDE/kwallet + pass https://www.passwordstore.org/ + +The pass backend requires GnuPG: https://gnupg.org/ +`, + } + + // support adding Ethereum supported keys + addCmd := keys.AddKeyCommand() + + // update the default signing algorithm value to "eth_secp256k1" + algoFlag := addCmd.Flag("algo") + algoFlag.DefValue = string(hd.EthSecp256k1Type) + err := algoFlag.Value.Set(string(hd.EthSecp256k1Type)) + if err != nil { + panic(err) + } + + addCmd.RunE = runAddCmd + + cmd.AddCommand( + keys.MnemonicKeyCommand(), + addCmd, + keys.ExportKeyCommand(), + keys.ImportKeyCommand(), + keys.ListKeysCmd(), + keys.ShowKeysCmd(), + flags.LineBreak, + keys.DeleteKeyCommand(), + keys.ParseKeyStringCommand(), + keys.MigrateCommand(), + flags.LineBreak, + UnsafeExportEthKeyCommand(), + UnsafeImportKeyCommand(), + ) + + cmd.PersistentFlags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.PersistentFlags().String(flags.FlagKeyringDir, "", "The client Keyring directory; if omitted, the default 'home' directory will be used") + cmd.PersistentFlags().String(flags.FlagKeyringBackend, keyring.BackendOS, "Select keyring's backend (os|file|test)") + cmd.PersistentFlags().String(cli.OutputFlag, "text", "Output format (text|json)") + return cmd +} + +func runAddCmd(cmd *cobra.Command, args []string) error { + buf := bufio.NewReader(cmd.InOrStdin()) + clientCtx := client.GetClientContextFromCmd(cmd) + + var ( + kr keyring.Keyring + err error + ) + + dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun) + if dryRun { + kr, err = keyring.New(sdk.KeyringServiceName(), keyring.BackendMemory, clientCtx.KeyringDir, buf, hd.EthSecp256k1Option()) + clientCtx = clientCtx.WithKeyring(kr) + } + + if err != nil { + return err + } + + return clientkeys.RunAddCmd(clientCtx, cmd, args, buf) +} diff --git a/client/keys/add.go b/client/keys/add.go new file mode 100644 index 00000000..e356f8bf --- /dev/null +++ b/client/keys/add.go @@ -0,0 +1,327 @@ +package keys + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "sort" + + "github.com/cosmos/go-bip39" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/input" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + stratoshd "github.com/stratosnet/stratos-chain/crypto/hd" +) + +const ( + flagInteractive = "interactive" + flagRecover = "recover" + flagNoBackup = "no-backup" + flagCoinType = "coin-type" + flagAccount = "account" + flagIndex = "index" + flagMultisig = "multisig" + flagMultiSigThreshold = "multisig-threshold" + flagNoSort = "nosort" + flagHDPath = "hd-path" + + mnemonicEntropySize = 256 +) + +// AddKeyCommand defines a keys command to add a generated or recovered private key to keybase. +func AddKeyCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "add ", + Short: "Add an encrypted private key (either newly generated or recovered), encrypt it, and save to file", + Long: `Derive a new private key and encrypt to disk. +Optionally specify a BIP39 mnemonic, a BIP39 passphrase to further secure the mnemonic, +and a bip32 HD path to derive a specific account. The key will be stored under the given name +and encrypted with the given password. The only input that is required is the encryption password. + +If run with -i, it will prompt the user for BIP44 path, BIP39 mnemonic, and passphrase. +The flag --recover allows one to recover a key from a seed passphrase. +If run with --dry-run, a key would be generated (or recovered) but not stored to the +local keystore. +Use the --pubkey flag to add arbitrary public keys to the keystore for constructing +multisig transactions. + +You can create and store a multisig key by passing the list of key names stored in a keyring +and the minimum number of signatures required through --multisig-threshold. The keys are +sorted by address, unless the flag --nosort is set. +Example: + + keys add mymultisig --multisig "keyname1,keyname2,keyname3" --multisig-threshold 2 +`, + Args: cobra.ExactArgs(1), + RunE: runAddCmdPrepare, + } + f := cmd.Flags() + f.StringSlice(flagMultisig, nil, "List of key names stored in keyring to construct a public legacy multisig key") + f.Int(flagMultiSigThreshold, 1, "K out of N required signatures. For use in conjunction with --multisig") + f.Bool(flagNoSort, false, "Keys passed to --multisig are taken in the order they're supplied") + f.String(keys.FlagPublicKey, "", "Parse a public key in JSON format and saves key info to file.") + f.BoolP(flagInteractive, "i", false, "Interactively prompt user for BIP39 passphrase and mnemonic") + f.Bool(flags.FlagUseLedger, false, "Store a local reference to a private key on a Ledger device") + f.Bool(flagRecover, false, "Provide seed phrase to recover existing key instead of creating") + f.Bool(flagNoBackup, false, "Don't print out seed phrase (if others are watching the terminal)") + f.Bool(flags.FlagDryRun, false, "Perform action, but don't add key to local keystore") + f.String(flagHDPath, "", "Manual HD Path derivation (overrides BIP44 config)") + f.Uint32(flagCoinType, sdk.GetConfig().GetCoinType(), "coin type number for HD derivation") + f.Uint32(flagAccount, 0, "Account number for HD derivation") + f.Uint32(flagIndex, 0, "Address index number for HD derivation") + f.String(flags.FlagKeyAlgorithm, string(stratoshd.EthSecp256k1Type), "Key signing algorithm to generate keys for") + + return cmd +} + +func runAddCmdPrepare(cmd *cobra.Command, args []string) error { + buf := bufio.NewReader(cmd.InOrStdin()) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + return RunAddCmd(clientCtx, cmd, args, buf) +} + +/* +input + - bip39 mnemonic + - bip39 passphrase + - bip44 path + - local encryption password +output + - armor encrypted private key (saved to file) +*/ +func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *bufio.Reader) error { + var err error + + name := args[0] + interactive, _ := cmd.Flags().GetBool(flagInteractive) + noBackup, _ := cmd.Flags().GetBool(flagNoBackup) + showMnemonic := !noBackup + kb := ctx.Keyring + outputFormat := ctx.OutputFormat + + keyringAlgos, _ := kb.SupportedAlgorithms() + algoStr, _ := cmd.Flags().GetString(flags.FlagKeyAlgorithm) + algo, err := keyring.NewSigningAlgoFromString(algoStr, keyringAlgos) + if err != nil { + return err + } + + if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun { + // use in memory keybase + kb = keyring.NewInMemory(stratoshd.EthSecp256k1Option()) + } else { + _, err = kb.Key(name) + if err == nil { + // account exists, ask for user confirmation + response, err2 := input.GetConfirmation(fmt.Sprintf("override the existing name %s", name), inBuf, cmd.ErrOrStderr()) + if err2 != nil { + return err2 + } + + if !response { + return errors.New("aborted") + } + + err2 = kb.Delete(name) + if err2 != nil { + return err2 + } + } + + multisigKeys, _ := cmd.Flags().GetStringSlice(flagMultisig) + if len(multisigKeys) != 0 { + pks := make([]cryptotypes.PubKey, len(multisigKeys)) + multisigThreshold, _ := cmd.Flags().GetInt(flagMultiSigThreshold) + if err := validateMultisigThreshold(multisigThreshold, len(multisigKeys)); err != nil { + return err + } + + for i, keyname := range multisigKeys { + k, err := kb.Key(keyname) + if err != nil { + return err + } + + pks[i] = k.GetPubKey() + } + + if noSort, _ := cmd.Flags().GetBool(flagNoSort); !noSort { + sort.Slice(pks, func(i, j int) bool { + return bytes.Compare(pks[i].Address(), pks[j].Address()) < 0 + }) + } + + pk := multisig.NewLegacyAminoPubKey(multisigThreshold, pks) + info, err := kb.SaveMultisig(name, pk) + if err != nil { + return err + } + + return printCreate(cmd, info, false, "", outputFormat) + } + } + + pubKey, _ := cmd.Flags().GetString(keys.FlagPublicKey) + if pubKey != "" { + var pk cryptotypes.PubKey + err = ctx.Codec.UnmarshalInterfaceJSON([]byte(pubKey), &pk) + if err != nil { + return err + } + + info, err := kb.SavePubKey(name, pk, algo.Name()) + if err != nil { + return err + } + + return printCreate(cmd, info, false, "", outputFormat) + } + + coinType, _ := cmd.Flags().GetUint32(flagCoinType) + account, _ := cmd.Flags().GetUint32(flagAccount) + index, _ := cmd.Flags().GetUint32(flagIndex) + hdPath, _ := cmd.Flags().GetString(flagHDPath) + useLedger, _ := cmd.Flags().GetBool(flags.FlagUseLedger) + + if len(hdPath) == 0 { + hdPath = hd.CreateHDPath(coinType, account, index).String() + } else if useLedger { + return errors.New("cannot set custom bip32 path with ledger") + } + + // If we're using ledger, only thing we need is the path and the bech32 prefix. + if useLedger { + bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix() + + info, err := kb.SaveLedgerKey(name, algo, bech32PrefixAccAddr, coinType, account, index) + if err != nil { + return err + } + + return printCreate(cmd, info, false, "", outputFormat) + } + + // Get bip39 mnemonic + var mnemonic, bip39Passphrase string + + recover, _ := cmd.Flags().GetBool(flagRecover) + if recover { + mnemonic, err = input.GetString("Enter your bip39 mnemonic", inBuf) + if err != nil { + return err + } + + if !bip39.IsMnemonicValid(mnemonic) { + return errors.New("invalid mnemonic") + } + } else if interactive { + mnemonic, err = input.GetString("Enter your bip39 mnemonic, or hit enter to generate one.", inBuf) + if err != nil { + return err + } + + if !bip39.IsMnemonicValid(mnemonic) && mnemonic != "" { + return errors.New("invalid mnemonic") + } + } + + if len(mnemonic) == 0 { + // read entropy seed straight from tmcrypto.Rand and convert to mnemonic + entropySeed, err := bip39.NewEntropy(mnemonicEntropySize) + if err != nil { + return err + } + + mnemonic, err = bip39.NewMnemonic(entropySeed) + if err != nil { + return err + } + } + + // override bip39 passphrase + if interactive { + bip39Passphrase, err = input.GetString( + "Enter your bip39 passphrase. This is combined with the mnemonic to derive the seed. "+ + "Most users should just hit enter to use the default, \"\"", inBuf) + if err != nil { + return err + } + + // if they use one, make them re-enter it + if len(bip39Passphrase) != 0 { + p2, err := input.GetString("Repeat the passphrase:", inBuf) + if err != nil { + return err + } + + if bip39Passphrase != p2 { + return errors.New("passphrases don't match") + } + } + } + + info, err := kb.NewAccount(name, mnemonic, bip39Passphrase, hdPath, algo) + if err != nil { + return err + } + + // Recover key from seed passphrase + if recover { + // Hide mnemonic from output + showMnemonic = false + mnemonic = "" + } + + return printCreate(cmd, info, showMnemonic, mnemonic, outputFormat) +} + +func printCreate(cmd *cobra.Command, info keyring.Info, showMnemonic bool, mnemonic, outputFormat string) error { + switch outputFormat { + case OutputFormatText: + cmd.PrintErrln() + printKeyInfo(cmd.OutOrStdout(), info, keyring.MkAccKeyOutput, outputFormat) + + // print mnemonic unless requested not to. + if showMnemonic { + fmt.Fprintln(cmd.ErrOrStderr(), "\n**Important** write this mnemonic phrase in a safe place.") + fmt.Fprintln(cmd.ErrOrStderr(), "It is the only way to recover your account if you ever forget your password.") + fmt.Fprintln(cmd.ErrOrStderr(), "") + fmt.Fprintln(cmd.ErrOrStderr(), mnemonic) + } + case OutputFormatJSON: + out, err := keyring.MkAccKeyOutput(info) + if err != nil { + return err + } + + if showMnemonic { + out.Mnemonic = mnemonic + } + + jsonString, err := keys.KeysCdc.MarshalJSON(out) + if err != nil { + return err + } + + cmd.Println(string(jsonString)) + + default: + return fmt.Errorf("invalid output format %s", outputFormat) + } + + return nil +} diff --git a/client/keys/keys.go b/client/keys/keys.go new file mode 100644 index 00000000..b2bba494 --- /dev/null +++ b/client/keys/keys.go @@ -0,0 +1,61 @@ +package keys + +import ( + "github.com/spf13/cobra" + "github.com/tendermint/tendermint/libs/cli" + + "github.com/cosmos/cosmos-sdk/client/flags" + + "github.com/cosmos/cosmos-sdk/client/keys" +) + +// Commands registers a sub-tree of commands to interact with +// local private key storage. +func Commands(defaultNodeHome string) *cobra.Command { + cmd := &cobra.Command{ + Use: "keys", + Short: "Manage your application's keys", + Long: `Keyring management commands. These keys may be in any format supported by the +Tendermint crypto library and can be used by light-clients, full nodes, or any other application +that needs to sign with a private key. + +The keyring supports the following backends: + + os Uses the operating system's default credentials store. + file Uses encrypted file-based keystore within the app's configuration directory. + This keyring will request a password each time it is accessed, which may occur + multiple times in a single command resulting in repeated password prompts. + kwallet Uses KDE Wallet Manager as a credentials management application. + pass Uses the pass command line utility to store and retrieve keys. + test Stores keys insecurely to disk. It does not prompt for a password to be unlocked + and it should be use only for testing purposes. + +kwallet and pass backends depend on external tools. Refer to their respective documentation for more +information: + KWallet https://github.com/KDE/kwallet + pass https://www.passwordstore.org/ + +The pass backend requires GnuPG: https://gnupg.org/ +`, + } + + cmd.AddCommand( + keys.MnemonicKeyCommand(), + AddKeyCommand(), + keys.ExportKeyCommand(), + keys.ImportKeyCommand(), + keys.ListKeysCmd(), + keys.ShowKeysCmd(), + flags.LineBreak, + keys.DeleteKeyCommand(), + keys.ParseKeyStringCommand(), + keys.MigrateCommand(), + ) + + cmd.PersistentFlags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.PersistentFlags().String(flags.FlagKeyringDir, "", "The client Keyring directory; if omitted, the default 'home' directory will be used") + cmd.PersistentFlags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") + cmd.PersistentFlags().String(cli.OutputFlag, "text", "Output format (text|json)") + + return cmd +} diff --git a/client/keys/utils.go b/client/keys/utils.go new file mode 100644 index 00000000..d054c783 --- /dev/null +++ b/client/keys/utils.go @@ -0,0 +1,72 @@ +package keys + +import ( + "fmt" + "io" + "path/filepath" + + "gopkg.in/yaml.v2" + + "github.com/cosmos/cosmos-sdk/client/keys" + cryptokeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" +) + +// available output formats. +const ( + OutputFormatText = "text" + OutputFormatJSON = "json" + + // defaultKeyDBName is the client's subdirectory where keys are stored. + defaultKeyDBName = "keys" +) + +type bechKeyOutFn func(keyInfo cryptokeyring.Info) (cryptokeyring.KeyOutput, error) + +// NewLegacyKeyBaseFromDir initializes a legacy keybase at the rootDir directory. Keybase +// options can be applied when generating this new Keybase. +func NewLegacyKeyBaseFromDir(rootDir string, opts ...cryptokeyring.KeybaseOption) (cryptokeyring.LegacyKeybase, error) { + return getLegacyKeyBaseFromDir(rootDir, opts...) +} + +func getLegacyKeyBaseFromDir(rootDir string, opts ...cryptokeyring.KeybaseOption) (cryptokeyring.LegacyKeybase, error) { + return cryptokeyring.NewLegacy(defaultKeyDBName, filepath.Join(rootDir, "keys"), opts...) +} + +func printKeyInfo(w io.Writer, keyInfo cryptokeyring.Info, bechKeyOut bechKeyOutFn, output string) { + ko, err := bechKeyOut(keyInfo) + if err != nil { + panic(err) + } + + switch output { + case OutputFormatText: + printTextInfos(w, []cryptokeyring.KeyOutput{ko}) + + case OutputFormatJSON: + out, err := keys.KeysCdc.MarshalJSON(ko) + if err != nil { + panic(err) + } + + fmt.Fprintln(w, string(out)) + } +} + +func printTextInfos(w io.Writer, kos []cryptokeyring.KeyOutput) { + out, err := yaml.Marshal(&kos) + if err != nil { + panic(err) + } + fmt.Fprintln(w, string(out)) +} + +func validateMultisigThreshold(k, nKeys int) error { + if k <= 0 { + return fmt.Errorf("threshold must be a positive integer") + } + if nKeys < k { + return fmt.Errorf( + "threshold k of n multisignature: %d < %d", nKeys, k) + } + return nil +} diff --git a/cmd/stchaind/genaccounts.go b/cmd/stchaind/genaccounts.go index 275e9ded..a3a107ff 100644 --- a/cmd/stchaind/genaccounts.go +++ b/cmd/stchaind/genaccounts.go @@ -1,153 +1,208 @@ package main -//import ( -// "bufio" -// "errors" -// "fmt" -// -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// -// "github.com/tendermint/tendermint/libs/cli" -// -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/codec" -// "github.com/cosmos/cosmos-sdk/crypto/keys" -// "github.com/cosmos/cosmos-sdk/server" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/x/auth" -// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" -// authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting" -// "github.com/cosmos/cosmos-sdk/x/genutil" -//) -// -//const ( -// flagClientHome = "home-client" -// flagVestingStart = "vesting-start-time" -// flagVestingEnd = "vesting-end-time" -// flagVestingAmt = "vesting-amount" -//) -// -//// AddGenesisAccountCmd returns add-genesis-account cobra Command. -//func AddGenesisAccountCmd( -// ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, -//) *cobra.Command { -// -// cmd := &cobra.Command{ -// Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", -// Short: "Add a genesis account to genesis.json", -// Long: `Add a genesis account to genesis.json. The provided account must specify -//the account address or key name and a list of initial coins. If a key name is given, -//the address will be looked up in the local Keybase. The list of initial tokens must -//contain valid denominations. Accounts may optionally be supplied with vesting parameters. -//`, -// Args: cobra.ExactArgs(2), -// RunE: func(cmd *cobra.Command, args []string) error { -// config := ctx.Config -// config.SetRoot(viper.GetString(cli.HomeFlag)) -// -// addr, err := sdk.AccAddressFromBech32(args[0]) -// inBuf := bufio.NewReader(cmd.InOrStdin()) -// if err != nil { -// // attempt to lookup address from Keybase if no address was provided -// kb, err := keys.NewKeyring( -// sdk.KeyringServiceName(), -// viper.GetString(flags.FlagKeyringBackend), -// viper.GetString(flagClientHome), -// inBuf, -// ) -// if err != nil { -// return err -// } -// -// info, err := kb.Get(args[0]) -// if err != nil { -// return fmt.Errorf("failed to get address from Keybase: %w", err) -// } -// -// addr = info.GetAddress() -// } -// -// coins, err := sdk.ParseCoins(args[1]) -// if err != nil { -// return fmt.Errorf("failed to parse coins: %w", err) -// } -// -// vestingStart := viper.GetInt64(flagVestingStart) -// vestingEnd := viper.GetInt64(flagVestingEnd) -// vestingAmt, err := sdk.ParseCoins(viper.GetString(flagVestingAmt)) -// if err != nil { -// return fmt.Errorf("failed to parse vesting amount: %w", err) -// } -// -// // create concrete account type based on input parameters -// var genAccount authexported.GenesisAccount -// -// baseAccount := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0) -// if !vestingAmt.IsZero() { -// baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) -// if err != nil { -// return fmt.Errorf("failed to create base vesting account: %w", err) -// } -// -// switch { -// case vestingStart != 0 && vestingEnd != 0: -// genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) -// -// case vestingEnd != 0: -// genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) -// -// default: -// return errors.New("invalid vesting parameters; must supply start and end time or end time") -// } -// } else { -// genAccount = baseAccount -// } -// -// if err := genAccount.Validate(); err != nil { -// return fmt.Errorf("failed to validate new genesis account: %w", err) -// } -// -// genFile := config.GenesisFile() -// appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) -// if err != nil { -// return fmt.Errorf("failed to unmarshal genesis state: %w", err) -// } -// -// authGenState := auth.GetGenesisStateFromAppState(cdc, appState) -// -// if authGenState.Accounts.Contains(addr) { -// return fmt.Errorf("cannot add account at existing address %s", addr) -// } -// -// // Add the new account to the set of genesis accounts and sanitize the -// // accounts afterwards. -// authGenState.Accounts = append(authGenState.Accounts, genAccount) -// authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts) -// -// authGenStateBz, err := cdc.MarshalJSON(authGenState) -// if err != nil { -// return fmt.Errorf("failed to marshal auth genesis state: %w", err) -// } -// -// appState[auth.ModuleName] = authGenStateBz -// -// appStateJSON, err := cdc.MarshalJSON(appState) -// if err != nil { -// return fmt.Errorf("failed to marshal application genesis state: %w", err) -// } -// -// genDoc.AppState = appStateJSON -// return genutil.ExportGenesisFile(genDoc, genFile) -// }, -// } -// -// cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") -// cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") -// cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") -// cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") -// cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") -// cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") -// -// return cmd -//} +import ( + "bufio" + "encoding/json" + "errors" + "fmt" + + "github.com/spf13/cobra" + + "github.com/ethereum/go-ethereum/common" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + + "github.com/stratosnet/stratos-chain/crypto/hd" + stratos "github.com/stratosnet/stratos-chain/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +const ( + //flagClientHome = "home-client" + flagVestingStart = "vesting-start-time" + flagVestingEnd = "vesting-end-time" + flagVestingAmt = "vesting-amount" +) + +// AddGenesisAccountCmd returns add-genesis-account cobra Command. +func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command { + + cmd := &cobra.Command{ + Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", + Short: "Add a genesis account to genesis.json", + Long: `Add a genesis account to genesis.json. The provided account must specify +the account address or key name and a list of initial coins. If a key name is given, +the address will be looked up in the local Keybase. The list of initial tokens must +contain valid denominations. Accounts may optionally be supplied with vesting parameters. +`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + config.SetRoot(clientCtx.HomeDir) + + var kr keyring.Keyring + addr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + inBuf := bufio.NewReader(cmd.InOrStdin()) + keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend) + + if keyringBackend != "" && clientCtx.Keyring == nil { + var err error + kr, err = keyring.New( + sdk.KeyringServiceName(), + keyringBackend, + clientCtx.HomeDir, + inBuf, + hd.EthSecp256k1Option(), + ) + if err != nil { + return err + } + } else { + kr = clientCtx.Keyring + } + + info, err := kr.Key(args[0]) + if err != nil { + return fmt.Errorf("failed to get address from Keyring: %w", err) + } + + addr = info.GetAddress() + } + + coins, err := sdk.ParseCoinsNormalized(args[1]) + if err != nil { + return fmt.Errorf("failed to parse coins: %w", err) + } + + vestingStart, err := cmd.Flags().GetInt64(flagVestingStart) + if err != nil { + return err + } + vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd) + if err != nil { + return err + } + vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt) + if err != nil { + return err + } + vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) + if err != nil { + return fmt.Errorf("failed to parse vesting amount: %w", err) + } + + // create concrete account type based on input parameters + var genAccount authtypes.GenesisAccount + + balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} + baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) + + if !vestingAmt.IsZero() { + baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) + + if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || + baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { + return errors.New("vesting amount cannot be greater than total amount") + } + + switch { + case vestingStart != 0 && vestingEnd != 0: + genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) + + case vestingEnd != 0: + genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) + + default: + return errors.New("invalid vesting parameters; must supply start and end time or end time") + } + } else { + genAccount = &stratos.EthAccount{ + BaseAccount: baseAccount, + CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), + } + } + + if err := genAccount.Validate(); err != nil { + return fmt.Errorf("failed to validate new genesis account: %w", err) + } + + genFile := config.GenesisFile() + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + if err != nil { + return fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) + + accs, err := authtypes.UnpackAccounts(authGenState.Accounts) + if err != nil { + return fmt.Errorf("failed to get accounts from any: %w", err) + } + + if accs.Contains(addr) { + return fmt.Errorf("cannot add account at existing address %s", addr) + } + + // Add the new account to the set of genesis accounts and sanitize the + // accounts afterwards. + accs = append(accs, genAccount) + accs = authtypes.SanitizeGenesisAccounts(accs) + + genAccs, err := authtypes.PackAccounts(accs) + if err != nil { + return fmt.Errorf("failed to convert accounts into any's: %w", err) + } + authGenState.Accounts = genAccs + + authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState) + if err != nil { + return fmt.Errorf("failed to marshal auth genesis state: %w", err) + } + + appState[authtypes.ModuleName] = authGenStateBz + + bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) + bankGenState.Balances = append(bankGenState.Balances, balances) + bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) + bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...) + + bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState) + if err != nil { + return fmt.Errorf("failed to marshal bank genesis state: %w", err) + } + + appState[banktypes.ModuleName] = bankGenStateBz + + appStateJSON, err := json.Marshal(appState) + if err != nil { + return fmt.Errorf("failed to marshal application genesis state: %w", err) + } + + genDoc.AppState = appStateJSON + return genutil.ExportGenesisFile(genDoc, genFile) + }, + } + + cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") + cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") + cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") + cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/cmd/stchaind/main.go b/cmd/stchaind/main.go index 320d6c09..86338297 100644 --- a/cmd/stchaind/main.go +++ b/cmd/stchaind/main.go @@ -1,110 +1,30 @@ package main -//import ( -// "encoding/json" -// "io" -// -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// -// abci "github.com/tendermint/tendermint/abci/types" -// "github.com/tendermint/tendermint/libs/cli" -// "github.com/tendermint/tendermint/libs/log" -// tmtypes "github.com/tendermint/tendermint/types" -// dbm "github.com/tendermint/tm-db" -// -// "github.com/stratosnet/stratos-chain/app" -// -// "github.com/cosmos/cosmos-sdk/baseapp" -// "github.com/cosmos/cosmos-sdk/client/debug" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/server" -// "github.com/cosmos/cosmos-sdk/store" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/x/auth" -// genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" -// "github.com/cosmos/cosmos-sdk/x/staking" -//) -// -//const flagInvCheckPeriod = "inv-check-period" -// -//var invCheckPeriod uint -// -//func main() { -// cdc := app.MakeCodec() -// -// app.SetConfig() -// -// ctx := server.NewDefaultContext() -// cobra.EnableCommandSorting = false -// rootCmd := &cobra.Command{ -// Use: "stchaind", -// Short: "app Daemon (server)", -// PersistentPreRunE: server.PersistentPreRunEFn(ctx), -// } -// -// rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) -// rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome)) -// rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) -// rootCmd.AddCommand( -// genutilcli.GenTxCmd( -// ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, -// auth.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome, -// ), -// ) -// rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) -// rootCmd.AddCommand(AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) -// rootCmd.AddCommand(AddGenesisIndexingNodeCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome, auth.GenesisAccountIterator{})) -// rootCmd.AddCommand(LoadTestCommands(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) -// rootCmd.AddCommand(flags.NewCompletionCmd(rootCmd, true)) -// rootCmd.AddCommand(debug.Cmd(cdc)) -// -// server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) -// -// // prepare and add flags -// executor := cli.PrepareBaseCmd(rootCmd, "AU", app.DefaultNodeHome) -// rootCmd.PersistentFlags().UintVar(&invCheckPeriod, flagInvCheckPeriod, -// 0, "Assert registered invariants every N blocks") -// err := executor.Execute() -// if err != nil { -// panic(err) -// } -//} -// -//func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application { -// var cache sdk.MultiStorePersistentCache -// -// if viper.GetBool(server.FlagInterBlockCache) { -// cache = store.NewCommitKVStoreCacheManager() -// } -// pruningOpts, err := server.GetPruningOptionsFromFlags() -// if err != nil { -// panic(err) -// } -// return app.NewInitApp( -// logger, db, traceStore, true, invCheckPeriod, -// baseapp.SetPruning(pruningOpts), -// baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)), -// baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)), -// baseapp.SetHaltTime(viper.GetUint64(server.FlagHaltTime)), -// baseapp.SetInterBlockCache(cache), -// ) -//} -// -//func exportAppStateAndTMValidators( -// logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailWhiteList []string, -//) (json.RawMessage, []tmtypes.GenesisValidator, error) { -// -// if height != -1 { -// aApp := app.NewInitApp(logger, db, traceStore, false, uint(1)) -// err := aApp.LoadHeight(height) -// if err != nil { -// return nil, nil, err -// } -// return aApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) -// } -// -// aApp := app.NewInitApp(logger, db, traceStore, true, uint(1)) -// -// return aApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) -//} +import ( + "os" + + "github.com/cosmos/cosmos-sdk/server" + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + + "github.com/stratosnet/stratos-chain/app" + stratos "github.com/stratosnet/stratos-chain/types" +) + +func main() { + setupConfig() + rootCmd, _ := NewRootCmd() + if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { + switch e := err.(type) { + case server.ErrorCode: + os.Exit(e.Code) + + default: + os.Exit(1) + } + } +} + +func setupConfig() { + config := stratos.GetConfig() + config.Seal() +} diff --git a/cmd/stchaind/main_new.go b/cmd/stchaind/main_new.go deleted file mode 100644 index e270fc61..00000000 --- a/cmd/stchaind/main_new.go +++ /dev/null @@ -1,24 +0,0 @@ -package main - -import ( - "os" - - "github.com/cosmos/cosmos-sdk/server" - svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - - "github.com/stratosnet/stratos-chain/app" -) - -func main() { - app.SetConfig() - rootCmd, _ := NewRootCmd() - if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - - default: - os.Exit(1) - } - } -} diff --git a/cmd/stchaind/root.go b/cmd/stchaind/root.go index a758681e..7d95c14e 100644 --- a/cmd/stchaind/root.go +++ b/cmd/stchaind/root.go @@ -18,11 +18,10 @@ import ( "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/server" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/cosmos/cosmos-sdk/snapshots" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" @@ -33,13 +32,20 @@ import ( genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/stratosnet/stratos-chain/app" - "github.com/stratosnet/stratos-chain/app/params" + stratosclient "github.com/stratosnet/stratos-chain/client" + "github.com/stratosnet/stratos-chain/crypto/hd" + "github.com/stratosnet/stratos-chain/encoding" + servercfg "github.com/stratosnet/stratos-chain/server/config" + srvflags "github.com/stratosnet/stratos-chain/server/flags" + stratos "github.com/stratosnet/stratos-chain/types" ) +const EnvPrefix = "" + // NewRootCmd creates a new root command for simd. It is called once in the // main function. func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - encodingConfig := app.MakeConfig() + encodingConfig := encoding.MakeConfig(app.ModuleBasics) initClientCtx := client.Context{}. WithCodec(encodingConfig.Marshaler). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). @@ -47,8 +53,10 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { WithLegacyAmino(encodingConfig.Amino). WithInput(os.Stdin). WithAccountRetriever(types.AccountRetriever{}). + WithBroadcastMode(flags.BroadcastBlock). WithHomeDir(app.DefaultNodeHome). - WithViper("") // In simapp, we don't use any prefix for env variables. + WithKeyringOptions(hd.EthSecp256k1Option()). + WithViper(EnvPrefix) // In simapp, we don't use any prefix for env variables. rootCmd := &cobra.Command{ Use: "stchaind", @@ -72,85 +80,29 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return err } - customAppTemplate, customAppConfig := initAppConfig() + customAppTemplate, customAppConfig := servercfg.AppConfig(stratos.USTOS) return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig) }, } + cfg := sdk.GetConfig() + cfg.Seal() + initRootCmd(rootCmd, encodingConfig) return rootCmd, encodingConfig } -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - // The following code snippet is just for reference. - - // WASMConfig defines configuration for the wasm module. - type WASMConfig struct { - // This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries - QueryGasLimit uint64 `mapstructure:"query_gas_limit"` - - // Address defines the gRPC-web server to listen on - LruSize uint64 `mapstructure:"lru_size"` - } - - type CustomAppConfig struct { - serverconfig.Config - - WASM WASMConfig `mapstructure:"wasm"` - } - - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - // The SDK's default minimum gas price is set to "" (empty value) inside - // app.toml. If left empty by validators, the node will halt on startup. - // However, the chain developer can set a default app.toml value for their - // validators here. - // - // In summary: - // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their - // own app.toml config, - // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their - // own app.toml to override, or use this default value. - // - // In simapp, we set the min gas prices to 0. - srvCfg.MinGasPrices = "0ustos" - - customAppConfig := CustomAppConfig{ - Config: *srvCfg, - WASM: WASMConfig{ - LruSize: 1, - QueryGasLimit: 300000, - }, - } - - customAppTemplate := serverconfig.DefaultConfigTemplate + ` -[wasm] -# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries -query_gas_limit = 300000 -# This is the number of wasm vm instances we keep cached in memory for speed-up -# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally -lru_size = 0` - - return customAppTemplate, customAppConfig -} - func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { - cfg := sdk.GetConfig() - cfg.Seal() - rootCmd.AddCommand( genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.ValidateGenesisCmd(app.ModuleBasics), + AddGenesisAccountCmd(app.DefaultNodeHome), //TODO: fix these cmds - //AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome), //AddGenesisIndexingNodeCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome, banktypes.GenesisBalancesIterator{}), //LoadTestCommands(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome), tmcli.NewCompletionCmd(rootCmd, true), @@ -167,9 +119,14 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rpc.StatusCommand(), queryCommand(), txCommand(), - keys.Commands(app.DefaultNodeHome), + stratosclient.KeyCommands(app.DefaultNodeHome), ) + rootCmd, err := srvflags.AddTxFlags(rootCmd) + if err != nil { + panic(err) + } + // add rosetta rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) } @@ -284,7 +241,8 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a // and exports state. func (a appCreator) appExport( logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, - appOpts servertypes.AppOptions) (servertypes.ExportedApp, error) { + appOpts servertypes.AppOptions, +) (servertypes.ExportedApp, error) { var stratosApp *app.NewApp homePath, ok := appOpts.Get(flags.FlagHome).(string) diff --git a/encoding/codec/codec.go b/encoding/codec/codec.go index d0db28b1..98cb4a1b 100644 --- a/encoding/codec/codec.go +++ b/encoding/codec/codec.go @@ -5,15 +5,21 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/std" sdk "github.com/cosmos/cosmos-sdk/types" + + cryptocodec "github.com/stratosnet/stratos-chain/crypto/codec" + stratos "github.com/stratosnet/stratos-chain/types" ) // RegisterLegacyAminoCodec registers Interfaces from types, crypto, and SDK std. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { sdk.RegisterLegacyAminoCodec(cdc) + cryptocodec.RegisterCrypto(cdc) codec.RegisterEvidences(cdc) } // RegisterInterfaces registers Interfaces from types, crypto, and SDK std. func RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) { std.RegisterInterfaces(interfaceRegistry) + cryptocodec.RegisterInterfaces(interfaceRegistry) + stratos.RegisterInterfaces(interfaceRegistry) } diff --git a/server/config/config.go b/server/config/config.go index 84e47435..c1e2e323 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -11,7 +11,6 @@ import ( "github.com/tendermint/tendermint/libs/strings" "github.com/cosmos/cosmos-sdk/server/config" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -28,6 +27,8 @@ const ( // DefaultEVMTracer is the default vm.Tracer type DefaultEVMTracer = "" + DefaultMaxTxGasWanted = 500000 + DefaultGasCap uint64 = 25000000 DefaultFilterCap int32 = 200 @@ -41,6 +42,10 @@ const ( DefaultEVMTimeout = 5 * time.Second // default 1.0 eth DefaultTxFeeCap float64 = 1.0 + + DefaultHTTPTimeout = 30 * time.Second + + DefaultHTTPIdleTimeout = 120 * time.Second ) var evmTracers = []string{"json", "markdown", "struct", "access_list"} @@ -60,6 +65,8 @@ type EVMConfig struct { // Tracer defines vm.Tracer type that the EVM will use if the node is run in // trace mode. Default: 'json'. Tracer string `mapstructure:"tracer"` + // MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. + MaxTxGasWanted uint64 `mapstructure:"max-tx-gas-wanted"` } // JSONRPCConfig defines configuration for the EVM RPC server. @@ -86,6 +93,10 @@ type JSONRPCConfig struct { LogsCap int32 `mapstructure:"logs-cap"` // BlockRangeCap defines the max block range allowed for `eth_getLogs` query. BlockRangeCap int32 `mapstructure:"block-range-cap"` + // HTTPTimeout is the read/write timeout of http json-rpc server. + HTTPTimeout time.Duration `mapstructure:"http-timeout"` + // HTTPIdleTimeout is the idle timeout of http json-rpc server. + HTTPIdleTimeout time.Duration `mapstructure:"http-idle-timeout"` } // TLSConfig defines the certificate and matching private key for the server. @@ -144,7 +155,8 @@ func DefaultConfig() *Config { // DefaultEVMConfig returns the default EVM configuration func DefaultEVMConfig() *EVMConfig { return &EVMConfig{ - Tracer: DefaultEVMTracer, + Tracer: DefaultEVMTracer, + MaxTxGasWanted: DefaultMaxTxGasWanted, } } @@ -170,17 +182,19 @@ func GetAPINamespaces() []string { // DefaultJSONRPCConfig returns an EVM config with the JSON-RPC API enabled by default func DefaultJSONRPCConfig() *JSONRPCConfig { return &JSONRPCConfig{ - Enable: true, - API: GetDefaultAPINamespaces(), - Address: DefaultJSONRPCAddress, - WsAddress: DefaultJSONRPCWsAddress, - GasCap: DefaultGasCap, - EVMTimeout: DefaultEVMTimeout, - TxFeeCap: DefaultTxFeeCap, - FilterCap: DefaultFilterCap, - FeeHistoryCap: DefaultFeeHistoryCap, - BlockRangeCap: DefaultBlockRangeCap, - LogsCap: DefaultLogsCap, + Enable: true, + API: GetDefaultAPINamespaces(), + Address: DefaultJSONRPCAddress, + WsAddress: DefaultJSONRPCWsAddress, + GasCap: DefaultGasCap, + EVMTimeout: DefaultEVMTimeout, + TxFeeCap: DefaultTxFeeCap, + FilterCap: DefaultFilterCap, + FeeHistoryCap: DefaultFeeHistoryCap, + BlockRangeCap: DefaultBlockRangeCap, + LogsCap: DefaultLogsCap, + HTTPTimeout: DefaultHTTPTimeout, + HTTPIdleTimeout: DefaultHTTPIdleTimeout, } } @@ -214,6 +228,14 @@ func (c JSONRPCConfig) Validate() error { return errors.New("JSON-RPC block range cap cannot be negative") } + if c.HTTPTimeout < 0 { + return errors.New("JSON-RPC HTTP timeout duration cannot be negative") + } + + if c.HTTPIdleTimeout < 0 { + return errors.New("JSON-RPC HTTP idle timeout duration cannot be negative") + } + // check for duplicates seenAPIs := make(map[string]bool) for _, api := range c.API { @@ -259,20 +281,23 @@ func GetConfig(v *viper.Viper) Config { return Config{ Config: cfg, EVM: EVMConfig{ - Tracer: v.GetString("evm.tracer"), + Tracer: v.GetString("evm.tracer"), + MaxTxGasWanted: v.GetUint64("evm.max-tx-gas-wanted"), }, JSONRPC: JSONRPCConfig{ - Enable: v.GetBool("json-rpc.enable"), - API: v.GetStringSlice("json-rpc.api"), - Address: v.GetString("json-rpc.address"), - WsAddress: v.GetString("json-rpc.ws-address"), - GasCap: v.GetUint64("json-rpc.gas-cap"), - FilterCap: v.GetInt32("json-rpc.filter-cap"), - FeeHistoryCap: v.GetInt32("json-rpc.feehistory-cap"), - TxFeeCap: v.GetFloat64("json-rpc.txfee-cap"), - EVMTimeout: v.GetDuration("json-rpc.evm-timeout"), - LogsCap: v.GetInt32("json-rpc.logs-cap"), - BlockRangeCap: v.GetInt32("json-rpc.block-range-cap"), + Enable: v.GetBool("json-rpc.enable"), + API: v.GetStringSlice("json-rpc.api"), + Address: v.GetString("json-rpc.address"), + WsAddress: v.GetString("json-rpc.ws-address"), + GasCap: v.GetUint64("json-rpc.gas-cap"), + FilterCap: v.GetInt32("json-rpc.filter-cap"), + FeeHistoryCap: v.GetInt32("json-rpc.feehistory-cap"), + TxFeeCap: v.GetFloat64("json-rpc.txfee-cap"), + EVMTimeout: v.GetDuration("json-rpc.evm-timeout"), + LogsCap: v.GetInt32("json-rpc.logs-cap"), + BlockRangeCap: v.GetInt32("json-rpc.block-range-cap"), + HTTPTimeout: v.GetDuration("json-rpc.http-timeout"), + HTTPIdleTimeout: v.GetDuration("json-rpc.http-idle-timeout"), }, TLS: TLSConfig{ CertificatePath: v.GetString("tls.certificate-path"), diff --git a/server/config/toml.go b/server/config/toml.go index 24233dcb..cd4258f0 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -13,6 +13,9 @@ const DefaultConfigTemplate = ` # Valid types are: json|struct|access_list|markdown tracer = "{{ .EVM.Tracer }}" +# MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. +max-tx-gas-wanted = {{ .EVM.MaxTxGasWanted }} + ############################################################################### ### JSON RPC Configuration ### ############################################################################### @@ -53,6 +56,12 @@ logs-cap = {{ .JSONRPC.LogsCap }} # BlockRangeCap defines the max block range allowed for 'eth_getLogs' query. block-range-cap = {{ .JSONRPC.BlockRangeCap }} +# HTTPTimeout is the read/write timeout of http json-rpc server. +http-timeout = "{{ .JSONRPC.HTTPTimeout }}" + +# HTTPIdleTimeout is the idle timeout of http json-rpc server. +http-idle-timeout = "{{ .JSONRPC.HTTPIdleTimeout }}" + ############################################################################### ### TLS Configuration ### ############################################################################### diff --git a/server/flags/flags.go b/server/flags/flags.go new file mode 100644 index 00000000..53b7ced3 --- /dev/null +++ b/server/flags/flags.go @@ -0,0 +1,86 @@ +package flags + +import ( + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +// Tendermint full-node start flags +const ( + WithTendermint = "with-tendermint" + Address = "address" + Transport = "transport" + TraceStore = "trace-store" + CPUProfile = "cpu-profile" +) + +// GRPC-related flags. +const ( + GRPCEnable = "grpc.enable" + GRPCAddress = "grpc.address" + GRPCWebEnable = "grpc-web.enable" + GRPCWebAddress = "grpc-web.address" +) + +// Cosmos API flags +const ( + RPCEnable = "api.enable" + EnabledUnsafeCors = "api.enabled-unsafe-cors" +) + +// JSON-RPC flags +const ( + JSONRPCEnable = "json-rpc.enable" + JSONRPCAPI = "json-rpc.api" + JSONRPCAddress = "json-rpc.address" + JSONWsAddress = "json-rpc.ws-address" + JSONRPCGasCap = "json-rpc.gas-cap" + JSONRPCEVMTimeout = "json-rpc.evm-timeout" + JSONRPCTxFeeCap = "json-rpc.txfee-cap" + JSONRPCFilterCap = "json-rpc.filter-cap" + JSONRPCLogsCap = "json-rpc.logs-cap" + JSONRPCBlockRangeCap = "json-rpc.block-range-cap" + JSONRPCHTTPTimeout = "json-rpc.http-timeout" + JSONRPCHTTPIdleTimeout = "json-rpc.http-idle-timeout" +) + +// EVM flags +const ( + EVMTracer = "evm.tracer" + EVMMaxTxGasWanted = "evm.max-tx-gas-wanted" +) + +// TLS flags +const ( + TLSCertPath = "tls.certificate-path" + TLSKeyPath = "tls.key-path" +) + +// AddTxFlags adds common flags for commands to post tx +func AddTxFlags(cmd *cobra.Command) (*cobra.Command, error) { + cmd.PersistentFlags().String(flags.FlagChainID, "testnet", "Specify Chain ID for sending Tx") + cmd.PersistentFlags().String(flags.FlagFrom, "", "Name or address of private key with which to sign") + cmd.PersistentFlags().String(flags.FlagFees, "", "Fees to pay along with transaction; eg: 10aphoton") + cmd.PersistentFlags().String(flags.FlagGasPrices, "", "Gas prices to determine the transaction fee (e.g. 10aphoton)") + cmd.PersistentFlags().String(flags.FlagNode, "tcp://localhost:26657", ": to tendermint rpc interface for this chain") + cmd.PersistentFlags().Float64(flags.FlagGasAdjustment, flags.DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ") + cmd.PersistentFlags().StringP(flags.FlagBroadcastMode, "b", flags.BroadcastSync, "Transaction broadcasting mode (sync|async|block)") + cmd.PersistentFlags().String(flags.FlagKeyringBackend, keyring.BackendOS, "Select keyring's backend") + + // --gas can accept integers and "simulate" + // cmd.PersistentFlags().Var(&flags.GasFlagVar, "gas", fmt.Sprintf( + // "gas limit to set per-transaction; set to %q to calculate required gas automatically (default %d)", + // flags.GasFlagAuto, flags.DefaultGasLimit, + // )) + + // viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode)) + if err := viper.BindPFlag(flags.FlagNode, cmd.PersistentFlags().Lookup(flags.FlagNode)); err != nil { + return nil, err + } + if err := viper.BindPFlag(flags.FlagKeyringBackend, cmd.PersistentFlags().Lookup(flags.FlagKeyringBackend)); err != nil { + return nil, err + } + return cmd, nil +} diff --git a/server/json_rpc.go b/server/json_rpc.go new file mode 100644 index 00000000..6c420300 --- /dev/null +++ b/server/json_rpc.go @@ -0,0 +1,98 @@ +package server + +import ( + "net/http" + "time" + + "github.com/gorilla/mux" + "github.com/rs/cors" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/types" + ethlog "github.com/ethereum/go-ethereum/log" + ethrpc "github.com/ethereum/go-ethereum/rpc" + + "github.com/stratosnet/stratos-chain/rpc" + "github.com/stratosnet/stratos-chain/server/config" +) + +// StartJSONRPC starts the JSON-RPC server +func StartJSONRPC(ctx *server.Context, clientCtx client.Context, tmRPCAddr, tmEndpoint string, config config.Config) (*http.Server, chan struct{}, error) { + tmWsClient := ConnectTmWS(tmRPCAddr, tmEndpoint, ctx.Logger) + + logger := ctx.Logger.With("module", "geth") + ethlog.Root().SetHandler(ethlog.FuncHandler(func(r *ethlog.Record) error { + switch r.Lvl { + case ethlog.LvlTrace, ethlog.LvlDebug: + logger.Debug(r.Msg, r.Ctx...) + case ethlog.LvlInfo, ethlog.LvlWarn: + logger.Info(r.Msg, r.Ctx...) + case ethlog.LvlError, ethlog.LvlCrit: + logger.Error(r.Msg, r.Ctx...) + } + return nil + })) + + rpcServer := ethrpc.NewServer() + + rpcAPIArr := config.JSONRPC.API + apis := rpc.GetRPCAPIs(ctx, clientCtx, tmWsClient, rpcAPIArr) + + for _, api := range apis { + if err := rpcServer.RegisterName(api.Namespace, api.Service); err != nil { + ctx.Logger.Error( + "failed to register service in JSON RPC namespace", + "namespace", api.Namespace, + "service", api.Service, + ) + return nil, nil, err + } + } + + r := mux.NewRouter() + r.HandleFunc("/", rpcServer.ServeHTTP).Methods("POST") + + handlerWithCors := cors.Default() + if config.API.EnableUnsafeCORS { + handlerWithCors = cors.AllowAll() + } + + httpSrv := &http.Server{ + Addr: config.JSONRPC.Address, + Handler: handlerWithCors.Handler(r), + ReadTimeout: config.JSONRPC.HTTPTimeout, + WriteTimeout: config.JSONRPC.HTTPTimeout, + IdleTimeout: config.JSONRPC.HTTPIdleTimeout, + } + httpSrvDone := make(chan struct{}, 1) + + errCh := make(chan error) + go func() { + ctx.Logger.Info("Starting JSON-RPC server", "address", config.JSONRPC.Address) + if err := httpSrv.ListenAndServe(); err != nil { + if err == http.ErrServerClosed { + close(httpSrvDone) + return + } + + ctx.Logger.Error("failed to start JSON-RPC server", "error", err.Error()) + errCh <- err + } + }() + + select { + case err := <-errCh: + ctx.Logger.Error("failed to boot JSON-RPC server", "error", err.Error()) + return nil, nil, err + case <-time.After(types.ServerStartTime): // assume JSON RPC server started successfully + } + + ctx.Logger.Info("Starting JSON WebSocket server", "address", config.JSONRPC.WsAddress) + + // allocate separate WS connection to Tendermint + tmWsClient = ConnectTmWS(tmRPCAddr, tmEndpoint, ctx.Logger) + wsSrv := rpc.NewWebsocketsServer(clientCtx, ctx.Logger, tmWsClient, config) + wsSrv.Start() + return httpSrv, httpSrvDone, nil +} diff --git a/server/start.go b/server/start.go new file mode 100644 index 00000000..e52046ad --- /dev/null +++ b/server/start.go @@ -0,0 +1,495 @@ +package server + +import ( + "context" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "runtime/pprof" + "strings" + "time" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + + "github.com/spf13/cobra" + + "google.golang.org/grpc" + + abciserver "github.com/tendermint/tendermint/abci/server" + tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" + tmos "github.com/tendermint/tendermint/libs/os" + "github.com/tendermint/tendermint/node" + "github.com/tendermint/tendermint/p2p" + pvm "github.com/tendermint/tendermint/privval" + "github.com/tendermint/tendermint/proxy" + "github.com/tendermint/tendermint/rpc/client/local" + dbm "github.com/tendermint/tm-db" + + "github.com/cosmos/cosmos-sdk/server/rosetta" + crgserver "github.com/cosmos/cosmos-sdk/server/rosetta/lib/server" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/api" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + servergrpc "github.com/cosmos/cosmos-sdk/server/grpc" + "github.com/cosmos/cosmos-sdk/server/types" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + ethdebug "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/debug" + "github.com/stratosnet/stratos-chain/server/config" + srvflags "github.com/stratosnet/stratos-chain/server/flags" +) + +// StartCmd runs the service passed in, either stand-alone or in-process with +// Tendermint. +func StartCmd(appCreator types.AppCreator, defaultNodeHome string) *cobra.Command { + cmd := &cobra.Command{ + Use: "start", + Short: "Run the full node", + Long: `Run the full node application with Tendermint in or out of process. By +default, the application will run with Tendermint in process. + +Pruning options can be provided via the '--pruning' flag or alternatively with '--pruning-keep-recent', +'pruning-keep-every', and 'pruning-interval' together. + +For '--pruning' the options are as follows: + +default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals +nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals +custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' + +Node halting configurations exist in the form of two flags: '--halt-height' and '--halt-time'. During +the ABCI Commit phase, the node will check if the current block height is greater than or equal to +the halt-height or if the current block time is greater than or equal to the halt-time. If so, the +node will attempt to gracefully shutdown and the block will not be committed. In addition, the node +will not be able to commit subsequent blocks. + +For profiling and benchmarking purposes, CPU profiling can be enabled via the '--cpu-profile' flag +which accepts a path for the resulting pprof file. +`, + PreRunE: func(cmd *cobra.Command, _ []string) error { + serverCtx := server.GetServerContextFromCmd(cmd) + + // Bind flags to the Context's Viper so the app construction can set + // options accordingly. + err := serverCtx.Viper.BindPFlags(cmd.Flags()) + if err != nil { + return err + } + + _, err = server.GetPruningOptionsFromFlags(serverCtx.Viper) + return err + }, + RunE: func(cmd *cobra.Command, _ []string) error { + serverCtx := server.GetServerContextFromCmd(cmd) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + withTM, _ := cmd.Flags().GetBool(srvflags.WithTendermint) + if !withTM { + serverCtx.Logger.Info("starting ABCI without Tendermint") + return startStandAlone(serverCtx, appCreator) + } + + serverCtx.Logger.Info("Unlocking keyring") + + // fire unlock precess for keyring + keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend) + if keyringBackend == keyring.BackendFile { + _, err = clientCtx.Keyring.List() + if err != nil { + return err + } + } + + serverCtx.Logger.Info("starting ABCI with Tendermint") + + // amino is needed here for backwards compatibility of REST routes + err = startInProcess(serverCtx, clientCtx, appCreator) + errCode, ok := err.(server.ErrorCode) + if !ok { + return err + } + + serverCtx.Logger.Debug(fmt.Sprintf("received quit signal: %d", errCode.Code)) + return nil + }, + } + + cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.Flags().Bool(srvflags.WithTendermint, true, "Run abci app embedded in-process with tendermint") + cmd.Flags().String(srvflags.Address, "tcp://0.0.0.0:26658", "Listen address") + cmd.Flags().String(srvflags.Transport, "socket", "Transport protocol: socket, grpc") + cmd.Flags().String(srvflags.TraceStore, "", "Enable KVStore tracing to an output file") + cmd.Flags().String(server.FlagMinGasPrices, "", "Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 0.01photon;0.0001stake)") + cmd.Flags().IntSlice(server.FlagUnsafeSkipUpgrades, []int{}, "Skip a set of upgrade heights to continue the old binary") + cmd.Flags().Uint64(server.FlagHaltHeight, 0, "Block height at which to gracefully halt the chain and shutdown the node") + cmd.Flags().Uint64(server.FlagHaltTime, 0, "Minimum block time (in Unix seconds) at which to gracefully halt the chain and shutdown the node") + cmd.Flags().Bool(server.FlagInterBlockCache, true, "Enable inter-block caching") + cmd.Flags().String(srvflags.CPUProfile, "", "Enable CPU profiling and write to the provided file") + cmd.Flags().Bool(server.FlagTrace, false, "Provide full stack traces for errors in ABCI Log") + cmd.Flags().String(server.FlagPruning, storetypes.PruningOptionDefault, "Pruning strategy (default|nothing|everything|custom)") + cmd.Flags().Uint64(server.FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") + cmd.Flags().Uint64(server.FlagPruningKeepEvery, 0, "Offset heights to keep on disk after 'keep-every' (ignored if pruning is not 'custom')") + cmd.Flags().Uint64(server.FlagPruningInterval, 0, "Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom')") + cmd.Flags().Uint(server.FlagInvCheckPeriod, 0, "Assert registered invariants every N blocks") + cmd.Flags().Uint64(server.FlagMinRetainBlocks, 0, "Minimum block height offset during ABCI commit to prune Tendermint blocks") + + cmd.Flags().Bool(srvflags.GRPCEnable, true, "Define if the gRPC server should be enabled") + cmd.Flags().String(srvflags.GRPCAddress, serverconfig.DefaultGRPCAddress, "the gRPC server address to listen on") + cmd.Flags().Bool(srvflags.GRPCWebEnable, true, "Define if the gRPC-Web server should be enabled. (Note: gRPC must also be enabled.)") + cmd.Flags().String(srvflags.GRPCWebAddress, serverconfig.DefaultGRPCWebAddress, "The gRPC-Web server address to listen on") + + cmd.Flags().Bool(srvflags.RPCEnable, false, "Defines if Cosmos-sdk REST server should be enabled") + cmd.Flags().Bool(srvflags.EnabledUnsafeCors, false, "Defines if CORS should be enabled (unsafe - use it at your own risk)") + + cmd.Flags().Bool(srvflags.JSONRPCEnable, true, "Define if the gRPC server should be enabled") + cmd.Flags().StringSlice(srvflags.JSONRPCAPI, config.GetDefaultAPINamespaces(), "Defines a list of JSON-RPC namespaces that should be enabled") + cmd.Flags().String(srvflags.JSONRPCAddress, config.DefaultJSONRPCAddress, "the JSON-RPC server address to listen on") + cmd.Flags().String(srvflags.JSONWsAddress, config.DefaultJSONRPCWsAddress, "the JSON-RPC WS server address to listen on") + cmd.Flags().Uint64(srvflags.JSONRPCGasCap, config.DefaultGasCap, "Sets a cap on gas that can be used in eth_call/estimateGas unit is aphoton (0=infinite)") + cmd.Flags().Float64(srvflags.JSONRPCTxFeeCap, config.DefaultTxFeeCap, "Sets a cap on transaction fee that can be sent via the RPC APIs (1 = default 1 photon)") + cmd.Flags().Int32(srvflags.JSONRPCFilterCap, config.DefaultFilterCap, "Sets the global cap for total number of filters that can be created") + cmd.Flags().Duration(srvflags.JSONRPCEVMTimeout, config.DefaultEVMTimeout, "Sets a timeout used for eth_call (0=infinite)") + cmd.Flags().Duration(srvflags.JSONRPCHTTPTimeout, config.DefaultHTTPTimeout, "Sets a read/write timeout for json-rpc http server (0=infinite)") + cmd.Flags().Duration(srvflags.JSONRPCHTTPIdleTimeout, config.DefaultHTTPIdleTimeout, "Sets a idle timeout for json-rpc http server (0=infinite)") + cmd.Flags().Int32(srvflags.JSONRPCLogsCap, config.DefaultLogsCap, "Sets the max number of results can be returned from single `eth_getLogs` query") + cmd.Flags().Int32(srvflags.JSONRPCBlockRangeCap, config.DefaultBlockRangeCap, "Sets the max block range allowed for `eth_getLogs` query") + + cmd.Flags().String(srvflags.EVMTracer, config.DefaultEVMTracer, "the EVM tracer type to collect execution traces from the EVM transaction execution (json|struct|access_list|markdown)") + cmd.Flags().Uint64(srvflags.EVMMaxTxGasWanted, config.DefaultMaxTxGasWanted, "the gas wanted for each eth tx returned in ante handler in check tx mode") + + cmd.Flags().String(srvflags.TLSCertPath, "", "the cert.pem file path for the server TLS configuration") + cmd.Flags().String(srvflags.TLSKeyPath, "", "the key.pem file path for the server TLS configuration") + + cmd.Flags().Uint64(server.FlagStateSyncSnapshotInterval, 0, "State sync snapshot interval") + cmd.Flags().Uint32(server.FlagStateSyncSnapshotKeepRecent, 2, "State sync snapshot to keep") + + // add support for all Tendermint-specific command line options + tcmd.AddNodeFlags(cmd) + return cmd +} + +func startStandAlone(ctx *server.Context, appCreator types.AppCreator) error { + addr := ctx.Viper.GetString(srvflags.Address) + transport := ctx.Viper.GetString(srvflags.Transport) + home := ctx.Viper.GetString(flags.FlagHome) + + db, err := openDB(home) + if err != nil { + return err + } + defer func() { + if err := db.Close(); err != nil { + ctx.Logger.With("error", err).Error("error closing db") + } + }() + + traceWriterFile := ctx.Viper.GetString(srvflags.TraceStore) + traceWriter, err := openTraceWriter(traceWriterFile) + if err != nil { + return err + } + + app := appCreator(ctx.Logger, db, traceWriter, ctx.Viper) + + svr, err := abciserver.NewServer(addr, transport, app) + if err != nil { + return fmt.Errorf("error creating listener: %v", err) + } + + svr.SetLogger(ctx.Logger.With("server", "abci")) + + err = svr.Start() + if err != nil { + tmos.Exit(err.Error()) + } + + defer func() { + if err = svr.Stop(); err != nil { + tmos.Exit(err.Error()) + } + }() + + // Wait for SIGINT or SIGTERM signal + return server.WaitForQuitSignals() +} + +// legacyAminoCdc is used for the legacy REST API +func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator types.AppCreator) (err error) { + cfg := ctx.Config + home := cfg.RootDir + logger := ctx.Logger + var cpuProfileCleanup func() error + + if cpuProfile := ctx.Viper.GetString(srvflags.CPUProfile); cpuProfile != "" { + fp, err := ethdebug.ExpandHome(cpuProfile) + if err != nil { + ctx.Logger.Debug("failed to get filepath for the CPU profile file", "error", err.Error()) + return err + } + f, err := os.Create(fp) + if err != nil { + return err + } + + ctx.Logger.Info("starting CPU profiler", "profile", cpuProfile) + if err := pprof.StartCPUProfile(f); err != nil { + return err + } + + cpuProfileCleanup = func() error { + ctx.Logger.Info("stopping CPU profiler", "profile", cpuProfile) + pprof.StopCPUProfile() + if err := f.Close(); err != nil { + logger.Error("failed to close CPU profiler file", "error", err.Error()) + return err + } + return nil + } + } + + traceWriterFile := ctx.Viper.GetString(srvflags.TraceStore) + db, err := openDB(home) + if err != nil { + logger.Error("failed to open DB", "error", err.Error()) + return err + } + defer func() { + if err := db.Close(); err != nil { + ctx.Logger.With("error", err).Error("error closing db") + } + }() + + traceWriter, err := openTraceWriter(traceWriterFile) + if err != nil { + logger.Error("failed to open trace writer", "error", err.Error()) + return err + } + + config := config.GetConfig(ctx.Viper) + + if err := config.ValidateBasic(); err != nil { + if strings.Contains(err.Error(), "set min gas price in app.toml or flag or env variable") { + ctx.Logger.Error( + "WARNING: The minimum-gas-prices config in app.toml is set to the empty string. " + + "This defaults to 0 in the current version, but will error in the next version " + + "(SDK v0.44). Please explicitly put the desired minimum-gas-prices in your app.toml.", + ) + } else { + return err + } + } + + app := appCreator(ctx.Logger, db, traceWriter, ctx.Viper) + + nodeKey, err := p2p.LoadOrGenNodeKey(cfg.NodeKeyFile()) + if err != nil { + logger.Error("failed load or gen node key", "error", err.Error()) + return err + } + + genDocProvider := node.DefaultGenesisDocProviderFunc(cfg) + tmNode, err := node.NewNode( + cfg, + pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile()), + nodeKey, + proxy.NewLocalClientCreator(app), + genDocProvider, + node.DefaultDBProvider, + node.DefaultMetricsProvider(cfg.Instrumentation), + ctx.Logger.With("server", "node"), + ) + if err != nil { + logger.Error("failed init node", "error", err.Error()) + return err + } + + if err := tmNode.Start(); err != nil { + logger.Error("failed start tendermint server", "error", err.Error()) + return err + } + + // Add the tx service to the gRPC router. We only need to register this + // service if API or gRPC or JSONRPC is enabled, and avoid doing so in the general + // case, because it spawns a new local tendermint RPC client. + if config.API.Enable || config.GRPC.Enable || config.JSONRPC.Enable { + clientCtx = clientCtx.WithClient(local.New(tmNode)) + + app.RegisterTxService(clientCtx) + app.RegisterTendermintService(clientCtx) + } + + var apiSrv *api.Server + if config.API.Enable { + genDoc, err := genDocProvider() + if err != nil { + return err + } + + clientCtx := clientCtx. + WithHomeDir(home). + WithChainID(genDoc.ChainID) + + apiSrv = api.New(clientCtx, ctx.Logger.With("server", "api")) + app.RegisterAPIRoutes(apiSrv, config.API) + errCh := make(chan error) + + go func() { + if err := apiSrv.Start(config.Config); err != nil { + errCh <- err + } + }() + + select { + case err := <-errCh: + return err + case <-time.After(types.ServerStartTime): // assume server started successfully + } + } + + var ( + grpcSrv *grpc.Server + grpcWebSrv *http.Server + ) + if config.GRPC.Enable { + grpcSrv, err = servergrpc.StartGRPCServer(clientCtx, app, config.GRPC.Address) + if err != nil { + return err + } + if config.GRPCWeb.Enable { + grpcWebSrv, err = servergrpc.StartGRPCWeb(grpcSrv, config.Config) + if err != nil { + ctx.Logger.Error("failed to start grpc-web http server", "error", err) + return err + } + } + } + + var rosettaSrv crgserver.Server + if config.Rosetta.Enable { + offlineMode := config.Rosetta.Offline + if !config.GRPC.Enable { // If GRPC is not enabled rosetta cannot work in online mode, so it works in offline mode. + offlineMode = true + } + + conf := &rosetta.Config{ + Blockchain: config.Rosetta.Blockchain, + Network: config.Rosetta.Network, + TendermintRPC: ctx.Config.RPC.ListenAddress, + GRPCEndpoint: config.GRPC.Address, + Addr: config.Rosetta.Address, + Retries: config.Rosetta.Retries, + Offline: offlineMode, + } + conf.WithCodec(clientCtx.InterfaceRegistry, clientCtx.Codec.(*codec.ProtoCodec)) + + rosettaSrv, err = rosetta.ServerFromConfig(conf) + if err != nil { + return err + } + errCh := make(chan error) + go func() { + if err := rosettaSrv.Start(); err != nil { + errCh <- err + } + }() + + select { + case err := <-errCh: + return err + case <-time.After(types.ServerStartTime): // assume server started successfully + } + } + + var ( + httpSrv *http.Server + httpSrvDone chan struct{} + ) + + if config.JSONRPC.Enable { + genDoc, err := genDocProvider() + if err != nil { + return err + } + + clientCtx := clientCtx.WithChainID(genDoc.ChainID) + + tmEndpoint := "/websocket" + tmRPCAddr := cfg.RPC.ListenAddress + httpSrv, httpSrvDone, err = StartJSONRPC(ctx, clientCtx, tmRPCAddr, tmEndpoint, config) + if err != nil { + return err + } + } + + defer func() { + if tmNode.IsRunning() { + _ = tmNode.Stop() + } + + if cpuProfileCleanup != nil { + _ = cpuProfileCleanup() + } + + if apiSrv != nil { + _ = apiSrv.Close() + } + + if grpcSrv != nil { + grpcSrv.Stop() + if grpcWebSrv != nil { + if err := grpcWebSrv.Close(); err != nil { + logger.Error("failed to close the grpcWebSrc", "error", err.Error()) + } + } + } + + if httpSrv != nil { + shutdownCtx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second) + defer cancelFn() + + if err := httpSrv.Shutdown(shutdownCtx); err != nil { + logger.Error("HTTP server shutdown produced a warning", "error", err.Error()) + } else { + logger.Info("HTTP server shut down, waiting 5 sec") + select { + case <-time.Tick(5 * time.Second): + case <-httpSrvDone: + } + } + } + + logger.Info("Bye!") + }() + + // Wait for SIGINT or SIGTERM signal + return server.WaitForQuitSignals() +} + +func openDB(rootDir string) (dbm.DB, error) { + dataDir := filepath.Join(rootDir, "data") + return sdk.NewLevelDB("application", dataDir) +} + +func openTraceWriter(traceWriterFile string) (w io.Writer, err error) { + if traceWriterFile == "" { + return + } + + filePath := filepath.Clean(traceWriterFile) + return os.OpenFile( + filePath, + os.O_WRONLY|os.O_APPEND|os.O_CREATE, + 0o600, + ) +} diff --git a/server/util.go b/server/util.go new file mode 100644 index 00000000..b4f9d607 --- /dev/null +++ b/server/util.go @@ -0,0 +1,98 @@ +package server + +import ( + "net/http" + "time" + + "github.com/gorilla/mux" + "github.com/improbable-eng/grpc-web/go/grpcweb" + "github.com/spf13/cobra" + + sdkserver "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/version" + + tmcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" + tmlog "github.com/tendermint/tendermint/libs/log" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" +) + +// add server commands +func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator types.AppCreator, appExport types.AppExporter, addStartFlags types.ModuleInitFlags) { + tendermintCmd := &cobra.Command{ + Use: "tendermint", + Short: "Tendermint subcommands", + } + + tendermintCmd.AddCommand( + sdkserver.ShowNodeIDCmd(), + sdkserver.ShowValidatorCmd(), + sdkserver.ShowAddressCmd(), + sdkserver.VersionCmd(), + tmcmd.ResetAllCmd, + tmcmd.ResetStateCmd, + ) + + startCmd := StartCmd(appCreator, defaultNodeHome) + addStartFlags(startCmd) + + rootCmd.AddCommand( + startCmd, + tendermintCmd, + sdkserver.ExportCmd(appExport, defaultNodeHome), + version.NewVersionCommand(), + ) +} + +func ConnectTmWS(tmRPCAddr, tmEndpoint string, logger tmlog.Logger) *rpcclient.WSClient { + tmWsClient, err := rpcclient.NewWS(tmRPCAddr, tmEndpoint, + rpcclient.MaxReconnectAttempts(256), + rpcclient.ReadWait(120*time.Second), + rpcclient.WriteWait(120*time.Second), + rpcclient.PingPeriod(50*time.Second), + rpcclient.OnReconnect(func() { + logger.Debug("EVM RPC reconnects to Tendermint WS", "address", tmRPCAddr+tmEndpoint) + }), + ) + + if err != nil { + logger.Error( + "Tendermint WS client could not be created", + "address", tmRPCAddr+tmEndpoint, + "error", err, + ) + } else if err := tmWsClient.OnStart(); err != nil { + logger.Error( + "Tendermint WS client could not start", + "address", tmRPCAddr+tmEndpoint, + "error", err, + ) + } + + return tmWsClient +} + +func MountGRPCWebServices( + router *mux.Router, + grpcWeb *grpcweb.WrappedGrpcServer, + grpcResources []string, + logger tmlog.Logger, +) { + for _, res := range grpcResources { + + logger.Info("[GRPC Web] HTTP POST mounted", "resource", res) + + s := router.Methods("POST").Subrouter() + s.HandleFunc(res, func(resp http.ResponseWriter, req *http.Request) { + if grpcWeb.IsGrpcWebSocketRequest(req) { + grpcWeb.HandleGrpcWebsocketRequest(resp, req) + return + } + + if grpcWeb.IsGrpcWebRequest(req) { + grpcWeb.HandleGrpcWebRequest(resp, req) + return + } + }) + } +} diff --git a/types/account.pb.go b/types/account.pb.go new file mode 100644 index 00000000..d95de534 --- /dev/null +++ b/types/account.pb.go @@ -0,0 +1,374 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/types/v1/account.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/regen-network/cosmos-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 + +// EthAccount implements the authtypes.AccountI interface and embeds an +// authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. +type EthAccount struct { + *types.BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty" yaml:"base_account"` + CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty" yaml:"code_hash"` +} + +func (m *EthAccount) Reset() { *m = EthAccount{} } +func (*EthAccount) ProtoMessage() {} +func (*EthAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_a508f4779e8b8a8e, []int{0} +} +func (m *EthAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EthAccount.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 *EthAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_EthAccount.Merge(m, src) +} +func (m *EthAccount) XXX_Size() int { + return m.Size() +} +func (m *EthAccount) XXX_DiscardUnknown() { + xxx_messageInfo_EthAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_EthAccount proto.InternalMessageInfo + +func init() { + proto.RegisterType((*EthAccount)(nil), "stratos.types.v1.EthAccount") +} + +func init() { proto.RegisterFile("stratos/types/v1/account.proto", fileDescriptor_a508f4779e8b8a8e) } + +var fileDescriptor_a508f4779e8b8a8e = []byte{ + // 318 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0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0xdf, + 0xc3, 0x9f, 0x34, 0xa3, 0xbf, 0x9b, 0xed, 0xc0, 0x6b, 0x70, 0x35, 0x13, 0x53, 0xc9, 0xb4, 0xec, + 0xfe, 0xeb, 0xc3, 0x41, 0x23, 0xec, 0x6c, 0x0b, 0xdc, 0xb2, 0xc2, 0x5f, 0xca, 0x9f, 0x1c, 0xec, + 0xe6, 0x2b, 0xa6, 0xe5, 0x38, 0x7c, 0xcc, 0x30, 0x78, 0xce, 0x30, 0xf8, 0xca, 0x30, 0x78, 0x7b, + 0x19, 0x8e, 0xe6, 0x0b, 0x23, 0x93, 0x88, 0x70, 0xb5, 0x74, 0x5f, 0x74, 0xc7, 0x50, 0xcf, 0xee, + 0xe8, 0x83, 0x2d, 0xc7, 0x56, 0xe6, 0x52, 0xaf, 0xc3, 0x8b, 0xd7, 0x12, 0xc1, 0xbc, 0x44, 0xf0, + 0xa3, 0x44, 0xf0, 0xa9, 0x42, 0x20, 0xaf, 0x10, 0x78, 0xaf, 0x10, 0xb8, 0x39, 0xdd, 0x73, 0x73, + 0x7d, 0xc7, 0xc2, 0xfc, 0x8c, 0x43, 0x2e, 0xd9, 0x22, 0xb6, 0x6e, 0xd1, 0xff, 0xba, 0xb3, 0xb3, + 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x28, 0x9f, 0xf3, 0x36, 0xb8, 0x01, 0x00, 0x00, +} + +func (m *EthAccount) 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 *EthAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintAccount(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x12 + } + if m.BaseAccount != nil { + { + size, err := m.BaseAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAccount(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintAccount(dAtA []byte, offset int, v uint64) int { + offset -= sovAccount(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EthAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BaseAccount != nil { + l = m.BaseAccount.Size() + n += 1 + l + sovAccount(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovAccount(uint64(l)) + } + return n +} + +func sovAccount(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAccount(x uint64) (n int) { + return sovAccount(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EthAccount) 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 ErrIntOverflowAccount + } + 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: EthAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EthAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccount + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAccount + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAccount + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BaseAccount == nil { + m.BaseAccount = &types.BaseAccount{} + } + if err := m.BaseAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAccount + } + 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 ErrInvalidLengthAccount + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAccount + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAccount(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAccount + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAccount(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, ErrIntOverflowAccount + } + 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, ErrIntOverflowAccount + } + 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, ErrIntOverflowAccount + } + 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, ErrInvalidLengthAccount + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAccount + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAccount + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAccount = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAccount = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAccount = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/codec.go b/types/codec.go index 9288d469..d526b2ec 100644 --- a/types/codec.go +++ b/types/codec.go @@ -1,9 +1,26 @@ package types import ( - "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(SdsAddress{}, "SdsAddress", nil) +type ExtensionOptionsWeb3TxI interface{} + +// RegisterInterfaces registers the tendermint concrete client-related +// implementations and interfaces. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*authtypes.AccountI)(nil), + &EthAccount{}, + ) + registry.RegisterImplementations( + (*authtypes.GenesisAccount)(nil), + &EthAccount{}, + ) + registry.RegisterInterface( + "stratos.v1.ExtensionOptionsWeb3Tx", + (*ExtensionOptionsWeb3TxI)(nil), + &ExtensionOptionsWeb3Tx{}, + ) } diff --git a/types/web3.pb.go b/types/web3.pb.go new file mode 100644 index 00000000..1e2549bd --- /dev/null +++ b/types/web3.pb.go @@ -0,0 +1,397 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/types/v1/web3.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ExtensionOptionsWeb3Tx struct { + // typed data chain id used only in EIP712 Domain and should match + // Ethereum network ID in a Web3 provider (e.g. Metamask). + TypedDataChainID uint64 `protobuf:"varint,1,opt,name=typed_data_chain_id,json=typedDataChainId,proto3" json:"typedDataChainID,omitempty"` + // fee payer is an account address for the fee payer. It will be validated + // during EIP712 signature checking. + FeePayer string `protobuf:"bytes,2,opt,name=fee_payer,json=feePayer,proto3" json:"feePayer,omitempty"` + // fee payer sig is a signature data from the fee paying account, + // allows to perform fee delegation when using EIP712 Domain. + FeePayerSig []byte `protobuf:"bytes,3,opt,name=fee_payer_sig,json=feePayerSig,proto3" json:"feePayerSig,omitempty"` +} + +func (m *ExtensionOptionsWeb3Tx) Reset() { *m = ExtensionOptionsWeb3Tx{} } +func (m *ExtensionOptionsWeb3Tx) String() string { return proto.CompactTextString(m) } +func (*ExtensionOptionsWeb3Tx) ProtoMessage() {} +func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int) { + return fileDescriptor_7234f467a119d7c0, []int{0} +} +func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExtensionOptionsWeb3Tx.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 *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionOptionsWeb3Tx.Merge(m, src) +} +func (m *ExtensionOptionsWeb3Tx) XXX_Size() int { + return m.Size() +} +func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionOptionsWeb3Tx.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionOptionsWeb3Tx proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ExtensionOptionsWeb3Tx)(nil), "stratos.types.v1.ExtensionOptionsWeb3Tx") +} + +func init() { proto.RegisterFile("stratos/types/v1/web3.proto", fileDescriptor_7234f467a119d7c0) } + +var fileDescriptor_7234f467a119d7c0 = []byte{ + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x2e, 0x29, 0x4a, + 0x2c, 0xc9, 0x2f, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0x33, 0xd4, 0x2f, 0x4f, 0x4d, + 0x32, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x4a, 0xea, 0x81, 0x25, 0xf5, 0xca, + 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0xd2, 0x57, + 0x46, 0x2e, 0x31, 0xd7, 0x8a, 0x92, 0xd4, 0xbc, 0xe2, 0xcc, 0xfc, 0x3c, 0xff, 0x82, 0x92, 0xcc, + 0xfc, 0xbc, 0xe2, 0xf0, 0xd4, 0x24, 0xe3, 0x90, 0x0a, 0xa1, 0x44, 0x2e, 0x61, 0x90, 0xe6, 0x94, + 0xf8, 0x94, 0xc4, 0x92, 0xc4, 0xf8, 0xe4, 0x8c, 0xc4, 0xcc, 0xbc, 0xf8, 0xcc, 0x14, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0x16, 0x27, 0xa3, 0x47, 0xf7, 0xe4, 0x05, 0x42, 0x40, 0xd2, 0x2e, 0x89, 0x25, + 0x89, 0xce, 0x20, 0x49, 0x4f, 0x97, 0x57, 0xf7, 0xe4, 0xa5, 0x4a, 0xd0, 0xc4, 0x74, 0xf2, 0x73, + 0x33, 0x4b, 0x52, 0x73, 0x0b, 0x4a, 0x2a, 0x83, 0x04, 0xd0, 0xe4, 0x52, 0x84, 0x8c, 0xb9, 0x38, + 0xd3, 0x52, 0x53, 0xe3, 0x0b, 0x12, 0x2b, 0x53, 0x8b, 0x24, 0x98, 0x14, 0x18, 0x35, 0x38, 0x9d, + 0xc4, 0x5e, 0xdd, 0x93, 0x17, 0x4a, 0x4b, 0x4d, 0x0d, 0x00, 0x89, 0x21, 0x69, 0xe6, 0x80, 0x89, + 0x09, 0xd9, 0x72, 0xf1, 0xc2, 0x35, 0xc5, 0x17, 0x67, 0xa6, 0x4b, 0x30, 0x2b, 0x30, 0x6a, 0xf0, + 0x38, 0x49, 0xbe, 0xba, 0x27, 0x2f, 0x0a, 0x53, 0x14, 0x9c, 0x99, 0x8e, 0xa4, 0x97, 0x1b, 0x49, + 0xd8, 0x8a, 0xa5, 0x63, 0x81, 0x3c, 0x83, 0x93, 0xf3, 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, 0x69, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, + 0x03, 0x31, 0x2f, 0xb5, 0x04, 0xc6, 0xd4, 0x05, 0x87, 0x03, 0x24, 0xc8, 0x93, 0xd8, 0xc0, 0x61, + 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x61, 0x11, 0xa6, 0x74, 0x8a, 0x01, 0x00, 0x00, +} + +func (m *ExtensionOptionsWeb3Tx) 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 *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeePayerSig) > 0 { + i -= len(m.FeePayerSig) + copy(dAtA[i:], m.FeePayerSig) + i = encodeVarintWeb3(dAtA, i, uint64(len(m.FeePayerSig))) + i-- + dAtA[i] = 0x1a + } + if len(m.FeePayer) > 0 { + i -= len(m.FeePayer) + copy(dAtA[i:], m.FeePayer) + i = encodeVarintWeb3(dAtA, i, uint64(len(m.FeePayer))) + i-- + dAtA[i] = 0x12 + } + if m.TypedDataChainID != 0 { + i = encodeVarintWeb3(dAtA, i, uint64(m.TypedDataChainID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintWeb3(dAtA []byte, offset int, v uint64) int { + offset -= sovWeb3(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ExtensionOptionsWeb3Tx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TypedDataChainID != 0 { + n += 1 + sovWeb3(uint64(m.TypedDataChainID)) + } + l = len(m.FeePayer) + if l > 0 { + n += 1 + l + sovWeb3(uint64(l)) + } + l = len(m.FeePayerSig) + if l > 0 { + n += 1 + l + sovWeb3(uint64(l)) + } + return n +} + +func sovWeb3(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozWeb3(x uint64) (n int) { + return sovWeb3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ExtensionOptionsWeb3Tx) 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 ErrIntOverflowWeb3 + } + 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: ExtensionOptionsWeb3Tx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExtensionOptionsWeb3Tx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TypedDataChainID", wireType) + } + m.TypedDataChainID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWeb3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TypedDataChainID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeePayer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWeb3 + } + 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 ErrInvalidLengthWeb3 + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWeb3 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeePayer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeePayerSig", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWeb3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWeb3 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWeb3 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeePayerSig = append(m.FeePayerSig[:0], dAtA[iNdEx:postIndex]...) + if m.FeePayerSig == nil { + m.FeePayerSig = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWeb3(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWeb3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWeb3(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, ErrIntOverflowWeb3 + } + 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, ErrIntOverflowWeb3 + } + 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, ErrIntOverflowWeb3 + } + 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, ErrInvalidLengthWeb3 + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWeb3 + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthWeb3 + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthWeb3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWeb3 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWeb3 = fmt.Errorf("proto: unexpected end of group") +) From 493d1fb62cb1894123f805991f8debc8071c29ae Mon Sep 17 00:00:00 2001 From: Xiong Date: Tue, 26 Apr 2022 17:47:03 -0400 Subject: [PATCH 006/113] bug fix --- app/app.go | 2 ++ cmd/stchaind/genaccounts.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index a5fa070f..2bfe1d2d 100644 --- a/app/app.go +++ b/app/app.go @@ -125,6 +125,8 @@ var ( crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, + authzmodule.AppModuleBasic{}, + feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, diff --git a/cmd/stchaind/genaccounts.go b/cmd/stchaind/genaccounts.go index a3a107ff..eb06d087 100644 --- a/cmd/stchaind/genaccounts.go +++ b/cmd/stchaind/genaccounts.go @@ -200,8 +200,8 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") - cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") - cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") + cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") + cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") flags.AddQueryFlagsToCmd(cmd) return cmd From e1e3b1f07127296372566bf528c983a7b3f2ff0b Mon Sep 17 00:00:00 2001 From: Xiong Date: Wed, 27 Apr 2022 20:10:34 -0400 Subject: [PATCH 007/113] fix chain start issue --- app/ante/ante.go | 103 +++++++ app/ante/eip712.go | 273 ++++++++++++++++++ app/ante/eth.go | 534 ++++++++++++++++++++++++++++++++++++ app/ante/handler_options.go | 105 +++++++ app/ante/interfaces.go | 33 +++ app/ante/reject_msgs.go | 25 ++ app/app.go | 62 +++-- client/config.go | 69 +++++ cmd/stchaind/root.go | 4 +- helpers/antehelper.go | 68 ----- types/gasmeter.go | 91 ++++++ x/sds/types/types.go | 1 - 12 files changed, 1278 insertions(+), 90 deletions(-) create mode 100644 app/ante/ante.go create mode 100644 app/ante/eip712.go create mode 100644 app/ante/eth.go create mode 100644 app/ante/handler_options.go create mode 100644 app/ante/interfaces.go create mode 100644 app/ante/reject_msgs.go create mode 100644 client/config.go delete mode 100644 helpers/antehelper.go create mode 100644 types/gasmeter.go delete mode 100644 x/sds/types/types.go diff --git a/app/ante/ante.go b/app/ante/ante.go new file mode 100644 index 00000000..72b37b53 --- /dev/null +++ b/app/ante/ante.go @@ -0,0 +1,103 @@ +package ante + +import ( + "fmt" + "runtime/debug" + + tmlog "github.com/tendermint/tendermint/libs/log" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" +) + +const ( + secp256k1VerifyCost uint64 = 21000 +) + +// NewAnteHandler returns an ante handler responsible for attempting to route an +// Ethereum or SDK transaction to an internal ante handler for performing +// transaction-level processing (e.g. fee payment, signature verification) before +// being passed onto it's respective handler. +func NewAnteHandler(options HandlerOptions) sdk.AnteHandler { + return func( + ctx sdk.Context, tx sdk.Tx, sim bool, + ) (newCtx sdk.Context, err error) { + var anteHandler sdk.AnteHandler + + defer Recover(ctx.Logger(), &err) + + txWithExtensions, ok := tx.(authante.HasExtensionOptionsTx) + if ok { + opts := txWithExtensions.GetExtensionOptions() + if len(opts) > 0 { + switch typeURL := opts[0].GetTypeUrl(); typeURL { + case "/stratos.evm.v1.ExtensionOptionsEthereumTx": + // handle as *evmtypes.MsgEthereumTx + anteHandler = newEthAnteHandler(options) + case "/stratos.types.v1.ExtensionOptionsWeb3Tx": + // handle as normal Cosmos SDK tx, except signature is checked for EIP712 representation + anteHandler = newCosmosAnteHandlerEip712(options) + default: + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrUnknownExtensionOptions, + "rejecting tx with unsupported extension option: %s", typeURL, + ) + } + + return anteHandler(ctx, tx, sim) + } + } + + // handle as totally normal Cosmos SDK tx + switch tx.(type) { + case sdk.Tx: + anteHandler = newCosmosAnteHandler(options) + default: + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid transaction type: %T", tx) + } + + return anteHandler(ctx, tx, sim) + } +} + +func Recover(logger tmlog.Logger, err *error) { + if r := recover(); r != nil { + *err = sdkerrors.Wrapf(sdkerrors.ErrPanic, "%v", r) + + if e, ok := r.(error); ok { + logger.Error( + "ante handler panicked", + "error", e, + "stack trace", string(debug.Stack()), + ) + } else { + logger.Error( + "ante handler panicked", + "recover", fmt.Sprintf("%v", r), + ) + } + } +} + +var _ authante.SignatureVerificationGasConsumer = DefaultSigVerificationGasConsumer + +// DefaultSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas +// for signature verification based upon the public key type. The cost is fetched from the given params and is matched +// by the concrete type. +func DefaultSigVerificationGasConsumer( + meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params, +) error { + // support for ethereum ECDSA secp256k1 keys + _, ok := sig.PubKey.(*ethsecp256k1.PubKey) + if ok { + meter.ConsumeGas(secp256k1VerifyCost, "ante verify: eth_secp256k1") + return nil + } + + return authante.DefaultSigVerificationGasConsumer(meter, sig, params) +} diff --git a/app/ante/eip712.go b/app/ante/eip712.go new file mode 100644 index 00000000..86dc4c0b --- /dev/null +++ b/app/ante/eip712.go @@ -0,0 +1,273 @@ +package ante + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + + ethcrypto "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/secp256k1" + + "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" + "github.com/stratosnet/stratos-chain/ethereum/eip712" + stratos "github.com/stratosnet/stratos-chain/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +var stratosCodec codec.ProtoCodecMarshaler + +func init() { + registry := codectypes.NewInterfaceRegistry() + stratos.RegisterInterfaces(registry) + stratosCodec = codec.NewProtoCodec(registry) +} + +// Eip712SigVerificationDecorator Verify all signatures for a tx and return an error if any are invalid. Note, +// the Eip712SigVerificationDecorator decorator will not get executed on ReCheck. +// +// CONTRACT: Pubkeys are set in context for all signers before this decorator runs +// CONTRACT: Tx must implement SigVerifiableTx interface +type Eip712SigVerificationDecorator struct { + ak evmtypes.AccountKeeper + signModeHandler authsigning.SignModeHandler +} + +// NewEip712SigVerificationDecorator creates a new Eip712SigVerificationDecorator +func NewEip712SigVerificationDecorator(ak evmtypes.AccountKeeper, signModeHandler authsigning.SignModeHandler) Eip712SigVerificationDecorator { + return Eip712SigVerificationDecorator{ + ak: ak, + signModeHandler: signModeHandler, + } +} + +// AnteHandle handles validation of EIP712 signed cosmos txs. +// it is not run on RecheckTx +func (svd Eip712SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + // no need to verify signatures on recheck tx + if ctx.IsReCheckTx() { + return next(ctx, tx, simulate) + } + + sigTx, ok := tx.(authsigning.SigVerifiableTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "tx %T doesn't implement authsigning.SigVerifiableTx", tx) + } + + authSignTx, ok := tx.(authsigning.Tx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "tx %T doesn't implement the authsigning.Tx interface", tx) + } + + // stdSigs contains the sequence number, account number, and signatures. + // When simulating, this would just be a 0-length slice. + sigs, err := sigTx.GetSignaturesV2() + if err != nil { + return ctx, err + } + + signerAddrs := sigTx.GetSigners() + + // EIP712 allows just one signature + if len(sigs) != 1 { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "invalid number of signers (%d); EIP712 signatures allows just one signature", len(sigs)) + } + + // check that signer length and signature length are the same + if len(sigs) != len(signerAddrs) { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "invalid number of signer; expected: %d, got %d", len(signerAddrs), len(sigs)) + } + + // EIP712 has just one signature, avoid looping here and only read index 0 + i := 0 + sig := sigs[i] + + acc, err := authante.GetSignerAcc(ctx, svd.ak, signerAddrs[i]) + if err != nil { + return ctx, err + } + + // retrieve pubkey + pubKey := acc.GetPubKey() + if !simulate && pubKey == nil { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "pubkey on account is not set") + } + + // Check account sequence number. + if sig.Sequence != acc.GetSequence() { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrWrongSequence, + "account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.Sequence, + ) + } + + // retrieve signer data + genesis := ctx.BlockHeight() == 0 + chainID := ctx.ChainID() + + var accNum uint64 + if !genesis { + accNum = acc.GetAccountNumber() + } + + signerData := authsigning.SignerData{ + ChainID: chainID, + AccountNumber: accNum, + Sequence: acc.GetSequence(), + } + + if simulate { + return next(ctx, tx, simulate) + } + + if err := VerifySignature(pubKey, signerData, sig.Data, svd.signModeHandler, authSignTx); err != nil { + errMsg := fmt.Errorf("signature verification failed; please verify account number (%d) and chain-id (%s): %w", accNum, chainID, err) + return ctx, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, errMsg.Error()) + } + + return next(ctx, tx, simulate) +} + +// VerifySignature verifies a transaction signature contained in SignatureData abstracting over different signing modes +// and single vs multi-signatures. +func VerifySignature( + pubKey cryptotypes.PubKey, + signerData authsigning.SignerData, + sigData signing.SignatureData, + _ authsigning.SignModeHandler, + tx authsigning.Tx, +) error { + switch data := sigData.(type) { + case *signing.SingleSignatureData: + if data.SignMode != signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON { + return sdkerrors.Wrapf(sdkerrors.ErrNotSupported, "unexpected SignatureData %T: wrong SignMode", sigData) + } + + // Note: this prevents the user from sending thrash data in the signature field + if len(data.Signature) != 0 { + return sdkerrors.Wrap(sdkerrors.ErrTooManySignatures, "invalid signature value; EIP712 must have the cosmos transaction signature empty") + } + + // @contract: this code is reached only when Msg has Web3Tx extension (so this custom Ante handler flow), + // and the signature is SIGN_MODE_LEGACY_AMINO_JSON which is supported for EIP712 for now + + msgs := tx.GetMsgs() + if len(msgs) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrNoSignatures, "tx doesn't contain any msgs to verify signature") + } + + txBytes := legacytx.StdSignBytes( + signerData.ChainID, + signerData.AccountNumber, + signerData.Sequence, + tx.GetTimeoutHeight(), + legacytx.StdFee{ + Amount: tx.GetFee(), + Gas: tx.GetGas(), + }, + msgs, tx.GetMemo(), + ) + + signerChainID, err := stratos.ParseChainID(signerData.ChainID) + if err != nil { + return sdkerrors.Wrapf(err, "failed to parse chainID: %s", signerData.ChainID) + } + + txWithExtensions, ok := tx.(authante.HasExtensionOptionsTx) + if !ok { + return sdkerrors.Wrap(sdkerrors.ErrUnknownExtensionOptions, "tx doesnt contain any extensions") + } + opts := txWithExtensions.GetExtensionOptions() + if len(opts) != 1 { + return sdkerrors.Wrap(sdkerrors.ErrUnknownExtensionOptions, "tx doesnt contain expected amount of extension options") + } + + var optIface stratos.ExtensionOptionsWeb3TxI + + if err := stratosCodec.UnpackAny(opts[0], &optIface); err != nil { + return sdkerrors.Wrap(err, "failed to proto-unpack ExtensionOptionsWeb3Tx") + } + + extOpt, ok := optIface.(*stratos.ExtensionOptionsWeb3Tx) + if !ok { + return sdkerrors.Wrap(sdkerrors.ErrInvalidChainID, "unknown extension option") + } + + if extOpt.TypedDataChainID != signerChainID.Uint64() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidChainID, "invalid chainID") + } + + if len(extOpt.FeePayer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrUnknownExtensionOptions, "no feePayer on ExtensionOptionsWeb3Tx") + } + feePayer, err := sdk.AccAddressFromBech32(extOpt.FeePayer) + if err != nil { + return sdkerrors.Wrap(err, "failed to parse feePayer from ExtensionOptionsWeb3Tx") + } + + feeDelegation := &eip712.FeeDelegationOptions{ + FeePayer: feePayer, + } + + typedData, err := eip712.WrapTxToTypedData(stratosCodec, extOpt.TypedDataChainID, msgs[0], txBytes, feeDelegation) + if err != nil { + return sdkerrors.Wrap(err, "failed to pack tx data in EIP712 object") + } + + sigHash, err := eip712.ComputeTypedDataHash(typedData) + if err != nil { + return err + } + + feePayerSig := extOpt.FeePayerSig + if len(feePayerSig) != ethcrypto.SignatureLength { + return sdkerrors.Wrap(sdkerrors.ErrorInvalidSigner, "signature length doesn't match typical [R||S||V] signature 65 bytes") + } + + // Remove the recovery offset if needed (ie. Metamask eip712 signature) + if feePayerSig[ethcrypto.RecoveryIDOffset] == 27 || feePayerSig[ethcrypto.RecoveryIDOffset] == 28 { + feePayerSig[ethcrypto.RecoveryIDOffset] -= 27 + } + + feePayerPubkey, err := secp256k1.RecoverPubkey(sigHash, feePayerSig) + if err != nil { + return sdkerrors.Wrap(err, "failed to recover delegated fee payer from sig") + } + + ecPubKey, err := ethcrypto.UnmarshalPubkey(feePayerPubkey) + if err != nil { + return sdkerrors.Wrap(err, "failed to unmarshal recovered fee payer pubkey") + } + + pk := ðsecp256k1.PubKey{ + Key: ethcrypto.CompressPubkey(ecPubKey), + } + + if !pubKey.Equals(pk) { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "feePayer pubkey %s is different from transaction pubkey %s", pubKey, pk) + } + + recoveredFeePayerAcc := sdk.AccAddress(pk.Address().Bytes()) + + if !recoveredFeePayerAcc.Equals(feePayer) { + return sdkerrors.Wrapf(sdkerrors.ErrorInvalidSigner, "failed to verify delegated fee payer %s signature", recoveredFeePayerAcc) + } + + // VerifySignature of ethsecp256k1 accepts 64 byte signature [R||S] + // WARNING! Under NO CIRCUMSTANCES try to use pubKey.VerifySignature there + if !secp256k1.VerifySignature(pubKey.Bytes(), sigHash, feePayerSig[:len(feePayerSig)-1]) { + return sdkerrors.Wrap(sdkerrors.ErrorInvalidSigner, "unable to verify signer signature of EIP712 typed data") + } + + return nil + default: + return sdkerrors.Wrapf(sdkerrors.ErrTooManySignatures, "unexpected SignatureData %T", sigData) + } +} diff --git a/app/ante/eth.go b/app/ante/eth.go new file mode 100644 index 00000000..a13375dc --- /dev/null +++ b/app/ante/eth.go @@ -0,0 +1,534 @@ +package ante + +import ( + "errors" + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authante "github.com/cosmos/cosmos-sdk/x/auth/ante" + + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + stratos "github.com/stratosnet/stratos-chain/types" + evmkeeper "github.com/stratosnet/stratos-chain/x/evm/keeper" + "github.com/stratosnet/stratos-chain/x/evm/statedb" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// EthSigVerificationDecorator validates an ethereum signatures +type EthSigVerificationDecorator struct { + evmKeeper EVMKeeper +} + +// NewEthSigVerificationDecorator creates a new EthSigVerificationDecorator +func NewEthSigVerificationDecorator(ek EVMKeeper) EthSigVerificationDecorator { + return EthSigVerificationDecorator{ + evmKeeper: ek, + } +} + +// AnteHandle validates checks that the registered chain id is the same as the one on the message, and +// that the signer address matches the one defined on the message. +// It's not skipped for RecheckTx, because it set `From` address which is critical from other ante handler to work. +// Failure in RecheckTx will prevent tx to be included into block, especially when CheckTx succeed, in which case user +// won't see the error message. +func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + chainID := esvd.evmKeeper.ChainID() + + params := esvd.evmKeeper.GetParams(ctx) + + ethCfg := params.ChainConfig.EthereumConfig(chainID) + blockNum := big.NewInt(ctx.BlockHeight()) + signer := ethtypes.MakeSigner(ethCfg, blockNum) + + for _, msg := range tx.GetMsgs() { + msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + + sender, err := signer.Sender(msgEthTx.AsTransaction()) + if err != nil { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrorInvalidSigner, + "couldn't retrieve sender address ('%s') from the ethereum transaction: %s", + msgEthTx.From, + err.Error(), + ) + } + + // set up the sender to the transaction field if not already + msgEthTx.From = sender.Hex() + } + + return next(ctx, tx, simulate) +} + +// EthAccountVerificationDecorator validates an account balance checks +type EthAccountVerificationDecorator struct { + ak evmtypes.AccountKeeper + bankKeeper evmtypes.BankKeeper + evmKeeper EVMKeeper +} + +// NewEthAccountVerificationDecorator creates a new EthAccountVerificationDecorator +func NewEthAccountVerificationDecorator(ak evmtypes.AccountKeeper, bankKeeper evmtypes.BankKeeper, ek EVMKeeper) EthAccountVerificationDecorator { + return EthAccountVerificationDecorator{ + ak: ak, + bankKeeper: bankKeeper, + evmKeeper: ek, + } +} + +// AnteHandle validates checks that the sender balance is greater than the total transaction cost. +// The account will be set to store if it doesn't exis, i.e cannot be found on store. +// This AnteHandler decorator will fail if: +// - any of the msgs is not a MsgEthereumTx +// - from address is empty +// - account balance is lower than the transaction cost +func (avd EthAccountVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if !ctx.IsCheckTx() { + return next(ctx, tx, simulate) + } + + for i, msg := range tx.GetMsgs() { + msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + + txData, err := evmtypes.UnpackTxData(msgEthTx.Data) + if err != nil { + return ctx, sdkerrors.Wrapf(err, "failed to unpack tx data any for tx %d", i) + } + + // sender address should be in the tx cache from the previous AnteHandle call + from := msgEthTx.GetFrom() + if from.Empty() { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "from address cannot be empty") + } + + // check whether the sender address is EOA + fromAddr := common.BytesToAddress(from) + acct := avd.evmKeeper.GetAccount(ctx, fromAddr) + + if acct == nil { + acc := avd.ak.NewAccountWithAddress(ctx, from) + avd.ak.SetAccount(ctx, acc) + acct = statedb.NewEmptyAccount() + } else if acct.IsContract() { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, + "the sender is not EOA: address %s, codeHash <%s>", fromAddr, acct.CodeHash) + } + + if err := evmkeeper.CheckSenderBalance(sdk.NewIntFromBigInt(acct.Balance), txData); err != nil { + return ctx, sdkerrors.Wrap(err, "failed to check sender balance") + } + + } + return next(ctx, tx, simulate) +} + +// EthGasConsumeDecorator validates enough intrinsic gas for the transaction and +// gas consumption. +type EthGasConsumeDecorator struct { + evmKeeper EVMKeeper + maxGasWanted uint64 +} + +// NewEthGasConsumeDecorator creates a new EthGasConsumeDecorator +func NewEthGasConsumeDecorator( + evmKeeper EVMKeeper, + maxGasWanted uint64, +) EthGasConsumeDecorator { + return EthGasConsumeDecorator{ + evmKeeper, + maxGasWanted, + } +} + +// AnteHandle validates that the Ethereum tx message has enough to cover intrinsic gas +// (during CheckTx only) and that the sender has enough balance to pay for the gas cost. +// +// Intrinsic gas for a transaction is the amount of gas that the transaction uses before the +// transaction is executed. The gas is a constant value plus any cost inccured by additional bytes +// of data supplied with the transaction. +// +// This AnteHandler decorator will fail if: +// - the message is not a MsgEthereumTx +// - sender account cannot be found +// - transaction's gas limit is lower than the intrinsic gas +// - user doesn't have enough balance to deduct the transaction fees (gas_limit * gas_price) +// - transaction or block gas meter runs out of gas +// - sets the gas meter limit +func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + params := egcd.evmKeeper.GetParams(ctx) + + ethCfg := params.ChainConfig.EthereumConfig(egcd.evmKeeper.ChainID()) + + blockHeight := big.NewInt(ctx.BlockHeight()) + homestead := ethCfg.IsHomestead(blockHeight) + istanbul := ethCfg.IsIstanbul(blockHeight) + london := ethCfg.IsLondon(blockHeight) + evmDenom := params.EvmDenom + gasWanted := uint64(0) + var events sdk.Events + + for _, msg := range tx.GetMsgs() { + msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + + txData, err := evmtypes.UnpackTxData(msgEthTx.Data) + if err != nil { + return ctx, sdkerrors.Wrap(err, "failed to unpack tx data") + } + + if ctx.IsCheckTx() { + // We can't trust the tx gas limit, because we'll refund the unused gas. + if txData.GetGas() > egcd.maxGasWanted { + gasWanted += egcd.maxGasWanted + } else { + gasWanted += txData.GetGas() + } + } else { + gasWanted += txData.GetGas() + } + + fees, err := egcd.evmKeeper.DeductTxCostsFromUserBalance( + ctx, + *msgEthTx, + txData, + evmDenom, + homestead, + istanbul, + london, + ) + if err != nil { + return ctx, sdkerrors.Wrapf(err, "failed to deduct transaction costs from user balance") + } + + events = append(events, sdk.NewEvent(sdk.EventTypeTx, sdk.NewAttribute(sdk.AttributeKeyFee, fees.String()))) + } + + // TODO: change to typed events + ctx.EventManager().EmitEvents(events) + + // TODO: deprecate after https://github.com/cosmos/cosmos-sdk/issues/9514 is fixed on SDK + blockGasLimit := stratos.BlockGasLimit(ctx) + + // NOTE: safety check + if blockGasLimit > 0 { + // generate a copy of the gas pool (i.e block gas meter) to see if we've run out of gas for this block + // if current gas consumed is greater than the limit, this funcion panics and the error is recovered on the Baseapp + gasPool := sdk.NewGasMeter(blockGasLimit) + gasPool.ConsumeGas(ctx.GasMeter().GasConsumedToLimit(), "gas pool check") + } + + // Set ctx.GasMeter with a limit of GasWanted (gasLimit) + gasConsumed := ctx.GasMeter().GasConsumed() + ctx = ctx.WithGasMeter(stratos.NewInfiniteGasMeterWithLimit(gasWanted)) + ctx.GasMeter().ConsumeGas(gasConsumed, "copy gas consumed") + + // we know that we have enough gas on the pool to cover the intrinsic gas + return next(ctx, tx, simulate) +} + +// CanTransferDecorator checks if the sender is allowed to transfer funds according to the EVM block +// context rules. +type CanTransferDecorator struct { + evmKeeper EVMKeeper +} + +// NewCanTransferDecorator creates a new CanTransferDecorator instance. +func NewCanTransferDecorator(evmKeeper EVMKeeper) CanTransferDecorator { + return CanTransferDecorator{ + evmKeeper: evmKeeper, + } +} + +// AnteHandle creates an EVM from the message and calls the BlockContext CanTransfer function to +// see if the address can execute the transaction. +func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + params := ctd.evmKeeper.GetParams(ctx) + ethCfg := params.ChainConfig.EthereumConfig(ctd.evmKeeper.ChainID()) + signer := ethtypes.MakeSigner(ethCfg, big.NewInt(ctx.BlockHeight())) + + for _, msg := range tx.GetMsgs() { + msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + + baseFee := ctd.evmKeeper.BaseFee(ctx, ethCfg) + + coreMsg, err := msgEthTx.AsMessage(signer, baseFee) + if err != nil { + return ctx, sdkerrors.Wrapf( + err, + "failed to create an ethereum core.Message from signer %T", signer, + ) + } + + // NOTE: pass in an empty coinbase address and nil tracer as we don't need them for the check below + cfg := &evmtypes.EVMConfig{ + ChainConfig: ethCfg, + Params: params, + CoinBase: common.Address{}, + BaseFee: baseFee, + } + stateDB := statedb.New(ctx, ctd.evmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash().Bytes()))) + evm := ctd.evmKeeper.NewEVM(ctx, coreMsg, cfg, evmtypes.NewNoOpTracer(), stateDB) + + // check that caller has enough balance to cover asset transfer for **topmost** call + // NOTE: here the gas consumed is from the context with the infinite gas meter + if coreMsg.Value().Sign() > 0 && !evm.Context.CanTransfer(stateDB, coreMsg.From(), coreMsg.Value()) { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrInsufficientFunds, + "failed to transfer %s from address %s using the EVM block context transfer function", + coreMsg.Value(), + coreMsg.From(), + ) + } + + if evmtypes.IsLondon(ethCfg, ctx.BlockHeight()) { + if baseFee == nil { + return ctx, sdkerrors.Wrap( + evmtypes.ErrInvalidBaseFee, + "base fee is supported but evm block context value is nil", + ) + } + if coreMsg.GasFeeCap().Cmp(baseFee) < 0 { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrInsufficientFee, + "max fee per gas less than block base fee (%s < %s)", + coreMsg.GasFeeCap(), baseFee, + ) + } + } + } + + return next(ctx, tx, simulate) +} + +// EthIncrementSenderSequenceDecorator increments the sequence of the signers. +type EthIncrementSenderSequenceDecorator struct { + ak evmtypes.AccountKeeper +} + +// NewEthIncrementSenderSequenceDecorator creates a new EthIncrementSenderSequenceDecorator. +func NewEthIncrementSenderSequenceDecorator(ak evmtypes.AccountKeeper) EthIncrementSenderSequenceDecorator { + return EthIncrementSenderSequenceDecorator{ + ak: ak, + } +} + +// AnteHandle handles incrementing the sequence of the signer (i.e sender). If the transaction is a +// contract creation, the nonce will be incremented during the transaction execution and not within +// this AnteHandler decorator. +func (issd EthIncrementSenderSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + for _, msg := range tx.GetMsgs() { + msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + + txData, err := evmtypes.UnpackTxData(msgEthTx.Data) + if err != nil { + return ctx, sdkerrors.Wrap(err, "failed to unpack tx data") + } + + // increase sequence of sender + acc := issd.ak.GetAccount(ctx, msgEthTx.GetFrom()) + if acc == nil { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrUnknownAddress, + "account %s is nil", common.BytesToAddress(msgEthTx.GetFrom().Bytes()), + ) + } + nonce := acc.GetSequence() + + // we merged the nonce verification to nonce increment, so when tx includes multiple messages + // with same sender, they'll be accepted. + if txData.GetNonce() != nonce { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrInvalidSequence, + "invalid nonce; got %d, expected %d", txData.GetNonce(), nonce, + ) + } + + if err := acc.SetSequence(nonce + 1); err != nil { + return ctx, sdkerrors.Wrapf(err, "failed to set sequence to %d", acc.GetSequence()+1) + } + + issd.ak.SetAccount(ctx, acc) + } + + return next(ctx, tx, simulate) +} + +// EthValidateBasicDecorator is adapted from ValidateBasicDecorator from cosmos-sdk, it ignores ErrNoSignatures +type EthValidateBasicDecorator struct { + evmKeeper EVMKeeper +} + +// NewEthValidateBasicDecorator creates a new EthValidateBasicDecorator +func NewEthValidateBasicDecorator(ek EVMKeeper) EthValidateBasicDecorator { + return EthValidateBasicDecorator{ + evmKeeper: ek, + } +} + +// AnteHandle handles basic validation of tx +func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + // no need to validate basic on recheck tx, call next antehandler + if ctx.IsReCheckTx() { + return next(ctx, tx, simulate) + } + + err := tx.ValidateBasic() + // ErrNoSignatures is fine with eth tx + if err != nil && !errors.Is(err, sdkerrors.ErrNoSignatures) { + return ctx, sdkerrors.Wrap(err, "tx basic validation failed") + } + + // For eth type cosmos tx, some fields should be veified as zero values, + // since we will only verify the signature against the hash of the MsgEthereumTx.Data + if wrapperTx, ok := tx.(protoTxProvider); ok { + protoTx := wrapperTx.GetProtoTx() + body := protoTx.Body + if body.Memo != "" || body.TimeoutHeight != uint64(0) || len(body.NonCriticalExtensionOptions) > 0 { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, + "for eth tx body Memo TimeoutHeight NonCriticalExtensionOptions should be empty") + } + + if len(body.ExtensionOptions) != 1 { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "for eth tx length of ExtensionOptions should be 1") + } + + txFee := sdk.Coins{} + txGasLimit := uint64(0) + + for _, msg := range protoTx.GetMsgs() { + msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + txGasLimit += msgEthTx.GetGas() + + txData, err := evmtypes.UnpackTxData(msgEthTx.Data) + if err != nil { + return ctx, sdkerrors.Wrap(err, "failed to unpack MsgEthereumTx Data") + } + + params := vbd.evmKeeper.GetParams(ctx) + chainID := vbd.evmKeeper.ChainID() + ethCfg := params.ChainConfig.EthereumConfig(chainID) + baseFee := vbd.evmKeeper.BaseFee(ctx, ethCfg) + if baseFee == nil && txData.TxType() == ethtypes.DynamicFeeTxType { + return ctx, sdkerrors.Wrap(ethtypes.ErrTxTypeNotSupported, "dynamic fee tx not supported") + } + + txFee = txFee.Add(sdk.NewCoin(params.EvmDenom, sdk.NewIntFromBigInt(txData.Fee()))) + } + + authInfo := protoTx.AuthInfo + if len(authInfo.SignerInfos) > 0 { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "for eth tx AuthInfo SignerInfos should be empty") + } + + if authInfo.Fee.Payer != "" || authInfo.Fee.Granter != "" { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "for eth tx AuthInfo Fee payer and granter should be empty") + } + + if !authInfo.Fee.Amount.IsEqual(txFee) { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid AuthInfo Fee Amount (%s != %s)", authInfo.Fee.Amount, txFee) + } + + if authInfo.Fee.GasLimit != txGasLimit { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid AuthInfo Fee GasLimit (%d != %d)", authInfo.Fee.GasLimit, txGasLimit) + } + + sigs := protoTx.Signatures + if len(sigs) > 0 { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "for eth tx Signatures should be empty") + } + } + + return next(ctx, tx, simulate) +} + +// EthSetupContextDecorator is adapted from SetUpContextDecorator from cosmos-sdk, it ignores gas consumption +// by setting the gas meter to infinite +type EthSetupContextDecorator struct { + evmKeeper EVMKeeper +} + +func NewEthSetUpContextDecorator(evmKeeper EVMKeeper) EthSetupContextDecorator { + return EthSetupContextDecorator{ + evmKeeper: evmKeeper, + } +} + +func (esc EthSetupContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + // all transactions must implement GasTx + _, ok := tx.(authante.GasTx) + if !ok { + return newCtx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be GasTx") + } + + newCtx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + // Reset transient gas used to prepare the execution of current cosmos tx. + // Transient gas-used is necessary to sum the gas-used of cosmos tx, when it contains multiple eth msgs. + esc.evmKeeper.ResetTransientGasUsed(ctx) + return next(newCtx, tx, simulate) +} + +// EthMempoolFeeDecorator will check if the transaction's effective fee is at least as large +// as the local validator's minimum gasFee (defined in validator config). +// If fee is too low, decorator returns error and tx is rejected from mempool. +// Note this only applies when ctx.CheckTx = true +// If fee is high enough or not CheckTx, then call next AnteHandler +// CONTRACT: Tx must implement FeeTx to use MempoolFeeDecorator +type EthMempoolFeeDecorator struct { + evmKeeper EVMKeeper +} + +func NewEthMempoolFeeDecorator(ek EVMKeeper) EthMempoolFeeDecorator { + return EthMempoolFeeDecorator{ + evmKeeper: ek, + } +} + +// AnteHandle ensures that the provided fees meet a minimum threshold for the validator, +// if this is a CheckTx. This is only for local mempool purposes, and thus +// is only ran on check tx. +// It only do the check if london hardfork not enabled or feemarket not enabled, because in that case feemarket will take over the task. +func (mfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if ctx.IsCheckTx() && !simulate { + params := mfd.evmKeeper.GetParams(ctx) + ethCfg := params.ChainConfig.EthereumConfig(mfd.evmKeeper.ChainID()) + baseFee := mfd.evmKeeper.BaseFee(ctx, ethCfg) + if baseFee == nil { + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + + evmDenom := params.EvmDenom + feeAmt := ethMsg.GetFee() + glDec := sdk.NewDec(int64(ethMsg.GetGas())) + requiredFee := ctx.MinGasPrices().AmountOf(evmDenom).Mul(glDec) + if sdk.NewDecFromBigInt(feeAmt).LT(requiredFee) { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "insufficient fees; got: %s required: %s", feeAmt, requiredFee) + } + } + } + } + + return next(ctx, tx, simulate) +} diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go new file mode 100644 index 00000000..443a7cc8 --- /dev/null +++ b/app/ante/handler_options.go @@ -0,0 +1,105 @@ +package ante + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC +// channel keeper, EVM Keeper and Fee Market Keeper. +type HandlerOptions struct { + AccountKeeper evmtypes.AccountKeeper + BankKeeper evmtypes.BankKeeper + IBCKeeper *ibckeeper.Keeper + //FeeMarketKeeper evmtypes.FeeMarketKeeper + EvmKeeper EVMKeeper + FeegrantKeeper ante.FeegrantKeeper + SignModeHandler authsigning.SignModeHandler + SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error + MaxTxGasWanted uint64 +} + +func (options HandlerOptions) Validate() error { + if options.AccountKeeper == nil { + return sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") + } + if options.BankKeeper == nil { + return sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") + } + if options.SignModeHandler == nil { + return sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") + } + //if options.FeeMarketKeeper == nil { + // return sdkerrors.Wrap(sdkerrors.ErrLogic, "fee market keeper is required for AnteHandler") + //} + if options.EvmKeeper == nil { + return sdkerrors.Wrap(sdkerrors.ErrLogic, "evm keeper is required for AnteHandler") + } + return nil +} + +func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler { + return sdk.ChainAnteDecorators( + NewEthSetUpContextDecorator(options.EvmKeeper), // outermost AnteDecorator. SetUpContext must be called first + NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices + NewEthValidateBasicDecorator(options.EvmKeeper), + NewEthSigVerificationDecorator(options.EvmKeeper), + NewEthAccountVerificationDecorator(options.AccountKeeper, options.BankKeeper, options.EvmKeeper), + NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted), + NewCanTransferDecorator(options.EvmKeeper), + NewEthIncrementSenderSequenceDecorator(options.AccountKeeper), // innermost AnteDecorator. + ) +} + +func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler { + return sdk.ChainAnteDecorators( + RejectMessagesDecorator{}, // reject MsgEthereumTxs + ante.NewSetUpContextDecorator(), + ante.NewRejectExtensionOptionsDecorator(), + ante.NewMempoolFeeDecorator(), + ante.NewValidateBasicDecorator(), + ante.NewTxTimeoutHeightDecorator(), + ante.NewValidateMemoDecorator(options.AccountKeeper), + ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), + ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper), + // SetPubKeyDecorator must be called before all signature verification decorators + ante.NewSetPubKeyDecorator(options.AccountKeeper), + ante.NewValidateSigCountDecorator(options.AccountKeeper), + ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), + ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), + ante.NewIncrementSequenceDecorator(options.AccountKeeper), + ibcante.NewAnteDecorator(options.IBCKeeper), + ) +} + +func newCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler { + return sdk.ChainAnteDecorators( + RejectMessagesDecorator{}, // reject MsgEthereumTxs + ante.NewSetUpContextDecorator(), + // NOTE: extensions option decorator removed + // ante.NewRejectExtensionOptionsDecorator(), + ante.NewMempoolFeeDecorator(), + ante.NewValidateBasicDecorator(), + ante.NewTxTimeoutHeightDecorator(), + ante.NewValidateMemoDecorator(options.AccountKeeper), + ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), + ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper), + // SetPubKeyDecorator must be called before all signature verification decorators + ante.NewSetPubKeyDecorator(options.AccountKeeper), + ante.NewValidateSigCountDecorator(options.AccountKeeper), + ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), + // Note: signature verification uses EIP instead of the cosmos signature validator + NewEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), + ante.NewIncrementSequenceDecorator(options.AccountKeeper), + ibcante.NewAnteDecorator(options.IBCKeeper), + ) +} diff --git a/app/ante/interfaces.go b/app/ante/interfaces.go new file mode 100644 index 00000000..0c00f3b6 --- /dev/null +++ b/app/ante/interfaces.go @@ -0,0 +1,33 @@ +package ante + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" + "github.com/stratosnet/stratos-chain/x/evm/statedb" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// EVMKeeper defines the expected keeper interface used on the Eth AnteHandler +type EVMKeeper interface { + statedb.Keeper + + ChainID() *big.Int + GetParams(ctx sdk.Context) evmtypes.Params + NewEVM(ctx sdk.Context, msg core.Message, cfg *evmtypes.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) *vm.EVM + DeductTxCostsFromUserBalance( + ctx sdk.Context, msgEthTx evmtypes.MsgEthereumTx, txData evmtypes.TxData, denom string, homestead, istanbul, london bool, + ) (sdk.Coins, error) + BaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int + GetBalance(ctx sdk.Context, addr common.Address) *big.Int + ResetTransientGasUsed(ctx sdk.Context) +} + +type protoTxProvider interface { + GetProtoTx() *tx.Tx +} diff --git a/app/ante/reject_msgs.go b/app/ante/reject_msgs.go new file mode 100644 index 00000000..962c3ce1 --- /dev/null +++ b/app/ante/reject_msgs.go @@ -0,0 +1,25 @@ +package ante + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// RejectMessagesDecorator prevents invalid msg types from being executed +type RejectMessagesDecorator struct{} + +// AnteHandle rejects messages that requires ethereum-specific authentication. +// For example `MsgEthereumTx` requires fee to be deducted in the antehandler in +// order to perform the refund. +func (rmd RejectMessagesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + for _, msg := range tx.GetMsgs() { + if _, ok := msg.(*evmtypes.MsgEthereumTx); ok { + return ctx, sdkerrors.Wrapf( + sdkerrors.ErrInvalidType, + "MsgEthereumTx needs to be contained within a tx with 'ExtensionOptionsEthereumTx' option", + ) + } + } + return next(ctx, tx, simulate) +} diff --git a/app/app.go b/app/app.go index 2bfe1d2d..f1412cac 100644 --- a/app/app.go +++ b/app/app.go @@ -1,11 +1,11 @@ package app import ( + "encoding/json" "io" "net/http" "os" - sdkparams "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" @@ -25,11 +25,11 @@ import ( "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/simapp" + sdkparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" @@ -91,7 +91,12 @@ import ( ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" - "github.com/stratosnet/stratos-chain/helpers" + "github.com/stratosnet/stratos-chain/app/ante" + srvflags "github.com/stratosnet/stratos-chain/server/flags" + "github.com/stratosnet/stratos-chain/x/evm" + evmrest "github.com/stratosnet/stratos-chain/x/evm/client/rest" + evmkeeper "github.com/stratosnet/stratos-chain/x/evm/keeper" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" //"github.com/stratosnet/stratos-chain/x/pot" //pottypes "github.com/stratosnet/stratos-chain/x/pot/types" //"github.com/stratosnet/stratos-chain/x/register" @@ -135,7 +140,7 @@ var ( //register.AppModuleBasic{}, //pot.AppModuleBasic{}, //sds.AppModuleBasic{}, - //evm.AppModuleBasic{}, + evm.AppModuleBasic{}, ) maccPerms = map[string][]string{ @@ -147,7 +152,7 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, //pot.FoundationAccount: nil, - //evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account } // module accounts that are allowed to receive tokens @@ -198,7 +203,7 @@ type NewApp struct { //registerKeeper register.Keeper //potKeeper pot.Keeper //sdsKeeper sds.Keeper - //evmKeeper *evmkeeper.Keeper + evmKeeper *evmkeeper.Keeper // the module manager mm *module.Manager @@ -242,9 +247,11 @@ func NewInitApp( ibchost.StoreKey, ibctransfertypes.StoreKey, // stratos keys //register.StoreKey, pot.StoreKey, sds.StoreKey, - //evmtypes.StoreKey, + evmtypes.StoreKey, ) - tKeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) + + // Add the EVM transient store key + tKeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) app := &NewApp{ @@ -310,6 +317,13 @@ func NewInitApp( keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter(), ) + tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer)) + app.evmKeeper = evmkeeper.NewKeeper( + appCodec, keys[evmtypes.StoreKey], tKeys[evmtypes.TransientKey], app.GetSubspace(evmtypes.ModuleName), + app.accountKeeper, app.bankKeeper, app.stakingKeeper, + tracer, + ) + // Create IBC Keeper app.ibcKeeper = ibckeeper.NewKeeper( appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.stakingKeeper, app.upgradeKeeper, scopedIBCKeeper, @@ -412,6 +426,7 @@ func NewInitApp( transferModule, // Stratos app modules + evm.NewAppModule(app.evmKeeper, app.accountKeeper), //register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), //pot.NewAppModule(app.potKeeper, app.bankKeeper, app.supplyKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), //sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), @@ -426,7 +441,7 @@ func NewInitApp( app.mm.SetOrderBeginBlockers( upgradetypes.ModuleName, capabilitytypes.ModuleName, - //evmtypes.ModuleName, + evmtypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -452,7 +467,7 @@ func NewInitApp( govtypes.ModuleName, stakingtypes.ModuleName, //register.ModuleName, - //evmtypes.ModuleName, + evmtypes.ModuleName, // no-op modules ibchost.ModuleName, ibctransfertypes.ModuleName, @@ -496,7 +511,7 @@ func NewInitApp( upgradetypes.ModuleName, vestingtypes.ModuleName, // Stratos modules - //evmtypes.ModuleName, + evmtypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module crisistypes.ModuleName, @@ -517,22 +532,27 @@ func NewInitApp( app.SetBeginBlocker(app.BeginBlocker) // custom AnteHandler + maxGasWanted := cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)) options := ante.HandlerOptions{ AccountKeeper: app.accountKeeper, BankKeeper: app.bankKeeper, + EvmKeeper: app.evmKeeper, FeegrantKeeper: app.feeGrantKeeper, + IBCKeeper: app.ibcKeeper, SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - SigGasConsumer: helpers.StSigVerificationGasConsumer, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + MaxTxGasWanted: maxGasWanted, } - antHandler, err := ante.NewAnteHandler(options) - if err != nil { + + if err := options.Validate(); err != nil { panic(err) } - app.SetAnteHandler(antHandler) + + app.SetAnteHandler(ante.NewAnteHandler(options)) app.SetEndBlocker(app.EndBlocker) if loadLatest { - if err = app.LoadLatestVersion(); err != nil { + if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) } } @@ -545,8 +565,10 @@ func NewInitApp( func (app *NewApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState simapp.GenesisState - - app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState) + if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { + panic(err) + } + app.upgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } @@ -625,7 +647,7 @@ func (app *NewApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICon clientCtx := apiSvr.ClientCtx rpc.RegisterRoutes(clientCtx, apiSvr.Router) - //evmrest.RegisterTxRoutes(clientCtx, apiSvr.Router) + evmrest.RegisterTxRoutes(clientCtx, apiSvr.Router) // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) @@ -674,7 +696,7 @@ func initParamsKeeper( //paramsKeeper.Subspace(registertypes.ModuleName) //paramsKeeper.Subspace(pottypes.ModuleName) //paramsKeeper.Subspace(sdstypes.ModuleName) - //paramsKeeper.Subspace(evmtypes.ModuleName) + paramsKeeper.Subspace(evmtypes.ModuleName) return paramsKeeper } diff --git a/client/config.go b/client/config.go new file mode 100644 index 00000000..540d32e0 --- /dev/null +++ b/client/config.go @@ -0,0 +1,69 @@ +package client + +import ( + "fmt" + "os" + "path" + + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/tendermint/tendermint/libs/cli" + + "github.com/cosmos/cosmos-sdk/client/flags" + + stratos "github.com/stratosnet/stratos-chain/types" +) + +// InitConfig adds the chain-id, encoding and output flags to the persistent flag set. +func InitConfig(cmd *cobra.Command) error { + home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) + if err != nil { + return err + } + + configFile := path.Join(home, "config", "config.toml") + _, err = os.Stat(configFile) + if err != nil && !os.IsNotExist(err) { + // Immediately return if the error isn't related to the file not existing. + // See issue https://github.com/tharsis/ethermint/issues/539 + return err + } + if err == nil { + viper.SetConfigFile(configFile) + + if err := viper.ReadInConfig(); err != nil { + return err + } + } + + if err := viper.BindPFlag(flags.FlagChainID, cmd.PersistentFlags().Lookup(flags.FlagChainID)); err != nil { + return err + } + + if err := viper.BindPFlag(cli.EncodingFlag, cmd.PersistentFlags().Lookup(cli.EncodingFlag)); err != nil { + return err + } + + return viper.BindPFlag(cli.OutputFlag, cmd.PersistentFlags().Lookup(cli.OutputFlag)) +} + +// ValidateChainID wraps a cobra command with a RunE function with base 10 integer chain-id verification. +func ValidateChainID(baseCmd *cobra.Command) *cobra.Command { + // Copy base run command to be used after chain verification + baseRunE := baseCmd.RunE + + // Function to replace command's RunE function + validateFn := func(cmd *cobra.Command, args []string) error { + chainID, _ := cmd.Flags().GetString(flags.FlagChainID) + + if !stratos.IsValidChainID(chainID) { + return fmt.Errorf("invalid chain-id format: %s", chainID) + } + + return baseRunE(cmd, args) + } + + baseCmd.RunE = validateFn + return baseCmd +} diff --git a/cmd/stchaind/root.go b/cmd/stchaind/root.go index 7d95c14e..b5d102d7 100644 --- a/cmd/stchaind/root.go +++ b/cmd/stchaind/root.go @@ -96,7 +96,9 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), + stratosclient.ValidateChainID( + genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), + ), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), diff --git a/helpers/antehelper.go b/helpers/antehelper.go deleted file mode 100644 index 670d21ee..00000000 --- a/helpers/antehelper.go +++ /dev/null @@ -1,68 +0,0 @@ -package helpers - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/cosmos/cosmos-sdk/crypto/types/multisig" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// StSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas -// for signature verification based upon the public key type. The cost is fetched from the given params and is matched -// by the concrete type. -func StSigVerificationGasConsumer( - meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params, -) error { - pubKey := sig.PubKey - switch pubKey := pubKey.(type) { - case *ed25519.PubKey: - meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") - return sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "ED25519 public keys are unsupported") - case *secp256k1.PubKey: - meter.ConsumeGas(params.SigVerifyCostSecp256k1, "ante verify: secp256k1") - return nil - case multisig.PubKey: - multisignature, ok := sig.Data.(*signing.MultiSignatureData) - if !ok { - return fmt.Errorf("expected %T, got, %T", &signing.MultiSignatureData{}, sig.Data) - } - err := consumeMultisignatureVerificationGas(meter, multisignature, pubKey, params, sig.Sequence) - if err != nil { - return err - } - return nil - default: - return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubKey) - } -} - -// ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubkey signature -func consumeMultisignatureVerificationGas( - meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey, params authtypes.Params, accSeq uint64, -) error { - size := sig.BitArray.Count() - sigIndex := 0 - - for i := 0; i < size; i++ { - if !sig.BitArray.GetIndex(i) { - continue - } - sigV2 := signing.SignatureV2{ - PubKey: pubkey.GetPubKeys()[i], - Data: sig.Signatures[sigIndex], - Sequence: accSeq, - } - err := StSigVerificationGasConsumer(meter, sigV2, params) - if err != nil { - return err - } - sigIndex++ - } - - return nil -} diff --git a/types/gasmeter.go b/types/gasmeter.go new file mode 100644 index 00000000..a3ce844c --- /dev/null +++ b/types/gasmeter.go @@ -0,0 +1,91 @@ +package types + +import ( + "fmt" + "math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// ErrorNegativeGasConsumed defines an error thrown when the amount of gas refunded results in a +// negative gas consumed amount. +// Copied from cosmos-sdk +type ErrorNegativeGasConsumed struct { + Descriptor string +} + +// ErrorGasOverflow defines an error thrown when an action results gas consumption +// unsigned integer overflow. +type ErrorGasOverflow struct { + Descriptor string +} + +type infiniteGasMeterWithLimit struct { + consumed sdk.Gas + limit sdk.Gas +} + +// NewInfiniteGasMeterWithLimit returns a reference to a new infiniteGasMeter. +func NewInfiniteGasMeterWithLimit(limit sdk.Gas) sdk.GasMeter { + return &infiniteGasMeterWithLimit{ + consumed: 0, + limit: limit, + } +} + +func (g *infiniteGasMeterWithLimit) GasConsumed() sdk.Gas { + return g.consumed +} + +func (g *infiniteGasMeterWithLimit) GasConsumedToLimit() sdk.Gas { + return g.consumed +} + +func (g *infiniteGasMeterWithLimit) Limit() sdk.Gas { + return g.limit +} + +// addUint64Overflow performs the addition operation on two uint64 integers and +// returns a boolean on whether or not the result overflows. +func addUint64Overflow(a, b uint64) (uint64, bool) { + if math.MaxUint64-a < b { + return 0, true + } + + return a + b, false +} + +func (g *infiniteGasMeterWithLimit) ConsumeGas(amount sdk.Gas, descriptor string) { + var overflow bool + // TODO: Should we set the consumed field after overflow checking? + g.consumed, overflow = addUint64Overflow(g.consumed, amount) + if overflow { + panic(ErrorGasOverflow{descriptor}) + } +} + +// RefundGas will deduct the given amount from the gas consumed. If the amount is greater than the +// gas consumed, the function will panic. +// +// Use case: This functionality enables refunding gas to the trasaction or block gas pools so that +// EVM-compatible chains can fully support the go-ethereum StateDb interface. +// See https://github.com/cosmos/cosmos-sdk/pull/9403 for reference. +func (g *infiniteGasMeterWithLimit) RefundGas(amount sdk.Gas, descriptor string) { + if g.consumed < amount { + panic(ErrorNegativeGasConsumed{Descriptor: descriptor}) + } + + g.consumed -= amount +} + +func (g *infiniteGasMeterWithLimit) IsPastLimit() bool { + return false +} + +func (g *infiniteGasMeterWithLimit) IsOutOfGas() bool { + return false +} + +func (g *infiniteGasMeterWithLimit) String() string { + return fmt.Sprintf("InfiniteGasMeter:\n consumed: %d", g.consumed) +} diff --git a/x/sds/types/types.go b/x/sds/types/types.go deleted file mode 100644 index ab1254f4..00000000 --- a/x/sds/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types From 6e5f2fafd559055a5d6e16a151232e5fdedd2138 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 3 May 2022 14:30:32 -0400 Subject: [PATCH 008/113] init upgrading --- proto/stratos/register/v1/genesis.proto | 50 + proto/stratos/register/v1/query.proto | 297 ++ proto/stratos/register/v1/register.proto | 82 + proto/stratos/register/v1/tx.proto | 173 + x/register/types/codec.go | 50 +- x/register/types/errors.go | 137 +- x/register/types/expected_keepers.go | 34 +- x/register/types/genesis.go | 76 +- x/register/types/genesis.pb.go | 1107 ++++++ x/register/types/hooks.go | 2 +- x/register/types/indexing_node.go | 200 +- x/register/types/msg.go | 499 ++- x/register/types/params.go | 68 +- x/register/types/register.pb.go | 2533 +++++++++++++ x/register/types/registration.go | 33 +- x/register/types/resource_node.go | 205 +- x/register/types/tx.pb.go | 4399 ++++++++++++++++++++++ x/register/types/tx.pb.gw.go | 806 ++++ x/register/types/unbonding_node.go | 8 +- 19 files changed, 10184 insertions(+), 575 deletions(-) create mode 100644 proto/stratos/register/v1/genesis.proto create mode 100644 proto/stratos/register/v1/query.proto create mode 100644 proto/stratos/register/v1/register.proto create mode 100644 proto/stratos/register/v1/tx.proto create mode 100644 x/register/types/genesis.pb.go create mode 100644 x/register/types/register.pb.go create mode 100644 x/register/types/tx.pb.go create mode 100644 x/register/types/tx.pb.gw.go diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto new file mode 100644 index 00000000..f8ab8626 --- /dev/null +++ b/proto/stratos/register/v1/genesis.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +package stratos.evm.v1; + + + +import "google/protobuf/any.proto"; +import "gogoproto/gogo.proto"; + +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/staking/v1beta1/staking.proto"; + +import "stratos/register/v1/register.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; + +// GenesisState defines the register module's genesis state. +message GenesisState { + register.v1.Params params = 1 [ (gogoproto.moretags) = "yaml:\"params\"" ]; + register.v1.ResourceNodes resourceNodes = 2 [ (gogoproto.moretags) = "yaml:\"resource_nodes\"" ]; + register.v1.IndexingNodes indexingNodes = 3 [ (gogoproto.moretags) = "yaml:\"indexing_nodes\"" ]; + string initialUozPrice = 4 [ + (gogoproto.moretags) = "yaml:\"initial_uoz_price\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; //initial price of uoz + string totalUnissuedPrepay = 5 [ + (gogoproto.moretags) = "yaml:\"total_unissued_prepay\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + repeated register.v1.Slashing slashing = 6 [ (gogoproto.moretags) = "yaml:\"slashing_info\"" ]; +} + +message GenesisIndexingNode { + string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the indexing node + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; // the consensus public key of the indexing node; bech encoded in JSON + bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; // has the indexing node been suspended from bonded status? + cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\""]; // indexing node status (Unspecified/Bonded/Unbonding/Unbonded) + string token = 5 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"token\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; // delegated tokens + string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the indexing node + register.v1.Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; // description terms for the indexing node +} diff --git a/proto/stratos/register/v1/query.proto b/proto/stratos/register/v1/query.proto new file mode 100644 index 00000000..51c49f63 --- /dev/null +++ b/proto/stratos/register/v1/query.proto @@ -0,0 +1,297 @@ +syntax = "proto3"; +package stratos.evm.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "google/api/annotations.proto"; +import "stratos/evm/v1/evm.proto"; +import "stratos/evm/v1/tx.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/evm/types"; + +// Query defines the gRPC querier service. +service Query { + // Account queries an Ethereum account. + rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { + option (google.api.http).get = "/stratos/evm/v1/account/{address}"; + } + + // CosmosAccount queries an Ethereum account's Cosmos Address. + rpc CosmosAccount(QueryCosmosAccountRequest) + returns (QueryCosmosAccountResponse) { + option (google.api.http).get = "/stratos/evm/v1/cosmos_account/{address}"; + } + + // ValidatorAccount queries an Ethereum account's from a validator consensus + // Address. + rpc ValidatorAccount(QueryValidatorAccountRequest) + returns (QueryValidatorAccountResponse) { + option (google.api.http).get = + "/stratos/evm/v1/validator_account/{cons_address}"; + } + + // Balance queries the balance of a the EVM denomination for a single + // EthAccount. + rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { + option (google.api.http).get = "/stratos/evm/v1/balances/{address}"; + } + + // Storage queries the balance of all coins for a single account. + rpc Storage(QueryStorageRequest) returns (QueryStorageResponse) { + option (google.api.http).get = "/stratos/evm/v1/storage/{address}/{key}"; + } + + // Code queries the balance of all coins for a single account. + rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { + option (google.api.http).get = "/stratos/evm/v1/codes/{address}"; + } + + // Params queries the parameters of x/evm module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/stratos/evm/v1/params"; + } + + // EthCall implements the `eth_call` rpc api + rpc EthCall(EthCallRequest) returns (MsgEthereumTxResponse) { + option (google.api.http).get = "/stratos/evm/v1/eth_call"; + } + + // EstimateGas implements the `eth_estimateGas` rpc api + rpc EstimateGas(EthCallRequest) returns (EstimateGasResponse) { + option (google.api.http).get = "/stratos/evm/v1/estimate_gas"; + } + + // TraceTx implements the `debug_traceTransaction` rpc api + rpc TraceTx(QueryTraceTxRequest) returns (QueryTraceTxResponse) { + option (google.api.http).get = "/stratos/evm/v1/trace_tx"; + } + + // TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api + rpc TraceBlock(QueryTraceBlockRequest) returns (QueryTraceBlockResponse) { + option (google.api.http).get = "/stratos/evm/v1/trace_block"; + } + + // BaseFee queries the base fee of the parent block of the current block. + rpc QueryBaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) { + option (google.api.http).get = "/stratos/evm/v1/base_fee"; + } + + // BlockGas queries the gas used at a given block height + rpc BlockGas(QueryBlockGasRequest) returns (QueryBlockGasResponse) { + option (google.api.http).get = "/stratos/evm/v1/block_gas"; + } +} + +// QueryAccountRequest is the request type for the Query/Account RPC method. +message QueryAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the account for. + string address = 1; +} + +// QueryAccountResponse is the response type for the Query/Account RPC method. +message QueryAccountResponse { + // balance is the balance of the EVM denomination. + string balance = 1; + // code hash is the hex-formatted code bytes from the EOA. + string code_hash = 2; + // nonce is the account's sequence number. + uint64 nonce = 3; +} + +// QueryCosmosAccountRequest is the request type for the Query/CosmosAccount RPC +// method. +message QueryCosmosAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the account for. + string address = 1; +} + +// QueryCosmosAccountResponse is the response type for the Query/CosmosAccount +// RPC method. +message QueryCosmosAccountResponse { + // cosmos_address is the cosmos address of the account. + string cosmos_address = 1; + // sequence is the account's sequence number. + uint64 sequence = 2; + // account_number is the account numbert + uint64 account_number = 3; +} + +// QueryValidatorAccountRequest is the request type for the +// Query/ValidatorAccount RPC method. +message QueryValidatorAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // cons_address is the validator cons address to query the account for. + string cons_address = 1; +} + +// QueryValidatorAccountResponse is the response type for the +// Query/ValidatorAccount RPC method. +message QueryValidatorAccountResponse { + // account_address is the cosmos address of the account in bech32 format. + string account_address = 1; + // sequence is the account's sequence number. + uint64 sequence = 2; + // account_number is the account number + uint64 account_number = 3; +} + +// QueryBalanceRequest is the request type for the Query/Balance RPC method. +message QueryBalanceRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the balance for. + string address = 1; +} + +// QueryBalanceResponse is the response type for the Query/Balance RPC method. +message QueryBalanceResponse { + // balance is the balance of the EVM denomination. + string balance = 1; +} + +// QueryStorageRequest is the request type for the Query/Storage RPC method. +message QueryStorageRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + /// address is the ethereum hex address to query the storage state for. + string address = 1; + + // key defines the key of the storage state + string key = 2; +} + +// QueryStorageResponse is the response type for the Query/Storage RPC +// method. +message QueryStorageResponse { + // key defines the storage state value hash associated with the given key. + string value = 1; +} + +// QueryCodeRequest is the request type for the Query/Code RPC method. +message QueryCodeRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the ethereum hex address to query the code for. + string address = 1; +} + +// QueryCodeResponse is the response type for the Query/Code RPC +// method. +message QueryCodeResponse { + // code represents the code bytes from an ethereum address. + bytes code = 1; +} + +// QueryTxLogsRequest is the request type for the Query/TxLogs RPC method. +message QueryTxLogsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // hash is the ethereum transaction hex hash to query the logs for. + string hash = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryTxLogs is the response type for the Query/TxLogs RPC method. +message QueryTxLogsResponse { + // logs represents the ethereum logs generated from the given transaction. + repeated Log logs = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryParamsRequest defines the request type for querying x/evm parameters. +message QueryParamsRequest {} + +// QueryParamsResponse defines the response type for querying x/evm parameters. +message QueryParamsResponse { + // params define the evm module parameters. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +// EthCallRequest defines EthCall request +message EthCallRequest { + // same json format as the json rpc api. + bytes args = 1; + // the default gas cap to be used + uint64 gas_cap = 2; +} + +// EstimateGasResponse defines EstimateGas response +message EstimateGasResponse { + // the estimated gas + uint64 gas = 1; +} + +// QueryTraceTxRequest defines TraceTx request +message QueryTraceTxRequest { + // msgEthereumTx for the requested transaction + MsgEthereumTx msg = 1; + // TraceConfig holds extra parameters to trace functions. + TraceConfig trace_config = 2; + // the predecessor transactions included in the same block + // need to be replayed first to get correct context for tracing. + repeated MsgEthereumTx predecessors = 3; + // block number of requested transaction + int64 block_number = 4; + // block hex hash of requested transaction + string block_hash = 5; + // block time of requested transaction + google.protobuf.Timestamp block_time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// QueryTraceTxResponse defines TraceTx response +message QueryTraceTxResponse { + // response serialized in bytes + bytes data = 1; +} + +// QueryTraceBlockRequest defines TraceTx request +message QueryTraceBlockRequest { + // txs messages in the block + repeated MsgEthereumTx txs = 1; + // TraceConfig holds extra parameters to trace functions. + TraceConfig trace_config = 3; + // block number + int64 block_number = 5; + // block hex hash + string block_hash = 6; + // block time + google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// QueryTraceBlockResponse defines TraceBlock response +message QueryTraceBlockResponse { + bytes data = 1; +} + + +// QueryBaseFeeRequest defines the request type for querying the EIP1559 base +// fee. +message QueryBaseFeeRequest {} + +// BaseFeeResponse returns the EIP1559 base fee. +message QueryBaseFeeResponse { + string base_fee = 1 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; +} + +// QueryBlockGasRequest defines the request type for querying the EIP1559 base +// fee. +message QueryBlockGasRequest {} + +// QueryBlockGasResponse returns block gas used for a given height. +message QueryBlockGasResponse { int64 gas = 1; } \ No newline at end of file diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto new file mode 100644 index 00000000..f41fff44 --- /dev/null +++ b/proto/stratos/register/v1/register.proto @@ -0,0 +1,82 @@ +syntax = "proto3"; +package stratos.register.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +import "cosmos_proto/cosmos.proto"; +import "cosmos/staking/v1beta1/staking.proto"; + + +option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; + +// Params defines the Register module parameters +message Params { + string bond_denom = 1 [ (gogoproto.moretags) = "yaml:\"bond_denom\",omitempty" ]; + string unbonding_threashold_time = 2 [(gogoproto.moretags) = "yaml:\"unbonding_threashold_time\"" ]; + string unbonding_completion_time = 3 [ (gogoproto.moretags) = "yaml:\"unbonding_completion_time\"" ]; + uint32 max_entries = 4 [ (gogoproto.moretags) = "yaml:\"max_entries\",omitempty" ]; +} + +message ResourceNode { + string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; + google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey",(gogoproto.moretags) = "yaml:\"pubkey\"" ]; + bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; + cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; + string tokens = 5 [ + (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tokens\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; + Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; + string nodeType = 8 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; + google.protobuf.Timestamp creation_time = 9 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"creation_time\"" + ]; +} + +message IndexingNode { + string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; + bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; + cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; + string tokens = 5 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"tokens\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; + Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; + google.protobuf.Timestamp creation_time = 9 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"creation_time\"" + ]; +} + +message Description { + string moniker = 1 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"moniker\",omitempty" ]; + string identity = 2 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"identity\",omitempty" ]; + string Website = 3 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"website\",omitempty" ]; + string SecurityContact = 4 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; + string Details = 5 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"details\",omitempty" ]; +} + +message Slashing { + string WalletAddress = 1; + int64 Value = 2; +} + +message ResourceNodes { + repeated ResourceNode resourceNodes = 1; +} + +message IndexingNodes { + repeated IndexingNode indexingNodes = 1; +} diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto new file mode 100644 index 00000000..9a66a293 --- /dev/null +++ b/proto/stratos/register/v1/tx.proto @@ -0,0 +1,173 @@ +syntax = "proto3"; +package stratos.register.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; +import "stratos/register/v1/register.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; + +// Msg defines the evm Msg service. +service Msg { + // CreateResourceNode defines a method for creating a new resource node. + rpc CreateResourceNode(MsgCreateResourceNode) returns (MsgCreateResourceNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/create_resource_node"; + }; + rpc RemoveResourceNode(MsgRemoveResourceNode) returns (MsgRemoveResourceNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/remove_resource_node"; + }; + rpc UpdateResourceNode(MsgUpdateResourceNode) returns (MsgUpdateResourceNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_resource_node"; + }; + rpc UpdateResourceNodeStake(MsgUpdateResourceNodeStake) returns (MsgUpdateResourceNodeStakeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_resource_node_stake"; + }; + + rpc CreateIndexingNode(MsgCreateIndexingNode) returns (MsgCreateIndexingNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/create_indexing_node"; + }; + rpc RemoveIndexingNode(MsgRemoveResourceNode) returns (MsgRemoveIndexingNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/remove_indexing_node"; + }; + rpc UpdateIndexingNode(MsgUpdateIndexingNode) returns (MsgUpdateIndexingNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_indexing_node"; + }; + rpc UpdateIndexingNodeStake(MsgUpdateIndexingNodeStake) returns (MsgUpdateIndexingNodeStakeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_indexing_node_stake"; + }; + rpc IndexingNodeRegistrationVote(MsgIndexingNodeRegistrationVote) returns (MsgIndexingNodeRegistrationVoteResponse) { + option (google.api.http).post = "/stratos/register/v1/indexing_node_registration_vote"; + }; + +} + +// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +message MsgCreateResourceNode { + string networkAddr = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; + google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.moretags) = "yaml:\"pubkey\"" ]; + cosmos.base.v1beta1.Coin value = 3 [ (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"value\"" ]; + string ownerAddress = 4 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; + Description description = 5 [ (gogoproto.moretags) = "yaml:\"description\"" ]; + string nodeType = 6 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; +} + +// MsgCreateResourceNodeTxResponse defines the CreateResourceNodeTx response type +message MsgCreateResourceNodeResponse {} + +// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +message MsgCreateIndexingNode { + string networkAddr = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; + google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.moretags) = "yaml:\"pubkey\"" ]; + cosmos.base.v1beta1.Coin value = 3 [ (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"value\"" ]; + string ownerAddress = 4 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; + Description description = 5 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; +} + +// MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message +message MsgRemoveResourceNode { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string resource_node_address = 1 [(gogoproto.moretags) = "yaml:\"resource_node_address\""]; + string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; +} + +// MsgRemoveResourceNodeResponse defines the Msg/RemoveResourceNode response type. +message MsgRemoveResourceNodeResponse {} + +// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type +message MsgCreateIndexingNodeResponse {} + + +// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message +message MsgRemoveIndexingNode { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string indexing_node_address = 1 [(gogoproto.moretags) = "yaml:\"indexing_node_address\""]; + string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; +} + +// MsgRemoveIndexingNodeResponse defines the Msg/RemoveIndexingNode response type. +message MsgRemoveIndexingNodeResponse {} + + +// MsgUpdateResourceNode defines a SDK message for updating an existing resource node. +message MsgUpdateResourceNode { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + Description description = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"description\""]; + string network_address = 2 [(gogoproto.moretags) = "yaml:\"network_address\""]; + string owner_address = 3 [(gogoproto.moretags) = "yaml:\"owner_address\""]; + string nodeType = 4 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; +} + +// MsgUpdateResourceNodeResponse defines the Msg/UpdateResourceNode response type. +message MsgUpdateResourceNodeResponse {} + + +// MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. +message MsgUpdateIndexingNode { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + Description description = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"description\""]; + string network_address = 2 [(gogoproto.moretags) = "yaml:\"network_address\""]; + string owner_address = 3 [(gogoproto.moretags) = "yaml:\"owner_address\""]; +} + +// MsgUpdateIndexingNodeResponse defines the Msg/UpdateIndexingNode response type. +message MsgUpdateIndexingNodeResponse {} + + +// MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. +message MsgUpdateResourceNodeStake { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string network_address = 1 [(gogoproto.moretags) = "yaml:\"network_address\""]; + string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; + bool incrStake = 3 [ (gogoproto.moretags) = "yaml:\"incr_stake\"" ]; + cosmos.base.v1beta1.Coin StakeDelta = 4 [ (gogoproto.moretags) = "yaml:\"stake_delta\"" ]; +} + +// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. +message MsgUpdateResourceNodeStakeResponse {} + + +// MsgUpdateIndexingNodeStake defines a SDK message for updating the stake of an existing indexing node. +message MsgUpdateIndexingNodeStake { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string network_address = 1 [(gogoproto.moretags) = "yaml:\"network_address\""]; + string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; + bool incrStake = 3 [ (gogoproto.moretags) = "yaml:\"incr_stake\"" ]; + cosmos.base.v1beta1.Coin StakeDelta = 4 [ (gogoproto.moretags) = "yaml:\"stake_delta\"" ]; +} + +// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. +message MsgUpdateIndexingNodeStakeResponse {} + +// MsgIndexingNodeRegistrationVote defines a SDK message for registration vote of an existing indexing node. +message MsgIndexingNodeRegistrationVote { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string candidate_network_address = 1 [(gogoproto.moretags) = "yaml:\"candidate_network_address\""]; // node address of indexing node + string candidate_owner_address = 2 [(gogoproto.moretags) = "yaml:\"candidate_owner_address\""]; // owner address of indexing node + bool opinion = 3 [ (gogoproto.moretags) = "yaml:\"opinion\"" ]; + string voter_network_address = 4 [(gogoproto.moretags) = "yaml:\"voter_network_address\""]; // address of voter (other existed indexing node) + string voter_owner_address = 5 [(gogoproto.moretags) = "yaml:\"voter_owner_address\""]; // address of owner of the voter (other existed indexing node) +} + +// MsgUpdateResourceNodeStakeResponse defines the Msg/IndexingNodeRegistrationVote response type. +message MsgIndexingNodeRegistrationVoteResponse {} diff --git a/x/register/types/codec.go b/x/register/types/codec.go index be3618f9..b8d329ca 100644 --- a/x/register/types/codec.go +++ b/x/register/types/codec.go @@ -2,11 +2,16 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/cosmos/cosmos-sdk/x/authz" ) -// RegisterCodec registers concrete types on codec -func RegisterCodec(cdc *codec.Codec) { - cdc.RegisterConcrete(MsgCreateResourceNode{}, "register/CreateResourceNodeTx", nil) +// RegisterLegacyAminoCodec registers concrete types on codec +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(MsgCreateResourceNode{}, "register/CreateResourceNode", nil) cdc.RegisterConcrete(MsgRemoveResourceNode{}, "register/RemoveResourceNodeTx", nil) cdc.RegisterConcrete(MsgUpdateResourceNode{}, "register/UpdateResourceNodeTx", nil) cdc.RegisterConcrete(MsgUpdateResourceNodeStake{}, "register/UpdateResourceNodeStakeTx", nil) @@ -15,16 +20,41 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgRemoveIndexingNode{}, "register/RemoveIndexingNodeTx", nil) cdc.RegisterConcrete(MsgUpdateIndexingNode{}, "register/UpdateIndexingNodeTx", nil) cdc.RegisterConcrete(MsgUpdateIndexingNodeStake{}, "register/UpdateIndexingNodeStakeTx", nil) - cdc.RegisterConcrete(MsgIndexingNodeRegistrationVote{}, "register/MsgIndexingNodeRegistrationVote", nil) } -// ModuleCdc defines the module codec -var ModuleCdc *codec.Codec +// RegisterInterfaces registers the x/register interfaces types with the interface registry +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateResourceNode{}, + //&MsgEditValidator{}, + //&MsgDelegate{}, + //&MsgUndelegate{}, + //&MsgBeginRedelegate{}, + ) + registry.RegisterImplementations( + (*authz.Authorization)(nil), + //&StakeAuthorization{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} +var ( + amino = codec.NewLegacyAmino() + + // ModuleCdc references the global x/register module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/register and + // defined at the application level. + ModuleCdc = codec.NewAminoCodec(amino) +) + +// ModuleCdc defines the module codec func init() { - ModuleCdc = codec.New() - RegisterCodec(ModuleCdc) - codec.RegisterCrypto(ModuleCdc) - ModuleCdc.Seal() + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() } diff --git a/x/register/types/errors.go b/x/register/types/errors.go index 3015b4f3..91fcf1f9 100644 --- a/x/register/types/errors.go +++ b/x/register/types/errors.go @@ -4,49 +4,98 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +const ( + codeErrInvalid = uint32(iota) + 2 // NOTE: code 1 is reserved for internal errors + codeErrInvalidNetworkAddr + codeErrEmptyOwnerAddr + codeErrValueNegative + codeErrEmptyDescription + codeErrEmptyMoniker + codeErrEmptyResourceNodeAddr + codeErrEmptyIndexingNodeAddr + codeErrBadDenom + codeErrResourceNodePubKeyExists + codeErrIndexingNodePubKeyExists + codeErrNoResourceNodeFound + codeErrNoIndexingNodeFound + codeErrNoOwnerAccountFound + codeErrInsufficientBalance + codeErrNodeType + codeErrEmptyCandidateNetworkAddr + codeErrEmptyCandidateOwnerAddr + codeErrEmptyVoterNetworkAddr + codeErrEmptyVoterOwnerAddr + codeErrSameAddr + codeErrInvalidOwnerAddr + codeErrInvalidVoterAddr + codeErrInvalidVoterStatus + codeEcoderrNoRegistrationVotePoolFound + codeErrDuplicateVoting + codeErrVoteExpired + codeErrInsufficientBalanceOfBondedPool + codeErrInsufficientBalanceOfNotBondedPool + codeErrSubAllTokens + codeErrED25519InvalidPubKey + codeErrEmptyNodeNetworkAddress + codeErrEmptyPubKey + codeErrInvalidGenesisToken + codeErrNoUnbondingNode + codeErrMaxUnbondingNodeEntries + codeErrNoNodeForAddress + codeErrUnbondingNode + codeErrInvalidNodeStatBonded + codeErrInitialUOzonePrice + codeErrInvalidStakeChange + codeErrTotalUnissuedPrepay + codeErrInvalidNodeType + codeErrUnknownAccountAddress + codeErrUnknownPubKey +) + var ( - ErrInvalid = sdkerrors.Register(ModuleName, 1, "error invalid") - ErrInvalidNetworkAddr = sdkerrors.Register(ModuleName, 2, "invalid network address") - ErrEmptyOwnerAddr = sdkerrors.Register(ModuleName, 3, "missing owner address") - ErrValueNegative = sdkerrors.Register(ModuleName, 4, "value must be positive") - ErrEmptyDescription = sdkerrors.Register(ModuleName, 5, "description must be not empty") - ErrEmptyMoniker = sdkerrors.Register(ModuleName, 6, "moniker must be not empty") - ErrEmptyResourceNodeAddr = sdkerrors.Register(ModuleName, 7, "missing resource node address") - ErrEmptyIndexingNodeAddr = sdkerrors.Register(ModuleName, 8, "missing indexing node address") - ErrBadDenom = sdkerrors.Register(ModuleName, 9, "invalid coin denomination") - ErrResourceNodePubKeyExists = sdkerrors.Register(ModuleName, 10, "resource node already exist for this pubkey; must use new resource node pubkey") - ErrIndexingNodePubKeyExists = sdkerrors.Register(ModuleName, 11, "indexing node already exist for this pubkey; must use new indexing node pubkey") - ErrNoResourceNodeFound = sdkerrors.Register(ModuleName, 12, "resource node does not exist") - ErrNoIndexingNodeFound = sdkerrors.Register(ModuleName, 13, "indexing node does not exist") - ErrNoOwnerAccountFound = sdkerrors.Register(ModuleName, 14, "account of owner does not exist") - ErrInsufficientBalance = sdkerrors.Register(ModuleName, 15, "insufficient balance") - ErrNodeType = sdkerrors.Register(ModuleName, 16, "node type(s) not supported") - ErrEmptyCandidateNetworkAddr = sdkerrors.Register(ModuleName, 17, "missing candidate network address") - ErrEmptyCandidateOwnerAddr = sdkerrors.Register(ModuleName, 18, "missing candidate owner address") - ErrEmptyVoterNetworkAddr = sdkerrors.Register(ModuleName, 19, "missing voter network address") - ErrEmptyVoterOwnerAddr = sdkerrors.Register(ModuleName, 20, "missing voter owner address") - ErrSameAddr = sdkerrors.Register(ModuleName, 21, "node address should not same as the voter address") - ErrInvalidOwnerAddr = sdkerrors.Register(ModuleName, 22, "invalid owner address") - ErrInvalidVoterAddr = sdkerrors.Register(ModuleName, 23, "invalid voter address") - ErrInvalidVoterStatus = sdkerrors.Register(ModuleName, 24, "invalid voter status") - ErrNoRegistrationVotePoolFound = sdkerrors.Register(ModuleName, 25, "registration pool does not exist") - ErrDuplicateVoting = sdkerrors.Register(ModuleName, 26, "duplicate voting") - ErrVoteExpired = sdkerrors.Register(ModuleName, 27, "vote expired") - ErrInsufficientBalanceOfBondedPool = sdkerrors.Register(ModuleName, 28, "insufficient balance of bonded pool") - ErrInsufficientBalanceOfNotBondedPool = sdkerrors.Register(ModuleName, 29, "insufficient balance of not bonded pool") - ErrSubAllTokens = sdkerrors.Register(ModuleName, 30, "can not sub all tokens since the node is still bonded") - ErrED25519InvalidPubKey = sdkerrors.Register(ModuleName, 31, "ED25519 public keys are unsupported") - ErrEmptyNodeId = sdkerrors.Register(ModuleName, 32, "missing node id") - ErrEmptyPubKey = sdkerrors.Register(ModuleName, 33, "missing public key") - ErrInvalidGenesisToken = sdkerrors.Register(ModuleName, 34, "invalid genesis token") - ErrNoUnbondingNode = sdkerrors.Register(ModuleName, 35, "no unbonding node found") - ErrMaxUnbondingNodeEntries = sdkerrors.Register(ModuleName, 36, "too many unbonding node entries for networkAddr tuple") - ErrNoNodeForAddress = sdkerrors.Register(ModuleName, 37, "registered node does not contain address") - ErrUnbondingNode = sdkerrors.Register(ModuleName, 38, "changes cannot be made to an unbonding node") - ErrInvalidNodeStatBonded = sdkerrors.Register(ModuleName, 39, "invalid node status: bonded") - ErrInitialUOzonePrice = sdkerrors.Register(ModuleName, 40, "initial uOzone price must be positive") - ErrInvalidStakeChange = sdkerrors.Register(ModuleName, 41, "invalid change for stake") - ErrTotalUnissuedPrepay = sdkerrors.Register(ModuleName, 42, "total unissued prepay must be non-negative") - ErrInvalidNodeType = sdkerrors.Register(ModuleName, 43, "invalid node type") - ErrUnknownAccountAddress = sdkerrors.Register(ModuleName, 44, "account address does not exist") + ErrInvalid = sdkerrors.Register(ModuleName, codeErrInvalid, "error invalid") + ErrInvalidNetworkAddr = sdkerrors.Register(ModuleName, codeErrInvalidNetworkAddr, "invalid network address") + ErrEmptyOwnerAddr = sdkerrors.Register(ModuleName, codeErrEmptyOwnerAddr, "missing owner address") + ErrValueNegative = sdkerrors.Register(ModuleName, codeErrValueNegative, "value must be positive") + ErrEmptyDescription = sdkerrors.Register(ModuleName, codeErrEmptyDescription, "description must be not empty") + ErrEmptyMoniker = sdkerrors.Register(ModuleName, codeErrEmptyMoniker, "moniker must be not empty") + ErrEmptyResourceNodeAddr = sdkerrors.Register(ModuleName, codeErrEmptyResourceNodeAddr, "missing resource node address") + ErrEmptyIndexingNodeAddr = sdkerrors.Register(ModuleName, codeErrEmptyIndexingNodeAddr, "missing indexing node address") + ErrBadDenom = sdkerrors.Register(ModuleName, codeErrBadDenom, "invalid coin denomination") + ErrResourceNodePubKeyExists = sdkerrors.Register(ModuleName, codeErrResourceNodePubKeyExists, "resource node already exist for this pubkey; must use new resource node pubkey") + ErrIndexingNodePubKeyExists = sdkerrors.Register(ModuleName, codeErrIndexingNodePubKeyExists, "indexing node already exist for this pubkey; must use new indexing node pubkey") + ErrNoResourceNodeFound = sdkerrors.Register(ModuleName, codeErrNoResourceNodeFound, "resource node does not exist") + ErrNoIndexingNodeFound = sdkerrors.Register(ModuleName, codeErrNoIndexingNodeFound, "indexing node does not exist") + ErrNoOwnerAccountFound = sdkerrors.Register(ModuleName, codeErrNoOwnerAccountFound, "account of owner does not exist") + ErrInsufficientBalance = sdkerrors.Register(ModuleName, codeErrInsufficientBalance, "insufficient balance") + ErrNodeType = sdkerrors.Register(ModuleName, codeErrNodeType, "node type(s) not supported") + ErrEmptyCandidateNetworkAddr = sdkerrors.Register(ModuleName, codeErrEmptyCandidateNetworkAddr, "missing candidate network address") + ErrEmptyCandidateOwnerAddr = sdkerrors.Register(ModuleName, codeErrEmptyCandidateOwnerAddr, "missing candidate owner address") + ErrEmptyVoterNetworkAddr = sdkerrors.Register(ModuleName, codeErrEmptyVoterNetworkAddr, "missing voter network address") + ErrEmptyVoterOwnerAddr = sdkerrors.Register(ModuleName, codeErrEmptyVoterOwnerAddr, "missing voter owner address") + ErrSameAddr = sdkerrors.Register(ModuleName, codeErrSameAddr, "node address should not same as the voter address") + ErrInvalidOwnerAddr = sdkerrors.Register(ModuleName, codeErrInvalidOwnerAddr, "invalid owner address") + ErrInvalidVoterAddr = sdkerrors.Register(ModuleName, codeErrInvalidVoterAddr, "invalid voter address") + ErrInvalidVoterStatus = sdkerrors.Register(ModuleName, codeErrInvalidVoterStatus, "invalid voter status") + ErrNoRegistrationVotePoolFound = sdkerrors.Register(ModuleName, codeEcoderrNoRegistrationVotePoolFound, "registration pool does not exist") + ErrDuplicateVoting = sdkerrors.Register(ModuleName, codeErrDuplicateVoting, "duplicate voting") + ErrVoteExpired = sdkerrors.Register(ModuleName, codeErrVoteExpired, "vote expired") + ErrInsufficientBalanceOfBondedPool = sdkerrors.Register(ModuleName, codeErrInsufficientBalanceOfBondedPool, "insufficient balance of bonded pool") + ErrInsufficientBalanceOfNotBondedPool = sdkerrors.Register(ModuleName, codeErrInsufficientBalanceOfNotBondedPool, "insufficient balance of not bonded pool") + ErrSubAllTokens = sdkerrors.Register(ModuleName, codeErrSubAllTokens, "can not sub all tokens since the node is still bonded") + ErrED25519InvalidPubKey = sdkerrors.Register(ModuleName, codeErrED25519InvalidPubKey, "ED25519 public keys are unsupported") + ErrEmptyNodeNetworkAddress = sdkerrors.Register(ModuleName, codeErrEmptyNodeNetworkAddress, "missing node network address") + ErrEmptyPubKey = sdkerrors.Register(ModuleName, codeErrEmptyPubKey, "missing public key") + ErrInvalidGenesisToken = sdkerrors.Register(ModuleName, codeErrInvalidGenesisToken, "invalid genesis token") + ErrNoUnbondingNode = sdkerrors.Register(ModuleName, codeErrNoUnbondingNode, "no unbonding node found") + ErrMaxUnbondingNodeEntries = sdkerrors.Register(ModuleName, codeErrMaxUnbondingNodeEntries, "too many unbonding node entries for networkAddr tuple") + ErrNoNodeForAddress = sdkerrors.Register(ModuleName, codeErrNoNodeForAddress, "registered node does not contain address") + ErrUnbondingNode = sdkerrors.Register(ModuleName, codeErrUnbondingNode, "changes cannot be made to an unbonding node") + ErrInvalidNodeStatBonded = sdkerrors.Register(ModuleName, codeErrInvalidNodeStatBonded, "invalid node status: bonded") + ErrInitialUOzonePrice = sdkerrors.Register(ModuleName, codeErrInitialUOzonePrice, "initial uOzone price must be positive") + ErrInvalidStakeChange = sdkerrors.Register(ModuleName, codeErrInvalidStakeChange, "invalid change for stake") + ErrTotalUnissuedPrepay = sdkerrors.Register(ModuleName, codeErrTotalUnissuedPrepay, "total unissued prepay must be non-negative") + ErrInvalidNodeType = sdkerrors.Register(ModuleName, codeErrInvalidNodeType, "invalid node type") + ErrUnknownAccountAddress = sdkerrors.Register(ModuleName, codeErrUnknownAccountAddress, "account address does not exist") + ErrUnknownPubKey = sdkerrors.Register(ModuleName, codeErrUnknownPubKey, "unknown pubKey ") ) diff --git a/x/register/types/expected_keepers.go b/x/register/types/expected_keepers.go index 65a96d8e..bea3e174 100644 --- a/x/register/types/expected_keepers.go +++ b/x/register/types/expected_keepers.go @@ -2,7 +2,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/params" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" stratos "github.com/stratosnet/stratos-chain/types" @@ -26,10 +26,38 @@ type BankKeeper interface { } */ +// AccountKeeper defines the expected account keeper (noalias) +//type AccountKeeper interface { +// IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool)) +// GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account // only used for simulation +//} + // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { - IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool)) - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account // only used for simulation + IterateAccounts(ctx sdk.Context, process func(authtypes.AccountI) (stop bool)) + GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // only used for simulation + + GetModuleAddress(name string) sdk.AccAddress + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + + // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 + SetModuleAccount(sdk.Context, authtypes.ModuleAccountI) +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + + GetSupply(ctx sdk.Context, denom string) sdk.Coin + + SendCoinsFromModuleToModule(ctx sdk.Context, senderPool, recipientPool string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + + BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error } // SupplyKeeper defines the expected supply Keeper (noalias) diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 9074e55f..87f3fcfa 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -8,23 +8,13 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -// GenesisState - all register state that must be provided at genesis -type GenesisState struct { - Params Params `json:"params" yaml:"params"` - ResourceNodes ResourceNodes `json:"resource_nodes" yaml:"resource_nodes"` - IndexingNodes IndexingNodes `json:"indexing_nodes" yaml:"indexing_nodes"` - InitialUozPrice sdk.Dec `json:"initial_uoz_price" yaml:"initial_uoz_price"` //initial price of uoz - TotalUnissuedPrepay sdk.Int `json:"total_unissued_prepay" yaml:"total_unissued_prepay"` - SlashingInfo []Slashing `json:"slashing_info" yaml:"slashing_info"` -} - // NewGenesisState creates a new GenesisState object -func NewGenesisState(params Params, - resourceNodes ResourceNodes, - indexingNodes IndexingNodes, +func NewGenesisState(params *Params, + resourceNodes *ResourceNodes, + indexingNodes *IndexingNodes, initialUOzonePrice sdk.Dec, totalUnissuedPrepay sdk.Int, - slashingInfo []Slashing, + slashingInfo []*Slashing, ) GenesisState { return GenesisState{ Params: params, @@ -32,23 +22,23 @@ func NewGenesisState(params Params, IndexingNodes: indexingNodes, InitialUozPrice: initialUOzonePrice, TotalUnissuedPrepay: totalUnissuedPrepay, - SlashingInfo: slashingInfo, + Slashing: slashingInfo, } } // DefaultGenesisState - default GenesisState used by Cosmos Hub -func DefaultGenesisState() GenesisState { - return GenesisState{ +func DefaultGenesisState() *GenesisState { + return &GenesisState{ Params: DefaultParams(), InitialUozPrice: DefaultUozPrice, TotalUnissuedPrepay: DefaultTotalUnissuedPrepay, - SlashingInfo: make([]Slashing, 0), + Slashing: make([]*Slashing, 0), } } // GetGenesisStateFromAppState returns x/auth GenesisState given raw application // genesis state. -func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState { +func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) GenesisState { var genesisState GenesisState if appState[ModuleName] != nil { cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) @@ -59,17 +49,17 @@ func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawM // ValidateGenesis validates the register genesis parameters func ValidateGenesis(data GenesisState) error { - if err := data.Params.Validate(); err != nil { + if err := data.GetParams().Validate(); err != nil { return err } - if err := data.ResourceNodes.Validate(); err != nil { + if err := data.GetResourceNodes().Validate(); err != nil { return err } - if err := data.IndexingNodes.Validate(); err != nil { + if err := data.GetIndexingNodes().Validate(); err != nil { return err } - if data.InitialUozPrice.LTE(sdk.ZeroDec()) { + if (data.InitialUozPrice).LTE(sdk.ZeroDec()) { return ErrInitialUOzonePrice } @@ -79,27 +69,12 @@ func ValidateGenesis(data GenesisState) error { return nil } -type GenesisIndexingNode struct { - NetworkAddr string `json:"network_address" yaml:"network_address"` // network address of the indexing node - PubKey string `json:"pubkey" yaml:"pubkey"` // the consensus public key of the indexing node; bech encoded in JSON - Suspend bool `json:"suspend" yaml:"suspend"` // has the indexing node been suspended from bonded status? - Status sdk.BondStatus `json:"status" yaml:"status"` // indexing node status (bonded/unbonding/unbonded) - Tokens string `json:"tokens" yaml:"tokens"` // delegated tokens - OwnerAddress string `json:"owner_address" yaml:"owner_address"` // owner address of the indexing node - Description Description `json:"description" yaml:"description"` // description terms for the indexing node -} - func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { - pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, v.PubKey) + _, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, v.PubKey.String()) if err != nil { panic(err) } - tokens, ok := sdk.NewIntFromString(v.Tokens) - if !ok { - panic(ErrInvalidGenesisToken) - } - ownerAddress, err := sdk.AccAddressFromBech32(v.OwnerAddress) if err != nil { panic(err) @@ -111,24 +86,19 @@ func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { } return IndexingNode{ - NetworkAddr: netAddr, - PubKey: pubKey, - Suspend: v.Suspend, - Status: v.Status, - Tokens: tokens, - OwnerAddress: ownerAddress, - Description: v.Description, + NetworkAddr: netAddr.String(), + PubKey: v.GetPubKey(), + Suspend: v.GetSuspend(), + Status: v.GetStatus(), + Tokens: v.Token, + OwnerAddress: ownerAddress.String(), + Description: v.GetDescription(), } } -type Slashing struct { - WalletAddress sdk.AccAddress - Value sdk.Int -} - func NewSlashing(walletAddress sdk.AccAddress, value sdk.Int) Slashing { return Slashing{ - WalletAddress: walletAddress, - Value: value, + WalletAddress: walletAddress.String(), + Value: value.Int64(), } } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go new file mode 100644 index 00000000..8376106d --- /dev/null +++ b/x/register/types/genesis.pb.go @@ -0,0 +1,1107 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/register/v1/genesis.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/regen-network/cosmos-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 register module's genesis state. +type GenesisState struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` + ResourceNodes *ResourceNodes `protobuf:"bytes,2,opt,name=resourceNodes,proto3" json:"resourceNodes,omitempty" yaml:"resource_nodes"` + IndexingNodes *IndexingNodes `protobuf:"bytes,3,opt,name=indexingNodes,proto3" json:"indexingNodes,omitempty" yaml:"indexing_nodes"` + InitialUozPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=initialUozPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initialUozPrice" yaml:"initial_uoz_price"` + TotalUnissuedPrepay github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=totalUnissuedPrepay,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"totalUnissuedPrepay" yaml:"total_unissued_prepay"` + Slashing []*Slashing `protobuf:"bytes,6,rep,name=slashing,proto3" json:"slashing,omitempty" yaml:"slashing_info"` +} + +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_5bdab54ebea9e48e, []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 nil +} + +func (m *GenesisState) GetResourceNodes() *ResourceNodes { + if m != nil { + return m.ResourceNodes + } + return nil +} + +func (m *GenesisState) GetIndexingNodes() *IndexingNodes { + if m != nil { + return m.IndexingNodes + } + return nil +} + +func (m *GenesisState) GetSlashing() []*Slashing { + if m != nil { + return m.Slashing + } + return nil +} + +type GenesisIndexingNode struct { + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Token github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=token,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token" yaml:"token"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` +} + +func (m *GenesisIndexingNode) Reset() { *m = GenesisIndexingNode{} } +func (m *GenesisIndexingNode) String() string { return proto.CompactTextString(m) } +func (*GenesisIndexingNode) ProtoMessage() {} +func (*GenesisIndexingNode) Descriptor() ([]byte, []int) { + return fileDescriptor_5bdab54ebea9e48e, []int{1} +} +func (m *GenesisIndexingNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisIndexingNode.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 *GenesisIndexingNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisIndexingNode.Merge(m, src) +} +func (m *GenesisIndexingNode) XXX_Size() int { + return m.Size() +} +func (m *GenesisIndexingNode) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisIndexingNode.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisIndexingNode proto.InternalMessageInfo + +func (m *GenesisIndexingNode) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *GenesisIndexingNode) GetPubKey() *types.Any { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *GenesisIndexingNode) GetSuspend() bool { + if m != nil { + return m.Suspend + } + return false +} + +func (m *GenesisIndexingNode) GetStatus() types1.BondStatus { + if m != nil { + return m.Status + } + return types1.Unspecified +} + +func (m *GenesisIndexingNode) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *GenesisIndexingNode) GetDescription() *Description { + if m != nil { + return m.Description + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "stratos.evm.v1.GenesisState") + proto.RegisterType((*GenesisIndexingNode)(nil), "stratos.evm.v1.GenesisIndexingNode") +} + +func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } + +var fileDescriptor_5bdab54ebea9e48e = []byte{ + // 741 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6a, 0xdb, 0x48, + 0x1c, 0xc7, 0xed, 0x4d, 0xe2, 0x24, 0x72, 0x92, 0x65, 0x15, 0xef, 0xa2, 0x64, 0x77, 0x2d, 0xef, + 0xb0, 0x2c, 0x59, 0x48, 0x24, 0x9c, 0xf6, 0x54, 0x42, 0x21, 0x22, 0xb4, 0xa4, 0xa5, 0xc1, 0xc8, + 0x0d, 0x85, 0x5e, 0xc4, 0x58, 0x9a, 0x28, 0x83, 0xed, 0x19, 0x31, 0x33, 0x72, 0xa2, 0x9c, 0xfa, + 0x08, 0x7d, 0x87, 0xbe, 0x42, 0x1f, 0x22, 0xf4, 0x94, 0x63, 0xe9, 0x41, 0x94, 0xe4, 0xde, 0x83, + 0x9f, 0xa0, 0x78, 0x66, 0x64, 0x2b, 0xc5, 0x14, 0x72, 0xf2, 0x8c, 0x7f, 0xdf, 0xdf, 0xe7, 0xcb, + 0xfc, 0xfe, 0xc8, 0xf8, 0x87, 0x0b, 0x06, 0x05, 0xe5, 0x2e, 0x43, 0x31, 0xe6, 0x02, 0x31, 0x77, + 0xd4, 0x76, 0x63, 0x44, 0x10, 0xc7, 0xdc, 0x49, 0x18, 0x15, 0xd4, 0xdc, 0xd0, 0x12, 0x07, 0x8d, + 0x86, 0xce, 0xa8, 0xbd, 0xbd, 0x15, 0x53, 0x1a, 0x0f, 0x90, 0x2b, 0xa3, 0xbd, 0xf4, 0xcc, 0x85, + 0x24, 0x53, 0xd2, 0xed, 0x46, 0x4c, 0x63, 0x2a, 0x8f, 0xee, 0xe4, 0xa4, 0xff, 0xdd, 0x0a, 0x29, + 0x1f, 0x52, 0x1e, 0xa8, 0x80, 0xba, 0xe8, 0x50, 0x53, 0xdd, 0xdc, 0x1e, 0xe4, 0xc8, 0x1d, 0xb5, + 0x7b, 0x48, 0xc0, 0xb6, 0x1b, 0x52, 0x4c, 0x74, 0xfc, 0x5f, 0x1d, 0xe7, 0x02, 0xf6, 0x31, 0x89, + 0xa7, 0x12, 0x7d, 0xd7, 0x2a, 0x30, 0xef, 0x11, 0xc5, 0x59, 0x69, 0xc0, 0xb7, 0x45, 0x63, 0xed, + 0xb9, 0x7a, 0x57, 0x57, 0x40, 0x81, 0xcc, 0x67, 0x46, 0x2d, 0x81, 0x0c, 0x0e, 0xb9, 0x55, 0x6d, + 0x55, 0x77, 0xea, 0xfb, 0x7f, 0x3a, 0xc5, 0x3b, 0xa7, 0x99, 0xa3, 0xb6, 0xd3, 0x91, 0x12, 0xef, + 0xb7, 0x71, 0x6e, 0xaf, 0x67, 0x70, 0x38, 0x78, 0x02, 0x54, 0x12, 0xf0, 0x75, 0xb6, 0x19, 0x1a, + 0xeb, 0x0c, 0x71, 0x9a, 0xb2, 0x10, 0x9d, 0xd0, 0x08, 0x71, 0xeb, 0x17, 0x89, 0x03, 0x73, 0x71, + 0x7e, 0x59, 0xe9, 0x6d, 0x8d, 0x73, 0xfb, 0x77, 0x45, 0x2d, 0x10, 0x01, 0x99, 0x44, 0x80, 0x7f, + 0x9f, 0x39, 0x31, 0xc1, 0x24, 0x42, 0x97, 0x98, 0xc4, 0xca, 0x64, 0xe1, 0x27, 0x26, 0xc7, 0x65, + 0x65, 0xd9, 0xa4, 0x40, 0x4c, 0x4d, 0xee, 0x31, 0x4d, 0x61, 0xfc, 0x8a, 0x09, 0x16, 0x18, 0x0e, + 0x4e, 0xe9, 0x55, 0x87, 0xe1, 0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, 0x35, 0x2b, 0x37, 0x77, 0xcd, 0xca, 0xe7, 0xbb, 0x66, 0xe5, 0xed, 0xe3, + 0xd2, 0xe3, 0xb5, 0x29, 0x41, 0xa2, 0x38, 0xee, 0x85, 0xe7, 0x10, 0x13, 0xf7, 0x72, 0xf6, 0xc9, + 0x93, 0xe5, 0xe8, 0xd5, 0xe4, 0x1c, 0x3c, 0xfa, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x75, 0x17, 0x3b, + 0xc4, 0xd8, 0x05, 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.Slashing) > 0 { + for iNdEx := len(m.Slashing) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Slashing[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + { + size := m.TotalUnissuedPrepay.Size() + i -= size + if _, err := m.TotalUnissuedPrepay.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.InitialUozPrice.Size() + i -= size + if _, err := m.InitialUozPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if m.IndexingNodes != nil { + { + size, err := m.IndexingNodes.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.ResourceNodes != nil { + { + size, err := m.ResourceNodes.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GenesisIndexingNode) 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 *GenesisIndexingNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Description != nil { + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x32 + } + { + size := m.Token.Size() + i -= size + if _, err := m.Token.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Status != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.Suspend { + i-- + if m.Suspend { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.NetworkAddr))) + 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 + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.ResourceNodes != nil { + l = m.ResourceNodes.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.IndexingNodes != nil { + l = m.IndexingNodes.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + l = m.InitialUozPrice.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.TotalUnissuedPrepay.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Slashing) > 0 { + for _, e := range m.Slashing { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *GenesisIndexingNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Suspend { + n += 2 + } + if m.Status != 0 { + n += 1 + sovGenesis(uint64(m.Status)) + } + l = m.Token.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Description != nil { + l = m.Description.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 m.Params == nil { + m.Params = &Params{} + } + 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 ResourceNodes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ResourceNodes == nil { + m.ResourceNodes = &ResourceNodes{} + } + if err := m.ResourceNodes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IndexingNodes == nil { + m.IndexingNodes = &IndexingNodes{} + } + if err := m.IndexingNodes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialUozPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InitialUozPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalUnissuedPrepay", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalUnissuedPrepay.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Slashing", 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.Slashing = append(m.Slashing, &Slashing{}) + if err := m.Slashing[len(m.Slashing)-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 (m *GenesisIndexingNode) 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: GenesisIndexingNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisIndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspend = bool(v != 0) + case 4: + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Description == nil { + m.Description = &Description{} + } + if err := m.Description.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/register/types/hooks.go b/x/register/types/hooks.go index 138e3b37..64bbc59a 100644 --- a/x/register/types/hooks.go +++ b/x/register/types/hooks.go @@ -5,7 +5,7 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -// combine multiple register hooks, all hook functions are run in array sequence +// MultiRegisterHooks combines multiple register hooks, all hook functions are run in array sequence type MultiRegisterHooks []RegisterHooks func NewMultiRegisterHooks(hooks ...RegisterHooks) MultiRegisterHooks { diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index 816d5e8a..a10109f1 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -3,50 +3,50 @@ package types import ( "bytes" "fmt" - "sort" - "strings" "time" - "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/tendermint/tendermint/crypto" + goamino "github.com/tendermint/go-amino" ) // IndexingNodes is a collection of indexing node -type IndexingNodes []IndexingNode - -func (v IndexingNodes) String() (out string) { - for _, node := range v { - out += node.String() + "\n" - } - return strings.TrimSpace(out) -} - -// Sort IndexingNodes sorts IndexingNode array in ascending owner address order -func (v IndexingNodes) Sort() { - sort.Sort(v) -} - -// Implements sort interface -func (v IndexingNodes) Len() int { - return len(v) -} - -// Implements sort interface -func (v IndexingNodes) Less(i, j int) bool { - return v[i].Tokens.LT(v[j].Tokens) -} - -// Implements sort interface -func (v IndexingNodes) Swap(i, j int) { - it := v[i] - v[i] = v[j] - v[j] = it -} +//type IndexingNodes []IndexingNode + +//func (v IndexingNodes) String() (out string) { +// for _, node := range v { +// out += node.String() + "\n" +// } +// return strings.TrimSpace(out) +//} + +//Sort IndexingNodes sorts IndexingNode array in ascending owner address order +//func (v IndexingNodes) Sort() { +// sort.Sort(v.GetIndexingNodes()) +//} + +//// Len Implements sort interface +//func (v IndexingNodes) Len() int { +// return len(v.GetIndexingNodes()) +//} +// +//// Less Implements sort interface +//func (v IndexingNodes) Less(i, j int) bool { +// return v.GetIndexingNodes()[i].Tokens < (v.GetIndexingNodes()[j].Tokens) +//} +// +//// Swap Implements sort interface +//func (v IndexingNodes) Swap(i, j int) { +// it := v.GetIndexingNodes()[i] +// v.GetIndexingNodes()[i] = v.GetIndexingNodes()[j] +// v.GetIndexingNodes()[j] = it +//} func (v IndexingNodes) Validate() error { - for _, node := range v { + for _, node := range v.GetIndexingNodes() { if err := node.Validate(); err != nil { return err } @@ -54,47 +54,45 @@ func (v IndexingNodes) Validate() error { return nil } -type IndexingNode struct { - NetworkAddr stratos.SdsAddress `json:"network_address" yaml:"network_address"` // network address - PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"` // the consensus public key of the indexing node; bech encoded in JSON - Suspend bool `json:"suspend" yaml:"suspend"` // has the indexing node been suspended from bonded status? - Status sdk.BondStatus `json:"status" yaml:"status"` // indexing node status (bonded/unbonding/unbonded) - Tokens sdk.Int `json:"tokens" yaml:"tokens"` // delegated tokens - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` // owner address of the indexing node - Description Description `json:"description" yaml:"description"` // description terms for the indexing node - CreationTime time.Time `json:"creation_time" yaml:"creation_time"` -} - // NewIndexingNode - initialize a new indexing node -func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress, description Description, creationTime time.Time) IndexingNode { +func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description *Description, creationTime time.Time) (IndexingNode, error) { + pkAny, err := codectypes.NewAnyWithValue(pubKey) + if err != nil { + return IndexingNode{}, err + } return IndexingNode{ - NetworkAddr: networkAddr, - PubKey: pubKey, + NetworkAddr: networkAddr.String(), + PubKey: pkAny, Suspend: true, - Status: sdk.Unbonded, + Status: stakingtypes.Unbonded, Tokens: sdk.ZeroInt(), - OwnerAddress: ownerAddr, + OwnerAddress: ownerAddr.String(), Description: description, CreationTime: creationTime, - } + }, nil } -// String returns a human readable string representation of a indexing node. -func (v IndexingNode) String() string { - pubKey, err := stratos.Bech32ifyPubKey(stratos.Bech32PubKeyTypeAccPub, v.PubKey) +// ConvertToString returns a human-readable string representation of an indexing node. +func (v IndexingNode) ConvertToString() string { + pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) if err != nil { - panic(err) + return ErrUnknownPubKey.Error() + } + pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeAccPub, pkAny.String()) + if err != nil { + return ErrUnknownPubKey.Error() } return fmt.Sprintf(`IndexingNode:{ - Network ID: %s - Pubkey: %s - Suspend: %v - Status: %s - Tokens: %s + Network Id: %s + Pubkey: %s + Suspend: %v + Status: %s + Tokens: %s Owner Address: %s - Description: %s + Description: %s CreationTime: %s - }`, v.NetworkAddr, pubKey, v.Suspend, v.Status, v.Tokens, v.OwnerAddress, v.Description, v.CreationTime) + }`, v.GetNetworkAddr(), pubKey, v.GetSuspend(), v.GetStatus(), + v.Tokens, v.GetOwnerAddress(), v.GetDescription(), v.GetCreationTime()) } // AddToken adds tokens to a indexing node @@ -104,34 +102,53 @@ func (v IndexingNode) AddToken(amount sdk.Int) IndexingNode { } // SubToken removes tokens from a indexing node -func (v IndexingNode) SubToken(tokens sdk.Int) IndexingNode { - if tokens.IsNegative() { - panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", tokens)) +func (v IndexingNode) SubToken(amount sdk.Int) IndexingNode { + if amount.IsNegative() { + panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", amount)) } - if v.Tokens.LT(tokens) { - panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, tokens)) + if v.Tokens.LT(amount) { + panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, amount)) } - v.Tokens = v.Tokens.Sub(tokens) + v.Tokens = v.Tokens.Sub(amount) return v } func (v IndexingNode) Validate() error { - if v.NetworkAddr.Empty() { - return ErrEmptyNodeId + netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddr()) + if err != nil { + return err + } + + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress + } + pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) + if err != nil { + return err } - if !v.NetworkAddr.Equals(stratos.SdsAddress(v.PubKey.Address())) { + sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) + if err != nil { + return err + } + if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } - if len(v.PubKey.Bytes()) == 0 { + if len(pkAny.String()) == 0 { return ErrEmptyPubKey } - if v.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(v.GetOwnerAddress()) + if err != nil { + return err + } + + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } if v.Tokens.LT(sdk.ZeroInt()) { return ErrValueNegative } - if v.Description.Moniker == "" { + if v.GetDescription().Moniker == "" { return ErrEmptyMoniker } return nil @@ -139,37 +156,26 @@ func (v IndexingNode) Validate() error { // IsBonded checks if the node status equals Bonded func (v IndexingNode) IsBonded() bool { - return v.GetStatus().Equal(sdk.Bonded) + return v.GetStatus() == stakingtypes.Bonded } // IsUnBonded checks if the node status equals Unbonded func (v IndexingNode) IsUnBonded() bool { - return v.GetStatus().Equal(sdk.Unbonded) + return v.GetStatus() == stakingtypes.Unbonded } // IsUnBonding checks if the node status equals Unbonding func (v IndexingNode) IsUnBonding() bool { - return v.GetStatus().Equal(sdk.Unbonding) -} - -func (v IndexingNode) IsSuspended() bool { return v.Suspend } -func (v IndexingNode) GetMoniker() string { return v.Description.Moniker } -func (v IndexingNode) GetStatus() sdk.BondStatus { return v.Status } -func (v IndexingNode) GetPubKey() crypto.PubKey { return v.PubKey } -func (v IndexingNode) GetNetworkAddr() stratos.SdsAddress { - return stratos.SdsAddress(v.PubKey.Address()) + return v.GetStatus() == stakingtypes.Unbonding } -func (v IndexingNode) GetTokens() sdk.Int { return v.Tokens } -func (v IndexingNode) GetOwnerAddr() sdk.AccAddress { return v.OwnerAddress } -func (v IndexingNode) GetCreationTime() time.Time { return v.CreationTime } // MustMarshalIndexingNode returns the indexingNode bytes. Panics if fails -func MustMarshalIndexingNode(cdc *codec.Codec, indexingNode IndexingNode) []byte { +func MustMarshalIndexingNode(cdc *goamino.Codec, indexingNode IndexingNode) []byte { return cdc.MustMarshalBinaryLengthPrefixed(indexingNode) } -// MustUnmarshalIndexingNode unmarshal a indexing node from a store value. Panics if fails -func MustUnmarshalIndexingNode(cdc *codec.Codec, value []byte) IndexingNode { +// MustUnmarshalIndexingNode unmarshal an indexing node from a store value. Panics if fails +func MustUnmarshalIndexingNode(cdc *goamino.Codec, value []byte) IndexingNode { indexingNode, err := UnmarshalIndexingNode(cdc, value) if err != nil { panic(err) @@ -177,8 +183,8 @@ func MustUnmarshalIndexingNode(cdc *codec.Codec, value []byte) IndexingNode { return indexingNode } -// UnmarshalIndexingNode unmarshal a indexing node from a store value -func UnmarshalIndexingNode(cdc *codec.Codec, value []byte) (indexingNode IndexingNode, err error) { +// UnmarshalIndexingNode unmarshal an indexing node from a store value +func UnmarshalIndexingNode(cdc *goamino.Codec, value []byte) (indexingNode IndexingNode, err error) { err = cdc.UnmarshalBinaryLengthPrefixed(value, &indexingNode) return indexingNode, err } @@ -230,8 +236,8 @@ func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []strat } } -func (indexingNode IndexingNode) Equal(indexingNode2 IndexingNode) bool { - bz1 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&indexingNode) - bz2 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&indexingNode2) +func (v1 IndexingNode) Equal(v2 IndexingNode) bool { + bz1 := goamino.MustMarshalBinaryLengthPrefixed(&v1) + bz2 := goamino.MustMarshalBinaryLengthPrefixed(&v2) return bytes.Equal(bz1, bz2) } diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 850d6d60..30bbee60 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -1,9 +1,12 @@ package types import ( + "strconv" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/tendermint/tendermint/crypto" ) // ensure Msg interface compliance at compile time @@ -19,148 +22,196 @@ var ( _ sdk.Msg = &MsgIndexingNodeRegistrationVote{} ) -type MsgCreateResourceNode struct { - NetworkAddr stratos.SdsAddress `json:"network_address" yaml:"network_address"` - PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"` - Value sdk.Coin `json:"value" yaml:"value"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` - Description Description `json:"description" yaml:"description"` - NodeType NodeType `json:"node_type" yaml:"node_type"` -} +// message type and route constants +const ( + // TypeMsgCreateResourceNodeTx defines the type string of an CreateResourceNodeTx transaction + TypeMsgCreateResourceNodeTx = "create_resource_node" + TypeMsgRemoveResourceNodeTx = "remove_resource_node" + TypeUpdateResourceNodeTx = "update_resource_node" + TypeUpdateResourceNodeStakeTx = "update_resource_node_stake" + TypeCreateIndexingNodeTx = "create_indexing_node" + TypeRemoveIndexingNodeTx = "remove_indexing_node" + TypeUpdateIndexingNodeTx = "update_indexing_node" + TypeUpdateIndexingNodeStakeTx = "update_indexing_node_stake" + TypeIndexingNodeRegistrationVoteTx = "indexing_node_registration_vote" +) // NewMsgCreateResourceNode NewMsg creates a new Msg instance -func NewMsgCreateResourceNode(networkAddr stratos.SdsAddress, pubKey crypto.PubKey, value sdk.Coin, - ownerAddr sdk.AccAddress, description Description, nodeType NodeType, -) MsgCreateResourceNode { - return MsgCreateResourceNode{ - NetworkAddr: networkAddr, - PubKey: pubKey, +func NewMsgCreateResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer + value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, nodeType *NodeType, +) (*MsgCreateResourceNode, error) { + var pkAny *codectypes.Any + if pubKey != nil { + var err error + if pkAny, err = codectypes.NewAnyWithValue(pubKey); err != nil { + return nil, err + } + } + return &MsgCreateResourceNode{ + NetworkAddr: networkAddr.String(), + PubKey: pkAny, Value: value, - OwnerAddress: ownerAddr, + OwnerAddress: ownerAddr.String(), Description: description, - NodeType: nodeType, - } + NodeType: nodeType.Type(), + }, nil } -func (msg MsgCreateResourceNode) Route() string { - return RouterKey -} +func (msg MsgCreateResourceNode) Route() string { return RouterKey } -func (msg MsgCreateResourceNode) Type() string { - return "create_resource_node" -} +func (msg MsgCreateResourceNode) Type() string { return TypeMsgCreateResourceNodeTx } // ValidateBasic validity check for the CreateResourceNode func (msg MsgCreateResourceNode) ValidateBasic() error { - if msg.NetworkAddr.Empty() { - return ErrEmptyNodeId + netAddr, err := stratos.SdsAddressFromBech32(msg.GetNetworkAddr()) + if err != nil { + return err } - if !msg.NetworkAddr.Equals(stratos.SdsAddress(msg.PubKey.Address())) { + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress + } + + pkAny, err := codectypes.NewAnyWithValue(msg.GetPubKey()) + if err != nil { + return err + } + sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) + if err != nil { + return err + } + if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } - if msg.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(msg.GetOwnerAddress()) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } - if !msg.Value.IsPositive() { + if !msg.GetValue().IsPositive() { return ErrValueNegative } - if msg.Description == (Description{}) { + if msg.GetDescription().Moniker == "" { + return ErrEmptyMoniker + } + + if *msg.GetDescription() == (Description{}) { return ErrEmptyDescription } - if msg.Description.Moniker == "" { - return ErrEmptyMoniker + + nodeTypeNum, err := strconv.Atoi(msg.GetNodeType()) + if err != nil { + return ErrInvalidNodeType } - if msg.NodeType > 7 || msg.NodeType < 1 { + if nodeTypeNum > 7 || nodeTypeNum < 1 { return ErrInvalidNodeType } return nil } func (msg MsgCreateResourceNode) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } func (msg MsgCreateResourceNode) GetSigners() []sdk.AccAddress { // Owner pays the tx fees - addrs := []sdk.AccAddress{msg.OwnerAddress} - return addrs -} - -type MsgCreateIndexingNode struct { - NetworkAddr stratos.SdsAddress `json:"network_addr" yaml:"network_addr"` - PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"` - Value sdk.Coin `json:"value" yaml:"value"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` - Description Description `json:"description" yaml:"description"` + addr, err := sdk.AccAddressFromBech32(msg.GetOwnerAddress()) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } // NewMsgCreateIndexingNode NewMsg creates a new Msg instance -func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey crypto.PubKey, value sdk.Coin, ownerAddr sdk.AccAddress, description Description, -) MsgCreateIndexingNode { - return MsgCreateIndexingNode{ - NetworkAddr: networkAddr, - PubKey: pubKey, +func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer + value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, +) (*MsgCreateResourceNode, error) { + var pkAny *codectypes.Any + if pubKey != nil { + var err error + if pkAny, err = codectypes.NewAnyWithValue(pubKey); err != nil { + return nil, err + } + } + return &MsgCreateResourceNode{ + NetworkAddr: networkAddr.String(), + PubKey: pkAny, Value: value, - OwnerAddress: ownerAddr, + OwnerAddress: ownerAddr.String(), Description: description, - } + }, nil } -func (msg MsgCreateIndexingNode) Route() string { - return RouterKey -} +func (msg MsgCreateIndexingNode) Route() string { return RouterKey } -func (msg MsgCreateIndexingNode) Type() string { - return "create_indexing_node" -} +func (msg MsgCreateIndexingNode) Type() string { return TypeCreateIndexingNodeTx } func (msg MsgCreateIndexingNode) ValidateBasic() error { - if msg.NetworkAddr.Empty() { - return ErrInvalidNetworkAddr + netAddr, err := stratos.SdsAddressFromBech32(msg.GetNetworkAddr()) + if err != nil { + return err + } + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress + } + + pkAny, err := codectypes.NewAnyWithValue(msg.GetPubKey()) + if err != nil { + return err } - if !msg.NetworkAddr.Equals(stratos.SdsAddress(msg.PubKey.Address())) { + sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) + if err != nil { + return err + } + if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } - if msg.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(msg.GetOwnerAddress()) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } - if !msg.Value.IsPositive() { + if !msg.GetValue().IsPositive() { return ErrValueNegative } - if msg.Description == (Description{}) { - return ErrEmptyDescription - } - if msg.Description.Moniker == "" { + if msg.GetDescription().Moniker == "" { return ErrEmptyMoniker } + + if *msg.GetDescription() == (Description{}) { + return ErrEmptyDescription + } return nil } func (msg MsgCreateIndexingNode) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } func (msg MsgCreateIndexingNode) GetSigners() []sdk.AccAddress { // Owner pays the tx fees - addrs := []sdk.AccAddress{msg.OwnerAddress} - return addrs -} + addr, err := sdk.AccAddressFromBech32(msg.GetOwnerAddress()) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} -// MsgRemoveResourceNode - struct for removing resource node -type MsgRemoveResourceNode struct { - ResourceNodeAddress stratos.SdsAddress `json:"resource_node_address" yaml:"resource_node_address"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` } // NewMsgRemoveResourceNode creates a new MsgRemoveResourceNode instance. -func NewMsgRemoveResourceNode(resourceNodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) MsgRemoveResourceNode { - return MsgRemoveResourceNode{ - ResourceNodeAddress: resourceNodeAddr, - OwnerAddress: ownerAddr, +func NewMsgRemoveResourceNode(resourceNodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) *MsgRemoveResourceNode { + return &MsgRemoveResourceNode{ + ResourceNodeAddress: resourceNodeAddr.String(), + OwnerAddress: ownerAddr.String(), } } @@ -168,41 +219,48 @@ func NewMsgRemoveResourceNode(resourceNodeAddr stratos.SdsAddress, ownerAddr sdk func (msg MsgRemoveResourceNode) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgRemoveResourceNode) Type() string { return "remove_resource_node" } +func (msg MsgRemoveResourceNode) Type() string { return TypeMsgRemoveResourceNodeTx } // GetSigners implements the sdk.Msg interface. func (msg MsgRemoveResourceNode) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.OwnerAddress} + addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgRemoveResourceNode) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgRemoveResourceNode) ValidateBasic() error { - if msg.ResourceNodeAddress.Empty() { + sdsAddress, err := stratos.SdsAddressFromBech32(msg.ResourceNodeAddress) + if err != nil { + return err + } + if sdsAddress.Empty() { return ErrEmptyResourceNodeAddr } - if msg.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } return nil } -// MsgRemoveIndexingNode - struct for removing indexing node -type MsgRemoveIndexingNode struct { - IndexingNodeAddress stratos.SdsAddress `json:"indexing_node_address" yaml:"indexing_node_address"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` -} - // NewMsgRemoveIndexingNode creates a new MsgRemoveIndexingNode instance. -func NewMsgRemoveIndexingNode(indexingNodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) MsgRemoveIndexingNode { - return MsgRemoveIndexingNode{ - IndexingNodeAddress: indexingNodeAddr, - OwnerAddress: ownerAddr, +func NewMsgRemoveIndexingNode(indexingNodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) *MsgRemoveIndexingNode { + return &MsgRemoveIndexingNode{ + IndexingNodeAddress: indexingNodeAddr.String(), + OwnerAddress: ownerAddr.String(), } } @@ -210,46 +268,51 @@ func NewMsgRemoveIndexingNode(indexingNodeAddr stratos.SdsAddress, ownerAddr sdk func (msg MsgRemoveIndexingNode) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgRemoveIndexingNode) Type() string { return "remove_indexing_node" } +func (msg MsgRemoveIndexingNode) Type() string { return TypeRemoveIndexingNodeTx } // GetSigners implements the sdk.Msg interface. func (msg MsgRemoveIndexingNode) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.OwnerAddress} + addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgRemoveIndexingNode) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgRemoveIndexingNode) ValidateBasic() error { - if msg.IndexingNodeAddress.Empty() { + sdsAddress, err := stratos.SdsAddressFromBech32(msg.IndexingNodeAddress) + if err != nil { + return err + } + if sdsAddress.Empty() { return ErrEmptyIndexingNodeAddr } - if msg.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } return nil } -// MsgUpdateResourceNode struct for updating resource node -type MsgUpdateResourceNode struct { - Description Description `json:"description" yaml:"description"` - NodeType NodeType `json:"node_type" yaml:"node_type"` - NetworkAddress stratos.SdsAddress `json:"network_address" yaml:"network_address"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` -} - func NewMsgUpdateResourceNode(description Description, nodeType NodeType, - networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress) MsgUpdateResourceNode { + networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress) *MsgUpdateResourceNode { - return MsgUpdateResourceNode{ + return &MsgUpdateResourceNode{ Description: description, - NodeType: nodeType, - NetworkAddress: networkAddress, - OwnerAddress: ownerAddress, + NodeType: nodeType.Type(), + NetworkAddress: networkAddress.String(), + OwnerAddress: ownerAddress.String(), } } @@ -257,50 +320,60 @@ func NewMsgUpdateResourceNode(description Description, nodeType NodeType, func (msg MsgUpdateResourceNode) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgUpdateResourceNode) Type() string { return "update_resource_node" } +func (msg MsgUpdateResourceNode) Type() string { return TypeUpdateResourceNodeTx } // GetSigners implements the sdk.Msg interface. func (msg MsgUpdateResourceNode) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.OwnerAddress} + addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgUpdateResourceNode) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgUpdateResourceNode) ValidateBasic() error { - if msg.NetworkAddress.Empty() { - return ErrInvalidNetworkAddr + netAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return err + } + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress } - if msg.OwnerAddress.Empty() { + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } + if msg.Description.Moniker == "" { return ErrEmptyMoniker } - if msg.NodeType > 7 || msg.NodeType < 1 { + + nodeTypeNum, err := strconv.Atoi(msg.NodeType) + if err != nil { + return ErrInvalidNodeType + } + if nodeTypeNum > 7 || nodeTypeNum < 1 { return ErrInvalidNodeType } return nil } -// MsgUpdateResourceNodeStake struct for only updating resource node's stake -type MsgUpdateResourceNodeStake struct { - NetworkAddress stratos.SdsAddress `json:"network_address" yaml:"network_address"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` - StakeDelta sdk.Coin `json:"stake_delta" yaml:"stake_delta"` - IncrStake bool `json:"incr_stake" yaml:"incr_stake"` -} - func NewMsgUpdateResourceNodeStake(networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress, - stakeDelta sdk.Coin, incrStake bool) MsgUpdateResourceNodeStake { - return MsgUpdateResourceNodeStake{ - NetworkAddress: networkAddress, - OwnerAddress: ownerAddress, + stakeDelta *sdk.Coin, incrStake bool) *MsgUpdateResourceNodeStake { + return &MsgUpdateResourceNodeStake{ + NetworkAddress: networkAddress.String(), + OwnerAddress: ownerAddress.String(), StakeDelta: stakeDelta, IncrStake: incrStake, } @@ -310,47 +383,54 @@ func NewMsgUpdateResourceNodeStake(networkAddress stratos.SdsAddress, ownerAddre func (msg MsgUpdateResourceNodeStake) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgUpdateResourceNodeStake) Type() string { return "update_resource_node_stake" } +func (msg MsgUpdateResourceNodeStake) Type() string { return TypeUpdateResourceNodeStakeTx } // GetSigners implements the sdk.Msg interface. func (msg MsgUpdateResourceNodeStake) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.OwnerAddress} + addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgUpdateResourceNodeStake) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgUpdateResourceNodeStake) ValidateBasic() error { - if msg.NetworkAddress.Empty() { - return ErrInvalidNetworkAddr + netAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return err + } + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress } - if msg.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } + if msg.StakeDelta.Amount.LTE(sdk.ZeroInt()) { return ErrInvalidStakeChange } return nil } -// MsgUpdateIndexingNode struct for updating indexing node -type MsgUpdateIndexingNode struct { - Description Description `json:"description" yaml:"description"` - NetworkAddress stratos.SdsAddress `json:"network_address" yaml:"network_address"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` -} - func NewMsgUpdateIndexingNode(description Description, networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress, -) MsgUpdateIndexingNode { +) *MsgUpdateIndexingNode { - return MsgUpdateIndexingNode{ + return &MsgUpdateIndexingNode{ Description: description, - NetworkAddress: networkAddress, - OwnerAddress: ownerAddress, + NetworkAddress: networkAddress.String(), + OwnerAddress: ownerAddress.String(), } } @@ -358,46 +438,53 @@ func NewMsgUpdateIndexingNode(description Description, networkAddress stratos.Sd func (msg MsgUpdateIndexingNode) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNode) Type() string { return "update_indexing_node" } +func (msg MsgUpdateIndexingNode) Type() string { return TypeUpdateIndexingNodeTx } // GetSigners implements the sdk.Msg interface. func (msg MsgUpdateIndexingNode) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.OwnerAddress} + addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgUpdateIndexingNode) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgUpdateIndexingNode) ValidateBasic() error { - if msg.NetworkAddress.Empty() { - return ErrInvalidNetworkAddr + netAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return err + } + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress } - if msg.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } + if msg.Description.Moniker == "" { return ErrEmptyMoniker } - return nil -} -// MsgUpdateIndexingNodeStake struct for updating indexing node's stake -type MsgUpdateIndexingNodeStake struct { - NetworkAddress stratos.SdsAddress `json:"network_address" yaml:"network_address"` - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` - StakeDelta sdk.Coin `json:"stake_delta" yaml:"stake_delta"` - IncrStake bool `json:"incr_stake" yaml:"incr_stake"` + return nil } func NewMsgUpdateIndexingNodeStake(networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress, - stakeDelta sdk.Coin, incrStake bool) MsgUpdateIndexingNodeStake { - return MsgUpdateIndexingNodeStake{ - NetworkAddress: networkAddress, - OwnerAddress: ownerAddress, + stakeDelta *sdk.Coin, incrStake bool) *MsgUpdateIndexingNodeStake { + return &MsgUpdateIndexingNodeStake{ + NetworkAddress: networkAddress.String(), + OwnerAddress: ownerAddress.String(), StakeDelta: stakeDelta, IncrStake: incrStake, } @@ -407,87 +494,91 @@ func NewMsgUpdateIndexingNodeStake(networkAddress stratos.SdsAddress, ownerAddre func (msg MsgUpdateIndexingNodeStake) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNodeStake) Type() string { return "update_indexing_node" } +func (msg MsgUpdateIndexingNodeStake) Type() string { return TypeUpdateIndexingNodeStakeTx } // GetSigners implements the sdk.Msg interface. func (msg MsgUpdateIndexingNodeStake) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.OwnerAddress} + addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgUpdateIndexingNodeStake) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgUpdateIndexingNodeStake) ValidateBasic() error { - if msg.NetworkAddress.Empty() { - return ErrInvalidNetworkAddr + netAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return err + } + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress } - if msg.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return err + } + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } + if msg.StakeDelta.Amount.LTE(sdk.ZeroInt()) { return ErrInvalidStakeChange } return nil } -type MsgIndexingNodeRegistrationVote struct { - CandidateNetworkAddress stratos.SdsAddress `json:"candidate_network_address" yaml:"candidate_network_address"` // node address of indexing node - CandidateOwnerAddress sdk.AccAddress `json:"candidate_owner_address" yaml:"candidate_owner_address"` // owner address of indexing node - Opinion VoteOpinion `json:"opinion" yaml:"opinion"` - VoterNetworkAddress stratos.SdsAddress `json:"voter_network_address" yaml:"voter_network_address"` // address of voter (other existed indexing node) - VoterOwnerAddress sdk.AccAddress `json:"voter_owner_address" yaml:"voter_owner_address"` // address of owner of the voter (other existed indexing node) -} - -func NewMsgIndexingNodeRegistrationVote(candidateNetworkAddress stratos.SdsAddress, candidateOwnerAddress sdk.AccAddress, opinion VoteOpinion, - voterNetworkAddress stratos.SdsAddress, voterOwnerAddress sdk.AccAddress) MsgIndexingNodeRegistrationVote { +func NewMsgIndexingNodeRegistrationVote(candidateNetworkAddress stratos.SdsAddress, candidateOwnerAddress sdk.AccAddress, opinion bool, + voterNetworkAddress stratos.SdsAddress, voterOwnerAddress sdk.AccAddress) *MsgIndexingNodeRegistrationVote { - return MsgIndexingNodeRegistrationVote{ - CandidateNetworkAddress: candidateNetworkAddress, - CandidateOwnerAddress: candidateOwnerAddress, + return &MsgIndexingNodeRegistrationVote{ + CandidateNetworkAddress: candidateNetworkAddress.String(), + CandidateOwnerAddress: candidateOwnerAddress.String(), Opinion: opinion, - VoterNetworkAddress: voterNetworkAddress, - VoterOwnerAddress: voterOwnerAddress, + VoterNetworkAddress: voterNetworkAddress.String(), + VoterOwnerAddress: voterOwnerAddress.String(), } } -func (m MsgIndexingNodeRegistrationVote) Route() string { - return RouterKey -} +func (mmsg MsgIndexingNodeRegistrationVote) Route() string { return RouterKey } -func (m MsgIndexingNodeRegistrationVote) Type() string { - return "indexing_node_reg_vote" -} +func (msg MsgIndexingNodeRegistrationVote) Type() string { return TypeIndexingNodeRegistrationVoteTx } -func (m MsgIndexingNodeRegistrationVote) ValidateBasic() error { - if m.CandidateNetworkAddress.Empty() { +func (msg MsgIndexingNodeRegistrationVote) ValidateBasic() error { + if msg.CandidateNetworkAddress.Empty() { return ErrEmptyCandidateNetworkAddr } - if m.CandidateOwnerAddress.Empty() { + if msg.CandidateOwnerAddress.Empty() { return ErrEmptyCandidateOwnerAddr } - if m.VoterNetworkAddress.Empty() { + if msg.VoterNetworkAddress.Empty() { return ErrEmptyVoterNetworkAddr } - if m.VoterOwnerAddress.Empty() { + if msg.VoterOwnerAddress.Empty() { return ErrEmptyVoterOwnerAddr } - if m.CandidateNetworkAddress.Equals(m.VoterNetworkAddress) { + if msg.CandidateNetworkAddress.Equals(msg.VoterNetworkAddress) { return ErrSameAddr } return nil } -func (m MsgIndexingNodeRegistrationVote) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(m) +func (msg MsgIndexingNodeRegistrationVote) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } -func (m MsgIndexingNodeRegistrationVote) GetSigners() []sdk.AccAddress { - var addrs []sdk.AccAddress - addrs = append(addrs, m.VoterOwnerAddress) - return addrs +func (msg MsgIndexingNodeRegistrationVote) GetSigners() []sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(msg.VoterOwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr.Bytes()} } diff --git a/x/register/types/params.go b/x/register/types/params.go index 63faa56d..ead582f8 100644 --- a/x/register/types/params.go +++ b/x/register/types/params.go @@ -7,17 +7,18 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/params" - "github.com/cosmos/cosmos-sdk/x/params/subspace" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/stratosnet/stratos-chain/types" ) +var _ paramtypes.ParamSet = &Params{} + // Default parameter namespace const ( - DefaultParamSpace = ModuleName - DefaultBondDenom = "ustos" - DefaultUnbondingThreasholdTime time.Duration = 180 * 24 * time.Hour // threashold for unbonding - by default 180 days - DefaultUnbondingCompletionTime time.Duration = 14 * 24 * time.Hour // lead time to complete unbonding - by default 14 days - DefaultMaxEntries = uint16(16) + DefaultParamSpace = ModuleName + DefaultBondDenom = types.USTOS + DefaultMaxEntries = uint32(16) ) // Parameter store keys @@ -27,27 +28,19 @@ var ( KeyUnbondingCompletionTime = []byte("UnbondingCompletionTime") KeyMaxEntries = []byte("KeyMaxEntries") - DefaultUozPrice = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz - DefaultTotalUnissuedPrepay = sdk.NewInt(0) + DefaultUnbondingThreasholdTime = (180 * 24 * time.Hour).String() // threashold for unbonding - by default 180 days + DefaultUnbondingCompletionTime = (14 * 24 * time.Hour).String() // lead time to complete unbonding - by default 14 days + DefaultUozPrice = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz + DefaultTotalUnissuedPrepay = sdk.NewInt(0) ) -var _ subspace.ParamSet = &Params{} - -// ParamKeyTable for register module -func ParamKeyTable() params.KeyTable { - return params.NewKeyTable().RegisterParamSet(&Params{}) -} - -// Params - used for initializing default parameter for register at genesis -type Params struct { - BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination - UnbondingThreasholdTime time.Duration `json:"unbonding_threashold_time" yaml:"unbonding_threashold_time"` // threashold for unbonding - by default 180 days - UnbondingCompletionTime time.Duration `json:"unbonding_completion_time" yaml:"unbonding_completion_time"` // lead time to complete unbonding - by default 14 days - MaxEntries uint16 `json:"max_entries" yaml:"max_entries"` // max entries for either unbonding delegation or redelegation (per pair/trio) +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } // NewParams creates a new Params object -func NewParams(bondDenom string, threashold, completion time.Duration, maxEntries uint16) Params { +func NewParams(bondDenom string, threashold, completion string, maxEntries uint32) Params { return Params{ BondDenom: bondDenom, UnbondingThreasholdTime: threashold, @@ -56,25 +49,13 @@ func NewParams(bondDenom string, threashold, completion time.Duration, maxEntrie } } -// String implements the stringer interface for Params -func (p Params) String() string { - return fmt.Sprintf(`Register Params: - BondDenom: %s - Unbonding Threashold Time: %s - Unbonding Completion Time: %s - Max Entries: %d -`, - p.BondDenom, p.UnbondingThreasholdTime, p.UnbondingCompletionTime, p.MaxEntries, - ) -} - // ParamSetPairs - Implements params.ParamSet -func (p *Params) ParamSetPairs() params.ParamSetPairs { - return params.ParamSetPairs{ - params.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), - params.NewParamSetPair(KeyUnbondingThreasholdTime, &p.UnbondingThreasholdTime, validateUnbondingThreasholdTime), - params.NewParamSetPair(KeyUnbondingCompletionTime, &p.UnbondingCompletionTime, validateUnbondingCompletionTime), - params.NewParamSetPair(KeyMaxEntries, &p.MaxEntries, validateMaxEntries), +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), + paramtypes.NewParamSetPair(KeyUnbondingThreasholdTime, &p.UnbondingThreasholdTime, validateUnbondingThreasholdTime), + paramtypes.NewParamSetPair(KeyUnbondingCompletionTime, &p.UnbondingCompletionTime, validateUnbondingCompletionTime), + paramtypes.NewParamSetPair(KeyMaxEntries, &p.MaxEntries, validateMaxEntries), } } @@ -95,8 +76,9 @@ func (p Params) Validate() error { } // DefaultParams defines the parameters for this module -func DefaultParams() Params { - return NewParams(DefaultBondDenom, DefaultUnbondingThreasholdTime, DefaultUnbondingCompletionTime, DefaultMaxEntries) +func DefaultParams() *Params { + p := NewParams(DefaultBondDenom, DefaultUnbondingThreasholdTime, DefaultUnbondingCompletionTime, DefaultMaxEntries) + return &p } func validateBondDenom(i interface{}) error { diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go new file mode 100644 index 00000000..391ddf7d --- /dev/null +++ b/x/register/types/register.pb.go @@ -0,0 +1,2533 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/register/v1/register.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/regen-network/cosmos-proto" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the Register module parameters +type Params struct { + BondDenom string `protobuf:"bytes,1,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom",omitempty` + UnbondingThreasholdTime string `protobuf:"bytes,2,opt,name=unbonding_threashold_time,json=unbondingThreasholdTime,proto3" json:"unbonding_threashold_time,omitempty" yaml:"unbonding_threashold_time"` + UnbondingCompletionTime string `protobuf:"bytes,3,opt,name=unbonding_completion_time,json=unbondingCompletionTime,proto3" json:"unbonding_completion_time,omitempty" yaml:"unbonding_completion_time"` + MaxEntries uint32 `protobuf:"varint,4,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty" yaml:"max_entries",omitempty` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetBondDenom() string { + if m != nil { + return m.BondDenom + } + return "" +} + +func (m *Params) GetUnbondingThreasholdTime() string { + if m != nil { + return m.UnbondingThreasholdTime + } + return "" +} + +func (m *Params) GetUnbondingCompletionTime() string { + if m != nil { + return m.UnbondingCompletionTime + } + return "" +} + +func (m *Params) GetMaxEntries() uint32 { + if m != nil { + return m.MaxEntries + } + return 0 +} + +type ResourceNode struct { + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + NodeType string `protobuf:"bytes,8,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` + CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` +} + +func (m *ResourceNode) Reset() { *m = ResourceNode{} } +func (m *ResourceNode) String() string { return proto.CompactTextString(m) } +func (*ResourceNode) ProtoMessage() {} +func (*ResourceNode) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{1} +} +func (m *ResourceNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceNode.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 *ResourceNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceNode.Merge(m, src) +} +func (m *ResourceNode) XXX_Size() int { + return m.Size() +} +func (m *ResourceNode) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceNode.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceNode proto.InternalMessageInfo + +func (m *ResourceNode) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *ResourceNode) GetPubKey() *types.Any { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *ResourceNode) GetSuspend() bool { + if m != nil { + return m.Suspend + } + return false +} + +func (m *ResourceNode) GetStatus() types1.BondStatus { + if m != nil { + return m.Status + } + return types1.Unspecified +} + +func (m *ResourceNode) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *ResourceNode) GetDescription() *Description { + if m != nil { + return m.Description + } + return nil +} + +func (m *ResourceNode) GetNodeType() string { + if m != nil { + return m.NodeType + } + return "" +} + +func (m *ResourceNode) GetCreationTime() time.Time { + if m != nil { + return m.CreationTime + } + return time.Time{} +} + +type IndexingNode struct { + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` +} + +func (m *IndexingNode) Reset() { *m = IndexingNode{} } +func (m *IndexingNode) String() string { return proto.CompactTextString(m) } +func (*IndexingNode) ProtoMessage() {} +func (*IndexingNode) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{2} +} +func (m *IndexingNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IndexingNode.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 *IndexingNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexingNode.Merge(m, src) +} +func (m *IndexingNode) XXX_Size() int { + return m.Size() +} +func (m *IndexingNode) XXX_DiscardUnknown() { + xxx_messageInfo_IndexingNode.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexingNode proto.InternalMessageInfo + +func (m *IndexingNode) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *IndexingNode) GetPubKey() *types.Any { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *IndexingNode) GetSuspend() bool { + if m != nil { + return m.Suspend + } + return false +} + +func (m *IndexingNode) GetStatus() types1.BondStatus { + if m != nil { + return m.Status + } + return types1.Unspecified +} + +func (m *IndexingNode) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *IndexingNode) GetDescription() *Description { + if m != nil { + return m.Description + } + return nil +} + +func (m *IndexingNode) GetCreationTime() time.Time { + if m != nil { + return m.CreationTime + } + return time.Time{} +} + +type Description struct { + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty" yaml:"moniker",omitempty` + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty" yaml:"identity",omitempty` + Website string `protobuf:"bytes,3,opt,name=Website,proto3" json:"Website,omitempty" yaml:"website",omitempty` + SecurityContact string `protobuf:"bytes,4,opt,name=SecurityContact,proto3" json:"SecurityContact,omitempty" yaml:"security_contact",omitempty` + Details string `protobuf:"bytes,5,opt,name=Details,proto3" json:"Details,omitempty" yaml:"details",omitempty` +} + +func (m *Description) Reset() { *m = Description{} } +func (m *Description) String() string { return proto.CompactTextString(m) } +func (*Description) ProtoMessage() {} +func (*Description) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{3} +} +func (m *Description) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Description) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Description.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 *Description) XXX_Merge(src proto.Message) { + xxx_messageInfo_Description.Merge(m, src) +} +func (m *Description) XXX_Size() int { + return m.Size() +} +func (m *Description) XXX_DiscardUnknown() { + xxx_messageInfo_Description.DiscardUnknown(m) +} + +var xxx_messageInfo_Description proto.InternalMessageInfo + +func (m *Description) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Description) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Description) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Description) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *Description) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +type Slashing struct { + WalletAddress string `protobuf:"bytes,1,opt,name=WalletAddress,proto3" json:"WalletAddress,omitempty"` + Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` +} + +func (m *Slashing) Reset() { *m = Slashing{} } +func (m *Slashing) String() string { return proto.CompactTextString(m) } +func (*Slashing) ProtoMessage() {} +func (*Slashing) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{4} +} +func (m *Slashing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Slashing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Slashing.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 *Slashing) XXX_Merge(src proto.Message) { + xxx_messageInfo_Slashing.Merge(m, src) +} +func (m *Slashing) XXX_Size() int { + return m.Size() +} +func (m *Slashing) XXX_DiscardUnknown() { + xxx_messageInfo_Slashing.DiscardUnknown(m) +} + +var xxx_messageInfo_Slashing proto.InternalMessageInfo + +func (m *Slashing) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +func (m *Slashing) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +type ResourceNodes struct { + ResourceNodes []*ResourceNode `protobuf:"bytes,1,rep,name=resourceNodes,proto3" json:"resourceNodes,omitempty"` +} + +func (m *ResourceNodes) Reset() { *m = ResourceNodes{} } +func (m *ResourceNodes) String() string { return proto.CompactTextString(m) } +func (*ResourceNodes) ProtoMessage() {} +func (*ResourceNodes) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{5} +} +func (m *ResourceNodes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceNodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceNodes.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 *ResourceNodes) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceNodes.Merge(m, src) +} +func (m *ResourceNodes) XXX_Size() int { + return m.Size() +} +func (m *ResourceNodes) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceNodes.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceNodes proto.InternalMessageInfo + +func (m *ResourceNodes) GetResourceNodes() []*ResourceNode { + if m != nil { + return m.ResourceNodes + } + return nil +} + +type IndexingNodes struct { + IndexingNodes []*IndexingNode `protobuf:"bytes,1,rep,name=indexingNodes,proto3" json:"indexingNodes,omitempty"` +} + +func (m *IndexingNodes) Reset() { *m = IndexingNodes{} } +func (m *IndexingNodes) String() string { return proto.CompactTextString(m) } +func (*IndexingNodes) ProtoMessage() {} +func (*IndexingNodes) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{6} +} +func (m *IndexingNodes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IndexingNodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IndexingNodes.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 *IndexingNodes) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexingNodes.Merge(m, src) +} +func (m *IndexingNodes) XXX_Size() int { + return m.Size() +} +func (m *IndexingNodes) XXX_DiscardUnknown() { + xxx_messageInfo_IndexingNodes.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexingNodes proto.InternalMessageInfo + +func (m *IndexingNodes) GetIndexingNodes() []*IndexingNode { + if m != nil { + return m.IndexingNodes + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "stratos.register.v1.Params") + proto.RegisterType((*ResourceNode)(nil), "stratos.register.v1.ResourceNode") + proto.RegisterType((*IndexingNode)(nil), "stratos.register.v1.IndexingNode") + proto.RegisterType((*Description)(nil), "stratos.register.v1.Description") + proto.RegisterType((*Slashing)(nil), "stratos.register.v1.Slashing") + proto.RegisterType((*ResourceNodes)(nil), "stratos.register.v1.ResourceNodes") + proto.RegisterType((*IndexingNodes)(nil), "stratos.register.v1.IndexingNodes") +} + +func init() { + proto.RegisterFile("stratos/register/v1/register.proto", fileDescriptor_fef1e3aeec8499d6) +} + +var fileDescriptor_fef1e3aeec8499d6 = []byte{ + // 928 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xcf, 0x6e, 0xe3, 0x44, + 0x18, 0x6f, 0x5a, 0xda, 0xa6, 0x93, 0x66, 0x01, 0x13, 0x81, 0x5b, 0x50, 0x9c, 0x5a, 0x15, 0xea, + 0x4a, 0x5b, 0x87, 0x16, 0x4e, 0xab, 0x05, 0xd4, 0x6c, 0x01, 0xad, 0x10, 0xab, 0x95, 0x5b, 0x51, + 0xc4, 0x25, 0x4c, 0xec, 0x0f, 0x67, 0x94, 0x78, 0xc6, 0xf2, 0x8c, 0xdb, 0xfa, 0xca, 0x13, 0xec, + 0xc3, 0xec, 0x43, 0xac, 0xb8, 0xb0, 0x17, 0x24, 0xc4, 0xc1, 0xa0, 0xf6, 0x0d, 0xfc, 0x04, 0xc8, + 0x33, 0xe3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 0xe2, 0x69, 0xa6, 0x3e, 0xdc, + 0x6b, 0xbe, 0x3a, 0xb8, 0x3f, 0xa1, 0xb6, 0xf9, 0x69, 0xe3, 0xd6, 0x77, 0xa8, 0x9d, 0x9a, 0x05, + 0xbb, 0xd1, 0x5b, 0x3b, 0x68, 0x1d, 0xef, 0xbd, 0x32, 0x7b, 0xa6, 0xd4, 0x5f, 0xd4, 0x55, 0xce, + 0xe6, 0xdb, 0x47, 0x3a, 0x13, 0xb3, 0xf0, 0xbf, 0xce, 0xa6, 0xd4, 0x5f, 0xd4, 0x0d, 0x1e, 0x3f, + 0xbf, 0xe9, 0x36, 0x5e, 0xdc, 0x74, 0x1b, 0xff, 0xde, 0x74, 0x1b, 0x4f, 0x6f, 0xbb, 0x2b, 0x2f, + 0x6e, 0xbb, 0x2b, 0x7f, 0xdd, 0x76, 0x57, 0x7e, 0xfe, 0xc2, 0x78, 0x6a, 0xb5, 0x2b, 0x05, 0x51, + 0x5f, 0x1e, 0x06, 0x63, 0x4c, 0x68, 0xff, 0x7a, 0xfe, 0x2f, 0x4f, 0x3e, 0xc7, 0xa3, 0x0d, 0x99, + 0xf3, 0xcf, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x07, 0xd9, 0x0d, 0x26, 0x06, 0x0a, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxEntries != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.MaxEntries)) + i-- + dAtA[i] = 0x20 + } + if len(m.UnbondingCompletionTime) > 0 { + i -= len(m.UnbondingCompletionTime) + copy(dAtA[i:], m.UnbondingCompletionTime) + i = encodeVarintRegister(dAtA, i, uint64(len(m.UnbondingCompletionTime))) + i-- + dAtA[i] = 0x1a + } + if len(m.UnbondingThreasholdTime) > 0 { + i -= len(m.UnbondingThreasholdTime) + copy(dAtA[i:], m.UnbondingThreasholdTime) + i = encodeVarintRegister(dAtA, i, uint64(len(m.UnbondingThreasholdTime))) + i-- + dAtA[i] = 0x12 + } + if len(m.BondDenom) > 0 { + i -= len(m.BondDenom) + copy(dAtA[i:], m.BondDenom) + i = encodeVarintRegister(dAtA, i, uint64(len(m.BondDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ResourceNode) 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 *ResourceNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintRegister(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x4a + if len(m.NodeType) > 0 { + i -= len(m.NodeType) + copy(dAtA[i:], m.NodeType) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeType))) + i-- + dAtA[i] = 0x42 + } + if m.Description != nil { + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x32 + } + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Status != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.Suspend { + i-- + if m.Suspend { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IndexingNode) 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 *IndexingNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintRegister(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x4a + if m.Description != nil { + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x32 + } + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Status != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.Suspend { + i-- + if m.Suspend { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Description) 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 *Description) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Description) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintRegister(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintRegister(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x22 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintRegister(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintRegister(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintRegister(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Slashing) 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 *Slashing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Slashing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x10 + } + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ResourceNodes) 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 *ResourceNodes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceNodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ResourceNodes) > 0 { + for iNdEx := len(m.ResourceNodes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *IndexingNodes) 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 *IndexingNodes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IndexingNodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.IndexingNodes) > 0 { + for iNdEx := len(m.IndexingNodes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.IndexingNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintRegister(dAtA []byte, offset int, v uint64) int { + offset -= sovRegister(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.UnbondingThreasholdTime) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.UnbondingCompletionTime) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.MaxEntries != 0 { + n += 1 + sovRegister(uint64(m.MaxEntries)) + } + return n +} + +func (m *ResourceNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.Suspend { + n += 2 + } + if m.Status != 0 { + n += 1 + sovRegister(uint64(m.Status)) + } + l = m.Tokens.Size() + n += 1 + l + sovRegister(uint64(l)) + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.Description != nil { + l = m.Description.Size() + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.NodeType) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) + n += 1 + l + sovRegister(uint64(l)) + return n +} + +func (m *IndexingNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.Suspend { + n += 2 + } + if m.Status != 0 { + n += 1 + sovRegister(uint64(m.Status)) + } + l = m.Tokens.Size() + n += 1 + l + sovRegister(uint64(l)) + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.Description != nil { + l = m.Description.Size() + n += 1 + l + sovRegister(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) + n += 1 + l + sovRegister(uint64(l)) + return n +} + +func (m *Description) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + return n +} + +func (m *Slashing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.Value != 0 { + n += 1 + sovRegister(uint64(m.Value)) + } + return n +} + +func (m *ResourceNodes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ResourceNodes) > 0 { + for _, e := range m.ResourceNodes { + l = e.Size() + n += 1 + l + sovRegister(uint64(l)) + } + } + return n +} + +func (m *IndexingNodes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.IndexingNodes) > 0 { + for _, e := range m.IndexingNodes { + l = e.Size() + n += 1 + l + sovRegister(uint64(l)) + } + } + return n +} + +func sovRegister(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRegister(x uint64) (n int) { + return sovRegister(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingThreasholdTime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UnbondingThreasholdTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingCompletionTime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UnbondingCompletionTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEntries", wireType) + } + m.MaxEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxEntries |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceNode) 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 ErrIntOverflowRegister + } + 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: ResourceNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspend = bool(v != 0) + case 4: + 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 ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Description == nil { + m.Description = &Description{} + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodeType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IndexingNode) 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 ErrIntOverflowRegister + } + 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: IndexingNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspend = bool(v != 0) + case 4: + 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 ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Description == nil { + m.Description = &Description{} + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Description) 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 ErrIntOverflowRegister + } + 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: Description: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Description: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Slashing) 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 ErrIntOverflowRegister + } + 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: Slashing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Slashing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceNodes) 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 ErrIntOverflowRegister + } + 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: ResourceNodes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceNodes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNodes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceNodes = append(m.ResourceNodes, &ResourceNode{}) + if err := m.ResourceNodes[len(m.ResourceNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IndexingNodes) 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 ErrIntOverflowRegister + } + 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: IndexingNodes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IndexingNodes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IndexingNodes = append(m.IndexingNodes, &IndexingNode{}) + if err := m.IndexingNodes[len(m.IndexingNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRegister(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, ErrIntOverflowRegister + } + 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, ErrIntOverflowRegister + } + 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, ErrIntOverflowRegister + } + 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, ErrInvalidLengthRegister + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRegister + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRegister + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRegister = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRegister = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRegister = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/register/types/registration.go b/x/register/types/registration.go index 815c69fb..594d6605 100644 --- a/x/register/types/registration.go +++ b/x/register/types/registration.go @@ -1,7 +1,6 @@ package types import ( - "fmt" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -16,13 +15,13 @@ const ( ) // Description - description fields for a resource/indexing node -type Description struct { - Moniker string `json:"moniker" yaml:"moniker"` // name - Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase) - Website string `json:"website" yaml:"website"` // optional website link - SecurityContact string `json:"security_contact" yaml:"security_contact"` // optional security contact info - Details string `json:"details" yaml:"details"` // optional details -} +//type Description struct { +// Moniker string `json:"moniker" yaml:"moniker"` // name +// Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase) +// Website string `json:"website" yaml:"website"` // optional website link +// SecurityContact string `json:"security_contact" yaml:"security_contact"` // optional security contact info +// Details string `json:"details" yaml:"details"` // optional details +//} // NewDescription returns a new Description with the provided values. func NewDescription(moniker, identity, website, securityContact, details string) Description { @@ -56,12 +55,12 @@ func (d Description) EnsureLength() (Description, error) { return d, nil } -func (d Description) String() string { - return fmt.Sprintf(`Description:{ - Moniker: %s - Identity: %s - Website: %s - SecurityContact: %s - Details: %s - }`, d.Moniker, d.Identity, d.Website, d.SecurityContact, d.Details) -} +//func (d Description) String() string { +// return fmt.Sprintf(`Description:{ +// Moniker: %s +// Identity: %s +// Website: %s +// SecurityContact: %s +// Details: %s +// }`, d.Moniker, d.Identity, d.Website, d.SecurityContact, d.Details) +//} diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 6f0ee0f6..51ed50a8 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -3,14 +3,15 @@ package types import ( "bytes" "fmt" - "sort" - "strings" + "strconv" "time" - "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/tendermint/tendermint/crypto" + goamino "github.com/tendermint/go-amino" ) type NodeType uint8 @@ -46,39 +47,32 @@ func (n NodeType) String() string { } // ResourceNodes is a collection of resource node -type ResourceNodes []ResourceNode +//type ResourceNodes []ResourceNode -func (v ResourceNodes) String() (out string) { - for _, node := range v { - out += node.String() + "\n" - } - return strings.TrimSpace(out) -} +//func (v ResourceNodes) String() (out string) { +// for _, node := range v { +// out += node.String() + "\n" +// } +// return strings.TrimSpace(out) +//} // Sort ResourceNodes sorts ResourceNode array in ascending owner address order -func (v ResourceNodes) Sort() { - sort.Sort(v) -} - -// Len implements sort interface -func (v ResourceNodes) Len() int { - return len(v) -} - -// Less implements sort interface -func (v ResourceNodes) Less(i, j int) bool { - return v[i].Tokens.LT(v[j].Tokens) -} - -// Swap implements sort interface -func (v ResourceNodes) Swap(i, j int) { - it := v[i] - v[i] = v[j] - v[j] = it -} +//func (v ResourceNodes) Sort() { +// sort.Sort(v) +//} +// +//// Len implements sort interface +//func (v ResourceNodes) Len() int { +// return len(v.ResourceNodes) +//} +// +//// Less implements sort interface +//func (v ResourceNodes) Less(i, j int) bool { +// return v.GetResourceNodes()[i].Tokens < v.GetResourceNodes()[j].Tokens +//} func (v ResourceNodes) Validate() error { - for _, node := range v { + for _, node := range v.GetResourceNodes() { if err := node.Validate(); err != nil { return err } @@ -86,50 +80,48 @@ func (v ResourceNodes) Validate() error { return nil } -type ResourceNode struct { - NetworkAddr stratos.SdsAddress `json:"network_address" yaml:"network_address"` // network id of the resource node, sds://... - PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"` // the public key of the resource node; bech encoded in JSON - Suspend bool `json:"suspend" yaml:"suspend"` // has the resource node been suspended from bonded status? - Status sdk.BondStatus `json:"status" yaml:"status"` // resource node bond status (bonded/unbonding/unbonded) - Tokens sdk.Int `json:"tokens" yaml:"tokens"` // delegated tokens - OwnerAddress sdk.AccAddress `json:"owner_address" yaml:"owner_address"` // owner address of the resource node - Description Description `json:"description" yaml:"description"` // description terms for the resource node - NodeType NodeType `json:"node_type" yaml:"node_type"` - CreationTime time.Time `json:"creation_time" yaml:"creation_time"` -} - // NewResourceNode - initialize a new resource node -func NewResourceNode(networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress, - description Description, nodeType NodeType, creationTime time.Time) ResourceNode { +func NewResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, + description *Description, nodeType *NodeType, creationTime time.Time) (ResourceNode, error) { + pkAny, err := codectypes.NewAnyWithValue(pubKey) + if err != nil { + return ResourceNode{}, err + } return ResourceNode{ - NetworkAddr: networkAddr, - PubKey: pubKey, + NetworkAddr: networkAddr.String(), + PubKey: pkAny, Suspend: true, - Status: sdk.Unbonded, + Status: stakingtypes.Unbonded, Tokens: sdk.ZeroInt(), - OwnerAddress: ownerAddr, + OwnerAddress: ownerAddr.String(), Description: description, - NodeType: nodeType, + NodeType: nodeType.Type(), CreationTime: creationTime, - } + }, nil } -// String returns a human readable string representation of a resource node. -func (v ResourceNode) String() string { - pubKey, err := stratos.Bech32ifyPubKey(stratos.Bech32PubKeyTypeAccPub, v.PubKey) +// ConvertToString returns a human-readable string representation of a resource node. +func (v ResourceNode) ConvertToString() string { + pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) if err != nil { - panic(err) + return ErrUnknownPubKey.Error() + } + pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeAccPub, pkAny.String()) + if err != nil { + return ErrUnknownPubKey.Error() } return fmt.Sprintf(`ResourceNode:{ Network Id: %s - Pubkey: %s - Suspend: %v - Status: %s - Tokens: %s + Pubkey: %s + Suspend: %v + Status: %s + Tokens: %s Owner Address: %s - Description: %s - CreationTime: %s - }`, v.NetworkAddr, pubKey, v.Suspend, v.Status, v.Tokens, v.OwnerAddress, v.Description, v.CreationTime) + NodeType: %s + Description: %s + CreationTime: %s + }`, v.GetNetworkAddr(), pubKey, v.GetSuspend(), v.GetStatus(), v.Tokens, + v.GetOwnerAddress(), v.NodeType, v.GetDescription(), v.GetCreationTime()) } // AddToken adds tokens to a resource node @@ -139,73 +131,88 @@ func (v ResourceNode) AddToken(amount sdk.Int) ResourceNode { } // SubToken removes tokens from a resource node -func (v ResourceNode) SubToken(tokens sdk.Int) ResourceNode { - if tokens.IsNegative() { - panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", tokens)) +func (v ResourceNode) SubToken(amount sdk.Int) ResourceNode { + if amount.IsNegative() { + panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", amount)) } - if v.Tokens.LT(tokens) { - panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, tokens)) + if v.Tokens.LT(amount) { + panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, amount)) } - v.Tokens = v.Tokens.Sub(tokens) + v.Tokens = v.Tokens.Sub(amount) return v } func (v ResourceNode) Validate() error { - if v.NetworkAddr.Empty() { - return ErrEmptyNodeId + netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddr()) + if err != nil { + return err } - if !v.NetworkAddr.Equals(stratos.SdsAddress(v.PubKey.Address())) { + + if netAddr.Empty() { + return ErrEmptyNodeNetworkAddress + } + pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) + if err != nil { + return err + } + sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) + if err != nil { + return err + } + if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } - if len(v.PubKey.Bytes()) == 0 { + if len(pkAny.String()) == 0 { return ErrEmptyPubKey } - if v.OwnerAddress.Empty() { + + ownerAddr, err := sdk.AccAddressFromBech32(v.GetOwnerAddress()) + if err != nil { + panic(err) + } + + if ownerAddr.Empty() { return ErrEmptyOwnerAddr } + if v.Tokens.LT(sdk.ZeroInt()) { return ErrValueNegative } - if v.Description.Moniker == "" { + if v.GetDescription().Moniker == "" { return ErrEmptyMoniker } + nodeTypeNum, err := strconv.Atoi(v.GetNodeType()) + if err != nil { + return ErrInvalidNodeType + } + if nodeTypeNum > 7 || nodeTypeNum < 1 { + return ErrInvalidNodeType + } return nil } // IsBonded checks if the node status equals Bonded func (v ResourceNode) IsBonded() bool { - return v.GetStatus().Equal(sdk.Bonded) + return v.GetStatus() == stakingtypes.Bonded } // IsUnBonded checks if the node status equals Unbonded func (v ResourceNode) IsUnBonded() bool { - return v.GetStatus().Equal(sdk.Unbonded) + return v.GetStatus() == stakingtypes.Unbonded } // IsUnBonding checks if the node status equals Unbonding func (v ResourceNode) IsUnBonding() bool { - return v.GetStatus().Equal(sdk.Unbonding) -} - -func (v ResourceNode) IsSuspended() bool { return v.Suspend } -func (v ResourceNode) GetMoniker() string { return v.Description.Moniker } -func (v ResourceNode) GetStatus() sdk.BondStatus { return v.Status } -func (v ResourceNode) GetPubKey() crypto.PubKey { return v.PubKey } -func (v ResourceNode) GetNetworkAddr() stratos.SdsAddress { - return stratos.SdsAddress(v.PubKey.Address()) + return v.GetStatus() == stakingtypes.Unbonding } -func (v ResourceNode) GetTokens() sdk.Int { return v.Tokens } -func (v ResourceNode) GetOwnerAddr() sdk.AccAddress { return v.OwnerAddress } -func (v ResourceNode) GetNodeType() string { return v.NodeType.String() } -func (v ResourceNode) GetCreationTime() time.Time { return v.CreationTime } // MustMarshalResourceNode returns the resourceNode bytes. Panics if fails -func MustMarshalResourceNode(cdc *codec.Codec, resourceNode ResourceNode) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(resourceNode) +func MustMarshalResourceNode(cdc *goamino.Codec, v ResourceNode) []byte { + return cdc.MustMarshalBinaryLengthPrefixed(v) } // MustUnmarshalResourceNode unmarshal a resourceNode from a store value. Panics if fails -func MustUnmarshalResourceNode(cdc *codec.Codec, value []byte) ResourceNode { +func MustUnmarshalResourceNode(cdc *goamino.Codec, value []byte) ResourceNode { resourceNode, err := UnmarshalResourceNode(cdc, value) if err != nil { panic(err) @@ -214,13 +221,13 @@ func MustUnmarshalResourceNode(cdc *codec.Codec, value []byte) ResourceNode { } // UnmarshalResourceNode unmarshal a resourceNode from a store value -func UnmarshalResourceNode(cdc *codec.Codec, value []byte) (resourceNode ResourceNode, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &resourceNode) - return resourceNode, err +func UnmarshalResourceNode(cdc *goamino.Codec, value []byte) (v ResourceNode, err error) { + err = cdc.UnmarshalBinaryLengthPrefixed(value, &v) + return v, err } -func (resourceNode ResourceNode) Equal(resourceNode2 ResourceNode) bool { - bz1 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&resourceNode) - bz2 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&resourceNode2) +func (v1 ResourceNode) Equal(v2 ResourceNode) bool { + bz1 := goamino.MustMarshalBinaryLengthPrefixed(&v1) + bz2 := goamino.MustMarshalBinaryLengthPrefixed(&v2) return bytes.Equal(bz1, bz2) } diff --git a/x/register/types/tx.pb.go b/x/register/types/tx.pb.go new file mode 100644 index 00000000..638b8c24 --- /dev/null +++ b/x/register/types/tx.pb.go @@ -0,0 +1,4399 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/register/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" + types1 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "github.com/regen-network/cosmos-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 + +// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +type MsgCreateResourceNode struct { + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` + OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` + NodeType string `protobuf:"bytes,6,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` +} + +func (m *MsgCreateResourceNode) Reset() { *m = MsgCreateResourceNode{} } +func (m *MsgCreateResourceNode) String() string { return proto.CompactTextString(m) } +func (*MsgCreateResourceNode) ProtoMessage() {} +func (*MsgCreateResourceNode) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{0} +} +func (m *MsgCreateResourceNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateResourceNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateResourceNode.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 *MsgCreateResourceNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateResourceNode.Merge(m, src) +} +func (m *MsgCreateResourceNode) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateResourceNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateResourceNode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateResourceNode proto.InternalMessageInfo + +func (m *MsgCreateResourceNode) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *MsgCreateResourceNode) GetPubKey() *types.Any { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *MsgCreateResourceNode) GetValue() types1.Coin { + if m != nil { + return m.Value + } + return types1.Coin{} +} + +func (m *MsgCreateResourceNode) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *MsgCreateResourceNode) GetDescription() *Description { + if m != nil { + return m.Description + } + return nil +} + +func (m *MsgCreateResourceNode) GetNodeType() string { + if m != nil { + return m.NodeType + } + return "" +} + +// MsgCreateResourceNodeTxResponse defines the CreateResourceNodeTx response type +type MsgCreateResourceNodeResponse struct { +} + +func (m *MsgCreateResourceNodeResponse) Reset() { *m = MsgCreateResourceNodeResponse{} } +func (m *MsgCreateResourceNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateResourceNodeResponse) ProtoMessage() {} +func (*MsgCreateResourceNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{1} +} +func (m *MsgCreateResourceNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateResourceNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateResourceNodeResponse.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 *MsgCreateResourceNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateResourceNodeResponse.Merge(m, src) +} +func (m *MsgCreateResourceNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateResourceNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateResourceNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateResourceNodeResponse proto.InternalMessageInfo + +// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +type MsgCreateIndexingNode struct { + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` + OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` +} + +func (m *MsgCreateIndexingNode) Reset() { *m = MsgCreateIndexingNode{} } +func (m *MsgCreateIndexingNode) String() string { return proto.CompactTextString(m) } +func (*MsgCreateIndexingNode) ProtoMessage() {} +func (*MsgCreateIndexingNode) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{2} +} +func (m *MsgCreateIndexingNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateIndexingNode.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 *MsgCreateIndexingNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateIndexingNode.Merge(m, src) +} +func (m *MsgCreateIndexingNode) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateIndexingNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateIndexingNode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateIndexingNode proto.InternalMessageInfo + +func (m *MsgCreateIndexingNode) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *MsgCreateIndexingNode) GetPubKey() *types.Any { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *MsgCreateIndexingNode) GetValue() types1.Coin { + if m != nil { + return m.Value + } + return types1.Coin{} +} + +func (m *MsgCreateIndexingNode) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *MsgCreateIndexingNode) GetDescription() *Description { + if m != nil { + return m.Description + } + return nil +} + +// MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message +type MsgRemoveResourceNode struct { + ResourceNodeAddress string `protobuf:"bytes,1,opt,name=resource_node_address,json=resourceNodeAddress,proto3" json:"resource_node_address,omitempty" yaml:"resource_node_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` +} + +func (m *MsgRemoveResourceNode) Reset() { *m = MsgRemoveResourceNode{} } +func (m *MsgRemoveResourceNode) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveResourceNode) ProtoMessage() {} +func (*MsgRemoveResourceNode) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{3} +} +func (m *MsgRemoveResourceNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveResourceNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveResourceNode.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 *MsgRemoveResourceNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveResourceNode.Merge(m, src) +} +func (m *MsgRemoveResourceNode) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveResourceNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveResourceNode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveResourceNode proto.InternalMessageInfo + +// MsgRemoveResourceNodeResponse defines the Msg/RemoveResourceNode response type. +type MsgRemoveResourceNodeResponse struct { +} + +func (m *MsgRemoveResourceNodeResponse) Reset() { *m = MsgRemoveResourceNodeResponse{} } +func (m *MsgRemoveResourceNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveResourceNodeResponse) ProtoMessage() {} +func (*MsgRemoveResourceNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{4} +} +func (m *MsgRemoveResourceNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveResourceNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveResourceNodeResponse.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 *MsgRemoveResourceNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveResourceNodeResponse.Merge(m, src) +} +func (m *MsgRemoveResourceNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveResourceNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveResourceNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveResourceNodeResponse proto.InternalMessageInfo + +// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type +type MsgCreateIndexingNodeResponse struct { +} + +func (m *MsgCreateIndexingNodeResponse) Reset() { *m = MsgCreateIndexingNodeResponse{} } +func (m *MsgCreateIndexingNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateIndexingNodeResponse) ProtoMessage() {} +func (*MsgCreateIndexingNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{5} +} +func (m *MsgCreateIndexingNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateIndexingNodeResponse.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 *MsgCreateIndexingNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateIndexingNodeResponse.Merge(m, src) +} +func (m *MsgCreateIndexingNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateIndexingNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateIndexingNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateIndexingNodeResponse proto.InternalMessageInfo + +// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message +type MsgRemoveIndexingNode struct { + IndexingNodeAddress string `protobuf:"bytes,1,opt,name=indexing_node_address,json=indexingNodeAddress,proto3" json:"indexing_node_address,omitempty" yaml:"indexing_node_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` +} + +func (m *MsgRemoveIndexingNode) Reset() { *m = MsgRemoveIndexingNode{} } +func (m *MsgRemoveIndexingNode) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveIndexingNode) ProtoMessage() {} +func (*MsgRemoveIndexingNode) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{6} +} +func (m *MsgRemoveIndexingNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveIndexingNode.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 *MsgRemoveIndexingNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveIndexingNode.Merge(m, src) +} +func (m *MsgRemoveIndexingNode) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveIndexingNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveIndexingNode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveIndexingNode proto.InternalMessageInfo + +// MsgRemoveIndexingNodeResponse defines the Msg/RemoveIndexingNode response type. +type MsgRemoveIndexingNodeResponse struct { +} + +func (m *MsgRemoveIndexingNodeResponse) Reset() { *m = MsgRemoveIndexingNodeResponse{} } +func (m *MsgRemoveIndexingNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveIndexingNodeResponse) ProtoMessage() {} +func (*MsgRemoveIndexingNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{7} +} +func (m *MsgRemoveIndexingNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveIndexingNodeResponse.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 *MsgRemoveIndexingNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveIndexingNodeResponse.Merge(m, src) +} +func (m *MsgRemoveIndexingNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveIndexingNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveIndexingNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveIndexingNodeResponse proto.InternalMessageInfo + +// MsgUpdateResourceNode defines a SDK message for updating an existing resource node. +type MsgUpdateResourceNode struct { + Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description" yaml:"description"` + NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + NodeType string `protobuf:"bytes,4,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` +} + +func (m *MsgUpdateResourceNode) Reset() { *m = MsgUpdateResourceNode{} } +func (m *MsgUpdateResourceNode) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateResourceNode) ProtoMessage() {} +func (*MsgUpdateResourceNode) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{8} +} +func (m *MsgUpdateResourceNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateResourceNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateResourceNode.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 *MsgUpdateResourceNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateResourceNode.Merge(m, src) +} +func (m *MsgUpdateResourceNode) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateResourceNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateResourceNode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateResourceNode proto.InternalMessageInfo + +// MsgUpdateResourceNodeResponse defines the Msg/UpdateResourceNode response type. +type MsgUpdateResourceNodeResponse struct { +} + +func (m *MsgUpdateResourceNodeResponse) Reset() { *m = MsgUpdateResourceNodeResponse{} } +func (m *MsgUpdateResourceNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateResourceNodeResponse) ProtoMessage() {} +func (*MsgUpdateResourceNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{9} +} +func (m *MsgUpdateResourceNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateResourceNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateResourceNodeResponse.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 *MsgUpdateResourceNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateResourceNodeResponse.Merge(m, src) +} +func (m *MsgUpdateResourceNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateResourceNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateResourceNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateResourceNodeResponse proto.InternalMessageInfo + +// MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. +type MsgUpdateIndexingNode struct { + Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description" yaml:"description"` + NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` +} + +func (m *MsgUpdateIndexingNode) Reset() { *m = MsgUpdateIndexingNode{} } +func (m *MsgUpdateIndexingNode) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateIndexingNode) ProtoMessage() {} +func (*MsgUpdateIndexingNode) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{10} +} +func (m *MsgUpdateIndexingNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateIndexingNode.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 *MsgUpdateIndexingNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateIndexingNode.Merge(m, src) +} +func (m *MsgUpdateIndexingNode) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateIndexingNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateIndexingNode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateIndexingNode proto.InternalMessageInfo + +// MsgUpdateIndexingNodeResponse defines the Msg/UpdateIndexingNode response type. +type MsgUpdateIndexingNodeResponse struct { +} + +func (m *MsgUpdateIndexingNodeResponse) Reset() { *m = MsgUpdateIndexingNodeResponse{} } +func (m *MsgUpdateIndexingNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateIndexingNodeResponse) ProtoMessage() {} +func (*MsgUpdateIndexingNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{11} +} +func (m *MsgUpdateIndexingNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateIndexingNodeResponse.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 *MsgUpdateIndexingNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateIndexingNodeResponse.Merge(m, src) +} +func (m *MsgUpdateIndexingNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateIndexingNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateIndexingNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateIndexingNodeResponse proto.InternalMessageInfo + +// MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. +type MsgUpdateResourceNodeStake struct { + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incrStake,omitempty" yaml:"incr_stake"` + StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"StakeDelta,omitempty" yaml:"stake_delta"` +} + +func (m *MsgUpdateResourceNodeStake) Reset() { *m = MsgUpdateResourceNodeStake{} } +func (m *MsgUpdateResourceNodeStake) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateResourceNodeStake) ProtoMessage() {} +func (*MsgUpdateResourceNodeStake) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{12} +} +func (m *MsgUpdateResourceNodeStake) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateResourceNodeStake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateResourceNodeStake.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 *MsgUpdateResourceNodeStake) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateResourceNodeStake.Merge(m, src) +} +func (m *MsgUpdateResourceNodeStake) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateResourceNodeStake) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateResourceNodeStake.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateResourceNodeStake proto.InternalMessageInfo + +// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. +type MsgUpdateResourceNodeStakeResponse struct { +} + +func (m *MsgUpdateResourceNodeStakeResponse) Reset() { *m = MsgUpdateResourceNodeStakeResponse{} } +func (m *MsgUpdateResourceNodeStakeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateResourceNodeStakeResponse) ProtoMessage() {} +func (*MsgUpdateResourceNodeStakeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{13} +} +func (m *MsgUpdateResourceNodeStakeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateResourceNodeStakeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateResourceNodeStakeResponse.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 *MsgUpdateResourceNodeStakeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateResourceNodeStakeResponse.Merge(m, src) +} +func (m *MsgUpdateResourceNodeStakeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateResourceNodeStakeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateResourceNodeStakeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateResourceNodeStakeResponse proto.InternalMessageInfo + +// MsgUpdateIndexingNodeStake defines a SDK message for updating the stake of an existing indexing node. +type MsgUpdateIndexingNodeStake struct { + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incrStake,omitempty" yaml:"incr_stake"` + StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"StakeDelta,omitempty" yaml:"stake_delta"` +} + +func (m *MsgUpdateIndexingNodeStake) Reset() { *m = MsgUpdateIndexingNodeStake{} } +func (m *MsgUpdateIndexingNodeStake) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateIndexingNodeStake) ProtoMessage() {} +func (*MsgUpdateIndexingNodeStake) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{14} +} +func (m *MsgUpdateIndexingNodeStake) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateIndexingNodeStake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateIndexingNodeStake.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 *MsgUpdateIndexingNodeStake) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateIndexingNodeStake.Merge(m, src) +} +func (m *MsgUpdateIndexingNodeStake) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateIndexingNodeStake) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateIndexingNodeStake.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateIndexingNodeStake proto.InternalMessageInfo + +// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. +type MsgUpdateIndexingNodeStakeResponse struct { +} + +func (m *MsgUpdateIndexingNodeStakeResponse) Reset() { *m = MsgUpdateIndexingNodeStakeResponse{} } +func (m *MsgUpdateIndexingNodeStakeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateIndexingNodeStakeResponse) ProtoMessage() {} +func (*MsgUpdateIndexingNodeStakeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{15} +} +func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse.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 *MsgUpdateIndexingNodeStakeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse.Merge(m, src) +} +func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateIndexingNodeStakeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse proto.InternalMessageInfo + +// MsgIndexingNodeRegistrationVote defines a SDK message for registration vote of an existing indexing node. +type MsgIndexingNodeRegistrationVote struct { + CandidateNetworkAddress string `protobuf:"bytes,1,opt,name=candidate_network_address,json=candidateNetworkAddress,proto3" json:"candidate_network_address,omitempty" yaml:"candidate_network_address"` + CandidateOwnerAddress string `protobuf:"bytes,2,opt,name=candidate_owner_address,json=candidateOwnerAddress,proto3" json:"candidate_owner_address,omitempty" yaml:"candidate_owner_address"` + Opinion bool `protobuf:"varint,3,opt,name=opinion,proto3" json:"opinion,omitempty" yaml:"opinion"` + VoterNetworkAddress string `protobuf:"bytes,4,opt,name=voter_network_address,json=voterNetworkAddress,proto3" json:"voter_network_address,omitempty" yaml:"voter_network_address"` + VoterOwnerAddress string `protobuf:"bytes,5,opt,name=voter_owner_address,json=voterOwnerAddress,proto3" json:"voter_owner_address,omitempty" yaml:"voter_owner_address"` +} + +func (m *MsgIndexingNodeRegistrationVote) Reset() { *m = MsgIndexingNodeRegistrationVote{} } +func (m *MsgIndexingNodeRegistrationVote) String() string { return proto.CompactTextString(m) } +func (*MsgIndexingNodeRegistrationVote) ProtoMessage() {} +func (*MsgIndexingNodeRegistrationVote) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{16} +} +func (m *MsgIndexingNodeRegistrationVote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIndexingNodeRegistrationVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIndexingNodeRegistrationVote.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 *MsgIndexingNodeRegistrationVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIndexingNodeRegistrationVote.Merge(m, src) +} +func (m *MsgIndexingNodeRegistrationVote) XXX_Size() int { + return m.Size() +} +func (m *MsgIndexingNodeRegistrationVote) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIndexingNodeRegistrationVote.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIndexingNodeRegistrationVote proto.InternalMessageInfo + +// MsgUpdateResourceNodeStakeResponse defines the Msg/IndexingNodeRegistrationVote response type. +type MsgIndexingNodeRegistrationVoteResponse struct { +} + +func (m *MsgIndexingNodeRegistrationVoteResponse) Reset() { + *m = MsgIndexingNodeRegistrationVoteResponse{} +} +func (m *MsgIndexingNodeRegistrationVoteResponse) String() string { return proto.CompactTextString(m) } +func (*MsgIndexingNodeRegistrationVoteResponse) ProtoMessage() {} +func (*MsgIndexingNodeRegistrationVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{17} +} +func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse.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 *MsgIndexingNodeRegistrationVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse.Merge(m, src) +} +func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateResourceNode)(nil), "stratos.register.v1.MsgCreateResourceNode") + proto.RegisterType((*MsgCreateResourceNodeResponse)(nil), "stratos.register.v1.MsgCreateResourceNodeResponse") + proto.RegisterType((*MsgCreateIndexingNode)(nil), "stratos.register.v1.MsgCreateIndexingNode") + proto.RegisterType((*MsgRemoveResourceNode)(nil), "stratos.register.v1.MsgRemoveResourceNode") + proto.RegisterType((*MsgRemoveResourceNodeResponse)(nil), "stratos.register.v1.MsgRemoveResourceNodeResponse") + proto.RegisterType((*MsgCreateIndexingNodeResponse)(nil), "stratos.register.v1.MsgCreateIndexingNodeResponse") + proto.RegisterType((*MsgRemoveIndexingNode)(nil), "stratos.register.v1.MsgRemoveIndexingNode") + proto.RegisterType((*MsgRemoveIndexingNodeResponse)(nil), "stratos.register.v1.MsgRemoveIndexingNodeResponse") + proto.RegisterType((*MsgUpdateResourceNode)(nil), "stratos.register.v1.MsgUpdateResourceNode") + proto.RegisterType((*MsgUpdateResourceNodeResponse)(nil), "stratos.register.v1.MsgUpdateResourceNodeResponse") + proto.RegisterType((*MsgUpdateIndexingNode)(nil), "stratos.register.v1.MsgUpdateIndexingNode") + proto.RegisterType((*MsgUpdateIndexingNodeResponse)(nil), "stratos.register.v1.MsgUpdateIndexingNodeResponse") + proto.RegisterType((*MsgUpdateResourceNodeStake)(nil), "stratos.register.v1.MsgUpdateResourceNodeStake") + proto.RegisterType((*MsgUpdateResourceNodeStakeResponse)(nil), "stratos.register.v1.MsgUpdateResourceNodeStakeResponse") + proto.RegisterType((*MsgUpdateIndexingNodeStake)(nil), "stratos.register.v1.MsgUpdateIndexingNodeStake") + proto.RegisterType((*MsgUpdateIndexingNodeStakeResponse)(nil), "stratos.register.v1.MsgUpdateIndexingNodeStakeResponse") + proto.RegisterType((*MsgIndexingNodeRegistrationVote)(nil), "stratos.register.v1.MsgIndexingNodeRegistrationVote") + proto.RegisterType((*MsgIndexingNodeRegistrationVoteResponse)(nil), "stratos.register.v1.MsgIndexingNodeRegistrationVoteResponse") +} + +func init() { proto.RegisterFile("stratos/register/v1/tx.proto", fileDescriptor_75d4b90d7a185a31) } + +var fileDescriptor_75d4b90d7a185a31 = []byte{ + // 1182 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0xfb, 0x8b, 0xee, 0xb4, 0xbb, 0xb0, 0x6e, 0xba, 0x9b, 0x46, 0x25, 0xae, 0x46, 0x2b, + 0xb1, 0x85, 0xad, 0x4d, 0xba, 0x15, 0x2b, 0xad, 0xca, 0xa1, 0xe9, 0x72, 0x40, 0xa8, 0x2d, 0x98, + 0x02, 0x52, 0x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d, 0xdd, 0xc6, 0xad, 0x5e, 0x66, 0x0f, 0xd1, 0xde, 0xcf, 0x0d, 0xfb, + 0xb1, 0xe5, 0x7a, 0xc6, 0x69, 0x7f, 0xb1, 0xf8, 0x1b, 0x25, 0x68, 0xcc, 0xb1, 0xbf, 0x32, 0xee, + 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xaf, 0x5d, 0x71, 0x2f, 0x14, 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 { + // CreateResourceNode defines a method for creating a new resource node. + CreateResourceNode(ctx context.Context, in *MsgCreateResourceNode, opts ...grpc.CallOption) (*MsgCreateResourceNodeResponse, error) + RemoveResourceNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveResourceNodeResponse, error) + UpdateResourceNode(ctx context.Context, in *MsgUpdateResourceNode, opts ...grpc.CallOption) (*MsgUpdateResourceNodeResponse, error) + UpdateResourceNodeStake(ctx context.Context, in *MsgUpdateResourceNodeStake, opts ...grpc.CallOption) (*MsgUpdateResourceNodeStakeResponse, error) + CreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) + RemoveIndexingNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) + UpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) + UpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) + IndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateResourceNode(ctx context.Context, in *MsgCreateResourceNode, opts ...grpc.CallOption) (*MsgCreateResourceNodeResponse, error) { + out := new(MsgCreateResourceNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/CreateResourceNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveResourceNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveResourceNodeResponse, error) { + out := new(MsgRemoveResourceNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/RemoveResourceNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateResourceNode(ctx context.Context, in *MsgUpdateResourceNode, opts ...grpc.CallOption) (*MsgUpdateResourceNodeResponse, error) { + out := new(MsgUpdateResourceNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateResourceNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateResourceNodeStake(ctx context.Context, in *MsgUpdateResourceNodeStake, opts ...grpc.CallOption) (*MsgUpdateResourceNodeStakeResponse, error) { + out := new(MsgUpdateResourceNodeStakeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateResourceNodeStake", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) { + out := new(MsgCreateIndexingNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/CreateIndexingNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveIndexingNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) { + out := new(MsgRemoveIndexingNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/RemoveIndexingNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) { + out := new(MsgUpdateIndexingNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateIndexingNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) { + out := new(MsgUpdateIndexingNodeStakeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateIndexingNodeStake", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) IndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) { + out := new(MsgIndexingNodeRegistrationVoteResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/IndexingNodeRegistrationVote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateResourceNode defines a method for creating a new resource node. + CreateResourceNode(context.Context, *MsgCreateResourceNode) (*MsgCreateResourceNodeResponse, error) + RemoveResourceNode(context.Context, *MsgRemoveResourceNode) (*MsgRemoveResourceNodeResponse, error) + UpdateResourceNode(context.Context, *MsgUpdateResourceNode) (*MsgUpdateResourceNodeResponse, error) + UpdateResourceNodeStake(context.Context, *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) + CreateIndexingNode(context.Context, *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) + RemoveIndexingNode(context.Context, *MsgRemoveResourceNode) (*MsgRemoveIndexingNodeResponse, error) + UpdateIndexingNode(context.Context, *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) + UpdateIndexingNodeStake(context.Context, *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) + IndexingNodeRegistrationVote(context.Context, *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateResourceNode(ctx context.Context, req *MsgCreateResourceNode) (*MsgCreateResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateResourceNode not implemented") +} +func (*UnimplementedMsgServer) RemoveResourceNode(ctx context.Context, req *MsgRemoveResourceNode) (*MsgRemoveResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveResourceNode not implemented") +} +func (*UnimplementedMsgServer) UpdateResourceNode(ctx context.Context, req *MsgUpdateResourceNode) (*MsgUpdateResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateResourceNode not implemented") +} +func (*UnimplementedMsgServer) UpdateResourceNodeStake(ctx context.Context, req *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateResourceNodeStake not implemented") +} +func (*UnimplementedMsgServer) CreateIndexingNode(ctx context.Context, req *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateIndexingNode not implemented") +} +func (*UnimplementedMsgServer) RemoveIndexingNode(ctx context.Context, req *MsgRemoveResourceNode) (*MsgRemoveIndexingNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveIndexingNode not implemented") +} +func (*UnimplementedMsgServer) UpdateIndexingNode(ctx context.Context, req *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateIndexingNode not implemented") +} +func (*UnimplementedMsgServer) UpdateIndexingNodeStake(ctx context.Context, req *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateIndexingNodeStake not implemented") +} +func (*UnimplementedMsgServer) IndexingNodeRegistrationVote(ctx context.Context, req *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IndexingNodeRegistrationVote not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateResourceNode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateResourceNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/CreateResourceNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateResourceNode(ctx, req.(*MsgCreateResourceNode)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveResourceNode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveResourceNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/RemoveResourceNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveResourceNode(ctx, req.(*MsgRemoveResourceNode)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateResourceNode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateResourceNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/UpdateResourceNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateResourceNode(ctx, req.(*MsgUpdateResourceNode)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateResourceNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateResourceNodeStake) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateResourceNodeStake(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/UpdateResourceNodeStake", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateResourceNodeStake(ctx, req.(*MsgUpdateResourceNodeStake)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CreateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateIndexingNode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateIndexingNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/CreateIndexingNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateIndexingNode(ctx, req.(*MsgCreateIndexingNode)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveResourceNode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveIndexingNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/RemoveIndexingNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveIndexingNode(ctx, req.(*MsgRemoveResourceNode)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateIndexingNode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateIndexingNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/UpdateIndexingNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateIndexingNode(ctx, req.(*MsgUpdateIndexingNode)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateIndexingNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateIndexingNodeStake) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateIndexingNodeStake(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/UpdateIndexingNodeStake", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateIndexingNodeStake(ctx, req.(*MsgUpdateIndexingNodeStake)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_IndexingNodeRegistrationVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgIndexingNodeRegistrationVote) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).IndexingNodeRegistrationVote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Msg/IndexingNodeRegistrationVote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).IndexingNodeRegistrationVote(ctx, req.(*MsgIndexingNodeRegistrationVote)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.register.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateResourceNode", + Handler: _Msg_CreateResourceNode_Handler, + }, + { + MethodName: "RemoveResourceNode", + Handler: _Msg_RemoveResourceNode_Handler, + }, + { + MethodName: "UpdateResourceNode", + Handler: _Msg_UpdateResourceNode_Handler, + }, + { + MethodName: "UpdateResourceNodeStake", + Handler: _Msg_UpdateResourceNodeStake_Handler, + }, + { + MethodName: "CreateIndexingNode", + Handler: _Msg_CreateIndexingNode_Handler, + }, + { + MethodName: "RemoveIndexingNode", + Handler: _Msg_RemoveIndexingNode_Handler, + }, + { + MethodName: "UpdateIndexingNode", + Handler: _Msg_UpdateIndexingNode_Handler, + }, + { + MethodName: "UpdateIndexingNodeStake", + Handler: _Msg_UpdateIndexingNodeStake_Handler, + }, + { + MethodName: "IndexingNodeRegistrationVote", + Handler: _Msg_IndexingNodeRegistrationVote_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/register/v1/tx.proto", +} + +func (m *MsgCreateResourceNode) 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 *MsgCreateResourceNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NodeType) > 0 { + i -= len(m.NodeType) + copy(dAtA[i:], m.NodeType) + i = encodeVarintTx(dAtA, i, uint64(len(m.NodeType))) + i-- + dAtA[i] = 0x32 + } + if m.Description != nil { + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateResourceNodeResponse) 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 *MsgCreateResourceNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCreateIndexingNode) 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 *MsgCreateIndexingNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Description != nil { + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveResourceNode) 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 *MsgRemoveResourceNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.ResourceNodeAddress) > 0 { + i -= len(m.ResourceNodeAddress) + copy(dAtA[i:], m.ResourceNodeAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ResourceNodeAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveResourceNodeResponse) 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 *MsgRemoveResourceNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCreateIndexingNodeResponse) 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 *MsgCreateIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRemoveIndexingNode) 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 *MsgRemoveIndexingNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.IndexingNodeAddress) > 0 { + i -= len(m.IndexingNodeAddress) + copy(dAtA[i:], m.IndexingNodeAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.IndexingNodeAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveIndexingNodeResponse) 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 *MsgRemoveIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateResourceNode) 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 *MsgUpdateResourceNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NodeType) > 0 { + i -= len(m.NodeType) + copy(dAtA[i:], m.NodeType) + i = encodeVarintTx(dAtA, i, uint64(len(m.NodeType))) + i-- + dAtA[i] = 0x22 + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddress))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgUpdateResourceNodeResponse) 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 *MsgUpdateResourceNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateIndexingNode) 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 *MsgUpdateIndexingNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddress))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgUpdateIndexingNodeResponse) 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 *MsgUpdateIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateResourceNodeStake) 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 *MsgUpdateResourceNodeStake) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateResourceNodeStake) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.StakeDelta != nil { + { + size, err := m.StakeDelta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.IncrStake { + i-- + if m.IncrStake { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateResourceNodeStakeResponse) 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 *MsgUpdateResourceNodeStakeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateResourceNodeStakeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateIndexingNodeStake) 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 *MsgUpdateIndexingNodeStake) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateIndexingNodeStake) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.StakeDelta != nil { + { + size, err := m.StakeDelta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.IncrStake { + i-- + if m.IncrStake { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateIndexingNodeStakeResponse) 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 *MsgUpdateIndexingNodeStakeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateIndexingNodeStakeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgIndexingNodeRegistrationVote) 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 *MsgIndexingNodeRegistrationVote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIndexingNodeRegistrationVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VoterOwnerAddress) > 0 { + i -= len(m.VoterOwnerAddress) + copy(dAtA[i:], m.VoterOwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.VoterOwnerAddress))) + i-- + dAtA[i] = 0x2a + } + if len(m.VoterNetworkAddress) > 0 { + i -= len(m.VoterNetworkAddress) + copy(dAtA[i:], m.VoterNetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.VoterNetworkAddress))) + i-- + dAtA[i] = 0x22 + } + if m.Opinion { + i-- + if m.Opinion { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.CandidateOwnerAddress) > 0 { + i -= len(m.CandidateOwnerAddress) + copy(dAtA[i:], m.CandidateOwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.CandidateOwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.CandidateNetworkAddress) > 0 { + i -= len(m.CandidateNetworkAddress) + copy(dAtA[i:], m.CandidateNetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.CandidateNetworkAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgIndexingNodeRegistrationVoteResponse) 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 *MsgIndexingNodeRegistrationVoteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIndexingNodeRegistrationVoteResponse) 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 *MsgCreateResourceNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Description != nil { + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NodeType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateResourceNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateIndexingNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Description != nil { + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveResourceNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ResourceNodeAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveResourceNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateIndexingNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveIndexingNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.IndexingNodeAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveIndexingNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateResourceNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.NetworkAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NodeType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateResourceNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateIndexingNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.NetworkAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateIndexingNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateResourceNodeStake) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.IncrStake { + n += 2 + } + if m.StakeDelta != nil { + l = m.StakeDelta.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateResourceNodeStakeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateIndexingNodeStake) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.IncrStake { + n += 2 + } + if m.StakeDelta != nil { + l = m.StakeDelta.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateIndexingNodeStakeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgIndexingNodeRegistrationVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CandidateNetworkAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.CandidateOwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Opinion { + n += 2 + } + l = len(m.VoterNetworkAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.VoterOwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgIndexingNodeRegistrationVoteResponse) 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 *MsgCreateResourceNode) 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: MsgCreateResourceNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateResourceNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", 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.NetworkAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Description == nil { + m.Description = &Description{} + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeType", 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.NodeType = 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 *MsgCreateResourceNodeResponse) 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: MsgCreateResourceNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateResourceNodeResponse: 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 *MsgCreateIndexingNode) 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: MsgCreateIndexingNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateIndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", 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.NetworkAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Description == nil { + m.Description = &Description{} + } + if err := m.Description.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 *MsgRemoveResourceNode) 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: MsgRemoveResourceNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveResourceNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNodeAddress", 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.ResourceNodeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = 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 *MsgRemoveResourceNodeResponse) 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: MsgRemoveResourceNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveResourceNodeResponse: 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 *MsgCreateIndexingNodeResponse) 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: MsgCreateIndexingNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateIndexingNodeResponse: 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 *MsgRemoveIndexingNode) 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: MsgRemoveIndexingNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveIndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodeAddress", 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.IndexingNodeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = 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 *MsgRemoveIndexingNodeResponse) 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: MsgRemoveIndexingNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveIndexingNodeResponse: 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 *MsgUpdateResourceNode) 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: MsgUpdateResourceNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateResourceNode: 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 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.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", 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.NetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeType", 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.NodeType = 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 *MsgUpdateResourceNodeResponse) 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: MsgUpdateResourceNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateResourceNodeResponse: 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 *MsgUpdateIndexingNode) 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: MsgUpdateIndexingNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateIndexingNode: 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 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.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", 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.NetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = 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 *MsgUpdateIndexingNodeResponse) 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: MsgUpdateIndexingNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateIndexingNodeResponse: 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 *MsgUpdateResourceNodeStake) 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: MsgUpdateResourceNodeStake: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateResourceNodeStake: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", 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.NetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IncrStake", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IncrStake = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeDelta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StakeDelta == nil { + m.StakeDelta = &types1.Coin{} + } + if err := m.StakeDelta.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 *MsgUpdateResourceNodeStakeResponse) 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: MsgUpdateResourceNodeStakeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateResourceNodeStakeResponse: 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 *MsgUpdateIndexingNodeStake) 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: MsgUpdateIndexingNodeStake: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateIndexingNodeStake: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", 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.NetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", 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.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IncrStake", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IncrStake = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeDelta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StakeDelta == nil { + m.StakeDelta = &types1.Coin{} + } + if err := m.StakeDelta.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 *MsgUpdateIndexingNodeStakeResponse) 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: MsgUpdateIndexingNodeStakeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateIndexingNodeStakeResponse: 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 *MsgIndexingNodeRegistrationVote) 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: MsgIndexingNodeRegistrationVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIndexingNodeRegistrationVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CandidateNetworkAddress", 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.CandidateNetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CandidateOwnerAddress", 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.CandidateOwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Opinion", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Opinion = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VoterNetworkAddress", 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.VoterNetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VoterOwnerAddress", 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.VoterOwnerAddress = 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 *MsgIndexingNodeRegistrationVoteResponse) 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: MsgIndexingNodeRegistrationVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIndexingNodeRegistrationVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/register/types/tx.pb.gw.go b/x/register/types/tx.pb.gw.go new file mode 100644 index 00000000..7d6e9039 --- /dev/null +++ b/x/register/types/tx.pb.gw.go @@ -0,0 +1,806 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/register/v1/tx.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/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 ( + filter_Msg_CreateResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_CreateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateResourceNode + 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_Msg_CreateResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_CreateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateResourceNode + 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_Msg_CreateResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateResourceNode(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_RemoveResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_RemoveResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveResourceNode + 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_Msg_RemoveResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RemoveResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_RemoveResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveResourceNode + 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_Msg_RemoveResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RemoveResourceNode(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_UpdateResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_UpdateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateResourceNode + 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_Msg_UpdateResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_UpdateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateResourceNode + 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_Msg_UpdateResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateResourceNode(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_UpdateResourceNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_UpdateResourceNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateResourceNodeStake + 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_Msg_UpdateResourceNodeStake_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateResourceNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_UpdateResourceNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateResourceNodeStake + 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_Msg_UpdateResourceNodeStake_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateResourceNodeStake(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_CreateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_CreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateIndexingNode + 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_Msg_CreateIndexingNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_CreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateIndexingNode + 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_Msg_CreateIndexingNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateIndexingNode(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_RemoveIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_RemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveResourceNode + 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_Msg_RemoveIndexingNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RemoveIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_RemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveResourceNode + 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_Msg_RemoveIndexingNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RemoveIndexingNode(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_UpdateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_UpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateIndexingNode + 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_Msg_UpdateIndexingNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_UpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateIndexingNode + 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_Msg_UpdateIndexingNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateIndexingNode(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_UpdateIndexingNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_UpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateIndexingNodeStake + 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_Msg_UpdateIndexingNodeStake_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateIndexingNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_UpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateIndexingNodeStake + 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_Msg_UpdateIndexingNodeStake_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateIndexingNodeStake(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_IndexingNodeRegistrationVote_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_IndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgIndexingNodeRegistrationVote + 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_Msg_IndexingNodeRegistrationVote_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.IndexingNodeRegistrationVote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_IndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgIndexingNodeRegistrationVote + 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_Msg_IndexingNodeRegistrationVote_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.IndexingNodeRegistrationVote(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". +// UnaryRPC :call MsgServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. +func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + + mux.Handle("POST", pattern_Msg_CreateResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_CreateResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_CreateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_RemoveResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_RemoveResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_RemoveResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_UpdateResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateResourceNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_UpdateResourceNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateResourceNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_CreateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_CreateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_CreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_RemoveIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_RemoveIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_RemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_UpdateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateIndexingNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_UpdateIndexingNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_IndexingNodeRegistrationVote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_IndexingNodeRegistrationVote_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_IndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMsgHandlerFromEndpoint(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 RegisterMsgHandler(ctx, mux, conn) +} + +// RegisterMsgHandler registers the http handlers for service Msg to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn)) +} + +// RegisterMsgHandlerClient registers the http handlers for service Msg +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MsgClient" to call the correct interceptors. +func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + + mux.Handle("POST", pattern_Msg_CreateResourceNode_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_Msg_CreateResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_CreateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_RemoveResourceNode_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_Msg_RemoveResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_RemoveResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateResourceNode_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_Msg_UpdateResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateResourceNodeStake_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_Msg_UpdateResourceNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateResourceNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_CreateIndexingNode_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_Msg_CreateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_CreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_RemoveIndexingNode_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_Msg_RemoveIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_RemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateIndexingNode_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_Msg_UpdateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_UpdateIndexingNodeStake_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_Msg_UpdateIndexingNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_UpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_IndexingNodeRegistrationVote_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_Msg_IndexingNodeRegistrationVote_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_IndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Msg_CreateResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_RemoveResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_UpdateResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_UpdateResourceNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_resource_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_CreateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_RemoveIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_UpdateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_UpdateIndexingNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_IndexingNodeRegistrationVote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "indexing_node_registration_vote"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Msg_CreateResourceNode_0 = runtime.ForwardResponseMessage + + forward_Msg_RemoveResourceNode_0 = runtime.ForwardResponseMessage + + forward_Msg_UpdateResourceNode_0 = runtime.ForwardResponseMessage + + forward_Msg_UpdateResourceNodeStake_0 = runtime.ForwardResponseMessage + + forward_Msg_CreateIndexingNode_0 = runtime.ForwardResponseMessage + + forward_Msg_RemoveIndexingNode_0 = runtime.ForwardResponseMessage + + forward_Msg_UpdateIndexingNode_0 = runtime.ForwardResponseMessage + + forward_Msg_UpdateIndexingNodeStake_0 = runtime.ForwardResponseMessage + + forward_Msg_IndexingNodeRegistrationVote_0 = runtime.ForwardResponseMessage +) diff --git a/x/register/types/unbonding_node.go b/x/register/types/unbonding_node.go index 9ceea56a..c7583715 100644 --- a/x/register/types/unbonding_node.go +++ b/x/register/types/unbonding_node.go @@ -6,9 +6,9 @@ import ( "strings" "time" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" + "github.com/tendermint/go-amino" ) // ======================= @@ -72,12 +72,12 @@ func (un *UnbondingNode) RemoveEntry(i int64) { } // return the unbonding Node -func MustMarshalUnbondingNode(cdc *codec.Codec, uin UnbondingNode) []byte { +func MustMarshalUnbondingNode(cdc *amino.Codec, uin UnbondingNode) []byte { return cdc.MustMarshalBinaryLengthPrefixed(uin) } // unmarshal a unbonding Node from a store value -func MustUnmarshalUnbondingNode(cdc *codec.Codec, value []byte) UnbondingNode { +func MustUnmarshalUnbondingNode(cdc *amino.Codec, value []byte) UnbondingNode { un, err := UnmarshalUnbondingNode(cdc, value) if err != nil { panic(err) @@ -86,7 +86,7 @@ func MustUnmarshalUnbondingNode(cdc *codec.Codec, value []byte) UnbondingNode { } // unmarshal a unbonding Node from a store value -func UnmarshalUnbondingNode(cdc *codec.Codec, value []byte) (uin UnbondingNode, err error) { +func UnmarshalUnbondingNode(cdc *amino.Codec, value []byte) (uin UnbondingNode, err error) { err = cdc.UnmarshalBinaryLengthPrefixed(value, &uin) return uin, err } From 88ca8cff39a4a6da97e33c8e9e97bea35e1cffaf Mon Sep 17 00:00:00 2001 From: jialbai Date: Tue, 3 May 2022 17:43:37 -0400 Subject: [PATCH 009/113] - qb-1163: keeper migration (todo: change addr in proto from str to bytes) --- x/register/keeper/keeper.go | 49 ++++++++++++++++++------------------- x/register/types/codec.go | 2 +- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index a9f75659..e9cf9865 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -5,23 +5,22 @@ import ( "fmt" "time" - "github.com/cosmos/cosmos-sdk/codec" + //"github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/params" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" + "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/log" ) // Keeper of the register store type Keeper struct { storeKey sdk.StoreKey - cdc *codec.Codec - paramSpace params.Subspace - accountKeeper auth.AccountKeeper - bankKeeper bank.Keeper + cdc *amino.Codec + paramSpace types.ParamSubspace + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper hooks types.RegisterHooks resourceNodeCache map[string]cachedResourceNode resourceNodeCacheList *list.List @@ -30,8 +29,8 @@ type Keeper struct { } // NewKeeper creates a register keeper -func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, - accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper) Keeper { +func NewKeeper(cdc *amino.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, + accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper) Keeper { keeper := Keeper{ storeKey: key, @@ -64,7 +63,7 @@ func (k *Keeper) SetHooks(sh types.RegisterHooks) *Keeper { func (k Keeper) SetInitialUOzonePrice(ctx sdk.Context, price sdk.Dec) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(price) + b := amino.MustMarshalBinaryLengthPrefixed(price) store.Set(types.InitialUOzonePriceKey, b) } @@ -74,13 +73,13 @@ func (k Keeper) GetInitialUOzonePrice(ctx sdk.Context) (price sdk.Dec) { if b == nil { panic("Stored initial uOzone price should not have been nil") } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &price) + amino.MustUnmarshalBinaryLengthPrefixed(b, &price) return } func (k Keeper) SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(totalUnissuedPrepay) + b := amino.MustMarshalBinaryLengthPrefixed(totalUnissuedPrepay) store.Set(types.TotalUnissuedPrepayKey, b) } @@ -90,13 +89,13 @@ func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk if b == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &totalUnissuedPrepay) + amino.MustUnmarshalBinaryLengthPrefixed(b, &totalUnissuedPrepay) return } func (k Keeper) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(stake) + b := amino.MustMarshalBinaryLengthPrefixed(stake) store.Set(types.InitialGenesisStakeTotalKey, b) } @@ -106,13 +105,13 @@ func (k Keeper) GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) { if b == nil { return sdk.ZeroInt() } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &stake) + amino.MustUnmarshalBinaryLengthPrefixed(b, &stake) return } func (k Keeper) SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(value) + b := amino.MustMarshalBinaryLengthPrefixed(value) store.Set(types.UpperBoundOfTotalOzoneKey, b) } @@ -122,7 +121,7 @@ func (k Keeper) GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int) { if b == nil { return sdk.ZeroInt() } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &value) + amino.MustUnmarshalBinaryLengthPrefixed(b, &value) return } @@ -307,14 +306,14 @@ func (k Keeper) GetUnbondingNodeQueueTimeSlice(ctx sdk.Context, timestamp time.T if bz == nil { return []stratos.SdsAddress{} } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &networkAddrs) + amino.MustUnmarshalBinaryLengthPrefixed(bz, &networkAddrs) return networkAddrs } // Sets a specific unbonding queue timeslice. func (k Keeper) SetUnbondingNodeQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []stratos.SdsAddress) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(keys) + bz := amino.MustMarshalBinaryLengthPrefixed(keys) store.Set(types.GetUBDTimeKey(timestamp), bz) } @@ -352,7 +351,7 @@ func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, for ; unbondingTimesliceIterator.Valid(); unbondingTimesliceIterator.Next() { timeslice := []stratos.SdsAddress{} value := unbondingTimesliceIterator.Value() - k.cdc.MustUnmarshalBinaryLengthPrefixed(value, ×lice) + amino.MustUnmarshalBinaryLengthPrefixed(value, ×lice) matureUnbonds = append(matureUnbonds, timeslice...) store.Delete(unbondingTimesliceIterator.Key()) } @@ -448,7 +447,7 @@ func (k Keeper) UnbondResourceNode( bondDenom := k.GetParams(ctx).BondDenom coin := sdk.NewCoin(bondDenom, amt) - if resourceNode.GetStatus() == sdk.Bonded { + if resourceNode.GetStatus() == stakingtypes.Bonded { // transfer the node tokens to the not bonded pool k.bondedToUnbonding(ctx, resourceNode, false, coin) // adjust ozone limit @@ -457,7 +456,7 @@ func (k Keeper) UnbondResourceNode( // change node status to unbonding if unbonding all tokens if amt.Equal(resourceNode.Tokens) { - resourceNode.Status = sdk.Unbonding + resourceNode.Status = stakingtypes.Unbonding k.SetResourceNode(ctx, resourceNode) } @@ -491,7 +490,7 @@ func (k Keeper) UnbondIndexingNode( bondDenom := k.GetParams(ctx).BondDenom coin := sdk.NewCoin(bondDenom, amt) - if indexingNode.GetStatus() == sdk.Bonded { + if indexingNode.GetStatus() == stakingtypes.Bonded { // transfer the node tokens to the not bonded pool k.bondedToUnbonding(ctx, indexingNode, true, coin) // adjust ozone limit @@ -499,7 +498,7 @@ func (k Keeper) UnbondIndexingNode( } // change node status to unbonding if unbonding all tokens if amt.Equal(indexingNode.Tokens) { - indexingNode.Status = sdk.Unbonding + indexingNode.Status = stakingtypes.Unbonding k.SetIndexingNode(ctx, indexingNode) } diff --git a/x/register/types/codec.go b/x/register/types/codec.go index b8d329ca..1f8cc5b8 100644 --- a/x/register/types/codec.go +++ b/x/register/types/codec.go @@ -11,7 +11,7 @@ import ( // RegisterLegacyAminoCodec registers concrete types on codec func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(MsgCreateResourceNode{}, "register/CreateResourceNode", nil) + cdc.RegisterConcrete(MsgCreateResourceNode{}, "register/CreateResourceNodeTx", nil) cdc.RegisterConcrete(MsgRemoveResourceNode{}, "register/RemoveResourceNodeTx", nil) cdc.RegisterConcrete(MsgUpdateResourceNode{}, "register/UpdateResourceNodeTx", nil) cdc.RegisterConcrete(MsgUpdateResourceNodeStake{}, "register/UpdateResourceNodeStakeTx", nil) From 3528a00e081b638b5d2e6f29982164b8e96ca0c2 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 4 May 2022 14:08:13 -0400 Subject: [PATCH 010/113] upgrade register module --- app/app.go | 30 +- proto/stratos/register/v1/query.proto | 301 +---- scripts/proto-tools-installer.sh | 4 +- types/address.go | 72 +- x/register/abci.go | 27 + x/register/client/cli/query.go | 45 +- x/register/client/cli/tx.go | 639 ++++----- x/register/exported/exported.go | 5 +- x/register/genesis.go | 51 +- x/register/keeper/migrations.go | 21 + x/register/module.go | 132 +- x/register/types/codec.go | 12 +- x/register/types/expected_keepers.go | 35 +- x/register/types/msg.go | 34 +- x/register/types/querier.go | 48 +- x/register/types/query.pb.go | 1725 +++++++++++++++++++++++++ x/register/types/query.pb.gw.go | 380 ++++++ x/register/types/registration.go | 19 - x/register/types/unbonding_node.go | 14 +- 19 files changed, 2800 insertions(+), 794 deletions(-) mode change 100644 => 100755 scripts/proto-tools-installer.sh create mode 100644 x/register/keeper/migrations.go create mode 100644 x/register/types/query.pb.go create mode 100644 x/register/types/query.pb.gw.go diff --git a/app/app.go b/app/app.go index f1412cac..928b87c5 100644 --- a/app/app.go +++ b/app/app.go @@ -9,6 +9,7 @@ import ( "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" + "github.com/stratosnet/stratos-chain/x/register" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" @@ -137,7 +138,7 @@ var ( transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, // stratos modules - //register.AppModuleBasic{}, + register.AppModuleBasic{}, //pot.AppModuleBasic{}, //sds.AppModuleBasic{}, evm.AppModuleBasic{}, @@ -200,7 +201,7 @@ type NewApp struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper // stratos keepers - //registerKeeper register.Keeper + registerKeeper register.Keeper //potKeeper pot.Keeper //sdsKeeper sds.Keeper evmKeeper *evmkeeper.Keeper @@ -246,7 +247,8 @@ func NewInitApp( // ibc keys ibchost.StoreKey, ibctransfertypes.StoreKey, // stratos keys - //register.StoreKey, pot.StoreKey, sds.StoreKey, + register.StoreKey, + //pot.StoreKey, sds.StoreKey, evmtypes.StoreKey, ) @@ -369,14 +371,14 @@ func NewInitApp( app.evidenceKeeper = *evidenceKeeper // Create Stratos keepers - //app.registerKeeper = register.NewKeeper( - // app.cdc, - // keys[register.StoreKey], - // app.subspaces[register.ModuleName], - // app.accountKeeper, - // app.bankKeeper, - //) - // + app.registerKeeper = register.NewKeeper( + app.cdc, + keys[register.StoreKey], + app.subspaces[register.ModuleName], + app.accountKeeper, + app.bankKeeper, + ) + //app.potKeeper = pot.NewKeeper( // app.cdc, // keys[pot.StoreKey], @@ -427,7 +429,7 @@ func NewInitApp( // Stratos app modules evm.NewAppModule(app.evmKeeper, app.accountKeeper), - //register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), + register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), //pot.NewAppModule(app.potKeeper, app.bankKeeper, app.supplyKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), //sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), ) @@ -466,7 +468,7 @@ func NewInitApp( crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, - //register.ModuleName, + register.ModuleName, evmtypes.ModuleName, // no-op modules ibchost.ModuleName, @@ -693,7 +695,7 @@ func initParamsKeeper( paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) // stratos subspaces - //paramsKeeper.Subspace(registertypes.ModuleName) + paramsKeeper.Subspace(registertypes.ModuleName) //paramsKeeper.Subspace(pottypes.ModuleName) //paramsKeeper.Subspace(sdstypes.ModuleName) paramsKeeper.Subspace(evmtypes.ModuleName) diff --git a/proto/stratos/register/v1/query.proto b/proto/stratos/register/v1/query.proto index 51c49f63..646b3585 100644 --- a/proto/stratos/register/v1/query.proto +++ b/proto/stratos/register/v1/query.proto @@ -1,297 +1,78 @@ syntax = "proto3"; -package stratos.evm.v1; +package stratos.register.v1; -import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "stratos/evm/v1/evm.proto"; -import "stratos/evm/v1/tx.proto"; -import "google/protobuf/timestamp.proto"; +import "stratos/register/v1/register.proto"; -option go_package = "github.com/stratosnet/stratos-chain/x/evm/types"; +option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; // Query defines the gRPC querier service. service Query { - // Account queries an Ethereum account. - rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { - option (google.api.http).get = "/stratos/evm/v1/account/{address}"; - } - - // CosmosAccount queries an Ethereum account's Cosmos Address. - rpc CosmosAccount(QueryCosmosAccountRequest) - returns (QueryCosmosAccountResponse) { - option (google.api.http).get = "/stratos/evm/v1/cosmos_account/{address}"; - } - - // ValidatorAccount queries an Ethereum account's from a validator consensus - // Address. - rpc ValidatorAccount(QueryValidatorAccountRequest) - returns (QueryValidatorAccountResponse) { - option (google.api.http).get = - "/stratos/evm/v1/validator_account/{cons_address}"; - } - - // Balance queries the balance of a the EVM denomination for a single - // EthAccount. - rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/stratos/evm/v1/balances/{address}"; - } - - // Storage queries the balance of all coins for a single account. - rpc Storage(QueryStorageRequest) returns (QueryStorageResponse) { - option (google.api.http).get = "/stratos/evm/v1/storage/{address}/{key}"; - } - - // Code queries the balance of all coins for a single account. - rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { - option (google.api.http).get = "/stratos/evm/v1/codes/{address}"; - } - - // Params queries the parameters of x/evm module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/stratos/evm/v1/params"; - } - - // EthCall implements the `eth_call` rpc api - rpc EthCall(EthCallRequest) returns (MsgEthereumTxResponse) { - option (google.api.http).get = "/stratos/evm/v1/eth_call"; - } - - // EstimateGas implements the `eth_estimateGas` rpc api - rpc EstimateGas(EthCallRequest) returns (EstimateGasResponse) { - option (google.api.http).get = "/stratos/evm/v1/estimate_gas"; - } - - // TraceTx implements the `debug_traceTransaction` rpc api - rpc TraceTx(QueryTraceTxRequest) returns (QueryTraceTxResponse) { - option (google.api.http).get = "/stratos/evm/v1/trace_tx"; - } - - // TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api - rpc TraceBlock(QueryTraceBlockRequest) returns (QueryTraceBlockResponse) { - option (google.api.http).get = "/stratos/evm/v1/trace_block"; + // ResourceNode queries ResourceNode info for given ResourceNode address. + rpc ResourceNode(QueryResourceNodeRequest) returns (QueryResourceNodeResponse) { + option (google.api.http).get = "/stratos/register/v1/resource-nodes/{node_addr}"; } - // BaseFee queries the base fee of the parent block of the current block. - rpc QueryBaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) { - option (google.api.http).get = "/stratos/evm/v1/base_fee"; + // IndexingNode queries IndexingNode info for given IndexingNode address. + rpc IndexingNode(QueryIndexingNodeRequest) returns (QueryIndexingNodeResponse) { + option (google.api.http).get = "/stratos/register/v1/indexing-nodes/{node_addr}"; } - // BlockGas queries the gas used at a given block height - rpc BlockGas(QueryBlockGasRequest) returns (QueryBlockGasResponse) { - option (google.api.http).get = "/stratos/evm/v1/block_gas"; + // Owner queries all staking info for given Owner address. + rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) { + option (google.api.http).get = "/stratos/register/v1/owner/{owner_addr}"; } } -// QueryAccountRequest is the request type for the Query/Account RPC method. -message QueryAccountRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the ethereum hex address to query the account for. - string address = 1; -} - -// QueryAccountResponse is the response type for the Query/Account RPC method. -message QueryAccountResponse { - // balance is the balance of the EVM denomination. - string balance = 1; - // code hash is the hex-formatted code bytes from the EOA. - string code_hash = 2; - // nonce is the account's sequence number. - uint64 nonce = 3; -} - -// QueryCosmosAccountRequest is the request type for the Query/CosmosAccount RPC -// method. -message QueryCosmosAccountRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the ethereum hex address to query the account for. - string address = 1; -} - -// QueryCosmosAccountResponse is the response type for the Query/CosmosAccount -// RPC method. -message QueryCosmosAccountResponse { - // cosmos_address is the cosmos address of the account. - string cosmos_address = 1; - // sequence is the account's sequence number. - uint64 sequence = 2; - // account_number is the account numbert - uint64 account_number = 3; +// QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method +message QueryResourceNodeRequest { + // node_addr defines the node address to query for. + string node_addr = 1; } -// QueryValidatorAccountRequest is the request type for the -// Query/ValidatorAccount RPC method. -message QueryValidatorAccountRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // cons_address is the validator cons address to query the account for. - string cons_address = 1; -} - -// QueryValidatorAccountResponse is the response type for the -// Query/ValidatorAccount RPC method. -message QueryValidatorAccountResponse { - // account_address is the cosmos address of the account in bech32 format. - string account_address = 1; - // sequence is the account's sequence number. - uint64 sequence = 2; - // account_number is the account number - uint64 account_number = 3; -} - -// QueryBalanceRequest is the request type for the Query/Balance RPC method. -message QueryBalanceRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the ethereum hex address to query the balance for. - string address = 1; +// QueryResourceNodeResponse is response type for the Query/ResourceNode RPC method +message QueryResourceNodeResponse { + // node defines the the resourceNode info. + ResourceNode node = 1 [(gogoproto.nullable) = false]; } -// QueryBalanceResponse is the response type for the Query/Balance RPC method. -message QueryBalanceResponse { - // balance is the balance of the EVM denomination. - string balance = 1; +// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method +message QueryIndexingNodeRequest { + // node_addr defines the node address to query for. + string node_addr = 1; } -// QueryStorageRequest is the request type for the Query/Storage RPC method. -message QueryStorageRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - /// address is the ethereum hex address to query the storage state for. - string address = 1; - - // key defines the key of the storage state - string key = 2; +// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method +message QueryIndexingNodeResponse { + // node defines the the indexing info. + IndexingNode node = 1 [(gogoproto.nullable) = false]; } -// QueryStorageResponse is the response type for the Query/Storage RPC -// method. -message QueryStorageResponse { - // key defines the storage state value hash associated with the given key. - string value = 1; +// QueryOwnerRequest is request type for the Query/Owner RPC method +message QueryOwnerRequest { + // owner_addr defines the owner address to query for. + string owner_addr = 1; } -// QueryCodeRequest is the request type for the Query/Code RPC method. -message QueryCodeRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the ethereum hex address to query the code for. - string address = 1; -} - -// QueryCodeResponse is the response type for the Query/Code RPC -// method. -message QueryCodeResponse { - // code represents the code bytes from an ethereum address. - bytes code = 1; -} - -// QueryTxLogsRequest is the request type for the Query/TxLogs RPC method. -message QueryTxLogsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // hash is the ethereum transaction hex hash to query the logs for. - string hash = 1; +// QueryOwnerResponse is response type for the Query/Owner RPC method +message QueryOwnerResponse { + // owner defines the the owner info. + string owner = 1 [(gogoproto.nullable) = true]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryTxLogs is the response type for the Query/TxLogs RPC method. -message QueryTxLogsResponse { - // logs represents the ethereum logs generated from the given transaction. - repeated Log logs = 1; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryParamsRequest defines the request type for querying x/evm parameters. +// QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} -// QueryParamsResponse defines the response type for querying x/evm parameters. +// QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { - // params define the evm module parameters. - Params params = 1 [ (gogoproto.nullable) = false ]; -} - -// EthCallRequest defines EthCall request -message EthCallRequest { - // same json format as the json rpc api. - bytes args = 1; - // the default gas cap to be used - uint64 gas_cap = 2; -} - -// EstimateGasResponse defines EstimateGas response -message EstimateGasResponse { - // the estimated gas - uint64 gas = 1; -} - -// QueryTraceTxRequest defines TraceTx request -message QueryTraceTxRequest { - // msgEthereumTx for the requested transaction - MsgEthereumTx msg = 1; - // TraceConfig holds extra parameters to trace functions. - TraceConfig trace_config = 2; - // the predecessor transactions included in the same block - // need to be replayed first to get correct context for tracing. - repeated MsgEthereumTx predecessors = 3; - // block number of requested transaction - int64 block_number = 4; - // block hex hash of requested transaction - string block_hash = 5; - // block time of requested transaction - google.protobuf.Timestamp block_time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false]; } -// QueryTraceTxResponse defines TraceTx response -message QueryTraceTxResponse { - // response serialized in bytes - bytes data = 1; -} -// QueryTraceBlockRequest defines TraceTx request -message QueryTraceBlockRequest { - // txs messages in the block - repeated MsgEthereumTx txs = 1; - // TraceConfig holds extra parameters to trace functions. - TraceConfig trace_config = 3; - // block number - int64 block_number = 5; - // block hex hash - string block_hash = 6; - // block time - google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} - -// QueryTraceBlockResponse defines TraceBlock response -message QueryTraceBlockResponse { - bytes data = 1; -} - - -// QueryBaseFeeRequest defines the request type for querying the EIP1559 base -// fee. -message QueryBaseFeeRequest {} - -// BaseFeeResponse returns the EIP1559 base fee. -message QueryBaseFeeResponse { - string base_fee = 1 - [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; -} -// QueryBlockGasRequest defines the request type for querying the EIP1559 base -// fee. -message QueryBlockGasRequest {} -// QueryBlockGasResponse returns block gas used for a given height. -message QueryBlockGasResponse { int64 gas = 1; } \ No newline at end of file diff --git a/scripts/proto-tools-installer.sh b/scripts/proto-tools-installer.sh old mode 100644 new mode 100755 index 6ea8b712..f9cb2c6d --- a/scripts/proto-tools-installer.sh +++ b/scripts/proto-tools-installer.sh @@ -149,7 +149,7 @@ f_ensure_tools f_ensure_dirs f_install_protoc f_install_buf -f_install_protoc_gen_gocosmos +#f_install_protoc_gen_gocosmos f_install_protoc_gen_grpc_gateway -f_install_protoc_gen_swagger +#f_install_protoc_gen_swagger f_install_clang_format \ No newline at end of file diff --git a/types/address.go b/types/address.go index 4f48de4b..d4773c5d 100644 --- a/types/address.go +++ b/types/address.go @@ -6,13 +6,13 @@ import ( "fmt" "strings" + "github.com/cosmos/cosmos-sdk/crypto/types" "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" - //tmamino "github.com/tendermint/go-amino" - "github.com/tendermint/tendermint/crypto" + "github.com/cosmos/cosmos-sdk/codec/legacy" ) // Bech32PubKeyType defines a string type alias for a Bech32 public key type. @@ -42,29 +42,7 @@ const ( // Bech32ifyPubKey returns a Bech32 encoded string containing the appropriate // prefix based on the key type provided for a given PublicKey. -func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) (string, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetConfig().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() - - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() - - case Bech32PubKeyTypeSdsP2PPub: - bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() - } - - return bech32.ConvertAndEncode(bech32Prefix, pubkey.Bytes()) -} - -// GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with -// a given key type. -//func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (crypto.PubKey, error) { +//func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) (string, error) { // var bech32Prefix string // // switch pkt { @@ -81,19 +59,41 @@ func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) (string, error) // bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() // } // -// bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) -// if err != nil { -// return nil, err -// } -// -// pk, err := tmamino.PubKeyFromBytes(bz) -// if err != nil { -// return nil, err -// } -// -// return pk, nil +// return bech32.ConvertAndEncode(bech32Prefix, pubkey.Bytes()) //} +// GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with +// a given key type. +func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (types.PubKey, error) { + var bech32Prefix string + + switch pkt { + case Bech32PubKeyTypeAccPub: + bech32Prefix = GetConfig().GetBech32AccountPubPrefix() + + case Bech32PubKeyTypeValPub: + bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() + + case Bech32PubKeyTypeConsPub: + bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() + + case Bech32PubKeyTypeSdsP2PPub: + bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() + } + + bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) + if err != nil { + return nil, err + } + + pk, err := legacy.PubKeyFromBytes(bz) + if err != nil { + return nil, err + } + + return pk, nil +} + type SdsAddress []byte var _ sdk.Address = SdsAddress{} diff --git a/x/register/abci.go b/x/register/abci.go index 03773d7a..5345450a 100644 --- a/x/register/abci.go +++ b/x/register/abci.go @@ -16,3 +16,30 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { return k.BlockRegisteredNodesUpdates(ctx) } + + +import ( +"time" + +abci "github.com/tendermint/tendermint/abci/types" + +"github.com/cosmos/cosmos-sdk/telemetry" +sdk "github.com/cosmos/cosmos-sdk/types" +"github.com/cosmos/cosmos-sdk/x/staking/keeper" +"github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// BeginBlocker will persist the current header and validator set as a historical entry +// and prune the oldest entry based on the HistoricalEntries parameter +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { + defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) + + k.TrackHistoricalInfo(ctx) +} + +// Called every block, update validator set +func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { + defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) + + return k.BlockValidatorUpdates(ctx) +} diff --git a/x/register/client/cli/query.go b/x/register/client/cli/query.go index 03b0251b..b5cb75af 100644 --- a/x/register/client/cli/query.go +++ b/x/register/client/cli/query.go @@ -6,9 +6,8 @@ import ( "strings" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -18,7 +17,7 @@ import ( ) // GetQueryCmd returns the cli query commands for register module -func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { +func GetQueryCmd() *cobra.Command { // Group register queries under a subcommand registerQueryCmd := &cobra.Command{ Use: types.ModuleName, @@ -29,18 +28,16 @@ func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { } registerQueryCmd.AddCommand( - flags.GetCommands( - // this line is used by starport scaffolding # 1 - GetCmdQueryResourceNode(queryRoute, cdc), - GetCmdQueryIndexingNodeList(queryRoute, cdc), - )..., + GetCmdQueryResourceNode(), + GetCmdQueryindexingNode(), + //GetCmdQueryIndexingNodeList(), ) return registerQueryCmd } // GetCmdQueryResourceNode implements the query resource nodes by network address command. -func GetCmdQueryResourceNode(queryRoute string, cdc *codec.Codec) *cobra.Command { +func GetCmdQueryResourceNode() *cobra.Command { cmd := &cobra.Command{ Use: "get-resource-nodes [flags]", // []byte Short: "Query resource node by network address", @@ -48,19 +45,26 @@ func GetCmdQueryResourceNode(queryRoute string, cdc *codec.Codec) *cobra.Command fmt.Sprintf(`Query resource node by network address`), ), RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) // query resource node by network address queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) if queryFlagNetworkAddr == "" { return sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") } - resp, err := GetResNodesByNetworkAddr(cliCtx, queryRoute) + + result, err := queryClient.ResourceNode(cmd.Context(), &types.QueryResourceNodeRequest{ + // Leaving status empty on purpose to query all validators. + }) if err != nil { return err } - return cliCtx.PrintOutput(resp) + + return clientCtx.PrintProto(result) }, } cmd.Flags().String(FlagNetworkAddress, "", "(optional) The network address of the node") @@ -156,3 +160,18 @@ func QueryIndexingNodes(cliCtx context.CLIContext, queryRoute, networkAddr strin } return cliCtx.QueryWithData(route, bz) } + +// Route returns the message routing key for the staking module. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the staking module's querier route name. +func (AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +// LegacyQuerierHandler returns the staking module sdk.Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) +} diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index 58e811f5..ea504de3 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -1,71 +1,64 @@ package cli import ( - "bufio" - "errors" - "fmt" "strconv" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/spf13/viper" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" ) -// GetTxCmd returns the transaction commands for this module -func GetTxCmd(cdc *codec.Codec) *cobra.Command { +// NewTxCmd returns the transaction commands for this module +func NewTxCmd() *cobra.Command { registerTxCmd := &cobra.Command{ Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + Short: "transactions subcommands", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } - registerTxCmd.AddCommand(flags.PostCommands( - CreateResourceNodeCmd(cdc), - RemoveResourceNodeCmd(cdc), - UpdateResourceNodeCmd(cdc), - UpdateResourceNodeStakeCmd(cdc), - - CreateIndexingNodeCmd(cdc), - RemoveIndexingNodeCmd(cdc), - UpdateIndexingNodeCmd(cdc), - UpdateIndexingNodeStakeCmd(cdc), - IndexingNodeRegistrationVoteCmd(cdc), - )...) + registerTxCmd.AddCommand( + CreateResourceNodeCmd(), + RemoveResourceNodeCmd(), + UpdateResourceNodeCmd(), + UpdateResourceNodeStakeCmd(), + + CreateIndexingNodeCmd(), + RemoveIndexingNodeCmd(), + UpdateIndexingNodeCmd(), + UpdateIndexingNodeStakeCmd(), + IndexingNodeRegistrationVoteCmd(), + ) return registerTxCmd } // CreateResourceNodeCmd will create a file upload tx and sign it with the given key. -func CreateResourceNodeCmd(cdc *codec.Codec) *cobra.Command { +func CreateResourceNodeCmd() *cobra.Command { cmd := &cobra.Command{ Use: "create-resource-node [flags]", Short: "create a new resource node", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - if !viper.IsSet(FlagNetworkAddress) { - return errors.New("required flag(s) \"network-id\" not set") + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err } - if !viper.IsSet(FlagMoniker) { - return errors.New("required flag(s) \"moniker\" not set") - } - txBldr, msg, err := buildCreateResourceNodeMsg(cliCtx, txBldr) + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildCreateResourceNodeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } @@ -83,82 +76,209 @@ func CreateResourceNodeCmd(cdc *codec.Codec) *cobra.Command { return cmd } -// UpdateResourceNodeStakeCmd will add/subtract resource node's stake. -func UpdateResourceNodeStakeCmd(cdc *codec.Codec) *cobra.Command { +// CreateIndexingNodeCmd will create a file upload tx and sign it with the given key. +func CreateIndexingNodeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "update-resource-node-stake [flags]", - Short: "update resource node's stake", + Use: "create-indexing-node [flags]", + Short: "create a new indexing node", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - txBldr, msg, err := buildUpdateResourceNodeStakeMsg(cliCtx, txBldr) + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildCreateIndexingNodeMsg(clientCtx, txf, cmd.Flags()) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } - - cmd.Flags().AddFlagSet(FsIncrStake) - cmd.Flags().AddFlagSet(FsStakeDelta) + cmd.Flags().AddFlagSet(FsPk) + cmd.Flags().AddFlagSet(FsAmount) cmd.Flags().AddFlagSet(FsNetworkAddress) + cmd.Flags().AddFlagSet(FsDescription) _ = cmd.MarkFlagRequired(flags.FlagFrom) - _ = cmd.MarkFlagRequired(FlagStakeDelta) - _ = cmd.MarkFlagRequired(FlagIncrStake) - _ = cmd.MarkFlagRequired(FlagNetworkAddress) + _ = cmd.MarkFlagRequired(FlagAmount) + _ = cmd.MarkFlagRequired(FlagPubKey) + return cmd } -// CreateIndexingNodeCmd will create a file upload tx and sign it with the given key. -func CreateIndexingNodeCmd(cdc *codec.Codec) *cobra.Command { +func RemoveResourceNodeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "create-indexing-node [flags]", - Short: "create a new indexing node", + Use: "remove-resource-node [resource_node_address] [owner_address]", + Args: cobra.ExactArgs(2), + Short: "remove resource node", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + resourceNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) + if err != nil { + return err + } + ownerAddr := clientCtx.GetFromAddress() + + msg := types.NewMsgRemoveResourceNode(resourceNodeAddr, ownerAddr) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + return cmd +} + +func RemoveIndexingNodeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-indexing-node [indexing_node_address] [owner_address]", + Args: cobra.ExactArgs(2), + Short: "remove indexing node", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - if !viper.IsSet(FlagNetworkAddress) { - return errors.New("required flag(s) \"network-id\" not set") + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err } - if !viper.IsSet(FlagMoniker) { - return errors.New("required flag(s) \"moniker\" not set") + + resourceNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) + if err != nil { + return err } - txBldr, msg, err := buildCreateIndexingNodeMsg(cliCtx, txBldr) + ownerAddr := clientCtx.GetFromAddress() + + msg := types.NewMsgRemoveIndexingNode(resourceNodeAddr, ownerAddr) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + return cmd +} + +func UpdateResourceNodeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-resource-node [flags]", + Short: "update resource node info", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildUpdateResourceNodeMsg(clientCtx, txf, cmd.Flags()) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } - cmd.Flags().AddFlagSet(FsPk) - cmd.Flags().AddFlagSet(FsAmount) + cmd.Flags().AddFlagSet(FsNetworkAddress) cmd.Flags().AddFlagSet(FsDescription) + cmd.Flags().AddFlagSet(FsNodeType) + cmd.Flags().AddFlagSet(FsNetworkAddress) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + _ = cmd.MarkFlagRequired(FlagMoniker) + _ = cmd.MarkFlagRequired(FlagNodeType) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) _ = cmd.MarkFlagRequired(flags.FlagFrom) - _ = cmd.MarkFlagRequired(FlagAmount) - _ = cmd.MarkFlagRequired(FlagPubKey) return cmd } +func UpdateIndexingNodeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-indexing-node [flags]", + Short: "update indexing node info", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildUpdateIndexingNodeMsg(clientCtx, txf, cmd.Flags()) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + cmd.Flags().AddFlagSet(FsNetworkAddress) + cmd.Flags().AddFlagSet(FsDescription) + cmd.Flags().AddFlagSet(FsNetworkAddress) + + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + _ = cmd.MarkFlagRequired(FlagMoniker) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} + +// UpdateResourceNodeStakeCmd will add/subtract resource node's stake. +func UpdateResourceNodeStakeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-resource-node-stake [flags]", + Short: "update resource node's stake", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildUpdateResourceNodeStakeMsg(clientCtx, txf, cmd.Flags()) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + cmd.Flags().AddFlagSet(FsIncrStake) + cmd.Flags().AddFlagSet(FsStakeDelta) + cmd.Flags().AddFlagSet(FsNetworkAddress) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + _ = cmd.MarkFlagRequired(FlagStakeDelta) + _ = cmd.MarkFlagRequired(FlagIncrStake) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + return cmd +} + // UpdateIndexingNodeStakeCmd will add/subtract indexing node's stake. -func UpdateIndexingNodeStakeCmd(cdc *codec.Codec) *cobra.Command { +func UpdateIndexingNodeStakeCmd() *cobra.Command { cmd := &cobra.Command{ Use: "update-indexing-node-stake [flags]", Short: "update indexing node's stake", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - txBldr, msg, err := buildUpdateIndexingNodeStakeMsg(cliCtx, txBldr) + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildUpdateIndexingNodeStakeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } @@ -173,26 +293,62 @@ func UpdateIndexingNodeStakeCmd(cdc *codec.Codec) *cobra.Command { return cmd } +// IndexingNodeRegistrationVoteCmd Indexing node registration need to be approved by 2/3 of existing indexing nodes +func IndexingNodeRegistrationVoteCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "indexing_node_reg_vote", + Short: "vote for the registration of a new indexing node", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildIndexingNodeRegistrationVoteMsg(clientCtx, txf, cmd.Flags()) + + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + cmd.Flags().AddFlagSet(FsCandidateNetworkAddress) + cmd.Flags().AddFlagSet(FsCandidateOwnerAddress) + cmd.Flags().AddFlagSet(FsOpinion) + cmd.Flags().AddFlagSet(FsVoterNetworkAddress) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + _ = cmd.MarkFlagRequired(FlagCandidateNetworkAddress) + _ = cmd.MarkFlagRequired(FlagCandidateOwnerAddress) + _ = cmd.MarkFlagRequired(FlagOpinion) + _ = cmd.MarkFlagRequired(FlagVoterNetworkAddress) + return cmd +} + // makes a new CreateResourceNodeMsg. -func buildCreateResourceNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - amountStr := viper.GetString(FlagAmount) - amount, err := sdk.ParseCoin(amountStr) +func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateResourceNode, error) { + fAmount, _ := fs.GetString(FlagAmount) + amount, err := sdk.ParseCoinNormalized(fAmount) if err != nil { - return txBldr, nil, err + return txf, nil, err } networkAddrstr := viper.GetString(FlagNetworkAddress) networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) if err != nil { - return txBldr, nil, err + return txf, nil, err } - ownerAddr := cliCtx.GetFromAddress() + ownerAddr := clientCtx.GetFromAddress() pkStr := viper.GetString(FlagPubKey) nodeTypeRef := viper.GetInt(FlagNodeType) pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) if er != nil { - return txBldr, nil, err + return txf, nil, err } desc := types.NewDescription( @@ -204,61 +360,80 @@ func buildCreateResourceNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder ) // validate nodeTypeRef - if t := types.NodeType(nodeTypeRef).Type(); t == "UNKNOWN" { - return txBldr, nil, types.ErrNodeType + newNodeType := types.NodeType(nodeTypeRef) + if t := newNodeType.Type(); t == "UNKNOWN" { + return txf, nil, types.ErrNodeType + } + msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, &desc, &newNodeType) + if er != nil { + return txf, nil, err } - msg := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, desc, types.NodeType(nodeTypeRef)) - return txBldr, msg, nil + return txf, msg, nil } -// makes a new UpdateResourceNodeStakeMsg. -func buildUpdateResourceNodeStakeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - stakeDeltaStr := viper.GetString(FlagStakeDelta) - stakeDelta, err := sdk.ParseCoin(stakeDeltaStr) +// makes a new MsgCreateIndexingNode. +func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateResourceNode, error) { + fAmount, _ := fs.GetString(FlagAmount) + amount, err := sdk.ParseCoinNormalized(fAmount) if err != nil { - return txBldr, nil, err + return txf, nil, err } - incrStakeStr := viper.GetString(FlagIncrStake) - incrStake, err := strconv.ParseBool(incrStakeStr) + networkAddrstr := viper.GetString(FlagNetworkAddress) + networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) if err != nil { - return txBldr, nil, err + return txf, nil, err } + ownerAddr := clientCtx.GetFromAddress() + pkStr := viper.GetString(FlagPubKey) - networkAddrStr := viper.GetString(FlagNetworkAddress) - networkAddr, err := stratos.SdsAddressFromBech32(networkAddrStr) - if err != nil { - return txBldr, nil, err + pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) + if er != nil { + return txf, nil, err } - ownerAddr := cliCtx.GetFromAddress() - - msg := types.NewMsgUpdateResourceNodeStake(networkAddr, ownerAddr, stakeDelta, incrStake) - return txBldr, msg, nil -} - -// makes a new MsgCreateIndexingNode. -func buildCreateIndexingNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - amountStr := viper.GetString(FlagAmount) - amount, err := sdk.ParseCoin(amountStr) - if err != nil { - return txBldr, nil, err + desc := types.NewDescription( + viper.GetString(FlagMoniker), + viper.GetString(FlagIdentity), + viper.GetString(FlagWebsite), + viper.GetString(FlagSecurityContact), + viper.GetString(FlagDetails), + ) + msg, er := types.NewMsgCreateIndexingNode(networkAddr, pubKey, amount, ownerAddr, &desc) + if er != nil { + return txf, nil, err } + return txf, msg, nil +} +// makes a new MsgUpdateResourceNode. +func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateResourceNode, error) { networkAddrstr := viper.GetString(FlagNetworkAddress) networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) if err != nil { - return txBldr, nil, err + return txf, nil, err } - ownerAddr := cliCtx.GetFromAddress() - pkStr := viper.GetString(FlagPubKey) + ownerAddr := clientCtx.GetFromAddress() + nodeTypeRef := viper.GetInt(FlagNodeType) - pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) + desc := types.NewDescription( + viper.GetString(FlagMoniker), + viper.GetString(FlagIdentity), + viper.GetString(FlagWebsite), + viper.GetString(FlagSecurityContact), + viper.GetString(FlagDetails), + ) - if err != nil { - return txBldr, nil, err + newNodeType := types.NodeType(nodeTypeRef) + if t := newNodeType.Type(); t == "UNKNOWN" { + return txf, nil, types.ErrNodeType } + msg := types.NewMsgUpdateResourceNode(desc, newNodeType, networkAddr, ownerAddr) + return txf, msg, nil +} +// makes a new MsgUpdateIndexingNode. +func newBuildUpdateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNode, error) { desc := types.NewDescription( viper.GetString(FlagMoniker), viper.GetString(FlagIdentity), @@ -266,242 +441,90 @@ func buildCreateIndexingNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder viper.GetString(FlagSecurityContact), viper.GetString(FlagDetails), ) - msg := types.NewMsgCreateIndexingNode(networkAddr, pubKey, amount, ownerAddr, desc) - return txBldr, msg, nil + + networkAddrstr := viper.GetString(FlagNetworkAddress) + networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) + if err != nil { + return txf, nil, err + } + ownerAddr := clientCtx.GetFromAddress() + + msg := types.NewMsgUpdateIndexingNode(desc, networkAddr, ownerAddr) + return txf, msg, nil } -// makes a new UpdateIndexingNodeStakeMsg. -func buildUpdateIndexingNodeStakeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { +// newBuildUpdateResourceNodeStakeMsg makes a new UpdateResourceNodeStakeMsg. +func newBuildUpdateResourceNodeStakeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateResourceNodeStake, error) { stakeDeltaStr := viper.GetString(FlagStakeDelta) - stakeDelta, err := sdk.ParseCoin(stakeDeltaStr) + stakeDelta, err := sdk.ParseCoinNormalized(stakeDeltaStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } incrStakeStr := viper.GetString(FlagIncrStake) incrStake, err := strconv.ParseBool(incrStakeStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } networkAddrStr := viper.GetString(FlagNetworkAddress) networkAddr, err := stratos.SdsAddressFromBech32(networkAddrStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } - ownerAddr := cliCtx.GetFromAddress() + ownerAddr := clientCtx.GetFromAddress() - msg := types.NewMsgUpdateIndexingNodeStake(networkAddr, ownerAddr, stakeDelta, incrStake) - return txBldr, msg, nil + msg := types.NewMsgUpdateResourceNodeStake(networkAddr, ownerAddr, &stakeDelta, incrStake) + return txf, msg, nil } -func RemoveResourceNodeCmd(cdc *codec.Codec) *cobra.Command { - cmd := &cobra.Command{ - Use: "remove-resource-node [resource_node_address] [owner_address]", - Args: cobra.ExactArgs(2), - Short: "remove resource node", - RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, args[1]).WithCodec(cdc) - - resourceNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) - if err != nil { - return err - } - ownerAddr := cliCtx.GetFromAddress() - - msg := types.NewMsgRemoveResourceNode(resourceNodeAddr, ownerAddr) - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) - }, +// newBuildUpdateIndexingNodeStakeMsg makes a new UpdateIndexingNodeStakeMsg. +func newBuildUpdateIndexingNodeStakeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNodeStake, error) { + stakeDeltaStr := viper.GetString(FlagStakeDelta) + stakeDelta, err := sdk.ParseCoinNormalized(stakeDeltaStr) + if err != nil { + return txf, nil, err } - return cmd -} - -func RemoveIndexingNodeCmd(cdc *codec.Codec) *cobra.Command { - cmd := &cobra.Command{ - Use: "remove-indexing-node [indexing_node_address] [owner_address]", - Args: cobra.ExactArgs(2), - Short: "remove indexing node", - RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, args[1]).WithCodec(cdc) - indexingNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) - if err != nil { - return err - } - ownerAddr := cliCtx.GetFromAddress() - - msg := types.NewMsgRemoveIndexingNode(indexingNodeAddr, ownerAddr) - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) - }, + incrStakeStr := viper.GetString(FlagIncrStake) + incrStake, err := strconv.ParseBool(incrStakeStr) + if err != nil { + return txf, nil, err } - return cmd -} -// IndexingNodeRegistrationVoteCmd Indexing node registration need to be approved by 2/3 of existing indexing nodes -func IndexingNodeRegistrationVoteCmd(cdc *codec.Codec) *cobra.Command { - cmd := &cobra.Command{ - Use: "indexing_node_reg_vote", - Short: "vote for the registration of a new indexing node", - RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - txBldr, msg, err := buildIndexingNodeRegistrationVoteMsg(cliCtx, txBldr) - if err != nil { - return err - } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) - }, + networkAddrStr := viper.GetString(FlagNetworkAddress) + networkAddr, err := stratos.SdsAddressFromBech32(networkAddrStr) + if err != nil { + return txf, nil, err } - cmd.Flags().AddFlagSet(FsCandidateNetworkAddress) - cmd.Flags().AddFlagSet(FsCandidateOwnerAddress) - cmd.Flags().AddFlagSet(FsOpinion) - cmd.Flags().AddFlagSet(FsVoterNetworkAddress) + ownerAddr := clientCtx.GetFromAddress() - _ = cmd.MarkFlagRequired(flags.FlagFrom) - _ = cmd.MarkFlagRequired(FlagCandidateNetworkAddress) - _ = cmd.MarkFlagRequired(FlagCandidateOwnerAddress) - _ = cmd.MarkFlagRequired(FlagOpinion) - _ = cmd.MarkFlagRequired(FlagVoterNetworkAddress) - return cmd + msg := types.NewMsgUpdateIndexingNodeStake(networkAddr, ownerAddr, &stakeDelta, incrStake) + return txf, msg, nil } -func buildIndexingNodeRegistrationVoteMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { +func newBuildIndexingNodeRegistrationVoteMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgIndexingNodeRegistrationVote, error) { candidateNetworkAddrStr := viper.GetString(FlagCandidateNetworkAddress) candidateNetworkAddr, err := stratos.SdsAddressFromBech32(candidateNetworkAddrStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } candidateOwnerAddrStr := viper.GetString(FlagCandidateOwnerAddress) candidateOwnerAddr, err := sdk.AccAddressFromBech32(candidateOwnerAddrStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } opinionVal := viper.GetBool(FlagOpinion) - opinion := types.VoteOpinionFromBool(opinionVal) + //opinion := types.VoteOpinionFromBool(opinionVal) voterNetworkAddrStr := viper.GetString(FlagVoterNetworkAddress) voterNetworkAddr, err := stratos.SdsAddressFromBech32(voterNetworkAddrStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } - voterOwnerAddr := cliCtx.GetFromAddress() - - msg := types.NewMsgIndexingNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, opinion, voterNetworkAddr, voterOwnerAddr) - return txBldr, msg, nil -} - -func UpdateResourceNodeCmd(cdc *codec.Codec) *cobra.Command { - cmd := &cobra.Command{ - Use: "update-resource-node [flags]", - Short: "update resource node info", - RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - txBldr, msg, err := buildUpdateResourceNodeMsg(cliCtx, txBldr) - if err != nil { - return err - } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) - }, - } - - cmd.Flags().AddFlagSet(FsNetworkAddress) - cmd.Flags().AddFlagSet(FsDescription) - cmd.Flags().AddFlagSet(FsNodeType) - cmd.Flags().AddFlagSet(FsNetworkAddress) - - _ = cmd.MarkFlagRequired(FlagNetworkAddress) - _ = cmd.MarkFlagRequired(FlagMoniker) - _ = cmd.MarkFlagRequired(FlagNodeType) - _ = cmd.MarkFlagRequired(FlagNetworkAddress) - _ = cmd.MarkFlagRequired(flags.FlagFrom) - - return cmd -} - -// makes a new MsgUpdateResourceNode. -func buildUpdateResourceNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - //networkAddr := viper.GetString(FlagNetworkAddr) - - desc := types.NewDescription( - viper.GetString(FlagMoniker), - viper.GetString(FlagIdentity), - viper.GetString(FlagWebsite), - viper.GetString(FlagSecurityContact), - viper.GetString(FlagDetails), - ) - - nodeType := viper.GetInt(FlagNodeType) - - nodeAddrStr := viper.GetString(FlagNetworkAddress) - nodeAddr, err := stratos.SdsAddressFromBech32(nodeAddrStr) - if err != nil { - return txBldr, nil, err - } - - ownerAddr := cliCtx.GetFromAddress() - if t := types.NodeType(nodeType).Type(); t == "UNKNOWN" { - return txBldr, nil, types.ErrNodeType - } - msg := types.NewMsgUpdateResourceNode(desc, types.NodeType(nodeType), nodeAddr, ownerAddr) - return txBldr, msg, nil -} - -func UpdateIndexingNodeCmd(cdc *codec.Codec) *cobra.Command { - cmd := &cobra.Command{ - Use: "update-indexing-node [flags]", - Short: "update indexing node info", - RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - txBldr, msg, err := buildUpdateIndexingNodeMsg(cliCtx, txBldr) - if err != nil { - return err - } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) - }, - } - - cmd.Flags().AddFlagSet(FsNetworkAddress) - cmd.Flags().AddFlagSet(FsDescription) - cmd.Flags().AddFlagSet(FsNetworkAddress) - - _ = cmd.MarkFlagRequired(FlagNetworkAddress) - _ = cmd.MarkFlagRequired(FlagMoniker) - _ = cmd.MarkFlagRequired(FlagNetworkAddress) - _ = cmd.MarkFlagRequired(flags.FlagFrom) - - return cmd -} - -// makes a new MsgUpdateIndexingNode. -func buildUpdateIndexingNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - //networkAddr := viper.GetString(FlagNetworkAddr) - - desc := types.NewDescription( - viper.GetString(FlagMoniker), - viper.GetString(FlagIdentity), - viper.GetString(FlagWebsite), - viper.GetString(FlagSecurityContact), - viper.GetString(FlagDetails), - ) - - nodeAddrStr := viper.GetString(FlagNetworkAddress) - nodeAddr, err := stratos.SdsAddressFromBech32(nodeAddrStr) - if err != nil { - return txBldr, nil, err - } - - ownerAddr := cliCtx.GetFromAddress() + voterOwnerAddr := clientCtx.GetFromAddress() - msg := types.NewMsgUpdateIndexingNode(desc, nodeAddr, ownerAddr) - return txBldr, msg, nil + msg := types.NewMsgIndexingNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, opinionVal, voterNetworkAddr, voterOwnerAddr) + return txf, msg, nil } diff --git a/x/register/exported/exported.go b/x/register/exported/exported.go index 23b85195..de8ed44c 100644 --- a/x/register/exported/exported.go +++ b/x/register/exported/exported.go @@ -2,6 +2,7 @@ package exported import ( sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/tendermint/tendermint/crypto" ) @@ -10,7 +11,7 @@ import ( type ResourceNodeI interface { IsSuspended() bool // whether the node is jailed GetMoniker() string // moniker of the node - GetStatus() sdk.BondStatus // status of the node + GetStatus() stakingtypes.BondStatus // status of the node GetPubKey() crypto.PubKey // pubkey of the node GetNetworkAddr() stratos.SdsAddress // network address of the node GetTokens() sdk.Int // staking tokens of the node @@ -22,7 +23,7 @@ type ResourceNodeI interface { type IndexingNodeI interface { IsSuspended() bool // whether the node is jailed GetMoniker() string // moniker of the node - GetStatus() sdk.BondStatus // status of the node + GetStatus() stakingtypes.BondStatus // status of the node GetPubKey() crypto.PubKey // pubkey of the node GetNetworkAddr() stratos.SdsAddress // network address of the node GetTokens() sdk.Int // staking tokens of the node diff --git a/x/register/genesis.go b/x/register/genesis.go index 819b5a6b..683237b9 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -2,39 +2,41 @@ package register import ( sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stratosnet/stratos-chain/x/register/types" + abci "github.com/tendermint/tendermint/abci/types" ) // InitGenesis initialize default parameters // and the keeper's address to pubkey map -func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) { - keeper.SetParams(ctx, data.Params) +func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) (res []abci.ValidatorUpdate) { + keeper.SetParams(ctx, *data.Params) initialStakeTotal := sdk.ZeroInt() resNodeBondedToken := sdk.ZeroInt() resNodeNotBondedToken := sdk.ZeroInt() - for _, resourceNode := range data.ResourceNodes { - if resourceNode.GetStatus() == sdk.Bonded { - initialStakeTotal = initialStakeTotal.Add(resourceNode.GetTokens()) - resNodeBondedToken = resNodeBondedToken.Add(resourceNode.GetTokens()) - } else if resourceNode.GetStatus() == sdk.Unbonded { - resNodeNotBondedToken = resNodeNotBondedToken.Add(resourceNode.GetTokens()) + for _, resourceNode := range data.ResourceNodes.GetResourceNodes() { + if resourceNode.GetStatus().String() == stakingtypes.BondStatusBonded { + initialStakeTotal = initialStakeTotal.Add(resourceNode.Tokens) + resNodeBondedToken = resNodeBondedToken.Add(resourceNode.Tokens) + } else if resourceNode.GetStatus().String() == stakingtypes.BondStatusUnbonded { + resNodeNotBondedToken = resNodeNotBondedToken.Add(resourceNode.Tokens) } - keeper.SetResourceNode(ctx, resourceNode) + keeper.SetResourceNode(ctx, *resourceNode) } keeper.SetResourceNodeBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeBondedToken)) keeper.SetResourceNodeNotBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeNotBondedToken)) idxNodeBondedToken := sdk.ZeroInt() idxNodeNotBondedToken := sdk.ZeroInt() - for _, indexingNode := range data.IndexingNodes { - if indexingNode.GetStatus() == sdk.Bonded { - initialStakeTotal = initialStakeTotal.Add(indexingNode.GetTokens()) - idxNodeBondedToken = idxNodeBondedToken.Add(indexingNode.GetTokens()) - } else if indexingNode.GetStatus() == sdk.Unbonded { - idxNodeNotBondedToken = idxNodeNotBondedToken.Add(indexingNode.GetTokens()) + for _, indexingNode := range data.IndexingNodes.GetIndexingNodes() { + if indexingNode.GetStatus().String() == stakingtypes.BondStatusBonded { + initialStakeTotal = initialStakeTotal.Add(indexingNode.Tokens) + idxNodeBondedToken = idxNodeBondedToken.Add(indexingNode.Tokens) + } else if indexingNode.GetStatus().String() == stakingtypes.BondStatusUnbonded { + idxNodeNotBondedToken = idxNodeNotBondedToken.Add(indexingNode.Tokens) } - keeper.SetIndexingNode(ctx, indexingNode) + keeper.SetIndexingNode(ctx, *indexingNode) } keeper.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeBondedToken)) keeper.SetIndexingNodeNotBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeNotBondedToken)) @@ -51,15 +53,20 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) { Amount: totalUnissuedPrepay, }) - for _, slashing := range data.SlashingInfo { - keeper.SetSlashing(ctx, slashing.WalletAddress, slashing.Value) + for _, slashing := range data.Slashing { + walletAddress, err := sdk.AccAddressFromBech32(slashing.GetWalletAddress()) + if err != nil { + panic(err) + } + + keeper.SetSlashing(ctx, walletAddress, sdk.NewInt(slashing.Value)) } } // ExportGenesis writes the current store values // to a genesis file, which can be imported again // with InitGenesis -func ExportGenesis(ctx sdk.Context, keeper Keeper) (data types.GenesisState) { +func ExportGenesis(ctx sdk.Context, keeper Keeper) (data *types.GenesisState) { params := keeper.GetParams(ctx) resourceNodes := keeper.GetAllResourceNodes(ctx) @@ -76,12 +83,12 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) (data types.GenesisState) { return false }) - return types.GenesisState{ - Params: params, + return &types.GenesisState{ + Params: ¶ms, ResourceNodes: resourceNodes, IndexingNodes: indexingNodes, InitialUozPrice: initialUOzonePrice, TotalUnissuedPrepay: totalUnissuedPrepay, - SlashingInfo: slashingInfo, + Slashing: slashingInfo, } } diff --git a/x/register/keeper/migrations.go b/x/register/keeper/migrations.go new file mode 100644 index 00000000..84f19c01 --- /dev/null +++ b/x/register/keeper/migrations.go @@ -0,0 +1,21 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v043 "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v043" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{keeper: keeper} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v043.MigrateStore(ctx, m.keeper.storeKey) +} diff --git a/x/register/module.go b/x/register/module.go index 76d2a451..44ff8d88 100644 --- a/x/register/module.go +++ b/x/register/module.go @@ -1,16 +1,21 @@ package register import ( + "context" "encoding/json" - "github.com/cosmos/cosmos-sdk/x/bank" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/gorilla/mux" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/cosmos-sdk/client/context" "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/stratosnet/stratos-chain/x/register/client/cli" @@ -25,48 +30,61 @@ var ( _ module.AppModuleBasic = AppModuleBasic{} ) -// AppModuleBasic defines the basic application module used by the register module. -type AppModuleBasic struct{} +// AppModuleBasic defines the basic application module used by the staking module. +type AppModuleBasic struct { + cdc codec.Codec +} + +var _ module.AppModuleBasic = AppModuleBasic{} -// Name returns the register module's name. +// Name returns the staking module's name. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the register module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the register // module. -func (AppModuleBasic) DefaultGenesis() json.RawMessage { - return types.ModuleCdc.MustMarshalJSON(types.DefaultGenesisState()) +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the register module. -func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState - err := types.ModuleCdc.UnmarshalJSON(bz, &data) - if err != nil { - return err + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } return types.ValidateGenesis(data) } // RegisterRESTRoutes registers the REST routes for the register module. -func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { rest.RegisterRoutes(ctx, rtr) } +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) +} + // GetTxCmd returns the root tx command for the register module. -func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetTxCmd(cdc) +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.NewTxCmd() } // GetQueryCmd returns no root query command for the register module. -func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetQueryCmd(types.StoreKey, cdc) +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() } //____________________________________________________________________________ @@ -74,13 +92,14 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { // AppModule implements an application module for the register module. type AppModule struct { AppModuleBasic + keeper keeper.Keeper accountKeeper types.AccountKeeper - bankKeeper bank.Keeper + bankKeeper types.BankKeeper } // NewAppModule creates a new AppModule object -func NewAppModule(k keeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper bank.Keeper) AppModule { +func NewAppModule(k keeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: k, @@ -89,19 +108,9 @@ func NewAppModule(k keeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper } } -// Name returns the register module's name. -func (AppModule) Name() string { - return types.ModuleName -} - // RegisterInvariants registers the register module invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// Route returns the message routing key for the register module. -func (AppModule) Route() string { - return types.RouterKey -} - // NewHandler returns an sdk.Handler for the register module. func (am AppModule) NewHandler() sdk.Handler { return NewHandler(am.keeper) @@ -117,22 +126,6 @@ func (am AppModule) NewQuerierHandler() sdk.Querier { return keeper.NewQuerier(am.keeper) } -// InitGenesis performs genesis initialization for the register module. It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState - types.ModuleCdc.MustUnmarshalJSON(data, &genesisState) - InitGenesis(ctx, am.keeper, genesisState) - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the exported genesis state as raw bytes for the register -// module. -func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage { - gs := ExportGenesis(ctx, am.keeper) - return types.ModuleCdc.MustMarshalJSON(gs) -} - // BeginBlock returns the begin blocker for the register module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) @@ -143,3 +136,48 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return EndBlocker(ctx, am.keeper) } + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) + + m := keeper.NewMigrator(am.keeper) + cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// LegacyQuerierHandler returns the staking module sdk.Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) +} + +// InitGenesis performs genesis initialization for the staking module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(data, &genesisState) + + return InitGenesis(ctx, am.keeper, &genesisState) +} + +// ExportGenesis returns the exported genesis state as raw bytes for the staking +// module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(gs) +} + +// Route returns the message routing key for the staking module. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} diff --git a/x/register/types/codec.go b/x/register/types/codec.go index b8d329ca..20526ebf 100644 --- a/x/register/types/codec.go +++ b/x/register/types/codec.go @@ -27,10 +27,14 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry types.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateResourceNode{}, - //&MsgEditValidator{}, - //&MsgDelegate{}, - //&MsgUndelegate{}, - //&MsgBeginRedelegate{}, + &MsgRemoveResourceNode{}, + &MsgUpdateResourceNode{}, + &MsgUpdateResourceNodeStake{}, + &MsgCreateIndexingNode{}, + &MsgRemoveResourceNode{}, + &MsgUpdateIndexingNode{}, + &MsgUpdateIndexingNodeStake{}, + &MsgIndexingNodeRegistrationVote{}, ) registry.RegisterImplementations( (*authz.Authorization)(nil), diff --git a/x/register/types/expected_keepers.go b/x/register/types/expected_keepers.go index bea3e174..7b386b1c 100644 --- a/x/register/types/expected_keepers.go +++ b/x/register/types/expected_keepers.go @@ -3,19 +3,9 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/params" - supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" stratos "github.com/stratosnet/stratos-chain/types" ) -// ParamSubspace defines the expected Subspace interface -type ParamSubspace interface { - WithKeyTable(table params.KeyTable) params.Subspace - Get(ctx sdk.Context, key []byte, ptr interface{}) - GetParamSet(ctx sdk.Context, ps params.ParamSet) - SetParamSet(ctx sdk.Context, ps params.ParamSet) -} - /* When a module wishes to interact with another module, it is good practice to define what it will use as an interface so the module cannot use things that are not permitted. @@ -26,12 +16,6 @@ type BankKeeper interface { } */ -// AccountKeeper defines the expected account keeper (noalias) -//type AccountKeeper interface { -// IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool)) -// GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account // only used for simulation -//} - // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { IterateAccounts(ctx sdk.Context, process func(authtypes.AccountI) (stop bool)) @@ -40,7 +24,7 @@ type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI - // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 + // SetModuleAccount TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, authtypes.ModuleAccountI) } @@ -60,23 +44,6 @@ type BankKeeper interface { BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error } -// SupplyKeeper defines the expected supply Keeper (noalias) -type SupplyKeeper interface { - GetSupply(ctx sdk.Context) supplyexported.SupplyI - - GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) supplyexported.ModuleAccountI - - // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 - SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI) - - SendCoinsFromModuleToModule(ctx sdk.Context, senderPool, recipientPool string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - - BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error -} - // RegisterHooks event hooks for registered node object (noalias) type RegisterHooks interface { AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) // Must be called when a node is created diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 30bbee60..86367c21 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -552,19 +552,39 @@ func (mmsg MsgIndexingNodeRegistrationVote) Route() string { return RouterKey } func (msg MsgIndexingNodeRegistrationVote) Type() string { return TypeIndexingNodeRegistrationVoteTx } func (msg MsgIndexingNodeRegistrationVote) ValidateBasic() error { - if msg.CandidateNetworkAddress.Empty() { - return ErrEmptyCandidateNetworkAddr + candidateNetworkAddress, err := stratos.SdsAddressFromBech32(msg.CandidateNetworkAddress) + if err != nil { + return err } - if msg.CandidateOwnerAddress.Empty() { - return ErrEmptyCandidateOwnerAddr + if candidateNetworkAddress.Empty() { + return ErrEmptyNodeNetworkAddress + } + + voterNetworkAddr, err := stratos.SdsAddressFromBech32(msg.VoterNetworkAddress) + if err != nil { + return err } - if msg.VoterNetworkAddress.Empty() { + if voterNetworkAddr.Empty() { return ErrEmptyVoterNetworkAddr } - if msg.VoterOwnerAddress.Empty() { + + candidateOwnerAddr, err := sdk.AccAddressFromBech32(msg.CandidateOwnerAddress) + if err != nil { + return err + } + if candidateOwnerAddr.Empty() { + return ErrEmptyCandidateOwnerAddr + } + + voterOwnerAddr, err := sdk.AccAddressFromBech32(msg.VoterOwnerAddress) + if err != nil { + return err + } + if voterOwnerAddr.Empty() { return ErrEmptyVoterOwnerAddr } - if msg.CandidateNetworkAddress.Equals(msg.VoterNetworkAddress) { + + if candidateNetworkAddress.Equals(voterNetworkAddr) { return ErrSameAddr } return nil diff --git a/x/register/types/querier.go b/x/register/types/querier.go index 6d747faf..a37265a2 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -4,8 +4,10 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/tendermint/tendermint/crypto" + cryptotypes "github.com/tendermint/tendermint/crypto" ) const ( @@ -75,18 +77,18 @@ func NewQueryNodesStakingInfo( } type StakingInfo struct { - NetworkAddr stratos.SdsAddress `json:"network_address"` - PubKey crypto.PubKey `json:"pub_key"` - Suspend bool `json:"suspend"` - Status sdk.BondStatus `json:"status"` - Tokens sdk.Int `json:"tokens"` - OwnerAddress sdk.AccAddress `json:"owner_address"` - Description Description `json:"description"` - NodeType string `json:"node_type"` - CreationTime time.Time `json:"creation_time"` - BondedStake sdk.Coin `json:"bonded_stake"` - UnBondingStake sdk.Coin `json:"un_bonding_stake"` - UnBondedStake sdk.Coin `json:"un_bonded_stake"` + NetworkAddr stratos.SdsAddress `json:"network_address"` + PubKey crypto.PubKey `json:"pub_key"` + Suspend bool `json:"suspend"` + Status stakingtypes.BondStatus `json:"status"` + Tokens sdk.Int `json:"tokens"` + OwnerAddress sdk.AccAddress `json:"owner_address"` + Description *Description `json:"description"` + NodeType string `json:"node_type"` + CreationTime time.Time `json:"creation_time"` + BondedStake sdk.Coin `json:"bonded_stake"` + UnBondingStake sdk.Coin `json:"un_bonding_stake"` + UnBondedStake sdk.Coin `json:"un_bonded_stake"` } // NewStakingInfoByResourceNodeAddr creates a new instance of StakingInfoByNodeAddr @@ -97,15 +99,19 @@ func NewStakingInfoByResourceNodeAddr( bondedStake sdk.Int, ) StakingInfo { + pk, ok := resourceNode.PubKey.GetCachedValue().(cryptotypes.PubKey) + if !ok { + return StakingInfo{} + } return StakingInfo{ - NetworkAddr: resourceNode.NetworkAddr, - PubKey: resourceNode.PubKey, + NetworkAddr: stratos.SdsAddress(resourceNode.NetworkAddr), + PubKey: pk, Suspend: resourceNode.Suspend, Status: resourceNode.Status, Tokens: resourceNode.Tokens, - OwnerAddress: resourceNode.OwnerAddress, + OwnerAddress: sdk.AccAddress(resourceNode.OwnerAddress), Description: resourceNode.Description, - NodeType: resourceNode.NodeType.String(), + NodeType: resourceNode.NodeType, CreationTime: resourceNode.CreationTime, UnBondingStake: sdk.NewCoin(defaultDenom, unBondingStake), UnBondedStake: sdk.NewCoin(defaultDenom, unBondedStake), @@ -120,13 +126,17 @@ func NewStakingInfoByIndexingNodeAddr( unBondedStake sdk.Int, bondedStake sdk.Int, ) StakingInfo { + pk, ok := indexingNode.PubKey.GetCachedValue().(cryptotypes.PubKey) + if !ok { + return StakingInfo{} + } return StakingInfo{ - NetworkAddr: indexingNode.NetworkAddr, - PubKey: indexingNode.PubKey, + NetworkAddr: stratos.SdsAddress(indexingNode.NetworkAddr), + PubKey: pk, Suspend: indexingNode.Suspend, Status: indexingNode.Status, Tokens: indexingNode.Tokens, - OwnerAddress: indexingNode.OwnerAddress, + OwnerAddress: sdk.AccAddress(indexingNode.OwnerAddress), Description: indexingNode.Description, NodeType: "metanode", CreationTime: indexingNode.CreationTime, diff --git a/x/register/types/query.pb.go b/x/register/types/query.pb.go new file mode 100644 index 00000000..c9c729fa --- /dev/null +++ b/x/register/types/query.pb.go @@ -0,0 +1,1725 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/register/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "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 + +// QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method +type QueryResourceNodeRequest struct { + // node_addr defines the node address to query for. + NodeAddr string `protobuf:"bytes,1,opt,name=node_addr,json=nodeAddr,proto3" json:"node_addr,omitempty"` +} + +func (m *QueryResourceNodeRequest) Reset() { *m = QueryResourceNodeRequest{} } +func (m *QueryResourceNodeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryResourceNodeRequest) ProtoMessage() {} +func (*QueryResourceNodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{0} +} +func (m *QueryResourceNodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResourceNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResourceNodeRequest.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 *QueryResourceNodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResourceNodeRequest.Merge(m, src) +} +func (m *QueryResourceNodeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryResourceNodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResourceNodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResourceNodeRequest proto.InternalMessageInfo + +func (m *QueryResourceNodeRequest) GetNodeAddr() string { + if m != nil { + return m.NodeAddr + } + return "" +} + +// QueryResourceNodeResponse is response type for the Query/ResourceNode RPC method +type QueryResourceNodeResponse struct { + // node defines the the resourceNode info. + Node ResourceNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node"` +} + +func (m *QueryResourceNodeResponse) Reset() { *m = QueryResourceNodeResponse{} } +func (m *QueryResourceNodeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryResourceNodeResponse) ProtoMessage() {} +func (*QueryResourceNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{1} +} +func (m *QueryResourceNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResourceNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResourceNodeResponse.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 *QueryResourceNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResourceNodeResponse.Merge(m, src) +} +func (m *QueryResourceNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryResourceNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResourceNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResourceNodeResponse proto.InternalMessageInfo + +func (m *QueryResourceNodeResponse) GetNode() ResourceNode { + if m != nil { + return m.Node + } + return ResourceNode{} +} + +// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method +type QueryIndexingNodeRequest struct { + // node_addr defines the node address to query for. + NodeAddr string `protobuf:"bytes,1,opt,name=node_addr,json=nodeAddr,proto3" json:"node_addr,omitempty"` +} + +func (m *QueryIndexingNodeRequest) Reset() { *m = QueryIndexingNodeRequest{} } +func (m *QueryIndexingNodeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryIndexingNodeRequest) ProtoMessage() {} +func (*QueryIndexingNodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{2} +} +func (m *QueryIndexingNodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryIndexingNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryIndexingNodeRequest.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 *QueryIndexingNodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryIndexingNodeRequest.Merge(m, src) +} +func (m *QueryIndexingNodeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryIndexingNodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryIndexingNodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryIndexingNodeRequest proto.InternalMessageInfo + +func (m *QueryIndexingNodeRequest) GetNodeAddr() string { + if m != nil { + return m.NodeAddr + } + return "" +} + +// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method +type QueryIndexingNodeResponse struct { + // node defines the the indexing info. + Node IndexingNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node"` +} + +func (m *QueryIndexingNodeResponse) Reset() { *m = QueryIndexingNodeResponse{} } +func (m *QueryIndexingNodeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryIndexingNodeResponse) ProtoMessage() {} +func (*QueryIndexingNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{3} +} +func (m *QueryIndexingNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryIndexingNodeResponse.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 *QueryIndexingNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryIndexingNodeResponse.Merge(m, src) +} +func (m *QueryIndexingNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryIndexingNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryIndexingNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryIndexingNodeResponse proto.InternalMessageInfo + +func (m *QueryIndexingNodeResponse) GetNode() IndexingNode { + if m != nil { + return m.Node + } + return IndexingNode{} +} + +// QueryOwnerRequest is request type for the Query/Owner RPC method +type QueryOwnerRequest struct { + // owner_addr defines the owner address to query for. + OwnerAddr string `protobuf:"bytes,1,opt,name=owner_addr,json=ownerAddr,proto3" json:"owner_addr,omitempty"` +} + +func (m *QueryOwnerRequest) Reset() { *m = QueryOwnerRequest{} } +func (m *QueryOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOwnerRequest) ProtoMessage() {} +func (*QueryOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{4} +} +func (m *QueryOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOwnerRequest.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 *QueryOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOwnerRequest.Merge(m, src) +} +func (m *QueryOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOwnerRequest proto.InternalMessageInfo + +func (m *QueryOwnerRequest) GetOwnerAddr() string { + if m != nil { + return m.OwnerAddr + } + return "" +} + +// QueryOwnerResponse is response type for the Query/Owner RPC method +type QueryOwnerResponse struct { + // owner defines the the owner info. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOwnerResponse) Reset() { *m = QueryOwnerResponse{} } +func (m *QueryOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOwnerResponse) ProtoMessage() {} +func (*QueryOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{5} +} +func (m *QueryOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOwnerResponse.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 *QueryOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOwnerResponse.Merge(m, src) +} +func (m *QueryOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOwnerResponse proto.InternalMessageInfo + +func (m *QueryOwnerResponse) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *QueryOwnerResponse) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{6} +} +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_59a612d1da8c0670, []int{7} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryResourceNodeRequest)(nil), "stratos.register.v1.QueryResourceNodeRequest") + proto.RegisterType((*QueryResourceNodeResponse)(nil), "stratos.register.v1.QueryResourceNodeResponse") + proto.RegisterType((*QueryIndexingNodeRequest)(nil), "stratos.register.v1.QueryIndexingNodeRequest") + proto.RegisterType((*QueryIndexingNodeResponse)(nil), "stratos.register.v1.QueryIndexingNodeResponse") + proto.RegisterType((*QueryOwnerRequest)(nil), "stratos.register.v1.QueryOwnerRequest") + proto.RegisterType((*QueryOwnerResponse)(nil), "stratos.register.v1.QueryOwnerResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "stratos.register.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "stratos.register.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("stratos/register/v1/query.proto", fileDescriptor_59a612d1da8c0670) } + +var fileDescriptor_59a612d1da8c0670 = []byte{ + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xe3, 0xd2, 0x54, 0xe4, 0x60, 0xe1, 0xda, 0x21, 0xb8, 0xe0, 0x82, 0x87, 0x16, 0x90, + 0x72, 0x27, 0x07, 0xa4, 0x0a, 0x31, 0xd1, 0x01, 0x89, 0xa5, 0x04, 0x4f, 0x88, 0x05, 0x5d, 0xe2, + 0x93, 0x6b, 0x89, 0xdc, 0xb9, 0x77, 0x97, 0x90, 0xaa, 0xea, 0xc2, 0xc6, 0x86, 0xc4, 0x77, 0xe0, + 0xb3, 0x74, 0xac, 0xc4, 0xc2, 0x84, 0x50, 0x02, 0xdf, 0x03, 0xf9, 0xf9, 0x9c, 0x38, 0xd2, 0xb5, + 0x25, 0xdb, 0xe5, 0xe5, 0xff, 0x7f, 0xef, 0x97, 0xf7, 0xfe, 0x0a, 0xda, 0xd1, 0x46, 0x31, 0x23, + 0x35, 0x55, 0x3c, 0xcd, 0xb4, 0xe1, 0x8a, 0x8e, 0x23, 0x7a, 0x3c, 0xe2, 0xea, 0x84, 0xe4, 0x4a, + 0x1a, 0x89, 0x37, 0xad, 0x80, 0x54, 0x02, 0x32, 0x8e, 0xfc, 0x27, 0x03, 0xa9, 0x87, 0x52, 0xd3, + 0x3e, 0xd3, 0xbc, 0x54, 0xd3, 0x71, 0xd4, 0xe7, 0x86, 0x45, 0x34, 0x67, 0x69, 0x26, 0x98, 0xc9, + 0xa4, 0x28, 0x1b, 0xf8, 0x5b, 0xa9, 0x4c, 0x25, 0x3c, 0x69, 0xf1, 0xb2, 0xd5, 0x7b, 0xa9, 0x94, + 0xe9, 0x47, 0x4e, 0x59, 0x9e, 0x51, 0x26, 0x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x39, + 0xda, 0xc8, 0xa1, 0x62, 0x37, 0xb3, 0xed, 0xdc, 0x4c, 0x69, 0xb2, 0x3b, 0xb1, 0x86, 0xee, 0xdf, + 0x1b, 0xa8, 0x09, 0x2d, 0xf1, 0x77, 0x0f, 0xdd, 0xae, 0xdf, 0x13, 0x77, 0x9c, 0x5d, 0x2e, 0x4b, + 0x9a, 0x4f, 0xfe, 0x57, 0x5e, 0x42, 0x87, 0xfb, 0x9f, 0x7f, 0xfc, 0xf9, 0xb6, 0x16, 0x61, 0x4a, + 0xdd, 0x11, 0x2f, 0x2d, 0x9d, 0xe2, 0x76, 0x9a, 0x9e, 0xce, 0x13, 0x73, 0x06, 0xa0, 0xf5, 0x2b, + 0x5f, 0x05, 0xea, 0xc8, 0xdf, 0x55, 0xa0, 0xae, 0xd4, 0x5d, 0x03, 0x9a, 0x59, 0x8b, 0x03, 0xf4, + 0x8b, 0x87, 0x9a, 0x90, 0x1c, 0xbc, 0x7b, 0xf9, 0xc8, 0x7a, 0x1c, 0xfd, 0xbd, 0x6b, 0x75, 0x96, + 0x89, 0x02, 0xd3, 0x63, 0xbc, 0xe7, 0x64, 0x82, 0x28, 0xd2, 0xd3, 0x45, 0xb2, 0xcf, 0x0e, 0x0e, + 0xcf, 0xa7, 0x81, 0x77, 0x31, 0x0d, 0xbc, 0xdf, 0xd3, 0xc0, 0xfb, 0x3a, 0x0b, 0x1a, 0x17, 0xb3, + 0xa0, 0xf1, 0x73, 0x16, 0x34, 0xde, 0x3f, 0x4b, 0x33, 0x73, 0x34, 0xea, 0x93, 0x81, 0x1c, 0x56, + 0xcd, 0x04, 0x37, 0xd5, 0xb3, 0x33, 0x38, 0x62, 0x99, 0xa0, 0x93, 0x45, 0x7f, 0x73, 0x92, 0x73, + 0xdd, 0xdf, 0x80, 0xbf, 0x9e, 0xa7, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xc0, 0x5b, 0x13, + 0x36, 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 + +// 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 { + // ResourceNode queries ResourceNode info for given ResourceNode address. + ResourceNode(ctx context.Context, in *QueryResourceNodeRequest, opts ...grpc.CallOption) (*QueryResourceNodeResponse, error) + // IndexingNode queries IndexingNode info for given IndexingNode address. + IndexingNode(ctx context.Context, in *QueryIndexingNodeRequest, opts ...grpc.CallOption) (*QueryIndexingNodeResponse, error) + // Owner queries all staking info for given Owner address. + Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) ResourceNode(ctx context.Context, in *QueryResourceNodeRequest, opts ...grpc.CallOption) (*QueryResourceNodeResponse, error) { + out := new(QueryResourceNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/ResourceNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) IndexingNode(ctx context.Context, in *QueryIndexingNodeRequest, opts ...grpc.CallOption) (*QueryIndexingNodeResponse, error) { + out := new(QueryIndexingNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/IndexingNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) { + out := new(QueryOwnerResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/Owner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // ResourceNode queries ResourceNode info for given ResourceNode address. + ResourceNode(context.Context, *QueryResourceNodeRequest) (*QueryResourceNodeResponse, error) + // IndexingNode queries IndexingNode info for given IndexingNode address. + IndexingNode(context.Context, *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) + // Owner queries all staking info for given Owner address. + Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) ResourceNode(ctx context.Context, req *QueryResourceNodeRequest) (*QueryResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResourceNode not implemented") +} +func (*UnimplementedQueryServer) IndexingNode(ctx context.Context, req *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IndexingNode not implemented") +} +func (*UnimplementedQueryServer) Owner(ctx context.Context, req *QueryOwnerRequest) (*QueryOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Owner not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_ResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryResourceNodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ResourceNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Query/ResourceNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ResourceNode(ctx, req.(*QueryResourceNodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_IndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryIndexingNodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).IndexingNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Query/IndexingNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).IndexingNode(ctx, req.(*QueryIndexingNodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Owner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Owner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Query/Owner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Owner(ctx, req.(*QueryOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.register.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ResourceNode", + Handler: _Query_ResourceNode_Handler, + }, + { + MethodName: "IndexingNode", + Handler: _Query_IndexingNode_Handler, + }, + { + MethodName: "Owner", + Handler: _Query_Owner_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/register/v1/query.proto", +} + +func (m *QueryResourceNodeRequest) 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 *QueryResourceNodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResourceNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NodeAddr) > 0 { + i -= len(m.NodeAddr) + copy(dAtA[i:], m.NodeAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NodeAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryResourceNodeResponse) 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 *QueryResourceNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Node.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 *QueryIndexingNodeRequest) 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 *QueryIndexingNodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryIndexingNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NodeAddr) > 0 { + i -= len(m.NodeAddr) + copy(dAtA[i:], m.NodeAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NodeAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryIndexingNodeResponse) 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 *QueryIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Node.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 *QueryOwnerRequest) 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 *QueryOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddr) > 0 { + i -= len(m.OwnerAddr) + copy(dAtA[i:], m.OwnerAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOwnerResponse) 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 *QueryOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOwnerResponse) 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.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryResourceNodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodeAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryResourceNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Node.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryIndexingNodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodeAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryIndexingNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Node.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryResourceNodeRequest) 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: QueryResourceNodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResourceNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeAddr", 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.NodeAddr = 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 *QueryResourceNodeResponse) 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: QueryResourceNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResourceNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", 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.Node.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 *QueryIndexingNodeRequest) 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: QueryIndexingNodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIndexingNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeAddr", 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.NodeAddr = 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 *QueryIndexingNodeResponse) 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: QueryIndexingNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIndexingNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", 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.Node.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 *QueryOwnerRequest) 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: QueryOwnerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddr", 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.OwnerAddr = 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 *QueryOwnerResponse) 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: QueryOwnerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = string(dAtA[iNdEx:postIndex]) + 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.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 *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/register/types/query.pb.gw.go b/x/register/types/query.pb.gw.go new file mode 100644 index 00000000..7c44e0c6 --- /dev/null +++ b/x/register/types/query.pb.gw.go @@ -0,0 +1,380 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/register/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/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 + +func request_Query_ResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryResourceNodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["node_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + } + + protoReq.NodeAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + } + + msg, err := client.ResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryResourceNodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["node_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + } + + protoReq.NodeAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + } + + msg, err := server.ResourceNode(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIndexingNodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["node_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + } + + protoReq.NodeAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + } + + msg, err := client.IndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIndexingNodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["node_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + } + + protoReq.NodeAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + } + + msg, err := server.IndexingNode(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Owner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_addr") + } + + protoReq.OwnerAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_addr", err) + } + + msg, err := client.Owner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Owner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_addr") + } + + protoReq.OwnerAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_addr", err) + } + + msg, err := server.Owner(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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_ResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_IndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_IndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_IndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Owner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Owner_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Owner_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_ResourceNode_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_ResourceNode_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_ResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_IndexingNode_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_IndexingNode_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_IndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Owner_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_Owner_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_Owner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_ResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "resource-nodes", "node_addr"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_IndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "indexing-nodes", "node_addr"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Owner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "owner", "owner_addr"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_ResourceNode_0 = runtime.ForwardResponseMessage + + forward_Query_IndexingNode_0 = runtime.ForwardResponseMessage + + forward_Query_Owner_0 = runtime.ForwardResponseMessage +) diff --git a/x/register/types/registration.go b/x/register/types/registration.go index 594d6605..45c68203 100644 --- a/x/register/types/registration.go +++ b/x/register/types/registration.go @@ -14,15 +14,6 @@ const ( MaxDetailsLength = 280 ) -// Description - description fields for a resource/indexing node -//type Description struct { -// Moniker string `json:"moniker" yaml:"moniker"` // name -// Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase) -// Website string `json:"website" yaml:"website"` // optional website link -// SecurityContact string `json:"security_contact" yaml:"security_contact"` // optional security contact info -// Details string `json:"details" yaml:"details"` // optional details -//} - // NewDescription returns a new Description with the provided values. func NewDescription(moniker, identity, website, securityContact, details string) Description { return Description{ @@ -54,13 +45,3 @@ func (d Description) EnsureLength() (Description, error) { return d, nil } - -//func (d Description) String() string { -// return fmt.Sprintf(`Description:{ -// Moniker: %s -// Identity: %s -// Website: %s -// SecurityContact: %s -// Details: %s -// }`, d.Moniker, d.Identity, d.Website, d.SecurityContact, d.Details) -//} diff --git a/x/register/types/unbonding_node.go b/x/register/types/unbonding_node.go index c7583715..20db4092 100644 --- a/x/register/types/unbonding_node.go +++ b/x/register/types/unbonding_node.go @@ -8,13 +8,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/tendermint/go-amino" + goamino "github.com/tendermint/go-amino" ) // ======================= // UnbondingNode stores all of a single delegator's unbonding bonds -// for a single unbonding node in an time-ordered list +// for a single unbonding node in a time-ordered list type UnbondingNode struct { NetworkAddr stratos.SdsAddress `json:"network_addr" yaml:"network_addr"` IsIndexingNode bool `json:"is_indexing_node yaml:"is_indexing_node` @@ -72,12 +72,12 @@ func (un *UnbondingNode) RemoveEntry(i int64) { } // return the unbonding Node -func MustMarshalUnbondingNode(cdc *amino.Codec, uin UnbondingNode) []byte { +func MustMarshalUnbondingNode(cdc *goamino.Codec, uin UnbondingNode) []byte { return cdc.MustMarshalBinaryLengthPrefixed(uin) } // unmarshal a unbonding Node from a store value -func MustUnmarshalUnbondingNode(cdc *amino.Codec, value []byte) UnbondingNode { +func MustUnmarshalUnbondingNode(cdc *goamino.Codec, value []byte) UnbondingNode { un, err := UnmarshalUnbondingNode(cdc, value) if err != nil { panic(err) @@ -86,7 +86,7 @@ func MustUnmarshalUnbondingNode(cdc *amino.Codec, value []byte) UnbondingNode { } // unmarshal a unbonding Node from a store value -func UnmarshalUnbondingNode(cdc *amino.Codec, value []byte) (uin UnbondingNode, err error) { +func UnmarshalUnbondingNode(cdc *goamino.Codec, value []byte) (uin UnbondingNode, err error) { err = cdc.UnmarshalBinaryLengthPrefixed(value, &uin) return uin, err } @@ -94,8 +94,8 @@ func UnmarshalUnbondingNode(cdc *amino.Codec, value []byte) (uin UnbondingNode, // nolint // inefficient but only used in testing func (un UnbondingNode) Equal(un2 UnbondingNode) bool { - bz1 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&un) - bz2 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&un2) + bz1 := goamino.MustMarshalBinaryLengthPrefixed(&un) + bz2 := goamino.MustMarshalBinaryLengthPrefixed(&un2) return bytes.Equal(bz1, bz2) } From 41ced1fc3edf673aeff19fb64f4a09660067e380 Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 4 May 2022 14:42:00 -0400 Subject: [PATCH 011/113] - qb-1163: update protobuf --- proto/stratos/register/v1/register.proto | 16 +- x/register/types/register.pb.go | 249 +++++++++++++---------- 2 files changed, 148 insertions(+), 117 deletions(-) diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index f41fff44..56b6651f 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -6,6 +6,7 @@ import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos/staking/v1beta1/staking.proto"; @@ -24,10 +25,9 @@ message ResourceNode { google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey",(gogoproto.moretags) = "yaml:\"pubkey\"" ]; bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; - string tokens = 5 [ - (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tokens\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" - ]; + repeated cosmos.base.v1beta1.Coin tokens = 5 [ + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"tokens\"" + ]; string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; string nodeType = 8 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -46,11 +46,9 @@ message IndexingNode { ]; bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; - string tokens = 5 [ - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"tokens\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" - ]; + repeated cosmos.base.v1beta1.Coin tokens = 5 [ + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"tokens\"" + ]; string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; google.protobuf.Timestamp creation_time = 9 [ diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 391ddf7d..6c09aed4 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types2 "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -101,15 +102,15 @@ func (m *Params) GetMaxEntries() uint32 { } type ResourceNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` - Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` - NodeType string `protobuf:"bytes,8,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` - CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=tokens,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + NodeType string `protobuf:"bytes,8,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` + CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } func (m *ResourceNode) Reset() { *m = ResourceNode{} } @@ -173,6 +174,13 @@ func (m *ResourceNode) GetStatus() types1.BondStatus { return types1.Unspecified } +func (m *ResourceNode) GetTokens() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Tokens + } + return nil +} + func (m *ResourceNode) GetOwnerAddress() string { if m != nil { return m.OwnerAddress @@ -202,14 +210,14 @@ func (m *ResourceNode) GetCreationTime() time.Time { } type IndexingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` - Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` - CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=tokens,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } func (m *IndexingNode) Reset() { *m = IndexingNode{} } @@ -273,6 +281,13 @@ func (m *IndexingNode) GetStatus() types1.BondStatus { return types1.Unspecified } +func (m *IndexingNode) GetTokens() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Tokens + } + return nil +} + func (m *IndexingNode) GetOwnerAddress() string { if m != nil { return m.OwnerAddress @@ -525,65 +540,67 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 928 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xcf, 0x6e, 0xe3, 0x44, - 0x18, 0x6f, 0x5a, 0xda, 0xa6, 0x93, 0x66, 0x01, 0x13, 0x81, 0x5b, 0x50, 0x9c, 0x5a, 0x15, 0xea, - 0x4a, 0x5b, 0x87, 0x16, 0x4e, 0xab, 0x05, 0xd4, 0x6c, 0x01, 0xad, 0x10, 0xab, 0x95, 0x5b, 0x51, - 0xc4, 0x25, 0x4c, 0xec, 0x0f, 0x67, 0x94, 0x78, 0xc6, 0xf2, 0x8c, 0xdb, 0xfa, 0xca, 0x13, 0xec, - 0xc3, 0xec, 0x43, 0xac, 0xb8, 0xb0, 0x17, 0x24, 0xc4, 0xc1, 0xa0, 0xf6, 0x0d, 0xfc, 0x04, 0xc8, - 0x33, 0xe3, 0x64, 0x92, 0xdd, 0xe5, 0xb8, 0xa7, 0x3d, 0xc5, 0xf3, 0xfd, 0xfe, 0x7c, 0x9f, 0x3f, - 0xfd, 0x6c, 0x07, 0xb9, 0x5c, 0xa4, 0x58, 0x30, 0xde, 0x4f, 0x21, 0x22, 0x5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0x1d, 0xef, 0xbd, 0x32, 0x7b, 0xa6, 0xd4, 0x5f, 0xd4, 0x55, 0xce, - 0xe6, 0xdb, 0x47, 0x3a, 0x13, 0xb3, 0xf0, 0xbf, 0xce, 0xa6, 0xd4, 0x5f, 0xd4, 0x0d, 0x1e, 0x3f, - 0xbf, 0xe9, 0x36, 0x5e, 0xdc, 0x74, 0x1b, 0xff, 0xde, 0x74, 0x1b, 0x4f, 0x6f, 0xbb, 0x2b, 0x2f, - 0x6e, 0xbb, 0x2b, 0x7f, 0xdd, 0x76, 0x57, 0x7e, 0xfe, 0xc2, 0x78, 0x6a, 0xb5, 0x2b, 0x05, 0x51, - 0x5f, 0x1e, 0x06, 0x63, 0x4c, 0x68, 0xff, 0x7a, 0xfe, 0x2f, 0x4f, 0x3e, 0xc7, 0xa3, 0x0d, 0x99, - 0xf3, 0xcf, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x07, 0xd9, 0x0d, 0x26, 0x06, 0x0a, 0x00, 0x00, + // 955 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xc1, 0x6e, 0xe3, 0x44, + 0x18, 0x6e, 0x5a, 0x9a, 0xa6, 0x93, 0x66, 0x81, 0x21, 0x02, 0xb7, 0xa0, 0x38, 0xb5, 0x7a, 0xe8, + 0x4a, 0x5b, 0x9b, 0x16, 0x4e, 0xab, 0x05, 0x29, 0x6e, 0x01, 0x21, 0xc4, 0x6a, 0xe5, 0x56, 0x14, + 0x71, 0x09, 0x13, 0x7b, 0x70, 0x46, 0x89, 0x67, 0x2c, 0xcf, 0xb8, 0xad, 0xdf, 0x62, 0xdf, 0x80, + 0x3b, 0x67, 0x1e, 0x62, 0xc5, 0x85, 0xe5, 0x80, 0xc4, 0xc9, 0x8b, 0xda, 0x37, 0xc8, 0x13, 0x20, + 0xcf, 0x8c, 0x93, 0x49, 0xe9, 0x22, 0x71, 0x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0x3e, 0x26, 0x34, 0x86, 0x7b, 0xa0, 0x73, 0x8e, 0xa6, 0x53, 0x2c, 0x6a, 0xaf, + 0xc9, 0xc9, 0x06, 0xcb, 0x41, 0xd8, 0x05, 0xeb, 0xdf, 0xa1, 0x69, 0xae, 0xae, 0xfc, 0xb5, 0x40, + 0x2d, 0x9c, 0xef, 0x41, 0xc7, 0xbc, 0x14, 0x39, 0xfc, 0x0a, 0x74, 0x32, 0x33, 0x60, 0x35, 0xe4, + 0xa6, 0xd9, 0xbd, 0xd3, 0x7b, 0x26, 0x35, 0x58, 0xe6, 0x55, 0xca, 0xe6, 0xd1, 0x24, 0x95, 0x89, + 0x19, 0xf8, 0x4f, 0x65, 0x93, 0x1a, 0x2c, 0xf3, 0xfc, 0xa7, 0x2f, 0xae, 0x7b, 0x8d, 0x97, 0xd7, + 0xbd, 0xc6, 0xdf, 0xd7, 0xbd, 0xc6, 0xf3, 0x9b, 0xde, 0xca, 0xcb, 0x9b, 0xde, 0xca, 0x5f, 0x37, + 0xbd, 0x95, 0x1f, 0x3e, 0x35, 0xb6, 0xa9, 0x56, 0xa5, 0x58, 0xd4, 0x8f, 0x07, 0xe1, 0x18, 0x11, + 0xea, 0x5d, 0x2d, 0xfe, 0x3f, 0xca, 0x8d, 0x3b, 0x6a, 0x4a, 0x9f, 0x7f, 0xf2, 0x4f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x59, 0x81, 0xff, 0x46, 0x60, 0x0a, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -689,16 +706,20 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - { - size := m.Tokens.Size() - i -= size - if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if len(m.Tokens) > 0 { + for iNdEx := len(m.Tokens) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - i = encodeVarintRegister(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x2a if m.Status != 0 { i = encodeVarintRegister(dAtA, i, uint64(m.Status)) i-- @@ -783,16 +804,20 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - { - size := m.Tokens.Size() - i -= size - if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if len(m.Tokens) > 0 { + for iNdEx := len(m.Tokens) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - i = encodeVarintRegister(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x2a if m.Status != 0 { i = encodeVarintRegister(dAtA, i, uint64(m.Status)) i-- @@ -1052,8 +1077,12 @@ func (m *ResourceNode) Size() (n int) { if m.Status != 0 { n += 1 + sovRegister(uint64(m.Status)) } - l = m.Tokens.Size() - n += 1 + l + sovRegister(uint64(l)) + if len(m.Tokens) > 0 { + for _, e := range m.Tokens { + l = e.Size() + n += 1 + l + sovRegister(uint64(l)) + } + } l = len(m.OwnerAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) @@ -1091,8 +1120,12 @@ func (m *IndexingNode) Size() (n int) { if m.Status != 0 { n += 1 + sovRegister(uint64(m.Status)) } - l = m.Tokens.Size() - n += 1 + l + sovRegister(uint64(l)) + if len(m.Tokens) > 0 { + for _, e := range m.Tokens { + l = e.Size() + n += 1 + l + sovRegister(uint64(l)) + } + } l = len(m.OwnerAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) @@ -1492,7 +1525,7 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1502,23 +1535,23 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Tokens = append(m.Tokens, types2.Coin{}) + if err := m.Tokens[len(m.Tokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1816,7 +1849,7 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1826,23 +1859,23 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Tokens = append(m.Tokens, types2.Coin{}) + if err := m.Tokens[len(m.Tokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From c85917038ffbf9ebede5c4d2d9a29a76c33e8d36 Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 4 May 2022 15:58:46 -0400 Subject: [PATCH 012/113] - qb-1163: update proto and keeper --- proto/stratos/register/v1/register.proto | 15 +- x/register/keeper/indexing_node.go | 81 +++++--- x/register/keeper/keeper.go | 40 +++- x/register/keeper/resource_node.go | 56 +++-- x/register/types/expected_keepers.go | 9 + x/register/types/register.pb.go | 249 ++++++++++------------- 6 files changed, 250 insertions(+), 200 deletions(-) diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index 56b6651f..37cf32ea 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -6,7 +6,6 @@ import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos/staking/v1beta1/staking.proto"; @@ -25,9 +24,10 @@ message ResourceNode { google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey",(gogoproto.moretags) = "yaml:\"pubkey\"" ]; bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; - repeated cosmos.base.v1beta1.Coin tokens = 5 [ - (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"tokens\"" - ]; + string tokens = 5 [ + (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tokens\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; string nodeType = 8 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -46,9 +46,10 @@ message IndexingNode { ]; bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; - repeated cosmos.base.v1beta1.Coin tokens = 5 [ - (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"tokens\"" - ]; + string tokens = 5 [ + (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tokens\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; google.protobuf.Timestamp creation_time = 9 [ diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 449bfdc0..e5b830b7 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -1,10 +1,12 @@ package keeper import ( + "bytes" "strings" "time" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" "github.com/tendermint/tendermint/crypto" @@ -65,7 +67,8 @@ func (k Keeper) GetIndexingNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) func (k Keeper) SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalIndexingNode(k.cdc, indexingNode) - store.Set(types.GetIndexingNodeKey(indexingNode.GetNetworkAddr()), bz) + networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + store.Set(types.GetIndexingNodeKey(networkAddr), bz) } // GetAllIndexingNodes get the set of all indexing nodes with no limits, used during genesis dump @@ -89,7 +92,7 @@ func (k Keeper) GetAllValidIndexingNodes(ctx sdk.Context) (indexingNodes []types for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) - if !node.IsSuspended() && node.GetStatus().Equal(sdk.Bonded) { + if !node.IsSuspended() && node.GetStatus().Equal(stakingtypes.Bonded) { indexingNodes = append(indexingNodes, node) } } @@ -99,8 +102,10 @@ func (k Keeper) GetAllValidIndexingNodes(ctx sdk.Context) (indexingNodes []types func (k Keeper) RegisterIndexingNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress, description types.Description, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error) { - indexingNode := types.NewIndexingNode(networkAddr, pubKey, ownerAddr, description, ctx.BlockHeader().Time) - + indexingNode, err := types.NewIndexingNode(networkAddr, pubKey, ownerAddr, description, ctx.BlockHeader().Time) + if err != nil { + return ozoneLimitChange, err + } ozoneLimitChange, err = k.AddIndexingNodeStake(ctx, indexingNode, stake) if err != nil { return ozoneLimitChange, err @@ -111,7 +116,7 @@ func (k Keeper) RegisterIndexingNode(ctx sdk.Context, networkAddr stratos.SdsAdd votingValidityPeriod := votingValidityPeriodInSecond * time.Second expireTime := ctx.BlockHeader().Time.Add(votingValidityPeriod) - votePool := types.NewRegistrationVotePool(indexingNode.GetNetworkAddr(), approveList, rejectList, expireTime) + votePool := types.NewRegistrationVotePool(networkAddr, approveList, rejectList, expireTime) k.SetIndexingNodeRegistrationVotePool(ctx, votePool) return ozoneLimitChange, nil @@ -123,12 +128,16 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin coins := sdk.NewCoins(tokenToAdd) + ownerAddr, err := sdk.AccAddressFromBech32(indexingNode.GetOwnerAddress()) + if err != nil { + return sdk.ZeroInt(), types.ErrInvalidOwnerAddr + } // sub coins from owner's wallet - hasCoin := k.bankKeeper.HasCoins(ctx, indexingNode.OwnerAddress, coins) + hasCoin := k.bankKeeper.HasCoins(ctx, ownerAddr, coins) if !hasCoin { return sdk.ZeroInt(), types.ErrInsufficientBalance } - _, err = k.bankKeeper.SubtractCoins(ctx, indexingNode.GetOwnerAddr(), coins) + _, err = k.bankKeeper.SubtractCoins(ctx, ownerAddr, coins) if err != nil { return sdk.ZeroInt(), err } @@ -136,15 +145,15 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin indexingNode = indexingNode.AddToken(tokenToAdd.Amount) switch indexingNode.GetStatus() { - case sdk.Unbonded: + case stakingtypes.Unbonded: notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) notBondedTokenInPool = notBondedTokenInPool.Add(tokenToAdd) k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) - case sdk.Bonded: + case stakingtypes.Bonded: bondedTokenInPool := k.GetIndexingNodeBondedToken(ctx) bondedTokenInPool = bondedTokenInPool.Add(tokenToAdd) k.SetIndexingNodeBondedToken(ctx, bondedTokenInPool) - case sdk.Unbonding: + case stakingtypes.Unbonding: return sdk.ZeroInt(), types.ErrUnbondingNode } @@ -172,7 +181,15 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, i // SubtractIndexingNodeStake Update the tokens of an existing indexing node func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - ownerAcc := k.accountKeeper.GetAccount(ctx, indexingNode.OwnerAddress) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + if err != nil { + return types.ErrInvalidNetworkAddr + } + ownerAddr, err := sdk.AccAddressFromBech32(indexingNode.GetOwnerAddress()) + if err != nil { + return types.ErrInvalidOwnerAddr + } + ownerAcc := k.accountKeeper.GetAccount(ctx, ownerAddr) if ownerAcc == nil { return types.ErrNoOwnerAccountFound } @@ -192,7 +209,7 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first - coins = k.DeductSlashing(ctx, indexingNode.OwnerAddress, coins) + coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc _, err := k.bankKeeper.AddCoins(ctx, indexingNode.OwnerAddress, coins) if err != nil { @@ -200,12 +217,12 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In } indexingNode = indexingNode.SubToken(tokenToSub.Amount) - newStake := indexingNode.GetTokens() + newStake := indexingNode.Tokens k.SetIndexingNode(ctx, indexingNode) if newStake.IsZero() { - err = k.removeIndexingNode(ctx, indexingNode.GetNetworkAddr()) + err = k.removeIndexingNode(ctx, networkAddr) if err != nil { return err } @@ -239,7 +256,11 @@ func (k Keeper) GetIndexingNodeList(ctx sdk.Context, networkAddr stratos.SdsAddr for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) - if node.NetworkAddr.Equals(networkAddr) { + networkAddrNode, err := stratos.SdsAddressFromBech32(node.GetNetworkAddr()) + if err != nil { + continue + } + if bytes.Equal(networkAddrNode, networkAddr) { indexingNodes = append(indexingNodes, node) } } @@ -261,24 +282,28 @@ func (k Keeper) GetIndexingNodeListByMoniker(ctx sdk.Context, moniker string) (r } func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress, - opinion types.VoteOpinion, voterAddr stratos.SdsAddress) (nodeStatus sdk.BondStatus, err error) { + opinion types.VoteOpinion, voterAddr stratos.SdsAddress) (nodeStatus stakingtypes.BondStatus, err error) { votePool, found := k.GetIndexingNodeRegistrationVotePool(ctx, nodeAddr) if !found { - return sdk.Unbonded, types.ErrNoRegistrationVotePoolFound + return stakingtypes.Unbonded, types.ErrNoRegistrationVotePoolFound } if votePool.ExpireTime.Before(ctx.BlockHeader().Time) { - return sdk.Unbonded, types.ErrVoteExpired + return stakingtypes.Unbonded, types.ErrVoteExpired } if hasValue(votePool.ApproveList, voterAddr) || hasValue(votePool.RejectList, voterAddr) { - return sdk.Unbonded, types.ErrDuplicateVoting + return stakingtypes.Unbonded, types.ErrDuplicateVoting } node, found := k.GetIndexingNode(ctx, nodeAddr) if !found { - return sdk.Unbonded, types.ErrNoIndexingNodeFound + return stakingtypes.Unbonded, types.ErrNoIndexingNodeFound + } + ownerAddrNode, err := sdk.AccAddressFromBech32(node.GetOwnerAddress()) + if err != nil { + return stakingtypes.Unbonded, types.ErrInvalidOwnerAddr } - if !node.OwnerAddress.Equals(ownerAddr) { + if !bytes.Equal(ownerAddrNode, ownerAddr) { return node.Status, types.ErrInvalidOwnerAddr } @@ -289,7 +314,7 @@ func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr } k.SetIndexingNodeRegistrationVotePool(ctx, votePool) - if node.Status == sdk.Bonded { + if node.Status == stakingtypes.Bonded { return node.Status, nil } @@ -297,12 +322,12 @@ func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr voteCountRequiredToPass := totalSpCount*2/3 + 1 //unbounded to bounded if len(votePool.ApproveList) >= voteCountRequiredToPass { - node.Status = sdk.Bonded + node.Status = stakingtypes.Bonded node.Suspend = false k.SetIndexingNode(ctx, node) // move stake from not bonded pool to bonded pool - tokenToBond := sdk.NewCoin(k.BondDenom(ctx), node.GetTokens()) + tokenToBond := sdk.NewCoin(k.BondDenom(ctx), node.Tokens) notBondedToken := k.GetIndexingNodeNotBondedToken(ctx) bondedToken := k.GetIndexingNodeBondedToken(ctx) @@ -343,7 +368,8 @@ func (k Keeper) UpdateIndexingNode(ctx sdk.Context, description types.Descriptio return types.ErrNoIndexingNodeFound } - if !node.OwnerAddress.Equals(ownerAddr) { + ownerAddrNode, _ := sdk.AccAddressFromBech32(node.GetOwnerAddress()) + if !bytes.Equal(ownerAddrNode, ownerAddr) { return types.ErrInvalidOwnerAddr } @@ -363,7 +389,8 @@ func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.Sds return sdk.ZeroInt(), blockTime, types.ErrNoIndexingNodeFound } - if !node.OwnerAddress.Equals(ownerAddr) { + ownerAddrNode, _ := sdk.AccAddressFromBech32(node.GetOwnerAddress()) + if !bytes.Equal(ownerAddrNode, ownerAddr) { return sdk.ZeroInt(), blockTime, types.ErrInvalidOwnerAddr } @@ -375,7 +402,7 @@ func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.Sds return ozoneLimitChange, blockTime, nil } else { // if !incrStake - if node.GetStatus() == sdk.Unbonding { + if node.GetStatus() == stakingtypes.Unbonding { return sdk.ZeroInt(), blockTime, types.ErrUnbondingNode } ozoneLimitChange, completionTime, err := k.UnbondIndexingNode(ctx, node, stakeDelta.Amount) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index e9cf9865..0c6cfd23 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "container/list" + "errors" "fmt" "time" @@ -184,12 +185,20 @@ func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { iterator := keeper.GetResourceNetworksIterator(ctx) for ; iterator.Valid(); iterator.Next() { resourceNode := types.MustUnmarshalResourceNode(k.cdc, iterator.Value()) - networkList = append(networkList, resourceNode.NetworkAddr) + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + if err != nil { + continue + } + networkList = append(networkList, networkAddr) } iter := keeper.GetIndexingNetworksIterator(ctx) for ; iter.Valid(); iter.Next() { indexingNode := types.MustUnmarshalResourceNode(k.cdc, iter.Value()) - networkList = append(networkList, indexingNode.NetworkAddr) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + if err != nil { + continue + } + networkList = append(networkList, networkAddr) } r := removeDuplicateValues(networkList) return r @@ -434,12 +443,19 @@ func (k Keeper) UnbondResourceNode( ctx.Logger().Info("Params of register module: " + params.String()) // transfer the node tokens to the not bonded pool - ownerAcc := k.accountKeeper.GetAccount(ctx, resourceNode.OwnerAddress) + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + if err != nil { + return sdk.ZeroInt(), time.Now(), errors.New("invalid network address") + } + ownerAddr, err := sdk.AccAddressFromBech32(resourceNode.GetOwnerAddress()) + if err != nil { + return sdk.ZeroInt(), time.Now(), errors.New("invalid wallet address") + } + ownerAcc := k.accountKeeper.GetAccount(ctx, ownerAddr) if ownerAcc == nil { return sdk.ZeroInt(), time.Time{}, types.ErrNoOwnerAccountFound } - networkAddr := resourceNode.GetNetworkAddr() if k.HasMaxUnbondingNodeEntries(ctx, networkAddr) { return sdk.ZeroInt(), time.Time{}, types.ErrMaxUnbondingNodeEntries } @@ -464,7 +480,7 @@ func (k Keeper) UnbondResourceNode( ctx.Logger().Info(fmt.Sprintf("Calculating mature time: creationTime[%s], threasholdTime[%s], completionTime[%s], matureTime[%s]", resourceNode.CreationTime, k.UnbondingThreasholdTime(ctx), k.UnbondingCompletionTime(ctx), unbondingMatureTime, )) - unbondingNode := k.SetUnbondingNodeEntry(ctx, resourceNode.GetNetworkAddr(), false, ctx.BlockHeight(), unbondingMatureTime, amt) + unbondingNode := k.SetUnbondingNodeEntry(ctx, networkAddr, false, ctx.BlockHeight(), unbondingMatureTime, amt) // Add to unbonding node queue k.InsertUnbondingNodeQueue(ctx, unbondingNode, unbondingMatureTime) ctx.Logger().Info("Unbonding resource node " + unbondingNode.String() + "\n after mature time" + unbondingMatureTime.String()) @@ -476,12 +492,20 @@ func (k Keeper) UnbondIndexingNode( ctx sdk.Context, indexingNode types.IndexingNode, amt sdk.Int, ) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error) { - ownerAcc := k.accountKeeper.GetAccount(ctx, indexingNode.OwnerAddress) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + if err != nil { + return sdk.ZeroInt(), time.Now(), errors.New("invalid network address") + } + ownerAddr, err := sdk.AccAddressFromBech32(indexingNode.GetOwnerAddress()) + if err != nil { + return sdk.ZeroInt(), time.Now(), errors.New("invalid wallet address") + } + + ownerAcc := k.accountKeeper.GetAccount(ctx, ownerAddr) if ownerAcc == nil { return sdk.ZeroInt(), time.Time{}, types.ErrNoOwnerAccountFound } - networkAddr := indexingNode.GetNetworkAddr() if k.HasMaxUnbondingNodeEntries(ctx, networkAddr) { return sdk.ZeroInt(), time.Time{}, types.ErrMaxUnbondingNodeEntries } @@ -503,7 +527,7 @@ func (k Keeper) UnbondIndexingNode( } // Set the unbonding mature time and completion height appropriately - unbondingNode := k.SetUnbondingNodeEntry(ctx, indexingNode.GetNetworkAddr(), true, ctx.BlockHeight(), unbondingMatureTime, amt) + unbondingNode := k.SetUnbondingNodeEntry(ctx, networkAddr, true, ctx.BlockHeight(), unbondingMatureTime, amt) // Add to unbonding node queue k.InsertUnbondingNodeQueue(ctx, unbondingNode, unbondingMatureTime) ctx.Logger().Info("Unbonding indexing node " + unbondingNode.String() + "\n after mature time" + unbondingMatureTime.String()) diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index b02f79a9..e241862f 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -1,9 +1,11 @@ package keeper import ( + "bytes" "time" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" "github.com/tendermint/tendermint/crypto" @@ -63,7 +65,8 @@ func (k Keeper) GetResourceNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) func (k Keeper) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalResourceNode(k.cdc, resourceNode) - store.Set(types.GetResourceNodeKey(resourceNode.GetNetworkAddr()), bz) + networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + store.Set(types.GetResourceNodeKey(networkAddr), bz) } // GetAllResourceNodes get the set of all resource nodes with no limits, used during genesis dump @@ -91,26 +94,31 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc coins := sdk.NewCoins(tokenToAdd) + ownerAddr, err := sdk.AccAddressFromBech32(resourceNode.GetOwnerAddress()) + if err != nil { + return sdk.ZeroInt(), types.ErrInvalidOwnerAddr + } + // sub coins from owner's wallet - hasCoin := k.bankKeeper.HasCoins(ctx, resourceNode.GetOwnerAddr(), coins) + hasCoin := k.bankKeeper.HasCoins(ctx, ownerAddr, coins) if !hasCoin { return sdk.ZeroInt(), types.ErrInsufficientBalance } - _, err = k.bankKeeper.SubtractCoins(ctx, resourceNode.GetOwnerAddr(), coins) + _, err = k.bankKeeper.SubtractCoins(ctx, ownerAddr, coins) if err != nil { return sdk.ZeroInt(), err } switch resourceNode.GetStatus() { - case sdk.Unbonded: + case stakingtypes.Unbonded: notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) notBondedTokenInPool = notBondedTokenInPool.Add(tokenToAdd) k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) - case sdk.Bonded: + case stakingtypes.Bonded: bondedTokenInPool := k.GetResourceNodeBondedToken(ctx) bondedTokenInPool = bondedTokenInPool.Add(tokenToAdd) k.SetResourceNodeBondedToken(ctx, bondedTokenInPool) - case sdk.Unbonding: + case stakingtypes.Unbonding: return sdk.ZeroInt(), types.ErrUnbondingNode } @@ -119,10 +127,10 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc // set status from unBonded to bonded & move stake from not bonded token pool to bonded token pool // since resource node registration does not require voting for now - if resourceNode.Status.Equal(sdk.Unbonded) { - resourceNode.Status = sdk.Bonded + if resourceNode.Status == stakingtypes.Unbonded { + resourceNode.Status = stakingtypes.Bonded - tokenToBond := sdk.NewCoin(k.BondDenom(ctx), resourceNode.GetTokens()) + tokenToBond := sdk.NewCoin(k.BondDenom(ctx), resourceNode.Tokens) notBondedToken := k.GetResourceNodeNotBondedToken(ctx) bondedToken := k.GetResourceNodeBondedToken(ctx) @@ -159,7 +167,16 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingResourceNode(ctx sdk.Context, r // SubtractResourceNodeStake Update the tokens of an existing resource node func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.ResourceNode, tokenToSub sdk.Coin) error { - ownerAcc := k.accountKeeper.GetAccount(ctx, resourceNode.OwnerAddress) + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + if err != nil { + return types.ErrInvalidNetworkAddr + } + ownerAddr, err := sdk.AccAddressFromBech32(resourceNode.GetOwnerAddress()) + if err != nil { + return types.ErrInvalidOwnerAddr + } + + ownerAcc := k.accountKeeper.GetAccount(ctx, ownerAddr) if ownerAcc == nil { return types.ErrNoOwnerAccountFound } @@ -179,7 +196,7 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first - coins = k.DeductSlashing(ctx, resourceNode.OwnerAddress, coins) + coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc _, err := k.bankKeeper.AddCoins(ctx, resourceNode.OwnerAddress, coins) if err != nil { @@ -187,12 +204,12 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re } resourceNode = resourceNode.SubToken(tokenToSub.Amount) - newStake := resourceNode.GetTokens() + newStake := resourceNode.Tokens k.SetResourceNode(ctx, resourceNode) if newStake.IsZero() { - err = k.removeResourceNode(ctx, resourceNode.GetNetworkAddr()) + err = k.removeResourceNode(ctx, networkAddr) if err != nil { return err } @@ -221,7 +238,10 @@ func (k Keeper) removeResourceNode(ctx sdk.Context, addr stratos.SdsAddress) err func (k Keeper) RegisterResourceNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress, description types.Description, nodeType types.NodeType, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error) { - resourceNode := types.NewResourceNode(networkAddr, pubKey, ownerAddr, description, nodeType, ctx.BlockHeader().Time) + resourceNode, err := types.NewResourceNode(networkAddr, pubKey, ownerAddr, description, nodeType, ctx.BlockHeader().Time) + if err != nil { + return ozoneLimitChange, err + } ozoneLimitChange, err = k.AddResourceNodeStake(ctx, resourceNode, stake) return ozoneLimitChange, err } @@ -234,7 +254,8 @@ func (k Keeper) UpdateResourceNode(ctx sdk.Context, description types.Descriptio return types.ErrNoResourceNodeFound } - if !node.OwnerAddress.Equals(ownerAddr) { + ownerAddrNode, _ := sdk.AccAddressFromBech32(node.GetOwnerAddress()) + if !bytes.Equal(ownerAddrNode, ownerAddr) { return types.ErrInvalidOwnerAddr } @@ -255,7 +276,8 @@ func (k Keeper) UpdateResourceNodeStake(ctx sdk.Context, networkAddr stratos.Sds return sdk.ZeroInt(), blockTime, types.ErrNoResourceNodeFound } - if !node.OwnerAddress.Equals(ownerAddr) { + ownerAddrNode, _ := sdk.AccAddressFromBech32(node.GetOwnerAddress()) + if !bytes.Equal(ownerAddrNode, ownerAddr) { return sdk.ZeroInt(), blockTime, types.ErrInvalidOwnerAddr } @@ -267,7 +289,7 @@ func (k Keeper) UpdateResourceNodeStake(ctx sdk.Context, networkAddr stratos.Sds return ozoneLimitChange, blockTime, nil } else { // if !incrStake - if node.GetStatus() == sdk.Unbonding { + if node.GetStatus() == stakingtypes.Unbonding { return sdk.ZeroInt(), blockTime, types.ErrUnbondingNode } diff --git a/x/register/types/expected_keepers.go b/x/register/types/expected_keepers.go index 7b386b1c..1e234ea4 100644 --- a/x/register/types/expected_keepers.go +++ b/x/register/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/params" stratos "github.com/stratosnet/stratos-chain/types" ) @@ -16,6 +17,14 @@ type BankKeeper interface { } */ +// ParamSubspace defines the expected Subspace interface +type ParamSubspace interface { + WithKeyTable(table params.KeyTable) params.Subspace + Get(ctx sdk.Context, key []byte, ptr interface{}) + GetParamSet(ctx sdk.Context, ps params.ParamSet) + SetParamSet(ctx sdk.Context, ps params.ParamSet) +} + // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { IterateAccounts(ctx sdk.Context, process func(authtypes.AccountI) (stop bool)) diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 6c09aed4..391ddf7d 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -7,7 +7,6 @@ import ( fmt "fmt" types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types2 "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -102,15 +101,15 @@ func (m *Params) GetMaxEntries() uint32 { } type ResourceNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` - Tokens github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=tokens,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` - NodeType string `protobuf:"bytes,8,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` - CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + NodeType string `protobuf:"bytes,8,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` + CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } func (m *ResourceNode) Reset() { *m = ResourceNode{} } @@ -174,13 +173,6 @@ func (m *ResourceNode) GetStatus() types1.BondStatus { return types1.Unspecified } -func (m *ResourceNode) GetTokens() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Tokens - } - return nil -} - func (m *ResourceNode) GetOwnerAddress() string { if m != nil { return m.OwnerAddress @@ -210,14 +202,14 @@ func (m *ResourceNode) GetCreationTime() time.Time { } type IndexingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` - Tokens github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=tokens,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` - CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } func (m *IndexingNode) Reset() { *m = IndexingNode{} } @@ -281,13 +273,6 @@ func (m *IndexingNode) GetStatus() types1.BondStatus { return types1.Unspecified } -func (m *IndexingNode) GetTokens() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Tokens - } - return nil -} - func (m *IndexingNode) GetOwnerAddress() string { if m != nil { return m.OwnerAddress @@ -540,67 +525,65 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 955 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xc1, 0x6e, 0xe3, 0x44, - 0x18, 0x6e, 0x5a, 0x9a, 0xa6, 0x93, 0x66, 0x81, 0x21, 0x02, 0xb7, 0xa0, 0x38, 0xb5, 0x7a, 0xe8, - 0x4a, 0x5b, 0x9b, 0x16, 0x4e, 0xab, 0x05, 0x29, 0x6e, 0x01, 0x21, 0xc4, 0x6a, 0xe5, 0x56, 0x14, - 0x71, 0x09, 0x13, 0x7b, 0x70, 0x46, 0x89, 0x67, 0x2c, 0xcf, 0xb8, 0xad, 0xdf, 0x62, 0xdf, 0x80, - 0x3b, 0x67, 0x1e, 0x62, 0xc5, 0x85, 0xe5, 0x80, 0xc4, 0xc9, 0x8b, 0xda, 0x37, 0xc8, 0x13, 0x20, - 0xcf, 0x8c, 0x93, 0x49, 0xe9, 0x22, 0x71, 0xd9, 0x53, 0x4f, 0xf1, 0xfc, 0xdf, 0xff, 0x7d, 0xff, - 0xef, 0xdf, 0xdf, 0xcc, 0x04, 0x38, 0x5c, 0x64, 0x48, 0x30, 0xee, 0x65, 0x38, 0x26, 0x5c, 0xe0, - 0xcc, 0xbb, 0x38, 0x9c, 0x3f, 0xbb, 0x69, 0xc6, 0x04, 0x83, 0xef, 0xe9, 0x1c, 0x77, 0x1e, 0xbf, - 0x38, 0xdc, 0xe9, 0xc6, 0x2c, 0x66, 0x12, 0xf7, 0xaa, 0x27, 0x95, 0xba, 0xb3, 0x1d, 0x33, 0x16, - 0x4f, 0xb1, 0x27, 0x57, 0xa3, 0xfc, 0x27, 0x0f, 0xd1, 0x42, 0x43, 0xf6, 0x6d, 0x48, 0x90, 0x04, - 0x73, 0x81, 0x92, 0xb4, 0xe6, 0x86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a, 0x42, 0x87, 0xff, 0x58, - 0x07, 0x5b, 0x01, 0xe6, 0x2c, 0xcf, 0x42, 0xfc, 0x94, 0x45, 0x18, 0x3e, 0x01, 0x6d, 0x8a, 0xc5, - 0x25, 0xcb, 0x26, 0x83, 0x28, 0xca, 0xf4, 0x60, 0x77, 0x66, 0xa5, 0xfd, 0xbe, 0xd2, 0xd4, 0xe0, - 0x10, 0x45, 0x51, 0x86, 0x39, 0x77, 0x02, 0x33, 0x1d, 0x9e, 0x83, 0x66, 0x9a, 0x8f, 0xbe, 0xc1, - 0x85, 0x1c, 0x61, 0xfb, 0xa8, 0xeb, 0x2a, 0xcf, 0xb8, 0xb5, 0x67, 0xdc, 0x01, 0x2d, 0xfc, 0x87, - 0xb3, 0xd2, 0xee, 0x28, 0xb9, 0x34, 0x1f, 0x4d, 0x70, 0xe1, 0xfc, 0xf6, 0xeb, 0x41, 0x57, 0xfb, - 0x25, 0xcc, 0x8a, 0x54, 0x30, 0xf7, 0x99, 0x94, 0x09, 0xb4, 0x1c, 0x7c, 0x04, 0x36, 0x78, 0xce, - 0x53, 0x4c, 0x23, 0x39, 0xba, 0x96, 0x0f, 0x67, 0xa5, 0xfd, 0x40, 0x69, 0x68, 0xc0, 0x09, 0xea, - 0x14, 0xf8, 0x2d, 0x68, 0x72, 0x81, 0x44, 0xae, 0x66, 0xf2, 0xe0, 0xc8, 0x71, 0xb5, 0x78, 0x6d, - 0x27, 0x6d, 0x2f, 0xd7, 0x67, 0x34, 0x3a, 0x95, 0x99, 0xfe, 0xbb, 0x8b, 0xa6, 0x14, 0xd7, 0x09, - 0xb4, 0x08, 0x14, 0xa0, 0x29, 0xd8, 0x04, 0x53, 0x6e, 0xad, 0xf7, 0xd7, 0xf6, 0xdb, 0x47, 0xdb, - 0xb5, 0x5c, 0xe5, 0xe6, 0xb9, 0xd6, 0x31, 0x23, 0xd4, 0x1f, 0xbc, 0x28, 0xed, 0x95, 0x85, 0x92, - 0xa2, 0x39, 0xbf, 0xb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d, 0xc6, 0xdf, 0xd7, 0xbd, 0xc6, 0xf3, 0x9b, 0xde, 0xca, 0xcb, 0x9b, 0xde, 0xca, 0x5f, 0x37, - 0xbd, 0x95, 0x1f, 0x3e, 0x35, 0xb6, 0xa9, 0x56, 0xa5, 0x58, 0xd4, 0x8f, 0x07, 0xe1, 0x18, 0x11, - 0xea, 0x5d, 0x2d, 0xfe, 0x3f, 0xca, 0x8d, 0x3b, 0x6a, 0x4a, 0x9f, 0x7f, 0xf2, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x59, 0x81, 0xff, 0x46, 0x60, 0x0a, 0x00, 0x00, + // 928 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xcf, 0x6e, 0xe3, 0x44, + 0x18, 0x6f, 0x5a, 0xda, 0xa6, 0x93, 0x66, 0x01, 0x13, 0x81, 0x5b, 0x50, 0x9c, 0x5a, 0x15, 0xea, + 0x4a, 0x5b, 0x87, 0x16, 0x4e, 0xab, 0x05, 0xd4, 0x6c, 0x01, 0xad, 0x10, 0xab, 0x95, 0x5b, 0x51, + 0xc4, 0x25, 0x4c, 0xec, 0x0f, 0x67, 0x94, 0x78, 0xc6, 0xf2, 0x8c, 0xdb, 0xfa, 0xca, 0x13, 0xec, + 0xc3, 0xec, 0x43, 0xac, 0xb8, 0xb0, 0x17, 0x24, 0xc4, 0xc1, 0xa0, 0xf6, 0x0d, 0xfc, 0x04, 0xc8, + 0x33, 0xe3, 0x64, 0x92, 0xdd, 0xe5, 0xb8, 0xa7, 0x3d, 0xc5, 0xf3, 0xfd, 0xfe, 0x7c, 0x9f, 0x3f, + 0xfd, 0x6c, 0x07, 0xb9, 0x5c, 0xa4, 0x58, 0x30, 0xde, 0x4f, 0x21, 0x22, 0x5c, 0x40, 0xda, 0xbf, + 0x3c, 0x9a, 0x5d, 0x7b, 0x49, 0xca, 0x04, 0xb3, 0x3e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0xdb, 0x47, 0x3a, 0x13, 0xb3, 0xf0, 0xbf, 0xce, 0xa6, 0xd4, 0x5f, 0xd4, 0x0d, 0x1e, 0x3f, + 0xbf, 0xe9, 0x36, 0x5e, 0xdc, 0x74, 0x1b, 0xff, 0xde, 0x74, 0x1b, 0x4f, 0x6f, 0xbb, 0x2b, 0x2f, + 0x6e, 0xbb, 0x2b, 0x7f, 0xdd, 0x76, 0x57, 0x7e, 0xfe, 0xc2, 0x78, 0x6a, 0xb5, 0x2b, 0x05, 0x51, + 0x5f, 0x1e, 0x06, 0x63, 0x4c, 0x68, 0xff, 0x7a, 0xfe, 0x2f, 0x4f, 0x3e, 0xc7, 0xa3, 0x0d, 0x99, + 0xf3, 0xcf, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x07, 0xd9, 0x0d, 0x26, 0x06, 0x0a, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -706,20 +689,16 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - if len(m.Tokens) > 0 { - for iNdEx := len(m.Tokens) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Tokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRegister(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err } + i = encodeVarintRegister(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a if m.Status != 0 { i = encodeVarintRegister(dAtA, i, uint64(m.Status)) i-- @@ -804,20 +783,16 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - if len(m.Tokens) > 0 { - for iNdEx := len(m.Tokens) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Tokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRegister(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err } + i = encodeVarintRegister(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a if m.Status != 0 { i = encodeVarintRegister(dAtA, i, uint64(m.Status)) i-- @@ -1077,12 +1052,8 @@ func (m *ResourceNode) Size() (n int) { if m.Status != 0 { n += 1 + sovRegister(uint64(m.Status)) } - if len(m.Tokens) > 0 { - for _, e := range m.Tokens { - l = e.Size() - n += 1 + l + sovRegister(uint64(l)) - } - } + l = m.Tokens.Size() + n += 1 + l + sovRegister(uint64(l)) l = len(m.OwnerAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) @@ -1120,12 +1091,8 @@ func (m *IndexingNode) Size() (n int) { if m.Status != 0 { n += 1 + sovRegister(uint64(m.Status)) } - if len(m.Tokens) > 0 { - for _, e := range m.Tokens { - l = e.Size() - n += 1 + l + sovRegister(uint64(l)) - } - } + l = m.Tokens.Size() + n += 1 + l + sovRegister(uint64(l)) l = len(m.OwnerAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) @@ -1525,7 +1492,7 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1535,23 +1502,23 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.Tokens = append(m.Tokens, types2.Coin{}) - if err := m.Tokens[len(m.Tokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1849,7 +1816,7 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1859,23 +1826,23 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.Tokens = append(m.Tokens, types2.Coin{}) - if err := m.Tokens[len(m.Tokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From c654b0820b9c6a4b565eaf03a48877cce2e2d142 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 4 May 2022 16:13:58 -0400 Subject: [PATCH 013/113] minor modifications --- x/register/abci.go | 13 +------------ x/register/types/genesis.go | 2 +- x/register/types/indexing_node.go | 10 +++++----- x/register/types/querier.go | 2 +- x/register/types/resource_node.go | 10 +++++----- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/x/register/abci.go b/x/register/abci.go index 5345450a..2ea66d35 100644 --- a/x/register/abci.go +++ b/x/register/abci.go @@ -1,6 +1,7 @@ package register import ( + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/register/keeper" abci "github.com/tendermint/tendermint/abci/types" @@ -17,18 +18,6 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { return k.BlockRegisteredNodesUpdates(ctx) } - -import ( -"time" - -abci "github.com/tendermint/tendermint/abci/types" - -"github.com/cosmos/cosmos-sdk/telemetry" -sdk "github.com/cosmos/cosmos-sdk/types" -"github.com/cosmos/cosmos-sdk/x/staking/keeper" -"github.com/cosmos/cosmos-sdk/x/staking/types" -) - // BeginBlocker will persist the current header and validator set as a historical entry // and prune the oldest entry based on the HistoricalEntries parameter func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 87f3fcfa..bd6a22a8 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -90,7 +90,7 @@ func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { PubKey: v.GetPubKey(), Suspend: v.GetSuspend(), Status: v.GetStatus(), - Tokens: v.Token, + Tokens: sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, v.Token)), OwnerAddress: ownerAddress.String(), Description: v.GetDescription(), } diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index a10109f1..9c03a5f0 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -65,7 +65,7 @@ func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, PubKey: pkAny, Suspend: true, Status: stakingtypes.Unbonded, - Tokens: sdk.ZeroInt(), + Tokens: sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, sdk.ZeroInt())), OwnerAddress: ownerAddr.String(), Description: description, CreationTime: creationTime, @@ -97,7 +97,7 @@ func (v IndexingNode) ConvertToString() string { // AddToken adds tokens to a indexing node func (v IndexingNode) AddToken(amount sdk.Int) IndexingNode { - v.Tokens = v.Tokens.Add(amount) + v.Tokens = v.Tokens.Add(sdk.NewCoin(DefaultBondDenom, amount)) return v } @@ -106,10 +106,10 @@ func (v IndexingNode) SubToken(amount sdk.Int) IndexingNode { if amount.IsNegative() { panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", amount)) } - if v.Tokens.LT(amount) { + if v.Tokens.AmountOf(DefaultBondDenom).LT(amount) { panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, amount)) } - v.Tokens = v.Tokens.Sub(amount) + v.Tokens = v.Tokens.Sub(sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, amount))) return v } @@ -145,7 +145,7 @@ func (v IndexingNode) Validate() error { if ownerAddr.Empty() { return ErrEmptyOwnerAddr } - if v.Tokens.LT(sdk.ZeroInt()) { + if v.Tokens.AmountOf(DefaultBondDenom).LT(sdk.ZeroInt()) { return ErrValueNegative } if v.GetDescription().Moniker == "" { diff --git a/x/register/types/querier.go b/x/register/types/querier.go index a37265a2..3f2b8085 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -81,7 +81,7 @@ type StakingInfo struct { PubKey crypto.PubKey `json:"pub_key"` Suspend bool `json:"suspend"` Status stakingtypes.BondStatus `json:"status"` - Tokens sdk.Int `json:"tokens"` + Tokens sdk.Coins `json:"tokens"` OwnerAddress sdk.AccAddress `json:"owner_address"` Description *Description `json:"description"` NodeType string `json:"node_type"` diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 51ed50a8..7d9f1d1c 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -92,7 +92,7 @@ func NewResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, PubKey: pkAny, Suspend: true, Status: stakingtypes.Unbonded, - Tokens: sdk.ZeroInt(), + Tokens: sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, sdk.ZeroInt())), OwnerAddress: ownerAddr.String(), Description: description, NodeType: nodeType.Type(), @@ -126,7 +126,7 @@ func (v ResourceNode) ConvertToString() string { // AddToken adds tokens to a resource node func (v ResourceNode) AddToken(amount sdk.Int) ResourceNode { - v.Tokens = v.Tokens.Add(amount) + v.Tokens = v.Tokens.Add(sdk.NewCoin(DefaultBondDenom, amount)) return v } @@ -135,10 +135,10 @@ func (v ResourceNode) SubToken(amount sdk.Int) ResourceNode { if amount.IsNegative() { panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", amount)) } - if v.Tokens.LT(amount) { + if v.Tokens.AmountOf(DefaultBondDenom).LT(amount) { panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, amount)) } - v.Tokens = v.Tokens.Sub(amount) + v.Tokens = v.Tokens.Sub(sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, amount))) return v } @@ -175,7 +175,7 @@ func (v ResourceNode) Validate() error { return ErrEmptyOwnerAddr } - if v.Tokens.LT(sdk.ZeroInt()) { + if v.Tokens.AmountOf(DefaultBondDenom).LT(sdk.ZeroInt()) { return ErrValueNegative } if v.GetDescription().Moniker == "" { From a06c87aa3a4a1e585eae8485eae17fef5a8dcb57 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 4 May 2022 22:51:10 -0400 Subject: [PATCH 014/113] major modifications --- proto/stratos/register/v1/genesis.proto | 1 - proto/stratos/register/v1/query.proto | 65 +- proto/stratos/register/v1/tx.proto | 18 +- x/register/client/cli/query.go | 230 ++++--- x/register/client/rest/query.go | 69 +- x/register/client/rest/rest.go | 12 +- x/register/client/rest/tx.go | 83 +-- x/register/genesis.go | 7 +- x/register/handler.go | 314 +-------- x/register/keeper/indexing_node.go | 4 +- x/register/keeper/keeper.go | 16 +- x/register/keeper/msg_server.go | 342 ++++++++++ x/register/keeper/querier.go | 7 +- x/register/keeper/resource_node.go | 2 +- x/register/module.go | 6 +- x/register/types/expected_keepers.go | 13 +- x/register/types/genesis.go | 4 +- x/register/types/genesis.pb.go | 96 ++- x/register/types/query.pb.go | 850 ++---------------------- x/register/types/query.pb.gw.go | 134 +--- x/register/types/tx.pb.go | 369 +++++----- x/register/types/tx.pb.gw.go | 274 ++++---- 22 files changed, 1103 insertions(+), 1813 deletions(-) create mode 100644 x/register/keeper/msg_server.go diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto index f8ab8626..0d251a38 100644 --- a/proto/stratos/register/v1/genesis.proto +++ b/proto/stratos/register/v1/genesis.proto @@ -7,7 +7,6 @@ import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos/staking/v1beta1/staking.proto"; import "stratos/register/v1/register.proto"; diff --git a/proto/stratos/register/v1/query.proto b/proto/stratos/register/v1/query.proto index 646b3585..239274d4 100644 --- a/proto/stratos/register/v1/query.proto +++ b/proto/stratos/register/v1/query.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package stratos.register.v1; -import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "stratos/register/v1/register.proto"; @@ -12,24 +11,24 @@ option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; service Query { // ResourceNode queries ResourceNode info for given ResourceNode address. rpc ResourceNode(QueryResourceNodeRequest) returns (QueryResourceNodeResponse) { - option (google.api.http).get = "/stratos/register/v1/resource-nodes/{node_addr}"; + option (google.api.http).get = "/stratos/register/v1/resource-nodes/{network_addr}"; } // IndexingNode queries IndexingNode info for given IndexingNode address. rpc IndexingNode(QueryIndexingNodeRequest) returns (QueryIndexingNodeResponse) { - option (google.api.http).get = "/stratos/register/v1/indexing-nodes/{node_addr}"; + option (google.api.http).get = "/stratos/register/v1/indexing-nodes/{network_addr}"; } - // Owner queries all staking info for given Owner address. - rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) { - option (google.api.http).get = "/stratos/register/v1/owner/{owner_addr}"; - } +// // Owner queries all staking info for given Owner address. +// rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) { +// option (google.api.http).get = "/stratos/register/v1/owner/{owner_addr}"; +// } } // QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method message QueryResourceNodeRequest { - // node_addr defines the node address to query for. - string node_addr = 1; + // network_addr defines the node address to query for. + string network_addr = 1; } // QueryResourceNodeResponse is response type for the Query/ResourceNode RPC method @@ -40,8 +39,8 @@ message QueryResourceNodeResponse { // QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method message QueryIndexingNodeRequest { - // node_addr defines the node address to query for. - string node_addr = 1; + // network_addr defines the node address to query for. + string network_addr = 1; } // QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method @@ -50,28 +49,28 @@ message QueryIndexingNodeResponse { IndexingNode node = 1 [(gogoproto.nullable) = false]; } -// QueryOwnerRequest is request type for the Query/Owner RPC method -message QueryOwnerRequest { - // owner_addr defines the owner address to query for. - string owner_addr = 1; -} - -// QueryOwnerResponse is response type for the Query/Owner RPC method -message QueryOwnerResponse { - // owner defines the the owner info. - string owner = 1 [(gogoproto.nullable) = true]; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} - -// 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]; -} +//// QueryOwnerRequest is request type for the Query/Owner RPC method +//message QueryOwnerRequest { +// // owner_addr defines the owner address to query for. +// string owner_addr = 1; +//} +// +//// QueryOwnerResponse is response type for the Query/Owner RPC method +//message QueryOwnerResponse { +// // owner defines the the owner info. +// string owner = 1 [(gogoproto.nullable) = true]; +// // pagination defines an optional pagination for the request. +// cosmos.base.query.v1beta1.PageRequest pagination = 2; +//} +// +//// QueryParamsRequest is request type for the Query/Params RPC method. +//message QueryParamsRequest {} +// +//// QueryParamsResponse is response type for the Query/Params RPC method. +//message QueryParamsResponse { +// // params holds all the parameters of this module. +// Params params = 1 [(gogoproto.nullable) = false]; +//} diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto index 9a66a293..b8b0e692 100644 --- a/proto/stratos/register/v1/tx.proto +++ b/proto/stratos/register/v1/tx.proto @@ -13,32 +13,32 @@ option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; // Msg defines the evm Msg service. service Msg { // CreateResourceNode defines a method for creating a new resource node. - rpc CreateResourceNode(MsgCreateResourceNode) returns (MsgCreateResourceNodeResponse) { + rpc HandleMsgCreateResourceNode(MsgCreateResourceNode) returns (MsgCreateResourceNodeResponse) { option (google.api.http).post = "/stratos/register/v1/create_resource_node"; }; - rpc RemoveResourceNode(MsgRemoveResourceNode) returns (MsgRemoveResourceNodeResponse) { + rpc HandleMsgRemoveResourceNode(MsgRemoveResourceNode) returns (MsgRemoveResourceNodeResponse) { option (google.api.http).post = "/stratos/register/v1/remove_resource_node"; }; - rpc UpdateResourceNode(MsgUpdateResourceNode) returns (MsgUpdateResourceNodeResponse) { + rpc HandleMsgUpdateResourceNode(MsgUpdateResourceNode) returns (MsgUpdateResourceNodeResponse) { option (google.api.http).post = "/stratos/register/v1/update_resource_node"; }; - rpc UpdateResourceNodeStake(MsgUpdateResourceNodeStake) returns (MsgUpdateResourceNodeStakeResponse) { + rpc HandleMsgUpdateResourceNodeStake(MsgUpdateResourceNodeStake) returns (MsgUpdateResourceNodeStakeResponse) { option (google.api.http).post = "/stratos/register/v1/update_resource_node_stake"; }; - rpc CreateIndexingNode(MsgCreateIndexingNode) returns (MsgCreateIndexingNodeResponse) { + rpc HandleMsgCreateIndexingNode(MsgCreateIndexingNode) returns (MsgCreateIndexingNodeResponse) { option (google.api.http).post = "/stratos/register/v1/create_indexing_node"; }; - rpc RemoveIndexingNode(MsgRemoveResourceNode) returns (MsgRemoveIndexingNodeResponse) { + rpc HandleMsgRemoveIndexingNode(MsgRemoveIndexingNode) returns (MsgRemoveIndexingNodeResponse) { option (google.api.http).post = "/stratos/register/v1/remove_indexing_node"; }; - rpc UpdateIndexingNode(MsgUpdateIndexingNode) returns (MsgUpdateIndexingNodeResponse) { + rpc HandleMsgUpdateIndexingNode(MsgUpdateIndexingNode) returns (MsgUpdateIndexingNodeResponse) { option (google.api.http).post = "/stratos/register/v1/update_indexing_node"; }; - rpc UpdateIndexingNodeStake(MsgUpdateIndexingNodeStake) returns (MsgUpdateIndexingNodeStakeResponse) { + rpc HandleMsgUpdateIndexingNodeStake(MsgUpdateIndexingNodeStake) returns (MsgUpdateIndexingNodeStakeResponse) { option (google.api.http).post = "/stratos/register/v1/update_indexing_node_stake"; }; - rpc IndexingNodeRegistrationVote(MsgIndexingNodeRegistrationVote) returns (MsgIndexingNodeRegistrationVoteResponse) { + rpc HandleMsgIndexingNodeRegistrationVote(MsgIndexingNodeRegistrationVote) returns (MsgIndexingNodeRegistrationVoteResponse) { option (google.api.http).post = "/stratos/register/v1/indexing_node_registration_vote"; }; diff --git a/x/register/client/cli/query.go b/x/register/client/cli/query.go index b5cb75af..939163ca 100644 --- a/x/register/client/cli/query.go +++ b/x/register/client/cli/query.go @@ -1,18 +1,14 @@ package cli import ( - "bufio" "fmt" "strings" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" "github.com/spf13/viper" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/register/keeper" "github.com/stratosnet/stratos-chain/x/register/types" ) @@ -29,7 +25,7 @@ func GetQueryCmd() *cobra.Command { registerQueryCmd.AddCommand( GetCmdQueryResourceNode(), - GetCmdQueryindexingNode(), + GetCmdQueryIndexingNode(), //GetCmdQueryIndexingNodeList(), ) @@ -39,10 +35,15 @@ func GetQueryCmd() *cobra.Command { // GetCmdQueryResourceNode implements the query resource nodes by network address command. func GetCmdQueryResourceNode() *cobra.Command { cmd := &cobra.Command{ - Use: "get-resource-nodes [flags]", // []byte - Short: "Query resource node by network address", + Use: "get-resource-nodes [flag]", + Short: "Query a resource node by its network address", Long: strings.TrimSpace( - fmt.Sprintf(`Query resource node by network address`), + fmt.Sprintf(`Query details about an individual resource node by its network address. +Example: +$ %s query register get-resource-nodes --network-id=%sstsds1np4d8re98lpgrcdqcas8yt85gl3rvj268leg6v +`, + version.AppName, + ), ), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -71,107 +72,148 @@ func GetCmdQueryResourceNode() *cobra.Command { return cmd } -// GetResNodesByNetworkAddr queries all resource nodes by multiple network IDs (sep: ";") -func GetResNodesByNetworkAddr(cliCtx context.CLIContext, queryRoute string) (res string, err error) { - queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) - queryByFlagNetworkAddrList := strings.Split(queryFlagNetworkAddr, ";") - for _, v := range queryByFlagNetworkAddrList { - resp, _, err := QueryResourceNode(cliCtx, queryRoute, v) - if err != nil { - return "null", err - } - res += string(resp) + ";" - } - return res[:len(res)-1], nil -} - -// QueryResourceNode queries resource node by network addr -func QueryResourceNode(cliCtx context.CLIContext, queryRoute, networkAddr string) ([]byte, int64, error) { - route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryResourceNodeByNetworkAddr) - sdsAddress, err := stratos.SdsAddressFromBech32(networkAddr) - if err != nil { - return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") - } - - params := types.NewQueryNodesParams(1, 1, sdsAddress, "", nil) - bz, err := cliCtx.Codec.MarshalJSON(params) - if err != nil { - return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") - } - return cliCtx.QueryWithData(route, bz) -} - -// GetCmdQueryIndexingNodeList implements the query all indexing nodes by network id command. -func GetCmdQueryIndexingNodeList(queryRoute string, cdc *codec.Codec) *cobra.Command { +// GetCmdQueryIndexingNode implements the query indexing nodes by network address command. +func GetCmdQueryIndexingNode() *cobra.Command { cmd := &cobra.Command{ - Use: "get-indexing-nodes [flags]", // []byte - Short: "Query all indexing nodes", + Use: "get-indexing-nodes [flag]", + Short: "Query an indexing node by its network address", Long: strings.TrimSpace( - fmt.Sprintf(`Query all indexing nodes`), + fmt.Sprintf(`Query details about an individual indexing node by its network address. +Example: +$ %s query register get-indexing-nodes --network-id=%sstsds1faej5w4q6hgnt0ft598dlm408g4p747y4krwca +`, + version.AppName, + ), ), RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) - // query all indexing nodes by network address + // query resource node by network address queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) if queryFlagNetworkAddr == "" { return sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") } - resp, err := GetIndNodesByNetworkAddr(cliCtx, queryRoute) + + result, err := queryClient.IndexingNode(cmd.Context(), &types.QueryIndexingNodeRequest{ + // Leaving status empty on purpose to query all validators. + }) if err != nil { return err } - return cliCtx.PrintOutput(resp) + return clientCtx.PrintProto(result) }, } cmd.Flags().String(FlagNetworkAddress, "", "(optional) The network address of the node") - return cmd } -// GetIndNodesByNetworkAddr queries all indexing nodes by multiple network addrs (sep: ";") -func GetIndNodesByNetworkAddr(cliCtx context.CLIContext, queryRoute string) (res string, err error) { - queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) - queryByFlagNetworkAddrList := strings.Split(queryFlagNetworkAddr, ";") - for _, v := range queryByFlagNetworkAddrList { - resp, _, err := QueryIndexingNodes(cliCtx, queryRoute, v) - if err != nil { - return "null", err - } - res += string(resp) + ";" - } - return res[:len(res)-1], nil -} - -// QueryIndexingNodes queries all indexing nodes -func QueryIndexingNodes(cliCtx context.CLIContext, queryRoute, networkAddr string) ([]byte, int64, error) { - route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryIndexingNodeByNetworkAddr) - sdsAddress, err := stratos.SdsAddressFromBech32(networkAddr) - if err != nil { - return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") - } - - params := types.NewQueryNodesParams(1, 1, sdsAddress, "", nil) - bz, err := cliCtx.Codec.MarshalJSON(params) - if err != nil { - return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") - } - return cliCtx.QueryWithData(route, bz) -} - -// Route returns the message routing key for the staking module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} - -// QuerierRoute returns the staking module's querier route name. -func (AppModule) QuerierRoute() string { - return types.QuerierRoute -} - -// LegacyQuerierHandler returns the staking module sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return keeper.NewQuerier(am.keeper, legacyQuerierCdc) -} +// +//// GetResNodesByNetworkAddr queries all resource nodes by multiple network IDs (sep: ";") +//func GetResNodesByNetworkAddr(cliCtx context.CLIContext, queryRoute string) (res string, err error) { +// queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) +// queryByFlagNetworkAddrList := strings.Split(queryFlagNetworkAddr, ";") +// for _, v := range queryByFlagNetworkAddrList { +// resp, _, err := QueryResourceNode(cliCtx, queryRoute, v) +// if err != nil { +// return "null", err +// } +// res += string(resp) + ";" +// } +// return res[:len(res)-1], nil +//} +// +//// QueryResourceNode queries resource node by network addr +//func QueryResourceNode(cliCtx context.CLIContext, queryRoute, networkAddr string) ([]byte, int64, error) { +// route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryResourceNodeByNetworkAddr) +// sdsAddress, err := stratos.SdsAddressFromBech32(networkAddr) +// if err != nil { +// return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") +// } +// +// params := types.NewQueryNodesParams(1, 1, sdsAddress, "", nil) +// bz, err := cliCtx.Codec.MarshalJSON(params) +// if err != nil { +// return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") +// } +// return cliCtx.QueryWithData(route, bz) +//} +// +//// GetCmdQueryIndexingNodeList implements the query all indexing nodes by network id command. +//func GetCmdQueryIndexingNodeList(queryRoute string, cdc *codec.Codec) *cobra.Command { +// cmd := &cobra.Command{ +// Use: "get-indexing-nodes [flags]", // []byte +// Short: "Query all indexing nodes", +// Long: strings.TrimSpace( +// fmt.Sprintf(`Query all indexing nodes`), +// ), +// RunE: func(cmd *cobra.Command, args []string) error { +// inBuf := bufio.NewReader(cmd.InOrStdin()) +// cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) +// +// // query all indexing nodes by network address +// queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) +// if queryFlagNetworkAddr == "" { +// return sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") +// } +// resp, err := GetIndNodesByNetworkAddr(cliCtx, queryRoute) +// if err != nil { +// return err +// } +// return cliCtx.PrintOutput(resp) +// +// }, +// } +// cmd.Flags().String(FlagNetworkAddress, "", "(optional) The network address of the node") +// +// return cmd +//} +// +//// GetIndNodesByNetworkAddr queries all indexing nodes by multiple network addrs (sep: ";") +//func GetIndNodesByNetworkAddr(cliCtx context.CLIContext, queryRoute string) (res string, err error) { +// queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) +// queryByFlagNetworkAddrList := strings.Split(queryFlagNetworkAddr, ";") +// for _, v := range queryByFlagNetworkAddrList { +// resp, _, err := QueryIndexingNodes(cliCtx, queryRoute, v) +// if err != nil { +// return "null", err +// } +// res += string(resp) + ";" +// } +// return res[:len(res)-1], nil +//} +// +//// QueryIndexingNodes queries all indexing nodes +//func QueryIndexingNodes(cliCtx context.CLIContext, queryRoute, networkAddr string) ([]byte, int64, error) { +// route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryIndexingNodeByNetworkAddr) +// sdsAddress, err := stratos.SdsAddressFromBech32(networkAddr) +// if err != nil { +// return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") +// } +// +// params := types.NewQueryNodesParams(1, 1, sdsAddress, "", nil) +// bz, err := cliCtx.Codec.MarshalJSON(params) +// if err != nil { +// return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") +// } +// return cliCtx.QueryWithData(route, bz) +//} +// +//// Route returns the message routing key for the staking module. +//func (am AppModule) Route() sdk.Route { +// return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +//} +// +//// QuerierRoute returns the staking module's querier route name. +//func (AppModule) QuerierRoute() string { +// return types.QuerierRoute +//} +// +//// LegacyQuerierHandler returns the staking module sdk.Querier. +//func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +// return keeper.NewQuerier(am.keeper, legacyQuerierCdc) +//} diff --git a/x/register/client/rest/query.go b/x/register/client/rest/query.go index 074cd2ec..3b2bf13c 100644 --- a/x/register/client/rest/query.go +++ b/x/register/client/rest/query.go @@ -5,7 +5,7 @@ import ( "net/http" "strconv" - "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" @@ -14,20 +14,20 @@ import ( "github.com/stratosnet/stratos-chain/x/register/types" ) -func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router) { - r.HandleFunc("/register/resource-nodes", nodesWithParamsFn(cliCtx, keeper.QueryResourceNodeByNetworkAddr)).Methods("GET") - r.HandleFunc("/register/indexing-nodes", nodesWithParamsFn(cliCtx, keeper.QueryIndexingNodeByNetworkAddr)).Methods("GET") - r.HandleFunc("/register/staking", nodeStakingHandlerFn(cliCtx, keeper.QueryNodesTotalStakes)).Methods("GET") - r.HandleFunc("/register/staking/address/{nodeAddress}", nodeStakingByNodeAddressFn(cliCtx, keeper.QueryNodeStakeByNodeAddr)).Methods("GET") - r.HandleFunc("/register/staking/owner/{ownerAddress}", nodeStakingByOwnerFn(cliCtx, keeper.QueryNodeStakeByOwner)).Methods("GET") - r.HandleFunc("/register/params", registerParamsHandlerFn(cliCtx, keeper.QueryRegisterParams)).Methods("GET") +func registerQueryRoutes(clientCtx client.Context, r *mux.Router) { + r.HandleFunc("/register/resource-nodes", nodesWithParamsFn(clientCtx, keeper.QueryResourceNodeByNetworkAddr)).Methods("GET") + r.HandleFunc("/register/indexing-nodes", nodesWithParamsFn(clientCtx, keeper.QueryIndexingNodeByNetworkAddr)).Methods("GET") + r.HandleFunc("/register/staking", nodeStakingHandlerFn(clientCtx, keeper.QueryNodesTotalStakes)).Methods("GET") + r.HandleFunc("/register/staking/address/{nodeAddress}", nodeStakingByNodeAddressFn(clientCtx, keeper.QueryNodeStakeByNodeAddr)).Methods("GET") + r.HandleFunc("/register/staking/owner/{ownerAddress}", nodeStakingByOwnerFn(clientCtx, keeper.QueryNodeStakeByOwner)).Methods("GET") + r.HandleFunc("/register/params", registerParamsHandlerFn(clientCtx, keeper.QueryRegisterParams)).Methods("GET") } // GET request handler to query params of Register module -func registerParamsHandlerFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func registerParamsHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } @@ -44,7 +44,7 @@ func registerParamsHandlerFn(cliCtx context.CLIContext, queryPath string) http.H } // GET request handler to query all resource/indexing nodes -func nodesWithParamsFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func nodesWithParamsFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) if err != nil { @@ -52,7 +52,7 @@ func nodesWithParamsFn(cliCtx context.CLIContext, queryPath string) http.Handler return } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } @@ -82,7 +82,7 @@ func nodesWithParamsFn(cliCtx context.CLIContext, queryPath string) http.Handler } params := types.NewQueryNodesParams(page, limit, networkAddr, moniker, ownerAddr) - bz, err := cliCtx.Codec.MarshalJSON(params) + bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -101,10 +101,10 @@ func nodesWithParamsFn(cliCtx context.CLIContext, queryPath string) http.Handler } // GET request handler to query nodes total staking info -func nodeStakingHandlerFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func nodeStakingHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } @@ -121,16 +121,16 @@ func nodeStakingHandlerFn(cliCtx context.CLIContext, queryPath string) http.Hand } // GET request handler to query node staking info -func nodeStakingByNodeAddressFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func nodeStakingByNodeAddressFn(cliCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + NodeAddrStr := mux.Vars(r)["nodeAddress"] + nodeAddress, ok := keeper.CheckSdsAddr(w, r, NodeAddrStr) if !ok { return } - NodeAddrStr := mux.Vars(r)["nodeAddress"] - nodeAddress, ok := keeper.CheckSdsAddr(w, r, NodeAddrStr) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } @@ -150,9 +150,8 @@ func nodeStakingByNodeAddressFn(cliCtx context.CLIContext, queryPath string) htt } params := types.NewQueryNodeStakingParams(nodeAddress, queryType) - bz, err := cliCtx.Codec.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + bz, err := cliCtx.LegacyAmino.MarshalJSON(params) + if rest.CheckBadRequestError(w, err) { return } @@ -164,42 +163,42 @@ func nodeStakingByNodeAddressFn(cliCtx context.CLIContext, queryPath string) htt } cliCtx = cliCtx.WithHeight(height) + if rest.CheckInternalServerError(w, err) { + return + } rest.PostProcessResponse(w, cliCtx, res) } } // GET request handler to query nodes staking info by Node wallet address -func nodeStakingByOwnerFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func nodeStakingByOwnerFn(cliCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + nodeWalletAddressStr := mux.Vars(r)["ownerAddress"] + nodeWalletAddress, ok := keeper.CheckAccAddr(w, r, nodeWalletAddressStr) + if !ok { return } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { + _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) + if rest.CheckBadRequestError(w, err) { return } - nodeWalletAddressStr := mux.Vars(r)["ownerAddress"] - nodeWalletAddress, ok := keeper.CheckAccAddr(w, r, nodeWalletAddressStr) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) if !ok { return } params := types.NewQueryNodesParams(page, limit, nil, "", nodeWalletAddress) - bz, err := cliCtx.Codec.MarshalJSON(params) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + bz, err := cliCtx.LegacyAmino.MarshalJSON(params) + if rest.CheckBadRequestError(w, err) { return } route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, queryPath) res, height, err := cliCtx.QueryWithData(route, bz) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) + if rest.CheckInternalServerError(w, err) { return } diff --git a/x/register/client/rest/rest.go b/x/register/client/rest/rest.go index 0e276224..edb62dd3 100644 --- a/x/register/client/rest/rest.go +++ b/x/register/client/rest/rest.go @@ -3,7 +3,8 @@ package rest import ( "github.com/gorilla/mux" - "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/rest" ) // REST Variable names @@ -16,8 +17,9 @@ const ( RestQueryType = "query_type" ) -// RegisterRoutes registers register-related REST handlers to a router -func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) { - registerTxRoutes(cliCtx, r) - registerQueryRoutes(cliCtx, r) +// RegisterHandlers registers register-related REST handlers to a router +func RegisterHandlers(clientCtx client.Context, rtr *mux.Router) { + r := rest.WithHTTPDeprecationHeaders(rtr) + registerQueryRoutes(clientCtx, r) + registerTxHandlers(clientCtx, r) } diff --git a/x/register/client/rest/tx.go b/x/register/client/rest/tx.go index 8ec16f2e..65ef7039 100644 --- a/x/register/client/rest/tx.go +++ b/x/register/client/rest/tx.go @@ -4,16 +4,17 @@ import ( "net/http" "strconv" - "github.com/cosmos/cosmos-sdk/client/context" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" "github.com/gorilla/mux" stratos "github.com/stratosnet/stratos-chain/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/rest" "github.com/stratosnet/stratos-chain/x/register/types" ) -func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router) { +func registerTxHandlers(cliCtx client.Context, r *mux.Router) { r.HandleFunc( "/register/createResourceNode", postCreateResourceNodeHandlerFn(cliCtx), @@ -117,11 +118,11 @@ type ( } ) -func postCreateResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postCreateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req CreateResourceNodeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -151,22 +152,23 @@ func postCreateResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - msg := types.NewMsgCreateResourceNode(networkAddr, pubKey, req.Amount, ownerAddr, req.Description, - types.NodeType(nodeTypeRef)) + nodeType := types.NodeType(nodeTypeRef) + msg, _ := types.NewMsgCreateResourceNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description, + &nodeType) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postCreateIndexingNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postCreateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req CreateIndexingNodeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -191,21 +193,26 @@ func postCreateIndexingNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - msg := types.NewMsgCreateIndexingNode(networkAddr, pubKey, req.Amount, ownerAddr, req.Description) + msg, err := types.NewMsgCreateIndexingNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postRemoveResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postRemoveResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req RemoveResourceNodeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -232,15 +239,15 @@ func postRemoveResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postRemoveIndexingNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postRemoveIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req RemoveIndexingNodeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -267,15 +274,15 @@ func postRemoveIndexingNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postUpdateResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postUpdateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req UpdateResourceNodeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -308,15 +315,15 @@ func postUpdateResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postUpdateResourceNodeStakeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postUpdateResourceNodeStakeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req UpdateResourceNodeStakeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -342,21 +349,21 @@ func postUpdateResourceNodeStakeHandlerFn(cliCtx context.CLIContext) http.Handle rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - msg := types.NewMsgUpdateResourceNodeStake(networkAddr, ownerAddr, req.StakeDelta, incrStake) + msg := types.NewMsgUpdateResourceNodeStake(networkAddr, ownerAddr, &req.StakeDelta, incrStake) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postUpdateIndexingNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postUpdateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req UpdateIndexingNodeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -383,15 +390,15 @@ func postUpdateIndexingNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postUpdateIndexingNodeStakeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func postUpdateIndexingNodeStakeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req UpdateIndexingNodeStakeRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -417,21 +424,21 @@ func postUpdateIndexingNodeStakeHandlerFn(cliCtx context.CLIContext) http.Handle rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - msg := types.NewMsgUpdateIndexingNodeStake(networkAddr, ownerAddr, req.StakeDelta, incrStake) + msg := types.NewMsgUpdateIndexingNodeStake(networkAddr, ownerAddr, &req.StakeDelta, incrStake) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } -func postIndexingNodeRegVoteFn(cliCtx context.CLIContext) http.HandlerFunc { +func postIndexingNodeRegVoteFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req IndexingNodeRegVoteRequest - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return } @@ -451,7 +458,7 @@ func postIndexingNodeRegVoteFn(cliCtx context.CLIContext) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) } - voteOpinion := types.VoteOpinionFromBool(req.Opinion) + voteOpinion := req.Opinion voterNetworkAddr, err := stratos.SdsAddressFromBech32(req.VoterNetworkAddress) if err != nil { @@ -470,6 +477,6 @@ func postIndexingNodeRegVoteFn(cliCtx context.CLIContext) http.HandlerFunc { return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) } } diff --git a/x/register/genesis.go b/x/register/genesis.go index 683237b9..55016b4f 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -61,6 +61,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) (res keeper.SetSlashing(ctx, walletAddress, sdk.NewInt(slashing.Value)) } + return } // ExportGenesis writes the current store values @@ -74,7 +75,7 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) (data *types.GenesisState) { totalUnissuedPrepay := keeper.GetTotalUnissuedPrepay(ctx).Amount initialUOzonePrice := keeper.CurrUozPrice(ctx) - var slashingInfo []types.Slashing + var slashingInfo []*types.Slashing keeper.IteratorSlashingInfo(ctx, func(walletAddress sdk.AccAddress, val sdk.Int) (stop bool) { if val.GT(sdk.ZeroInt()) { slashing := types.NewSlashing(walletAddress, val) @@ -85,8 +86,8 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) (data *types.GenesisState) { return &types.GenesisState{ Params: ¶ms, - ResourceNodes: resourceNodes, - IndexingNodes: indexingNodes, + ResourceNodes: &resourceNodes, + IndexingNodes: &indexingNodes, InitialUozPrice: initialUOzonePrice, TotalUnissuedPrepay: totalUnissuedPrepay, Slashing: slashingInfo, diff --git a/x/register/handler.go b/x/register/handler.go index ad8bba4c..ebf1a418 100644 --- a/x/register/handler.go +++ b/x/register/handler.go @@ -1,42 +1,49 @@ package register import ( - "encoding/hex" "fmt" - "strconv" - "time" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/keeper" "github.com/stratosnet/stratos-chain/x/register/types" ) // NewHandler ... func NewHandler(k keeper.Keeper) sdk.Handler { + msgServer := keeper.NewMsgServerImpl(k) + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { ctx = ctx.WithEventManager(sdk.NewEventManager()) switch msg := msg.(type) { - case types.MsgCreateResourceNode: - return handleMsgCreateResourceNode(ctx, msg, k) - case types.MsgRemoveResourceNode: - return handleMsgRemoveResourceNode(ctx, msg, k) - case types.MsgUpdateResourceNode: - return handleMsgUpdateResourceNode(ctx, msg, k) - case types.MsgUpdateResourceNodeStake: - return handleMsgUpdateResourceNodeStake(ctx, msg, k) - - case types.MsgCreateIndexingNode: - return handleMsgCreateIndexingNode(ctx, msg, k) - case types.MsgRemoveIndexingNode: - return handleMsgRemoveIndexingNode(ctx, msg, k) - case types.MsgUpdateIndexingNode: - return handleMsgUpdateIndexingNode(ctx, msg, k) - case types.MsgUpdateIndexingNodeStake: - return handleMsgUpdateIndexingNodeStake(ctx, msg, k) - case types.MsgIndexingNodeRegistrationVote: - return handleMsgIndexingNodeRegistrationVote(ctx, msg, k) + case *types.MsgCreateResourceNode: + res, err := msgServer.HandleMsgCreateResourceNode(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgRemoveResourceNode: + res, err := msgServer.HandleMsgRemoveResourceNode(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateResourceNode: + res, err := msgServer.HandleMsgUpdateResourceNode(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateResourceNodeStake: + res, err := msgServer.HandleMsgUpdateResourceNodeStake(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + case *types.MsgCreateIndexingNode: + res, err := msgServer.HandleMsgCreateIndexingNode(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgRemoveIndexingNode: + res, err := msgServer.HandleMsgRemoveIndexingNode(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateIndexingNode: + res, err := msgServer.HandleMsgUpdateIndexingNode(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateIndexingNodeStake: + res, err := msgServer.HandleMsgUpdateIndexingNodeStake(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgIndexingNodeRegistrationVote: + res, err := msgServer.HandleMsgIndexingNodeRegistrationVote(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) // this line is used by starport scaffolding # 1 default: @@ -45,264 +52,3 @@ func NewHandler(k keeper.Keeper) sdk.Handler { } } } - -func handleMsgCreateResourceNode(ctx sdk.Context, msg types.MsgCreateResourceNode, k keeper.Keeper) (*sdk.Result, error) { - // check to see if the pubkey or sender has been registered before - if _, found := k.GetResourceNode(ctx, stratos.SdsAddress(msg.PubKey.Address())); found { - ctx.Logger().Error("Resource node already exist") - return nil, ErrResourceNodePubKeyExists - } - if msg.Value.Denom != k.BondDenom(ctx) { - return nil, ErrBadDenom - } - - ozoneLimitChange, err := k.RegisterResourceNode(ctx, msg.NetworkAddr, msg.PubKey, msg.OwnerAddress, msg.Description, msg.NodeType, msg.Value) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeCreateResourceNode, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyNetworkAddress, stratos.SdsAddress(msg.PubKey.Address()).String()), - sdk.NewAttribute(types.AttributeKeyPubKey, hex.EncodeToString(msg.PubKey.Bytes())), - sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), - sdk.NewAttribute(types.AttributeKeyInitialStake, msg.Value.Amount.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgCreateIndexingNode(ctx sdk.Context, msg types.MsgCreateIndexingNode, k keeper.Keeper) (*sdk.Result, error) { - // check to see if the pubkey or sender has been registered before - if _, found := k.GetIndexingNode(ctx, stratos.SdsAddress(msg.PubKey.Address())); found { - ctx.Logger().Error("Indexing node already exist") - return nil, ErrIndexingNodePubKeyExists - } - if msg.Value.Denom != k.BondDenom(ctx) { - return nil, ErrBadDenom - } - - ozoneLimitChange, err := k.RegisterIndexingNode(ctx, msg.NetworkAddr, msg.PubKey, msg.OwnerAddress, msg.Description, msg.Value) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeCreateIndexingNode, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyNetworkAddress, stratos.SdsAddress(msg.PubKey.Address()).String()), - sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgRemoveResourceNode(ctx sdk.Context, msg types.MsgRemoveResourceNode, k keeper.Keeper) (*sdk.Result, error) { - resourceNode, found := k.GetResourceNode(ctx, msg.ResourceNodeAddress) - if !found { - return nil, ErrNoResourceNodeFound - } - if resourceNode.GetStatus() == sdk.Unbonding { - return nil, types.ErrUnbondingNode - } - - ozoneLimitChange, completionTime, err := k.UnbondResourceNode(ctx, resourceNode, resourceNode.Tokens) - if err != nil { - return nil, err - } - - completionTimeBz := types.ModuleCdc.MustMarshalBinaryLengthPrefixed(completionTime) - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUnbondingResourceNode, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyResourceNode, msg.ResourceNodeAddress.String()), - sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.Neg().String()), - sdk.NewAttribute(types.AttributeKeyStakeToRemove, resourceNode.Tokens.String()), - sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - - return &sdk.Result{Data: completionTimeBz, Events: ctx.EventManager().Events()}, nil -} - -func handleMsgRemoveIndexingNode(ctx sdk.Context, msg types.MsgRemoveIndexingNode, k keeper.Keeper) (*sdk.Result, error) { - indexingNode, found := k.GetIndexingNode(ctx, msg.IndexingNodeAddress) - if !found { - return nil, ErrNoIndexingNodeFound - } - - if indexingNode.GetStatus() == sdk.Unbonding { - return nil, types.ErrUnbondingNode - } - - ozoneLimitChange, completionTime, err := k.UnbondIndexingNode(ctx, indexingNode, indexingNode.Tokens) - if err != nil { - return nil, err - } - - completionTimeBz := types.ModuleCdc.MustMarshalBinaryLengthPrefixed(completionTime) - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUnbondingIndexingNode, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyIndexingNode, msg.IndexingNodeAddress.String()), - sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.Neg().String()), - sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - - return &sdk.Result{Data: completionTimeBz, Events: ctx.EventManager().Events()}, nil -} - -func handleMsgIndexingNodeRegistrationVote(ctx sdk.Context, msg types.MsgIndexingNodeRegistrationVote, k keeper.Keeper) (*sdk.Result, error) { - nodeToApprove, found := k.GetIndexingNode(ctx, msg.CandidateNetworkAddress) - if !found { - return nil, ErrNoIndexingNodeFound - } - if !nodeToApprove.GetOwnerAddr().Equals(msg.CandidateOwnerAddress) { - return nil, ErrInvalidOwnerAddr - } - - voter, found := k.GetIndexingNode(ctx, msg.VoterNetworkAddress) - if !found { - return nil, ErrInvalidApproverAddr - } - if !voter.Status.Equal(sdk.Bonded) || voter.IsSuspended() { - return nil, ErrInvalidApproverStatus - } - - nodeStatus, err := k.HandleVoteForIndexingNodeRegistration(ctx, msg.CandidateNetworkAddress, msg.CandidateOwnerAddress, msg.Opinion, msg.VoterNetworkAddress) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeIndexingNodeRegistrationVote, - sdk.NewAttribute(sdk.AttributeKeySender, msg.VoterOwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyVoterNetworkAddress, msg.VoterNetworkAddress.String()), - sdk.NewAttribute(types.AttributeKeyCandidateNetworkAddress, msg.CandidateNetworkAddress.String()), - sdk.NewAttribute(types.AttributeKeyCandidateStatus, nodeStatus.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.VoterOwnerAddress.String()), - ), - }) - - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgUpdateResourceNode(ctx sdk.Context, msg types.MsgUpdateResourceNode, k keeper.Keeper) (*sdk.Result, error) { - err := k.UpdateResourceNode(ctx, msg.Description, msg.NodeType, msg.NetworkAddress, msg.OwnerAddress) - if err != nil { - return nil, err - } - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpdateResourceNode, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgUpdateResourceNodeStake(ctx sdk.Context, msg types.MsgUpdateResourceNodeStake, k keeper.Keeper) (*sdk.Result, error) { - ozoneLimitChange, completionTime, err := k.UpdateResourceNodeStake(ctx, msg.NetworkAddress, msg.OwnerAddress, msg.StakeDelta, msg.IncrStake) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpdateResourceNodeStake, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress.String()), - sdk.NewAttribute(types.AttributeKeyIncrStakeBool, strconv.FormatBool(msg.IncrStake)), - sdk.NewAttribute(types.AttributeKeyStakeDelta, msg.StakeDelta.Amount.String()), - sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), - sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgUpdateIndexingNode(ctx sdk.Context, msg types.MsgUpdateIndexingNode, k keeper.Keeper) (*sdk.Result, error) { - err := k.UpdateIndexingNode(ctx, msg.Description, msg.NetworkAddress, msg.OwnerAddress) - if err != nil { - return nil, err - } - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpdateIndexingNode, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgUpdateIndexingNodeStake(ctx sdk.Context, msg types.MsgUpdateIndexingNodeStake, k keeper.Keeper) (*sdk.Result, error) { - ozoneLimitChange, completionTime, err := k.UpdateIndexingNodeStake(ctx, msg.NetworkAddress, msg.OwnerAddress, msg.StakeDelta, msg.IncrStake) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpdateIndexingNodeStake, - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress.String()), - sdk.NewAttribute(types.AttributeKeyIncrStakeBool, strconv.FormatBool(msg.IncrStake)), - sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), - sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index e5b830b7..8f0fe504 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -72,7 +72,7 @@ func (k Keeper) SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode } // GetAllIndexingNodes get the set of all indexing nodes with no limits, used during genesis dump -func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes []types.IndexingNode) { +func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes types.IndexingNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) defer iterator.Close() @@ -181,7 +181,7 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, i // SubtractIndexingNodeStake Update the tokens of an existing indexing node func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.AddToken().GetNetworkAddr()) if err != nil { return types.ErrInvalidNetworkAddr } diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 0c6cfd23..36e98797 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - //"github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" @@ -17,9 +17,9 @@ import ( // Keeper of the register store type Keeper struct { - storeKey sdk.StoreKey - cdc *amino.Codec - paramSpace types.ParamSubspace + storeKey sdk.StoreKey + cdc codec.BinaryCodec + //paramSpace types.ParamSubspace accountKeeper types.AccountKeeper bankKeeper types.BankKeeper hooks types.RegisterHooks @@ -30,13 +30,13 @@ type Keeper struct { } // NewKeeper creates a register keeper -func NewKeeper(cdc *amino.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, +func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper) Keeper { keeper := Keeper{ - storeKey: key, - cdc: cdc, - paramSpace: paramSpace.WithKeyTable(types.ParamKeyTable()), + storeKey: key, + cdc: cdc, + //paramSpace: paramSpace.WithKeyTable(types.ParamKeyTable()), accountKeeper: accountKeeper, bankKeeper: bankKeeper, hooks: nil, diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go new file mode 100644 index 00000000..958981e4 --- /dev/null +++ b/x/register/keeper/msg_server.go @@ -0,0 +1,342 @@ +package keeper + +import ( + "context" + "encoding/hex" + "strconv" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/register/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the bank MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types.MsgCreateResourceNode) (*types.MsgCreateResourceNodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // check to see if the pubkey or sender has been registered before + pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.PubKey.String()) + if err != nil { + return nil, err + } + + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddr) + if err != nil { + return &types.MsgCreateResourceNodeResponse{}, err + } + + if _, found := k.GetResourceNode(ctx, networkAddr); found { + ctx.Logger().Error("Resource node already exist") + return nil, types.ErrResourceNodePubKeyExists + } + if msg.Value.Denom != k.BondDenom(ctx) { + return nil, types.ErrBadDenom + } + + ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return &types.MsgCreateResourceNodeResponse{}, err + } + + ozoneLimitChange, err := k.RegisterResourceNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, msg.NodeType, msg.Value) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCreateResourceNode, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyNetworkAddress, pk.String()), + sdk.NewAttribute(types.AttributeKeyPubKey, hex.EncodeToString(pk.Bytes())), + sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), + sdk.NewAttribute(types.AttributeKeyInitialStake, msg.Value.Amount.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + return &types.MsgCreateResourceNodeResponse{}, nil +} + +func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types.MsgCreateIndexingNode) (*types.MsgCreateIndexingNodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + // check to see if the pubkey or sender has been registered before + pk, err := stratos.SdsAddressFromBech32(msg.PubKey.String()) + if err != nil { + return &types.MsgCreateIndexingNodeResponse{}, err + } + if _, found := k.GetIndexingNode(ctx, pk); found { + ctx.Logger().Error("Indexing node already exist") + return nil, types.ErrIndexingNodePubKeyExists + } + if msg.Value.Denom != k.BondDenom(ctx) { + return nil, types.ErrBadDenom + } + + ozoneLimitChange, err := k.RegisterIndexingNode(ctx, msg.NetworkAddr, msg.PubKey, msg.OwnerAddress, msg.Description, msg.Value) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCreateIndexingNode, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyNetworkAddress, pk.String()), + sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + return &types.MsgCreateIndexingNodeResponse{}, nil +} + +func (k msgServer) HandleMsgRemoveResourceNode(goCtx context.Context, msg *types.MsgRemoveResourceNode) (*types.MsgRemoveResourceNodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + p2pAddress, err := stratos.SdsAddressFromBech32(msg.ResourceNodeAddress) + if err != nil { + return &types.MsgRemoveResourceNodeResponse{}, err + } + resourceNode, found := k.GetResourceNode(ctx, p2pAddress) + if !found { + return nil, types.ErrNoResourceNodeFound + } + if resourceNode.GetStatus().String() == stakingtypes.BondStatusUnbonding { + return nil, types.ErrUnbondingNode + } + + ozoneLimitChange, completionTime, err := k.UnbondResourceNode(ctx, resourceNode, resourceNode.Tokens) + if err != nil { + return nil, err + } + + //completionTimeBz := amino.MustMarshalBinaryLengthPrefixed(completionTime) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeUnbondingResourceNode, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyResourceNode, msg.ResourceNodeAddress), + sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.Neg().String()), + sdk.NewAttribute(types.AttributeKeyStakeToRemove, resourceNode.Tokens.String()), + sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + + return &types.MsgRemoveResourceNodeResponse{}, nil +} + +func (k msgServer) HandleMsgRemoveIndexingNode(goCtx context.Context, msg *types.MsgRemoveIndexingNode) (*types.MsgRemoveIndexingNodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + p2pAddress, err := stratos.SdsAddressFromBech32(msg.IndexingNodeAddress) + if err != nil { + return &types.MsgRemoveIndexingNodeResponse{}, err + } + indexingNode, found := k.GetIndexingNode(ctx, p2pAddress) + if !found { + return nil, types.ErrNoIndexingNodeFound + } + + if indexingNode.GetStatus().String() == stakingtypes.BondStatusUnbonding { + return nil, types.ErrUnbondingNode + } + + ozoneLimitChange, completionTime, err := k.UnbondIndexingNode(ctx, indexingNode, indexingNode.Tokens) + if err != nil { + return nil, err + } + + //completionTimeBz := amino.MustMarshalBinaryLengthPrefixed(completionTime) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeUnbondingIndexingNode, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyIndexingNode, msg.IndexingNodeAddress), + sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.Neg().String()), + sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + + return &types.MsgRemoveIndexingNodeResponse{}, nil +} + +func (k msgServer) HandleMsgIndexingNodeRegistrationVote(goCtx context.Context, msg *types.MsgIndexingNodeRegistrationVote) (*types.MsgIndexingNodeRegistrationVoteResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + candidateNetworkAddress, err := stratos.SdsAddressFromBech32(msg.CandidateNetworkAddress) + if err != nil { + return &types.MsgIndexingNodeRegistrationVoteResponse{}, err + } + + nodeToApprove, found := k.GetIndexingNode(ctx, candidateNetworkAddress) + if !found { + return nil, types.ErrNoIndexingNodeFound + } + ownerAddress, err := stratos.SdsAddressFromBech32(nodeToApprove.OwnerAddress) + if err != nil { + return &types.MsgIndexingNodeRegistrationVoteResponse{}, err + } + if !ownerAddress.Equals(candidateNetworkAddress) { + return nil, types.ErrInvalidOwnerAddr + } + voterNetworkAddress, err := stratos.SdsAddressFromBech32(msg.VoterNetworkAddress) + if err != nil { + return &types.MsgIndexingNodeRegistrationVoteResponse{}, err + } + voter, found := k.GetIndexingNode(ctx, voterNetworkAddress) + if !found { + return nil, types.ErrInvalidVoterAddr + } + + candidateOwnerAddress, err := sdk.AccAddressFromBech32(msg.CandidateOwnerAddress) + if err != nil { + return &types.MsgIndexingNodeRegistrationVoteResponse{}, err + } + + if !(voter.Status.String() == stakingtypes.BondStatusBonded) || voter.Suspend { + return nil, types.ErrInvalidVoterStatus + } + + nodeStatus, err := k.HandleVoteForIndexingNodeRegistration(ctx, candidateNetworkAddress, candidateOwnerAddress, types.VoteOpinion(msg.Opinion), voterNetworkAddress) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeIndexingNodeRegistrationVote, + sdk.NewAttribute(sdk.AttributeKeySender, msg.VoterOwnerAddress), + sdk.NewAttribute(types.AttributeKeyVoterNetworkAddress, msg.VoterNetworkAddress), + sdk.NewAttribute(types.AttributeKeyCandidateNetworkAddress, msg.CandidateNetworkAddress), + sdk.NewAttribute(types.AttributeKeyCandidateStatus, nodeStatus.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.VoterOwnerAddress), + ), + }) + + return &types.MsgIndexingNodeRegistrationVoteResponse{}, nil +} + +func (k msgServer) HandleMsgUpdateResourceNode(goCtx context.Context, msg *types.MsgUpdateResourceNode) (*types.MsgUpdateResourceNodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + _, err := k.UpdateResourceNode(ctx, msg.Description, msg.NodeType, msg.NetworkAddress, msg.OwnerAddress) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeUpdateResourceNode, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + return &types.MsgUpdateResourceNodeResponse{}, nil +} + +func (k msgServer) HandleMsgUpdateResourceNodeStake(goCtx context.Context, msg *types.MsgUpdateResourceNodeStake) (*types.MsgUpdateResourceNodeStakeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + ozoneLimitChange, completionTime, err := k.UpdateResourceNodeStake(ctx, msg.NetworkAddress, msg.OwnerAddress, msg.StakeDelta, msg.IncrStake) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeUpdateResourceNodeStake, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress), + sdk.NewAttribute(types.AttributeKeyIncrStakeBool, strconv.FormatBool(msg.IncrStake)), + sdk.NewAttribute(types.AttributeKeyStakeDelta, msg.StakeDelta.Amount.String()), + sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), + sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + return &types.MsgUpdateResourceNodeStakeResponse{}, nil +} + +func (k msgServer) HandleMsgUpdateIndexingNode(goCtx context.Context, msg *types.MsgUpdateIndexingNode) (*types.MsgUpdateIndexingNodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + err := k.UpdateIndexingNode(ctx, msg.Description, msg.NetworkAddress, msg.OwnerAddress) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeUpdateIndexingNode, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + return &types.MsgUpdateIndexingNodeResponse{}, nil +} + +func (k msgServer) HandleMsgUpdateIndexingNodeStake(goCtx context.Context, msg *types.MsgUpdateIndexingNodeStake) (*types.MsgUpdateIndexingNodeStakeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + ozoneLimitChange, completionTime, err := k.UpdateIndexingNodeStake(ctx, msg.NetworkAddress, msg.OwnerAddress, msg.StakeDelta, msg.IncrStake) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeUpdateIndexingNodeStake, + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress), + sdk.NewAttribute(types.AttributeKeyIncrStakeBool, strconv.FormatBool(msg.IncrStake)), + sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), + sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + }) + return &types.MsgUpdateIndexingNodeStakeResponse{}, nil +} diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 9e19f588..5a36ded9 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -17,17 +17,18 @@ import ( ) const ( - QueryResourceNodeByNetworkAddr = "resource_node_by_network" + QueryResourceNodeByNetworkAddr = "resource-nodes" QueryIndexingNodeByNetworkAddr = "indexing_nodes" QueryNodesTotalStakes = "nodes_total_stakes" QueryNodeStakeByNodeAddr = "node_stakes" QueryNodeStakeByOwner = "node_stakes_by_owner" QueryRegisterParams = "register_params" - QueryDefaultLimit = 100 + + QueryDefaultLimit = 100 ) // NewQuerier creates a new querier for register clients. -func NewQuerier(k Keeper) sdk.Querier { +func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) { switch path[0] { case QueryResourceNodeByNetworkAddr: diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index e241862f..e60778c4 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -70,7 +70,7 @@ func (k Keeper) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode } // GetAllResourceNodes get the set of all resource nodes with no limits, used during genesis dump -func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes []types.ResourceNode) { +func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes types.ResourceNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) defer iterator.Close() diff --git a/x/register/module.go b/x/register/module.go index 44ff8d88..c1fff2cc 100644 --- a/x/register/module.go +++ b/x/register/module.go @@ -69,7 +69,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterRESTRoutes registers the REST routes for the register module. func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(ctx, rtr) + rest.RegisterHandlers(ctx, rtr) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. @@ -122,8 +122,8 @@ func (AppModule) QuerierRoute() string { } // NewQuerierHandler returns the register module sdk.Querier. -func (am AppModule) NewQuerierHandler() sdk.Querier { - return keeper.NewQuerier(am.keeper) +func (am AppModule) NewQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) } // BeginBlock returns the begin blocker for the register module. diff --git a/x/register/types/expected_keepers.go b/x/register/types/expected_keepers.go index 1e234ea4..364b7f6c 100644 --- a/x/register/types/expected_keepers.go +++ b/x/register/types/expected_keepers.go @@ -3,7 +3,6 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/params" stratos "github.com/stratosnet/stratos-chain/types" ) @@ -18,12 +17,12 @@ type BankKeeper interface { */ // ParamSubspace defines the expected Subspace interface -type ParamSubspace interface { - WithKeyTable(table params.KeyTable) params.Subspace - Get(ctx sdk.Context, key []byte, ptr interface{}) - GetParamSet(ctx sdk.Context, ps params.ParamSet) - SetParamSet(ctx sdk.Context, ps params.ParamSet) -} +//type ParamSubspace interface { +// WithKeyTable(table params.KeyTable) params.Subspace +// Get(ctx sdk.Context, key []byte, ptr interface{}) +// GetParamSet(ctx sdk.Context, ps params.ParamSet) +// SetParamSet(ctx sdk.Context, ps params.ParamSet) +//} // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 87f3fcfa..5542bed5 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -96,8 +96,8 @@ func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { } } -func NewSlashing(walletAddress sdk.AccAddress, value sdk.Int) Slashing { - return Slashing{ +func NewSlashing(walletAddress sdk.AccAddress, value sdk.Int) *Slashing { + return &Slashing{ WalletAddress: walletAddress.String(), Value: value.Int64(), } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go index 8376106d..3ecd1eda 100644 --- a/x/register/types/genesis.pb.go +++ b/x/register/types/genesis.pb.go @@ -6,7 +6,6 @@ package types import ( fmt "fmt" types "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/gogo/protobuf/gogoproto" @@ -192,54 +191,53 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } var fileDescriptor_5bdab54ebea9e48e = []byte{ - // 741 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6a, 0xdb, 0x48, - 0x1c, 0xc7, 0xed, 0x4d, 0xe2, 0x24, 0x72, 0x92, 0x65, 0x15, 0xef, 0xa2, 0x64, 0x77, 0x2d, 0xef, - 0xb0, 0x2c, 0x59, 0x48, 0x24, 0x9c, 0xf6, 0x54, 0x42, 0x21, 0x22, 0xb4, 0xa4, 0xa5, 0xc1, 0xc8, - 0x0d, 0x85, 0x5e, 0xc4, 0x58, 0x9a, 0x28, 0x83, 0xed, 0x19, 0x31, 0x33, 0x72, 0xa2, 0x9c, 0xfa, - 0x08, 0x7d, 0x87, 0xbe, 0x42, 0x1f, 0x22, 0xf4, 0x94, 0x63, 0xe9, 0x41, 0x94, 0xe4, 0xde, 0x83, - 0x9f, 0xa0, 0x78, 0x66, 0x64, 0x2b, 0xc5, 0x14, 0x72, 0xf2, 0x8c, 0x7f, 0xdf, 0xdf, 0xe7, 0xcb, - 0xfc, 0xfe, 0xc8, 0xf8, 0x87, 0x0b, 0x06, 0x05, 0xe5, 0x2e, 0x43, 0x31, 0xe6, 0x02, 0x31, 0x77, - 0xd4, 0x76, 0x63, 0x44, 0x10, 0xc7, 0xdc, 0x49, 0x18, 0x15, 0xd4, 0xdc, 0xd0, 0x12, 0x07, 0x8d, - 0x86, 0xce, 0xa8, 0xbd, 0xbd, 0x15, 0x53, 0x1a, 0x0f, 0x90, 0x2b, 0xa3, 0xbd, 0xf4, 0xcc, 0x85, - 0x24, 0x53, 0xd2, 0xed, 0x46, 0x4c, 0x63, 0x2a, 0x8f, 0xee, 0xe4, 0xa4, 0xff, 0xdd, 0x0a, 0x29, - 0x1f, 0x52, 0x1e, 0xa8, 0x80, 0xba, 0xe8, 0x50, 0x53, 0xdd, 0xdc, 0x1e, 0xe4, 0xc8, 0x1d, 0xb5, - 0x7b, 0x48, 0xc0, 0xb6, 0x1b, 0x52, 0x4c, 0x74, 0xfc, 0x5f, 0x1d, 0xe7, 0x02, 0xf6, 0x31, 0x89, - 0xa7, 0x12, 0x7d, 0xd7, 0x2a, 0x30, 0xef, 0x11, 0xc5, 0x59, 0x69, 0xc0, 0xb7, 0x45, 0x63, 0xed, - 0xb9, 0x7a, 0x57, 0x57, 0x40, 0x81, 0xcc, 0x67, 0x46, 0x2d, 0x81, 0x0c, 0x0e, 0xb9, 0x55, 0x6d, - 0x55, 0x77, 0xea, 0xfb, 0x7f, 0x3a, 0xc5, 0x3b, 0xa7, 0x99, 0xa3, 0xb6, 0xd3, 0x91, 0x12, 0xef, - 0xb7, 0x71, 0x6e, 0xaf, 0x67, 0x70, 0x38, 0x78, 0x02, 0x54, 0x12, 0xf0, 0x75, 0xb6, 0x19, 0x1a, - 0xeb, 0x0c, 0x71, 0x9a, 0xb2, 0x10, 0x9d, 0xd0, 0x08, 0x71, 0xeb, 0x17, 0x89, 0x03, 0x73, 0x71, - 0x7e, 0x59, 0xe9, 0x6d, 0x8d, 0x73, 0xfb, 0x77, 0x45, 0x2d, 0x10, 0x01, 0x99, 0x44, 0x80, 0x7f, - 0x9f, 0x39, 0x31, 0xc1, 0x24, 0x42, 0x97, 0x98, 0xc4, 0xca, 0x64, 0xe1, 0x27, 0x26, 0xc7, 0x65, - 0x65, 0xd9, 0xa4, 0x40, 0x4c, 0x4d, 0xee, 0x31, 0x4d, 0x61, 0xfc, 0x8a, 0x09, 0x16, 0x18, 0x0e, - 0x4e, 0xe9, 0x55, 0x87, 0xe1, 0x10, 0x59, 0x8b, 0xad, 0xea, 0xce, 0xaa, 0xf7, 0xe2, 0x3a, 0xb7, - 0x2b, 0x5f, 0x72, 0xfb, 0xbf, 0x18, 0x8b, 0xf3, 0xb4, 0xe7, 0x84, 0x74, 0xa8, 0xdb, 0xa8, 0x7f, - 0xf6, 0x78, 0xd4, 0x77, 0x45, 0x96, 0x20, 0xee, 0x1c, 0xa1, 0x70, 0x9c, 0xdb, 0x56, 0x61, 0x28, - 0x71, 0x41, 0x4a, 0xaf, 0x82, 0x64, 0x02, 0x04, 0xfe, 0x8f, 0x16, 0xe6, 0xbb, 0xaa, 0xb1, 0x29, - 0xa8, 0x80, 0x83, 0x53, 0x82, 0x39, 0x4f, 0x51, 0xd4, 0x61, 0x28, 0x81, 0x99, 0xb5, 0x24, 0xad, - 0x4f, 0x1e, 0x60, 0x7d, 0x4c, 0xc4, 0x38, 0xb7, 0xff, 0x52, 0xd6, 0x12, 0x19, 0xa4, 0x9a, 0x19, - 0x24, 0x12, 0x0a, 0xfc, 0x79, 0x56, 0x66, 0xd7, 0x58, 0xe1, 0x03, 0xc8, 0xcf, 0x31, 0x89, 0xad, - 0x5a, 0x6b, 0x61, 0xa7, 0xbe, 0xff, 0xf7, 0xdc, 0xc2, 0x76, 0xb5, 0xc8, 0xb3, 0xc6, 0xb9, 0xdd, - 0x50, 0x3e, 0x45, 0x62, 0x80, 0xc9, 0x19, 0x05, 0xfe, 0x14, 0x04, 0x3e, 0x2c, 0x1a, 0x9b, 0x7a, - 0xe0, 0xca, 0x0d, 0x31, 0x0f, 0x8c, 0x3a, 0x41, 0xe2, 0x82, 0xb2, 0xfe, 0x61, 0x14, 0x31, 0x39, - 0x7c, 0xab, 0xde, 0xf6, 0x38, 0xb7, 0xff, 0x50, 0x40, 0x1d, 0x0c, 0x60, 0x14, 0x31, 0xc4, 0x39, - 0xf0, 0xcb, 0x72, 0xf3, 0x8d, 0x51, 0x4b, 0xd2, 0xde, 0x4b, 0x94, 0xe9, 0x31, 0x6b, 0x38, 0x6a, - 0x1b, 0x9d, 0x62, 0x1b, 0x9d, 0x43, 0x92, 0x79, 0xff, 0x97, 0xc6, 0x35, 0xed, 0xf5, 0x51, 0x06, - 0x3e, 0x7d, 0xdc, 0x6b, 0xe8, 0xcd, 0x0b, 0x59, 0x96, 0x08, 0xea, 0x74, 0x24, 0xc6, 0xd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 0x1c, 0x3c, 0xfa, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x75, 0x17, 0x3b, - 0xc4, 0xd8, 0x05, 0x00, 0x00, + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x4e, 0xdb, 0x48, + 0x1c, 0xc7, 0x93, 0x05, 0x02, 0x38, 0xc0, 0x6a, 0x4d, 0x76, 0x65, 0xd8, 0xdd, 0x38, 0x1d, 0x55, + 0x15, 0x95, 0xc0, 0x56, 0x68, 0x4f, 0x15, 0xaa, 0x84, 0x85, 0x5a, 0xd1, 0xaa, 0x28, 0x72, 0x8a, + 0x2a, 0xf5, 0x62, 0x4d, 0xec, 0xc1, 0x8c, 0x92, 0xcc, 0x58, 0x33, 0xe3, 0x80, 0x39, 0xf5, 0x11, + 0xfa, 0x0e, 0x7d, 0x85, 0x3e, 0x04, 0xea, 0x89, 0x63, 0xd5, 0x83, 0x55, 0xc1, 0xbd, 0x87, 0x3c, + 0x41, 0x95, 0x99, 0x31, 0x31, 0x55, 0x54, 0x89, 0x13, 0x33, 0xfc, 0xbe, 0xbf, 0xcf, 0xd7, 0xf3, + 0xfb, 0x13, 0xe3, 0x01, 0x17, 0x0c, 0x0a, 0xca, 0x5d, 0x86, 0x62, 0xcc, 0x05, 0x62, 0xee, 0xa8, + 0xed, 0xc6, 0x88, 0x20, 0x8e, 0xb9, 0x93, 0x30, 0x2a, 0xa8, 0xb9, 0xa6, 0x25, 0x0e, 0x1a, 0x0d, + 0x9d, 0x51, 0x7b, 0x73, 0x23, 0xa6, 0x34, 0x1e, 0x20, 0x57, 0x46, 0x7b, 0xe9, 0x89, 0x0b, 0x49, + 0xa6, 0xa4, 0x9b, 0x8d, 0x98, 0xc6, 0x54, 0x1e, 0xdd, 0xc9, 0x49, 0xff, 0x77, 0x23, 0xa4, 0x7c, + 0x48, 0x79, 0xa0, 0x02, 0xea,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, 0xa0, 0x70, 0x9c, + 0xdb, 0x56, 0x61, 0x28, 0x71, 0x41, 0x4a, 0x2f, 0x82, 0x64, 0x02, 0x04, 0xfe, 0xaf, 0x16, 0xe6, + 0x87, 0xaa, 0xb1, 0x2e, 0xa8, 0x80, 0x83, 0x63, 0x82, 0x39, 0x4f, 0x51, 0xd4, 0x61, 0x28, 0x81, + 0x99, 0xb5, 0x20, 0xad, 0x8f, 0xee, 0x61, 0x7d, 0x48, 0xc4, 0x38, 0xb7, 0xff, 0x53, 0xd6, 0x12, + 0x19, 0xa4, 0x9a, 0x19, 0x24, 0x12, 0x0a, 0xfc, 0x59, 0x56, 0x66, 0xd7, 0x58, 0xe2, 0x03, 0xc8, + 0x4f, 0x31, 0x89, 0xad, 0x5a, 0x6b, 0x6e, 0xab, 0xbe, 0xfb, 0xff, 0xcc, 0xc2, 0x76, 0xb5, 0xc8, + 0xb3, 0xc6, 0xb9, 0xdd, 0x50, 0x3e, 0x45, 0x62, 0x80, 0xc9, 0x09, 0x05, 0xfe, 0x2d, 0x08, 0x7c, + 0x9a, 0x37, 0xd6, 0xf5, 0xc0, 0x95, 0x1b, 0x62, 0xee, 0x19, 0x75, 0x82, 0xc4, 0x19, 0x65, 0xfd, + 0xfd, 0x28, 0x62, 0x72, 0xf8, 0x96, 0xbd, 0xcd, 0x71, 0x6e, 0xff, 0xa3, 0x80, 0x3a, 0x18, 0xc0, + 0x28, 0x62, 0x88, 0x73, 0xe0, 0x97, 0xe5, 0xe6, 0x3b, 0xa3, 0x96, 0xa4, 0xbd, 0xd7, 0x28, 0xd3, + 0x63, 0xd6, 0x70, 0xd4, 0xb6, 0x39, 0xc5, 0xb6, 0x39, 0xfb, 0x24, 0xf3, 0x1e, 0x97, 0xc6, 0x35, + 0xed, 0xf5, 0x51, 0x06, 0xbe, 0x7c, 0xde, 0x69, 0xe8, 0xcd, 0x0a, 0x59, 0x96, 0x08, 0xea, 0x74, + 0x24, 0xc6, 0xd7, 0x38, 0x73, 0xd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 0x33, 0x00, 0x00, 0xff, + 0xff, 0x35, 0xdb, 0xf5, 0x98, 0xb8, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/register/types/query.pb.go b/x/register/types/query.pb.go index c9c729fa..57a4e272 100644 --- a/x/register/types/query.pb.go +++ b/x/register/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -32,8 +31,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method type QueryResourceNodeRequest struct { - // node_addr defines the node address to query for. - NodeAddr string `protobuf:"bytes,1,opt,name=node_addr,json=nodeAddr,proto3" json:"node_addr,omitempty"` + // network_addr defines the node address to query for. + NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` } func (m *QueryResourceNodeRequest) Reset() { *m = QueryResourceNodeRequest{} } @@ -69,9 +68,9 @@ func (m *QueryResourceNodeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryResourceNodeRequest proto.InternalMessageInfo -func (m *QueryResourceNodeRequest) GetNodeAddr() string { +func (m *QueryResourceNodeRequest) GetNetworkAddr() string { if m != nil { - return m.NodeAddr + return m.NetworkAddr } return "" } @@ -124,8 +123,8 @@ func (m *QueryResourceNodeResponse) GetNode() ResourceNode { // QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method type QueryIndexingNodeRequest struct { - // node_addr defines the node address to query for. - NodeAddr string `protobuf:"bytes,1,opt,name=node_addr,json=nodeAddr,proto3" json:"node_addr,omitempty"` + // network_addr defines the node address to query for. + NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` } func (m *QueryIndexingNodeRequest) Reset() { *m = QueryIndexingNodeRequest{} } @@ -161,9 +160,9 @@ func (m *QueryIndexingNodeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryIndexingNodeRequest proto.InternalMessageInfo -func (m *QueryIndexingNodeRequest) GetNodeAddr() string { +func (m *QueryIndexingNodeRequest) GetNetworkAddr() string { if m != nil { - return m.NodeAddr + return m.NetworkAddr } return "" } @@ -214,239 +213,41 @@ func (m *QueryIndexingNodeResponse) GetNode() IndexingNode { return IndexingNode{} } -// QueryOwnerRequest is request type for the Query/Owner RPC method -type QueryOwnerRequest struct { - // owner_addr defines the owner address to query for. - OwnerAddr string `protobuf:"bytes,1,opt,name=owner_addr,json=ownerAddr,proto3" json:"owner_addr,omitempty"` -} - -func (m *QueryOwnerRequest) Reset() { *m = QueryOwnerRequest{} } -func (m *QueryOwnerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryOwnerRequest) ProtoMessage() {} -func (*QueryOwnerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_59a612d1da8c0670, []int{4} -} -func (m *QueryOwnerRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOwnerRequest.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 *QueryOwnerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOwnerRequest.Merge(m, src) -} -func (m *QueryOwnerRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryOwnerRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOwnerRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOwnerRequest proto.InternalMessageInfo - -func (m *QueryOwnerRequest) GetOwnerAddr() string { - if m != nil { - return m.OwnerAddr - } - return "" -} - -// QueryOwnerResponse is response type for the Query/Owner RPC method -type QueryOwnerResponse struct { - // owner defines the the owner info. - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryOwnerResponse) Reset() { *m = QueryOwnerResponse{} } -func (m *QueryOwnerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryOwnerResponse) ProtoMessage() {} -func (*QueryOwnerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_59a612d1da8c0670, []int{5} -} -func (m *QueryOwnerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOwnerResponse.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 *QueryOwnerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOwnerResponse.Merge(m, src) -} -func (m *QueryOwnerResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryOwnerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOwnerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOwnerResponse proto.InternalMessageInfo - -func (m *QueryOwnerResponse) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *QueryOwnerResponse) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_59a612d1da8c0670, []int{6} -} -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_59a612d1da8c0670, []int{7} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func init() { proto.RegisterType((*QueryResourceNodeRequest)(nil), "stratos.register.v1.QueryResourceNodeRequest") proto.RegisterType((*QueryResourceNodeResponse)(nil), "stratos.register.v1.QueryResourceNodeResponse") proto.RegisterType((*QueryIndexingNodeRequest)(nil), "stratos.register.v1.QueryIndexingNodeRequest") proto.RegisterType((*QueryIndexingNodeResponse)(nil), "stratos.register.v1.QueryIndexingNodeResponse") - proto.RegisterType((*QueryOwnerRequest)(nil), "stratos.register.v1.QueryOwnerRequest") - proto.RegisterType((*QueryOwnerResponse)(nil), "stratos.register.v1.QueryOwnerResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "stratos.register.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "stratos.register.v1.QueryParamsResponse") } func init() { proto.RegisterFile("stratos/register/v1/query.proto", fileDescriptor_59a612d1da8c0670) } var fileDescriptor_59a612d1da8c0670 = []byte{ - // 532 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0xe3, 0xd2, 0x54, 0xe4, 0x60, 0xe1, 0xda, 0x21, 0xb8, 0xe0, 0x82, 0x87, 0x16, 0x90, - 0x72, 0x27, 0x07, 0xa4, 0x0a, 0x31, 0xd1, 0x01, 0x89, 0xa5, 0x04, 0x4f, 0x88, 0x05, 0x5d, 0xe2, - 0x93, 0x6b, 0x89, 0xdc, 0xb9, 0x77, 0x97, 0x90, 0xaa, 0xea, 0xc2, 0xc6, 0x86, 0xc4, 0x77, 0xe0, - 0xb3, 0x74, 0xac, 0xc4, 0xc2, 0x84, 0x50, 0x02, 0xdf, 0x03, 0xf9, 0xf9, 0x9c, 0x38, 0xd2, 0xb5, - 0x25, 0xdb, 0xe5, 0xe5, 0xff, 0x7f, 0xef, 0x97, 0xf7, 0xfe, 0x0a, 0xda, 0xd1, 0x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, 0x45, 0xb2, 0xcf, 0x0e, 0x0e, - 0xcf, 0xa7, 0x81, 0x77, 0x31, 0x0d, 0xbc, 0xdf, 0xd3, 0xc0, 0xfb, 0x3a, 0x0b, 0x1a, 0x17, 0xb3, - 0xa0, 0xf1, 0x73, 0x16, 0x34, 0xde, 0x3f, 0x4b, 0x33, 0x73, 0x34, 0xea, 0x93, 0x81, 0x1c, 0x56, - 0xcd, 0x04, 0x37, 0xd5, 0xb3, 0x33, 0x38, 0x62, 0x99, 0xa0, 0x93, 0x45, 0x7f, 0x73, 0x92, 0x73, - 0xdd, 0xdf, 0x80, 0xbf, 0x9e, 0xa7, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xc0, 0x5b, 0x13, - 0x36, 0x05, 0x00, 0x00, + // 374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcf, 0x4e, 0xea, 0x40, + 0x14, 0x87, 0x5b, 0xc2, 0xbd, 0xc9, 0x2d, 0xac, 0x7a, 0xef, 0x82, 0x4b, 0x4c, 0x91, 0xae, 0xdc, + 0xd0, 0x09, 0xc8, 0x4a, 0xe3, 0x42, 0x76, 0x6e, 0x48, 0xec, 0xca, 0xb8, 0x31, 0x85, 0x9e, 0x94, + 0x89, 0x3a, 0xa7, 0xcc, 0x4c, 0x11, 0x62, 0xdc, 0xf8, 0x04, 0x26, 0x3e, 0x85, 0x6f, 0xc2, 0x92, + 0xc4, 0x8d, 0x2b, 0x35, 0xe0, 0x83, 0x18, 0x86, 0x82, 0x35, 0x19, 0xf1, 0xcf, 0x6e, 0xd2, 0xf9, + 0x7d, 0xe7, 0x7c, 0xe7, 0x74, 0xac, 0x8a, 0x90, 0x3c, 0x90, 0x28, 0x08, 0x87, 0x88, 0x0a, 0x09, + 0x9c, 0x0c, 0xea, 0xa4, 0x9f, 0x00, 0x1f, 0x79, 0x31, 0x47, 0x89, 0x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 0xec, 0x48, 0xeb, 0x5c, 0x35, 0x2b, 0x5f, 0xe7, 0xaa, 0x5b, 0xf1, 0x27, 0xae, 0x34, + 0x45, 0xb4, 0xae, 0xad, 0xf6, 0x78, 0xea, 0x98, 0x93, 0xa9, 0x63, 0x3e, 0x4f, 0x1d, 0xf3, 0x66, + 0xe6, 0x18, 0x93, 0x99, 0x63, 0x3c, 0xcc, 0x1c, 0xe3, 0xb8, 0x19, 0x51, 0xd9, 0x4b, 0x3a, 0x5e, + 0x17, 0xcf, 0x97, 0x75, 0x19, 0xc8, 0xe5, 0xb1, 0xd6, 0xed, 0x05, 0x94, 0x91, 0xe1, 0x5b, 0x2b, + 0x39, 0x8a, 0x41, 0x74, 0x7e, 0xab, 0xa7, 0xbe, 0xfd, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x86, 0x3c, + 0x3f, 0x3a, 0x7a, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -465,8 +266,6 @@ type QueryClient interface { ResourceNode(ctx context.Context, in *QueryResourceNodeRequest, opts ...grpc.CallOption) (*QueryResourceNodeResponse, error) // IndexingNode queries IndexingNode info for given IndexingNode address. IndexingNode(ctx context.Context, in *QueryIndexingNodeRequest, opts ...grpc.CallOption) (*QueryIndexingNodeResponse, error) - // Owner queries all staking info for given Owner address. - Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) } type queryClient struct { @@ -495,23 +294,12 @@ func (c *queryClient) IndexingNode(ctx context.Context, in *QueryIndexingNodeReq return out, nil } -func (c *queryClient) Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) { - out := new(QueryOwnerResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/Owner", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. type QueryServer interface { // ResourceNode queries ResourceNode info for given ResourceNode address. ResourceNode(context.Context, *QueryResourceNodeRequest) (*QueryResourceNodeResponse, error) // IndexingNode queries IndexingNode info for given IndexingNode address. IndexingNode(context.Context, *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) - // Owner queries all staking info for given Owner address. - Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -524,9 +312,6 @@ func (*UnimplementedQueryServer) ResourceNode(ctx context.Context, req *QueryRes func (*UnimplementedQueryServer) IndexingNode(ctx context.Context, req *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method IndexingNode not implemented") } -func (*UnimplementedQueryServer) Owner(ctx context.Context, req *QueryOwnerRequest) (*QueryOwnerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Owner not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -568,24 +353,6 @@ func _Query_IndexingNode_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Query_Owner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOwnerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Owner(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/stratos.register.v1.Query/Owner", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Owner(ctx, req.(*QueryOwnerRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "stratos.register.v1.Query", HandlerType: (*QueryServer)(nil), @@ -598,10 +365,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "IndexingNode", Handler: _Query_IndexingNode_Handler, }, - { - MethodName: "Owner", - Handler: _Query_Owner_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "stratos/register/v1/query.proto", @@ -627,10 +390,10 @@ func (m *QueryResourceNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if len(m.NodeAddr) > 0 { - i -= len(m.NodeAddr) - copy(dAtA[i:], m.NodeAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NodeAddr))) + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NetworkAddr))) i-- dAtA[i] = 0xa } @@ -690,10 +453,10 @@ func (m *QueryIndexingNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if len(m.NodeAddr) > 0 { - i -= len(m.NodeAddr) - copy(dAtA[i:], m.NodeAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NodeAddr))) + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NetworkAddr))) i-- dAtA[i] = 0xa } @@ -733,134 +496,6 @@ func (m *QueryIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryOwnerRequest) 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 *QueryOwnerRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OwnerAddr) > 0 { - i -= len(m.OwnerAddr) - copy(dAtA[i:], m.OwnerAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryOwnerResponse) 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 *QueryOwnerResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOwnerResponse) 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.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -878,7 +513,7 @@ func (m *QueryResourceNodeRequest) Size() (n int) { } var l int _ = l - l = len(m.NodeAddr) + l = len(m.NetworkAddr) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -902,7 +537,7 @@ func (m *QueryIndexingNodeRequest) Size() (n int) { } var l int _ = l - l = len(m.NodeAddr) + l = len(m.NetworkAddr) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -920,61 +555,11 @@ func (m *QueryIndexingNodeResponse) Size() (n int) { return n } -func (m *QueryOwnerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.OwnerAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } - -func (m *QueryOwnerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *QueryResourceNodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -1007,7 +592,7 @@ func (m *QueryResourceNodeRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1035,7 +620,7 @@ func (m *QueryResourceNodeRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NodeAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1172,7 +757,7 @@ func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1200,7 +785,7 @@ func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NodeAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1306,339 +891,6 @@ func (m *QueryIndexingNodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryOwnerRequest) 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: QueryOwnerRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddr", 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.OwnerAddr = 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 *QueryOwnerResponse) 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: QueryOwnerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = string(dAtA[iNdEx:postIndex]) - 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.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 *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/register/types/query.pb.gw.go b/x/register/types/query.pb.gw.go index 7c44e0c6..a6ce942c 100644 --- a/x/register/types/query.pb.gw.go +++ b/x/register/types/query.pb.gw.go @@ -42,15 +42,15 @@ func request_Query_ResourceNode_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["node_addr"] + val, ok = pathParams["network_addr"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "network_addr") } - protoReq.NodeAddr, err = runtime.String(val) + protoReq.NetworkAddr, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "network_addr", err) } msg, err := client.ResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -69,15 +69,15 @@ func local_request_Query_ResourceNode_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["node_addr"] + val, ok = pathParams["network_addr"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "network_addr") } - protoReq.NodeAddr, err = runtime.String(val) + protoReq.NetworkAddr, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "network_addr", err) } msg, err := server.ResourceNode(ctx, &protoReq) @@ -96,15 +96,15 @@ func request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["node_addr"] + val, ok = pathParams["network_addr"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "network_addr") } - protoReq.NodeAddr, err = runtime.String(val) + protoReq.NetworkAddr, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "network_addr", err) } msg, err := client.IndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -123,15 +123,15 @@ func local_request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["node_addr"] + val, ok = pathParams["network_addr"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "node_addr") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "network_addr") } - protoReq.NodeAddr, err = runtime.String(val) + protoReq.NetworkAddr, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "node_addr", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "network_addr", err) } msg, err := server.IndexingNode(ctx, &protoReq) @@ -139,60 +139,6 @@ func local_request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.M } -func request_Query_Owner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOwnerRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["owner_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_addr") - } - - protoReq.OwnerAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_addr", err) - } - - msg, err := client.Owner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Owner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOwnerRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["owner_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_addr") - } - - protoReq.OwnerAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_addr", err) - } - - msg, err := server.Owner(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. @@ -239,26 +185,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_Owner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Owner_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Owner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -340,41 +266,17 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_Owner_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_Owner_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_Owner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } var ( - pattern_Query_ResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "resource-nodes", "node_addr"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_ResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "resource-nodes", "network_addr"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_IndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "indexing-nodes", "node_addr"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_Owner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "owner", "owner_addr"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_IndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "indexing-nodes", "network_addr"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Query_ResourceNode_0 = runtime.ForwardResponseMessage forward_Query_IndexingNode_0 = runtime.ForwardResponseMessage - - forward_Query_Owner_0 = runtime.ForwardResponseMessage ) diff --git a/x/register/types/tx.pb.go b/x/register/types/tx.pb.go index 638b8c24..6dd06ce1 100644 --- a/x/register/types/tx.pb.go +++ b/x/register/types/tx.pb.go @@ -836,81 +836,82 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/tx.proto", fileDescriptor_75d4b90d7a185a31) } var fileDescriptor_75d4b90d7a185a31 = []byte{ - // 1182 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0x8e, 0xfb, 0x8b, 0xee, 0xb4, 0xbb, 0xb0, 0x6e, 0xba, 0x9b, 0x46, 0x25, 0xae, 0x46, 0x2b, - 0xb1, 0x85, 0xad, 0x4d, 0xba, 0x15, 0x2b, 0xad, 0xca, 0xa1, 0xe9, 0x72, 0x40, 0xa8, 0x2d, 0x98, - 0x02, 0x52, 0x0f, 0x04, 0xc7, 0x1e, 0xb2, 0x56, 0x1b, 0x8f, 0x35, 0x9e, 0x64, 0x9b, 0x2b, 0x12, - 0x12, 0x47, 0x24, 0xfe, 0x81, 0xbd, 0x71, 0xe1, 0x84, 0x10, 0x5c, 0xe0, 0xbe, 0xe2, 0x54, 0x01, - 0x07, 0x4e, 0x16, 0x6a, 0x39, 0x20, 0x8e, 0xfe, 0x0b, 0x90, 0xc7, 0x13, 0x67, 0x9c, 0x4c, 0x12, - 0xb7, 0x88, 0x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f8, 0x14, 0xc4, - 0x9b, 0x99, 0x45, 0x26, 0x88, 0x57, 0xf4, 0x9d, 0x24, 0x5e, 0xe9, 0xe5, 0x9e, 0x4b, 0xbc, 0x99, - 0xd9, 0x58, 0x10, 0x6f, 0x3e, 0xa4, 0x97, 0x17, 0xef, 0x15, 0x90, 0x72, 0xf1, 0x0e, 0x23, 0x95, - 0xcc, 0x77, 0x13, 0xc4, 0x9b, 0x8f, 0xd3, 0x31, 0x03, 0x53, 0x2e, 0xf1, 0x66, 0x91, 0xf6, 0xc5, - 0x3b, 0x3c, 0x05, 0x18, 0xf9, 0x21, 0xe4, 0x12, 0xef, 0xe8, 0x3b, 0x33, 0x97, 0x78, 0xb3, 0x1f, - 0x4a, 0x89, 0x78, 0xcf, 0x14, 0xb0, 0x3a, 0xf6, 0xa6, 0xdd, 0x1a, 0x05, 0x69, 0x5c, 0x54, 0x79, - 0xfb, 0x2a, 0x51, 0x69, 0x35, 0xdb, 0xac, 0x9a, 0x37, 0xe0, 0x96, 0xb4, 0x9a, 0x6c, 0x19, 0x44, - 0x48, 0x52, 0x8f, 0xaf, 0xa5, 0xda, 0xfe, 0xb3, 0xf3, 0x8a, 0x72, 0x76, 0x5e, 0x51, 0xfe, 0x38, - 0xaf, 0x28, 0x5f, 0x5e, 0x54, 0x0a, 0x67, 0x17, 0x95, 0xc2, 0xef, 0x17, 0x95, 0xc2, 0xd1, 0x56, - 0xd3, 0xa5, 0x8f, 0xdb, 0x0d, 0xdd, 0xc6, 0xad, 0x5e, 0x66, 0x0f, 0xd1, 0xde, 0xcf, 0x0d, 0xfb, - 0xb1, 0xe5, 0x7a, 0xc6, 0x69, 0x7f, 0xb1, 0xf8, 0x1b, 0x25, 0x68, 0xcc, 0xb1, 0xbf, 0x32, 0xee, - 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xaf, 0x5d, 0x71, 0x2f, 0x14, 0x00, 0x00, + // 1198 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b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x47, 0xf7, 0xe6, 0x38, 0x6c, 0x79, 0x59, 0xd5, 0xad, + 0xcb, 0x64, 0x25, 0xb4, 0xb6, 0x28, 0xad, 0x57, 0xe1, 0xa6, 0x90, 0x56, 0x9a, 0x8f, 0xc7, 0x15, + 0x69, 0x45, 0xe7, 0x5c, 0x73, 0xef, 0xf1, 0x69, 0x4d, 0x7a, 0x72, 0x5a, 0x93, 0x7e, 0x3f, 0xad, + 0x49, 0x9f, 0x9f, 0xd5, 0x4a, 0x4f, 0xce, 0x6a, 0xa5, 0x5f, 0xcf, 0x6a, 0xa5, 0xc3, 0xcd, 0x8e, + 0x4d, 0x1e, 0xf4, 0xda, 0xaa, 0x89, 0xbb, 0xc3, 0xca, 0x0e, 0x22, 0xc3, 0x9f, 0xeb, 0xe6, 0x03, + 0xc3, 0x76, 0xb4, 0x93, 0xf3, 0xc9, 0xa2, 0x8f, 0x1e, 0xbf, 0x3d, 0x47, 0xff, 0x1b, 0xb9, 0xf3, + 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x04, 0xb5, 0x64, 0x80, 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -926,15 +927,15 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { // CreateResourceNode defines a method for creating a new resource node. - CreateResourceNode(ctx context.Context, in *MsgCreateResourceNode, opts ...grpc.CallOption) (*MsgCreateResourceNodeResponse, error) - RemoveResourceNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveResourceNodeResponse, error) - UpdateResourceNode(ctx context.Context, in *MsgUpdateResourceNode, opts ...grpc.CallOption) (*MsgUpdateResourceNodeResponse, error) - UpdateResourceNodeStake(ctx context.Context, in *MsgUpdateResourceNodeStake, opts ...grpc.CallOption) (*MsgUpdateResourceNodeStakeResponse, error) - CreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) - RemoveIndexingNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) - UpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) - UpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) - IndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) + HandleMsgCreateResourceNode(ctx context.Context, in *MsgCreateResourceNode, opts ...grpc.CallOption) (*MsgCreateResourceNodeResponse, error) + HandleMsgRemoveResourceNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveResourceNodeResponse, error) + HandleMsgUpdateResourceNode(ctx context.Context, in *MsgUpdateResourceNode, opts ...grpc.CallOption) (*MsgUpdateResourceNodeResponse, error) + HandleMsgUpdateResourceNodeStake(ctx context.Context, in *MsgUpdateResourceNodeStake, opts ...grpc.CallOption) (*MsgUpdateResourceNodeStakeResponse, error) + HandleMsgCreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) + HandleMsgRemoveIndexingNode(ctx context.Context, in *MsgRemoveIndexingNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) + HandleMsgUpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) + HandleMsgUpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) + HandleMsgIndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) } type msgClient struct { @@ -945,81 +946,81 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) CreateResourceNode(ctx context.Context, in *MsgCreateResourceNode, opts ...grpc.CallOption) (*MsgCreateResourceNodeResponse, error) { +func (c *msgClient) HandleMsgCreateResourceNode(ctx context.Context, in *MsgCreateResourceNode, opts ...grpc.CallOption) (*MsgCreateResourceNodeResponse, error) { out := new(MsgCreateResourceNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/CreateResourceNode", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgCreateResourceNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) RemoveResourceNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveResourceNodeResponse, error) { +func (c *msgClient) HandleMsgRemoveResourceNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveResourceNodeResponse, error) { out := new(MsgRemoveResourceNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/RemoveResourceNode", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgRemoveResourceNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) UpdateResourceNode(ctx context.Context, in *MsgUpdateResourceNode, opts ...grpc.CallOption) (*MsgUpdateResourceNodeResponse, error) { +func (c *msgClient) HandleMsgUpdateResourceNode(ctx context.Context, in *MsgUpdateResourceNode, opts ...grpc.CallOption) (*MsgUpdateResourceNodeResponse, error) { out := new(MsgUpdateResourceNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateResourceNode", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateResourceNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) UpdateResourceNodeStake(ctx context.Context, in *MsgUpdateResourceNodeStake, opts ...grpc.CallOption) (*MsgUpdateResourceNodeStakeResponse, error) { +func (c *msgClient) HandleMsgUpdateResourceNodeStake(ctx context.Context, in *MsgUpdateResourceNodeStake, opts ...grpc.CallOption) (*MsgUpdateResourceNodeStakeResponse, error) { out := new(MsgUpdateResourceNodeStakeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateResourceNodeStake", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateResourceNodeStake", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) CreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) { +func (c *msgClient) HandleMsgCreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) { out := new(MsgCreateIndexingNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/CreateIndexingNode", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgCreateIndexingNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) RemoveIndexingNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) { +func (c *msgClient) HandleMsgRemoveIndexingNode(ctx context.Context, in *MsgRemoveIndexingNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) { out := new(MsgRemoveIndexingNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/RemoveIndexingNode", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgRemoveIndexingNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) UpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) { +func (c *msgClient) HandleMsgUpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) { out := new(MsgUpdateIndexingNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateIndexingNode", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) UpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) { +func (c *msgClient) HandleMsgUpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) { out := new(MsgUpdateIndexingNodeStakeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/UpdateIndexingNodeStake", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNodeStake", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) IndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) { +func (c *msgClient) HandleMsgIndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) { out := new(MsgIndexingNodeRegistrationVoteResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/IndexingNodeRegistrationVote", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgIndexingNodeRegistrationVote", in, out, opts...) if err != nil { return nil, err } @@ -1029,211 +1030,211 @@ func (c *msgClient) IndexingNodeRegistrationVote(ctx context.Context, in *MsgInd // MsgServer is the server API for Msg service. type MsgServer interface { // CreateResourceNode defines a method for creating a new resource node. - CreateResourceNode(context.Context, *MsgCreateResourceNode) (*MsgCreateResourceNodeResponse, error) - RemoveResourceNode(context.Context, *MsgRemoveResourceNode) (*MsgRemoveResourceNodeResponse, error) - UpdateResourceNode(context.Context, *MsgUpdateResourceNode) (*MsgUpdateResourceNodeResponse, error) - UpdateResourceNodeStake(context.Context, *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) - CreateIndexingNode(context.Context, *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) - RemoveIndexingNode(context.Context, *MsgRemoveResourceNode) (*MsgRemoveIndexingNodeResponse, error) - UpdateIndexingNode(context.Context, *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) - UpdateIndexingNodeStake(context.Context, *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) - IndexingNodeRegistrationVote(context.Context, *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) + HandleMsgCreateResourceNode(context.Context, *MsgCreateResourceNode) (*MsgCreateResourceNodeResponse, error) + HandleMsgRemoveResourceNode(context.Context, *MsgRemoveResourceNode) (*MsgRemoveResourceNodeResponse, error) + HandleMsgUpdateResourceNode(context.Context, *MsgUpdateResourceNode) (*MsgUpdateResourceNodeResponse, error) + HandleMsgUpdateResourceNodeStake(context.Context, *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) + HandleMsgCreateIndexingNode(context.Context, *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) + HandleMsgRemoveIndexingNode(context.Context, *MsgRemoveIndexingNode) (*MsgRemoveIndexingNodeResponse, error) + HandleMsgUpdateIndexingNode(context.Context, *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) + HandleMsgUpdateIndexingNodeStake(context.Context, *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) + HandleMsgIndexingNodeRegistrationVote(context.Context, *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) CreateResourceNode(ctx context.Context, req *MsgCreateResourceNode) (*MsgCreateResourceNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateResourceNode not implemented") +func (*UnimplementedMsgServer) HandleMsgCreateResourceNode(ctx context.Context, req *MsgCreateResourceNode) (*MsgCreateResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgCreateResourceNode not implemented") } -func (*UnimplementedMsgServer) RemoveResourceNode(ctx context.Context, req *MsgRemoveResourceNode) (*MsgRemoveResourceNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveResourceNode not implemented") +func (*UnimplementedMsgServer) HandleMsgRemoveResourceNode(ctx context.Context, req *MsgRemoveResourceNode) (*MsgRemoveResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgRemoveResourceNode not implemented") } -func (*UnimplementedMsgServer) UpdateResourceNode(ctx context.Context, req *MsgUpdateResourceNode) (*MsgUpdateResourceNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateResourceNode not implemented") +func (*UnimplementedMsgServer) HandleMsgUpdateResourceNode(ctx context.Context, req *MsgUpdateResourceNode) (*MsgUpdateResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateResourceNode not implemented") } -func (*UnimplementedMsgServer) UpdateResourceNodeStake(ctx context.Context, req *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateResourceNodeStake not implemented") +func (*UnimplementedMsgServer) HandleMsgUpdateResourceNodeStake(ctx context.Context, req *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateResourceNodeStake not implemented") } -func (*UnimplementedMsgServer) CreateIndexingNode(ctx context.Context, req *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateIndexingNode not implemented") +func (*UnimplementedMsgServer) HandleMsgCreateIndexingNode(ctx context.Context, req *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgCreateIndexingNode not implemented") } -func (*UnimplementedMsgServer) RemoveIndexingNode(ctx context.Context, req *MsgRemoveResourceNode) (*MsgRemoveIndexingNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveIndexingNode not implemented") +func (*UnimplementedMsgServer) HandleMsgRemoveIndexingNode(ctx context.Context, req *MsgRemoveIndexingNode) (*MsgRemoveIndexingNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgRemoveIndexingNode not implemented") } -func (*UnimplementedMsgServer) UpdateIndexingNode(ctx context.Context, req *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateIndexingNode not implemented") +func (*UnimplementedMsgServer) HandleMsgUpdateIndexingNode(ctx context.Context, req *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateIndexingNode not implemented") } -func (*UnimplementedMsgServer) UpdateIndexingNodeStake(ctx context.Context, req *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateIndexingNodeStake not implemented") +func (*UnimplementedMsgServer) HandleMsgUpdateIndexingNodeStake(ctx context.Context, req *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateIndexingNodeStake not implemented") } -func (*UnimplementedMsgServer) IndexingNodeRegistrationVote(ctx context.Context, req *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method IndexingNodeRegistrationVote not implemented") +func (*UnimplementedMsgServer) HandleMsgIndexingNodeRegistrationVote(ctx context.Context, req *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgIndexingNodeRegistrationVote not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_CreateResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgCreateResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgCreateResourceNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).CreateResourceNode(ctx, in) + return srv.(MsgServer).HandleMsgCreateResourceNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/CreateResourceNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgCreateResourceNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateResourceNode(ctx, req.(*MsgCreateResourceNode)) + return srv.(MsgServer).HandleMsgCreateResourceNode(ctx, req.(*MsgCreateResourceNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_RemoveResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgRemoveResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgRemoveResourceNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).RemoveResourceNode(ctx, in) + return srv.(MsgServer).HandleMsgRemoveResourceNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/RemoveResourceNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgRemoveResourceNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveResourceNode(ctx, req.(*MsgRemoveResourceNode)) + return srv.(MsgServer).HandleMsgRemoveResourceNode(ctx, req.(*MsgRemoveResourceNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgUpdateResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateResourceNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateResourceNode(ctx, in) + return srv.(MsgServer).HandleMsgUpdateResourceNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/UpdateResourceNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateResourceNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateResourceNode(ctx, req.(*MsgUpdateResourceNode)) + return srv.(MsgServer).HandleMsgUpdateResourceNode(ctx, req.(*MsgUpdateResourceNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateResourceNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgUpdateResourceNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateResourceNodeStake) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateResourceNodeStake(ctx, in) + return srv.(MsgServer).HandleMsgUpdateResourceNodeStake(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/UpdateResourceNodeStake", + FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateResourceNodeStake", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateResourceNodeStake(ctx, req.(*MsgUpdateResourceNodeStake)) + return srv.(MsgServer).HandleMsgUpdateResourceNodeStake(ctx, req.(*MsgUpdateResourceNodeStake)) } return interceptor(ctx, in, info, handler) } -func _Msg_CreateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgCreateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgCreateIndexingNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).CreateIndexingNode(ctx, in) + return srv.(MsgServer).HandleMsgCreateIndexingNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/CreateIndexingNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgCreateIndexingNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateIndexingNode(ctx, req.(*MsgCreateIndexingNode)) + return srv.(MsgServer).HandleMsgCreateIndexingNode(ctx, req.(*MsgCreateIndexingNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_RemoveIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveResourceNode) +func _Msg_HandleMsgRemoveIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveIndexingNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).RemoveIndexingNode(ctx, in) + return srv.(MsgServer).HandleMsgRemoveIndexingNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/RemoveIndexingNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgRemoveIndexingNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveIndexingNode(ctx, req.(*MsgRemoveResourceNode)) + return srv.(MsgServer).HandleMsgRemoveIndexingNode(ctx, req.(*MsgRemoveIndexingNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgUpdateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateIndexingNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateIndexingNode(ctx, in) + return srv.(MsgServer).HandleMsgUpdateIndexingNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/UpdateIndexingNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateIndexingNode(ctx, req.(*MsgUpdateIndexingNode)) + return srv.(MsgServer).HandleMsgUpdateIndexingNode(ctx, req.(*MsgUpdateIndexingNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateIndexingNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgUpdateIndexingNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateIndexingNodeStake) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateIndexingNodeStake(ctx, in) + return srv.(MsgServer).HandleMsgUpdateIndexingNodeStake(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/UpdateIndexingNodeStake", + FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNodeStake", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateIndexingNodeStake(ctx, req.(*MsgUpdateIndexingNodeStake)) + return srv.(MsgServer).HandleMsgUpdateIndexingNodeStake(ctx, req.(*MsgUpdateIndexingNodeStake)) } return interceptor(ctx, in, info, handler) } -func _Msg_IndexingNodeRegistrationVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_HandleMsgIndexingNodeRegistrationVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgIndexingNodeRegistrationVote) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).IndexingNodeRegistrationVote(ctx, in) + return srv.(MsgServer).HandleMsgIndexingNodeRegistrationVote(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/IndexingNodeRegistrationVote", + FullMethod: "/stratos.register.v1.Msg/HandleMsgIndexingNodeRegistrationVote", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).IndexingNodeRegistrationVote(ctx, req.(*MsgIndexingNodeRegistrationVote)) + return srv.(MsgServer).HandleMsgIndexingNodeRegistrationVote(ctx, req.(*MsgIndexingNodeRegistrationVote)) } return interceptor(ctx, in, info, handler) } @@ -1243,40 +1244,40 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "CreateResourceNode", - Handler: _Msg_CreateResourceNode_Handler, + MethodName: "HandleMsgCreateResourceNode", + Handler: _Msg_HandleMsgCreateResourceNode_Handler, }, { - MethodName: "RemoveResourceNode", - Handler: _Msg_RemoveResourceNode_Handler, + MethodName: "HandleMsgRemoveResourceNode", + Handler: _Msg_HandleMsgRemoveResourceNode_Handler, }, { - MethodName: "UpdateResourceNode", - Handler: _Msg_UpdateResourceNode_Handler, + MethodName: "HandleMsgUpdateResourceNode", + Handler: _Msg_HandleMsgUpdateResourceNode_Handler, }, { - MethodName: "UpdateResourceNodeStake", - Handler: _Msg_UpdateResourceNodeStake_Handler, + MethodName: "HandleMsgUpdateResourceNodeStake", + Handler: _Msg_HandleMsgUpdateResourceNodeStake_Handler, }, { - MethodName: "CreateIndexingNode", - Handler: _Msg_CreateIndexingNode_Handler, + MethodName: "HandleMsgCreateIndexingNode", + Handler: _Msg_HandleMsgCreateIndexingNode_Handler, }, { - MethodName: "RemoveIndexingNode", - Handler: _Msg_RemoveIndexingNode_Handler, + MethodName: "HandleMsgRemoveIndexingNode", + Handler: _Msg_HandleMsgRemoveIndexingNode_Handler, }, { - MethodName: "UpdateIndexingNode", - Handler: _Msg_UpdateIndexingNode_Handler, + MethodName: "HandleMsgUpdateIndexingNode", + Handler: _Msg_HandleMsgUpdateIndexingNode_Handler, }, { - MethodName: "UpdateIndexingNodeStake", - Handler: _Msg_UpdateIndexingNodeStake_Handler, + MethodName: "HandleMsgUpdateIndexingNodeStake", + Handler: _Msg_HandleMsgUpdateIndexingNodeStake_Handler, }, { - MethodName: "IndexingNodeRegistrationVote", - Handler: _Msg_IndexingNodeRegistrationVote_Handler, + MethodName: "HandleMsgIndexingNodeRegistrationVote", + Handler: _Msg_HandleMsgIndexingNodeRegistrationVote_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/x/register/types/tx.pb.gw.go b/x/register/types/tx.pb.gw.go index 7d6e9039..8f78dbfa 100644 --- a/x/register/types/tx.pb.gw.go +++ b/x/register/types/tx.pb.gw.go @@ -32,325 +32,325 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var ( - filter_Msg_CreateResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgCreateResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_CreateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgCreateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgCreateResourceNode 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_Msg_CreateResourceNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgCreateResourceNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.CreateResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgCreateResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_CreateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgCreateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgCreateResourceNode 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_Msg_CreateResourceNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgCreateResourceNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.CreateResourceNode(ctx, &protoReq) + msg, err := server.HandleMsgCreateResourceNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_RemoveResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgRemoveResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_RemoveResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgRemoveResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgRemoveResourceNode 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_Msg_RemoveResourceNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgRemoveResourceNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.RemoveResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgRemoveResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_RemoveResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgRemoveResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgRemoveResourceNode 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_Msg_RemoveResourceNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgRemoveResourceNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.RemoveResourceNode(ctx, &protoReq) + msg, err := server.HandleMsgRemoveResourceNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_UpdateResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgUpdateResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_UpdateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgUpdateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateResourceNode 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_Msg_UpdateResourceNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateResourceNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.UpdateResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgUpdateResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_UpdateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgUpdateResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateResourceNode 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_Msg_UpdateResourceNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateResourceNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.UpdateResourceNode(ctx, &protoReq) + msg, err := server.HandleMsgUpdateResourceNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_UpdateResourceNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgUpdateResourceNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_UpdateResourceNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgUpdateResourceNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateResourceNodeStake 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_Msg_UpdateResourceNodeStake_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateResourceNodeStake_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.UpdateResourceNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgUpdateResourceNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_UpdateResourceNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgUpdateResourceNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateResourceNodeStake 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_Msg_UpdateResourceNodeStake_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateResourceNodeStake_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.UpdateResourceNodeStake(ctx, &protoReq) + msg, err := server.HandleMsgUpdateResourceNodeStake(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_CreateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgCreateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_CreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgCreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgCreateIndexingNode 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_Msg_CreateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgCreateIndexingNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.CreateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgCreateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_CreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgCreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgCreateIndexingNode 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_Msg_CreateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgCreateIndexingNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.CreateIndexingNode(ctx, &protoReq) + msg, err := server.HandleMsgCreateIndexingNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_RemoveIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgRemoveIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_RemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgRemoveResourceNode +func request_Msg_HandleMsgRemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveIndexingNode 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_Msg_RemoveIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgRemoveIndexingNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.RemoveIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgRemoveIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_RemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgRemoveResourceNode +func local_request_Msg_HandleMsgRemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveIndexingNode 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_Msg_RemoveIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgRemoveIndexingNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.RemoveIndexingNode(ctx, &protoReq) + msg, err := server.HandleMsgRemoveIndexingNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_UpdateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgUpdateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_UpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgUpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateIndexingNode 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_Msg_UpdateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateIndexingNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.UpdateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgUpdateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_UpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgUpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateIndexingNode 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_Msg_UpdateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateIndexingNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.UpdateIndexingNode(ctx, &protoReq) + msg, err := server.HandleMsgUpdateIndexingNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_UpdateIndexingNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgUpdateIndexingNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_UpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateIndexingNodeStake 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_Msg_UpdateIndexingNodeStake_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateIndexingNodeStake_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.UpdateIndexingNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgUpdateIndexingNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_UpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateIndexingNodeStake 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_Msg_UpdateIndexingNodeStake_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateIndexingNodeStake_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.UpdateIndexingNodeStake(ctx, &protoReq) + msg, err := server.HandleMsgUpdateIndexingNodeStake(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_IndexingNodeRegistrationVote_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgIndexingNodeRegistrationVote_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_IndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgIndexingNodeRegistrationVote 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_Msg_IndexingNodeRegistrationVote_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgIndexingNodeRegistrationVote_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.IndexingNodeRegistrationVote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgIndexingNodeRegistrationVote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_IndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgIndexingNodeRegistrationVote 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_Msg_IndexingNodeRegistrationVote_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgIndexingNodeRegistrationVote_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.IndexingNodeRegistrationVote(ctx, &protoReq) + msg, err := server.HandleMsgIndexingNodeRegistrationVote(ctx, &protoReq) return msg, metadata, err } @@ -361,7 +361,7 @@ func local_request_Msg_IndexingNodeRegistrationVote_0(ctx context.Context, marsh // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_CreateResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgCreateResourceNode_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) @@ -370,18 +370,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_CreateResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgCreateResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_CreateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgCreateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_RemoveResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgRemoveResourceNode_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) @@ -390,18 +390,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_RemoveResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgRemoveResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_RemoveResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgRemoveResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateResourceNode_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) @@ -410,18 +410,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_UpdateResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgUpdateResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateResourceNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateResourceNodeStake_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) @@ -430,18 +430,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_UpdateResourceNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgUpdateResourceNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateResourceNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateResourceNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_CreateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgCreateIndexingNode_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) @@ -450,18 +450,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_CreateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgCreateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_CreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgCreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_RemoveIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgRemoveIndexingNode_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) @@ -470,18 +470,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_RemoveIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgRemoveIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_RemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgRemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNode_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) @@ -490,18 +490,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_UpdateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgUpdateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateIndexingNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNodeStake_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) @@ -510,18 +510,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_UpdateIndexingNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgUpdateIndexingNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_IndexingNodeRegistrationVote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgIndexingNodeRegistrationVote_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) @@ -530,14 +530,14 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_IndexingNodeRegistrationVote_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgIndexingNodeRegistrationVote_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_IndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -582,7 +582,7 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_CreateResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgCreateResourceNode_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) @@ -591,18 +591,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_CreateResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgCreateResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_CreateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgCreateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_RemoveResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgRemoveResourceNode_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) @@ -611,18 +611,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_RemoveResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgRemoveResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_RemoveResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgRemoveResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateResourceNode_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) @@ -631,18 +631,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_UpdateResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgUpdateResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateResourceNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateResourceNodeStake_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) @@ -651,18 +651,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_UpdateResourceNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgUpdateResourceNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateResourceNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateResourceNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_CreateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgCreateIndexingNode_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) @@ -671,18 +671,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_CreateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgCreateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_CreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgCreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_RemoveIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgRemoveIndexingNode_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) @@ -691,18 +691,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_RemoveIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgRemoveIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_RemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgRemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNode_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) @@ -711,18 +711,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_UpdateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgUpdateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_UpdateIndexingNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNodeStake_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) @@ -731,18 +731,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_UpdateIndexingNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgUpdateIndexingNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_UpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_IndexingNodeRegistrationVote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgIndexingNodeRegistrationVote_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) @@ -751,14 +751,14 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_IndexingNodeRegistrationVote_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgIndexingNodeRegistrationVote_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_IndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -766,41 +766,41 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } var ( - pattern_Msg_CreateResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgCreateResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_RemoveResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgRemoveResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_UpdateResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgUpdateResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_UpdateResourceNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_resource_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgUpdateResourceNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_resource_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_CreateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgCreateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_RemoveIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgRemoveIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_UpdateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgUpdateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_UpdateIndexingNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgUpdateIndexingNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_IndexingNodeRegistrationVote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "indexing_node_registration_vote"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgIndexingNodeRegistrationVote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "indexing_node_registration_vote"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( - forward_Msg_CreateResourceNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgCreateResourceNode_0 = runtime.ForwardResponseMessage - forward_Msg_RemoveResourceNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgRemoveResourceNode_0 = runtime.ForwardResponseMessage - forward_Msg_UpdateResourceNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgUpdateResourceNode_0 = runtime.ForwardResponseMessage - forward_Msg_UpdateResourceNodeStake_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgUpdateResourceNodeStake_0 = runtime.ForwardResponseMessage - forward_Msg_CreateIndexingNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgCreateIndexingNode_0 = runtime.ForwardResponseMessage - forward_Msg_RemoveIndexingNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgRemoveIndexingNode_0 = runtime.ForwardResponseMessage - forward_Msg_UpdateIndexingNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgUpdateIndexingNode_0 = runtime.ForwardResponseMessage - forward_Msg_UpdateIndexingNodeStake_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgUpdateIndexingNodeStake_0 = runtime.ForwardResponseMessage - forward_Msg_IndexingNodeRegistrationVote_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgIndexingNodeRegistrationVote_0 = runtime.ForwardResponseMessage ) From 7c8c7fd4b19ab92de291de3e4535543b618e2769 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 4 May 2022 22:53:36 -0400 Subject: [PATCH 015/113] added abci.go --- x/register/abci.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/x/register/abci.go b/x/register/abci.go index 5345450a..2ea66d35 100644 --- a/x/register/abci.go +++ b/x/register/abci.go @@ -1,6 +1,7 @@ package register import ( + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/register/keeper" abci "github.com/tendermint/tendermint/abci/types" @@ -17,18 +18,6 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { return k.BlockRegisteredNodesUpdates(ctx) } - -import ( -"time" - -abci "github.com/tendermint/tendermint/abci/types" - -"github.com/cosmos/cosmos-sdk/telemetry" -sdk "github.com/cosmos/cosmos-sdk/types" -"github.com/cosmos/cosmos-sdk/x/staking/keeper" -"github.com/cosmos/cosmos-sdk/x/staking/types" -) - // BeginBlocker will persist the current header and validator set as a historical entry // and prune the oldest entry based on the HistoricalEntries parameter func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { From cc6ef9842bb43870379033c070ed7ddeb401f0ac Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 4 May 2022 23:06:19 -0400 Subject: [PATCH 016/113] finished cli and type --- x/register/types/genesis.go | 2 +- x/register/types/indexing_node.go | 10 +++++----- x/register/types/querier.go | 2 +- x/register/types/resource_node.go | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 5cf4b430..5542bed5 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -90,7 +90,7 @@ func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { PubKey: v.GetPubKey(), Suspend: v.GetSuspend(), Status: v.GetStatus(), - Tokens: sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, v.Token)), + Tokens: v.Token, OwnerAddress: ownerAddress.String(), Description: v.GetDescription(), } diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index 9c03a5f0..a10109f1 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -65,7 +65,7 @@ func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, PubKey: pkAny, Suspend: true, Status: stakingtypes.Unbonded, - Tokens: sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, sdk.ZeroInt())), + Tokens: sdk.ZeroInt(), OwnerAddress: ownerAddr.String(), Description: description, CreationTime: creationTime, @@ -97,7 +97,7 @@ func (v IndexingNode) ConvertToString() string { // AddToken adds tokens to a indexing node func (v IndexingNode) AddToken(amount sdk.Int) IndexingNode { - v.Tokens = v.Tokens.Add(sdk.NewCoin(DefaultBondDenom, amount)) + v.Tokens = v.Tokens.Add(amount) return v } @@ -106,10 +106,10 @@ func (v IndexingNode) SubToken(amount sdk.Int) IndexingNode { if amount.IsNegative() { panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", amount)) } - if v.Tokens.AmountOf(DefaultBondDenom).LT(amount) { + if v.Tokens.LT(amount) { panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, amount)) } - v.Tokens = v.Tokens.Sub(sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, amount))) + v.Tokens = v.Tokens.Sub(amount) return v } @@ -145,7 +145,7 @@ func (v IndexingNode) Validate() error { if ownerAddr.Empty() { return ErrEmptyOwnerAddr } - if v.Tokens.AmountOf(DefaultBondDenom).LT(sdk.ZeroInt()) { + if v.Tokens.LT(sdk.ZeroInt()) { return ErrValueNegative } if v.GetDescription().Moniker == "" { diff --git a/x/register/types/querier.go b/x/register/types/querier.go index 3f2b8085..a37265a2 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -81,7 +81,7 @@ type StakingInfo struct { PubKey crypto.PubKey `json:"pub_key"` Suspend bool `json:"suspend"` Status stakingtypes.BondStatus `json:"status"` - Tokens sdk.Coins `json:"tokens"` + Tokens sdk.Int `json:"tokens"` OwnerAddress sdk.AccAddress `json:"owner_address"` Description *Description `json:"description"` NodeType string `json:"node_type"` diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 7d9f1d1c..51ed50a8 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -92,7 +92,7 @@ func NewResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, PubKey: pkAny, Suspend: true, Status: stakingtypes.Unbonded, - Tokens: sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, sdk.ZeroInt())), + Tokens: sdk.ZeroInt(), OwnerAddress: ownerAddr.String(), Description: description, NodeType: nodeType.Type(), @@ -126,7 +126,7 @@ func (v ResourceNode) ConvertToString() string { // AddToken adds tokens to a resource node func (v ResourceNode) AddToken(amount sdk.Int) ResourceNode { - v.Tokens = v.Tokens.Add(sdk.NewCoin(DefaultBondDenom, amount)) + v.Tokens = v.Tokens.Add(amount) return v } @@ -135,10 +135,10 @@ func (v ResourceNode) SubToken(amount sdk.Int) ResourceNode { if amount.IsNegative() { panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", amount)) } - if v.Tokens.AmountOf(DefaultBondDenom).LT(amount) { + if v.Tokens.LT(amount) { panic(fmt.Sprintf("should not happen: only have %v tokens, trying to remove %v", v.Tokens, amount)) } - v.Tokens = v.Tokens.Sub(sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, amount))) + v.Tokens = v.Tokens.Sub(amount) return v } @@ -175,7 +175,7 @@ func (v ResourceNode) Validate() error { return ErrEmptyOwnerAddr } - if v.Tokens.AmountOf(DefaultBondDenom).LT(sdk.ZeroInt()) { + if v.Tokens.LT(sdk.ZeroInt()) { return ErrValueNegative } if v.GetDescription().Moniker == "" { From 53f982738473c93cf888d81bee4cc3f3c99b4d86 Mon Sep 17 00:00:00 2001 From: jialbai Date: Thu, 5 May 2022 12:12:12 -0400 Subject: [PATCH 017/113] - qb-1163: update codec --- proto/stratos/register/v1/register.proto | 11 + x/register/keeper/indexing_node.go | 21 +- x/register/keeper/utils.go | 9 + x/register/types/indexing_node.go | 57 ++- x/register/types/register.pb.go | 465 ++++++++++++++++++++--- x/register/types/resource_node.go | 11 +- 6 files changed, 482 insertions(+), 92 deletions(-) diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index 37cf32ea..4b0e5a80 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -59,6 +59,17 @@ message IndexingNode { ]; } +message IndexingNodeRegistrationVotePool { + string nodeAddress = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; + repeated string approveList = 2 [ (gogoproto.moretags) = "yaml:\"approve_list\"" ]; + repeated string rejectList = 3 [ (gogoproto.moretags) = "yaml:\"reject_list\"" ]; + google.protobuf.Timestamp expireTime = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"expire_time\"" + ]; +} + message Description { string moniker = 1 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"moniker\",omitempty" ]; string identity = 2 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"identity\",omitempty" ]; diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 8f0fe504..23f06105 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -291,7 +291,7 @@ func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr if votePool.ExpireTime.Before(ctx.BlockHeader().Time) { return stakingtypes.Unbonded, types.ErrVoteExpired } - if hasValue(votePool.ApproveList, voterAddr) || hasValue(votePool.RejectList, voterAddr) { + if hasStringValue(votePool.ApproveList, voterAddr.String()) || hasStringValue(votePool.RejectList, voterAddr.String()) { return stakingtypes.Unbonded, types.ErrDuplicateVoting } @@ -308,9 +308,9 @@ func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr } if opinion.Equal(types.Approve) { - votePool.ApproveList = append(votePool.ApproveList, voterAddr) + votePool.ApproveList = append(votePool.ApproveList, voterAddr.String()) } else { - votePool.RejectList = append(votePool.RejectList, voterAddr) + votePool.RejectList = append(votePool.RejectList, voterAddr.String()) } k.SetIndexingNodeRegistrationVotePool(ctx, votePool) @@ -349,15 +349,16 @@ func (k Keeper) GetIndexingNodeRegistrationVotePool(ctx sdk.Context, nodeAddr st if bz == nil { return votePool, false } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &votePool) + k.cdc.MustUnmarshalLengthPrefixed(bz, &votePool) return votePool, true } func (k Keeper) SetIndexingNodeRegistrationVotePool(ctx sdk.Context, votePool types.IndexingNodeRegistrationVotePool) { nodeAddr := votePool.NodeAddress store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(votePool) - store.Set(types.GetIndexingNodeRegistrationVotesKey(nodeAddr), bz) + bz := k.cdc.MustMarshalLengthPrefixed(&votePool) + node, _ := stratos.SdsAddressFromBech32(nodeAddr) + store.Set(types.GetIndexingNodeRegistrationVotesKey(node), bz) } func (k Keeper) UpdateIndexingNode(ctx sdk.Context, description types.Description, @@ -415,7 +416,7 @@ func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.Sds func (k Keeper) SetIndexingNodeBondedToken(ctx sdk.Context, token sdk.Coin) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(token) + bz := k.cdc.MustMarshalLengthPrefixed(&token) store.Set(types.IndexingNodeBondedTokenKey, bz) } @@ -425,13 +426,13 @@ func (k Keeper) GetIndexingNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { if bz == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &token) + k.cdc.MustUnmarshalLengthPrefixed(bz, &token) return token } func (k Keeper) SetIndexingNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(token) + bz := k.cdc.MustMarshalLengthPrefixed(&token) store.Set(types.IndexingNodeNotBondedTokenKey, bz) } @@ -441,6 +442,6 @@ func (k Keeper) GetIndexingNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) if bz == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &token) + k.cdc.MustUnmarshalLengthPrefixed(bz, &token) return token } diff --git a/x/register/keeper/utils.go b/x/register/keeper/utils.go index 906ff6d1..c3740b0c 100644 --- a/x/register/keeper/utils.go +++ b/x/register/keeper/utils.go @@ -34,3 +34,12 @@ func hasValue(items []stratos.SdsAddress, item stratos.SdsAddress) bool { } return false } + +func hasStringValue(items []string, item string) bool { + for _, eachItem := range items { + if len(item) > 0 && eachItem == item { + return true + } + } + return false +} diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index a10109f1..88934181 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -5,6 +5,7 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -170,12 +171,12 @@ func (v IndexingNode) IsUnBonding() bool { } // MustMarshalIndexingNode returns the indexingNode bytes. Panics if fails -func MustMarshalIndexingNode(cdc *goamino.Codec, indexingNode IndexingNode) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(indexingNode) +func MustMarshalIndexingNode(cdc codec.BinaryCodec, indexingNode IndexingNode) []byte { + return cdc.MustMarshal(&indexingNode) } // MustUnmarshalIndexingNode unmarshal an indexing node from a store value. Panics if fails -func MustUnmarshalIndexingNode(cdc *goamino.Codec, value []byte) IndexingNode { +func MustUnmarshalIndexingNode(cdc codec.BinaryCodec, value []byte) IndexingNode { indexingNode, err := UnmarshalIndexingNode(cdc, value) if err != nil { panic(err) @@ -184,8 +185,8 @@ func MustUnmarshalIndexingNode(cdc *goamino.Codec, value []byte) IndexingNode { } // UnmarshalIndexingNode unmarshal an indexing node from a store value -func UnmarshalIndexingNode(cdc *goamino.Codec, value []byte) (indexingNode IndexingNode, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &indexingNode) +func UnmarshalIndexingNode(cdc codec.BinaryCodec, value []byte) (indexingNode IndexingNode, err error) { + err = cdc.Unmarshal(value, &indexingNode) return indexingNode, err } @@ -220,22 +221,50 @@ func (v VoteOpinion) String() string { } } -type IndexingNodeRegistrationVotePool struct { - NodeAddress stratos.SdsAddress `json:"node_address" yaml:"node_address"` - ApproveList []stratos.SdsAddress `json:"approve_list" yaml:"approve_list"` - RejectList []stratos.SdsAddress `json:"reject_list" yaml:"reject_list"` - ExpireTime time.Time `json:"expire_time" yaml:"expire_time"` -} +//type IndexingNodeRegistrationVotePool struct { +// NodeAddress stratos.SdsAddress `json:"node_address" yaml:"node_address"` +// ApproveList []stratos.SdsAddress `json:"approve_list" yaml:"approve_list"` +// RejectList []stratos.SdsAddress `json:"reject_list" yaml:"reject_list"` +// ExpireTime time.Time `json:"expire_time" yaml:"expire_time"` +//} func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []stratos.SdsAddress, rejectList []stratos.SdsAddress, expireTime time.Time) IndexingNodeRegistrationVotePool { + approveSlice := make([]string, len(approveList)) + rejectSlice := make([]string, len(rejectList)) + for _, approval := range approveList { + approveSlice = append(approveSlice, approval.String()) + } + for _, reject := range rejectList { + rejectSlice = append(rejectSlice, reject.String()) + } return IndexingNodeRegistrationVotePool{ - NodeAddress: nodeAddress, - ApproveList: approveList, - RejectList: rejectList, + NodeAddress: nodeAddress.String(), + ApproveList: approveSlice, + RejectList: rejectSlice, ExpireTime: expireTime, } } +// MustMarshalIndexingNodeRegistrationVotePool returns the indexingNode bytes. Panics if fails +func MustMarshalIndexingNodeRegistrationVotePool(cdc codec.BinaryCodec, votePool IndexingNodeRegistrationVotePool) []byte { + return cdc.MustMarshal(&votePool) +} + +// MustUnmarshalIndexingNodeRegistrationVotePool unmarshal an indexing node from a store value. Panics if fails +func MustUnmarshalIndexingNodeRegistrationVotePool(cdc codec.BinaryCodec, value []byte) IndexingNodeRegistrationVotePool { + votePool, err := UnmarshalIndexingNodeRegistrationVotePool(cdc, value) + if err != nil { + panic(err) + } + return votePool +} + +// UnmarshalIndexingNodeRegistrationVotePool unmarshal an indexing node from a store value +func UnmarshalIndexingNodeRegistrationVotePool(cdc codec.BinaryCodec, value []byte) (votePool IndexingNodeRegistrationVotePool, err error) { + err = cdc.Unmarshal(value, &votePool) + return votePool, err +} + func (v1 IndexingNode) Equal(v2 IndexingNode) bool { bz1 := goamino.MustMarshalBinaryLengthPrefixed(&v1) bz2 := goamino.MustMarshalBinaryLengthPrefixed(&v2) diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 391ddf7d..911140bc 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -294,6 +294,74 @@ func (m *IndexingNode) GetCreationTime() time.Time { return time.Time{} } +type IndexingNodeRegistrationVotePool struct { + NodeAddress string `protobuf:"bytes,1,opt,name=nodeAddress,proto3" json:"nodeAddress,omitempty" yaml:"network_address"` + ApproveList []string `protobuf:"bytes,2,rep,name=approveList,proto3" json:"approveList,omitempty" yaml:"approve_list"` + RejectList []string `protobuf:"bytes,3,rep,name=rejectList,proto3" json:"rejectList,omitempty" yaml:"reject_list"` + ExpireTime time.Time `protobuf:"bytes,4,opt,name=expireTime,proto3,stdtime" json:"expireTime" yaml:"expire_time"` +} + +func (m *IndexingNodeRegistrationVotePool) Reset() { *m = IndexingNodeRegistrationVotePool{} } +func (m *IndexingNodeRegistrationVotePool) String() string { return proto.CompactTextString(m) } +func (*IndexingNodeRegistrationVotePool) ProtoMessage() {} +func (*IndexingNodeRegistrationVotePool) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{3} +} +func (m *IndexingNodeRegistrationVotePool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IndexingNodeRegistrationVotePool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IndexingNodeRegistrationVotePool.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 *IndexingNodeRegistrationVotePool) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexingNodeRegistrationVotePool.Merge(m, src) +} +func (m *IndexingNodeRegistrationVotePool) XXX_Size() int { + return m.Size() +} +func (m *IndexingNodeRegistrationVotePool) XXX_DiscardUnknown() { + xxx_messageInfo_IndexingNodeRegistrationVotePool.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexingNodeRegistrationVotePool proto.InternalMessageInfo + +func (m *IndexingNodeRegistrationVotePool) GetNodeAddress() string { + if m != nil { + return m.NodeAddress + } + return "" +} + +func (m *IndexingNodeRegistrationVotePool) GetApproveList() []string { + if m != nil { + return m.ApproveList + } + return nil +} + +func (m *IndexingNodeRegistrationVotePool) GetRejectList() []string { + if m != nil { + return m.RejectList + } + return nil +} + +func (m *IndexingNodeRegistrationVotePool) GetExpireTime() time.Time { + if m != nil { + return m.ExpireTime + } + return time.Time{} +} + type Description struct { Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty" yaml:"moniker",omitempty` Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty" yaml:"identity",omitempty` @@ -306,7 +374,7 @@ func (m *Description) Reset() { *m = Description{} } func (m *Description) String() string { return proto.CompactTextString(m) } func (*Description) ProtoMessage() {} func (*Description) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{3} + return fileDescriptor_fef1e3aeec8499d6, []int{4} } func (m *Description) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -379,7 +447,7 @@ func (m *Slashing) Reset() { *m = Slashing{} } func (m *Slashing) String() string { return proto.CompactTextString(m) } func (*Slashing) ProtoMessage() {} func (*Slashing) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{4} + return fileDescriptor_fef1e3aeec8499d6, []int{5} } func (m *Slashing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -430,7 +498,7 @@ func (m *ResourceNodes) Reset() { *m = ResourceNodes{} } func (m *ResourceNodes) String() string { return proto.CompactTextString(m) } func (*ResourceNodes) ProtoMessage() {} func (*ResourceNodes) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{5} + return fileDescriptor_fef1e3aeec8499d6, []int{6} } func (m *ResourceNodes) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -474,7 +542,7 @@ func (m *IndexingNodes) Reset() { *m = IndexingNodes{} } func (m *IndexingNodes) String() string { return proto.CompactTextString(m) } func (*IndexingNodes) ProtoMessage() {} func (*IndexingNodes) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{6} + return fileDescriptor_fef1e3aeec8499d6, []int{7} } func (m *IndexingNodes) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -514,6 +582,7 @@ func init() { proto.RegisterType((*Params)(nil), "stratos.register.v1.Params") proto.RegisterType((*ResourceNode)(nil), "stratos.register.v1.ResourceNode") proto.RegisterType((*IndexingNode)(nil), "stratos.register.v1.IndexingNode") + proto.RegisterType((*IndexingNodeRegistrationVotePool)(nil), "stratos.register.v1.IndexingNodeRegistrationVotePool") proto.RegisterType((*Description)(nil), "stratos.register.v1.Description") proto.RegisterType((*Slashing)(nil), "stratos.register.v1.Slashing") proto.RegisterType((*ResourceNodes)(nil), "stratos.register.v1.ResourceNodes") @@ -525,65 +594,73 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 928 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0xcf, 0x6e, 0xe3, 0x44, - 0x18, 0x6f, 0x5a, 0xda, 0xa6, 0x93, 0x66, 0x01, 0x13, 0x81, 0x5b, 0x50, 0x9c, 0x5a, 0x15, 0xea, - 0x4a, 0x5b, 0x87, 0x16, 0x4e, 0xab, 0x05, 0xd4, 0x6c, 0x01, 0xad, 0x10, 0xab, 0x95, 0x5b, 0x51, - 0xc4, 0x25, 0x4c, 0xec, 0x0f, 0x67, 0x94, 0x78, 0xc6, 0xf2, 0x8c, 0xdb, 0xfa, 0xca, 0x13, 0xec, - 0xc3, 0xec, 0x43, 0xac, 0xb8, 0xb0, 0x17, 0x24, 0xc4, 0xc1, 0xa0, 0xf6, 0x0d, 0xfc, 0x04, 0xc8, - 0x33, 0xe3, 0x64, 0x92, 0xdd, 0xe5, 0xb8, 0xa7, 0x3d, 0xc5, 0xf3, 0xfd, 0xfe, 0x7c, 0x9f, 0x3f, - 0xfd, 0x6c, 0x07, 0xb9, 0x5c, 0xa4, 0x58, 0x30, 0xde, 0x4f, 0x21, 0x22, 0x5c, 0x40, 0xda, 0xbf, - 0x3c, 0x9a, 0x5d, 0x7b, 0x49, 0xca, 0x04, 0xb3, 0x3e, 0xd0, 0x1c, 0x6f, 0x56, 0xbf, 0x3c, 0xda, - 0xed, 0x44, 0x2c,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x5f, 0xd4, 0x0d, 0x1e, 0x3f, - 0xbf, 0xe9, 0x36, 0x5e, 0xdc, 0x74, 0x1b, 0xff, 0xde, 0x74, 0x1b, 0x4f, 0x6f, 0xbb, 0x2b, 0x2f, - 0x6e, 0xbb, 0x2b, 0x7f, 0xdd, 0x76, 0x57, 0x7e, 0xfe, 0xc2, 0x78, 0x6a, 0xb5, 0x2b, 0x05, 0x51, - 0x5f, 0x1e, 0x06, 0x63, 0x4c, 0x68, 0xff, 0x7a, 0xfe, 0x2f, 0x4f, 0x3e, 0xc7, 0xa3, 0x0d, 0x99, - 0xf3, 0xcf, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x07, 0xd9, 0x0d, 0x26, 0x06, 0x0a, 0x00, 0x00, + // 1042 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x4d, 0x6f, 0xdc, 0xc4, + 0x1b, 0xcf, 0x26, 0xff, 0xbc, 0xcd, 0x66, 0xfb, 0x87, 0xe9, 0xaa, 0xdd, 0x04, 0xb4, 0xde, 0x58, + 0x11, 0x4a, 0xa5, 0xc6, 0x4b, 0x02, 0x42, 0xa2, 0x2a, 0xa0, 0x6c, 0x03, 0xa8, 0x02, 0xaa, 0xc8, + 0x89, 0x1a, 0xd4, 0xcb, 0x32, 0x6b, 0x3f, 0x6c, 0x86, 0xb5, 0x67, 0x2c, 0xcf, 0x6c, 0x12, 0x5f, + 0xf9, 0x04, 0xfd, 0x26, 0x5c, 0xfa, 0x21, 0x2a, 0x2e, 0xf4, 0x82, 0x84, 0x38, 0x18, 0x94, 0x7c, + 0x03, 0x7f, 0x02, 0xe4, 0x99, 0xf1, 0xee, 0x6c, 0xfa, 0x22, 0x4e, 0x9c, 0x7a, 0xda, 0x9d, 0xf9, + 0xbd, 0x3c, 0x8f, 0x1f, 0xff, 0xc6, 0x36, 0x72, 0x85, 0x4c, 0x89, 0xe4, 0xa2, 0x9b, 0xc2, 0x90, + 0x0a, 0x09, 0x69, 0xf7, 0x6c, 0x77, 0xf2, 0xdf, 0x4b, 0x52, 0x2e, 0x39, 0xbe, 0x69, 0x38, 0xde, + 0x64, 0xff, 0x6c, 0x77, 0xa3, 0x39, 0xe4, 0x43, 0xae, 0xf0, 0x6e, 0xf9, 0x4f, 0x53, 0x37, 0xd6, + 0x87, 0x9c, 0x0f, 0x23, 0xe8, 0xaa, 0xd5, 0x60, 0xfc, 0x63, 0x97, 0xb0, 0xcc, 0x40, 0xce, 0x75, + 0x48, 0xd2, 0x18, 0x84, 0x24, 0x71, 0x52, 0x69, 0x03, 0x2e, 0x62, 0x2e, 0xfa, 0xda, 0x54, 0x2f, + 0x0c, 0xb4, 0xa5, 0x57, 0x5d, 0x21, 0xc9, 0x88, 0xb2, 0x61, 0xf7, 0x6c, 0x77, 0x00, 0x92, 0xec, + 0x56, 0x6b, 0xcd, 0x72, 0x7f, 0x9b, 0x47, 0x4b, 0x87, 0x24, 0x25, 0xb1, 0xc0, 0x9f, 0x23, 0x34, + 0xe0, 0x2c, 0xec, 0x87, 0xc0, 0x78, 0xdc, 0xaa, 0x75, 0x6a, 0xdb, 0xab, 0x3d, 0xa7, 0xc8, 0x9d, + 0xf7, 0x32, 0x12, 0x47, 0xf7, 0xdc, 0x29, 0xe6, 0xde, 0xe5, 0x31, 0x95, 0x10, 0x27, 0x32, 0xf3, + 0x57, 0xcb, 0xed, 0x83, 0x72, 0x17, 0xff, 0x80, 0xd6, 0xc7, 0xac, 0x5c, 0x52, 0x36, 0xec, 0xcb, + 0xd3, 0x14, 0x88, 0x38, 0xe5, 0x51, 0xd8, 0x2f, 0x7b, 0x6e, 0xcd, 0x2b, 0xbb, 0xad, 0x22, 0x77, + 0x3a, 0xda, 0xee, 0xb5, 0x54, 0xd7, 0xbf, 0x3d, 0xc1, 0x8e, 0x27, 0xd0, 0x31, 0x8d, 0x61, 0xb6, + 0x42, 0xc0, 0xe3, 0x24, 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, 0x17, 0xab, 0x27, 0xdf, 0x60, + 0x49, 0x65, 0xfc, 0xa3, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x05, 0x20, 0xe5, 0x38, 0x0b, + 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -830,6 +907,62 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *IndexingNodeRegistrationVotePool) 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 *IndexingNodeRegistrationVotePool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IndexingNodeRegistrationVotePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpireTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireTime):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintRegister(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x22 + if len(m.RejectList) > 0 { + for iNdEx := len(m.RejectList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RejectList[iNdEx]) + copy(dAtA[i:], m.RejectList[iNdEx]) + i = encodeVarintRegister(dAtA, i, uint64(len(m.RejectList[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.ApproveList) > 0 { + for iNdEx := len(m.ApproveList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ApproveList[iNdEx]) + copy(dAtA[i:], m.ApproveList[iNdEx]) + i = encodeVarintRegister(dAtA, i, uint64(len(m.ApproveList[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.NodeAddress) > 0 { + i -= len(m.NodeAddress) + copy(dAtA[i:], m.NodeAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Description) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1106,6 +1239,33 @@ func (m *IndexingNode) Size() (n int) { return n } +func (m *IndexingNodeRegistrationVotePool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodeAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if len(m.ApproveList) > 0 { + for _, s := range m.ApproveList { + l = len(s) + n += 1 + l + sovRegister(uint64(l)) + } + } + if len(m.RejectList) > 0 { + for _, s := range m.RejectList { + l = len(s) + n += 1 + l + sovRegister(uint64(l)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireTime) + n += 1 + l + sovRegister(uint64(l)) + return n +} + func (m *Description) Size() (n int) { if m == nil { return 0 @@ -1968,6 +2128,185 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { } return nil } +func (m *IndexingNodeRegistrationVotePool) 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 ErrIntOverflowRegister + } + 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: IndexingNodeRegistrationVotePool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IndexingNodeRegistrationVotePool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApproveList", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ApproveList = append(m.ApproveList, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RejectList", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RejectList = append(m.RejectList, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpireTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpireTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Description) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 51ed50a8..62db846b 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -6,6 +6,7 @@ import ( "strconv" "time" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -207,12 +208,12 @@ func (v ResourceNode) IsUnBonding() bool { } // MustMarshalResourceNode returns the resourceNode bytes. Panics if fails -func MustMarshalResourceNode(cdc *goamino.Codec, v ResourceNode) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(v) +func MustMarshalResourceNode(cdc codec.BinaryCodec, resourceNode ResourceNode) []byte { + return cdc.MustMarshalLengthPrefixed(&resourceNode) } // MustUnmarshalResourceNode unmarshal a resourceNode from a store value. Panics if fails -func MustUnmarshalResourceNode(cdc *goamino.Codec, value []byte) ResourceNode { +func MustUnmarshalResourceNode(cdc codec.BinaryCodec, value []byte) ResourceNode { resourceNode, err := UnmarshalResourceNode(cdc, value) if err != nil { panic(err) @@ -221,8 +222,8 @@ func MustUnmarshalResourceNode(cdc *goamino.Codec, value []byte) ResourceNode { } // UnmarshalResourceNode unmarshal a resourceNode from a store value -func UnmarshalResourceNode(cdc *goamino.Codec, value []byte) (v ResourceNode, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &v) +func UnmarshalResourceNode(cdc codec.BinaryCodec, value []byte) (v ResourceNode, err error) { + err = cdc.Unmarshal(value, &v) return v, err } From f8d84e1b04c06e51f86a5ac52f749f40a88b5da2 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Thu, 5 May 2022 13:16:14 -0400 Subject: [PATCH 018/113] update --- types/address.go | 4 +- x/register/abci.go | 16 ---- x/register/alias.go | 121 +++++++++++++++-------------- x/register/exported/exported.go | 6 +- x/register/keeper/grpc_query.go | 54 +++++++++++++ x/register/keeper/msg_server.go | 83 +++++++++++++++++--- x/register/keeper/params.go | 3 +- x/register/keeper/resource_node.go | 4 +- x/register/keeper/slashing.go | 9 ++- x/register/types/querier.go | 3 +- 10 files changed, 202 insertions(+), 101 deletions(-) create mode 100644 x/register/keeper/grpc_query.go diff --git a/types/address.go b/types/address.go index d4773c5d..49cb4859 100644 --- a/types/address.go +++ b/types/address.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/cosmos/cosmos-sdk/crypto/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" @@ -64,7 +64,7 @@ const ( // GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with // a given key type. -func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (types.PubKey, error) { +func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (cryptotypes.PubKey, error) { var bech32Prefix string switch pkt { diff --git a/x/register/abci.go b/x/register/abci.go index 2ea66d35..03773d7a 100644 --- a/x/register/abci.go +++ b/x/register/abci.go @@ -1,7 +1,6 @@ package register import ( - "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/register/keeper" abci "github.com/tendermint/tendermint/abci/types" @@ -17,18 +16,3 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { return k.BlockRegisteredNodesUpdates(ctx) } - -// BeginBlocker will persist the current header and validator set as a historical entry -// and prune the oldest entry based on the HistoricalEntries parameter -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) - - k.TrackHistoricalInfo(ctx) -} - -// Called every block, update validator set -func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) - - return k.BlockValidatorUpdates(ctx) -} diff --git a/x/register/alias.go b/x/register/alias.go index 5a93ccd9..4dec2c33 100644 --- a/x/register/alias.go +++ b/x/register/alias.go @@ -1,62 +1,63 @@ package register -import ( - "github.com/stratosnet/stratos-chain/x/register/keeper" - "github.com/stratosnet/stratos-chain/x/register/types" -) - -const ( - DefaultParamSpace = types.DefaultParamSpace - ModuleName = types.ModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey - NodeTypeComputation = types.COMPUTATION - NodeTypeDataBase = types.DATABASE - NodeTypeStorage = types.STORAGE -) - -var ( - NewKeeper = keeper.NewKeeper - RegisterCodec = types.RegisterCodec - - ErrInvalid = types.ErrInvalid - ErrInvalidNetworkAddr = types.ErrInvalidNetworkAddr - ErrEmptyOwnerAddr = types.ErrEmptyOwnerAddr - ErrValueNegative = types.ErrValueNegative - ErrEmptyDescription = types.ErrEmptyDescription - ErrEmptyResourceNodeAddr = types.ErrEmptyResourceNodeAddr - ErrEmptyIndexingNodeAddr = types.ErrEmptyIndexingNodeAddr - ErrBadDenom = types.ErrBadDenom - ErrResourceNodePubKeyExists = types.ErrResourceNodePubKeyExists - ErrIndexingNodePubKeyExists = types.ErrIndexingNodePubKeyExists - ErrNoResourceNodeFound = types.ErrNoResourceNodeFound - ErrNoIndexingNodeFound = types.ErrNoIndexingNodeFound - ErrInvalidOwnerAddr = types.ErrInvalidOwnerAddr - ErrInvalidApproverAddr = types.ErrInvalidVoterAddr - ErrInvalidApproverStatus = types.ErrInvalidVoterStatus - - DefaultParams = types.DefaultParams - DefaultGenesisState = types.DefaultGenesisState - NewGenesisState = types.NewGenesisState - NewResourceNode = types.NewResourceNode - NewIndexingNode = types.NewIndexingNode - NewDescription = types.NewDescription - NewMsgCreateResourceNode = types.NewMsgCreateResourceNode - NewMsgCreateIndexingNode = types.NewMsgCreateIndexingNode - - GetGenesisStateFromAppState = types.GetGenesisStateFromAppState - - NewMultiRegisterHooks = types.NewMultiRegisterHooks -) - -type ( - Keeper = keeper.Keeper - ResourceNode = types.ResourceNode - IndexingNode = types.IndexingNode - Description = types.Description - GenesisIndexingNode = types.GenesisIndexingNode - Slashing = types.Slashing - MsgCreateResourceNode = types.MsgCreateResourceNode - MsgCreateIndexingNode = types.MsgCreateIndexingNode - VoteOpinion = types.VoteOpinion -) +// +//import ( +// "github.com/stratosnet/stratos-chain/x/register/keeper" +// "github.com/stratosnet/stratos-chain/x/register/types" +//) +// +//const ( +// DefaultParamSpace = types.DefaultParamSpace +// ModuleName = types.ModuleName +// StoreKey = types.StoreKey +// RouterKey = types.RouterKey +// NodeTypeComputation = types.COMPUTATION +// NodeTypeDataBase = types.DATABASE +// NodeTypeStorage = types.STORAGE +//) +// +//var ( +// NewKeeper = keeper.NewKeeper +// RegisterCodec = types.RegisterCodec +// +// ErrInvalid = types.ErrInvalid +// ErrInvalidNetworkAddr = types.ErrInvalidNetworkAddr +// ErrEmptyOwnerAddr = types.ErrEmptyOwnerAddr +// ErrValueNegative = types.ErrValueNegative +// ErrEmptyDescription = types.ErrEmptyDescription +// ErrEmptyResourceNodeAddr = types.ErrEmptyResourceNodeAddr +// ErrEmptyIndexingNodeAddr = types.ErrEmptyIndexingNodeAddr +// ErrBadDenom = types.ErrBadDenom +// ErrResourceNodePubKeyExists = types.ErrResourceNodePubKeyExists +// ErrIndexingNodePubKeyExists = types.ErrIndexingNodePubKeyExists +// ErrNoResourceNodeFound = types.ErrNoResourceNodeFound +// ErrNoIndexingNodeFound = types.ErrNoIndexingNodeFound +// ErrInvalidOwnerAddr = types.ErrInvalidOwnerAddr +// ErrInvalidApproverAddr = types.ErrInvalidVoterAddr +// ErrInvalidApproverStatus = types.ErrInvalidVoterStatus +// +// DefaultParams = types.DefaultParams +// DefaultGenesisState = types.DefaultGenesisState +// NewGenesisState = types.NewGenesisState +// NewResourceNode = types.NewResourceNode +// NewIndexingNode = types.NewIndexingNode +// NewDescription = types.NewDescription +// NewMsgCreateResourceNode = types.NewMsgCreateResourceNode +// NewMsgCreateIndexingNode = types.NewMsgCreateIndexingNode +// +// GetGenesisStateFromAppState = types.GetGenesisStateFromAppState +// +// NewMultiRegisterHooks = types.NewMultiRegisterHooks +//) +// +//type ( +// Keeper = keeper.Keeper +// ResourceNode = types.ResourceNode +// IndexingNode = types.IndexingNode +// Description = types.Description +// GenesisIndexingNode = types.GenesisIndexingNode +// Slashing = types.Slashing +// MsgCreateResourceNode = types.MsgCreateResourceNode +// MsgCreateIndexingNode = types.MsgCreateIndexingNode +// VoteOpinion = types.VoteOpinion +//) diff --git a/x/register/exported/exported.go b/x/register/exported/exported.go index de8ed44c..b1a80d21 100644 --- a/x/register/exported/exported.go +++ b/x/register/exported/exported.go @@ -1,10 +1,10 @@ package exported import ( + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/tendermint/tendermint/crypto" ) // ResourceNodeI expected resource node functions @@ -12,7 +12,7 @@ type ResourceNodeI interface { IsSuspended() bool // whether the node is jailed GetMoniker() string // moniker of the node GetStatus() stakingtypes.BondStatus // status of the node - GetPubKey() crypto.PubKey // pubkey of the node + GetPubKey() cryptotypes.PubKey // pubkey of the node GetNetworkAddr() stratos.SdsAddress // network address of the node GetTokens() sdk.Int // staking tokens of the node GetOwnerAddr() sdk.AccAddress // owner address of the node @@ -24,7 +24,7 @@ type IndexingNodeI interface { IsSuspended() bool // whether the node is jailed GetMoniker() string // moniker of the node GetStatus() stakingtypes.BondStatus // status of the node - GetPubKey() crypto.PubKey // pubkey of the node + GetPubKey() cryptotypes.PubKey // pubkey of the node GetNetworkAddr() stratos.SdsAddress // network address of the node GetTokens() sdk.Int // staking tokens of the node GetOwnerAddr() sdk.AccAddress // owner address of the node diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go new file mode 100644 index 00000000..1af7a52b --- /dev/null +++ b/x/register/keeper/grpc_query.go @@ -0,0 +1,54 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stratosnet/stratos-chain/x/register/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper +type Querier struct { + Keeper +} + +var _ types.QueryServer = Querier{} + +func (q Querier) ResourceNode(c context.Context, req *types.QueryResourceNodeRequest) (*types.QueryResourceNodeResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + if req.NetworkAddr == "" { + return nil, status.Error(codes.InvalidArgument, types.ErrInvalidNetworkAddr.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + var params types.QueryNodesParams + node, ok := q.GetResourceNode(ctx, params.NetworkAddr) + if !ok { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoResourceNodeFound.Error()) + } + return &types.QueryResourceNodeResponse{Node: node}, nil +} + +func (q Querier) IndexingNode(c context.Context, req *types.QueryIndexingNodeRequest) (*types.QueryIndexingNodeResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + if req.NetworkAddr == "" { + return nil, status.Error(codes.InvalidArgument, types.ErrInvalidNetworkAddr.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + var params types.QueryNodesParams + node, ok := q.GetIndexingNode(ctx, params.NetworkAddr) + if !ok { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoIndexingNodeFound.Error()) + } + return &types.QueryIndexingNodeResponse{Node: node}, nil +} diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 958981e4..886ffc9a 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -38,6 +38,11 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types return &types.MsgCreateResourceNodeResponse{}, err } + ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return &types.MsgCreateResourceNodeResponse{}, err + } + if _, found := k.GetResourceNode(ctx, networkAddr); found { ctx.Logger().Error("Resource node already exist") return nil, types.ErrResourceNodePubKeyExists @@ -45,13 +50,11 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types if msg.Value.Denom != k.BondDenom(ctx) { return nil, types.ErrBadDenom } - - ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + nodeType, err := strconv.ParseUint(msg.NodeType, 10, 8) if err != nil { return &types.MsgCreateResourceNodeResponse{}, err } - - ozoneLimitChange, err := k.RegisterResourceNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, msg.NodeType, msg.Value) + ozoneLimitChange, err := k.RegisterResourceNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, types.NodeType(nodeType), msg.Value) if err != nil { return nil, err } @@ -77,11 +80,17 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types.MsgCreateIndexingNode) (*types.MsgCreateIndexingNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // check to see if the pubkey or sender has been registered before - pk, err := stratos.SdsAddressFromBech32(msg.PubKey.String()) + pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.PubKey.String()) + if err != nil { + return nil, err + } + + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddr) if err != nil { return &types.MsgCreateIndexingNodeResponse{}, err } - if _, found := k.GetIndexingNode(ctx, pk); found { + + if _, found := k.GetIndexingNode(ctx, networkAddr); found { ctx.Logger().Error("Indexing node already exist") return nil, types.ErrIndexingNodePubKeyExists } @@ -89,7 +98,12 @@ func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types return nil, types.ErrBadDenom } - ozoneLimitChange, err := k.RegisterIndexingNode(ctx, msg.NetworkAddr, msg.PubKey, msg.OwnerAddress, msg.Description, msg.Value) + ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return &types.MsgCreateIndexingNodeResponse{}, err + } + + ozoneLimitChange, err := k.RegisterIndexingNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, msg.Value) if err != nil { return nil, err } @@ -250,7 +264,21 @@ func (k msgServer) HandleMsgIndexingNodeRegistrationVote(goCtx context.Context, func (k msgServer) HandleMsgUpdateResourceNode(goCtx context.Context, msg *types.MsgUpdateResourceNode) (*types.MsgUpdateResourceNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - _, err := k.UpdateResourceNode(ctx, msg.Description, msg.NodeType, msg.NetworkAddress, msg.OwnerAddress) + + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return &types.MsgUpdateResourceNodeResponse{}, err + } + + ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return &types.MsgUpdateResourceNodeResponse{}, err + } + nodeType, err := strconv.ParseUint(msg.NodeType, 10, 8) + if err != nil { + return &types.MsgUpdateResourceNodeResponse{}, err + } + err = k.UpdateResourceNode(ctx, msg.Description, types.NodeType(nodeType), networkAddr, ownerAddress) if err != nil { return nil, err } @@ -271,7 +299,18 @@ func (k msgServer) HandleMsgUpdateResourceNode(goCtx context.Context, msg *types func (k msgServer) HandleMsgUpdateResourceNodeStake(goCtx context.Context, msg *types.MsgUpdateResourceNodeStake) (*types.MsgUpdateResourceNodeStakeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - ozoneLimitChange, completionTime, err := k.UpdateResourceNodeStake(ctx, msg.NetworkAddress, msg.OwnerAddress, msg.StakeDelta, msg.IncrStake) + + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return &types.MsgUpdateResourceNodeStakeResponse{}, err + } + + ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return &types.MsgUpdateResourceNodeStakeResponse{}, err + } + + ozoneLimitChange, completionTime, err := k.UpdateResourceNodeStake(ctx, networkAddr, ownerAddress, *msg.StakeDelta, msg.IncrStake) if err != nil { return nil, err } @@ -297,7 +336,18 @@ func (k msgServer) HandleMsgUpdateResourceNodeStake(goCtx context.Context, msg * func (k msgServer) HandleMsgUpdateIndexingNode(goCtx context.Context, msg *types.MsgUpdateIndexingNode) (*types.MsgUpdateIndexingNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - err := k.UpdateIndexingNode(ctx, msg.Description, msg.NetworkAddress, msg.OwnerAddress) + + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return &types.MsgUpdateIndexingNodeResponse{}, err + } + + ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return &types.MsgUpdateIndexingNodeResponse{}, err + } + + err = k.UpdateIndexingNode(ctx, msg.Description, networkAddr, ownerAddress) if err != nil { return nil, err } @@ -318,7 +368,18 @@ func (k msgServer) HandleMsgUpdateIndexingNode(goCtx context.Context, msg *types func (k msgServer) HandleMsgUpdateIndexingNodeStake(goCtx context.Context, msg *types.MsgUpdateIndexingNodeStake) (*types.MsgUpdateIndexingNodeStakeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - ozoneLimitChange, completionTime, err := k.UpdateIndexingNodeStake(ctx, msg.NetworkAddress, msg.OwnerAddress, msg.StakeDelta, msg.IncrStake) + + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return &types.MsgUpdateIndexingNodeStakeResponse{}, err + } + + ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return &types.MsgUpdateIndexingNodeStakeResponse{}, err + } + + ozoneLimitChange, completionTime, err := k.UpdateIndexingNodeStake(ctx, networkAddr, ownerAddress, *msg.StakeDelta, msg.IncrStake) if err != nil { return nil, err } diff --git a/x/register/keeper/params.go b/x/register/keeper/params.go index cd5f12cc..3bd430a2 100644 --- a/x/register/keeper/params.go +++ b/x/register/keeper/params.go @@ -1,9 +1,10 @@ package keeper import ( + "time" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/register/types" - "time" ) // GetParams returns the total set of register parameters. diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index e60778c4..5a9a7d00 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -4,11 +4,11 @@ import ( "bytes" "time" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/tendermint/tendermint/crypto" ) const resourceNodeCacheSize = 500 @@ -235,7 +235,7 @@ func (k Keeper) removeResourceNode(ctx sdk.Context, addr stratos.SdsAddress) err return nil } -func (k Keeper) RegisterResourceNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress, +func (k Keeper) RegisterResourceNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description types.Description, nodeType types.NodeType, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error) { resourceNode, err := types.NewResourceNode(networkAddr, pubKey, ownerAddr, description, nodeType, ctx.BlockHeader().Time) diff --git a/x/register/keeper/slashing.go b/x/register/keeper/slashing.go index 65516564..95c864e6 100644 --- a/x/register/keeper/slashing.go +++ b/x/register/keeper/slashing.go @@ -2,11 +2,12 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/go-amino" "github.com/stratosnet/stratos-chain/x/register/types" ) -// deduct slashing amount from coins, return the coins that after deduction +// DeductSlashing deduct slashing amount from coins, return the coins that after deduction func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins { slashing := k.GetSlashing(ctx, walletAddress) if slashing.LTE(sdk.ZeroInt()) || coins.Empty() || coins.IsZero() { @@ -36,7 +37,7 @@ func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress for ; iter.Valid(); iter.Next() { walletAddress := sdk.AccAddress(iter.Key()[len(types.SlashingPrefix):]) var slashing sdk.Int - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &slashing) + amino.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &slashing) if handler(walletAddress, slashing) { break } @@ -46,7 +47,7 @@ func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress func (k Keeper) SetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, slashing sdk.Int) { store := ctx.KVStore(k.storeKey) storeKey := types.GetSlashingKey(walletAddress) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(slashing) + bz := amino.MustMarshalBinaryLengthPrefixed(slashing) store.Set(storeKey, bz) } @@ -56,6 +57,6 @@ func (k Keeper) GetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress) (res if bz == nil { return sdk.ZeroInt() } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &res) + amino.MustUnmarshalBinaryLengthPrefixed(bz, &res) return } diff --git a/x/register/types/querier.go b/x/register/types/querier.go index a37265a2..1daae50a 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/tendermint/tendermint/crypto" cryptotypes "github.com/tendermint/tendermint/crypto" ) @@ -78,7 +77,7 @@ func NewQueryNodesStakingInfo( type StakingInfo struct { NetworkAddr stratos.SdsAddress `json:"network_address"` - PubKey crypto.PubKey `json:"pub_key"` + PubKey cryptotypes.PubKey `json:"pub_key"` Suspend bool `json:"suspend"` Status stakingtypes.BondStatus `json:"status"` Tokens sdk.Int `json:"tokens"` From 719059101d058639672fd6ddfa5bb6fca0abf297 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Thu, 5 May 2022 14:09:16 -0400 Subject: [PATCH 019/113] update --- x/register/genesis.go | 13 +++--- x/register/keeper/indexing_node.go | 7 +-- x/register/keeper/msg_server.go | 6 +-- x/register/keeper/node_state_change.go | 60 +++++++++++++++++--------- 4 files changed, 54 insertions(+), 32 deletions(-) diff --git a/x/register/genesis.go b/x/register/genesis.go index 55016b4f..f6b1e5f7 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -3,23 +3,24 @@ package register import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stratosnet/stratos-chain/x/register/keeper" "github.com/stratosnet/stratos-chain/x/register/types" abci "github.com/tendermint/tendermint/abci/types" ) // InitGenesis initialize default parameters // and the keeper's address to pubkey map -func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) (res []abci.ValidatorUpdate) { +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) (res []abci.ValidatorUpdate) { keeper.SetParams(ctx, *data.Params) initialStakeTotal := sdk.ZeroInt() resNodeBondedToken := sdk.ZeroInt() resNodeNotBondedToken := sdk.ZeroInt() for _, resourceNode := range data.ResourceNodes.GetResourceNodes() { - if resourceNode.GetStatus().String() == stakingtypes.BondStatusBonded { + if resourceNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(resourceNode.Tokens) resNodeBondedToken = resNodeBondedToken.Add(resourceNode.Tokens) - } else if resourceNode.GetStatus().String() == stakingtypes.BondStatusUnbonded { + } else if resourceNode.GetStatus() == stakingtypes.Unbonded { resNodeNotBondedToken = resNodeNotBondedToken.Add(resourceNode.Tokens) } keeper.SetResourceNode(ctx, *resourceNode) @@ -30,10 +31,10 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) (res idxNodeBondedToken := sdk.ZeroInt() idxNodeNotBondedToken := sdk.ZeroInt() for _, indexingNode := range data.IndexingNodes.GetIndexingNodes() { - if indexingNode.GetStatus().String() == stakingtypes.BondStatusBonded { + if indexingNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(indexingNode.Tokens) idxNodeBondedToken = idxNodeBondedToken.Add(indexingNode.Tokens) - } else if indexingNode.GetStatus().String() == stakingtypes.BondStatusUnbonded { + } else if indexingNode.GetStatus() == stakingtypes.Unbonded { idxNodeNotBondedToken = idxNodeNotBondedToken.Add(indexingNode.Tokens) } keeper.SetIndexingNode(ctx, *indexingNode) @@ -67,7 +68,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) (res // ExportGenesis writes the current store values // to a genesis file, which can be imported again // with InitGenesis -func ExportGenesis(ctx sdk.Context, keeper Keeper) (data *types.GenesisState) { +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisState) { params := keeper.GetParams(ctx) resourceNodes := keeper.GetAllResourceNodes(ctx) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 23f06105..503be59b 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -5,6 +5,7 @@ import ( "strings" "time" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" @@ -99,10 +100,10 @@ func (k Keeper) GetAllValidIndexingNodes(ctx sdk.Context) (indexingNodes []types return indexingNodes } -func (k Keeper) RegisterIndexingNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress, +func (k Keeper) RegisterIndexingNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description types.Description, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error) { - indexingNode, err := types.NewIndexingNode(networkAddr, pubKey, ownerAddr, description, ctx.BlockHeader().Time) + indexingNode, err := types.NewIndexingNode(networkAddr, pubKey, ownerAddr, &description, ctx.BlockHeader().Time) if err != nil { return ozoneLimitChange, err } @@ -133,7 +134,7 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin return sdk.ZeroInt(), types.ErrInvalidOwnerAddr } // sub coins from owner's wallet - hasCoin := k.bankKeeper.HasCoins(ctx, ownerAddr, coins) + hasCoin := k.bankKeeper..HasCoins(ctx, ownerAddr, coins) if !hasCoin { return sdk.ZeroInt(), types.ErrInsufficientBalance } diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 886ffc9a..582750ce 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -134,7 +134,7 @@ func (k msgServer) HandleMsgRemoveResourceNode(goCtx context.Context, msg *types if !found { return nil, types.ErrNoResourceNodeFound } - if resourceNode.GetStatus().String() == stakingtypes.BondStatusUnbonding { + if resourceNode.GetStatus() == stakingtypes.Unbonding { return nil, types.ErrUnbondingNode } @@ -174,7 +174,7 @@ func (k msgServer) HandleMsgRemoveIndexingNode(goCtx context.Context, msg *types return nil, types.ErrNoIndexingNodeFound } - if indexingNode.GetStatus().String() == stakingtypes.BondStatusUnbonding { + if indexingNode.GetStatus() == stakingtypes.Unbonding { return nil, types.ErrUnbondingNode } @@ -235,7 +235,7 @@ func (k msgServer) HandleMsgIndexingNodeRegistrationVote(goCtx context.Context, return &types.MsgIndexingNodeRegistrationVoteResponse{}, err } - if !(voter.Status.String() == stakingtypes.BondStatusBonded) || voter.Suspend { + if !(voter.Status == stakingtypes.Bonded) || voter.Suspend { return nil, types.ErrInvalidVoterStatus } diff --git a/x/register/keeper/node_state_change.go b/x/register/keeper/node_state_change.go index 5847c6d6..d11030ee 100644 --- a/x/register/keeper/node_state_change.go +++ b/x/register/keeper/node_state_change.go @@ -5,8 +5,10 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" + "github.com/tendermint/go-amino" abci "github.com/tendermint/tendermint/abci/types" ) @@ -49,16 +51,16 @@ func (k Keeper) bondedToUnbonding(ctx sdk.Context, node interface{}, isIndexingN switch isIndexingNode { case true: temp := node.(types.IndexingNode) - if temp.GetStatus() != sdk.Bonded { + if temp.GetStatus() != stakingtypes.Bonded { panic(fmt.Sprintf("bad state transition bondedToUnbonding, indexingNode: %v\n", temp)) } - return k.beginUnbondingIndexingNode(ctx, temp, coin) + return k.beginUnbondingIndexingNode(ctx, &temp, &coin) default: temp := node.(types.ResourceNode) - if temp.GetStatus() != sdk.Bonded { + if temp.GetStatus() != stakingtypes.Bonded { panic(fmt.Sprintf("bad state transition bondedToUnbonding, resourceNode: %v\n", temp)) } - return k.beginUnbondingResourceNode(ctx, temp, coin) + return k.beginUnbondingResourceNode(ctx, &temp, &coin) } } @@ -67,13 +69,13 @@ func (k Keeper) unbondingToUnbonded(ctx sdk.Context, node interface{}, isIndexin switch isIndexingNode { case true: temp := node.(types.IndexingNode) - if temp.GetStatus() != sdk.Unbonding { + if temp.GetStatus() != stakingtypes.Unbonding { panic(fmt.Sprintf("bad state transition unbondingToBonded, indexingNode: %v\n", temp)) } return k.completeUnbondingNode(ctx, temp, isIndexingNode) default: temp := node.(types.ResourceNode) - if temp.GetStatus() != sdk.Unbonding { + if temp.GetStatus() != stakingtypes.Unbonding { panic(fmt.Sprintf("bad state transition unbondingToBonded, resourceNode: %v\n", temp)) } return k.completeUnbondingNode(ctx, temp, isIndexingNode) @@ -81,24 +83,42 @@ func (k Keeper) unbondingToUnbonded(ctx sdk.Context, node interface{}, isIndexin } // perform all the store operations for when a Node begins unbonding -func (k Keeper) beginUnbondingResourceNode(ctx sdk.Context, resourceNode types.ResourceNode, coin sdk.Coin) types.ResourceNode { +func (k Keeper) beginUnbondingResourceNode(ctx sdk.Context, resourceNode *types.ResourceNode, coin *sdk.Coin) *types.ResourceNode { // set node stat to unbonding, remove token from bonded pool, add token into NotBondedPool - k.RemoveTokenFromPoolWhileUnbondingResourceNode(ctx, resourceNode, coin) + err := k.RemoveTokenFromPoolWhileUnbondingResourceNode(ctx, *resourceNode, *coin) + if err != nil { + return &types.ResourceNode{} + } + + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + if err != nil { + return &types.ResourceNode{} + } // trigger hook if registered - k.AfterNodeBeginUnbonding(ctx, resourceNode.GetNetworkAddr(), false) + k.AfterNodeBeginUnbonding(ctx, networkAddr, false) return resourceNode } -func (k Keeper) beginUnbondingIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode, coin sdk.Coin) types.IndexingNode { +func (k Keeper) beginUnbondingIndexingNode(ctx sdk.Context, indexingNode *types.IndexingNode, coin *sdk.Coin) *types.IndexingNode { // change node stat, remove token from bonded pool, add token into NotBondedPool - k.RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx, indexingNode, coin) + err := k.RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx, *indexingNode, *coin) + if err != nil { + return nil + } + if err != nil { + return &types.IndexingNode{} + } + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + if err != nil { + return &types.IndexingNode{} + } // trigger hook if registered - k.AfterNodeBeginUnbonding(ctx, indexingNode.GetNetworkAddr(), true) + k.AfterNodeBeginUnbonding(ctx, networkAddr, true) return indexingNode } -func calcUnbondingMatureTime(ctx sdk.Context, currStatus sdk.BondStatus, creationTime time.Time, threasholdTime time.Duration, completionTime time.Duration) time.Time { +func calcUnbondingMatureTime(ctx sdk.Context, currStatus stakingtypes.BondStatus, creationTime time.Time, threasholdTime time.Duration, completionTime time.Duration) time.Time { switch currStatus { - case sdk.Unbonded: + case stakingtypes.Unbonded: return creationTime.Add(completionTime) default: now := ctx.BlockHeader().Time @@ -114,12 +134,12 @@ func calcUnbondingMatureTime(ctx sdk.Context, currStatus sdk.BondStatus, creatio func (k Keeper) completeUnbondingNode(ctx sdk.Context, node interface{}, isIndexingNode bool) interface{} { if isIndexingNode { temp := node.(types.IndexingNode) - temp.Status = sdk.Unbonded + temp.Status = stakingtypes.Unbonded k.SetIndexingNode(ctx, temp) return temp } else { temp := node.(types.ResourceNode) - temp.Status = sdk.Unbonded + temp.Status = stakingtypes.Unbonded k.SetResourceNode(ctx, temp) return temp } @@ -139,7 +159,7 @@ func (k Keeper) GetAllMatureUBDNodeQueue(ctx sdk.Context, currTime time.Time) (m for ; ubdTimesliceIterator.Valid(); ubdTimesliceIterator.Next() { timeslice := []sdk.AccAddress{} - k.cdc.MustUnmarshalBinaryLengthPrefixed(ubdTimesliceIterator.Value(), ×lice) + amino.MustUnmarshalBinaryLengthPrefixed(ubdTimesliceIterator.Value(), ×lice) matureNetworkAddrs = append(matureNetworkAddrs, timeslice...) } @@ -154,7 +174,7 @@ func (k Keeper) UnbondAllMatureUBDNodeQueue(ctx sdk.Context) { for ; nodeTimesliceIterator.Valid(); nodeTimesliceIterator.Next() { timeslice := []stratos.SdsAddress{} - k.cdc.MustUnmarshalBinaryLengthPrefixed(nodeTimesliceIterator.Value(), ×lice) + amino.MustUnmarshalBinaryLengthPrefixed(nodeTimesliceIterator.Value(), ×lice) for _, networkAddr := range timeslice { ubd, found := k.GetUnbondingNode(ctx, networkAddr) @@ -167,7 +187,7 @@ func (k Keeper) UnbondAllMatureUBDNodeQueue(ctx sdk.Context) { if !found { panic("cannot find indexing node " + ubd.NetworkAddr.String()) } - if node.GetStatus() != sdk.Unbonding { + if node.GetStatus() != stakingtypes.Unbonding { panic("unexpected node in unbonding queue; status was not unbonding") } k.unbondingToUnbonded(ctx, node, ubd.IsIndexingNode) @@ -181,7 +201,7 @@ func (k Keeper) UnbondAllMatureUBDNodeQueue(ctx sdk.Context) { if !found { panic("cannot find resource node " + ubd.NetworkAddr.String()) } - if node.GetStatus() != sdk.Unbonding { + if node.GetStatus() != stakingtypes.Unbonding { panic("unexpected node in unbonding queue; status was not unbonding") } k.unbondingToUnbonded(ctx, node, ubd.IsIndexingNode) From d2c183770c842e5aec5458d4d771c420b904a9b9 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Thu, 5 May 2022 16:04:00 -0400 Subject: [PATCH 020/113] update --- x/register/genesis.go | 4 ++-- x/register/keeper/indexing_node.go | 9 ++++----- x/register/keeper/keeper.go | 14 ++++++++------ x/register/keeper/resource_node.go | 21 +++++++++++---------- x/register/types/expected_keepers.go | 13 +++++++------ 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/x/register/genesis.go b/x/register/genesis.go index f6b1e5f7..404121d2 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -87,8 +87,8 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisSt return &types.GenesisState{ Params: ¶ms, - ResourceNodes: &resourceNodes, - IndexingNodes: &indexingNodes, + ResourceNodes: resourceNodes, + IndexingNodes: indexingNodes, InitialUozPrice: initialUOzonePrice, TotalUnissuedPrepay: totalUnissuedPrepay, Slashing: slashingInfo, diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 503be59b..409cecf8 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -10,7 +10,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/tendermint/tendermint/crypto" ) const ( @@ -73,14 +72,14 @@ func (k Keeper) SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode } // GetAllIndexingNodes get the set of all indexing nodes with no limits, used during genesis dump -func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes types.IndexingNodes) { +func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes *types.IndexingNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) - indexingNodes = append(indexingNodes, node) + indexingNodes.IndexingNodes = append(indexingNodes.IndexingNodes, &node) } return indexingNodes } @@ -182,7 +181,7 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, i // SubtractIndexingNodeStake Update the tokens of an existing indexing node func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.AddToken().GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) if err != nil { return types.ErrInvalidNetworkAddr } @@ -375,7 +374,7 @@ func (k Keeper) UpdateIndexingNode(ctx sdk.Context, description types.Descriptio return types.ErrInvalidOwnerAddr } - node.Description = description + node.Description = &description k.SetIndexingNode(ctx, node) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 36e98797..2d16fe7c 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" @@ -19,7 +20,8 @@ import ( type Keeper struct { storeKey sdk.StoreKey cdc codec.BinaryCodec - //paramSpace types.ParamSubspace + // module specific parameter space that can be configured through governance + paramSpace paramtypes.Subspace accountKeeper types.AccountKeeper bankKeeper types.BankKeeper hooks types.RegisterHooks @@ -30,13 +32,13 @@ type Keeper struct { } // NewKeeper creates a register keeper -func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, +func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper) Keeper { keeper := Keeper{ - storeKey: key, - cdc: cdc, - //paramSpace: paramSpace.WithKeyTable(types.ParamKeyTable()), + storeKey: key, + cdc: cdc, + paramSpace: paramSpace.WithKeyTable(types.ParamKeyTable()), accountKeeper: accountKeeper, bankKeeper: bankKeeper, hooks: nil, @@ -53,7 +55,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -// Set the register hooks +// SetHooks Set the register hooks func (k *Keeper) SetHooks(sh types.RegisterHooks) *Keeper { if k.hooks != nil { panic("cannot set register hooks twice") diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 5a9a7d00..72c9cc43 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -9,6 +9,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" + "github.com/tendermint/go-amino" ) const resourceNodeCacheSize = 500 @@ -70,16 +71,16 @@ func (k Keeper) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode } // GetAllResourceNodes get the set of all resource nodes with no limits, used during genesis dump -func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes types.ResourceNodes) { +func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes *types.ResourceNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalResourceNode(k.cdc, iterator.Value()) - resourceNodes = append(resourceNodes, node) + resourceNodes.ResourceNodes = append(resourceNodes.ResourceNodes, &node) } - return resourceNodes + return } func (k Keeper) getResourceNodeIterator(ctx sdk.Context) sdk.Iterator { @@ -238,7 +239,7 @@ func (k Keeper) removeResourceNode(ctx sdk.Context, addr stratos.SdsAddress) err func (k Keeper) RegisterResourceNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description types.Description, nodeType types.NodeType, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error) { - resourceNode, err := types.NewResourceNode(networkAddr, pubKey, ownerAddr, description, nodeType, ctx.BlockHeader().Time) + resourceNode, err := types.NewResourceNode(networkAddr, pubKey, ownerAddr, &description, &nodeType, ctx.BlockHeader().Time) if err != nil { return ozoneLimitChange, err } @@ -259,8 +260,8 @@ func (k Keeper) UpdateResourceNode(ctx sdk.Context, description types.Descriptio return types.ErrInvalidOwnerAddr } - node.Description = description - node.NodeType = nodeType + node.Description = &description + node.NodeType = nodeType.String() k.SetResourceNode(ctx, node) @@ -303,7 +304,7 @@ func (k Keeper) UpdateResourceNodeStake(ctx sdk.Context, networkAddr stratos.Sds func (k Keeper) SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(token) + bz := amino.MustMarshalBinaryLengthPrefixed(token) store.Set(types.ResourceNodeBondedTokenKey, bz) } @@ -313,13 +314,13 @@ func (k Keeper) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { if bz == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &token) + amino.MustUnmarshalBinaryLengthPrefixed(bz, &token) return token } func (k Keeper) SetResourceNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(token) + bz := amino.MustMarshalBinaryLengthPrefixed(token) store.Set(types.ResourceNodeNotBondedTokenKey, bz) } @@ -329,6 +330,6 @@ func (k Keeper) GetResourceNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) if bz == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &token) + amino.MustUnmarshalBinaryLengthPrefixed(bz, &token) return token } diff --git a/x/register/types/expected_keepers.go b/x/register/types/expected_keepers.go index 364b7f6c..42e13a99 100644 --- a/x/register/types/expected_keepers.go +++ b/x/register/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" stratos "github.com/stratosnet/stratos-chain/types" ) @@ -17,12 +18,12 @@ type BankKeeper interface { */ // ParamSubspace defines the expected Subspace interface -//type ParamSubspace interface { -// WithKeyTable(table params.KeyTable) params.Subspace -// Get(ctx sdk.Context, key []byte, ptr interface{}) -// GetParamSet(ctx sdk.Context, ps params.ParamSet) -// SetParamSet(ctx sdk.Context, ps params.ParamSet) -//} +type ParamSubspace interface { + WithKeyTable(table paramstypes.KeyTable) paramstypes.Subspace + Get(ctx sdk.Context, key []byte, ptr interface{}) + GetParamSet(ctx sdk.Context, ps paramstypes.ParamSet) + SetParamSet(ctx sdk.Context, ps paramstypes.ParamSet) +} // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { From 51ee6e5d6dc39efde1758c44962ce234cf45d076 Mon Sep 17 00:00:00 2001 From: jialbai Date: Thu, 5 May 2022 16:11:12 -0400 Subject: [PATCH 021/113] - qb-1163: migrate bankKeeper.AddCoins and SubstractCoins --- app/app.go | 7 ++++--- x/register/keeper/indexing_node.go | 16 ++++++++++++---- x/register/keeper/msg_server.go | 9 +++++++++ x/register/keeper/resource_node.go | 22 +++++++++++++++------- x/register/types/expected_keepers.go | 4 ++++ 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/app/app.go b/app/app.go index 928b87c5..2a84002e 100644 --- a/app/app.go +++ b/app/app.go @@ -101,7 +101,7 @@ import ( //"github.com/stratosnet/stratos-chain/x/pot" //pottypes "github.com/stratosnet/stratos-chain/x/pot/types" //"github.com/stratosnet/stratos-chain/x/register" - //registertypes "github.com/stratosnet/stratos-chain/x/register/types" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" //"github.com/stratosnet/stratos-chain/x/sds" //sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) @@ -153,7 +153,8 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, //pot.FoundationAccount: nil, - evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account } // module accounts that are allowed to receive tokens @@ -468,7 +469,7 @@ func NewInitApp( crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, - register.ModuleName, + registertypes.ModuleName, evmtypes.ModuleName, // no-op modules ibchost.ModuleName, diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 23f06105..d0b38be9 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -133,11 +133,15 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin return sdk.ZeroInt(), types.ErrInvalidOwnerAddr } // sub coins from owner's wallet - hasCoin := k.bankKeeper.HasCoins(ctx, ownerAddr, coins) + hasCoin := k.bankKeeper.HasBalance(ctx, ownerAddr, tokenToAdd) if !hasCoin { return sdk.ZeroInt(), types.ErrInsufficientBalance } - _, err = k.bankKeeper.SubtractCoins(ctx, ownerAddr, coins) + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddr, types.ModuleName, coins) + if err != nil { + return sdk.ZeroInt(), err + } + err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins) if err != nil { return sdk.ZeroInt(), err } @@ -181,7 +185,7 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, i // SubtractIndexingNodeStake Update the tokens of an existing indexing node func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.AddToken().GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) if err != nil { return types.ErrInvalidNetworkAddr } @@ -211,7 +215,11 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In // deduct slashing amount first coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc - _, err := k.bankKeeper.AddCoins(ctx, indexingNode.OwnerAddress, coins) + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, coins) + if err != nil { + return err + } + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { return err } diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 886ffc9a..10b686ff 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( "context" "encoding/hex" + "errors" "strconv" "time" @@ -310,6 +311,10 @@ func (k msgServer) HandleMsgUpdateResourceNodeStake(goCtx context.Context, msg * return &types.MsgUpdateResourceNodeStakeResponse{}, err } + if msg.StakeDelta.Amount.LT(sdk.NewInt(0)) { + return &types.MsgUpdateResourceNodeStakeResponse{}, errors.New("invalid stake delta") + } + ozoneLimitChange, completionTime, err := k.UpdateResourceNodeStake(ctx, networkAddr, ownerAddress, *msg.StakeDelta, msg.IncrStake) if err != nil { return nil, err @@ -379,6 +384,10 @@ func (k msgServer) HandleMsgUpdateIndexingNodeStake(goCtx context.Context, msg * return &types.MsgUpdateIndexingNodeStakeResponse{}, err } + if msg.StakeDelta.Amount.LT(sdk.NewInt(0)) { + return &types.MsgUpdateIndexingNodeStakeResponse{}, errors.New("invalid stake delta") + } + ozoneLimitChange, completionTime, err := k.UpdateIndexingNodeStake(ctx, networkAddr, ownerAddress, *msg.StakeDelta, msg.IncrStake) if err != nil { return nil, err diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 5a9a7d00..97567317 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -100,11 +100,15 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc } // sub coins from owner's wallet - hasCoin := k.bankKeeper.HasCoins(ctx, ownerAddr, coins) + hasCoin := k.bankKeeper.HasBalance(ctx, ownerAddr, tokenToAdd) if !hasCoin { return sdk.ZeroInt(), types.ErrInsufficientBalance } - _, err = k.bankKeeper.SubtractCoins(ctx, ownerAddr, coins) + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddr, types.ModuleName, coins) + if err != nil { + return sdk.ZeroInt(), err + } + err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins) if err != nil { return sdk.ZeroInt(), err } @@ -198,7 +202,11 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re // deduct slashing amount first coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc - _, err := k.bankKeeper.AddCoins(ctx, resourceNode.OwnerAddress, coins) + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, coins) + if err != nil { + return err + } + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { return err } @@ -303,7 +311,7 @@ func (k Keeper) UpdateResourceNodeStake(ctx sdk.Context, networkAddr stratos.Sds func (k Keeper) SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(token) + bz := k.cdc.MustMarshalLengthPrefixed(&token) store.Set(types.ResourceNodeBondedTokenKey, bz) } @@ -313,13 +321,13 @@ func (k Keeper) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { if bz == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &token) + k.cdc.MustUnmarshalLengthPrefixed(bz, &token) return token } func (k Keeper) SetResourceNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(token) + bz := k.cdc.MustMarshalLengthPrefixed(&token) store.Set(types.ResourceNodeNotBondedTokenKey, bz) } @@ -329,6 +337,6 @@ func (k Keeper) GetResourceNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) if bz == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &token) + k.cdc.MustUnmarshalLengthPrefixed(bz, &token) return token } diff --git a/x/register/types/expected_keepers.go b/x/register/types/expected_keepers.go index 364b7f6c..481a0160 100644 --- a/x/register/types/expected_keepers.go +++ b/x/register/types/expected_keepers.go @@ -38,6 +38,7 @@ type AccountKeeper interface { // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { + HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins @@ -45,10 +46,13 @@ type BankKeeper interface { GetSupply(ctx sdk.Context, denom string) sdk.Coin + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx sdk.Context, senderPool, recipientPool string, amt sdk.Coins) error UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error } From 1a9cf8265627165d393320b4f2398ff7c3f8f930 Mon Sep 17 00:00:00 2001 From: jialbai Date: Thu, 5 May 2022 16:28:03 -0400 Subject: [PATCH 022/113] - qb-1163: fix node.IsSuspended() --- x/register/keeper/indexing_node.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 544cf23b..61f77588 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -92,7 +92,7 @@ func (k Keeper) GetAllValidIndexingNodes(ctx sdk.Context) (indexingNodes []types for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) - if !node.IsSuspended() && node.GetStatus().Equal(stakingtypes.Bonded) { + if !node.GetSuspend() && node.GetStatus() == stakingtypes.Bonded { indexingNodes = append(indexingNodes, node) } } From 8148a037b7fe64362843bc8f2cc5df8659ebdee2 Mon Sep 17 00:00:00 2001 From: Xiong Date: Fri, 6 May 2022 14:54:56 -0400 Subject: [PATCH 023/113] bug fix & using ustos denom unit for evm --- client/keys/add.go | 5 +- cmd/stchaincli/faucet.go | 504 ------------------------ cmd/stchaincli/main.go | 182 --------- cmd/stchaind/main.go | 16 +- cmd/stchaind/root.go | 33 +- rpc/ethereum/backend/backend.go | 5 + rpc/ethereum/backend/utils.go | 24 ++ rpc/ethereum/namespaces/eth/api.go | 22 +- rpc/ethereum/namespaces/personal/api.go | 2 +- server/flags/flags.go | 4 +- server/start.go | 2 +- types/address.go | 233 +++++------ types/bech32/legacybech32/pk.go | 72 ++++ types/coin.go | 17 +- types/config.go | 31 +- types/utils.go | 40 ++ x/evm/keeper/keeper.go | 4 +- x/evm/types/params.go | 25 +- 18 files changed, 334 insertions(+), 887 deletions(-) delete mode 100644 cmd/stchaincli/faucet.go delete mode 100644 cmd/stchaincli/main.go create mode 100644 types/bech32/legacybech32/pk.go create mode 100644 types/utils.go diff --git a/client/keys/add.go b/client/keys/add.go index e356f8bf..f34862cc 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -7,7 +7,6 @@ import ( "fmt" "sort" - "github.com/cosmos/go-bip39" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -19,8 +18,10 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/go-bip39" stratoshd "github.com/stratosnet/stratos-chain/crypto/hd" + stratos "github.com/stratosnet/stratos-chain/types" ) const ( @@ -76,7 +77,7 @@ Example: f.Bool(flagNoBackup, false, "Don't print out seed phrase (if others are watching the terminal)") f.Bool(flags.FlagDryRun, false, "Perform action, but don't add key to local keystore") f.String(flagHDPath, "", "Manual HD Path derivation (overrides BIP44 config)") - f.Uint32(flagCoinType, sdk.GetConfig().GetCoinType(), "coin type number for HD derivation") + f.Uint32(flagCoinType, stratos.GetConfig().GetCoinType(), "coin type number for HD derivation") f.Uint32(flagAccount, 0, "Account number for HD derivation") f.Uint32(flagIndex, 0, "Address index number for HD derivation") f.String(flags.FlagKeyAlgorithm, string(stratoshd.EthSecp256k1Type), "Key signing algorithm to generate keys for") diff --git a/cmd/stchaincli/faucet.go b/cmd/stchaincli/faucet.go deleted file mode 100644 index b2775e01..00000000 --- a/cmd/stchaincli/faucet.go +++ /dev/null @@ -1,504 +0,0 @@ -package main - -//import ( -// "bufio" -// "fmt" -// "net" -// "net/http" -// "os" -// "os/signal" -// "strconv" -// "strings" -// "sync" -// "syscall" -// "time" -// -// "github.com/ReneKroon/ttlcache/v2" -// "github.com/cosmos/cosmos-sdk/client/context" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/client/input" -// "github.com/cosmos/cosmos-sdk/client/keys" -// "github.com/cosmos/cosmos-sdk/codec" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/types/rest" -// "github.com/cosmos/cosmos-sdk/x/auth" -// "github.com/cosmos/cosmos-sdk/x/auth/client/utils" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// "github.com/cosmos/cosmos-sdk/x/bank" -// "github.com/gorilla/mux" -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// "github.com/tendermint/tendermint/libs/cli" -//) -// -//const ( -// flagFundFrom = "from" // optional -// flagAmt = "amt" // denom fixed as ustos -// flagPort = "port" -// flagChainId = "chain-id" -// flagAddrCap = "addr-cap" -// flagIpCap = "ip-cap" -// -// defaultOutputFlag = "text" -// defaultKeyringBackend = "test" -// defaultDenom = "ustos" -// defaultChainId = "test-chain" -// defaultPort = "26600" -// defaultAddrCap = 1 -// defaultIpCap = 3 -// capDuration = 60 // in minutes -// -// maxAmtFaucet = 100000000000 -// requestInterval = 100 * time.Millisecond -//) -// -//// used in request channel -//type FaucetReq struct { -// FromAddress sdk.AccAddress -// FromName string -// From string -// -// ToAddr sdk.AccAddress -// resChan chan FaucetRsp -// Index int -//} -// -//// used in response channel -//type FaucetRsp struct { -// ErrorMsg string -// TxResponse sdk.TxResponse -// Seq uint64 -//} -// -//// used for restful response -//type RestFaucetRsp struct { -// ErrorMsg string -// TxResponse sdk.TxResponse -//} -// -//type FaucetToMiddleware struct { -// Cap int // maximum faucet cap to an individual addr during an hour -// AddrCache ttlcache.SimpleCache -//} -// -//type FromIpMiddleware struct { -// Cap int // maximum accessing times during an hour -// IpCache ttlcache.SimpleCache -//} -// -//func (ftm *FaucetToMiddleware) Middleware(h http.Handler) http.Handler { -// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// vars := mux.Vars(r) -// addr := vars["address"] -// if ftm.checkCap(addr) { -// h.ServeHTTP(w, r) -// } else { -// w.WriteHeader(http.StatusTooManyRequests) -// w.Write([]byte("Faucet request to address [" + addr + "] exceeds hourly cap (" + strconv.Itoa(ftm.Cap) + " request(s) per hour)")) -// } -// }) -//} -// -//func (ftm *FaucetToMiddleware) checkCap(toAddr string) bool { -// val, _ := ftm.AddrCache.Get(toAddr) -// if val == nil { -// ftm.AddrCache.Set(toAddr, 1) -// return true -// } -// -// if val.(int) >= ftm.Cap { -// return false -// } -// ftm.AddrCache.Set(toAddr, val.(int)+1) -// return true -//} -// -//func (fim *FromIpMiddleware) Middleware(h http.Handler) http.Handler { -// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// realIp := getRealAddr(r) -// if fim.checkCap(realIp) { -// h.ServeHTTP(w, r) -// } else { -// fmt.Printf(" ********** request from %s breached ip cap\n", realIp) -// w.WriteHeader(http.StatusTooManyRequests) -// w.Write([]byte("Faucet request from Ip " + realIp + " exceeds hourly cap (" + strconv.Itoa(fim.Cap) + " request(s) per hour)!")) -// } -// }) -//} -// -//func (fim *FromIpMiddleware) checkCap(fromIp string) bool { -// val, _ := fim.IpCache.Get(fromIp) -// if val == nil { -// fim.IpCache.Set(fromIp, 1) -// return true -// } -// -// if val.(int) >= fim.Cap { -// return false -// } -// fim.IpCache.Set(fromIp, val.(int)+1) -// return true -//} -// -//// global to load command line args -//var ( -// faucetServices = make([]FaucetService, 0) -// faucetPort = defaultPort -//) -// -//// struct to hold the command-line args -//type FaucetService struct { -// fromAddress sdk.AccAddress -// fromName string -// from string -// coins sdk.Coins -// seqInfo SeqInfo -//} -// -//type ServiceIndex struct { -// nextServiceIndex int -// lenOfService int -// mux sync.Mutex -//} -// -//func (si *ServiceIndex) getIndexAndScrollNext() int { -// if si.lenOfService < 1 { -// return 0 -// } -// si.mux.Lock() -// defer si.mux.Unlock() -// ret := si.nextServiceIndex -// if si.nextServiceIndex < si.lenOfService-1 { -// si.nextServiceIndex += 1 -// } else { -// si.nextServiceIndex = 0 -// } -// return ret -//} -// -//type SeqInfo struct { -// lastSuccSeq int -// startSeq int -// mu sync.Mutex -//} -// -//func (si *SeqInfo) incrLastSuccSeq(succSeq uint64) { -// si.mu.Lock() -// defer si.mu.Unlock() -// if si.lastSuccSeq < int(succSeq) { -// si.lastSuccSeq = int(succSeq) -// } -//} -// -//func (si *SeqInfo) getNewSeq(newStartSeq int) int { -// si.mu.Lock() -// defer si.mu.Unlock() -// -// if si.lastSuccSeq < newStartSeq-1 { -// si.lastSuccSeq = newStartSeq - 1 -// return newStartSeq -// } else { -// return si.lastSuccSeq + 1 -// } -//} -// -//func FaucetJobFromCh(faucetReq *chan FaucetReq, cliCtx context.CLIContext, txBldr authtypes.TxBuilder, from sdk.AccAddress, coin sdk.Coin, quit chan os.Signal) { -// for { -// select { -// case sig := <-quit: -// fmt.Printf("**** faucet service (sender[%s]) quit after receiving signal[%s] ****\n", from, sig.String()) -// os.Exit(0) -// case fReq := <-*faucetReq: -// resChan := fReq.resChan -// // update cliCtx -// cliCtx := cliCtx.WithFromName(fReq.FromName).WithFrom(fReq.From).WithFromAddress(fReq.FromAddress) -// -// // get latest seq and accountNumber by FromAddress -// accountNumber, latestSeq, err := authtypes.NewAccountRetriever(cliCtx).GetAccountNumberSequence(fReq.FromAddress) -// if err != nil { -// faucetRsp := FaucetRsp{ErrorMsg: "Node is under maintenance, please try again later!"} -// resChan <- faucetRsp -// continue -// } -// fmt.Printf("----sender[%s] senderIdx[%d] accNum[%d] lastSeq[%d] -----\n", cliCtx.From, fReq.Index, int(accountNumber), int(latestSeq)) -// newSeq := faucetServices[fReq.Index].seqInfo.getNewSeq(int(latestSeq)) -// err = doTransfer(cliCtx, -// txBldr. -// WithAccountNumber(accountNumber). -// WithSequence(uint64(newSeq)). -// WithChainID(viper.GetString(flags.FlagChainID)). -// WithGas(uint64(400000)). -// WithMemo(strconv.Itoa(newSeq)), -// fReq.ToAddr, fReq.FromAddress, coin, &resChan) -// if err != nil { -// faucetRsp := FaucetRsp{ErrorMsg: err.Error()} -// resChan <- faucetRsp -// } -// } -// } -//} -// -//// GetFaucetCmd returns faucet cobra Command -//func GetFaucetCmd(cdc *codec.Codec) *cobra.Command { -// -// cmd := &cobra.Command{ -// Use: "faucet", -// Short: "Run a faucet server", -// Args: cobra.RangeArgs(0, 7), -// RunE: func(cmd *cobra.Command, args []string) (err error) { -// if !viper.IsSet(flagFundFrom) { -// return fmt.Errorf("fund-from not specified") -// } -// if !viper.IsSet(flags.FlagChainID) { -// return fmt.Errorf("chain-id not specified") -// } -// if !viper.IsSet(flags.FlagKeyringBackend) { -// viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) -// } -// -// addrCap := viper.GetInt(flagAddrCap) -// ipCap := viper.GetInt(flagIpCap) -// -// fmt.Print("Set hourly addrCap = " + strconv.Itoa(addrCap) + ", hourly ipCap = " + strconv.Itoa(ipCap)) -// -// faucetToCache := ttlcache.NewCache() -// faucetToCache.SetTTL(capDuration * time.Minute) -// faucetToCache.SkipTTLExtensionOnHit(true) -// faucetToCache.SetCacheSizeLimit(65535) -// ftm := FaucetToMiddleware{AddrCache: faucetToCache, Cap: addrCap} -// -// fromIpCache := ttlcache.NewCache() -// fromIpCache.SetTTL(capDuration * time.Minute) -// fromIpCache.SkipTTLExtensionOnHit(true) -// fromIpCache.SetCacheSizeLimit(65535) -// fim := FromIpMiddleware{IpCache: fromIpCache, Cap: ipCap} -// -// // parse coins to transfer -// var toTransferAmt int -// if toTransferAmt = viper.GetInt(flagAmt); toTransferAmt <= 0 || toTransferAmt > maxAmtFaucet { -// return fmt.Errorf("invalid amount in faucet") -// } -// coin := sdk.Coin{Amount: sdk.NewInt(int64(toTransferAmt)), Denom: defaultDenom} -// -// // parse funding accs -// fromAddressesStr := viper.GetString(flagFundFrom) -// fundAccs := strings.Split(fromAddressesStr, ",") -// if len(fundAccs) < 1 { -// return fmt.Errorf("at least 1 funding acc need to be specified for faucet") -// } -// inBuf := bufio.NewReader(cmd.InOrStdin()) -// faucetReqChList := make([]chan FaucetReq, 0) -// chQuitSlice := make([]chan os.Signal, 0) -// for _, acc := range fundAccs { -// fromAddress, fromName, err := context.GetFromFields(inBuf, acc, false) -// if err != nil { -// return fmt.Errorf("failed to parse bech32 address fro FROM Address: %w", err) -// } -// -// service := FaucetService{ -// fromAddress: fromAddress, -// fromName: fromName, -// from: acc, -// coins: sdk.Coins{coin}, -// seqInfo: SeqInfo{startSeq: 0, lastSuccSeq: 0}, -// } -// faucetServices = append(faucetServices, service) -// // new reqCh for service -// reqCh := make(chan FaucetReq, 10000) -// faucetReqChList = append(faucetReqChList, reqCh) -// -// // new quit signal -// quit := make(chan os.Signal, 1) -// signal.Notify(quit, -// syscall.SIGTERM, -// syscall.SIGINT, -// syscall.SIGQUIT, -// syscall.SIGKILL, -// syscall.SIGHUP, -// ) -// chQuitSlice = append(chQuitSlice, quit) -// } -// if len(faucetServices) != len(faucetReqChList) { -// return fmt.Errorf("failed to setup context for each funding accs") -// } -// //fmt.Printf("FaucetServices are [%v]", faucetServices) -// // start threads -// txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) -// viper.Set(flags.FlagSkipConfirmation, true) -// viper.Set(cli.OutputFlag, defaultOutputFlag) -// -// cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, faucetServices[0].fromAddress.String()).WithCodec(cdc) -// -// // setup port -// portFromCmd := viper.GetString(flagPort) -// if len(portFromCmd) > 0 { -// faucetPort = portFromCmd -// } -// fmt.Print("\nfunding address: ", "addr", fromAddressesStr) -// fmt.Print("\nStarting faucet...") -// // listen to localhost:faucetPort -// listener, err := net.Listen("tcp", ":"+faucetPort) -// fmt.Print("\nlisten to [" + ":" + faucetPort + "]\n") -// -// // init serviceIndex -// serviceIndex := ServiceIndex{ -// nextServiceIndex: 0, -// lenOfService: len(faucetServices), -// } -// -// // router -// r := mux.NewRouter() -// // health check -// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { -// w.WriteHeader(http.StatusOK) -// w.Write([]byte("ok\n")) -// }) -// //faucetReqCh := make(chan FaucetReq, 10000) -// //faucet -// r.HandleFunc("/faucet/{address}", func(writer http.ResponseWriter, request *http.Request) { -// vars := mux.Vars(request) -// addr := vars["address"] -// remoteIp := getRealAddr(request) -// toAddr, err := sdk.AccAddressFromBech32(addr) -// if err != nil { -// writer.WriteHeader(http.StatusBadRequest) -// writer.Write([]byte(err.Error())) -// } -// // select a context (bonded with funding acc) -// reqIndex := serviceIndex.getIndexAndScrollNext() -// fmt.Printf("get request from ip [%s], faucet to account [%s], senderIdx[%d]\n", remoteIp, addr, reqIndex) -// resChan := make(chan FaucetRsp) -// faucetReq := FaucetReq{ -// FromAddress: faucetServices[reqIndex].fromAddress, -// FromName: faucetServices[reqIndex].fromName, -// From: faucetServices[reqIndex].from, -// ToAddr: toAddr, -// resChan: resChan, -// Index: reqIndex, -// } -// faucetReqChList[reqIndex] <- faucetReq -// -// faucetRsp := <-resChan -// if int(faucetRsp.TxResponse.Code) < 1 && len(faucetRsp.ErrorMsg) == 0 { -// // sigverify pass -// faucetServices[reqIndex].seqInfo.incrLastSuccSeq(faucetRsp.Seq) -// } -// fmt.Println("tx send=", faucetRsp.TxResponse.TxHash, ", height=", faucetRsp.TxResponse.Height, ", errorMsg=", faucetRsp.ErrorMsg, ", ip=", remoteIp, ", acc=", addr) -// restRsp := &RestFaucetRsp{ErrorMsg: faucetRsp.ErrorMsg, TxResponse: faucetRsp.TxResponse} -// rest.PostProcessResponseBare(writer, cliCtx, restRsp) -// return -// }).Methods("POST") -// // ipCap check has higher priority than toAddrCap -// r.Use(fim.Middleware) -// r.Use(ftm.Middleware) -// -// for i, _ := range faucetServices { -// go FaucetJobFromCh(&faucetReqChList[i], cliCtx, txBldr, faucetServices[i].fromAddress, coin, chQuitSlice[i]) -// } -// //start the server -// err = http.Serve(listener, r) -// if err != nil { -// fmt.Println(err.Error()) -// } -// // print stats -// fmt.Println("####################################################################") -// fmt.Println("################ Terminating faucet ##################") -// fmt.Println("####################################################################") -// return nil -// }, -// } -// -// cmd.Flags().String(flags.FlagKeyringBackend, defaultKeyringBackend, "Select keyring's backend (os|file|test)") -// cmd.Flags().String(flagAmt, "", "amt to transfer in faucet") -// cmd.Flags().String(flagFundFrom, "", "fund from address") -// cmd.Flags().String(flagPort, "26600", "port of faucet server") -// cmd.Flags().Int(flagAddrCap, defaultAddrCap, "hourly cap of faucet to a particular account address") -// cmd.Flags().Int(flagIpCap, defaultIpCap, "hourly cap of faucet from a particular IP") -// -// return cmd -//} -// -//func doTransfer(cliCtx context.CLIContext, txBldr authtypes.TxBuilder, to sdk.AccAddress, from sdk.AccAddress, coin sdk.Coin, resChan *chan FaucetRsp) error { -// //// build and sign the transaction, then broadcast to Tendermint -// msg := bank.NewMsgSend(from, to, sdk.Coins{coin}) -// msgs := []sdk.Msg{msg} -// txBldr, err := utils.PrepareTxBuilder(txBldr, cliCtx) -// if err != nil { -// return err -// } -// -// fromName := cliCtx.GetFromName() -// -// if txBldr.SimulateAndExecute() || cliCtx.Simulate { -// txBldr, err = utils.EnrichWithGas(txBldr, cliCtx, msgs) -// if err != nil { -// return err -// } -// -// gasEst := utils.GasEstimateResponse{GasEstimate: txBldr.Gas()} -// _, _ = fmt.Fprintf(os.Stderr, "%s\n", gasEst.String()) -// } -// -// if !cliCtx.SkipConfirm { -// stdSignMsg, err := txBldr.BuildSignMsg(msgs) -// if err != nil { -// return err -// } -// -// var json []byte -// if viper.GetBool(flags.FlagIndentResponse) { -// json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ") -// if err != nil { -// panic(err) -// } -// } else { -// json = cliCtx.Codec.MustMarshalJSON(stdSignMsg) -// } -// -// _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", json) -// -// buf := bufio.NewReader(os.Stdin) -// ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf) -// if err != nil || !ok { -// _, _ = fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction") -// return err -// } -// } -// // build and sign the transaction -// txBytes, err := txBldr.BuildAndSign(fromName, keys.DefaultKeyPass, msgs) -// if err != nil { -// return err -// } -// -// // broadcast to a Tendermint node -// res, err := cliCtx.BroadcastTxCommit(txBytes) -// if err != nil { -// return err -// } -// faucetRsp := FaucetRsp{TxResponse: res, Seq: txBldr.Sequence()} -// *resChan <- faucetRsp -// return nil -//} -// -//func getRealAddr(r *http.Request) string { -// remoteIP := "" -// // the default is the originating ip. but we try to find better options because this is almost -// // never the right IP -// if parts := strings.Split(r.RemoteAddr, ":"); len(parts) == 2 { -// remoteIP = parts[0] -// } -// // If we have a forwarded-for header, take the address from there -// if xff := strings.Trim(r.Header.Get("X-Forwarded-For"), ","); len(xff) > 0 { -// addrs := strings.Split(xff, ",") -// lastFwd := addrs[len(addrs)-1] -// if ip := net.ParseIP(lastFwd); ip != nil { -// remoteIP = ip.String() -// } -// // parse X-Real-Ip header -// } else if xri := r.Header.Get("X-Real-Ip"); len(xri) > 0 { -// if ip := net.ParseIP(xri); ip != nil { -// remoteIP = ip.String() -// } -// } -// return remoteIP -//} diff --git a/cmd/stchaincli/main.go b/cmd/stchaincli/main.go deleted file mode 100644 index bd9744b9..00000000 --- a/cmd/stchaincli/main.go +++ /dev/null @@ -1,182 +0,0 @@ -package main - -//import ( -// "fmt" -// "os" -// "path" -// -// "github.com/cosmos/cosmos-sdk/client" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/client/keys" -// "github.com/cosmos/cosmos-sdk/client/lcd" -// "github.com/cosmos/cosmos-sdk/client/rpc" -// "github.com/cosmos/cosmos-sdk/version" -// "github.com/cosmos/cosmos-sdk/x/auth" -// authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" -// authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" -// "github.com/cosmos/cosmos-sdk/x/bank" -// bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" -// govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli" -// reportcmd "github.com/stratosnet/stratos-chain/x/pot/client/cli" -// uploadcmd "github.com/stratosnet/stratos-chain/x/sds/client/cli" -// -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// -// "github.com/tendermint/go-amino" -// "github.com/tendermint/tendermint/libs/cli" -// -// "github.com/stratosnet/stratos-chain/app" -// // this line is used by starport scaffolding # 1 -//) -// -//func main() { -// // Configure cobra to sort commands -// cobra.EnableCommandSorting = false -// -// // Instantiate the codec for the command line application -// cdc := app.MakeCodec() -// -// app.SetConfig() -// -// // TODO: setup keybase, viper object, etc. to be passed into -// // the below functions and eliminate global vars, like we do -// // with the cdc -// -// rootCmd := &cobra.Command{ -// Use: "stchaincli", -// Short: "Command line interface for interacting with stratoschaind", -// } -// -// // Add --chain-id to persistent flags and mark it required -// rootCmd.PersistentFlags().String(flags.FlagChainID, "", "Chain ID of tendermint node") -// rootCmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error { -// return initConfig(rootCmd) -// } -// -// // Construct Root Command -// rootCmd.AddCommand( -// rpc.StatusCommand(), -// client.ConfigCmd(app.DefaultCLIHome), -// queryCmd(cdc), -// txCmd(cdc), -// flags.LineBreak, -// lcd.ServeCommand(cdc, registerRoutes), -// flags.LineBreak, -// GetFaucetCmd(cdc), -// flags.LineBreak, -// keys.Commands(), -// flags.LineBreak, -// version.Cmd, -// flags.NewCompletionCmd(rootCmd, true), -// -// flags.LineBreak, -// ) -// -// // Add flags and prefix all env exposed with AA -// executor := cli.PrepareMainCmd(rootCmd, "AA", app.DefaultCLIHome) -// -// err := executor.Execute() -// if err != nil { -// fmt.Printf("Failed executing CLI command: %s, exiting...\n", err) -// os.Exit(1) -// } -//} -// -//func queryCmd(cdc *amino.Codec) *cobra.Command { -// queryCmd := &cobra.Command{ -// Use: "query", -// Aliases: []string{"q"}, -// Short: "Querying subcommands", -// } -// -// queryCmd.AddCommand( -// authcmd.GetAccountCmd(cdc), -// flags.LineBreak, -// rpc.ValidatorCommand(cdc), -// rpc.BlockCommand(), -// authcmd.QueryTxsByEventsCmd(cdc), -// authcmd.QueryTxCmd(cdc), -// flags.LineBreak, -// ) -// -// // add modules' query commands -// app.ModuleBasics.AddQueryCommands(queryCmd, cdc) -// -// return queryCmd -//} -// -//func txCmd(cdc *amino.Codec) *cobra.Command { -// txCmd := &cobra.Command{ -// Use: "tx", -// Short: "Transactions subcommands", -// } -// -// txCmd.AddCommand( -// bankcmd.SendTxCmd(cdc), -// flags.LineBreak, -// uploadcmd.FileUploadTxCmd(cdc), -// reportcmd.VolumeReportCmd(cdc), -// flags.LineBreak, -// govcmd.GetCmdSubmitProposal(cdc), -// govcmd.GetCmdDeposit(cdc), -// govcmd.GetCmdVote(cdc), -// flags.LineBreak, -// authcmd.GetSignCommand(cdc), -// authcmd.GetMultiSignCommand(cdc), -// flags.LineBreak, -// authcmd.GetBroadcastCommand(cdc), -// authcmd.GetEncodeCommand(cdc), -// authcmd.GetDecodeCommand(cdc), -// flags.LineBreak, -// ) -// -// // add modules' tx commands -// app.ModuleBasics.AddTxCommands(txCmd, cdc) -// -// // remove auth and bank commands as they're mounted under the root tx command -// var cmdsToRemove []*cobra.Command -// -// for _, cmd := range txCmd.Commands() { -// if cmd.Use == auth.ModuleName || cmd.Use == bank.ModuleName { -// cmdsToRemove = append(cmdsToRemove, cmd) -// } -// } -// -// txCmd.RemoveCommand(cmdsToRemove...) -// -// return txCmd -//} -// -//// registerRoutes registers the routes from the different modules for the LCD. -//// NOTE: details on the routes added for each module are in the module documentation -//// NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go -//func registerRoutes(rs *lcd.RestServer) { -// client.RegisterRoutes(rs.CliCtx, rs.Mux) -// authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) -// app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) -// // this line is used by starport scaffolding # 2 -//} -// -//func initConfig(cmd *cobra.Command) error { -// home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) -// if err != nil { -// return err -// } -// -// cfgFile := path.Join(home, "config", "config.toml") -// if _, err := os.Stat(cfgFile); err == nil { -// viper.SetConfigFile(cfgFile) -// -// if err := viper.ReadInConfig(); err != nil { -// return err -// } -// } -// if err := viper.BindPFlag(flags.FlagChainID, cmd.PersistentFlags().Lookup(flags.FlagChainID)); err != nil { -// return err -// } -// if err := viper.BindPFlag(cli.EncodingFlag, cmd.PersistentFlags().Lookup(cli.EncodingFlag)); err != nil { -// return err -// } -// return viper.BindPFlag(cli.OutputFlag, cmd.PersistentFlags().Lookup(cli.OutputFlag)) -//} diff --git a/cmd/stchaind/main.go b/cmd/stchaind/main.go index 86338297..6e239725 100644 --- a/cmd/stchaind/main.go +++ b/cmd/stchaind/main.go @@ -5,13 +5,15 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/app" stratos "github.com/stratosnet/stratos-chain/types" ) func main() { - setupConfig() + registerDenoms() + rootCmd, _ := NewRootCmd() if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { switch e := err.(type) { @@ -24,7 +26,13 @@ func main() { } } -func setupConfig() { - config := stratos.GetConfig() - config.Seal() +// RegisterDenoms registers the base and display denominations to the SDK. +func registerDenoms() { + if err := sdk.RegisterDenom(stratos.DisplayDenom, sdk.OneDec()); err != nil { + panic(err) + } + + if err := sdk.RegisterDenom(stratos.USTOS, sdk.NewDecWithPrec(1, stratos.BaseDenomUnit)); err != nil { + panic(err) + } } diff --git a/cmd/stchaind/root.go b/cmd/stchaind/root.go index b5d102d7..b7643b11 100644 --- a/cmd/stchaind/root.go +++ b/cmd/stchaind/root.go @@ -19,7 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/server" + sdkserver "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/cosmos/cosmos-sdk/snapshots" @@ -35,6 +35,7 @@ import ( stratosclient "github.com/stratosnet/stratos-chain/client" "github.com/stratosnet/stratos-chain/crypto/hd" "github.com/stratosnet/stratos-chain/encoding" + "github.com/stratosnet/stratos-chain/server" servercfg "github.com/stratosnet/stratos-chain/server/config" srvflags "github.com/stratosnet/stratos-chain/server/flags" stratos "github.com/stratosnet/stratos-chain/types" @@ -82,11 +83,11 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { customAppTemplate, customAppConfig := servercfg.AppConfig(stratos.USTOS) - return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig) + return sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig) }, } - cfg := sdk.GetConfig() + cfg := stratos.GetConfig() cfg.Seal() initRootCmd(rootCmd, encodingConfig) @@ -130,7 +131,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { } // add rosetta - rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) + rootCmd.AddCommand(sdkserver.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) } func addModuleInitFlags(startCmd *cobra.Command) { @@ -195,16 +196,16 @@ type appCreator struct { func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { var cache sdk.MultiStorePersistentCache - if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { + if cast.ToBool(appOpts.Get(sdkserver.FlagInterBlockCache)) { cache = store.NewCommitKVStoreCacheManager() } skipUpgradeHeights := make(map[int64]bool) - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + for _, h := range cast.ToIntSlice(appOpts.Get(sdkserver.FlagUnsafeSkipUpgrades)) { skipUpgradeHeights[int64(h)] = true } - pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts) + pruningOpts, err := sdkserver.GetPruningOptionsFromFlags(appOpts) if err != nil { panic(err) } @@ -222,20 +223,20 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a return app.NewInitApp( logger, db, traceStore, true, skipUpgradeHeights, cast.ToString(appOpts.Get(flags.FlagHome)), - cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), + cast.ToUint(appOpts.Get(sdkserver.FlagInvCheckPeriod)), a.encCfg, appOpts, baseapp.SetPruning(pruningOpts), - baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), - baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), - baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), - baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), + baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(sdkserver.FlagMinGasPrices))), + baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(sdkserver.FlagHaltHeight))), + baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(sdkserver.FlagHaltTime))), + baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(sdkserver.FlagMinRetainBlocks))), baseapp.SetInterBlockCache(cache), - baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), - baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), + baseapp.SetTrace(cast.ToBool(appOpts.Get(sdkserver.FlagTrace))), + baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(sdkserver.FlagIndexEvents))), baseapp.SetSnapshotStore(snapshotStore), - baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))), - baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))), + baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(sdkserver.FlagStateSyncSnapshotInterval))), + baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent))), ) } diff --git a/rpc/ethereum/backend/backend.go b/rpc/ethereum/backend/backend.go index f6d9b766..1c45e58f 100644 --- a/rpc/ethereum/backend/backend.go +++ b/rpc/ethereum/backend/backend.go @@ -782,6 +782,11 @@ func (e *EVMBackend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash return common.Hash{}, err } + args, err = e.parseGasUnit(args) + if err != nil { + return common.Hash{}, err + } + msg := args.ToTransaction() if err := msg.ValidateBasic(); err != nil { e.logger.Debug("tx failed basic validation", "error", err.Error()) diff --git a/rpc/ethereum/backend/utils.go b/rpc/ethereum/backend/utils.go index e3a1ddd2..cb026967 100644 --- a/rpc/ethereum/backend/utils.go +++ b/rpc/ethereum/backend/utils.go @@ -18,6 +18,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + stratos "github.com/stratosnet/stratos-chain/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) @@ -253,3 +254,26 @@ func ParseTxLogsFromEvent(event abci.Event) ([]*ethtypes.Log, error) { } return evmtypes.LogsToEthereum(logs), nil } + +func (e *EVMBackend) parseGasUnit(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) { + var err error + + args.GasPrice, err = stratos.WeiToUstosBigInt(args.GasPrice) + if err != nil { + return args, err + } + args.MaxFeePerGas, err = stratos.WeiToUstosBigInt(args.MaxFeePerGas) + if err != nil { + return args, err + } + args.MaxPriorityFeePerGas, err = stratos.WeiToUstosBigInt(args.MaxPriorityFeePerGas) + if err != nil { + return args, err + } + args.Value, err = stratos.WeiToUstosBigInt(args.Value) + if err != nil { + return args, err + } + + return args, nil +} diff --git a/rpc/ethereum/namespaces/eth/api.go b/rpc/ethereum/namespaces/eth/api.go index 4d6b478c..d26159d7 100644 --- a/rpc/ethereum/namespaces/eth/api.go +++ b/rpc/ethereum/namespaces/eth/api.go @@ -7,18 +7,12 @@ import ( "math" "math/big" - "github.com/stratosnet/stratos-chain/ethereum/eip712" - - "github.com/ethereum/go-ethereum/signer/core/apitypes" - - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pkg/errors" "github.com/spf13/viper" + "github.com/tendermint/tendermint/libs/log" tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" @@ -33,9 +27,13 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/signer/core/apitypes" "github.com/stratosnet/stratos-chain/crypto/hd" + "github.com/stratosnet/stratos-chain/ethereum/eip712" "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" stratos "github.com/stratosnet/stratos-chain/types" @@ -278,6 +276,12 @@ func (e *PublicAPI) GetBalance(address common.Address, blockNrOrHash rpctypes.Bl return nil, errors.New("invalid balance") } + //return balance using unit "wei" + val, err = stratos.UstosToWei(val) + if err != nil { + return nil, err + } + return (*hexutil.Big)(val.BigInt()), nil } @@ -558,8 +562,8 @@ func checkTxFee(gasPrice *big.Int, gas uint64, cap float64) error { return nil } totalfee := new(big.Float).SetInt(new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(gas))) - // 1 photon in 10^18 aphoton - oneToken := new(big.Float).SetInt(big.NewInt(params.Ether)) + // 1 stos in 10^9 ustos + oneToken := new(big.Float).SetFloat64(math.Pow10(stratos.BaseDenomUnit)) // quo = rounded(x/y) feeEth := new(big.Float).Quo(totalfee, oneToken) // no need to check error from parsing diff --git a/rpc/ethereum/namespaces/personal/api.go b/rpc/ethereum/namespaces/personal/api.go index 18227479..e2a26e00 100644 --- a/rpc/ethereum/namespaces/personal/api.go +++ b/rpc/ethereum/namespaces/personal/api.go @@ -35,7 +35,7 @@ type PrivateAccountAPI struct { // NewAPI creates an instance of the public Personal Eth API. func NewAPI(logger log.Logger, clientCtx client.Context, backend backend.Backend) *PrivateAccountAPI { - cfg := sdk.GetConfig() + cfg := stratos.GetConfig() basePath := cfg.GetFullBIP44Path() iterator, err := stratos.NewHDPathIterator(basePath, true) diff --git a/server/flags/flags.go b/server/flags/flags.go index 53b7ced3..a0513d41 100644 --- a/server/flags/flags.go +++ b/server/flags/flags.go @@ -62,8 +62,8 @@ const ( func AddTxFlags(cmd *cobra.Command) (*cobra.Command, error) { cmd.PersistentFlags().String(flags.FlagChainID, "testnet", "Specify Chain ID for sending Tx") cmd.PersistentFlags().String(flags.FlagFrom, "", "Name or address of private key with which to sign") - cmd.PersistentFlags().String(flags.FlagFees, "", "Fees to pay along with transaction; eg: 10aphoton") - cmd.PersistentFlags().String(flags.FlagGasPrices, "", "Gas prices to determine the transaction fee (e.g. 10aphoton)") + cmd.PersistentFlags().String(flags.FlagFees, "", "Fees to pay along with transaction; eg: 10ustos") + cmd.PersistentFlags().String(flags.FlagGasPrices, "", "Gas prices to determine the transaction fee (e.g. 10ustos)") cmd.PersistentFlags().String(flags.FlagNode, "tcp://localhost:26657", ": to tendermint rpc interface for this chain") cmd.PersistentFlags().Float64(flags.FlagGasAdjustment, flags.DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ") cmd.PersistentFlags().StringP(flags.FlagBroadcastMode, "b", flags.BroadcastSync, "Transaction broadcasting mode (sync|async|block)") diff --git a/server/start.go b/server/start.go index e52046ad..a5c42f9e 100644 --- a/server/start.go +++ b/server/start.go @@ -156,7 +156,7 @@ which accepts a path for the resulting pprof file. cmd.Flags().StringSlice(srvflags.JSONRPCAPI, config.GetDefaultAPINamespaces(), "Defines a list of JSON-RPC namespaces that should be enabled") cmd.Flags().String(srvflags.JSONRPCAddress, config.DefaultJSONRPCAddress, "the JSON-RPC server address to listen on") cmd.Flags().String(srvflags.JSONWsAddress, config.DefaultJSONRPCWsAddress, "the JSON-RPC WS server address to listen on") - cmd.Flags().Uint64(srvflags.JSONRPCGasCap, config.DefaultGasCap, "Sets a cap on gas that can be used in eth_call/estimateGas unit is aphoton (0=infinite)") + cmd.Flags().Uint64(srvflags.JSONRPCGasCap, config.DefaultGasCap, "Sets a cap on gas that can be used in eth_call/estimateGas unit is ustos (0=infinite)") cmd.Flags().Float64(srvflags.JSONRPCTxFeeCap, config.DefaultTxFeeCap, "Sets a cap on transaction fee that can be sent via the RPC APIs (1 = default 1 photon)") cmd.Flags().Int32(srvflags.JSONRPCFilterCap, config.DefaultFilterCap, "Sets the global cap for total number of filters that can be created") cmd.Flags().Duration(srvflags.JSONRPCEVMTimeout, config.DefaultEVMTimeout, "Sets a timeout used for eth_call (0=infinite)") diff --git a/types/address.go b/types/address.go index 4f48de4b..e98bb57a 100644 --- a/types/address.go +++ b/types/address.go @@ -2,7 +2,9 @@ package types import ( "bytes" + "encoding/hex" "encoding/json" + "errors" "fmt" "strings" @@ -10,163 +12,104 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" - - //tmamino "github.com/tendermint/go-amino" - "github.com/tendermint/tendermint/crypto" ) -// Bech32PubKeyType defines a string type alias for a Bech32 public key type. -type Bech32PubKeyType string - // Bech32 conversion constants const ( StratosBech32Prefix = "st" - Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" - Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" - Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" - Bech32PubKeyTypeSdsP2PPub Bech32PubKeyType = "sdsp2p" - - AccountPubKeyPrefix = StratosBech32Prefix + "pub" - ValidatorAddressPrefix = StratosBech32Prefix + "valoper" - ValidatorPubKeyPrefix = StratosBech32Prefix + "valoperpub" - ConsNodeAddressPrefix = StratosBech32Prefix + "valcons" - ConsNodePubKeyPrefix = StratosBech32Prefix + "valconspub" - SdsNodeP2PPubkeyPrefix = StratosBech32Prefix + "sdspub" - SdsNodeP2PAddressPrefix = StratosBech32Prefix + "sds" - - CoinType = 606 - - HDPath = "m/44'/606'/0'/0/0" + // PrefixSds is the prefix for sds keys + PrefixSds = "sds" + + // AccountAddressPrefix defines the Bech32 prefix of an account's address (st) + AccountAddressPrefix = StratosBech32Prefix + // AccountPubKeyPrefix defines the Bech32 prefix of an account's public key (stpub) + AccountPubKeyPrefix = StratosBech32Prefix + sdk.PrefixPublic + // ValidatorAddressPrefix defines the Bech32 prefix of a validator's operator address (stvaloper) + ValidatorAddressPrefix = StratosBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + // ValidatorPubKeyPrefix defines the Bech32 prefix of a validator's operator public key (stvaloperpub) + ValidatorPubKeyPrefix = StratosBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic + // ConsNodeAddressPrefix defines the Bech32 prefix of a consensus node address (stvalcons) + ConsNodeAddressPrefix = StratosBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + // ConsNodePubKeyPrefix defines the Bech32 prefix of a consensus node public key (stvalconspub) + ConsNodePubKeyPrefix = StratosBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic + // SdsNodeP2PPubkeyPrefix defines the Bech32 prefix of an sds account's public key (stsdspub) + SdsNodeP2PPubkeyPrefix = StratosBech32Prefix + PrefixSds + sdk.PrefixPublic + // SdsNodeP2PAddressPrefix defines the Bech32 prefix of an sds account's address (stsds) + SdsNodeP2PAddressPrefix = StratosBech32Prefix + PrefixSds ) -// Bech32ifyPubKey returns a Bech32 encoded string containing the appropriate -// prefix based on the key type provided for a given PublicKey. -func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) (string, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetConfig().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() - - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() +var _ sdk.Address = SdsAddress{} +var _ yaml.Marshaler = SdsAddress{} - case Bech32PubKeyTypeSdsP2PPub: - bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() - } +type SdsAddress []byte - return bech32.ConvertAndEncode(bech32Prefix, pubkey.Bytes()) +// SdsAddressFromHex creates an SdsAddress from a hex string. +func SdsAddressFromHex(address string) (addr SdsAddress, err error) { + bz, err := addressBytesFromHexString(address) + return SdsAddress(bz), err } -// GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with -// a given key type. -//func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (crypto.PubKey, error) { -// var bech32Prefix string -// -// switch pkt { -// case Bech32PubKeyTypeAccPub: -// bech32Prefix = GetConfig().GetBech32AccountPubPrefix() -// -// case Bech32PubKeyTypeValPub: -// bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() -// -// case Bech32PubKeyTypeConsPub: -// bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() -// -// case Bech32PubKeyTypeSdsP2PPub: -// bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() -// } -// -// bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) -// if err != nil { -// return nil, err -// } -// -// pk, err := tmamino.PubKeyFromBytes(bz) -// if err != nil { -// return nil, err -// } -// -// return pk, nil -//} +// AccAddressFromBech32 creates an SdsAddress from a Bech32 string. +func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { + if len(strings.TrimSpace(address)) == 0 { + return SdsAddress{}, errors.New("empty address string is not allowed") + } -type SdsAddress []byte + bech32PrefixSdsAddr := GetConfig().GetBech32SdsNodeP2PAddrPrefix() -var _ sdk.Address = SdsAddress{} + bz, err := sdk.GetFromBech32(address, bech32PrefixSdsAddr) + if err != nil { + return nil, err + } -func (a SdsAddress) Equals(addr sdk.Address) bool { - if a.Empty() && addr.Empty() { - return true + err = sdk.VerifyAddressFormat(bz) + if err != nil { + return nil, err } - return bytes.Equal(a.Bytes(), addr.Bytes()) + return SdsAddress(bz), nil } -func (a SdsAddress) Empty() bool { - if a == nil { +// Returns boolean for whether two SdsAddress are Equal +func (aa SdsAddress) Equals(aa2 sdk.Address) bool { + if aa.Empty() && aa2.Empty() { return true } - aa2 := SdsAddress{} - return bytes.Equal(a.Bytes(), aa2.Bytes()) -} - -func (a SdsAddress) Marshal() ([]byte, error) { - return a, nil -} - -func (a SdsAddress) MarshalJSON() ([]byte, error) { - return json.Marshal(a.String()) -} - -func (a SdsAddress) Bytes() []byte { - return a + return bytes.Equal(aa.Bytes(), aa2.Bytes()) } -func (a SdsAddress) String() string { - if a.Empty() { - return "" - } - - bech32PrefixSdsAddr := GetConfig().GetBech32SdsNodeP2PAddrPrefix() - - bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixSdsAddr, a.Bytes()) - if err != nil { - panic(err) - } - - return bech32Addr +// Returns boolean for whether a SdsAddress is empty +func (aa SdsAddress) Empty() bool { + return aa == nil || len(aa) == 0 } -func (a SdsAddress) Format(s fmt.State, verb rune) { - switch verb { - case 's': - s.Write([]byte(a.String())) - case 'p': - s.Write([]byte(fmt.Sprintf("%p", a))) - default: - s.Write([]byte(fmt.Sprintf("%X", []byte(a)))) - } +// Marshal returns the raw address bytes. It is needed for protobuf +// compatibility. +func (aa SdsAddress) Marshal() ([]byte, error) { + return aa, nil } // Unmarshal sets the address to the given data. It is needed for protobuf // compatibility. -func (a *SdsAddress) Unmarshal(data []byte) error { - *a = data +func (aa *SdsAddress) Unmarshal(data []byte) error { + *aa = data return nil } +// MarshalJSON marshals to JSON using Bech32. +func (aa SdsAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(aa.String()) +} + // MarshalYAML marshals to YAML using Bech32. -func (a SdsAddress) MarshalYAML() (interface{}, error) { - return a.String(), nil +func (aa SdsAddress) MarshalYAML() (interface{}, error) { + return aa.String(), nil } // UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (a *SdsAddress) UnmarshalJSON(data []byte) error { +func (aa *SdsAddress) UnmarshalJSON(data []byte) error { var s string err := json.Unmarshal(data, &s) @@ -174,7 +117,7 @@ func (a *SdsAddress) UnmarshalJSON(data []byte) error { return err } if s == "" { - *a = SdsAddress{} + *aa = SdsAddress{} return nil } @@ -183,19 +126,19 @@ func (a *SdsAddress) UnmarshalJSON(data []byte) error { return err } - *a = aa2 + *aa = aa2 return nil } // UnmarshalYAML unmarshals from JSON assuming Bech32 encoding. -func (a *SdsAddress) UnmarshalYAML(data []byte) error { +func (aa *SdsAddress) UnmarshalYAML(data []byte) error { var s string err := yaml.Unmarshal(data, &s) if err != nil { return err } if s == "" { - *a = SdsAddress{} + *aa = SdsAddress{} return nil } @@ -204,27 +147,47 @@ func (a *SdsAddress) UnmarshalYAML(data []byte) error { return err } - *a = aa2 + *aa = aa2 return nil } -// AccAddressFromBech32 creates an AccAddress from a Bech32 string. -func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { - if len(strings.TrimSpace(address)) == 0 { - return SdsAddress{}, nil +// Bytes returns the raw address bytes. +func (aa SdsAddress) Bytes() []byte { + return aa +} + +// String implements the Stringer interface. +func (aa SdsAddress) String() string { + if aa.Empty() { + return "" } bech32PrefixSdsAddr := GetConfig().GetBech32SdsNodeP2PAddrPrefix() - bz, err := sdk.GetFromBech32(address, bech32PrefixSdsAddr) + bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixSdsAddr, aa.Bytes()) if err != nil { - return nil, err + panic(err) } - err = sdk.VerifyAddressFormat(bz) - if err != nil { - return nil, err + return bech32Addr +} + +// Format implements the fmt.Formatter interface. +func (aa SdsAddress) Format(s fmt.State, verb rune) { + switch verb { + case 's': + s.Write([]byte(aa.String())) + case 'p': + s.Write([]byte(fmt.Sprintf("%p", aa))) + default: + s.Write([]byte(fmt.Sprintf("%X", []byte(aa)))) } +} - return SdsAddress(bz), nil +func addressBytesFromHexString(address string) ([]byte, error) { + if len(address) == 0 { + return nil, errors.New("decoding Bech32 address failed: must provide an address") + } + + return hex.DecodeString(address) } diff --git a/types/bech32/legacybech32/pk.go b/types/bech32/legacybech32/pk.go new file mode 100644 index 00000000..39bd0d9f --- /dev/null +++ b/types/bech32/legacybech32/pk.go @@ -0,0 +1,72 @@ +// Deprecated: The module provides legacy bech32 functions which will be removed in a future +// release. +package legacybech32 + +import ( + "github.com/cosmos/cosmos-sdk/codec/legacy" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" + + "github.com/stratosnet/stratos-chain/types" +) + +// TODO: when removing this package remove: +// + sdk:config.GetBech32AccountPubPrefix (and other related functions) +// + Bech32PrefixAccAddr and other related constants + +// Deprecated: Bech32PubKeyType defines a string type alias for a Bech32 public key type. +type Bech32PubKeyType string + +// Bech32 conversion constants +const ( + Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" + Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" + Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" + Bech32PubKeyTypeSdsP2PPub Bech32PubKeyType = "sdsp2p" +) + +// Deprecated: MarshalPubKey returns a Bech32 encoded string containing the appropriate +// prefix based on the key type provided for a given PublicKey. +func MarshalPubKey(pkt Bech32PubKeyType, pubkey cryptotypes.PubKey) (string, error) { + bech32Prefix := getPrefix(pkt) + return bech32.ConvertAndEncode(bech32Prefix, legacy.Cdc.MustMarshal(pubkey)) +} + +// Deprecated: MustMarshalPubKey calls MarshalPubKey and panics on error. +func MustMarshalPubKey(pkt Bech32PubKeyType, pubkey cryptotypes.PubKey) string { + res, err := MarshalPubKey(pkt, pubkey) + if err != nil { + panic(err) + } + + return res +} + +func getPrefix(pkt Bech32PubKeyType) string { + cfg := types.GetConfig() + switch pkt { + case Bech32PubKeyTypeAccPub: + return cfg.GetBech32AccountPubPrefix() + case Bech32PubKeyTypeValPub: + return cfg.GetBech32ValidatorPubPrefix() + case Bech32PubKeyTypeConsPub: + return cfg.GetBech32ConsensusPubPrefix() + case Bech32PubKeyTypeSdsP2PPub: + return cfg.GetBech32SdsNodeP2PPubPrefix() + } + + return "" +} + +// Deprecated: UnmarshalPubKey returns a PublicKey from a bech32-encoded PublicKey with +// a given key type. +func UnmarshalPubKey(pkt Bech32PubKeyType, pubkeyStr string) (cryptotypes.PubKey, error) { + bech32Prefix := getPrefix(pkt) + + bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) + if err != nil { + return nil, err + } + return legacy.PubKeyFromBytes(bz) +} diff --git a/types/coin.go b/types/coin.go index 978b0fbb..62fbdbe4 100644 --- a/types/coin.go +++ b/types/coin.go @@ -1,11 +1,22 @@ package types const ( + CoinType = 606 + + // DisplayDenom defines the denomination displayed to users in client applications. + DisplayDenom = "USTOS" + USTOS string = "ustos" - // BaseDenomUnit defines the base denomination unit for Photons. - // 1 photon = 1x10^{BaseDenomUnit} aphoton - BaseDenomUnit = 18 + //1 eth = 1x10^18 wei + EthDenomUnit = 18 + + // BaseDenomUnit defines the base denomination unit for stos. + // 1 stos = 1x10^{BaseDenomUnit} ustos + BaseDenomUnit = 9 + + // 1 ustos = 1x10^{DenomUnitDiff} wei + DenomUnitDiff = EthDenomUnit - BaseDenomUnit // DefaultGasPrice is default gas price for evm transactions DefaultGasPrice = 20 diff --git a/types/config.go b/types/config.go index 5a2a2f7b..63251490 100644 --- a/types/config.go +++ b/types/config.go @@ -2,6 +2,7 @@ package types import ( "context" + "fmt" "sync" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,11 +15,11 @@ const DefaultKeyringServiceName = "stratos" // Config is the structure that holds the SDK configuration parameters. // This could be used to initialize certain configuration parameters for the SDK. type Config struct { - fullFundraiserPath string bech32AddressPrefix map[string]string txEncoder sdk.TxEncoder addressVerifier func([]byte) error mtx sync.RWMutex + purpose uint32 coinType uint32 sealed bool sealedch chan struct{} @@ -32,11 +33,10 @@ var ( // New returns a new Config with default values. func NewConfig() *Config { - return &Config{ sealedch: make(chan struct{}), bech32AddressPrefix: map[string]string{ - "account_addr": StratosBech32Prefix, + "account_addr": AccountAddressPrefix, "validator_addr": ValidatorAddressPrefix, "consensus_addr": ConsNodeAddressPrefix, "account_pub": AccountPubKeyPrefix, @@ -45,9 +45,9 @@ func NewConfig() *Config { "sdsp2p_pub": SdsNodeP2PPubkeyPrefix, "sdsp2p_addr": SdsNodeP2PAddressPrefix, }, - coinType: CoinType, - fullFundraiserPath: HDPath, - txEncoder: nil, + purpose: sdk.Purpose, + coinType: CoinType, + txEncoder: nil, } } @@ -137,12 +137,6 @@ func (config *Config) SetCoinType(coinType uint32) { config.coinType = coinType } -// Set the FullFundraiserPath (BIP44Prefix) on the config -func (config *Config) SetFullFundraiserPath(fullFundraiserPath string) { - config.assertNotSealed() - config.fullFundraiserPath = fullFundraiserPath -} - // Seal seals the config such that the config state could not be modified further func (config *Config) Seal() *Config { @@ -151,7 +145,7 @@ func (config *Config) Seal() *Config { sdkCfg.SetBech32PrefixForValidator(config.GetBech32ValidatorAddrPrefix(), config.GetBech32ValidatorPubPrefix()) sdkCfg.SetBech32PrefixForConsensusNode(config.GetBech32ConsensusAddrPrefix(), config.GetBech32ConsensusPubPrefix()) sdkCfg.SetCoinType(config.GetCoinType()) - sdkCfg.SetFullFundraiserPath(config.GetFullFundraiserPath()) + sdkCfg.SetPurpose(config.GetPurpose()) sdkCfg.SetAddressVerifier(config.addressVerifier) sdkCfg.SetTxEncoder(config.txEncoder) sdkCfg.Seal() @@ -219,14 +213,19 @@ func (config *Config) GetAddressVerifier() func([]byte) error { return config.addressVerifier } +// GetPurpose returns the BIP-0044 Purpose code on the config. +func (config *Config) GetPurpose() uint32 { + return config.purpose +} + // GetCoinType returns the BIP-0044 CoinType code on the config. func (config *Config) GetCoinType() uint32 { return config.coinType } -// GetFullFundraiserPath returns the BIP44Prefix. -func (config *Config) GetFullFundraiserPath() string { - return config.fullFundraiserPath +// GetFullBIP44Path returns the BIP44Prefix. +func (config *Config) GetFullBIP44Path() string { + return fmt.Sprintf("m/%d'/%d'/0'/0/0", config.purpose, config.coinType) } func KeyringServiceName() string { diff --git a/types/utils.go b/types/utils.go new file mode 100644 index 00000000..63b76eee --- /dev/null +++ b/types/utils.go @@ -0,0 +1,40 @@ +package types + +import ( + "math" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common/hexutil" +) + +//ethereum 1 eth = 10^18 wei, stratos 1 stos = 10^9 ustos +//assume 1eth = 1stos, then 1 ustos = 10^9 wei +func UstosToWei(ustosVal sdk.Int) (weiVal sdk.Int, err error) { + if ustosVal.IsNegative() { + return weiVal, sdkerrors.Wrap(err, "value is negative") + } + + return ustosVal.MulRaw(int64(math.Pow10(DenomUnitDiff))), nil +} + +func WeiToUstosBigInt(weiValBig *hexutil.Big) (ustosValBig *hexutil.Big, err error) { + if weiValBig == nil { + return nil, nil + } + + ustosVal, err := WeiToUstos(sdk.NewIntFromBigInt(weiValBig.ToInt())) + if err != nil { + return nil, err + } + + return (*hexutil.Big)(ustosVal.BigInt()), nil +} + +func WeiToUstos(weiVal sdk.Int) (ustosVal sdk.Int, err error) { + if weiVal.IsNegative() { + return weiVal, sdkerrors.Wrap(err, "value is negative") + } + + return weiVal.QuoRaw(int64(math.Pow10(DenomUnitDiff))), nil +} diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index d40d5411..584ebb9b 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -3,6 +3,8 @@ package keeper import ( "math/big" + "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,8 +17,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/params" - "github.com/tendermint/tendermint/libs/log" - stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/evm/statedb" "github.com/stratosnet/stratos-chain/x/evm/types" diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 07dbe827..520e699b 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -10,13 +10,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stratosnet/stratos-chain/types" + stratos "github.com/stratosnet/stratos-chain/types" ) var _ paramtypes.ParamSet = &Params{} const ( - DefaultEVMDenom = types.USTOS + DefaultEVMDenom = stratos.USTOS ) // Parameter keys @@ -163,24 +163,29 @@ func IsLondon(ethConfig *params.ChainConfig, height int64) bool { // creates a new FeeMarketParams instance func NewFeeMarketParams(noBaseFee bool, baseFeeChangeDenom, elasticityMultiplier uint32, baseFee uint64, enableHeight int64) FeeMarketParams { + ustosBaseFee, err := stratos.WeiToUstos(sdk.NewIntFromUint64(baseFee)) + if err != nil { + panic(err) + } + return FeeMarketParams{ NoBaseFee: noBaseFee, BaseFeeChangeDenominator: baseFeeChangeDenom, ElasticityMultiplier: elasticityMultiplier, - BaseFee: sdk.NewIntFromUint64(baseFee), + BaseFee: ustosBaseFee, EnableHeight: enableHeight, } } // DefaultParams returns default evm parameters func DefaultFeeMarketParams() FeeMarketParams { - return FeeMarketParams{ - NoBaseFee: false, - BaseFeeChangeDenominator: params.BaseFeeChangeDenominator, - ElasticityMultiplier: params.ElasticityMultiplier, - BaseFee: sdk.NewIntFromUint64(params.InitialBaseFee), - EnableHeight: 0, - } + return NewFeeMarketParams( + false, + params.BaseFeeChangeDenominator, + params.ElasticityMultiplier, + params.InitialBaseFee, + 0, + ) } // Validate performs basic validation on fee market parameters. From 5b433eb109d6acc0e2b8c9276ff405d994b4a349 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 6 May 2022 18:27:59 -0400 Subject: [PATCH 024/113] update --- proto/stratos/register/v1/query.proto | 102 +- proto/stratos/register/v1/register.proto | 268 +- proto/stratos/register/v1/tx.proto | 194 +- x/register/alias.go | 63 - x/register/client/rest/query.go | 4 +- x/register/keeper/grpc_query.go | 64 +- x/register/keeper/keeper.go | 8 +- x/register/keeper/msg_server.go | 1 - x/register/keeper/node_state_change.go | 22 +- x/register/keeper/querier.go | 271 +- x/register/module.go | 2 +- x/register/types/indexing_node.go | 2 +- x/register/types/querier.go | 115 +- x/register/types/query.pb.go | 1949 +++++++++++++- x/register/types/query.pb.gw.go | 360 +++ x/register/types/register.pb.go | 2965 +++++++++++++++++----- x/register/types/tx.pb.go | 214 +- x/register/types/unbonding_node.go | 91 +- 18 files changed, 5403 insertions(+), 1292 deletions(-) delete mode 100644 x/register/alias.go diff --git a/proto/stratos/register/v1/query.proto b/proto/stratos/register/v1/query.proto index 239274d4..a29d9b16 100644 --- a/proto/stratos/register/v1/query.proto +++ b/proto/stratos/register/v1/query.proto @@ -1,8 +1,9 @@ syntax = "proto3"; package stratos.register.v1; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + import "stratos/register/v1/register.proto"; option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; @@ -19,58 +20,97 @@ service Query { option (google.api.http).get = "/stratos/register/v1/indexing-nodes/{network_addr}"; } -// // Owner queries all staking info for given Owner address. -// rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) { -// option (google.api.http).get = "/stratos/register/v1/owner/{owner_addr}"; -// } + // Params queries Register module Params info. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/stratos/register/v1/params"; + } + + // StakeByNode queries all staking info for given node network address. + rpc StakeByNode(QueryStakeByNodeRequest) returns (QueryStakeByNodeResponse) { + option (google.api.http).get = "/stratos/register/v1/stakes_node/{acc_addr}/{query_type}"; + } + + // StakeByOwner queries all staking info for given owner address. + rpc StakeByOwner(QueryStakeByOwnerRequest) returns (QueryStakeByOwnerResponse) { + option (google.api.http).get = "/stratos/register/v1/stakes_owner/{owner_addr}"; + } + + // StakeTotal queries all staking info. + rpc StakeTotal(QueryTotalStakeRequest) returns (QueryTotalStakeResponse) { + option (google.api.http).get = "/stratos/register/v1/total_stakes"; + } } // QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method message QueryResourceNodeRequest { - // network_addr defines the node address to query for. + // network_addr defines the node network address to query for. string network_addr = 1; } // QueryResourceNodeResponse is response type for the Query/ResourceNode RPC method message QueryResourceNodeResponse { // node defines the the resourceNode info. - ResourceNode node = 1 [(gogoproto.nullable) = false]; + ResourceNode node = 1; } // QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method message QueryIndexingNodeRequest { - // network_addr defines the node address to query for. + // network_addr defines the node network address to query for. string network_addr = 1; } // QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method message QueryIndexingNodeResponse { // node defines the the indexing info. - IndexingNode node = 1 [(gogoproto.nullable) = false]; + IndexingNode node = 1; } -//// QueryOwnerRequest is request type for the Query/Owner RPC method -//message QueryOwnerRequest { -// // owner_addr defines the owner address to query for. -// string owner_addr = 1; -//} -// -//// QueryOwnerResponse is response type for the Query/Owner RPC method -//message QueryOwnerResponse { -// // owner defines the the owner info. -// string owner = 1 [(gogoproto.nullable) = true]; -// // pagination defines an optional pagination for the request. -// cosmos.base.query.v1beta1.PageRequest pagination = 2; -//} -// -//// 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]; -//} +// QueryStakeByNodeRequest is request type for the Query/StakeByNode RPC method +message QueryStakeByNodeRequest { + // acc_addr defines the node network address to query for. + string acc_addr = 1; + int64 query_type = 2; +} + +// QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method +message QueryStakeByNodeResponse { + // staking_info defines the the staking_info info of the node. + StakingInfo staking_info = 1; +} + +// QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method +message QueryStakeByOwnerRequest { + // owner_addr defines the owner address to query for. + string network_addr = 1; + string moniker = 2; + string owner_addr = 3; +} + +// QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method +message QueryStakeByOwnerResponse { + // staking_infos defines the the node staking info of this owner. + repeated StakingInfo staking_infos = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryTotalStakeRequest is request type for the Query/TotalStake RPC method +message QueryTotalStakeRequest {} + +// QueryTotalStakeResponse is response type for the Query/TotalStake RPC method +message QueryTotalStakeResponse { + // total_stakes defines the total staking info. + TotalStakesResponse total_stakes= 1; +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1; +} diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index 4b0e5a80..dd1cb5b4 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -6,6 +6,7 @@ import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos/staking/v1beta1/staking.proto"; @@ -13,74 +14,157 @@ option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; // Params defines the Register module parameters message Params { - string bond_denom = 1 [ (gogoproto.moretags) = "yaml:\"bond_denom\",omitempty" ]; - string unbonding_threashold_time = 2 [(gogoproto.moretags) = "yaml:\"unbonding_threashold_time\"" ]; - string unbonding_completion_time = 3 [ (gogoproto.moretags) = "yaml:\"unbonding_completion_time\"" ]; - uint32 max_entries = 4 [ (gogoproto.moretags) = "yaml:\"max_entries\",omitempty" ]; + string bond_denom = 1 [ + (gogoproto.jsontag) = "bond_denom", + (gogoproto.moretags) = "yaml:\"bond_denom\"" + ]; + string unbonding_threashold_time = 2 [ + (gogoproto.jsontag) = "unbonding_threashold_time", + (gogoproto.moretags) = "yaml:\"unbonding_threashold_time\"" + ]; + string unbonding_completion_time = 3 [ + (gogoproto.jsontag) = "unbonding_completion_time", + (gogoproto.moretags) = "yaml:\"unbonding_completion_time\"" + ]; + uint32 max_entries = 4 [ + (gogoproto.jsontag) = "max_entries", + (gogoproto.moretags) = "yaml:\"max_entries\",omitempty" + ]; } message ResourceNode { - string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey",(gogoproto.moretags) = "yaml:\"pubkey\"" ]; - bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; - cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; + bool suspend = 3 [ + (gogoproto.jsontag) = "suspend", + (gogoproto.moretags) = "yaml:\"suspend\"" + ]; + cosmos.staking.v1beta1.BondStatus status = 4 [ + (gogoproto.jsontag) = "status", + (gogoproto.moretags) = "yaml:\"status\"" ]; string tokens = 5 [ - (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tokens\"", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "tokens", + (gogoproto.moretags) = "yaml:\"tokens\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; - string nodeType = 8 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; - google.protobuf.Timestamp creation_time = 9 [ + string ownerAddress = 6 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + Description description = 7 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + google.protobuf.Timestamp creation_time = 8 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true, + (gogoproto.jsontag) = "creation_time", (gogoproto.moretags) = "yaml:\"creation_time\"" ]; + string nodeType = 9 [ + (gogoproto.jsontag) = "node_type", + (gogoproto.moretags) = "yaml:\"node_type\"" + ]; + } message IndexingNode { - string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", (gogoproto.moretags) = "yaml:\"pubkey\"" ]; - bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; - cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\"" ]; + bool suspend = 3 [ + (gogoproto.jsontag) = "suspend", + (gogoproto.moretags) = "yaml:\"suspend\"" + ]; + cosmos.staking.v1beta1.BondStatus status = 4 [ + (gogoproto.jsontag) = "status", + (gogoproto.moretags) = "yaml:\"status\"" ]; string tokens = 5 [ - (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tokens\"", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "tokens", + (gogoproto.moretags) = "yaml:\"tokens\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; - google.protobuf.Timestamp creation_time = 9 [ + string ownerAddress = 6 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + Description description = 7 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + google.protobuf.Timestamp creation_time = 8 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true, + (gogoproto.jsontag) = "creation_time", (gogoproto.moretags) = "yaml:\"creation_time\"" ]; } message IndexingNodeRegistrationVotePool { - string nodeAddress = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; - repeated string approveList = 2 [ (gogoproto.moretags) = "yaml:\"approve_list\"" ]; - repeated string rejectList = 3 [ (gogoproto.moretags) = "yaml:\"reject_list\"" ]; + string nodeAddress = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + repeated string approveList = 2 [ + (gogoproto.jsontag) = "approve_list", + (gogoproto.moretags) = "yaml:\"approve_list\"" + ]; + repeated string rejectList = 3 [ + (gogoproto.jsontag) = "reject_list", + (gogoproto.moretags) = "yaml:\"reject_list\"" + ]; google.protobuf.Timestamp expireTime = 4 [ - (gogoproto.nullable) = false, (gogoproto.stdtime) = true, + (gogoproto.jsontag) = "expire_time", (gogoproto.moretags) = "yaml:\"expire_time\"" ]; } message Description { - string moniker = 1 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"moniker\",omitempty" ]; - string identity = 2 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"identity\",omitempty" ]; - string Website = 3 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"website\",omitempty" ]; - string SecurityContact = 4 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; - string Details = 5 [ (gogoproto.nullable) = true, (gogoproto.moretags) = "yaml:\"details\",omitempty" ]; + string moniker = 1 [ + (gogoproto.jsontag) = "moniker", + (gogoproto.moretags) = "yaml:\"moniker\"" + ]; + string identity = 2 [ + (gogoproto.jsontag) = "identity", + (gogoproto.moretags) = "yaml:\"identity\",omitempty" + ]; + string Website = 3 [ + (gogoproto.jsontag) = "website", + (gogoproto.moretags) = "yaml:\"website\",omitempty" + ]; + string SecurityContact = 4 [ + (gogoproto.jsontag) = "security_contact", + (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; + string Details = 5 [ + (gogoproto.jsontag) = "details", + (gogoproto.moretags) = "yaml:\"details\",omitempty" ]; } message Slashing { - string WalletAddress = 1; - int64 Value = 2; + string WalletAddress = 1 [ + (gogoproto.jsontag) = "wallet_address", + (gogoproto.moretags) = "yaml:\"wallet_address\"" + ]; + int64 Value = 2 [ + (gogoproto.jsontag) = "value", + (gogoproto.moretags) = "yaml:\"value\"" + ]; } message ResourceNodes { @@ -90,3 +174,123 @@ message ResourceNodes { message IndexingNodes { repeated IndexingNode indexingNodes = 1; } + +message TotalStakesResponse { + cosmos.base.v1beta1.Coin resource_nodes_total_stake = 1; + cosmos.base.v1beta1.Coin indexing_nodes_total_stake = 2; + cosmos.base.v1beta1.Coin total_bonded_stake = 3; + cosmos.base.v1beta1.Coin total_unbonded_stake = 4; + cosmos.base.v1beta1.Coin total_unbonding_stake = 5; +} + +message StakingInfo { + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; + bool suspend = 3 [ + (gogoproto.jsontag) = "suspend", + (gogoproto.moretags) = "yaml:\"suspend\"" + ]; + cosmos.staking.v1beta1.BondStatus status = 4 [ + (gogoproto.jsontag) = "status", + (gogoproto.moretags) = "yaml:\"status\"" ]; + string tokens = 5 [ + (gogoproto.jsontag) = "tokens", + (gogoproto.moretags) = "yaml:\"tokens\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string ownerAddress = 6 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + Description description = 7 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + google.protobuf.Timestamp creation_time = 8 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.jsontag) = "creation_time", + (gogoproto.moretags) = "yaml:\"creation_time\"" + ]; + string nodeType = 9 [ + (gogoproto.jsontag) = "node_type", + (gogoproto.moretags) = "yaml:\"node_type\"" + ]; + cosmos.base.v1beta1.Coin bonded_stake = 10 [ + (gogoproto.nullable) = true, + (gogoproto.jsontag) = "bonded_stake", + (gogoproto.moretags) = "yaml:\"bonded_stake\"" + ]; + cosmos.base.v1beta1.Coin un_bonding_stake = 11 [ + (gogoproto.nullable) = true, + (gogoproto.jsontag) = "un_bonding_stake", + (gogoproto.moretags) = "yaml:\"un_bonding_stake\"" + ]; + cosmos.base.v1beta1.Coin un_bonded_stake = 12 [ + (gogoproto.nullable) = true, + (gogoproto.jsontag) = "un_bonded_stake", + (gogoproto.moretags) = "yaml:\"un_bonded_stake\"" + ]; + +} + +// UnbondingNode stores all of a single delegator's unbonding bonds +// for a single unbonding node in a time-ordered list +message UnbondingNode { + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_addr", + (gogoproto.moretags) = "yaml:\"network_addr\"" + ]; + bool is_indexing_node = 2 [ + (gogoproto.jsontag) = "is_indexing_node", + (gogoproto.moretags) = "yaml:\"is_indexing_node\"" + ]; + repeated UnbondingNodeEntry entries = 3 [ + (gogoproto.jsontag) = "entries", + (gogoproto.moretags) = "yaml:\"entries\"" + ]; + +} + +message UnbondingNodeEntry { + int64 creation_height = 1 [ + (gogoproto.jsontag) = "creation_height", + (gogoproto.moretags) = "yaml:\"creation_height\"" + ]; + google.protobuf.Timestamp completion_time = 2 [ + (gogoproto.stdtime) = true, + (gogoproto.jsontag) = "creation_time", + (gogoproto.moretags) = "yaml:\"creation_time\"" + ]; + string initial_balance = 3 [ + (gogoproto.jsontag) = "initial_balance", + (gogoproto.moretags) = "yaml:\"initial_balance\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string balance = 4 [ + (gogoproto.jsontag) = "balance", + (gogoproto.moretags) = "yaml:\"balance\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; +} + +//message QueryNodeStakingParams { +// string acc_addr = 1; +// int64 query_type = 2; +//} +// +//// QueryNodesParams Params for query 'custom/register/resource-nodes' +//message QueryNodesParams { +// string network_addr = 1; +// string moniker = 2; +// string owner_addr = 3; +//} + + diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto index b8b0e692..a4e92a3c 100644 --- a/proto/stratos/register/v1/tx.proto +++ b/proto/stratos/register/v1/tx.proto @@ -3,10 +3,12 @@ package stratos.register.v1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; + import "cosmos_proto/cosmos.proto"; import "stratos/register/v1/register.proto"; import "cosmos/base/v1beta1/coin.proto"; -import "google/api/annotations.proto"; + option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; @@ -46,14 +48,32 @@ service Msg { // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. message MsgCreateResourceNode { - string networkAddr = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", - (gogoproto.moretags) = "yaml:\"pubkey\"" ]; - cosmos.base.v1beta1.Coin value = 3 [ (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"value\"" ]; - string ownerAddress = 4 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - Description description = 5 [ (gogoproto.moretags) = "yaml:\"description\"" ]; - string nodeType = 6 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; + cosmos.base.v1beta1.Coin value = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "value", + (gogoproto.moretags) = "yaml:\"value\"" + ]; + string ownerAddress = 4 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + Description description = 5 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + string nodeType = 6 [ + (gogoproto.jsontag) = "node_type", + (gogoproto.moretags) = "yaml:\"node_type\"" + ]; } // MsgCreateResourceNodeTxResponse defines the CreateResourceNodeTx response type @@ -61,22 +81,42 @@ message MsgCreateResourceNodeResponse {} // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. message MsgCreateIndexingNode { - string networkAddr = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", - (gogoproto.moretags) = "yaml:\"pubkey\"" ]; - cosmos.base.v1beta1.Coin value = 3 [ (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"value\"" ]; - string ownerAddress = 4 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - Description description = 5 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; + cosmos.base.v1beta1.Coin value = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "value", + (gogoproto.moretags) = "yaml:\"value\"" + ]; + string ownerAddress = 4 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + Description description = 5 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; } // MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message message MsgRemoveResourceNode { - option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string resource_node_address = 1 [(gogoproto.moretags) = "yaml:\"resource_node_address\""]; - string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; + string resource_node_address = 1 [ + (gogoproto.jsontag) = "resource_node_address", + (gogoproto.moretags) = "yaml:\"resource_node_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; } // MsgRemoveResourceNodeResponse defines the Msg/RemoveResourceNode response type. @@ -88,11 +128,16 @@ message MsgCreateIndexingNodeResponse {} // MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message message MsgRemoveIndexingNode { - option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string indexing_node_address = 1 [(gogoproto.moretags) = "yaml:\"indexing_node_address\""]; - string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; + string indexing_node_address = 1 [ + (gogoproto.jsontag) = "indexing_node_address", + (gogoproto.moretags) = "yaml:\"indexing_node_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; } // MsgRemoveIndexingNodeResponse defines the Msg/RemoveIndexingNode response type. @@ -101,13 +146,25 @@ message MsgRemoveIndexingNodeResponse {} // MsgUpdateResourceNode defines a SDK message for updating an existing resource node. message MsgUpdateResourceNode { - option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - Description description = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"description\""]; - string network_address = 2 [(gogoproto.moretags) = "yaml:\"network_address\""]; - string owner_address = 3 [(gogoproto.moretags) = "yaml:\"owner_address\""]; - string nodeType = 4 [ (gogoproto.moretags) = "yaml:\"node_type\"" ]; + Description description = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + string network_address = 2 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 3 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + string nodeType = 4 [ + (gogoproto.jsontag) = "node_type", + (gogoproto.moretags) = "yaml:\"node_type\"" + ]; } // MsgUpdateResourceNodeResponse defines the Msg/UpdateResourceNode response type. @@ -116,12 +173,21 @@ message MsgUpdateResourceNodeResponse {} // MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. message MsgUpdateIndexingNode { - option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - Description description = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"description\""]; - string network_address = 2 [(gogoproto.moretags) = "yaml:\"network_address\""]; - string owner_address = 3 [(gogoproto.moretags) = "yaml:\"owner_address\""]; + Description description = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + string network_address = 2 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 3 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; } // MsgUpdateIndexingNodeResponse defines the Msg/UpdateIndexingNode response type. @@ -130,13 +196,24 @@ message MsgUpdateIndexingNodeResponse {} // MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. message MsgUpdateResourceNodeStake { - option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string network_address = 1 [(gogoproto.moretags) = "yaml:\"network_address\""]; - string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; - bool incrStake = 3 [ (gogoproto.moretags) = "yaml:\"incr_stake\"" ]; - cosmos.base.v1beta1.Coin StakeDelta = 4 [ (gogoproto.moretags) = "yaml:\"stake_delta\"" ]; + string network_address = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + bool incrStake = 3 [ + (gogoproto.jsontag) = "incr_stake", + (gogoproto.moretags) = "yaml:\"incr_stake\"" + ]; + cosmos.base.v1beta1.Coin StakeDelta = 4 [ + (gogoproto.jsontag) = "stake_delta", + (gogoproto.moretags) = "yaml:\"stake_delta\"" + ]; } // MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. @@ -148,10 +225,22 @@ message MsgUpdateIndexingNodeStake { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string network_address = 1 [(gogoproto.moretags) = "yaml:\"network_address\""]; - string owner_address = 2 [(gogoproto.moretags) = "yaml:\"owner_address\""]; - bool incrStake = 3 [ (gogoproto.moretags) = "yaml:\"incr_stake\"" ]; - cosmos.base.v1beta1.Coin StakeDelta = 4 [ (gogoproto.moretags) = "yaml:\"stake_delta\"" ]; + string network_address = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + bool incrStake = 3 [ + (gogoproto.jsontag) = "incr_stake", + (gogoproto.moretags) = "yaml:\"incr_stake\"" + ]; + cosmos.base.v1beta1.Coin StakeDelta = 4 [ + (gogoproto.jsontag) = "stake_delta", + (gogoproto.moretags) = "yaml:\"stake_delta\"" + ]; } // MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. @@ -162,11 +251,26 @@ message MsgIndexingNodeRegistrationVote { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string candidate_network_address = 1 [(gogoproto.moretags) = "yaml:\"candidate_network_address\""]; // node address of indexing node - string candidate_owner_address = 2 [(gogoproto.moretags) = "yaml:\"candidate_owner_address\""]; // owner address of indexing node - bool opinion = 3 [ (gogoproto.moretags) = "yaml:\"opinion\"" ]; - string voter_network_address = 4 [(gogoproto.moretags) = "yaml:\"voter_network_address\""]; // address of voter (other existed indexing node) - string voter_owner_address = 5 [(gogoproto.moretags) = "yaml:\"voter_owner_address\""]; // address of owner of the voter (other existed indexing node) + string candidate_network_address = 1 [ + (gogoproto.jsontag) = "candidate_network_address", + (gogoproto.moretags) = "yaml:\"candidate_network_address\"" + ]; // node address of indexing node + string candidate_owner_address = 2 [ + (gogoproto.jsontag) = "candidate_owner_address", + (gogoproto.moretags) = "yaml:\"candidate_owner_address\"" + ]; // owner address of indexing node + bool opinion = 3 [ + (gogoproto.jsontag) = "opinion", + (gogoproto.moretags) = "yaml:\"opinion\"" + ]; + string voter_network_address = 4 [ + (gogoproto.jsontag) = "voter_network_address", + (gogoproto.moretags) = "yaml:\"voter_network_address\"" + ]; // address of voter (other existed indexing node) + string voter_owner_address = 5 [ + (gogoproto.jsontag) = "voter_owner_address", + (gogoproto.moretags) = "yaml:\"voter_owner_address\"" + ]; // address of owner of the voter (other existed indexing node) } // MsgUpdateResourceNodeStakeResponse defines the Msg/IndexingNodeRegistrationVote response type. diff --git a/x/register/alias.go b/x/register/alias.go deleted file mode 100644 index 4dec2c33..00000000 --- a/x/register/alias.go +++ /dev/null @@ -1,63 +0,0 @@ -package register - -// -//import ( -// "github.com/stratosnet/stratos-chain/x/register/keeper" -// "github.com/stratosnet/stratos-chain/x/register/types" -//) -// -//const ( -// DefaultParamSpace = types.DefaultParamSpace -// ModuleName = types.ModuleName -// StoreKey = types.StoreKey -// RouterKey = types.RouterKey -// NodeTypeComputation = types.COMPUTATION -// NodeTypeDataBase = types.DATABASE -// NodeTypeStorage = types.STORAGE -//) -// -//var ( -// NewKeeper = keeper.NewKeeper -// RegisterCodec = types.RegisterCodec -// -// ErrInvalid = types.ErrInvalid -// ErrInvalidNetworkAddr = types.ErrInvalidNetworkAddr -// ErrEmptyOwnerAddr = types.ErrEmptyOwnerAddr -// ErrValueNegative = types.ErrValueNegative -// ErrEmptyDescription = types.ErrEmptyDescription -// ErrEmptyResourceNodeAddr = types.ErrEmptyResourceNodeAddr -// ErrEmptyIndexingNodeAddr = types.ErrEmptyIndexingNodeAddr -// ErrBadDenom = types.ErrBadDenom -// ErrResourceNodePubKeyExists = types.ErrResourceNodePubKeyExists -// ErrIndexingNodePubKeyExists = types.ErrIndexingNodePubKeyExists -// ErrNoResourceNodeFound = types.ErrNoResourceNodeFound -// ErrNoIndexingNodeFound = types.ErrNoIndexingNodeFound -// ErrInvalidOwnerAddr = types.ErrInvalidOwnerAddr -// ErrInvalidApproverAddr = types.ErrInvalidVoterAddr -// ErrInvalidApproverStatus = types.ErrInvalidVoterStatus -// -// DefaultParams = types.DefaultParams -// DefaultGenesisState = types.DefaultGenesisState -// NewGenesisState = types.NewGenesisState -// NewResourceNode = types.NewResourceNode -// NewIndexingNode = types.NewIndexingNode -// NewDescription = types.NewDescription -// NewMsgCreateResourceNode = types.NewMsgCreateResourceNode -// NewMsgCreateIndexingNode = types.NewMsgCreateIndexingNode -// -// GetGenesisStateFromAppState = types.GetGenesisStateFromAppState -// -// NewMultiRegisterHooks = types.NewMultiRegisterHooks -//) -// -//type ( -// Keeper = keeper.Keeper -// ResourceNode = types.ResourceNode -// IndexingNode = types.IndexingNode -// Description = types.Description -// GenesisIndexingNode = types.GenesisIndexingNode -// Slashing = types.Slashing -// MsgCreateResourceNode = types.MsgCreateResourceNode -// MsgCreateIndexingNode = types.MsgCreateIndexingNode -// VoteOpinion = types.VoteOpinion -//) diff --git a/x/register/client/rest/query.go b/x/register/client/rest/query.go index 3b2bf13c..681ea26f 100644 --- a/x/register/client/rest/query.go +++ b/x/register/client/rest/query.go @@ -81,7 +81,7 @@ func nodesWithParamsFn(clientCtx client.Context, queryPath string) http.HandlerF } } - params := types.NewQueryNodesParams(page, limit, networkAddr, moniker, ownerAddr) + params := types.NewQueryNodesParams(networkAddr, moniker, ownerAddr) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) @@ -190,7 +190,7 @@ func nodeStakingByOwnerFn(cliCtx client.Context, queryPath string) http.HandlerF return } - params := types.NewQueryNodesParams(page, limit, nil, "", nodeWalletAddress) + params := types.NewQueryNodesParams(nil, "", nodeWalletAddress) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { return diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index 1af7a52b..5834e946 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -3,11 +3,7 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stratosnet/stratos-chain/x/register/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) // Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper @@ -15,40 +11,34 @@ type Querier struct { Keeper } -var _ types.QueryServer = Querier{} +func (q Querier) ResourceNode(ctx context.Context, request *types.QueryResourceNodeRequest) (*types.QueryResourceNodeResponse, error) { + //TODO implement me + panic("implement me") +} + +func (q Querier) IndexingNode(ctx context.Context, request *types.QueryIndexingNodeRequest) (*types.QueryIndexingNodeResponse, error) { + //TODO implement me + panic("implement me") +} + +func (q Querier) Params(ctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + //TODO implement me + panic("implement me") +} + +func (q Querier) StakeByNode(ctx context.Context, request *types.QueryStakeByNodeRequest) (*types.QueryStakeByNodeResponse, error) { + //TODO implement me + panic("implement me") +} -func (q Querier) ResourceNode(c context.Context, req *types.QueryResourceNodeRequest) (*types.QueryResourceNodeResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - if req.NetworkAddr == "" { - return nil, status.Error(codes.InvalidArgument, types.ErrInvalidNetworkAddr.Error()) - } - - ctx := sdk.UnwrapSDKContext(c) - - var params types.QueryNodesParams - node, ok := q.GetResourceNode(ctx, params.NetworkAddr) - if !ok { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoResourceNodeFound.Error()) - } - return &types.QueryResourceNodeResponse{Node: node}, nil +func (q Querier) StakeByOwner(ctx context.Context, request *types.QueryStakeByOwnerRequest) (*types.QueryStakeByOwnerResponse, error) { + //TODO implement me + panic("implement me") } -func (q Querier) IndexingNode(c context.Context, req *types.QueryIndexingNodeRequest) (*types.QueryIndexingNodeResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - if req.NetworkAddr == "" { - return nil, status.Error(codes.InvalidArgument, types.ErrInvalidNetworkAddr.Error()) - } - - ctx := sdk.UnwrapSDKContext(c) - - var params types.QueryNodesParams - node, ok := q.GetIndexingNode(ctx, params.NetworkAddr) - if !ok { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoIndexingNodeFound.Error()) - } - return &types.QueryIndexingNodeResponse{Node: node}, nil +func (q Querier) StakeTotal(ctx context.Context, request *types.QueryTotalStakeRequest) (*types.QueryTotalStakeResponse, error) { + //TODO implement me + panic("implement me") } + +var _ types.QueryServer = Querier{} diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 2d16fe7c..7a2340cf 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -66,7 +66,7 @@ func (k *Keeper) SetHooks(sh types.RegisterHooks) *Keeper { func (k Keeper) SetInitialUOzonePrice(ctx sdk.Context, price sdk.Dec) { store := ctx.KVStore(k.storeKey) - b := amino.MustMarshalBinaryLengthPrefixed(price) + b := k.cdc.MustMarshalLengthPrefixed(&price) store.Set(types.InitialUOzonePriceKey, b) } @@ -202,16 +202,16 @@ func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { } networkList = append(networkList, networkAddr) } - r := removeDuplicateValues(networkList) + r := removeDuplicateValues(k, networkList) return r } -func removeDuplicateValues(stringSlice []stratos.SdsAddress) (res []byte) { +func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res []byte) { keys := make(map[string]bool) for _, entry := range stringSlice { if _, value := keys[entry.String()]; !value { keys[entry.String()] = true - res = append(res, types.ModuleCdc.MustMarshalJSON(entry)...) + res = append(res, keeper.cdc.MustMarshalJSON(entry)...) res = append(res, ';') } } diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index bc6d09fb..96c530a8 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -144,7 +144,6 @@ func (k msgServer) HandleMsgRemoveResourceNode(goCtx context.Context, msg *types return nil, err } - //completionTimeBz := amino.MustMarshalBinaryLengthPrefixed(completionTime) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeUnbondingResourceNode, diff --git a/x/register/keeper/node_state_change.go b/x/register/keeper/node_state_change.go index d11030ee..040ca1b8 100644 --- a/x/register/keeper/node_state_change.go +++ b/x/register/keeper/node_state_change.go @@ -178,37 +178,39 @@ func (k Keeper) UnbondAllMatureUBDNodeQueue(ctx sdk.Context) { for _, networkAddr := range timeslice { ubd, found := k.GetUnbondingNode(ctx, networkAddr) + ubdNetworkAddr, _ := stratos.SdsAddressFromBech32(ubd.NetworkAddr) if !found { panic("node in the unbonding queue was not found") } if ubd.IsIndexingNode { - node, found := k.GetIndexingNode(ctx, ubd.NetworkAddr) + + node, found := k.GetIndexingNode(ctx, ubdNetworkAddr) if !found { - panic("cannot find indexing node " + ubd.NetworkAddr.String()) + panic("cannot find indexing node " + ubd.NetworkAddr) } if node.GetStatus() != stakingtypes.Unbonding { panic("unexpected node in unbonding queue; status was not unbonding") } k.unbondingToUnbonded(ctx, node, ubd.IsIndexingNode) - k.removeIndexingNode(ctx, ubd.NetworkAddr) - _, found1 := k.GetIndexingNode(ctx, ubd.NetworkAddr) + k.removeIndexingNode(ctx, ubdNetworkAddr) + _, found1 := k.GetIndexingNode(ctx, ubdNetworkAddr) if found1 { - ctx.Logger().Info("Removed indexing node with addr " + ubd.NetworkAddr.String()) + ctx.Logger().Info("Removed indexing node with addr " + ubd.NetworkAddr) } } else { - node, found := k.GetResourceNode(ctx, ubd.NetworkAddr) + node, found := k.GetResourceNode(ctx, ubdNetworkAddr) if !found { - panic("cannot find resource node " + ubd.NetworkAddr.String()) + panic("cannot find resource node " + ubd.NetworkAddr) } if node.GetStatus() != stakingtypes.Unbonding { panic("unexpected node in unbonding queue; status was not unbonding") } k.unbondingToUnbonded(ctx, node, ubd.IsIndexingNode) - k.removeResourceNode(ctx, ubd.NetworkAddr) - _, found1 := k.GetResourceNode(ctx, ubd.NetworkAddr) + k.removeResourceNode(ctx, ubdNetworkAddr) + _, found1 := k.GetResourceNode(ctx, ubdNetworkAddr) if found1 { - ctx.Logger().Info("Removed resource node with addr " + ubd.NetworkAddr.String()) + ctx.Logger().Info("Removed resource node with addr " + ubd.NetworkAddr) } } diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 5a36ded9..bcd6664e 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" @@ -32,31 +33,40 @@ func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) { switch path[0] { case QueryResourceNodeByNetworkAddr: - return getResourceNodeByNetworkAddr(ctx, req, k) + return getResourceNodeByNetworkAddr(ctx, req, k, legacyQuerierCdc) case QueryIndexingNodeByNetworkAddr: - return getIndexingNodeList(ctx, req, k) + return getIndexingNodesStakingInfo(ctx, req, k, legacyQuerierCdc) case QueryNodesTotalStakes: - return getNodesStakingInfo(ctx, req, k) + return getNodesStakingInfo(ctx, req, k, legacyQuerierCdc) case QueryNodeStakeByNodeAddr: - return getStakingInfoByNodeAddr(ctx, req, k) + return getStakingInfoByNodeAddr(ctx, req, k, legacyQuerierCdc) case QueryNodeStakeByOwner: - return getStakingInfoByOwnerAddr(ctx, req, k) + return getStakingInfoByOwnerAddr(ctx, req, k, legacyQuerierCdc) case QueryRegisterParams: - return getRegisterParams(ctx, req, k) + return getRegisterParams(ctx, req, k, legacyQuerierCdc) default: return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown register query endpoint "+req.String()+string(req.Data)) } } } -func getRegisterParams(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func getRegisterParams(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { params := k.GetParams(ctx) - return types.ModuleCdc.MustMarshalJSON(params), nil + res, err := codec.MarshalJSONIndent(legacyQuerierCdc, params) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + } + + return res, nil } -func getResourceNodeByNetworkAddr(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) ([]byte, error) { - var params types.QueryNodesParams - err := keeper.cdc.UnmarshalJSON(req.Data, ¶ms) +func getResourceNodeByNetworkAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { + var ( + params types.QueryNodesParams + nodes []*types.ResourceNode + ) + + err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } @@ -64,16 +74,25 @@ func getResourceNodeByNetworkAddr(ctx sdk.Context, req abci.RequestQuery, keeper if params.NetworkAddr.Empty() { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrInvalidNetworkAddr.Error()) } - node, ok := keeper.GetResourceNode(ctx, params.NetworkAddr) - if !ok { + node, found := k.GetResourceNode(ctx, params.NetworkAddr) + if !found { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoResourceNodeFound.Error()) } - return types.ModuleCdc.MustMarshalJSON([]types.ResourceNode{node}), nil + nodes = append(nodes, &node) + res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.ResourceNodes{ResourceNodes: nodes}) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + } + return res, nil } -func getIndexingNodeList(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) ([]byte, error) { - var params types.QueryNodesParams - err := keeper.cdc.UnmarshalJSON(req.Data, ¶ms) +func getIndexingNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { + + var ( + params types.QueryNodesParams + nodes []*types.IndexingNode + ) + err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } @@ -81,37 +100,41 @@ func getIndexingNodeList(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) if params.NetworkAddr.Empty() { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrInvalidNetworkAddr.Error()) } - node, ok := keeper.GetIndexingNode(ctx, params.NetworkAddr) - if !ok { + node, found := k.GetIndexingNode(ctx, params.NetworkAddr) + if !found { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoIndexingNodeFound.Error()) } - - return types.ModuleCdc.MustMarshalJSON([]types.IndexingNode{node}), nil + nodes = append(nodes, &node) + res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.IndexingNodes{IndexingNodes: nodes}) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + } + return res, nil } -func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) ([]byte, error) { +func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - totalBondedStakeOfResourceNodes := keeper.GetResourceNodeBondedToken(ctx).Amount - totalBondedStakeOfIndexingNodes := keeper.GetIndexingNodeBondedToken(ctx).Amount + totalBondedStakeOfResourceNodes := k.GetResourceNodeBondedToken(ctx).Amount + totalBondedStakeOfIndexingNodes := k.GetIndexingNodeBondedToken(ctx).Amount - totalUnbondedStakeOfResourceNodes := keeper.GetResourceNodeNotBondedToken(ctx).Amount - totalUnbondedStakeOfIndexingNodes := keeper.GetIndexingNodeNotBondedToken(ctx).Amount + totalUnbondedStakeOfResourceNodes := k.GetResourceNodeNotBondedToken(ctx).Amount + totalUnbondedStakeOfIndexingNodes := k.GetIndexingNodeNotBondedToken(ctx).Amount - resourceNodeList := keeper.GetAllResourceNodes(ctx) + resourceNodeList := k.GetAllResourceNodes(ctx) totalStakeOfResourceNodes := sdk.ZeroInt() - for _, node := range resourceNodeList { - totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.GetTokens()) + for _, node := range resourceNodeList.GetResourceNodes() { + totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) } - indexingNodeList := keeper.GetAllIndexingNodes(ctx) + indexingNodeList := k.GetAllIndexingNodes(ctx) totalStakeOfIndexingNodes := sdk.ZeroInt() - for _, node := range indexingNodeList { - totalStakeOfIndexingNodes = totalStakeOfIndexingNodes.Add(node.GetTokens()) + for _, node := range indexingNodeList.GetIndexingNodes() { + totalStakeOfIndexingNodes = totalStakeOfIndexingNodes.Add(node.Tokens) } totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfIndexingNodes) totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfIndexingNodes) - totalUnbondingStake := keeper.GetAllUnbondingNodesTotalBalance(ctx) + totalUnbondingStake := k.GetAllUnbondingNodesTotalBalance(ctx) totalUnbondedStake = totalUnbondedStake.Sub(totalUnbondingStake) res := types.NewQueryNodesStakingInfo( totalStakeOfResourceNodes, @@ -120,7 +143,7 @@ func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) totalUnbondedStake, totalUnbondingStake, ) - bz, err := codec.MarshalJSONIndent(keeper.cdc, res) + bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, res) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -128,34 +151,31 @@ func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) return bz, nil } -func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) ([]byte, error) { +// +func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var ( bz []byte params types.QueryNodeStakingParams stakingInfo types.StakingInfo ) - err := keeper.cdc.UnmarshalJSON(req.Data, ¶ms) + err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - NodeAddr, err := stratos.SdsAddressFromBech32(params.AccAddr.String()) - if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, err.Error()) - } - queryType := params.QueryType if queryType == types.QueryType_All || queryType == types.QueryType_SP { - indexingNode, found := keeper.GetIndexingNode(ctx, NodeAddr) + indexingNode, found := k.GetIndexingNode(ctx, params.AccAddr) if found { // Adding indexing node staking info - unBondingStake, unBondedStake, bondedStake, err := getNodeStakes( - ctx, keeper, + networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( + ctx, indexingNode.GetStatus(), - indexingNode.GetNetworkAddr(), - indexingNode.GetTokens(), + networkAddr, + indexingNode.Tokens, ) if err != nil { return nil, err @@ -167,7 +187,7 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, keeper Kee unBondedStake, bondedStake, ) - bzIndexing, err := codec.MarshalJSONIndent(keeper.cdc, stakingInfo) + bzIndexing, err := codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfo) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -177,14 +197,15 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, keeper Kee } if queryType == types.QueryType_All || queryType == types.QueryType_PP { - resourceNode, found := keeper.GetResourceNode(ctx, NodeAddr) + resourceNode, found := k.GetResourceNode(ctx, params.AccAddr) if found { // Adding resource node staking info - unBondingStake, unBondedStake, bondedStake, err := getNodeStakes( - ctx, keeper, + networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( + ctx, resourceNode.GetStatus(), - resourceNode.GetNetworkAddr(), - resourceNode.GetTokens(), + networkAddr, + resourceNode.Tokens, ) if err != nil { return nil, err @@ -196,7 +217,7 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, keeper Kee unBondedStake, bondedStake, ) - bzResource, err := codec.MarshalJSONIndent(keeper.cdc, stakingInfo) + bzResource, err := codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfo) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -208,26 +229,27 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, keeper Kee return bz, nil } -func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) (result []byte, err error) { +func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) (result []byte, err error) { var ( params types.QueryNodesParams stakingInfo types.StakingInfo stakingInfos []types.StakingInfo ) - err = keeper.cdc.UnmarshalJSON(req.Data, ¶ms) + err = legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - resNodes := keeper.GetResourceNodesFiltered(ctx, params) - indNodes := keeper.GetIndexingNodesFiltered(ctx, params) + resNodes := k.GetResourceNodesFiltered(ctx, params) + indNodes := k.GetIndexingNodesFiltered(ctx, params) for _, n := range indNodes { - unBondingStake, unBondedStake, bondedStake, err := getNodeStakes( - ctx, keeper, + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( + ctx, n.GetStatus(), - n.GetNetworkAddr(), - n.GetTokens(), + networkAddr, + n.Tokens, ) if err != nil { return nil, err @@ -244,11 +266,12 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, keeper Ke } for _, n := range resNodes { - unBondingStake, unBondedStake, bondedStake, err := getNodeStakes( - ctx, keeper, + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( + ctx, n.GetStatus(), - n.GetNetworkAddr(), - n.GetTokens(), + networkAddr, + n.Tokens, ) if err != nil { return nil, err @@ -269,7 +292,7 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, keeper Ke return nil, nil } else { stakingInfos = stakingInfos[start:end] - result, err = codec.MarshalJSONIndent(keeper.cdc, stakingInfos) + result, err = codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfos) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -277,14 +300,58 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, keeper Ke } } +func (k Keeper) resourceNodesPagination(filteredNodes []types.ResourceNode, params types.QueryNodesParams) []types.ResourceNode { + start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) + if start < 0 || end < 0 { + filteredNodes = nil + } else { + filteredNodes = filteredNodes[start:end] + } + return filteredNodes +} + +func (k Keeper) indexingNodesPagination(filteredNodes []types.IndexingNode, params types.QueryNodesParams) []types.IndexingNode { + start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) + if start < 0 || end < 0 { + filteredNodes = nil + } else { + filteredNodes = filteredNodes[start:end] + } + return filteredNodes +} + +func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatus, nodeAddress stratos.SdsAddress, tokens sdk.Int) (unbondingStake, unbondedStake, bondedStake sdk.Int, err error) { + unbondingStake = sdk.NewInt(0) + unbondedStake = sdk.NewInt(0) + bondedStake = sdk.NewInt(0) + + switch bondStatus { + case stakingtypes.Unbonding: + unbondingStake = k.GetUnbondingNodeBalance(ctx, nodeAddress) + case stakingtypes.Unbonded: + unbondedStake = tokens + case stakingtypes.Bonded: + bondedStake = tokens + default: + err := fmt.Sprintf("Invalid status of node %s, expected Bonded, Unbonded, or Unbonding, got %s", + nodeAddress.String(), bondStatus) + return sdk.Int{}, sdk.Int{}, sdk.Int{}, sdkerrors.Wrap(sdkerrors.ErrPanic, err) + } + return unbondingStake, unbondedStake, bondedStake, nil +} + func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.IndexingNode { nodes := k.GetAllIndexingNodes(ctx) - filteredNodes := make([]types.IndexingNode, 0, len(nodes)) + filteredNodes := make([]types.IndexingNode, 0, len(nodes.GetIndexingNodes())) - for _, n := range nodes { + for _, n := range nodes.GetIndexingNodes() { // match NetworkAddr (if supplied) + nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + if er != nil { + continue + } if !params.NetworkAddr.Empty() { - if n.NetworkAddr.Equals(params.NetworkAddr) { + if nodeNetworkAddr.Equals(params.NetworkAddr) { continue } } @@ -297,8 +364,12 @@ func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNode } // match OwnerAddr (if supplied) - if params.OwnerAddr.Empty() || n.OwnerAddress.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, n) + nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddr()) + if er != nil { + continue + } + if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { + filteredNodes = append(filteredNodes, *n) } } return filteredNodes @@ -306,12 +377,16 @@ func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNode func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.ResourceNode { nodes := k.GetAllResourceNodes(ctx) - filteredNodes := make([]types.ResourceNode, 0, len(nodes)) + filteredNodes := make([]types.ResourceNode, 0, len(nodes.GetResourceNodes())) - for _, n := range nodes { + for _, n := range nodes.GetResourceNodes() { // match NetworkAddr (if supplied) + nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + if er != nil { + continue + } if !params.NetworkAddr.Empty() { - if n.NetworkAddr.Equals(params.NetworkAddr) { + if nodeNetworkAddr.Equals(params.NetworkAddr) { continue } } @@ -324,49 +399,13 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode } // match OwnerAddr (if supplied) - if params.OwnerAddr.Empty() || n.OwnerAddress.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, n) + nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddr()) + if er != nil { + continue + } + if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { + filteredNodes = append(filteredNodes, *n) } } return filteredNodes } - -func (k Keeper) resourceNodesPagination(filteredNodes []types.ResourceNode, params types.QueryNodesParams) []types.ResourceNode { - start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) - if start < 0 || end < 0 { - filteredNodes = nil - } else { - filteredNodes = filteredNodes[start:end] - } - return filteredNodes -} - -func (k Keeper) indexingNodesPagination(filteredNodes []types.IndexingNode, params types.QueryNodesParams) []types.IndexingNode { - start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) - if start < 0 || end < 0 { - filteredNodes = nil - } else { - filteredNodes = filteredNodes[start:end] - } - return filteredNodes -} - -func getNodeStakes(ctx sdk.Context, keeper Keeper, bondStatus sdk.BondStatus, nodeAddress stratos.SdsAddress, tokens sdk.Int) (unbondingStake, unbondedStake, bondedStake sdk.Int, err error) { - unbondingStake = sdk.NewInt(0) - unbondedStake = sdk.NewInt(0) - bondedStake = sdk.NewInt(0) - - switch bondStatus { - case sdk.Unbonding: - unbondingStake = keeper.GetUnbondingNodeBalance(ctx, nodeAddress) - case sdk.Unbonded: - unbondedStake = tokens - case sdk.Bonded: - bondedStake = tokens - default: - err := fmt.Sprintf("Invalid status of node %s, expected Bonded, Unbonded, or Unbonding, got %s", - nodeAddress.String(), bondStatus.String()) - return sdk.Int{}, sdk.Int{}, sdk.Int{}, sdkerrors.Wrap(sdkerrors.ErrPanic, err) - } - return unbondingStake, unbondedStake, bondedStake, nil -} diff --git a/x/register/module.go b/x/register/module.go index c1fff2cc..df194678 100644 --- a/x/register/module.go +++ b/x/register/module.go @@ -144,7 +144,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), querier) m := keeper.NewMigrator(am.keeper) - cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + _ = cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) } // ConsensusVersion implements AppModule/ConsensusVersion. diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index 88934181..44834d5e 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -241,7 +241,7 @@ func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []strat NodeAddress: nodeAddress.String(), ApproveList: approveSlice, RejectList: rejectSlice, - ExpireTime: expireTime, + ExpireTime: &expireTime, } } diff --git a/x/register/types/querier.go b/x/register/types/querier.go index 1daae50a..3b01d62d 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -1,12 +1,8 @@ package types import ( - "time" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - cryptotypes "github.com/tendermint/tendermint/crypto" ) const ( @@ -41,55 +37,23 @@ type QueryNodeStakingParams struct { QueryType int64 //0:All(Default) 1: indexingNode; 2: ResourceNode } -// NewQueryNodeStakingParams creates a new instance of QueryNodesParams -func NewQueryNodeStakingParams(nodeAddr stratos.SdsAddress, queryType int64) QueryNodeStakingParams { - return QueryNodeStakingParams{ - AccAddr: nodeAddr, - QueryType: queryType, - } -} - -// NodesStakingInfo Params for query 'custom/register/staking' -type NodesStakingInfo struct { - TotalStakeOfResourceNodes sdk.Coin - TotalStakeOfIndexingNodes sdk.Coin - TotalBondedStake sdk.Coin - TotalUnbondedStake sdk.Coin - TotalUnbondingStake sdk.Coin -} +// NewQueryNodesStakingInfo creates a new instance of TotalStakesResponse +func NewQueryNodesStakingInfo(ResourceNodeTotalStake, IndexingNodeTotalStake, totalBondedStake, totalUnbondedStake, totalUnbondingStake sdk.Int) *TotalStakesResponse { + resValue := sdk.NewCoin(defaultDenom, ResourceNodeTotalStake) + indValue := sdk.NewCoin(defaultDenom, IndexingNodeTotalStake) + bonedValue := sdk.NewCoin(defaultDenom, totalBondedStake) + unBondedValue := sdk.NewCoin(defaultDenom, totalUnbondedStake) + unBondingValue := sdk.NewCoin(defaultDenom, totalUnbondingStake) -// NewQueryNodesStakingInfo creates a new instance of NodesStakingInfo -func NewQueryNodesStakingInfo( - totalStakeOfResourceNodes, - totalStakeOfIndexingNodes, - totalBondedStake, - totalUnbondedStake, - totalUnbondingStake sdk.Int, -) NodesStakingInfo { - return NodesStakingInfo{ - TotalStakeOfResourceNodes: sdk.NewCoin(defaultDenom, totalStakeOfResourceNodes), - TotalStakeOfIndexingNodes: sdk.NewCoin(defaultDenom, totalStakeOfIndexingNodes), - TotalBondedStake: sdk.NewCoin(defaultDenom, totalBondedStake), - TotalUnbondedStake: sdk.NewCoin(defaultDenom, totalUnbondedStake), - TotalUnbondingStake: sdk.NewCoin(defaultDenom, totalUnbondingStake), + return &TotalStakesResponse{ + ResourceNodesTotalStake: &resValue, + IndexingNodesTotalStake: &indValue, + TotalBondedStake: &bonedValue, + TotalUnbondedStake: &unBondedValue, + TotalUnbondingStake: &unBondingValue, } } -type StakingInfo struct { - NetworkAddr stratos.SdsAddress `json:"network_address"` - PubKey cryptotypes.PubKey `json:"pub_key"` - Suspend bool `json:"suspend"` - Status stakingtypes.BondStatus `json:"status"` - Tokens sdk.Int `json:"tokens"` - OwnerAddress sdk.AccAddress `json:"owner_address"` - Description *Description `json:"description"` - NodeType string `json:"node_type"` - CreationTime time.Time `json:"creation_time"` - BondedStake sdk.Coin `json:"bonded_stake"` - UnBondingStake sdk.Coin `json:"un_bonding_stake"` - UnBondedStake sdk.Coin `json:"un_bonded_stake"` -} - // NewStakingInfoByResourceNodeAddr creates a new instance of StakingInfoByNodeAddr func NewStakingInfoByResourceNodeAddr( resourceNode ResourceNode, @@ -98,23 +62,23 @@ func NewStakingInfoByResourceNodeAddr( bondedStake sdk.Int, ) StakingInfo { - pk, ok := resourceNode.PubKey.GetCachedValue().(cryptotypes.PubKey) - if !ok { - return StakingInfo{} - } + bonedValue := sdk.NewCoin(defaultDenom, bondedStake) + unBondedValue := sdk.NewCoin(defaultDenom, unBondedStake) + unBondingValue := sdk.NewCoin(defaultDenom, unBondingStake) + return StakingInfo{ - NetworkAddr: stratos.SdsAddress(resourceNode.NetworkAddr), - PubKey: pk, - Suspend: resourceNode.Suspend, - Status: resourceNode.Status, - Tokens: resourceNode.Tokens, - OwnerAddress: sdk.AccAddress(resourceNode.OwnerAddress), - Description: resourceNode.Description, - NodeType: resourceNode.NodeType, - CreationTime: resourceNode.CreationTime, - UnBondingStake: sdk.NewCoin(defaultDenom, unBondingStake), - UnBondedStake: sdk.NewCoin(defaultDenom, unBondedStake), - BondedStake: sdk.NewCoin(defaultDenom, bondedStake), + NetworkAddr: resourceNode.GetNetworkAddr(), + PubKey: resourceNode.GetPubKey(), + Suspend: resourceNode.GetSuspend(), + Status: resourceNode.GetStatus(), + Tokens: &resourceNode.Tokens, + OwnerAddress: resourceNode.GetOwnerAddress(), + Description: resourceNode.GetDescription(), + NodeType: resourceNode.GetNodeType(), + CreationTime: resourceNode.GetCreationTime(), + UnBondingStake: &unBondingValue, + UnBondedStake: &unBondedValue, + BondedStake: &bonedValue, } } @@ -125,22 +89,21 @@ func NewStakingInfoByIndexingNodeAddr( unBondedStake sdk.Int, bondedStake sdk.Int, ) StakingInfo { - pk, ok := indexingNode.PubKey.GetCachedValue().(cryptotypes.PubKey) - if !ok { - return StakingInfo{} - } + bonedValue := sdk.NewCoin(defaultDenom, bondedStake) + unBondedValue := sdk.NewCoin(defaultDenom, unBondedStake) + unBondingValue := sdk.NewCoin(defaultDenom, unBondingStake) return StakingInfo{ - NetworkAddr: stratos.SdsAddress(indexingNode.NetworkAddr), - PubKey: pk, + NetworkAddr: indexingNode.GetNetworkAddr(), + PubKey: indexingNode.GetPubKey(), Suspend: indexingNode.Suspend, Status: indexingNode.Status, - Tokens: indexingNode.Tokens, - OwnerAddress: sdk.AccAddress(indexingNode.OwnerAddress), + Tokens: &indexingNode.Tokens, + OwnerAddress: indexingNode.GetOwnerAddress(), Description: indexingNode.Description, NodeType: "metanode", CreationTime: indexingNode.CreationTime, - UnBondingStake: sdk.NewCoin(defaultDenom, unBondingStake), - UnBondedStake: sdk.NewCoin(defaultDenom, unBondedStake), - BondedStake: sdk.NewCoin(defaultDenom, bondedStake), + UnBondingStake: &unBondingValue, + UnBondedStake: &unBondedValue, + BondedStake: &bonedValue, } } diff --git a/x/register/types/query.pb.go b/x/register/types/query.pb.go index 57a4e272..659f46a8 100644 --- a/x/register/types/query.pb.go +++ b/x/register/types/query.pb.go @@ -6,7 +6,7 @@ package types import ( context "context" fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" + query "github.com/cosmos/cosmos-sdk/types/query" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -31,7 +31,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method type QueryResourceNodeRequest struct { - // network_addr defines the node address to query for. + // network_addr defines the node network address to query for. NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` } @@ -78,7 +78,7 @@ func (m *QueryResourceNodeRequest) GetNetworkAddr() string { // QueryResourceNodeResponse is response type for the Query/ResourceNode RPC method type QueryResourceNodeResponse struct { // node defines the the resourceNode info. - Node ResourceNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node"` + Node *ResourceNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` } func (m *QueryResourceNodeResponse) Reset() { *m = QueryResourceNodeResponse{} } @@ -114,16 +114,16 @@ func (m *QueryResourceNodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryResourceNodeResponse proto.InternalMessageInfo -func (m *QueryResourceNodeResponse) GetNode() ResourceNode { +func (m *QueryResourceNodeResponse) GetNode() *ResourceNode { if m != nil { return m.Node } - return ResourceNode{} + return nil } // QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method type QueryIndexingNodeRequest struct { - // network_addr defines the node address to query for. + // network_addr defines the node network address to query for. NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` } @@ -170,7 +170,7 @@ func (m *QueryIndexingNodeRequest) GetNetworkAddr() string { // QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method type QueryIndexingNodeResponse struct { // node defines the the indexing info. - Node IndexingNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node"` + Node *IndexingNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` } func (m *QueryIndexingNodeResponse) Reset() { *m = QueryIndexingNodeResponse{} } @@ -206,11 +206,394 @@ func (m *QueryIndexingNodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryIndexingNodeResponse proto.InternalMessageInfo -func (m *QueryIndexingNodeResponse) GetNode() IndexingNode { +func (m *QueryIndexingNodeResponse) GetNode() *IndexingNode { if m != nil { return m.Node } - return IndexingNode{} + return nil +} + +// QueryStakeByNodeRequest is request type for the Query/StakeByNode RPC method +type QueryStakeByNodeRequest struct { + // acc_addr defines the node network address to query for. + AccAddr string `protobuf:"bytes,1,opt,name=acc_addr,json=accAddr,proto3" json:"acc_addr,omitempty"` + QueryType int64 `protobuf:"varint,2,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` +} + +func (m *QueryStakeByNodeRequest) Reset() { *m = QueryStakeByNodeRequest{} } +func (m *QueryStakeByNodeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStakeByNodeRequest) ProtoMessage() {} +func (*QueryStakeByNodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{4} +} +func (m *QueryStakeByNodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStakeByNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStakeByNodeRequest.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 *QueryStakeByNodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStakeByNodeRequest.Merge(m, src) +} +func (m *QueryStakeByNodeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStakeByNodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStakeByNodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStakeByNodeRequest proto.InternalMessageInfo + +func (m *QueryStakeByNodeRequest) GetAccAddr() string { + if m != nil { + return m.AccAddr + } + return "" +} + +func (m *QueryStakeByNodeRequest) GetQueryType() int64 { + if m != nil { + return m.QueryType + } + return 0 +} + +// QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method +type QueryStakeByNodeResponse struct { + // staking_info defines the the staking_info info of the node. + StakingInfo *StakingInfo `protobuf:"bytes,1,opt,name=staking_info,json=stakingInfo,proto3" json:"staking_info,omitempty"` +} + +func (m *QueryStakeByNodeResponse) Reset() { *m = QueryStakeByNodeResponse{} } +func (m *QueryStakeByNodeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStakeByNodeResponse) ProtoMessage() {} +func (*QueryStakeByNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{5} +} +func (m *QueryStakeByNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStakeByNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStakeByNodeResponse.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 *QueryStakeByNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStakeByNodeResponse.Merge(m, src) +} +func (m *QueryStakeByNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStakeByNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStakeByNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStakeByNodeResponse proto.InternalMessageInfo + +func (m *QueryStakeByNodeResponse) GetStakingInfo() *StakingInfo { + if m != nil { + return m.StakingInfo + } + return nil +} + +// QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method +type QueryStakeByOwnerRequest struct { + // owner_addr defines the owner address to query for. + NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + OwnerAddr string `protobuf:"bytes,3,opt,name=owner_addr,json=ownerAddr,proto3" json:"owner_addr,omitempty"` +} + +func (m *QueryStakeByOwnerRequest) Reset() { *m = QueryStakeByOwnerRequest{} } +func (m *QueryStakeByOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStakeByOwnerRequest) ProtoMessage() {} +func (*QueryStakeByOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{6} +} +func (m *QueryStakeByOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStakeByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStakeByOwnerRequest.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 *QueryStakeByOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStakeByOwnerRequest.Merge(m, src) +} +func (m *QueryStakeByOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStakeByOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStakeByOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStakeByOwnerRequest proto.InternalMessageInfo + +func (m *QueryStakeByOwnerRequest) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *QueryStakeByOwnerRequest) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *QueryStakeByOwnerRequest) GetOwnerAddr() string { + if m != nil { + return m.OwnerAddr + } + return "" +} + +// QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method +type QueryStakeByOwnerResponse struct { + // staking_infos defines the the node staking info of this owner. + StakingInfos []*StakingInfo `protobuf:"bytes,1,rep,name=staking_infos,json=stakingInfos,proto3" json:"staking_infos,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryStakeByOwnerResponse) Reset() { *m = QueryStakeByOwnerResponse{} } +func (m *QueryStakeByOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStakeByOwnerResponse) ProtoMessage() {} +func (*QueryStakeByOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{7} +} +func (m *QueryStakeByOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStakeByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStakeByOwnerResponse.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 *QueryStakeByOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStakeByOwnerResponse.Merge(m, src) +} +func (m *QueryStakeByOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStakeByOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStakeByOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStakeByOwnerResponse proto.InternalMessageInfo + +func (m *QueryStakeByOwnerResponse) GetStakingInfos() []*StakingInfo { + if m != nil { + return m.StakingInfos + } + return nil +} + +func (m *QueryStakeByOwnerResponse) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryTotalStakeRequest is request type for the Query/TotalStake RPC method +type QueryTotalStakeRequest struct { +} + +func (m *QueryTotalStakeRequest) Reset() { *m = QueryTotalStakeRequest{} } +func (m *QueryTotalStakeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalStakeRequest) ProtoMessage() {} +func (*QueryTotalStakeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{8} +} +func (m *QueryTotalStakeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalStakeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalStakeRequest.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 *QueryTotalStakeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalStakeRequest.Merge(m, src) +} +func (m *QueryTotalStakeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalStakeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalStakeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalStakeRequest proto.InternalMessageInfo + +// QueryTotalStakeResponse is response type for the Query/TotalStake RPC method +type QueryTotalStakeResponse struct { + // total_stakes defines the total staking info. + TotalStakes *TotalStakesResponse `protobuf:"bytes,1,opt,name=total_stakes,json=totalStakes,proto3" json:"total_stakes,omitempty"` +} + +func (m *QueryTotalStakeResponse) Reset() { *m = QueryTotalStakeResponse{} } +func (m *QueryTotalStakeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalStakeResponse) ProtoMessage() {} +func (*QueryTotalStakeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{9} +} +func (m *QueryTotalStakeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalStakeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalStakeResponse.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 *QueryTotalStakeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalStakeResponse.Merge(m, src) +} +func (m *QueryTotalStakeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalStakeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalStakeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalStakeResponse proto.InternalMessageInfo + +func (m *QueryTotalStakeResponse) GetTotalStakes() *TotalStakesResponse { + if m != nil { + return m.TotalStakes + } + return nil +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_59a612d1da8c0670, []int{10} +} +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,omitempty"` +} + +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_59a612d1da8c0670, []int{11} +} +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 nil } func init() { @@ -218,36 +601,69 @@ func init() { proto.RegisterType((*QueryResourceNodeResponse)(nil), "stratos.register.v1.QueryResourceNodeResponse") proto.RegisterType((*QueryIndexingNodeRequest)(nil), "stratos.register.v1.QueryIndexingNodeRequest") proto.RegisterType((*QueryIndexingNodeResponse)(nil), "stratos.register.v1.QueryIndexingNodeResponse") + proto.RegisterType((*QueryStakeByNodeRequest)(nil), "stratos.register.v1.QueryStakeByNodeRequest") + proto.RegisterType((*QueryStakeByNodeResponse)(nil), "stratos.register.v1.QueryStakeByNodeResponse") + proto.RegisterType((*QueryStakeByOwnerRequest)(nil), "stratos.register.v1.QueryStakeByOwnerRequest") + proto.RegisterType((*QueryStakeByOwnerResponse)(nil), "stratos.register.v1.QueryStakeByOwnerResponse") + proto.RegisterType((*QueryTotalStakeRequest)(nil), "stratos.register.v1.QueryTotalStakeRequest") + proto.RegisterType((*QueryTotalStakeResponse)(nil), "stratos.register.v1.QueryTotalStakeResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "stratos.register.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "stratos.register.v1.QueryParamsResponse") } func init() { proto.RegisterFile("stratos/register/v1/query.proto", fileDescriptor_59a612d1da8c0670) } var fileDescriptor_59a612d1da8c0670 = []byte{ - // 374 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcf, 0x4e, 0xea, 0x40, - 0x14, 0x87, 0x5b, 0xc2, 0xbd, 0xc9, 0x2d, 0xac, 0x7a, 0xef, 0x82, 0x4b, 0x4c, 0x91, 0xae, 0xdc, - 0xd0, 0x09, 0xc8, 0x4a, 0xe3, 0x42, 0x76, 0x6e, 0x48, 0xec, 0xca, 0xb8, 0x31, 0x85, 0x9e, 0x94, - 0x89, 0x3a, 0xa7, 0xcc, 0x4c, 0x11, 0x62, 0xdc, 0xf8, 0x04, 0x26, 0x3e, 0x85, 0x6f, 0xc2, 0x92, - 0xc4, 0x8d, 0x2b, 0x35, 0xe0, 0x83, 0x18, 0x86, 0x82, 0x35, 0x19, 0xf1, 0xcf, 0x6e, 0xd2, 0xf9, - 0x7d, 0xe7, 0x7c, 0xe7, 0x74, 0xac, 0x8a, 0x90, 0x3c, 0x90, 0x28, 0x08, 0x87, 0x88, 0x0a, 0x09, - 0x9c, 0x0c, 0xea, 0xa4, 0x9f, 0x00, 0x1f, 0x79, 0x31, 0x47, 0x89, 0xf6, 0xdf, 0x34, 0xe0, 0x2d, - 0x03, 0xde, 0xa0, 0x5e, 0xfe, 0x17, 0x61, 0x84, 0xea, 0x9e, 0xcc, 0x4f, 0x8b, 0x68, 0x79, 0x23, - 0x42, 0x8c, 0xce, 0x80, 0x04, 0x31, 0x25, 0x01, 0x63, 0x28, 0x03, 0x49, 0x91, 0x89, 0xf4, 0xd6, - 0xd5, 0x75, 0x5a, 0x15, 0x55, 0x19, 0x77, 0xcf, 0x2a, 0x1d, 0xce, 0x7b, 0xfb, 0x20, 0x30, 0xe1, - 0x5d, 0x68, 0x63, 0x08, 0x3e, 0xf4, 0x13, 0x10, 0xd2, 0xae, 0x5a, 0x45, 0x06, 0xf2, 0x02, 0xf9, - 0xe9, 0x49, 0x10, 0x86, 0xbc, 0x64, 0x6e, 0x9a, 0x5b, 0x7f, 0xfc, 0x42, 0xfa, 0x6d, 0x3f, 0x0c, - 0xb9, 0x7b, 0x64, 0xfd, 0xd7, 0xe0, 0x22, 0x46, 0x26, 0xc0, 0xde, 0xb5, 0xf2, 0x0c, 0x43, 0x50, - 0x5c, 0xa1, 0x51, 0xf5, 0x34, 0x73, 0x79, 0x59, 0xb0, 0x95, 0x1f, 0x3f, 0x56, 0x0c, 0x5f, 0x41, - 0x2b, 0xb1, 0x03, 0x16, 0xc2, 0x90, 0xb2, 0xe8, 0x87, 0x62, 0xef, 0xf1, 0x6f, 0x88, 0x65, 0xc1, - 0xac, 0x58, 0xe3, 0x29, 0x67, 0xfd, 0x52, 0xa5, 0xed, 0x3b, 0xd3, 0x2a, 0x66, 0xfd, 0xed, 0x9a, - 0xb6, 0xd2, 0x47, 0xfb, 0x2d, 0x7b, 0x5f, 0x8d, 0x2f, 0xb4, 0xdd, 0x9d, 0xeb, 0xfb, 0x97, 0xdb, - 0x5c, 0xd3, 0x6e, 0x10, 0xfd, 0x8f, 0x5d, 0x20, 0xb5, 0xb9, 0xa5, 0x20, 0x97, 0xd9, 0x0d, 0x5d, - 0x29, 0xd7, 0xec, 0x48, 0xeb, 0x5c, 0x35, 0x2b, 0x5f, 0xe7, 0xaa, 0x5b, 0xf1, 0x27, 0xae, 0x34, - 0x45, 0xb4, 0xae, 0xad, 0xf6, 0x78, 0xea, 0x98, 0x93, 0xa9, 0x63, 0x3e, 0x4f, 0x1d, 0xf3, 0x66, - 0xe6, 0x18, 0x93, 0x99, 0x63, 0x3c, 0xcc, 0x1c, 0xe3, 0xb8, 0x19, 0x51, 0xd9, 0x4b, 0x3a, 0x5e, - 0x17, 0xcf, 0x97, 0x75, 0x19, 0xc8, 0xe5, 0xb1, 0xd6, 0xed, 0x05, 0x94, 0x91, 0xe1, 0x5b, 0x2b, - 0x39, 0x8a, 0x41, 0x74, 0x7e, 0xab, 0xa7, 0xbe, 0xfd, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x86, 0x3c, - 0x3f, 0x3a, 0x7a, 0x03, 0x00, 0x00, + // 773 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xd1, 0x4e, 0x13, 0x4d, + 0x14, 0xc7, 0x59, 0xf8, 0x3e, 0xb0, 0xd3, 0x7a, 0x33, 0x18, 0x2d, 0x45, 0x6a, 0x59, 0x12, 0xad, + 0x4a, 0x77, 0x6c, 0x41, 0x63, 0x48, 0x4c, 0x14, 0xa3, 0x09, 0x9a, 0x20, 0x2e, 0x5c, 0x79, 0xd3, + 0x4c, 0xb7, 0xc3, 0xb2, 0x29, 0x9d, 0x29, 0x3b, 0xd3, 0x42, 0xd3, 0x34, 0x31, 0x3e, 0x81, 0xd1, + 0x67, 0xf0, 0x42, 0xe3, 0x83, 0x78, 0x65, 0x48, 0xbc, 0xf1, 0xd2, 0x80, 0x0f, 0x62, 0x76, 0x76, + 0x96, 0xee, 0x86, 0x69, 0xa9, 0xde, 0xd1, 0xb3, 0xe7, 0x7f, 0xce, 0xef, 0xec, 0xd9, 0xf3, 0x0f, + 0xe0, 0x06, 0x17, 0x3e, 0x16, 0x8c, 0x23, 0x9f, 0xb8, 0x1e, 0x17, 0xc4, 0x47, 0x9d, 0x32, 0x3a, + 0x68, 0x13, 0xbf, 0x6b, 0xb5, 0x7c, 0x26, 0x18, 0x9c, 0x55, 0x09, 0x56, 0x94, 0x60, 0x75, 0xca, + 0xb9, 0xeb, 0x2e, 0x63, 0xee, 0x3e, 0x41, 0xb8, 0xe5, 0x21, 0x4c, 0x29, 0x13, 0x58, 0x78, 0x8c, + 0xf2, 0x50, 0x92, 0xbb, 0xe3, 0x30, 0xde, 0x64, 0x1c, 0xd5, 0x30, 0x27, 0x61, 0x2d, 0xd4, 0x29, + 0xd7, 0x88, 0xc0, 0x65, 0xd4, 0xc2, 0xae, 0x47, 0x65, 0xb2, 0xca, 0x35, 0x75, 0xfd, 0xcf, 0x5a, + 0xc9, 0x1c, 0xf3, 0x11, 0xc8, 0xbe, 0x0e, 0xaa, 0xd8, 0x84, 0xb3, 0xb6, 0xef, 0x90, 0x4d, 0x56, + 0x27, 0x36, 0x39, 0x68, 0x13, 0x2e, 0xe0, 0x22, 0xc8, 0x50, 0x22, 0x0e, 0x99, 0xdf, 0xa8,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, 0xa6, 0xe5, 0x3f, 0x03, 0x2b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xee, 0x79, 0x7b, + 0x75, 0xb2, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -266,6 +682,14 @@ type QueryClient interface { ResourceNode(ctx context.Context, in *QueryResourceNodeRequest, opts ...grpc.CallOption) (*QueryResourceNodeResponse, error) // IndexingNode queries IndexingNode info for given IndexingNode address. IndexingNode(ctx context.Context, in *QueryIndexingNodeRequest, opts ...grpc.CallOption) (*QueryIndexingNodeResponse, error) + // Params queries Register module Params info. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // StakeByNode queries all staking info for given node network address. + StakeByNode(ctx context.Context, in *QueryStakeByNodeRequest, opts ...grpc.CallOption) (*QueryStakeByNodeResponse, error) + // StakeByOwner queries all staking info for given owner address. + StakeByOwner(ctx context.Context, in *QueryStakeByOwnerRequest, opts ...grpc.CallOption) (*QueryStakeByOwnerResponse, error) + // StakeTotal queries all staking info. + StakeTotal(ctx context.Context, in *QueryTotalStakeRequest, opts ...grpc.CallOption) (*QueryTotalStakeResponse, error) } type queryClient struct { @@ -294,12 +718,56 @@ func (c *queryClient) IndexingNode(ctx context.Context, in *QueryIndexingNodeReq return out, nil } +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StakeByNode(ctx context.Context, in *QueryStakeByNodeRequest, opts ...grpc.CallOption) (*QueryStakeByNodeResponse, error) { + out := new(QueryStakeByNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/StakeByNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StakeByOwner(ctx context.Context, in *QueryStakeByOwnerRequest, opts ...grpc.CallOption) (*QueryStakeByOwnerResponse, error) { + out := new(QueryStakeByOwnerResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/StakeByOwner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StakeTotal(ctx context.Context, in *QueryTotalStakeRequest, opts ...grpc.CallOption) (*QueryTotalStakeResponse, error) { + out := new(QueryTotalStakeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/StakeTotal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ResourceNode queries ResourceNode info for given ResourceNode address. ResourceNode(context.Context, *QueryResourceNodeRequest) (*QueryResourceNodeResponse, error) // IndexingNode queries IndexingNode info for given IndexingNode address. IndexingNode(context.Context, *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) + // Params queries Register module Params info. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // StakeByNode queries all staking info for given node network address. + StakeByNode(context.Context, *QueryStakeByNodeRequest) (*QueryStakeByNodeResponse, error) + // StakeByOwner queries all staking info for given owner address. + StakeByOwner(context.Context, *QueryStakeByOwnerRequest) (*QueryStakeByOwnerResponse, error) + // StakeTotal queries all staking info. + StakeTotal(context.Context, *QueryTotalStakeRequest) (*QueryTotalStakeResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -312,6 +780,18 @@ func (*UnimplementedQueryServer) ResourceNode(ctx context.Context, req *QueryRes func (*UnimplementedQueryServer) IndexingNode(ctx context.Context, req *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method IndexingNode not implemented") } +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) StakeByNode(ctx context.Context, req *QueryStakeByNodeRequest) (*QueryStakeByNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StakeByNode not implemented") +} +func (*UnimplementedQueryServer) StakeByOwner(ctx context.Context, req *QueryStakeByOwnerRequest) (*QueryStakeByOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StakeByOwner not implemented") +} +func (*UnimplementedQueryServer) StakeTotal(ctx context.Context, req *QueryTotalStakeRequest) (*QueryTotalStakeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StakeTotal not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -353,18 +833,106 @@ func _Query_IndexingNode_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "stratos.register.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ResourceNode", - Handler: _Query_ResourceNode_Handler, +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StakeByNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStakeByNodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StakeByNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Query/StakeByNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StakeByNode(ctx, req.(*QueryStakeByNodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StakeByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStakeByOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StakeByOwner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Query/StakeByOwner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StakeByOwner(ctx, req.(*QueryStakeByOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StakeTotal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalStakeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StakeTotal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.register.v1.Query/StakeTotal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StakeTotal(ctx, req.(*QueryTotalStakeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.register.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ResourceNode", + Handler: _Query_ResourceNode_Handler, }, { MethodName: "IndexingNode", Handler: _Query_IndexingNode_Handler, }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "StakeByNode", + Handler: _Query_StakeByNode_Handler, + }, + { + MethodName: "StakeByOwner", + Handler: _Query_StakeByOwner_Handler, + }, + { + MethodName: "StakeTotal", + Handler: _Query_StakeTotal_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "stratos/register/v1/query.proto", @@ -420,16 +988,18 @@ func (m *QueryResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - { - size, err := m.Node.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Node != nil { + { + size, err := m.Node.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -483,85 +1053,1006 @@ func (m *QueryIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - { - size, err := m.Node.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Node != nil { + { + size, err := m.Node.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - 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++ +func (m *QueryStakeByNodeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryResourceNodeRequest) Size() (n int) { - if m == nil { - return 0 + +func (m *QueryStakeByNodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStakeByNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.QueryType != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.QueryType)) + i-- + dAtA[i] = 0x10 + } + if len(m.AccAddr) > 0 { + i -= len(m.AccAddr) + copy(dAtA[i:], m.AccAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AccAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryStakeByNodeResponse) 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 *QueryStakeByNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStakeByNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.StakingInfo != nil { + { + size, err := m.StakingInfo.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 *QueryStakeByOwnerRequest) 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 *QueryStakeByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStakeByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.NetworkAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.OwnerAddr) > 0 { + i -= len(m.OwnerAddr) + copy(dAtA[i:], m.OwnerAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddr))) + i-- + dAtA[i] = 0x1a } - return n + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NetworkAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryResourceNodeResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryStakeByOwnerResponse) 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 *QueryStakeByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStakeByOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.Node.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + 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.StakingInfos) > 0 { + for iNdEx := len(m.StakingInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StakingInfos[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 *QueryIndexingNodeRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryTotalStakeRequest) 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 *QueryTotalStakeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalStakeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.NetworkAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + return len(dAtA) - i, nil +} + +func (m *QueryTotalStakeResponse) 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 *QueryTotalStakeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalStakeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TotalStakes != nil { + { + size, err := m.TotalStakes.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func 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 *QueryResourceNodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryResourceNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Node != nil { + l = m.Node.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryIndexingNodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryIndexingNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Node != nil { + l = m.Node.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStakeByNodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AccAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.QueryType != 0 { + n += 1 + sovQuery(uint64(m.QueryType)) + } + return n +} + +func (m *QueryStakeByNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StakingInfo != nil { + l = m.StakingInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStakeByOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OwnerAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStakeByOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.StakingInfos) > 0 { + for _, e := range m.StakingInfos { + 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 *QueryTotalStakeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalStakeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TotalStakes != nil { + l = m.TotalStakes.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryResourceNodeRequest) 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: QueryResourceNodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResourceNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", 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.NetworkAddr = 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 *QueryResourceNodeResponse) 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: QueryResourceNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResourceNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", 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.Node == nil { + m.Node = &ResourceNode{} + } + if err := m.Node.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 *QueryIndexingNodeRequest) 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: QueryIndexingNodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIndexingNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", 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.NetworkAddr = 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 *QueryIndexingNodeResponse) 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: QueryIndexingNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIndexingNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", 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.Node == nil { + m.Node = &IndexingNode{} + } + if err := m.Node.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 *QueryStakeByNodeRequest) 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: QueryStakeByNodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStakeByNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccAddr", 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.AccAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryType", wireType) + } + m.QueryType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QueryType |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryStakeByNodeResponse) 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: QueryStakeByNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStakeByNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakingInfo", 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.StakingInfo == nil { + m.StakingInfo = &StakingInfo{} + } + if err := m.StakingInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - return n -} -func (m *QueryIndexingNodeResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = m.Node.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *QueryResourceNodeRequest) Unmarshal(dAtA []byte) error { +func (m *QueryStakeByOwnerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -584,10 +2075,10 @@ func (m *QueryResourceNodeRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryResourceNodeRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStakeByOwnerRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryResourceNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStakeByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -622,6 +2113,70 @@ func (m *QueryResourceNodeRequest) Unmarshal(dAtA []byte) error { } m.NetworkAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", 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.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddr", 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.OwnerAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -643,7 +2198,7 @@ func (m *QueryResourceNodeRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryResourceNodeResponse) Unmarshal(dAtA []byte) error { +func (m *QueryStakeByOwnerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -666,15 +2221,15 @@ func (m *QueryResourceNodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryResourceNodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStakeByOwnerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryResourceNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStakeByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakingInfos", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -701,7 +2256,44 @@ func (m *QueryResourceNodeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.StakingInfos = append(m.StakingInfos, &StakingInfo{}) + if err := m.StakingInfos[len(m.StakingInfos)-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.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -726,7 +2318,7 @@ func (m *QueryResourceNodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTotalStakeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -749,17 +2341,67 @@ func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryIndexingNodeRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTotalStakeRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryIndexingNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTotalStakeRequest: 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 *QueryTotalStakeResponse) 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: QueryTotalStakeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalStakeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalStakes", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -769,23 +2411,27 @@ func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + if m.TotalStakes == nil { + m.TotalStakes = &TotalStakesResponse{} + } + if err := m.TotalStakes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -808,7 +2454,7 @@ func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryIndexingNodeResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -831,15 +2477,65 @@ func (m *QueryIndexingNodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryIndexingNodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryIndexingNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Node", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -866,7 +2562,10 @@ func (m *QueryIndexingNodeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/types/query.pb.gw.go b/x/register/types/query.pb.gw.go index a6ce942c..d1a956d2 100644 --- a/x/register/types/query.pb.gw.go +++ b/x/register/types/query.pb.gw.go @@ -139,6 +139,190 @@ func local_request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.M } +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_StakeByNode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStakeByNodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["acc_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "acc_addr") + } + + protoReq.AccAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "acc_addr", err) + } + + val, ok = pathParams["query_type"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "query_type") + } + + protoReq.QueryType, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_type", err) + } + + msg, err := client.StakeByNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StakeByNode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStakeByNodeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["acc_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "acc_addr") + } + + protoReq.AccAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "acc_addr", err) + } + + val, ok = pathParams["query_type"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "query_type") + } + + protoReq.QueryType, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_type", err) + } + + msg, err := server.StakeByNode(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_StakeByOwner_0 = &utilities.DoubleArray{Encoding: map[string]int{"owner_addr": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_StakeByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStakeByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_addr") + } + + protoReq.OwnerAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_addr", 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_StakeByOwner_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.StakeByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StakeByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStakeByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_addr") + } + + protoReq.OwnerAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_addr", 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_StakeByOwner_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.StakeByOwner(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_StakeTotal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalStakeRequest + var metadata runtime.ServerMetadata + + msg, err := client.StakeTotal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StakeTotal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalStakeRequest + var metadata runtime.ServerMetadata + + msg, err := server.StakeTotal(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. @@ -185,6 +369,86 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + 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.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) + 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_StakeByNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_StakeByNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StakeByNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StakeByOwner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_StakeByOwner_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StakeByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StakeTotal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_StakeTotal_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StakeTotal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -266,6 +530,86 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + 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_StakeByNode_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_StakeByNode_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_StakeByNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StakeByOwner_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_StakeByOwner_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_StakeByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StakeTotal_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_StakeTotal_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_StakeTotal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -273,10 +617,26 @@ var ( pattern_Query_ResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "resource-nodes", "network_addr"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_IndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "indexing-nodes", "network_addr"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_StakeByNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"stratos", "register", "v1", "stakes_node", "acc_addr", "query_type"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_StakeByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "stakes_owner", "owner_addr"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_StakeTotal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "total_stakes"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Query_ResourceNode_0 = runtime.ForwardResponseMessage forward_Query_IndexingNode_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_StakeByNode_0 = runtime.ForwardResponseMessage + + forward_Query_StakeByOwner_0 = runtime.ForwardResponseMessage + + forward_Query_StakeTotal_0 = runtime.ForwardResponseMessage ) diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 911140bc..1917fe95 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types2 "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -33,10 +34,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the Register module parameters type Params struct { - BondDenom string `protobuf:"bytes,1,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom",omitempty` - UnbondingThreasholdTime string `protobuf:"bytes,2,opt,name=unbonding_threashold_time,json=unbondingThreasholdTime,proto3" json:"unbonding_threashold_time,omitempty" yaml:"unbonding_threashold_time"` - UnbondingCompletionTime string `protobuf:"bytes,3,opt,name=unbonding_completion_time,json=unbondingCompletionTime,proto3" json:"unbonding_completion_time,omitempty" yaml:"unbonding_completion_time"` - MaxEntries uint32 `protobuf:"varint,4,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty" yaml:"max_entries",omitempty` + BondDenom string `protobuf:"bytes,1,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom" yaml:"bond_denom"` + UnbondingThreasholdTime string `protobuf:"bytes,2,opt,name=unbonding_threashold_time,json=unbondingThreasholdTime,proto3" json:"unbonding_threashold_time" yaml:"unbonding_threashold_time"` + UnbondingCompletionTime string `protobuf:"bytes,3,opt,name=unbonding_completion_time,json=unbondingCompletionTime,proto3" json:"unbonding_completion_time" yaml:"unbonding_completion_time"` + MaxEntries uint32 `protobuf:"varint,4,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries" yaml:"max_entries",omitempty` } func (m *Params) Reset() { *m = Params{} } @@ -101,15 +102,15 @@ func (m *Params) GetMaxEntries() uint32 { } type ResourceNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` - NodeType string `protobuf:"bytes,8,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` - CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` + CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NodeType string `protobuf:"bytes,9,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *ResourceNode) Reset() { *m = ResourceNode{} } @@ -187,29 +188,29 @@ func (m *ResourceNode) GetDescription() *Description { return nil } -func (m *ResourceNode) GetNodeType() string { +func (m *ResourceNode) GetCreationTime() time.Time { if m != nil { - return m.NodeType + return m.CreationTime } - return "" + return time.Time{} } -func (m *ResourceNode) GetCreationTime() time.Time { +func (m *ResourceNode) GetNodeType() string { if m != nil { - return m.CreationTime + return m.NodeType } - return time.Time{} + return "" } type IndexingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` - CreationTime time.Time `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` + CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } func (m *IndexingNode) Reset() { *m = IndexingNode{} } @@ -295,10 +296,10 @@ func (m *IndexingNode) GetCreationTime() time.Time { } type IndexingNodeRegistrationVotePool struct { - NodeAddress string `protobuf:"bytes,1,opt,name=nodeAddress,proto3" json:"nodeAddress,omitempty" yaml:"network_address"` - ApproveList []string `protobuf:"bytes,2,rep,name=approveList,proto3" json:"approveList,omitempty" yaml:"approve_list"` - RejectList []string `protobuf:"bytes,3,rep,name=rejectList,proto3" json:"rejectList,omitempty" yaml:"reject_list"` - ExpireTime time.Time `protobuf:"bytes,4,opt,name=expireTime,proto3,stdtime" json:"expireTime" yaml:"expire_time"` + NodeAddress string `protobuf:"bytes,1,opt,name=nodeAddress,proto3" json:"network_address" yaml:"network_address"` + ApproveList []string `protobuf:"bytes,2,rep,name=approveList,proto3" json:"approve_list" yaml:"approve_list"` + RejectList []string `protobuf:"bytes,3,rep,name=rejectList,proto3" json:"reject_list" yaml:"reject_list"` + ExpireTime *time.Time `protobuf:"bytes,4,opt,name=expireTime,proto3,stdtime" json:"expire_time" yaml:"expire_time"` } func (m *IndexingNodeRegistrationVotePool) Reset() { *m = IndexingNodeRegistrationVotePool{} } @@ -355,19 +356,19 @@ func (m *IndexingNodeRegistrationVotePool) GetRejectList() []string { return nil } -func (m *IndexingNodeRegistrationVotePool) GetExpireTime() time.Time { +func (m *IndexingNodeRegistrationVotePool) GetExpireTime() *time.Time { if m != nil { return m.ExpireTime } - return time.Time{} + return nil } type Description struct { - Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty" yaml:"moniker",omitempty` - Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty" yaml:"identity",omitempty` - Website string `protobuf:"bytes,3,opt,name=Website,proto3" json:"Website,omitempty" yaml:"website",omitempty` - SecurityContact string `protobuf:"bytes,4,opt,name=SecurityContact,proto3" json:"SecurityContact,omitempty" yaml:"security_contact",omitempty` - Details string `protobuf:"bytes,5,opt,name=Details,proto3" json:"Details,omitempty" yaml:"details",omitempty` + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker" yaml:"moniker"` + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity" yaml:"identity",omitempty` + Website string `protobuf:"bytes,3,opt,name=Website,proto3" json:"website" yaml:"website",omitempty` + SecurityContact string `protobuf:"bytes,4,opt,name=SecurityContact,proto3" json:"security_contact" yaml:"security_contact",omitempty` + Details string `protobuf:"bytes,5,opt,name=Details,proto3" json:"details" yaml:"details",omitempty` } func (m *Description) Reset() { *m = Description{} } @@ -439,8 +440,8 @@ func (m *Description) GetDetails() string { } type Slashing struct { - WalletAddress string `protobuf:"bytes,1,opt,name=WalletAddress,proto3" json:"WalletAddress,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"` + WalletAddress string `protobuf:"bytes,1,opt,name=WalletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"value" yaml:"value"` } func (m *Slashing) Reset() { *m = Slashing{} } @@ -578,6 +579,323 @@ func (m *IndexingNodes) GetIndexingNodes() []*IndexingNode { return nil } +type TotalStakesResponse struct { + ResourceNodesTotalStake *types2.Coin `protobuf:"bytes,1,opt,name=resource_nodes_total_stake,json=resourceNodesTotalStake,proto3" json:"resource_nodes_total_stake,omitempty"` + IndexingNodesTotalStake *types2.Coin `protobuf:"bytes,2,opt,name=indexing_nodes_total_stake,json=indexingNodesTotalStake,proto3" json:"indexing_nodes_total_stake,omitempty"` + TotalBondedStake *types2.Coin `protobuf:"bytes,3,opt,name=total_bonded_stake,json=totalBondedStake,proto3" json:"total_bonded_stake,omitempty"` + TotalUnbondedStake *types2.Coin `protobuf:"bytes,4,opt,name=total_unbonded_stake,json=totalUnbondedStake,proto3" json:"total_unbonded_stake,omitempty"` + TotalUnbondingStake *types2.Coin `protobuf:"bytes,5,opt,name=total_unbonding_stake,json=totalUnbondingStake,proto3" json:"total_unbonding_stake,omitempty"` +} + +func (m *TotalStakesResponse) Reset() { *m = TotalStakesResponse{} } +func (m *TotalStakesResponse) String() string { return proto.CompactTextString(m) } +func (*TotalStakesResponse) ProtoMessage() {} +func (*TotalStakesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{8} +} +func (m *TotalStakesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TotalStakesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TotalStakesResponse.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 *TotalStakesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TotalStakesResponse.Merge(m, src) +} +func (m *TotalStakesResponse) XXX_Size() int { + return m.Size() +} +func (m *TotalStakesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TotalStakesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TotalStakesResponse proto.InternalMessageInfo + +func (m *TotalStakesResponse) GetResourceNodesTotalStake() *types2.Coin { + if m != nil { + return m.ResourceNodesTotalStake + } + return nil +} + +func (m *TotalStakesResponse) GetIndexingNodesTotalStake() *types2.Coin { + if m != nil { + return m.IndexingNodesTotalStake + } + return nil +} + +func (m *TotalStakesResponse) GetTotalBondedStake() *types2.Coin { + if m != nil { + return m.TotalBondedStake + } + return nil +} + +func (m *TotalStakesResponse) GetTotalUnbondedStake() *types2.Coin { + if m != nil { + return m.TotalUnbondedStake + } + return nil +} + +func (m *TotalStakesResponse) GetTotalUnbondingStake() *types2.Coin { + if m != nil { + return m.TotalUnbondingStake + } + return nil +} + +type StakingInfo struct { + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` + Tokens *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` + CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NodeType string `protobuf:"bytes,9,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` + BondedStake *types2.Coin `protobuf:"bytes,10,opt,name=bonded_stake,json=bondedStake,proto3" json:"bonded_stake" yaml:"bonded_stake"` + UnBondingStake *types2.Coin `protobuf:"bytes,11,opt,name=un_bonding_stake,json=unBondingStake,proto3" json:"un_bonding_stake" yaml:"un_bonding_stake"` + UnBondedStake *types2.Coin `protobuf:"bytes,12,opt,name=un_bonded_stake,json=unBondedStake,proto3" json:"un_bonded_stake" yaml:"un_bonded_stake"` +} + +func (m *StakingInfo) Reset() { *m = StakingInfo{} } +func (m *StakingInfo) String() string { return proto.CompactTextString(m) } +func (*StakingInfo) ProtoMessage() {} +func (*StakingInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{9} +} +func (m *StakingInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakingInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakingInfo.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 *StakingInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakingInfo.Merge(m, src) +} +func (m *StakingInfo) XXX_Size() int { + return m.Size() +} +func (m *StakingInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StakingInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StakingInfo proto.InternalMessageInfo + +func (m *StakingInfo) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *StakingInfo) GetPubKey() *types.Any { + if m != nil { + return m.PubKey + } + return nil +} + +func (m *StakingInfo) GetSuspend() bool { + if m != nil { + return m.Suspend + } + return false +} + +func (m *StakingInfo) GetStatus() types1.BondStatus { + if m != nil { + return m.Status + } + return types1.Unspecified +} + +func (m *StakingInfo) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *StakingInfo) GetDescription() *Description { + if m != nil { + return m.Description + } + return nil +} + +func (m *StakingInfo) GetCreationTime() time.Time { + if m != nil { + return m.CreationTime + } + return time.Time{} +} + +func (m *StakingInfo) GetNodeType() string { + if m != nil { + return m.NodeType + } + return "" +} + +func (m *StakingInfo) GetBondedStake() *types2.Coin { + if m != nil { + return m.BondedStake + } + return nil +} + +func (m *StakingInfo) GetUnBondingStake() *types2.Coin { + if m != nil { + return m.UnBondingStake + } + return nil +} + +func (m *StakingInfo) GetUnBondedStake() *types2.Coin { + if m != nil { + return m.UnBondedStake + } + return nil +} + +// UnbondingNode stores all of a single delegator's unbonding bonds +// for a single unbonding node in a time-ordered list +type UnbondingNode struct { + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_addr" yaml:"network_addr"` + IsIndexingNode bool `protobuf:"varint,2,opt,name=is_indexing_node,json=isIndexingNode,proto3" json:"is_indexing_node" yaml:"is_indexing_node"` + Entries []*UnbondingNodeEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries" yaml:"entries"` +} + +func (m *UnbondingNode) Reset() { *m = UnbondingNode{} } +func (m *UnbondingNode) String() string { return proto.CompactTextString(m) } +func (*UnbondingNode) ProtoMessage() {} +func (*UnbondingNode) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{10} +} +func (m *UnbondingNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnbondingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnbondingNode.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 *UnbondingNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnbondingNode.Merge(m, src) +} +func (m *UnbondingNode) XXX_Size() int { + return m.Size() +} +func (m *UnbondingNode) XXX_DiscardUnknown() { + xxx_messageInfo_UnbondingNode.DiscardUnknown(m) +} + +var xxx_messageInfo_UnbondingNode proto.InternalMessageInfo + +func (m *UnbondingNode) GetNetworkAddr() string { + if m != nil { + return m.NetworkAddr + } + return "" +} + +func (m *UnbondingNode) GetIsIndexingNode() bool { + if m != nil { + return m.IsIndexingNode + } + return false +} + +func (m *UnbondingNode) GetEntries() []*UnbondingNodeEntry { + if m != nil { + return m.Entries + } + return nil +} + +type UnbondingNodeEntry struct { + CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height" yaml:"creation_height"` + CompletionTime *time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + InitialBalance *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"initial_balance" yaml:"initial_balance"` + Balance *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance" yaml:"balance"` +} + +func (m *UnbondingNodeEntry) Reset() { *m = UnbondingNodeEntry{} } +func (m *UnbondingNodeEntry) String() string { return proto.CompactTextString(m) } +func (*UnbondingNodeEntry) ProtoMessage() {} +func (*UnbondingNodeEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{11} +} +func (m *UnbondingNodeEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnbondingNodeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnbondingNodeEntry.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 *UnbondingNodeEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnbondingNodeEntry.Merge(m, src) +} +func (m *UnbondingNodeEntry) XXX_Size() int { + return m.Size() +} +func (m *UnbondingNodeEntry) XXX_DiscardUnknown() { + xxx_messageInfo_UnbondingNodeEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_UnbondingNodeEntry proto.InternalMessageInfo + +func (m *UnbondingNodeEntry) GetCreationHeight() int64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *UnbondingNodeEntry) GetCompletionTime() *time.Time { + if m != nil { + return m.CompletionTime + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "stratos.register.v1.Params") proto.RegisterType((*ResourceNode)(nil), "stratos.register.v1.ResourceNode") @@ -587,6 +905,10 @@ func init() { proto.RegisterType((*Slashing)(nil), "stratos.register.v1.Slashing") proto.RegisterType((*ResourceNodes)(nil), "stratos.register.v1.ResourceNodes") proto.RegisterType((*IndexingNodes)(nil), "stratos.register.v1.IndexingNodes") + proto.RegisterType((*TotalStakesResponse)(nil), "stratos.register.v1.TotalStakesResponse") + proto.RegisterType((*StakingInfo)(nil), "stratos.register.v1.StakingInfo") + proto.RegisterType((*UnbondingNode)(nil), "stratos.register.v1.UnbondingNode") + proto.RegisterType((*UnbondingNodeEntry)(nil), "stratos.register.v1.UnbondingNodeEntry") } func init() { @@ -594,73 +916,108 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1042 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x4d, 0x6f, 0xdc, 0xc4, - 0x1b, 0xcf, 0x26, 0xff, 0xbc, 0xcd, 0x66, 0xfb, 0x87, 0xe9, 0xaa, 0xdd, 0x04, 0xb4, 0xde, 0x58, - 0x11, 0x4a, 0xa5, 0xc6, 0x4b, 0x02, 0x42, 0xa2, 0x2a, 0xa0, 0x6c, 0x03, 0xa8, 0x02, 0xaa, 0xc8, - 0x89,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9, 0x6c, 0x1f, 0x15, 0xe5, 0x4c, 0xed, 0x8d, 0x37, 0x3a, 0xcf, 0x9c, 0xb2, 0x59, 0x5d, 0xef, - 0xd1, 0xf3, 0xcb, 0x76, 0xed, 0xc5, 0x65, 0xbb, 0xf6, 0xf7, 0x65, 0xbb, 0xf6, 0xf4, 0xaa, 0x3d, - 0xf7, 0xe2, 0xaa, 0x3d, 0xf7, 0xc7, 0x55, 0x7b, 0xee, 0xc9, 0xc7, 0xd6, 0x73, 0xce, 0xb8, 0x32, - 0x90, 0xd5, 0xdf, 0x9d, 0xe0, 0x94, 0x50, 0xd6, 0xbd, 0x98, 0x7e, 0x17, 0xab, 0x27, 0xdf, 0x60, - 0x49, 0x65, 0xfc, 0xa3, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x05, 0x20, 0xe5, 0x38, 0x0b, - 0x00, 0x00, + // 1611 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1c, 0x45, + 0x16, 0xf7, 0x78, 0xe2, 0xaf, 0x9a, 0x19, 0xdb, 0xdb, 0x76, 0x36, 0x63, 0xef, 0xae, 0xdb, 0xa9, + 0xfd, 0x88, 0x57, 0x59, 0xcf, 0xc8, 0xce, 0x4a, 0x08, 0x24, 0x0e, 0xee, 0xc4, 0x0a, 0x56, 0x48, + 0x30, 0x6d, 0x63, 0x03, 0x12, 0x1a, 0x7a, 0xba, 0x2b, 0xe3, 0xc2, 0x33, 0x55, 0xa3, 0xae, 0x1a, + 0xdb, 0x73, 0x40, 0xe2, 0x2f, 0x40, 0xb9, 0x71, 0xe1, 0xc8, 0x89, 0x33, 0x7f, 0x03, 0x8a, 0x38, + 0xe5, 0x88, 0x38, 0x34, 0x28, 0x11, 0x97, 0x11, 0xa7, 0x39, 0x21, 0x4e, 0xa8, 0x3e, 0xba, 0xbb, + 0xba, 0xed, 0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a7, 0x2b, 0x85, 0x47, 0xcf, 0x56, 0xc6, 0x9e, 0x3c, 0x5b, 0x19, 0xfb, 0xf6, + 0xd9, 0xca, 0xd8, 0xfb, 0xff, 0x37, 0xfc, 0xe8, 0xec, 0x21, 0x88, 0xc7, 0x3f, 0xd7, 0xfd, 0x23, + 0x0f, 0x93, 0xfa, 0x59, 0xfa, 0x1a, 0x2c, 0x3d, 0x37, 0x27, 0xe5, 0x45, 0xdc, 0xfa, 0x35, 0x00, + 0x00, 0xff, 0xff, 0xba, 0x22, 0xf4, 0xfb, 0x2e, 0x16, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -732,6 +1089,13 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NodeType) > 0 { + i -= len(m.NodeType) + copy(dAtA[i:], m.NodeType) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeType))) + i-- + dAtA[i] = 0x4a + } n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) if err1 != nil { return 0, err1 @@ -739,14 +1103,7 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n1 i = encodeVarintRegister(dAtA, i, uint64(n1)) i-- - dAtA[i] = 0x4a - if len(m.NodeType) > 0 { - i -= len(m.NodeType) - copy(dAtA[i:], m.NodeType) - i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeType))) - i-- - dAtA[i] = 0x42 - } + dAtA[i] = 0x42 if m.Description != nil { { size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) @@ -840,7 +1197,7 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n4 i = encodeVarintRegister(dAtA, i, uint64(n4)) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 if m.Description != nil { { size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) @@ -927,14 +1284,16 @@ func (m *IndexingNodeRegistrationVotePool) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpireTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireTime):]) - if err7 != nil { - return 0, err7 + if m.ExpireTime != nil { + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.ExpireTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpireTime):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintRegister(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x22 } - i -= n7 - i = encodeVarintRegister(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0x22 if len(m.RejectList) > 0 { for iNdEx := len(m.RejectList) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.RejectList[iNdEx]) @@ -1130,140 +1489,480 @@ func (m *IndexingNodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintRegister(dAtA []byte, offset int, v uint64) int { - offset -= sovRegister(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *TotalStakesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } + +func (m *TotalStakesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TotalStakesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.BondDenom) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.TotalUnbondingStake != nil { + { + size, err := m.TotalUnbondingStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - l = len(m.UnbondingThreasholdTime) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.TotalUnbondedStake != nil { + { + size, err := m.TotalUnbondedStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 } - l = len(m.UnbondingCompletionTime) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.TotalBondedStake != nil { + { + size, err := m.TotalBondedStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - if m.MaxEntries != 0 { - n += 1 + sovRegister(uint64(m.MaxEntries)) + if m.IndexingNodesTotalStake != nil { + { + size, err := m.IndexingNodesTotalStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return n + if m.ResourceNodesTotalStake != nil { + { + size, err := m.ResourceNodesTotalStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *ResourceNode) Size() (n int) { - if m == nil { - return 0 +func (m *StakingInfo) 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 *StakingInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StakingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.NetworkAddr) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.UnBondedStake != nil { + { + size, err := m.UnBondedStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 } - if m.PubKey != nil { - l = m.PubKey.Size() - n += 1 + l + sovRegister(uint64(l)) + if m.UnBondingStake != nil { + { + size, err := m.UnBondingStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a } - if m.Suspend { - n += 2 + if m.BondedStake != nil { + { + size, err := m.BondedStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 } - if m.Status != 0 { - n += 1 + sovRegister(uint64(m.Status)) + if len(m.NodeType) > 0 { + i -= len(m.NodeType) + copy(dAtA[i:], m.NodeType) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeType))) + i-- + dAtA[i] = 0x4a } - l = m.Tokens.Size() - n += 1 + l + sovRegister(uint64(l)) - l = len(m.OwnerAddress) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) + if err16 != nil { + return 0, err16 } + i -= n16 + i = encodeVarintRegister(dAtA, i, uint64(n16)) + i-- + dAtA[i] = 0x42 if m.Description != nil { - l = m.Description.Size() - n += 1 + l + sovRegister(uint64(l)) - } - l = len(m.NodeType) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) - n += 1 + l + sovRegister(uint64(l)) - return n -} - -func (m *IndexingNode) Size() (n int) { - if m == nil { - return 0 + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x32 } - var l int - _ = l - l = len(m.NetworkAddr) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.Tokens != nil { + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - if m.PubKey != nil { - l = m.PubKey.Size() - n += 1 + l + sovRegister(uint64(l)) + if m.Status != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 } if m.Suspend { - n += 2 - } - if m.Status != 0 { - n += 1 + sovRegister(uint64(m.Status)) + i-- + if m.Suspend { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 } - l = m.Tokens.Size() - n += 1 + l + sovRegister(uint64(l)) - l = len(m.OwnerAddress) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.PubKey != nil { + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - if m.Description != nil { - l = m.Description.Size() - n += 1 + l + sovRegister(uint64(l)) + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddr))) + i-- + dAtA[i] = 0xa } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) - n += 1 + l + sovRegister(uint64(l)) - return n + return len(dAtA) - i, nil } -func (m *IndexingNodeRegistrationVotePool) Size() (n int) { - if m == nil { - return 0 +func (m *UnbondingNode) 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 *UnbondingNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnbondingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.NodeAddress) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) - } - if len(m.ApproveList) > 0 { - for _, s := range m.ApproveList { - l = len(s) - n += 1 + l + sovRegister(uint64(l)) + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } } - if len(m.RejectList) > 0 { - for _, s := range m.RejectList { - l = len(s) - n += 1 + l + sovRegister(uint64(l)) + if m.IsIndexingNode { + i-- + if m.IsIndexingNode { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x10 } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireTime) - n += 1 + l + sovRegister(uint64(l)) - return n + if len(m.NetworkAddr) > 0 { + i -= len(m.NetworkAddr) + copy(dAtA[i:], m.NetworkAddr) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UnbondingNodeEntry) 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 *UnbondingNodeEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnbondingNodeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Balance != nil { + { + size := m.Balance.Size() + i -= size + if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.InitialBalance != nil { + { + size := m.InitialBalance.Size() + i -= size + if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.CompletionTime != nil { + n19, err19 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.CompletionTime):]) + if err19 != nil { + return 0, err19 + } + i -= n19 + i = encodeVarintRegister(dAtA, i, uint64(n19)) + i-- + dAtA[i] = 0x12 + } + if m.CreationHeight != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintRegister(dAtA []byte, offset int, v uint64) int { + offset -= sovRegister(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.UnbondingThreasholdTime) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.UnbondingCompletionTime) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.MaxEntries != 0 { + n += 1 + sovRegister(uint64(m.MaxEntries)) + } + return n +} + +func (m *ResourceNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.Suspend { + n += 2 + } + if m.Status != 0 { + n += 1 + sovRegister(uint64(m.Status)) + } + l = m.Tokens.Size() + n += 1 + l + sovRegister(uint64(l)) + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.Description != nil { + l = m.Description.Size() + n += 1 + l + sovRegister(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) + n += 1 + l + sovRegister(uint64(l)) + l = len(m.NodeType) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + return n +} + +func (m *IndexingNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.Suspend { + n += 2 + } + if m.Status != 0 { + n += 1 + sovRegister(uint64(m.Status)) + } + l = m.Tokens.Size() + n += 1 + l + sovRegister(uint64(l)) + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.Description != nil { + l = m.Description.Size() + n += 1 + l + sovRegister(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) + n += 1 + l + sovRegister(uint64(l)) + return n +} + +func (m *IndexingNodeRegistrationVotePool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodeAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if len(m.ApproveList) > 0 { + for _, s := range m.ApproveList { + l = len(s) + n += 1 + l + sovRegister(uint64(l)) + } + } + if len(m.RejectList) > 0 { + for _, s := range m.RejectList { + l = len(s) + n += 1 + l + sovRegister(uint64(l)) + } + } + if m.ExpireTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpireTime) + n += 1 + l + sovRegister(uint64(l)) + } + return n } func (m *Description) Size() (n int) { @@ -1323,31 +2022,940 @@ func (m *ResourceNodes) Size() (n int) { n += 1 + l + sovRegister(uint64(l)) } } - return n -} + return n +} + +func (m *IndexingNodes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.IndexingNodes) > 0 { + for _, e := range m.IndexingNodes { + l = e.Size() + n += 1 + l + sovRegister(uint64(l)) + } + } + return n +} + +func (m *TotalStakesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ResourceNodesTotalStake != nil { + l = m.ResourceNodesTotalStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.IndexingNodesTotalStake != nil { + l = m.IndexingNodesTotalStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.TotalBondedStake != nil { + l = m.TotalBondedStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.TotalUnbondedStake != nil { + l = m.TotalUnbondedStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.TotalUnbondingStake != nil { + l = m.TotalUnbondingStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + return n +} + +func (m *StakingInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.PubKey != nil { + l = m.PubKey.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.Suspend { + n += 2 + } + if m.Status != 0 { + n += 1 + sovRegister(uint64(m.Status)) + } + if m.Tokens != nil { + l = m.Tokens.Size() + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.Description != nil { + l = m.Description.Size() + n += 1 + l + sovRegister(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) + n += 1 + l + sovRegister(uint64(l)) + l = len(m.NodeType) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.BondedStake != nil { + l = m.BondedStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.UnBondingStake != nil { + l = m.UnBondingStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.UnBondedStake != nil { + l = m.UnBondedStake.Size() + n += 1 + l + sovRegister(uint64(l)) + } + return n +} + +func (m *UnbondingNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddr) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + if m.IsIndexingNode { + n += 2 + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovRegister(uint64(l)) + } + } + return n +} + +func (m *UnbondingNodeEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovRegister(uint64(m.CreationHeight)) + } + if m.CompletionTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CompletionTime) + n += 1 + l + sovRegister(uint64(l)) + } + if m.InitialBalance != nil { + l = m.InitialBalance.Size() + n += 1 + l + sovRegister(uint64(l)) + } + if m.Balance != nil { + l = m.Balance.Size() + n += 1 + l + sovRegister(uint64(l)) + } + return n +} + +func sovRegister(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRegister(x uint64) (n int) { + return sovRegister(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingThreasholdTime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UnbondingThreasholdTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingCompletionTime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UnbondingCompletionTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEntries", wireType) + } + m.MaxEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxEntries |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceNode) 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 ErrIntOverflowRegister + } + 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: ResourceNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspend = bool(v != 0) + case 4: + 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 ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Description == nil { + m.Description = &Description{} + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodeType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IndexingNode) 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 ErrIntOverflowRegister + } + 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: IndexingNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspend = bool(v != 0) + case 4: + 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 ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Description == nil { + m.Description = &Description{} + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *IndexingNodes) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.IndexingNodes) > 0 { - for _, e := range m.IndexingNodes { - l = e.Size() - n += 1 + l + sovRegister(uint64(l)) - } + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} - -func sovRegister(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozRegister(x uint64) (n int) { - return sovRegister(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *Params) Unmarshal(dAtA []byte) error { +func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1370,15 +2978,15 @@ func (m *Params) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") + return fmt.Errorf("proto: IndexingNodeRegistrationVotePool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: IndexingNodeRegistrationVotePool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1406,11 +3014,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BondDenom = string(dAtA[iNdEx:postIndex]) + m.NodeAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingThreasholdTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ApproveList", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1438,11 +3046,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UnbondingThreasholdTime = string(dAtA[iNdEx:postIndex]) + m.ApproveList = append(m.ApproveList, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingCompletionTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RejectList", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1470,13 +3078,13 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UnbondingCompletionTime = string(dAtA[iNdEx:postIndex]) + m.RejectList = append(m.RejectList, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxEntries", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpireTime", wireType) } - m.MaxEntries = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1486,11 +3094,28 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxEntries |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ExpireTime == nil { + m.ExpireTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.ExpireTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRegister(dAtA[iNdEx:]) @@ -1512,7 +3137,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } -func (m *ResourceNode) Unmarshal(dAtA []byte) error { +func (m *Description) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1535,15 +3160,15 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ResourceNode: wiretype end group for non-group") + return fmt.Errorf("proto: Description: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceNode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Description: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1571,13 +3196,13 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + m.Moniker = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1587,33 +3212,29 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} - } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Identity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) } - var v int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1623,17 +3244,29 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.Suspend = bool(v != 0) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) } - m.Status = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1643,14 +3276,27 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= types1.BondStatus(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1678,13 +3324,61 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { return err } - iNdEx = postIndex - case 6: + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Slashing) 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 ErrIntOverflowRegister + } + 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: Slashing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Slashing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1712,13 +3406,13 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + m.WalletAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } - var msglen int + m.Value = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1728,33 +3422,66 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Value |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthRegister + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthRegister } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if m.Description == nil { - m.Description = &Description{} + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceNodes) 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 ErrIntOverflowRegister } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if iNdEx >= l { + return io.ErrUnexpectedEOF } - iNdEx = postIndex - case 8: + 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: ResourceNodes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceNodes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNodes", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1764,27 +3491,79 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.NodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: + m.ResourceNodes = append(m.ResourceNodes, &ResourceNode{}) + if err := m.ResourceNodes[len(m.ResourceNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IndexingNodes) 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 ErrIntOverflowRegister + } + 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: IndexingNodes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IndexingNodes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1811,7 +3590,8 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + m.IndexingNodes = append(m.IndexingNodes, &IndexingNode{}) + if err := m.IndexingNodes[len(m.IndexingNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1836,7 +3616,7 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } return nil } -func (m *IndexingNode) Unmarshal(dAtA []byte) error { +func (m *TotalStakesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1859,17 +3639,17 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IndexingNode: wiretype end group for non-group") + return fmt.Errorf("proto: TotalStakesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TotalStakesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNodesTotalStake", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1879,27 +3659,31 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + if m.ResourceNodesTotalStake == nil { + m.ResourceNodesTotalStake = &types2.Coin{} + } + if err := m.ResourceNodesTotalStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodesTotalStake", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1926,57 +3710,18 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} + if m.IndexingNodesTotalStake == nil { + m.IndexingNodesTotalStake = &types2.Coin{} } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.IndexingNodesTotalStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegister - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Suspend = bool(v != 0) - case 4: - 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 ErrIntOverflowRegister - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= types1.BondStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalBondedStake", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -1986,61 +3731,31 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegister - } - 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 ErrInvalidLengthRegister - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegister + if m.TotalBondedStake == nil { + m.TotalBondedStake = &types2.Coin{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.TotalBondedStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.OwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalUnbondedStake", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2067,16 +3782,16 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Description == nil { - m.Description = &Description{} + if m.TotalUnbondedStake == nil { + m.TotalUnbondedStake = &types2.Coin{} } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TotalUnbondedStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 9: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalUnbondingStake", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2103,7 +3818,10 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + if m.TotalUnbondingStake == nil { + m.TotalUnbondingStake = &types2.Coin{} + } + if err := m.TotalUnbondingStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2128,7 +3846,7 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { } return nil } -func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { +func (m *StakingInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2151,15 +3869,15 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IndexingNodeRegistrationVotePool: wiretype end group for non-group") + return fmt.Errorf("proto: StakingInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IndexingNodeRegistrationVotePool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StakingInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2187,13 +3905,13 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NodeAddress = string(dAtA[iNdEx:postIndex]) + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ApproveList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2203,27 +3921,70 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.ApproveList = append(m.ApproveList, string(dAtA[iNdEx:postIndex])) + if m.PubKey == nil { + m.PubKey = &types.Any{} + } + if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspend = bool(v != 0) + case 4: + 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 ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RejectList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2251,13 +4012,17 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RejectList = append(m.RejectList, string(dAtA[iNdEx:postIndex])) + var v github_com_cosmos_cosmos_sdk_types.Int + m.Tokens = &v + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 4: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpireTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2267,80 +4032,65 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpireTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRegister(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRegister - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Description) 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 ErrIntOverflowRegister + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if m.Description == nil { + m.Description = &Description{} } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Description: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Description: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2350,27 +4100,28 @@ func (m *Description) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.Moniker = string(dAtA[iNdEx:postIndex]) + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreationTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2398,13 +4149,13 @@ func (m *Description) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.NodeType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BondedStake", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2414,29 +4165,33 @@ func (m *Description) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.Website = string(dAtA[iNdEx:postIndex]) + if m.BondedStake == nil { + m.BondedStake = &types2.Coin{} + } + if err := m.BondedStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 4: + case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UnBondingStake", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2446,29 +4201,33 @@ func (m *Description) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.SecurityContact = string(dAtA[iNdEx:postIndex]) + if m.UnBondingStake == nil { + m.UnBondingStake = &types2.Coin{} + } + if err := m.UnBondingStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 5: + case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UnBondedStake", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2478,23 +4237,27 @@ func (m *Description) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.Details = string(dAtA[iNdEx:postIndex]) + if m.UnBondedStake == nil { + m.UnBondedStake = &types2.Coin{} + } + if err := m.UnBondedStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2517,7 +4280,7 @@ func (m *Description) Unmarshal(dAtA []byte) error { } return nil } -func (m *Slashing) Unmarshal(dAtA []byte) error { +func (m *UnbondingNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2540,15 +4303,15 @@ func (m *Slashing) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Slashing: wiretype end group for non-group") + return fmt.Errorf("proto: UnbondingNode: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Slashing: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UnbondingNode: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2576,13 +4339,13 @@ func (m *Slashing) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.WalletAddress = string(dAtA[iNdEx:postIndex]) + m.NetworkAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IsIndexingNode", wireType) } - m.Value = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2592,11 +4355,46 @@ func (m *Slashing) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Value |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsIndexingNode = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRegister + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, &UnbondingNodeEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRegister(dAtA[iNdEx:]) @@ -2618,7 +4416,7 @@ func (m *Slashing) Unmarshal(dAtA []byte) error { } return nil } -func (m *ResourceNodes) Unmarshal(dAtA []byte) error { +func (m *UnbondingNodeEntry) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2641,15 +4439,34 @@ func (m *ResourceNodes) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ResourceNodes: wiretype end group for non-group") + return fmt.Errorf("proto: UnbondingNodeEntry: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceNodes: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UnbondingNodeEntry: 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 ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceNodes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2676,66 +4493,54 @@ func (m *ResourceNodes) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ResourceNodes = append(m.ResourceNodes, &ResourceNode{}) - if err := m.ResourceNodes[len(m.ResourceNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.CompletionTime == nil { + m.CompletionTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRegister(dAtA[iNdEx:]) - if err != nil { - return err + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRegister + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRegister } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IndexingNodes) 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 ErrIntOverflowRegister + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var v github_com_cosmos_cosmos_sdk_types.Int + m.InitialBalance = &v + if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IndexingNodes: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IndexingNodes: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2745,23 +4550,25 @@ func (m *IndexingNodes) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.IndexingNodes = append(m.IndexingNodes, &IndexingNode{}) - if err := m.IndexingNodes[len(m.IndexingNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + var v github_com_cosmos_cosmos_sdk_types.Int + m.Balance = &v + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/types/tx.pb.go b/x/register/types/tx.pb.go index 6dd06ce1..2ca4a24c 100644 --- a/x/register/types/tx.pb.go +++ b/x/register/types/tx.pb.go @@ -35,11 +35,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. type MsgCreateResourceNode struct { NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` - OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` - NodeType string `protobuf:"bytes,6,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` + OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` + NodeType string `protobuf:"bytes,6,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *MsgCreateResourceNode) Reset() { *m = MsgCreateResourceNode{} } @@ -157,10 +157,10 @@ var xxx_messageInfo_MsgCreateResourceNodeResponse proto.InternalMessageInfo // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. type MsgCreateIndexingNode struct { NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` - OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` } func (m *MsgCreateIndexingNode) Reset() { *m = MsgCreateIndexingNode{} } @@ -233,8 +233,8 @@ func (m *MsgCreateIndexingNode) GetDescription() *Description { // MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message type MsgRemoveResourceNode struct { - ResourceNodeAddress string `protobuf:"bytes,1,opt,name=resource_node_address,json=resourceNodeAddress,proto3" json:"resource_node_address,omitempty" yaml:"resource_node_address"` - OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + ResourceNodeAddress string `protobuf:"bytes,1,opt,name=resource_node_address,json=resourceNodeAddress,proto3" json:"resource_node_address" yaml:"resource_node_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` } func (m *MsgRemoveResourceNode) Reset() { *m = MsgRemoveResourceNode{} } @@ -346,8 +346,8 @@ var xxx_messageInfo_MsgCreateIndexingNodeResponse proto.InternalMessageInfo // MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message type MsgRemoveIndexingNode struct { - IndexingNodeAddress string `protobuf:"bytes,1,opt,name=indexing_node_address,json=indexingNodeAddress,proto3" json:"indexing_node_address,omitempty" yaml:"indexing_node_address"` - OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + IndexingNodeAddress string `protobuf:"bytes,1,opt,name=indexing_node_address,json=indexingNodeAddress,proto3" json:"indexing_node_address" yaml:"indexing_node_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` } func (m *MsgRemoveIndexingNode) Reset() { *m = MsgRemoveIndexingNode{} } @@ -423,9 +423,9 @@ var xxx_messageInfo_MsgRemoveIndexingNodeResponse proto.InternalMessageInfo // MsgUpdateResourceNode defines a SDK message for updating an existing resource node. type MsgUpdateResourceNode struct { Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description" yaml:"description"` - NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` - OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` - NodeType string `protobuf:"bytes,4,opt,name=nodeType,proto3" json:"nodeType,omitempty" yaml:"node_type"` + NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + NodeType string `protobuf:"bytes,4,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *MsgUpdateResourceNode) Reset() { *m = MsgUpdateResourceNode{} } @@ -501,8 +501,8 @@ var xxx_messageInfo_MsgUpdateResourceNodeResponse proto.InternalMessageInfo // MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. type MsgUpdateIndexingNode struct { Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description" yaml:"description"` - NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` - OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` } func (m *MsgUpdateIndexingNode) Reset() { *m = MsgUpdateIndexingNode{} } @@ -577,10 +577,10 @@ var xxx_messageInfo_MsgUpdateIndexingNodeResponse proto.InternalMessageInfo // MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. type MsgUpdateResourceNodeStake struct { - NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` - OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` - IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incrStake,omitempty" yaml:"incr_stake"` - StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"StakeDelta,omitempty" yaml:"stake_delta"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incr_stake" yaml:"incr_stake"` + StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"stake_delta" yaml:"stake_delta"` } func (m *MsgUpdateResourceNodeStake) Reset() { *m = MsgUpdateResourceNodeStake{} } @@ -655,10 +655,10 @@ var xxx_messageInfo_MsgUpdateResourceNodeStakeResponse proto.InternalMessageInfo // MsgUpdateIndexingNodeStake defines a SDK message for updating the stake of an existing indexing node. type MsgUpdateIndexingNodeStake struct { - NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` - OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` - IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incrStake,omitempty" yaml:"incr_stake"` - StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"StakeDelta,omitempty" yaml:"stake_delta"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incr_stake" yaml:"incr_stake"` + StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"stake_delta" yaml:"stake_delta"` } func (m *MsgUpdateIndexingNodeStake) Reset() { *m = MsgUpdateIndexingNodeStake{} } @@ -733,11 +733,11 @@ var xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse proto.InternalMessageInfo // MsgIndexingNodeRegistrationVote defines a SDK message for registration vote of an existing indexing node. type MsgIndexingNodeRegistrationVote struct { - CandidateNetworkAddress string `protobuf:"bytes,1,opt,name=candidate_network_address,json=candidateNetworkAddress,proto3" json:"candidate_network_address,omitempty" yaml:"candidate_network_address"` - CandidateOwnerAddress string `protobuf:"bytes,2,opt,name=candidate_owner_address,json=candidateOwnerAddress,proto3" json:"candidate_owner_address,omitempty" yaml:"candidate_owner_address"` - Opinion bool `protobuf:"varint,3,opt,name=opinion,proto3" json:"opinion,omitempty" yaml:"opinion"` - VoterNetworkAddress string `protobuf:"bytes,4,opt,name=voter_network_address,json=voterNetworkAddress,proto3" json:"voter_network_address,omitempty" yaml:"voter_network_address"` - VoterOwnerAddress string `protobuf:"bytes,5,opt,name=voter_owner_address,json=voterOwnerAddress,proto3" json:"voter_owner_address,omitempty" yaml:"voter_owner_address"` + CandidateNetworkAddress string `protobuf:"bytes,1,opt,name=candidate_network_address,json=candidateNetworkAddress,proto3" json:"candidate_network_address" yaml:"candidate_network_address"` + CandidateOwnerAddress string `protobuf:"bytes,2,opt,name=candidate_owner_address,json=candidateOwnerAddress,proto3" json:"candidate_owner_address" yaml:"candidate_owner_address"` + Opinion bool `protobuf:"varint,3,opt,name=opinion,proto3" json:"opinion" yaml:"opinion"` + VoterNetworkAddress string `protobuf:"bytes,4,opt,name=voter_network_address,json=voterNetworkAddress,proto3" json:"voter_network_address" yaml:"voter_network_address"` + VoterOwnerAddress string `protobuf:"bytes,5,opt,name=voter_owner_address,json=voterOwnerAddress,proto3" json:"voter_owner_address" yaml:"voter_owner_address"` } func (m *MsgIndexingNodeRegistrationVote) Reset() { *m = MsgIndexingNodeRegistrationVote{} } @@ -836,82 +836,86 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/tx.proto", fileDescriptor_75d4b90d7a185a31) } var fileDescriptor_75d4b90d7a185a31 = []byte{ - // 1198 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4f, 0x6f, 0xe3, 0xc4, - 0x1b, 0x8e, 0xfb, 0xef, 0xd7, 0x9d, 0x6e, 0xf7, 0xc7, 0xba, 0xe9, 0x92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x45, 0xe7, 0x5c, 0x73, 0xef, 0xf1, 0x69, 0x4d, 0x7a, 0x72, 0x5a, 0x93, 0x7e, 0x3f, 0xad, - 0x49, 0x9f, 0x9f, 0xd5, 0x4a, 0x4f, 0xce, 0x6a, 0xa5, 0x5f, 0xcf, 0x6a, 0xa5, 0xc3, 0xcd, 0x8e, - 0x4d, 0x1e, 0xf4, 0xda, 0xaa, 0x89, 0xbb, 0xc3, 0xca, 0x0e, 0x22, 0xc3, 0x9f, 0xeb, 0xe6, 0x03, - 0xc3, 0x76, 0xb4, 0x93, 0xf3, 0xc9, 0xa2, 0x8f, 0x1e, 0xbf, 0x3d, 0x47, 0xff, 0x1b, 0xb9, 0xf3, - 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x04, 0xb5, 0x64, 0x80, 0x14, 0x00, 0x00, + // 1250 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x26, 0x6e, 0x48, 0x26, 0x4d, 0xa1, 0x9b, 0x04, 0x1c, 0x93, 0x78, 0xc2, 0x40, 0x45, + 0x03, 0xca, 0xae, 0x9c, 0x06, 0x22, 0xaa, 0xf6, 0x10, 0xb7, 0x07, 0x10, 0x4a, 0x8a, 0x16, 0xe8, + 0x81, 0x8b, 0x59, 0x7b, 0x07, 0x77, 0x95, 0x78, 0xc7, 0xda, 0x5d, 0xbb, 0xf1, 0x81, 0x0b, 0x27, + 0x8e, 0x48, 0xf0, 0x01, 0x90, 0xf8, 0x02, 0x3d, 0xf4, 0x2b, 0x20, 0x55, 0x9c, 0x2a, 0x21, 0x24, + 0x90, 0xd0, 0x08, 0x25, 0x1c, 0xd0, 0x5e, 0x90, 0xcc, 0x17, 0x40, 0x3b, 0xb3, 0xbb, 0x9e, 0xb5, + 0xc7, 0xeb, 0x4d, 0x0a, 0x48, 0x48, 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5, 0xab, 0xd3, 0xf2, 0xd4, 0xd3, 0xd3, 0xf2, 0xd4, 0xcf, 0xa7, 0xe5, + 0xa9, 0x4f, 0x76, 0x9a, 0xb6, 0xff, 0xa0, 0x53, 0xd7, 0x1a, 0xa4, 0x15, 0xef, 0xec, 0x60, 0x3f, + 0xfe, 0xb9, 0xd5, 0x78, 0x60, 0xda, 0x8e, 0x7e, 0x3c, 0x38, 0x2c, 0x7c, 0x10, 0x7a, 0xf5, 0x59, + 0xf6, 0x67, 0xd7, 0x8d, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x13, 0x51, 0x52, 0xd0, 0x91, 0x16, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/register/types/unbonding_node.go b/x/register/types/unbonding_node.go index 20db4092..b635359b 100644 --- a/x/register/types/unbonding_node.go +++ b/x/register/types/unbonding_node.go @@ -2,33 +2,15 @@ package types import ( "bytes" - "fmt" - "strings" "time" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" - goamino "github.com/tendermint/go-amino" ) // ======================= -// UnbondingNode stores all of a single delegator's unbonding bonds -// for a single unbonding node in a time-ordered list -type UnbondingNode struct { - NetworkAddr stratos.SdsAddress `json:"network_addr" yaml:"network_addr"` - IsIndexingNode bool `json:"is_indexing_node yaml:"is_indexing_node` - Entries []UnbondingNodeEntry `json:"entries" yaml:"entries"` // unbonding node entries -} - -// UnbondingNodeEntry - entry to an UnbondingNode -type UnbondingNodeEntry struct { - CreationHeight int64 `json:"creation_height" yaml:"creation_height"` // height which the unbonding took place - CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the unbonding delegation will complete - InitialBalance sdk.Int `json:"initial_balance" yaml:"initial_balance"` // ustos initially scheduled to receive at completion - Balance sdk.Int `json:"balance" yaml:"balance"` // ustos to receive at completion -} - // IsMature - is the current entry mature func (e UnbondingNodeEntry) IsMature(currentTime time.Time) bool { return !e.CompletionTime.After(currentTime) @@ -40,9 +22,9 @@ func NewUnbondingNode(networkAddr stratos.SdsAddress, isIndexingNode bool, creat entry := NewUnbondingNodeEntry(creationHeight, minTime, balance) return UnbondingNode{ - NetworkAddr: networkAddr, + NetworkAddr: networkAddr.String(), IsIndexingNode: isIndexingNode, - Entries: []UnbondingNodeEntry{entry}, + Entries: []*UnbondingNodeEntry{&entry}, } } @@ -52,9 +34,9 @@ func NewUnbondingNodeEntry(creationHeight int64, completionTime time.Time, return UnbondingNodeEntry{ CreationHeight: creationHeight, - CompletionTime: completionTime, - InitialBalance: balance, - Balance: balance, + CompletionTime: &completionTime, + InitialBalance: &balance, + Balance: &balance, } } @@ -63,7 +45,7 @@ func (un *UnbondingNode) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int) { entry := NewUnbondingNodeEntry(creationHeight, minTime, balance) - un.Entries = append(un.Entries, entry) + un.Entries = append(un.Entries, &entry) } // RemoveEntry - remove entry at index i to the unbonding Node @@ -71,13 +53,13 @@ func (un *UnbondingNode) RemoveEntry(i int64) { un.Entries = append(un.Entries[:i], un.Entries[i+1:]...) } -// return the unbonding Node -func MustMarshalUnbondingNode(cdc *goamino.Codec, uin UnbondingNode) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(uin) +// MustMarshalUnbondingNode return the unbonding Node +func MustMarshalUnbondingNode(cdc codec.BinaryCodec, uin UnbondingNode) []byte { + return cdc.MustMarshalLengthPrefixed(&uin) } -// unmarshal a unbonding Node from a store value -func MustUnmarshalUnbondingNode(cdc *goamino.Codec, value []byte) UnbondingNode { +// MustUnmarshalUnbondingNode unmarshal a unbonding Node from a store value +func MustUnmarshalUnbondingNode(cdc codec.BinaryCodec, value []byte) UnbondingNode { un, err := UnmarshalUnbondingNode(cdc, value) if err != nil { panic(err) @@ -85,46 +67,27 @@ func MustUnmarshalUnbondingNode(cdc *goamino.Codec, value []byte) UnbondingNode return un } -// unmarshal a unbonding Node from a store value -func UnmarshalUnbondingNode(cdc *goamino.Codec, value []byte) (uin UnbondingNode, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &uin) +// UnmarshalUnbondingNode unmarshal a unbonding Node from a store value +func UnmarshalUnbondingNode(cdc codec.BinaryCodec, value []byte) (uin UnbondingNode, err error) { + err = cdc.UnmarshalLengthPrefixed(value, &uin) return uin, err } -// nolint +// Equal nolint // inefficient but only used in testing func (un UnbondingNode) Equal(un2 UnbondingNode) bool { - bz1 := goamino.MustMarshalBinaryLengthPrefixed(&un) - bz2 := goamino.MustMarshalBinaryLengthPrefixed(&un2) + var cdc codec.BinaryCodec + bz1 := cdc.MustMarshalLengthPrefixed(&un) + bz2 := cdc.MustMarshalLengthPrefixed(&un2) return bytes.Equal(bz1, bz2) } -func (un UnbondingNode) GetNetworkAddr() stratos.SdsAddress { - return un.NetworkAddr -} - -// String returns a human readable string representation of an UnbondingNode. -func (un UnbondingNode) String() string { - out := fmt.Sprintf(`Unbonding Nodes between: - NetworkAddr: %s, - IsIndexingNode: %t, - Entries:`, un.NetworkAddr, un.IsIndexingNode) - for i, entry := range un.Entries { - out += fmt.Sprintf(` Unbonding Node %d: - Creation Height: %v - Min time to unbond (unix): %v - Expected balance: %s`, i, entry.CreationHeight, - entry.CompletionTime, entry.Balance) - } - return out -} - // UnbondingNodes is a collection of UnbondingNode -type UnbondingNodes []UnbondingNode - -func (uns UnbondingNodes) String() (out string) { - for _, u := range uns { - out += u.String() + "\n" - } - return strings.TrimSpace(out) -} +//type UnbondingNodes []UnbondingNode + +//func (uns UnbondingNodes) String() (out string) { +// for _, u := range uns { +// out += u.String() + "\n" +// } +// return strings.TrimSpace(out) +//} From 10f5097f73126205eba7f5f8b5455d942bea7af4 Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 6 May 2022 18:34:36 -0400 Subject: [PATCH 025/113] - qb-1163: update codec related stuff --- x/register/keeper/keeper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 7a2340cf..5430652c 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -210,8 +210,12 @@ func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res keys := make(map[string]bool) for _, entry := range stringSlice { if _, value := keys[entry.String()]; !value { + bytes, err := entry.MarshalJSON() + if err != nil { + continue + } keys[entry.String()] = true - res = append(res, keeper.cdc.MustMarshalJSON(entry)...) + res = append(res, bytes...) res = append(res, ';') } } From 59b4ce4e0e821fb30e480b969a2c0510b178a94b Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 6 May 2022 18:40:21 -0400 Subject: [PATCH 026/113] - qb-1163: adapt networkAddr in string --- cmd/stchaincli/faucet.go | 504 ------------------------------------ cmd/stchaincli/main.go | 182 ------------- x/register/keeper/keeper.go | 13 +- 3 files changed, 8 insertions(+), 691 deletions(-) delete mode 100644 cmd/stchaincli/faucet.go delete mode 100644 cmd/stchaincli/main.go diff --git a/cmd/stchaincli/faucet.go b/cmd/stchaincli/faucet.go deleted file mode 100644 index b2775e01..00000000 --- a/cmd/stchaincli/faucet.go +++ /dev/null @@ -1,504 +0,0 @@ -package main - -//import ( -// "bufio" -// "fmt" -// "net" -// "net/http" -// "os" -// "os/signal" -// "strconv" -// "strings" -// "sync" -// "syscall" -// "time" -// -// "github.com/ReneKroon/ttlcache/v2" -// "github.com/cosmos/cosmos-sdk/client/context" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/client/input" -// "github.com/cosmos/cosmos-sdk/client/keys" -// "github.com/cosmos/cosmos-sdk/codec" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/types/rest" -// "github.com/cosmos/cosmos-sdk/x/auth" -// "github.com/cosmos/cosmos-sdk/x/auth/client/utils" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// "github.com/cosmos/cosmos-sdk/x/bank" -// "github.com/gorilla/mux" -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// "github.com/tendermint/tendermint/libs/cli" -//) -// -//const ( -// flagFundFrom = "from" // optional -// flagAmt = "amt" // denom fixed as ustos -// flagPort = "port" -// flagChainId = "chain-id" -// flagAddrCap = "addr-cap" -// flagIpCap = "ip-cap" -// -// defaultOutputFlag = "text" -// defaultKeyringBackend = "test" -// defaultDenom = "ustos" -// defaultChainId = "test-chain" -// defaultPort = "26600" -// defaultAddrCap = 1 -// defaultIpCap = 3 -// capDuration = 60 // in minutes -// -// maxAmtFaucet = 100000000000 -// requestInterval = 100 * time.Millisecond -//) -// -//// used in request channel -//type FaucetReq struct { -// FromAddress sdk.AccAddress -// FromName string -// From string -// -// ToAddr sdk.AccAddress -// resChan chan FaucetRsp -// Index int -//} -// -//// used in response channel -//type FaucetRsp struct { -// ErrorMsg string -// TxResponse sdk.TxResponse -// Seq uint64 -//} -// -//// used for restful response -//type RestFaucetRsp struct { -// ErrorMsg string -// TxResponse sdk.TxResponse -//} -// -//type FaucetToMiddleware struct { -// Cap int // maximum faucet cap to an individual addr during an hour -// AddrCache ttlcache.SimpleCache -//} -// -//type FromIpMiddleware struct { -// Cap int // maximum accessing times during an hour -// IpCache ttlcache.SimpleCache -//} -// -//func (ftm *FaucetToMiddleware) Middleware(h http.Handler) http.Handler { -// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// vars := mux.Vars(r) -// addr := vars["address"] -// if ftm.checkCap(addr) { -// h.ServeHTTP(w, r) -// } else { -// w.WriteHeader(http.StatusTooManyRequests) -// w.Write([]byte("Faucet request to address [" + addr + "] exceeds hourly cap (" + strconv.Itoa(ftm.Cap) + " request(s) per hour)")) -// } -// }) -//} -// -//func (ftm *FaucetToMiddleware) checkCap(toAddr string) bool { -// val, _ := ftm.AddrCache.Get(toAddr) -// if val == nil { -// ftm.AddrCache.Set(toAddr, 1) -// return true -// } -// -// if val.(int) >= ftm.Cap { -// return false -// } -// ftm.AddrCache.Set(toAddr, val.(int)+1) -// return true -//} -// -//func (fim *FromIpMiddleware) Middleware(h http.Handler) http.Handler { -// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// realIp := getRealAddr(r) -// if fim.checkCap(realIp) { -// h.ServeHTTP(w, r) -// } else { -// fmt.Printf(" ********** request from %s breached ip cap\n", realIp) -// w.WriteHeader(http.StatusTooManyRequests) -// w.Write([]byte("Faucet request from Ip " + realIp + " exceeds hourly cap (" + strconv.Itoa(fim.Cap) + " request(s) per hour)!")) -// } -// }) -//} -// -//func (fim *FromIpMiddleware) checkCap(fromIp string) bool { -// val, _ := fim.IpCache.Get(fromIp) -// if val == nil { -// fim.IpCache.Set(fromIp, 1) -// return true -// } -// -// if val.(int) >= fim.Cap { -// return false -// } -// fim.IpCache.Set(fromIp, val.(int)+1) -// return true -//} -// -//// global to load command line args -//var ( -// faucetServices = make([]FaucetService, 0) -// faucetPort = defaultPort -//) -// -//// struct to hold the command-line args -//type FaucetService struct { -// fromAddress sdk.AccAddress -// fromName string -// from string -// coins sdk.Coins -// seqInfo SeqInfo -//} -// -//type ServiceIndex struct { -// nextServiceIndex int -// lenOfService int -// mux sync.Mutex -//} -// -//func (si *ServiceIndex) getIndexAndScrollNext() int { -// if si.lenOfService < 1 { -// return 0 -// } -// si.mux.Lock() -// defer si.mux.Unlock() -// ret := si.nextServiceIndex -// if si.nextServiceIndex < si.lenOfService-1 { -// si.nextServiceIndex += 1 -// } else { -// si.nextServiceIndex = 0 -// } -// return ret -//} -// -//type SeqInfo struct { -// lastSuccSeq int -// startSeq int -// mu sync.Mutex -//} -// -//func (si *SeqInfo) incrLastSuccSeq(succSeq uint64) { -// si.mu.Lock() -// defer si.mu.Unlock() -// if si.lastSuccSeq < int(succSeq) { -// si.lastSuccSeq = int(succSeq) -// } -//} -// -//func (si *SeqInfo) getNewSeq(newStartSeq int) int { -// si.mu.Lock() -// defer si.mu.Unlock() -// -// if si.lastSuccSeq < newStartSeq-1 { -// si.lastSuccSeq = newStartSeq - 1 -// return newStartSeq -// } else { -// return si.lastSuccSeq + 1 -// } -//} -// -//func FaucetJobFromCh(faucetReq *chan FaucetReq, cliCtx context.CLIContext, txBldr authtypes.TxBuilder, from sdk.AccAddress, coin sdk.Coin, quit chan os.Signal) { -// for { -// select { -// case sig := <-quit: -// fmt.Printf("**** faucet service (sender[%s]) quit after receiving signal[%s] ****\n", from, sig.String()) -// os.Exit(0) -// case fReq := <-*faucetReq: -// resChan := fReq.resChan -// // update cliCtx -// cliCtx := cliCtx.WithFromName(fReq.FromName).WithFrom(fReq.From).WithFromAddress(fReq.FromAddress) -// -// // get latest seq and accountNumber by FromAddress -// accountNumber, latestSeq, err := authtypes.NewAccountRetriever(cliCtx).GetAccountNumberSequence(fReq.FromAddress) -// if err != nil { -// faucetRsp := FaucetRsp{ErrorMsg: "Node is under maintenance, please try again later!"} -// resChan <- faucetRsp -// continue -// } -// fmt.Printf("----sender[%s] senderIdx[%d] accNum[%d] lastSeq[%d] -----\n", cliCtx.From, fReq.Index, int(accountNumber), int(latestSeq)) -// newSeq := faucetServices[fReq.Index].seqInfo.getNewSeq(int(latestSeq)) -// err = doTransfer(cliCtx, -// txBldr. -// WithAccountNumber(accountNumber). -// WithSequence(uint64(newSeq)). -// WithChainID(viper.GetString(flags.FlagChainID)). -// WithGas(uint64(400000)). -// WithMemo(strconv.Itoa(newSeq)), -// fReq.ToAddr, fReq.FromAddress, coin, &resChan) -// if err != nil { -// faucetRsp := FaucetRsp{ErrorMsg: err.Error()} -// resChan <- faucetRsp -// } -// } -// } -//} -// -//// GetFaucetCmd returns faucet cobra Command -//func GetFaucetCmd(cdc *codec.Codec) *cobra.Command { -// -// cmd := &cobra.Command{ -// Use: "faucet", -// Short: "Run a faucet server", -// Args: cobra.RangeArgs(0, 7), -// RunE: func(cmd *cobra.Command, args []string) (err error) { -// if !viper.IsSet(flagFundFrom) { -// return fmt.Errorf("fund-from not specified") -// } -// if !viper.IsSet(flags.FlagChainID) { -// return fmt.Errorf("chain-id not specified") -// } -// if !viper.IsSet(flags.FlagKeyringBackend) { -// viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) -// } -// -// addrCap := viper.GetInt(flagAddrCap) -// ipCap := viper.GetInt(flagIpCap) -// -// fmt.Print("Set hourly addrCap = " + strconv.Itoa(addrCap) + ", hourly ipCap = " + strconv.Itoa(ipCap)) -// -// faucetToCache := ttlcache.NewCache() -// faucetToCache.SetTTL(capDuration * time.Minute) -// faucetToCache.SkipTTLExtensionOnHit(true) -// faucetToCache.SetCacheSizeLimit(65535) -// ftm := FaucetToMiddleware{AddrCache: faucetToCache, Cap: addrCap} -// -// fromIpCache := ttlcache.NewCache() -// fromIpCache.SetTTL(capDuration * time.Minute) -// fromIpCache.SkipTTLExtensionOnHit(true) -// fromIpCache.SetCacheSizeLimit(65535) -// fim := FromIpMiddleware{IpCache: fromIpCache, Cap: ipCap} -// -// // parse coins to transfer -// var toTransferAmt int -// if toTransferAmt = viper.GetInt(flagAmt); toTransferAmt <= 0 || toTransferAmt > maxAmtFaucet { -// return fmt.Errorf("invalid amount in faucet") -// } -// coin := sdk.Coin{Amount: sdk.NewInt(int64(toTransferAmt)), Denom: defaultDenom} -// -// // parse funding accs -// fromAddressesStr := viper.GetString(flagFundFrom) -// fundAccs := strings.Split(fromAddressesStr, ",") -// if len(fundAccs) < 1 { -// return fmt.Errorf("at least 1 funding acc need to be specified for faucet") -// } -// inBuf := bufio.NewReader(cmd.InOrStdin()) -// faucetReqChList := make([]chan FaucetReq, 0) -// chQuitSlice := make([]chan os.Signal, 0) -// for _, acc := range fundAccs { -// fromAddress, fromName, err := context.GetFromFields(inBuf, acc, false) -// if err != nil { -// return fmt.Errorf("failed to parse bech32 address fro FROM Address: %w", err) -// } -// -// service := FaucetService{ -// fromAddress: fromAddress, -// fromName: fromName, -// from: acc, -// coins: sdk.Coins{coin}, -// seqInfo: SeqInfo{startSeq: 0, lastSuccSeq: 0}, -// } -// faucetServices = append(faucetServices, service) -// // new reqCh for service -// reqCh := make(chan FaucetReq, 10000) -// faucetReqChList = append(faucetReqChList, reqCh) -// -// // new quit signal -// quit := make(chan os.Signal, 1) -// signal.Notify(quit, -// syscall.SIGTERM, -// syscall.SIGINT, -// syscall.SIGQUIT, -// syscall.SIGKILL, -// syscall.SIGHUP, -// ) -// chQuitSlice = append(chQuitSlice, quit) -// } -// if len(faucetServices) != len(faucetReqChList) { -// return fmt.Errorf("failed to setup context for each funding accs") -// } -// //fmt.Printf("FaucetServices are [%v]", faucetServices) -// // start threads -// txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) -// viper.Set(flags.FlagSkipConfirmation, true) -// viper.Set(cli.OutputFlag, defaultOutputFlag) -// -// cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, faucetServices[0].fromAddress.String()).WithCodec(cdc) -// -// // setup port -// portFromCmd := viper.GetString(flagPort) -// if len(portFromCmd) > 0 { -// faucetPort = portFromCmd -// } -// fmt.Print("\nfunding address: ", "addr", fromAddressesStr) -// fmt.Print("\nStarting faucet...") -// // listen to localhost:faucetPort -// listener, err := net.Listen("tcp", ":"+faucetPort) -// fmt.Print("\nlisten to [" + ":" + faucetPort + "]\n") -// -// // init serviceIndex -// serviceIndex := ServiceIndex{ -// nextServiceIndex: 0, -// lenOfService: len(faucetServices), -// } -// -// // router -// r := mux.NewRouter() -// // health check -// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { -// w.WriteHeader(http.StatusOK) -// w.Write([]byte("ok\n")) -// }) -// //faucetReqCh := make(chan FaucetReq, 10000) -// //faucet -// r.HandleFunc("/faucet/{address}", func(writer http.ResponseWriter, request *http.Request) { -// vars := mux.Vars(request) -// addr := vars["address"] -// remoteIp := getRealAddr(request) -// toAddr, err := sdk.AccAddressFromBech32(addr) -// if err != nil { -// writer.WriteHeader(http.StatusBadRequest) -// writer.Write([]byte(err.Error())) -// } -// // select a context (bonded with funding acc) -// reqIndex := serviceIndex.getIndexAndScrollNext() -// fmt.Printf("get request from ip [%s], faucet to account [%s], senderIdx[%d]\n", remoteIp, addr, reqIndex) -// resChan := make(chan FaucetRsp) -// faucetReq := FaucetReq{ -// FromAddress: faucetServices[reqIndex].fromAddress, -// FromName: faucetServices[reqIndex].fromName, -// From: faucetServices[reqIndex].from, -// ToAddr: toAddr, -// resChan: resChan, -// Index: reqIndex, -// } -// faucetReqChList[reqIndex] <- faucetReq -// -// faucetRsp := <-resChan -// if int(faucetRsp.TxResponse.Code) < 1 && len(faucetRsp.ErrorMsg) == 0 { -// // sigverify pass -// faucetServices[reqIndex].seqInfo.incrLastSuccSeq(faucetRsp.Seq) -// } -// fmt.Println("tx send=", faucetRsp.TxResponse.TxHash, ", height=", faucetRsp.TxResponse.Height, ", errorMsg=", faucetRsp.ErrorMsg, ", ip=", remoteIp, ", acc=", addr) -// restRsp := &RestFaucetRsp{ErrorMsg: faucetRsp.ErrorMsg, TxResponse: faucetRsp.TxResponse} -// rest.PostProcessResponseBare(writer, cliCtx, restRsp) -// return -// }).Methods("POST") -// // ipCap check has higher priority than toAddrCap -// r.Use(fim.Middleware) -// r.Use(ftm.Middleware) -// -// for i, _ := range faucetServices { -// go FaucetJobFromCh(&faucetReqChList[i], cliCtx, txBldr, faucetServices[i].fromAddress, coin, chQuitSlice[i]) -// } -// //start the server -// err = http.Serve(listener, r) -// if err != nil { -// fmt.Println(err.Error()) -// } -// // print stats -// fmt.Println("####################################################################") -// fmt.Println("################ Terminating faucet ##################") -// fmt.Println("####################################################################") -// return nil -// }, -// } -// -// cmd.Flags().String(flags.FlagKeyringBackend, defaultKeyringBackend, "Select keyring's backend (os|file|test)") -// cmd.Flags().String(flagAmt, "", "amt to transfer in faucet") -// cmd.Flags().String(flagFundFrom, "", "fund from address") -// cmd.Flags().String(flagPort, "26600", "port of faucet server") -// cmd.Flags().Int(flagAddrCap, defaultAddrCap, "hourly cap of faucet to a particular account address") -// cmd.Flags().Int(flagIpCap, defaultIpCap, "hourly cap of faucet from a particular IP") -// -// return cmd -//} -// -//func doTransfer(cliCtx context.CLIContext, txBldr authtypes.TxBuilder, to sdk.AccAddress, from sdk.AccAddress, coin sdk.Coin, resChan *chan FaucetRsp) error { -// //// build and sign the transaction, then broadcast to Tendermint -// msg := bank.NewMsgSend(from, to, sdk.Coins{coin}) -// msgs := []sdk.Msg{msg} -// txBldr, err := utils.PrepareTxBuilder(txBldr, cliCtx) -// if err != nil { -// return err -// } -// -// fromName := cliCtx.GetFromName() -// -// if txBldr.SimulateAndExecute() || cliCtx.Simulate { -// txBldr, err = utils.EnrichWithGas(txBldr, cliCtx, msgs) -// if err != nil { -// return err -// } -// -// gasEst := utils.GasEstimateResponse{GasEstimate: txBldr.Gas()} -// _, _ = fmt.Fprintf(os.Stderr, "%s\n", gasEst.String()) -// } -// -// if !cliCtx.SkipConfirm { -// stdSignMsg, err := txBldr.BuildSignMsg(msgs) -// if err != nil { -// return err -// } -// -// var json []byte -// if viper.GetBool(flags.FlagIndentResponse) { -// json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ") -// if err != nil { -// panic(err) -// } -// } else { -// json = cliCtx.Codec.MustMarshalJSON(stdSignMsg) -// } -// -// _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", json) -// -// buf := bufio.NewReader(os.Stdin) -// ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf) -// if err != nil || !ok { -// _, _ = fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction") -// return err -// } -// } -// // build and sign the transaction -// txBytes, err := txBldr.BuildAndSign(fromName, keys.DefaultKeyPass, msgs) -// if err != nil { -// return err -// } -// -// // broadcast to a Tendermint node -// res, err := cliCtx.BroadcastTxCommit(txBytes) -// if err != nil { -// return err -// } -// faucetRsp := FaucetRsp{TxResponse: res, Seq: txBldr.Sequence()} -// *resChan <- faucetRsp -// return nil -//} -// -//func getRealAddr(r *http.Request) string { -// remoteIP := "" -// // the default is the originating ip. but we try to find better options because this is almost -// // never the right IP -// if parts := strings.Split(r.RemoteAddr, ":"); len(parts) == 2 { -// remoteIP = parts[0] -// } -// // If we have a forwarded-for header, take the address from there -// if xff := strings.Trim(r.Header.Get("X-Forwarded-For"), ","); len(xff) > 0 { -// addrs := strings.Split(xff, ",") -// lastFwd := addrs[len(addrs)-1] -// if ip := net.ParseIP(lastFwd); ip != nil { -// remoteIP = ip.String() -// } -// // parse X-Real-Ip header -// } else if xri := r.Header.Get("X-Real-Ip"); len(xri) > 0 { -// if ip := net.ParseIP(xri); ip != nil { -// remoteIP = ip.String() -// } -// } -// return remoteIP -//} diff --git a/cmd/stchaincli/main.go b/cmd/stchaincli/main.go deleted file mode 100644 index bd9744b9..00000000 --- a/cmd/stchaincli/main.go +++ /dev/null @@ -1,182 +0,0 @@ -package main - -//import ( -// "fmt" -// "os" -// "path" -// -// "github.com/cosmos/cosmos-sdk/client" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/client/keys" -// "github.com/cosmos/cosmos-sdk/client/lcd" -// "github.com/cosmos/cosmos-sdk/client/rpc" -// "github.com/cosmos/cosmos-sdk/version" -// "github.com/cosmos/cosmos-sdk/x/auth" -// authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" -// authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" -// "github.com/cosmos/cosmos-sdk/x/bank" -// bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" -// govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli" -// reportcmd "github.com/stratosnet/stratos-chain/x/pot/client/cli" -// uploadcmd "github.com/stratosnet/stratos-chain/x/sds/client/cli" -// -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// -// "github.com/tendermint/go-amino" -// "github.com/tendermint/tendermint/libs/cli" -// -// "github.com/stratosnet/stratos-chain/app" -// // this line is used by starport scaffolding # 1 -//) -// -//func main() { -// // Configure cobra to sort commands -// cobra.EnableCommandSorting = false -// -// // Instantiate the codec for the command line application -// cdc := app.MakeCodec() -// -// app.SetConfig() -// -// // TODO: setup keybase, viper object, etc. to be passed into -// // the below functions and eliminate global vars, like we do -// // with the cdc -// -// rootCmd := &cobra.Command{ -// Use: "stchaincli", -// Short: "Command line interface for interacting with stratoschaind", -// } -// -// // Add --chain-id to persistent flags and mark it required -// rootCmd.PersistentFlags().String(flags.FlagChainID, "", "Chain ID of tendermint node") -// rootCmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error { -// return initConfig(rootCmd) -// } -// -// // Construct Root Command -// rootCmd.AddCommand( -// rpc.StatusCommand(), -// client.ConfigCmd(app.DefaultCLIHome), -// queryCmd(cdc), -// txCmd(cdc), -// flags.LineBreak, -// lcd.ServeCommand(cdc, registerRoutes), -// flags.LineBreak, -// GetFaucetCmd(cdc), -// flags.LineBreak, -// keys.Commands(), -// flags.LineBreak, -// version.Cmd, -// flags.NewCompletionCmd(rootCmd, true), -// -// flags.LineBreak, -// ) -// -// // Add flags and prefix all env exposed with AA -// executor := cli.PrepareMainCmd(rootCmd, "AA", app.DefaultCLIHome) -// -// err := executor.Execute() -// if err != nil { -// fmt.Printf("Failed executing CLI command: %s, exiting...\n", err) -// os.Exit(1) -// } -//} -// -//func queryCmd(cdc *amino.Codec) *cobra.Command { -// queryCmd := &cobra.Command{ -// Use: "query", -// Aliases: []string{"q"}, -// Short: "Querying subcommands", -// } -// -// queryCmd.AddCommand( -// authcmd.GetAccountCmd(cdc), -// flags.LineBreak, -// rpc.ValidatorCommand(cdc), -// rpc.BlockCommand(), -// authcmd.QueryTxsByEventsCmd(cdc), -// authcmd.QueryTxCmd(cdc), -// flags.LineBreak, -// ) -// -// // add modules' query commands -// app.ModuleBasics.AddQueryCommands(queryCmd, cdc) -// -// return queryCmd -//} -// -//func txCmd(cdc *amino.Codec) *cobra.Command { -// txCmd := &cobra.Command{ -// Use: "tx", -// Short: "Transactions subcommands", -// } -// -// txCmd.AddCommand( -// bankcmd.SendTxCmd(cdc), -// flags.LineBreak, -// uploadcmd.FileUploadTxCmd(cdc), -// reportcmd.VolumeReportCmd(cdc), -// flags.LineBreak, -// govcmd.GetCmdSubmitProposal(cdc), -// govcmd.GetCmdDeposit(cdc), -// govcmd.GetCmdVote(cdc), -// flags.LineBreak, -// authcmd.GetSignCommand(cdc), -// authcmd.GetMultiSignCommand(cdc), -// flags.LineBreak, -// authcmd.GetBroadcastCommand(cdc), -// authcmd.GetEncodeCommand(cdc), -// authcmd.GetDecodeCommand(cdc), -// flags.LineBreak, -// ) -// -// // add modules' tx commands -// app.ModuleBasics.AddTxCommands(txCmd, cdc) -// -// // remove auth and bank commands as they're mounted under the root tx command -// var cmdsToRemove []*cobra.Command -// -// for _, cmd := range txCmd.Commands() { -// if cmd.Use == auth.ModuleName || cmd.Use == bank.ModuleName { -// cmdsToRemove = append(cmdsToRemove, cmd) -// } -// } -// -// txCmd.RemoveCommand(cmdsToRemove...) -// -// return txCmd -//} -// -//// registerRoutes registers the routes from the different modules for the LCD. -//// NOTE: details on the routes added for each module are in the module documentation -//// NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go -//func registerRoutes(rs *lcd.RestServer) { -// client.RegisterRoutes(rs.CliCtx, rs.Mux) -// authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) -// app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) -// // this line is used by starport scaffolding # 2 -//} -// -//func initConfig(cmd *cobra.Command) error { -// home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) -// if err != nil { -// return err -// } -// -// cfgFile := path.Join(home, "config", "config.toml") -// if _, err := os.Stat(cfgFile); err == nil { -// viper.SetConfigFile(cfgFile) -// -// if err := viper.ReadInConfig(); err != nil { -// return err -// } -// } -// if err := viper.BindPFlag(flags.FlagChainID, cmd.PersistentFlags().Lookup(flags.FlagChainID)); err != nil { -// return err -// } -// if err := viper.BindPFlag(cli.EncodingFlag, cmd.PersistentFlags().Lookup(cli.EncodingFlag)); err != nil { -// return err -// } -// return viper.BindPFlag(cli.OutputFlag, cmd.PersistentFlags().Lookup(cli.OutputFlag)) -//} diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 5430652c..8ac191f2 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -285,14 +285,16 @@ func (k Keeper) HasMaxUnbondingNodeEntries(ctx sdk.Context, networkAddr stratos. func (k Keeper) SetUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalUnbondingNode(k.cdc, ubd) - key := types.GetUBDNodeKey(ubd.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) + key := types.GetUBDNodeKey(networkAddr) store.Set(key, bz) } // remove the unbonding IndexingNode object func (k Keeper) RemoveUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) - key := types.GetUBDNodeKey(ubd.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) + key := types.GetUBDNodeKey(networkAddr) store.Delete(key) } @@ -337,7 +339,7 @@ func (k Keeper) InsertUnbondingNodeQueue(ctx sdk.Context, ubd types.UnbondingNod completionTime time.Time) { timeSlice := k.GetUnbondingNodeQueueTimeSlice(ctx, completionTime) - networkAddr := ubd.NetworkAddr + networkAddr, _ := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) if len(timeSlice) == 0 { k.SetUnbondingNodeQueueTimeSlice(ctx, completionTime, []stratos.SdsAddress{networkAddr}) } else { @@ -426,16 +428,17 @@ func (k Keeper) CompleteUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddres } func (k Keeper) SubtractUBDNodeStake(ctx sdk.Context, ubd types.UnbondingNode, tokenToSub sdk.Coin) error { + networkAddr, _ := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) // case of indexing node if ubd.IsIndexingNode { - indexingNode, found := k.GetIndexingNode(ctx, ubd.NetworkAddr) + indexingNode, found := k.GetIndexingNode(ctx, networkAddr) if !found { return types.ErrNoIndexingNodeFound } return k.SubtractIndexingNodeStake(ctx, indexingNode, tokenToSub) } // case of resource node - resourceNode, found := k.GetResourceNode(ctx, ubd.NetworkAddr) + resourceNode, found := k.GetResourceNode(ctx, networkAddr) if !found { return types.ErrNoIndexingNodeFound } From ac2fef4861fc9b66f14e3e1a712cd2c5a7aa08b6 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 6 May 2022 19:05:31 -0400 Subject: [PATCH 027/113] modified keeper.go --- x/register/keeper/keeper.go | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 7a2340cf..b8ed23c1 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -281,14 +281,22 @@ func (k Keeper) HasMaxUnbondingNodeEntries(ctx sdk.Context, networkAddr stratos. func (k Keeper) SetUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalUnbondingNode(k.cdc, ubd) - key := types.GetUBDNodeKey(ubd.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) + if err != nil { + return + } + key := types.GetUBDNodeKey(networkAddr) store.Set(key, bz) } // remove the unbonding IndexingNode object func (k Keeper) RemoveUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) - key := types.GetUBDNodeKey(ubd.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) + if err != nil { + return + } + key := types.GetUBDNodeKey(networkAddr) store.Delete(key) } @@ -333,7 +341,10 @@ func (k Keeper) InsertUnbondingNodeQueue(ctx sdk.Context, ubd types.UnbondingNod completionTime time.Time) { timeSlice := k.GetUnbondingNodeQueueTimeSlice(ctx, completionTime) - networkAddr := ubd.NetworkAddr + networkAddr, err := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) + if err != nil { + return + } if len(timeSlice) == 0 { k.SetUnbondingNodeQueueTimeSlice(ctx, completionTime, []stratos.SdsAddress{networkAddr}) } else { @@ -393,7 +404,7 @@ func (k Keeper) CompleteUnbondingWithAmount(ctx sdk.Context, networkAddr stratos // track undelegation only when remaining or truncated shares are non-zero if !entry.Balance.IsZero() { - amt := sdk.NewCoin(bondDenom, entry.Balance) + amt := sdk.NewCoin(bondDenom, *entry.Balance) err := k.SubtractUBDNodeStake(ctx, ubd, amt) if err != nil { return nil, false, err @@ -423,15 +434,19 @@ func (k Keeper) CompleteUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddres func (k Keeper) SubtractUBDNodeStake(ctx sdk.Context, ubd types.UnbondingNode, tokenToSub sdk.Coin) error { // case of indexing node + networkAddr, err := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) + if err != nil { + return err + } if ubd.IsIndexingNode { - indexingNode, found := k.GetIndexingNode(ctx, ubd.NetworkAddr) + indexingNode, found := k.GetIndexingNode(ctx, networkAddr) if !found { return types.ErrNoIndexingNodeFound } return k.SubtractIndexingNodeStake(ctx, indexingNode, tokenToSub) } // case of resource node - resourceNode, found := k.GetResourceNode(ctx, ubd.NetworkAddr) + resourceNode, found := k.GetResourceNode(ctx, networkAddr) if !found { return types.ErrNoIndexingNodeFound } @@ -558,7 +573,7 @@ func (k Keeper) GetAllUnbondingNodesTotalBalance(ctx sdk.Context) sdk.Int { for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) for _, entry := range node.Entries { - ubdTotal = ubdTotal.Add(entry.Balance) + ubdTotal = ubdTotal.Add(*entry.Balance) } } return ubdTotal @@ -579,7 +594,7 @@ func (k Keeper) GetUnbondingNodeBalance(ctx sdk.Context, ubd := types.MustUnmarshalUnbondingNode(k.cdc, value) for _, entry := range ubd.Entries { - balance = balance.Add(entry.Balance) + balance = balance.Add(*entry.Balance) } return balance } From 78f6f2b78f78cb08475f1414e9960d32019d12b2 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 6 May 2022 19:12:58 -0400 Subject: [PATCH 028/113] modified keeper.go --- x/register/keeper/keeper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index b8ed23c1..e3d014c7 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -66,7 +66,7 @@ func (k *Keeper) SetHooks(sh types.RegisterHooks) *Keeper { func (k Keeper) SetInitialUOzonePrice(ctx sdk.Context, price sdk.Dec) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalLengthPrefixed(&price) + b := amino.MustMarshalBinaryLengthPrefixed(&price) store.Set(types.InitialUOzonePriceKey, b) } @@ -211,7 +211,7 @@ func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res for _, entry := range stringSlice { if _, value := keys[entry.String()]; !value { keys[entry.String()] = true - res = append(res, keeper.cdc.MustMarshalJSON(entry)...) + res = append(res, codec.NewLegacyAmino().MustMarshalJSON(entry)...) res = append(res, ';') } } From 7b22c0c55f9cc991386c48370efca8ec477451f7 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 6 May 2022 19:20:42 -0400 Subject: [PATCH 029/113] modified querier.go --- x/register/client/rest/query.go | 4 ++-- x/register/types/querier.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/x/register/client/rest/query.go b/x/register/client/rest/query.go index 681ea26f..3b2bf13c 100644 --- a/x/register/client/rest/query.go +++ b/x/register/client/rest/query.go @@ -81,7 +81,7 @@ func nodesWithParamsFn(clientCtx client.Context, queryPath string) http.HandlerF } } - params := types.NewQueryNodesParams(networkAddr, moniker, ownerAddr) + params := types.NewQueryNodesParams(page, limit, networkAddr, moniker, ownerAddr) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) @@ -190,7 +190,7 @@ func nodeStakingByOwnerFn(cliCtx client.Context, queryPath string) http.HandlerF return } - params := types.NewQueryNodesParams(nil, "", nodeWalletAddress) + params := types.NewQueryNodesParams(page, limit, nil, "", nodeWalletAddress) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { return diff --git a/x/register/types/querier.go b/x/register/types/querier.go index 3b01d62d..8927e1df 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -37,6 +37,14 @@ type QueryNodeStakingParams struct { QueryType int64 //0:All(Default) 1: indexingNode; 2: ResourceNode } +// NewQueryNodeStakingParams creates a new instance of QueryNodesParams +func NewQueryNodeStakingParams(nodeAddr stratos.SdsAddress, queryType int64) QueryNodeStakingParams { + return QueryNodeStakingParams{ + AccAddr: nodeAddr, + QueryType: queryType, + } +} + // NewQueryNodesStakingInfo creates a new instance of TotalStakesResponse func NewQueryNodesStakingInfo(ResourceNodeTotalStake, IndexingNodeTotalStake, totalBondedStake, totalUnbondedStake, totalUnbondingStake sdk.Int) *TotalStakesResponse { resValue := sdk.NewCoin(defaultDenom, ResourceNodeTotalStake) From 893917be3f29302630b4e4b6fee7fbd2280b2e81 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 6 May 2022 19:55:39 -0400 Subject: [PATCH 030/113] modified app.go --- app/app.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/app.go b/app/app.go index 2a84002e..76df2a4c 100644 --- a/app/app.go +++ b/app/app.go @@ -98,6 +98,7 @@ import ( evmrest "github.com/stratosnet/stratos-chain/x/evm/client/rest" evmkeeper "github.com/stratosnet/stratos-chain/x/evm/keeper" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" + registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" //"github.com/stratosnet/stratos-chain/x/pot" //pottypes "github.com/stratosnet/stratos-chain/x/pot/types" //"github.com/stratosnet/stratos-chain/x/register" @@ -202,7 +203,7 @@ type NewApp struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper // stratos keepers - registerKeeper register.Keeper + registerKeeper registerkeeper.Keeper //potKeeper pot.Keeper //sdsKeeper sds.Keeper evmKeeper *evmkeeper.Keeper @@ -248,7 +249,7 @@ func NewInitApp( // ibc keys ibchost.StoreKey, ibctransfertypes.StoreKey, // stratos keys - register.StoreKey, + registertypes.StoreKey, //pot.StoreKey, sds.StoreKey, evmtypes.StoreKey, ) @@ -372,10 +373,10 @@ func NewInitApp( app.evidenceKeeper = *evidenceKeeper // Create Stratos keepers - app.registerKeeper = register.NewKeeper( - app.cdc, - keys[register.StoreKey], - app.subspaces[register.ModuleName], + app.registerKeeper = registerkeeper.NewKeeper( + appCodec, + keys[registertypes.StoreKey], + app.GetSubspace(registertypes.ModuleName), app.accountKeeper, app.bankKeeper, ) @@ -445,6 +446,7 @@ func NewInitApp( upgradetypes.ModuleName, capabilitytypes.ModuleName, evmtypes.ModuleName, + registertypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, From d13babb5be958291fe83904029edd91cadcd6675 Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 9 May 2022 11:07:55 -0400 Subject: [PATCH 031/113] - qb-1163: fix register module init --- app/app.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/app.go b/app/app.go index 76df2a4c..74c0748f 100644 --- a/app/app.go +++ b/app/app.go @@ -520,6 +520,7 @@ func NewInitApp( // NOTE: crisis module must go at the end to check for invariants on each module crisistypes.ModuleName, + registertypes.ModuleName, ) app.mm.RegisterInvariants(&app.crisisKeeper) From 7c8327e23a3c960df6f2a32f30fd3c6d8b5311a8 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 9 May 2022 11:11:50 -0400 Subject: [PATCH 032/113] removed stchaincli --- cmd/stchaincli/faucet.go | 504 --------------------------------------- cmd/stchaincli/main.go | 182 -------------- 2 files changed, 686 deletions(-) delete mode 100644 cmd/stchaincli/faucet.go delete mode 100644 cmd/stchaincli/main.go diff --git a/cmd/stchaincli/faucet.go b/cmd/stchaincli/faucet.go deleted file mode 100644 index b2775e01..00000000 --- a/cmd/stchaincli/faucet.go +++ /dev/null @@ -1,504 +0,0 @@ -package main - -//import ( -// "bufio" -// "fmt" -// "net" -// "net/http" -// "os" -// "os/signal" -// "strconv" -// "strings" -// "sync" -// "syscall" -// "time" -// -// "github.com/ReneKroon/ttlcache/v2" -// "github.com/cosmos/cosmos-sdk/client/context" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/client/input" -// "github.com/cosmos/cosmos-sdk/client/keys" -// "github.com/cosmos/cosmos-sdk/codec" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/types/rest" -// "github.com/cosmos/cosmos-sdk/x/auth" -// "github.com/cosmos/cosmos-sdk/x/auth/client/utils" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// "github.com/cosmos/cosmos-sdk/x/bank" -// "github.com/gorilla/mux" -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// "github.com/tendermint/tendermint/libs/cli" -//) -// -//const ( -// flagFundFrom = "from" // optional -// flagAmt = "amt" // denom fixed as ustos -// flagPort = "port" -// flagChainId = "chain-id" -// flagAddrCap = "addr-cap" -// flagIpCap = "ip-cap" -// -// defaultOutputFlag = "text" -// defaultKeyringBackend = "test" -// defaultDenom = "ustos" -// defaultChainId = "test-chain" -// defaultPort = "26600" -// defaultAddrCap = 1 -// defaultIpCap = 3 -// capDuration = 60 // in minutes -// -// maxAmtFaucet = 100000000000 -// requestInterval = 100 * time.Millisecond -//) -// -//// used in request channel -//type FaucetReq struct { -// FromAddress sdk.AccAddress -// FromName string -// From string -// -// ToAddr sdk.AccAddress -// resChan chan FaucetRsp -// Index int -//} -// -//// used in response channel -//type FaucetRsp struct { -// ErrorMsg string -// TxResponse sdk.TxResponse -// Seq uint64 -//} -// -//// used for restful response -//type RestFaucetRsp struct { -// ErrorMsg string -// TxResponse sdk.TxResponse -//} -// -//type FaucetToMiddleware struct { -// Cap int // maximum faucet cap to an individual addr during an hour -// AddrCache ttlcache.SimpleCache -//} -// -//type FromIpMiddleware struct { -// Cap int // maximum accessing times during an hour -// IpCache ttlcache.SimpleCache -//} -// -//func (ftm *FaucetToMiddleware) Middleware(h http.Handler) http.Handler { -// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// vars := mux.Vars(r) -// addr := vars["address"] -// if ftm.checkCap(addr) { -// h.ServeHTTP(w, r) -// } else { -// w.WriteHeader(http.StatusTooManyRequests) -// w.Write([]byte("Faucet request to address [" + addr + "] exceeds hourly cap (" + strconv.Itoa(ftm.Cap) + " request(s) per hour)")) -// } -// }) -//} -// -//func (ftm *FaucetToMiddleware) checkCap(toAddr string) bool { -// val, _ := ftm.AddrCache.Get(toAddr) -// if val == nil { -// ftm.AddrCache.Set(toAddr, 1) -// return true -// } -// -// if val.(int) >= ftm.Cap { -// return false -// } -// ftm.AddrCache.Set(toAddr, val.(int)+1) -// return true -//} -// -//func (fim *FromIpMiddleware) Middleware(h http.Handler) http.Handler { -// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// realIp := getRealAddr(r) -// if fim.checkCap(realIp) { -// h.ServeHTTP(w, r) -// } else { -// fmt.Printf(" ********** request from %s breached ip cap\n", realIp) -// w.WriteHeader(http.StatusTooManyRequests) -// w.Write([]byte("Faucet request from Ip " + realIp + " exceeds hourly cap (" + strconv.Itoa(fim.Cap) + " request(s) per hour)!")) -// } -// }) -//} -// -//func (fim *FromIpMiddleware) checkCap(fromIp string) bool { -// val, _ := fim.IpCache.Get(fromIp) -// if val == nil { -// fim.IpCache.Set(fromIp, 1) -// return true -// } -// -// if val.(int) >= fim.Cap { -// return false -// } -// fim.IpCache.Set(fromIp, val.(int)+1) -// return true -//} -// -//// global to load command line args -//var ( -// faucetServices = make([]FaucetService, 0) -// faucetPort = defaultPort -//) -// -//// struct to hold the command-line args -//type FaucetService struct { -// fromAddress sdk.AccAddress -// fromName string -// from string -// coins sdk.Coins -// seqInfo SeqInfo -//} -// -//type ServiceIndex struct { -// nextServiceIndex int -// lenOfService int -// mux sync.Mutex -//} -// -//func (si *ServiceIndex) getIndexAndScrollNext() int { -// if si.lenOfService < 1 { -// return 0 -// } -// si.mux.Lock() -// defer si.mux.Unlock() -// ret := si.nextServiceIndex -// if si.nextServiceIndex < si.lenOfService-1 { -// si.nextServiceIndex += 1 -// } else { -// si.nextServiceIndex = 0 -// } -// return ret -//} -// -//type SeqInfo struct { -// lastSuccSeq int -// startSeq int -// mu sync.Mutex -//} -// -//func (si *SeqInfo) incrLastSuccSeq(succSeq uint64) { -// si.mu.Lock() -// defer si.mu.Unlock() -// if si.lastSuccSeq < int(succSeq) { -// si.lastSuccSeq = int(succSeq) -// } -//} -// -//func (si *SeqInfo) getNewSeq(newStartSeq int) int { -// si.mu.Lock() -// defer si.mu.Unlock() -// -// if si.lastSuccSeq < newStartSeq-1 { -// si.lastSuccSeq = newStartSeq - 1 -// return newStartSeq -// } else { -// return si.lastSuccSeq + 1 -// } -//} -// -//func FaucetJobFromCh(faucetReq *chan FaucetReq, cliCtx context.CLIContext, txBldr authtypes.TxBuilder, from sdk.AccAddress, coin sdk.Coin, quit chan os.Signal) { -// for { -// select { -// case sig := <-quit: -// fmt.Printf("**** faucet service (sender[%s]) quit after receiving signal[%s] ****\n", from, sig.String()) -// os.Exit(0) -// case fReq := <-*faucetReq: -// resChan := fReq.resChan -// // update cliCtx -// cliCtx := cliCtx.WithFromName(fReq.FromName).WithFrom(fReq.From).WithFromAddress(fReq.FromAddress) -// -// // get latest seq and accountNumber by FromAddress -// accountNumber, latestSeq, err := authtypes.NewAccountRetriever(cliCtx).GetAccountNumberSequence(fReq.FromAddress) -// if err != nil { -// faucetRsp := FaucetRsp{ErrorMsg: "Node is under maintenance, please try again later!"} -// resChan <- faucetRsp -// continue -// } -// fmt.Printf("----sender[%s] senderIdx[%d] accNum[%d] lastSeq[%d] -----\n", cliCtx.From, fReq.Index, int(accountNumber), int(latestSeq)) -// newSeq := faucetServices[fReq.Index].seqInfo.getNewSeq(int(latestSeq)) -// err = doTransfer(cliCtx, -// txBldr. -// WithAccountNumber(accountNumber). -// WithSequence(uint64(newSeq)). -// WithChainID(viper.GetString(flags.FlagChainID)). -// WithGas(uint64(400000)). -// WithMemo(strconv.Itoa(newSeq)), -// fReq.ToAddr, fReq.FromAddress, coin, &resChan) -// if err != nil { -// faucetRsp := FaucetRsp{ErrorMsg: err.Error()} -// resChan <- faucetRsp -// } -// } -// } -//} -// -//// GetFaucetCmd returns faucet cobra Command -//func GetFaucetCmd(cdc *codec.Codec) *cobra.Command { -// -// cmd := &cobra.Command{ -// Use: "faucet", -// Short: "Run a faucet server", -// Args: cobra.RangeArgs(0, 7), -// RunE: func(cmd *cobra.Command, args []string) (err error) { -// if !viper.IsSet(flagFundFrom) { -// return fmt.Errorf("fund-from not specified") -// } -// if !viper.IsSet(flags.FlagChainID) { -// return fmt.Errorf("chain-id not specified") -// } -// if !viper.IsSet(flags.FlagKeyringBackend) { -// viper.Set(flags.FlagKeyringBackend, defaultKeyringBackend) -// } -// -// addrCap := viper.GetInt(flagAddrCap) -// ipCap := viper.GetInt(flagIpCap) -// -// fmt.Print("Set hourly addrCap = " + strconv.Itoa(addrCap) + ", hourly ipCap = " + strconv.Itoa(ipCap)) -// -// faucetToCache := ttlcache.NewCache() -// faucetToCache.SetTTL(capDuration * time.Minute) -// faucetToCache.SkipTTLExtensionOnHit(true) -// faucetToCache.SetCacheSizeLimit(65535) -// ftm := FaucetToMiddleware{AddrCache: faucetToCache, Cap: addrCap} -// -// fromIpCache := ttlcache.NewCache() -// fromIpCache.SetTTL(capDuration * time.Minute) -// fromIpCache.SkipTTLExtensionOnHit(true) -// fromIpCache.SetCacheSizeLimit(65535) -// fim := FromIpMiddleware{IpCache: fromIpCache, Cap: ipCap} -// -// // parse coins to transfer -// var toTransferAmt int -// if toTransferAmt = viper.GetInt(flagAmt); toTransferAmt <= 0 || toTransferAmt > maxAmtFaucet { -// return fmt.Errorf("invalid amount in faucet") -// } -// coin := sdk.Coin{Amount: sdk.NewInt(int64(toTransferAmt)), Denom: defaultDenom} -// -// // parse funding accs -// fromAddressesStr := viper.GetString(flagFundFrom) -// fundAccs := strings.Split(fromAddressesStr, ",") -// if len(fundAccs) < 1 { -// return fmt.Errorf("at least 1 funding acc need to be specified for faucet") -// } -// inBuf := bufio.NewReader(cmd.InOrStdin()) -// faucetReqChList := make([]chan FaucetReq, 0) -// chQuitSlice := make([]chan os.Signal, 0) -// for _, acc := range fundAccs { -// fromAddress, fromName, err := context.GetFromFields(inBuf, acc, false) -// if err != nil { -// return fmt.Errorf("failed to parse bech32 address fro FROM Address: %w", err) -// } -// -// service := FaucetService{ -// fromAddress: fromAddress, -// fromName: fromName, -// from: acc, -// coins: sdk.Coins{coin}, -// seqInfo: SeqInfo{startSeq: 0, lastSuccSeq: 0}, -// } -// faucetServices = append(faucetServices, service) -// // new reqCh for service -// reqCh := make(chan FaucetReq, 10000) -// faucetReqChList = append(faucetReqChList, reqCh) -// -// // new quit signal -// quit := make(chan os.Signal, 1) -// signal.Notify(quit, -// syscall.SIGTERM, -// syscall.SIGINT, -// syscall.SIGQUIT, -// syscall.SIGKILL, -// syscall.SIGHUP, -// ) -// chQuitSlice = append(chQuitSlice, quit) -// } -// if len(faucetServices) != len(faucetReqChList) { -// return fmt.Errorf("failed to setup context for each funding accs") -// } -// //fmt.Printf("FaucetServices are [%v]", faucetServices) -// // start threads -// txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) -// viper.Set(flags.FlagSkipConfirmation, true) -// viper.Set(cli.OutputFlag, defaultOutputFlag) -// -// cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, faucetServices[0].fromAddress.String()).WithCodec(cdc) -// -// // setup port -// portFromCmd := viper.GetString(flagPort) -// if len(portFromCmd) > 0 { -// faucetPort = portFromCmd -// } -// fmt.Print("\nfunding address: ", "addr", fromAddressesStr) -// fmt.Print("\nStarting faucet...") -// // listen to localhost:faucetPort -// listener, err := net.Listen("tcp", ":"+faucetPort) -// fmt.Print("\nlisten to [" + ":" + faucetPort + "]\n") -// -// // init serviceIndex -// serviceIndex := ServiceIndex{ -// nextServiceIndex: 0, -// lenOfService: len(faucetServices), -// } -// -// // router -// r := mux.NewRouter() -// // health check -// r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { -// w.WriteHeader(http.StatusOK) -// w.Write([]byte("ok\n")) -// }) -// //faucetReqCh := make(chan FaucetReq, 10000) -// //faucet -// r.HandleFunc("/faucet/{address}", func(writer http.ResponseWriter, request *http.Request) { -// vars := mux.Vars(request) -// addr := vars["address"] -// remoteIp := getRealAddr(request) -// toAddr, err := sdk.AccAddressFromBech32(addr) -// if err != nil { -// writer.WriteHeader(http.StatusBadRequest) -// writer.Write([]byte(err.Error())) -// } -// // select a context (bonded with funding acc) -// reqIndex := serviceIndex.getIndexAndScrollNext() -// fmt.Printf("get request from ip [%s], faucet to account [%s], senderIdx[%d]\n", remoteIp, addr, reqIndex) -// resChan := make(chan FaucetRsp) -// faucetReq := FaucetReq{ -// FromAddress: faucetServices[reqIndex].fromAddress, -// FromName: faucetServices[reqIndex].fromName, -// From: faucetServices[reqIndex].from, -// ToAddr: toAddr, -// resChan: resChan, -// Index: reqIndex, -// } -// faucetReqChList[reqIndex] <- faucetReq -// -// faucetRsp := <-resChan -// if int(faucetRsp.TxResponse.Code) < 1 && len(faucetRsp.ErrorMsg) == 0 { -// // sigverify pass -// faucetServices[reqIndex].seqInfo.incrLastSuccSeq(faucetRsp.Seq) -// } -// fmt.Println("tx send=", faucetRsp.TxResponse.TxHash, ", height=", faucetRsp.TxResponse.Height, ", errorMsg=", faucetRsp.ErrorMsg, ", ip=", remoteIp, ", acc=", addr) -// restRsp := &RestFaucetRsp{ErrorMsg: faucetRsp.ErrorMsg, TxResponse: faucetRsp.TxResponse} -// rest.PostProcessResponseBare(writer, cliCtx, restRsp) -// return -// }).Methods("POST") -// // ipCap check has higher priority than toAddrCap -// r.Use(fim.Middleware) -// r.Use(ftm.Middleware) -// -// for i, _ := range faucetServices { -// go FaucetJobFromCh(&faucetReqChList[i], cliCtx, txBldr, faucetServices[i].fromAddress, coin, chQuitSlice[i]) -// } -// //start the server -// err = http.Serve(listener, r) -// if err != nil { -// fmt.Println(err.Error()) -// } -// // print stats -// fmt.Println("####################################################################") -// fmt.Println("################ Terminating faucet ##################") -// fmt.Println("####################################################################") -// return nil -// }, -// } -// -// cmd.Flags().String(flags.FlagKeyringBackend, defaultKeyringBackend, "Select keyring's backend (os|file|test)") -// cmd.Flags().String(flagAmt, "", "amt to transfer in faucet") -// cmd.Flags().String(flagFundFrom, "", "fund from address") -// cmd.Flags().String(flagPort, "26600", "port of faucet server") -// cmd.Flags().Int(flagAddrCap, defaultAddrCap, "hourly cap of faucet to a particular account address") -// cmd.Flags().Int(flagIpCap, defaultIpCap, "hourly cap of faucet from a particular IP") -// -// return cmd -//} -// -//func doTransfer(cliCtx context.CLIContext, txBldr authtypes.TxBuilder, to sdk.AccAddress, from sdk.AccAddress, coin sdk.Coin, resChan *chan FaucetRsp) error { -// //// build and sign the transaction, then broadcast to Tendermint -// msg := bank.NewMsgSend(from, to, sdk.Coins{coin}) -// msgs := []sdk.Msg{msg} -// txBldr, err := utils.PrepareTxBuilder(txBldr, cliCtx) -// if err != nil { -// return err -// } -// -// fromName := cliCtx.GetFromName() -// -// if txBldr.SimulateAndExecute() || cliCtx.Simulate { -// txBldr, err = utils.EnrichWithGas(txBldr, cliCtx, msgs) -// if err != nil { -// return err -// } -// -// gasEst := utils.GasEstimateResponse{GasEstimate: txBldr.Gas()} -// _, _ = fmt.Fprintf(os.Stderr, "%s\n", gasEst.String()) -// } -// -// if !cliCtx.SkipConfirm { -// stdSignMsg, err := txBldr.BuildSignMsg(msgs) -// if err != nil { -// return err -// } -// -// var json []byte -// if viper.GetBool(flags.FlagIndentResponse) { -// json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ") -// if err != nil { -// panic(err) -// } -// } else { -// json = cliCtx.Codec.MustMarshalJSON(stdSignMsg) -// } -// -// _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", json) -// -// buf := bufio.NewReader(os.Stdin) -// ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf) -// if err != nil || !ok { -// _, _ = fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction") -// return err -// } -// } -// // build and sign the transaction -// txBytes, err := txBldr.BuildAndSign(fromName, keys.DefaultKeyPass, msgs) -// if err != nil { -// return err -// } -// -// // broadcast to a Tendermint node -// res, err := cliCtx.BroadcastTxCommit(txBytes) -// if err != nil { -// return err -// } -// faucetRsp := FaucetRsp{TxResponse: res, Seq: txBldr.Sequence()} -// *resChan <- faucetRsp -// return nil -//} -// -//func getRealAddr(r *http.Request) string { -// remoteIP := "" -// // the default is the originating ip. but we try to find better options because this is almost -// // never the right IP -// if parts := strings.Split(r.RemoteAddr, ":"); len(parts) == 2 { -// remoteIP = parts[0] -// } -// // If we have a forwarded-for header, take the address from there -// if xff := strings.Trim(r.Header.Get("X-Forwarded-For"), ","); len(xff) > 0 { -// addrs := strings.Split(xff, ",") -// lastFwd := addrs[len(addrs)-1] -// if ip := net.ParseIP(lastFwd); ip != nil { -// remoteIP = ip.String() -// } -// // parse X-Real-Ip header -// } else if xri := r.Header.Get("X-Real-Ip"); len(xri) > 0 { -// if ip := net.ParseIP(xri); ip != nil { -// remoteIP = ip.String() -// } -// } -// return remoteIP -//} diff --git a/cmd/stchaincli/main.go b/cmd/stchaincli/main.go deleted file mode 100644 index bd9744b9..00000000 --- a/cmd/stchaincli/main.go +++ /dev/null @@ -1,182 +0,0 @@ -package main - -//import ( -// "fmt" -// "os" -// "path" -// -// "github.com/cosmos/cosmos-sdk/client" -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/client/keys" -// "github.com/cosmos/cosmos-sdk/client/lcd" -// "github.com/cosmos/cosmos-sdk/client/rpc" -// "github.com/cosmos/cosmos-sdk/version" -// "github.com/cosmos/cosmos-sdk/x/auth" -// authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" -// authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" -// "github.com/cosmos/cosmos-sdk/x/bank" -// bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" -// govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli" -// reportcmd "github.com/stratosnet/stratos-chain/x/pot/client/cli" -// uploadcmd "github.com/stratosnet/stratos-chain/x/sds/client/cli" -// -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// -// "github.com/tendermint/go-amino" -// "github.com/tendermint/tendermint/libs/cli" -// -// "github.com/stratosnet/stratos-chain/app" -// // this line is used by starport scaffolding # 1 -//) -// -//func main() { -// // Configure cobra to sort commands -// cobra.EnableCommandSorting = false -// -// // Instantiate the codec for the command line application -// cdc := app.MakeCodec() -// -// app.SetConfig() -// -// // TODO: setup keybase, viper object, etc. to be passed into -// // the below functions and eliminate global vars, like we do -// // with the cdc -// -// rootCmd := &cobra.Command{ -// Use: "stchaincli", -// Short: "Command line interface for interacting with stratoschaind", -// } -// -// // Add --chain-id to persistent flags and mark it required -// rootCmd.PersistentFlags().String(flags.FlagChainID, "", "Chain ID of tendermint node") -// rootCmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error { -// return initConfig(rootCmd) -// } -// -// // Construct Root Command -// rootCmd.AddCommand( -// rpc.StatusCommand(), -// client.ConfigCmd(app.DefaultCLIHome), -// queryCmd(cdc), -// txCmd(cdc), -// flags.LineBreak, -// lcd.ServeCommand(cdc, registerRoutes), -// flags.LineBreak, -// GetFaucetCmd(cdc), -// flags.LineBreak, -// keys.Commands(), -// flags.LineBreak, -// version.Cmd, -// flags.NewCompletionCmd(rootCmd, true), -// -// flags.LineBreak, -// ) -// -// // Add flags and prefix all env exposed with AA -// executor := cli.PrepareMainCmd(rootCmd, "AA", app.DefaultCLIHome) -// -// err := executor.Execute() -// if err != nil { -// fmt.Printf("Failed executing CLI command: %s, exiting...\n", err) -// os.Exit(1) -// } -//} -// -//func queryCmd(cdc *amino.Codec) *cobra.Command { -// queryCmd := &cobra.Command{ -// Use: "query", -// Aliases: []string{"q"}, -// Short: "Querying subcommands", -// } -// -// queryCmd.AddCommand( -// authcmd.GetAccountCmd(cdc), -// flags.LineBreak, -// rpc.ValidatorCommand(cdc), -// rpc.BlockCommand(), -// authcmd.QueryTxsByEventsCmd(cdc), -// authcmd.QueryTxCmd(cdc), -// flags.LineBreak, -// ) -// -// // add modules' query commands -// app.ModuleBasics.AddQueryCommands(queryCmd, cdc) -// -// return queryCmd -//} -// -//func txCmd(cdc *amino.Codec) *cobra.Command { -// txCmd := &cobra.Command{ -// Use: "tx", -// Short: "Transactions subcommands", -// } -// -// txCmd.AddCommand( -// bankcmd.SendTxCmd(cdc), -// flags.LineBreak, -// uploadcmd.FileUploadTxCmd(cdc), -// reportcmd.VolumeReportCmd(cdc), -// flags.LineBreak, -// govcmd.GetCmdSubmitProposal(cdc), -// govcmd.GetCmdDeposit(cdc), -// govcmd.GetCmdVote(cdc), -// flags.LineBreak, -// authcmd.GetSignCommand(cdc), -// authcmd.GetMultiSignCommand(cdc), -// flags.LineBreak, -// authcmd.GetBroadcastCommand(cdc), -// authcmd.GetEncodeCommand(cdc), -// authcmd.GetDecodeCommand(cdc), -// flags.LineBreak, -// ) -// -// // add modules' tx commands -// app.ModuleBasics.AddTxCommands(txCmd, cdc) -// -// // remove auth and bank commands as they're mounted under the root tx command -// var cmdsToRemove []*cobra.Command -// -// for _, cmd := range txCmd.Commands() { -// if cmd.Use == auth.ModuleName || cmd.Use == bank.ModuleName { -// cmdsToRemove = append(cmdsToRemove, cmd) -// } -// } -// -// txCmd.RemoveCommand(cmdsToRemove...) -// -// return txCmd -//} -// -//// registerRoutes registers the routes from the different modules for the LCD. -//// NOTE: details on the routes added for each module are in the module documentation -//// NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go -//func registerRoutes(rs *lcd.RestServer) { -// client.RegisterRoutes(rs.CliCtx, rs.Mux) -// authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) -// app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) -// // this line is used by starport scaffolding # 2 -//} -// -//func initConfig(cmd *cobra.Command) error { -// home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) -// if err != nil { -// return err -// } -// -// cfgFile := path.Join(home, "config", "config.toml") -// if _, err := os.Stat(cfgFile); err == nil { -// viper.SetConfigFile(cfgFile) -// -// if err := viper.ReadInConfig(); err != nil { -// return err -// } -// } -// if err := viper.BindPFlag(flags.FlagChainID, cmd.PersistentFlags().Lookup(flags.FlagChainID)); err != nil { -// return err -// } -// if err := viper.BindPFlag(cli.EncodingFlag, cmd.PersistentFlags().Lookup(cli.EncodingFlag)); err != nil { -// return err -// } -// return viper.BindPFlag(cli.OutputFlag, cmd.PersistentFlags().Lookup(cli.OutputFlag)) -//} From 3cec90adb5faaf6623b1fe9e38b422748a9e1755 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 9 May 2022 17:12:13 -0400 Subject: [PATCH 033/113] added grpc_query.go --- proto/stratos/register/v1/query.proto | 8 +- proto/stratos/register/v1/register.proto | 24 ++ x/register/keeper/grpc_query.go | 269 ++++++++++++- x/register/types/errors.go | 2 + x/register/types/query.pb.go | 291 +++++++++++--- x/register/types/query.pb.gw.go | 18 + x/register/types/register.pb.go | 464 ++++++++++++++++++----- 7 files changed, 900 insertions(+), 176 deletions(-) diff --git a/proto/stratos/register/v1/query.proto b/proto/stratos/register/v1/query.proto index a29d9b16..66bf0537 100644 --- a/proto/stratos/register/v1/query.proto +++ b/proto/stratos/register/v1/query.proto @@ -70,12 +70,16 @@ message QueryStakeByNodeRequest { // acc_addr defines the node network address to query for. string acc_addr = 1; int64 query_type = 2; + // pagination defines an optional pagination for the request. +// cosmos.base.query.v1beta1.PageRequest pagination = 3; } // QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method message QueryStakeByNodeResponse { // staking_info defines the the staking_info info of the node. StakingInfo staking_info = 1; + // pagination defines an optional pagination for the request. +// cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method @@ -84,6 +88,8 @@ message QueryStakeByOwnerRequest { string network_addr = 1; string moniker = 2; string owner_addr = 3; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 4; } // QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method @@ -91,7 +97,7 @@ message QueryStakeByOwnerResponse { // staking_infos defines the the node staking info of this owner. repeated StakingInfo staking_infos = 1; // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryTotalStakeRequest is request type for the Query/TotalStake RPC method diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index dd1cb5b4..fb964e43 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -281,6 +281,30 @@ message UnbondingNodeEntry { ]; } +message Staking { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + // network_address is the bech32-encoded address of the node. + string network_address = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + // owner_address is the bech32-encoded address of owner of the node. + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + // shares define the delegation shares received. + string value = 3 [ + (gogoproto.jsontag) = "value", + (gogoproto.moretags) = "yaml:\"value\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + //message QueryNodeStakingParams { // string acc_addr = 1; // int64 query_type = 2; diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index 5834e946..bc4b1981 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -2,8 +2,14 @@ package keeper import ( "context" + "strconv" + "github.com/cosmos/cosmos-sdk/client" + sdk "github.com/cosmos/cosmos-sdk/types" + stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper @@ -11,34 +17,257 @@ type Querier struct { Keeper } -func (q Querier) ResourceNode(ctx context.Context, request *types.QueryResourceNodeRequest) (*types.QueryResourceNodeResponse, error) { - //TODO implement me - panic("implement me") -} +var _ types.QueryServer = Querier{} + +func (q Querier) ResourceNode(c context.Context, req *types.QueryResourceNodeRequest) (*types.QueryResourceNodeResponse, error) { + if req == nil { + return &types.QueryResourceNodeResponse{}, status.Error(codes.InvalidArgument, "empty request") + } + + if req.GetNetworkAddr() == "" { + return &types.QueryResourceNodeResponse{}, status.Error(codes.InvalidArgument, " Network address cannot be empty") + } + + networkAddr, err := stratos.SdsAddressFromBech32(req.GetNetworkAddr()) + if err != nil { + return &types.QueryResourceNodeResponse{}, err + } -func (q Querier) IndexingNode(ctx context.Context, request *types.QueryIndexingNodeRequest) (*types.QueryIndexingNodeResponse, error) { - //TODO implement me - panic("implement me") + ctx := sdk.UnwrapSDKContext(c) + node, found := q.GetResourceNode(ctx, networkAddr) + if !found { + return &types.QueryResourceNodeResponse{}, status.Errorf(codes.NotFound, "network address %s not found", req.NetworkAddr) + } + + return &types.QueryResourceNodeResponse{Node: &node}, nil } -func (q Querier) Params(ctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - //TODO implement me - panic("implement me") +func (q Querier) IndexingNode(c context.Context, req *types.QueryIndexingNodeRequest) (*types.QueryIndexingNodeResponse, error) { + if req == nil { + return &types.QueryIndexingNodeResponse{}, status.Error(codes.InvalidArgument, "empty request") + } + + if req.GetNetworkAddr() == "" { + return &types.QueryIndexingNodeResponse{}, status.Error(codes.InvalidArgument, " network address cannot be empty") + } + + networkAddr, err := stratos.SdsAddressFromBech32(req.GetNetworkAddr()) + if err != nil { + return &types.QueryIndexingNodeResponse{}, err + } + + ctx := sdk.UnwrapSDKContext(c) + node, found := q.GetIndexingNode(ctx, networkAddr) + if !found { + return &types.QueryIndexingNodeResponse{}, status.Errorf(codes.NotFound, "network address %s not found", req.NetworkAddr) + } + + return &types.QueryIndexingNodeResponse{Node: &node}, nil } -func (q Querier) StakeByNode(ctx context.Context, request *types.QueryStakeByNodeRequest) (*types.QueryStakeByNodeResponse, error) { - //TODO implement me - panic("implement me") +func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.GetParams(ctx) + + return &types.QueryParamsResponse{Params: ¶ms}, nil } -func (q Querier) StakeByOwner(ctx context.Context, request *types.QueryStakeByOwnerRequest) (*types.QueryStakeByOwnerResponse, error) { - //TODO implement me - panic("implement me") +func (q Querier) StakeByNode(c context.Context, req *types.QueryStakeByNodeRequest) (*types.QueryStakeByNodeResponse, error) { + if req == nil { + return &types.QueryStakeByNodeResponse{}, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.GetAccAddr() == "" { + return &types.QueryStakeByNodeResponse{}, status.Error(codes.InvalidArgument, "node network address cannot be empty") + } + ctx := sdk.UnwrapSDKContext(c) + + queryType := req.QueryType + accAddr, err := stratos.SdsAddressFromBech32(req.AccAddr) + if err != nil { + return &types.QueryStakeByNodeResponse{}, err + } + stakingInfo := types.StakingInfo{} + + if queryType == types.QueryType_All || queryType == types.QueryType_SP { + indexingNode, found := q.GetIndexingNode(ctx, accAddr) + if found { + // Adding indexing node staking info + networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, err := q.getNodeStakes( + ctx, + indexingNode.GetStatus(), + networkAddr, + indexingNode.Tokens, + ) + if err != nil { + return &types.QueryStakeByNodeResponse{}, err + } + if !indexingNode.Equal(types.IndexingNode{}) { + stakingInfo = types.NewStakingInfoByIndexingNodeAddr( + indexingNode, + unBondingStake, + unBondedStake, + bondedStake, + ) + } + } + } + + if queryType == types.QueryType_All || queryType == types.QueryType_PP { + accAddr, err := stratos.SdsAddressFromBech32(req.GetAccAddr()) + if err != nil { + return &types.QueryStakeByNodeResponse{}, err + } + resourceNode, found := q.GetResourceNode(ctx, accAddr) + if found { + // Adding resource node staking info + networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, err := q.getNodeStakes( + ctx, + resourceNode.GetStatus(), + networkAddr, + resourceNode.Tokens, + ) + if err != nil { + return nil, err + } + if !resourceNode.Equal(types.ResourceNode{}) { + stakingInfo = types.NewStakingInfoByResourceNodeAddr( + resourceNode, + unBondingStake, + unBondedStake, + bondedStake, + ) + } + } + } + return &types.QueryStakeByNodeResponse{StakingInfo: &stakingInfo}, nil + } -func (q Querier) StakeTotal(ctx context.Context, request *types.QueryTotalStakeRequest) (*types.QueryTotalStakeResponse, error) { - //TODO implement me - panic("implement me") +func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerRequest) (*types.QueryStakeByOwnerResponse, error) { + if req == nil { + return &types.QueryStakeByOwnerResponse{}, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.GetOwnerAddr() == "" { + return &types.QueryStakeByOwnerResponse{}, status.Error(codes.InvalidArgument, "owner address cannot be empty") + } + ctx := sdk.UnwrapSDKContext(c) + + var ( + params types.QueryNodesParams + stakingInfo types.StakingInfo + stakingInfos []*types.StakingInfo + ) + + networkAddr, er := stratos.SdsAddressFromBech32(req.GetNetworkAddr()) + if er != nil { + return &types.QueryStakeByOwnerResponse{}, er + } + + ownerAddr, er := sdk.AccAddressFromBech32(req.GetOwnerAddr()) + if er != nil { + return &types.QueryStakeByOwnerResponse{}, er + } + + page, er := strconv.Atoi(string(req.Pagination.Key)) + if er != nil { + return &types.QueryStakeByOwnerResponse{}, er + } + + params = types.NewQueryNodesParams(page, int(req.Pagination.Limit), networkAddr, req.GetMoniker(), ownerAddr) + + resNodes := q.GetResourceNodesFiltered(ctx, params) + indNodes := q.GetIndexingNodesFiltered(ctx, params) + + for _, n := range indNodes { + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( + ctx, + n.GetStatus(), + networkAddr, + n.Tokens, + ) + if er != nil { + return nil, er + } + if !n.Equal(types.IndexingNode{}) { + stakingInfo = types.NewStakingInfoByIndexingNodeAddr( + n, + unBondingStake, + unBondedStake, + bondedStake, + ) + stakingInfos = append(stakingInfos, &stakingInfo) + } + } + + for _, n := range resNodes { + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( + ctx, + n.GetStatus(), + networkAddr, + n.Tokens, + ) + if er != nil { + return nil, er + } + if !n.Equal(types.ResourceNode{}) { + stakingInfo = types.NewStakingInfoByResourceNodeAddr( + n, + unBondingStake, + unBondedStake, + bondedStake, + ) + stakingInfos = append(stakingInfos, &stakingInfo) + } + } + + start, end := client.Paginate(len(stakingInfos), params.Page, params.Limit, QueryDefaultLimit) + if start < 0 || end < 0 { + return &types.QueryStakeByOwnerResponse{}, nil + } else { + stakingInfos = stakingInfos[start:end] + return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfos}, nil + } + } -var _ types.QueryServer = Querier{} +func (q Querier) StakeTotal(c context.Context, _ *types.QueryTotalStakeRequest) (*types.QueryTotalStakeResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + totalBondedStakeOfResourceNodes := q.GetResourceNodeBondedToken(ctx).Amount + totalBondedStakeOfIndexingNodes := q.GetIndexingNodeBondedToken(ctx).Amount + + totalUnbondedStakeOfResourceNodes := q.GetResourceNodeNotBondedToken(ctx).Amount + totalUnbondedStakeOfIndexingNodes := q.GetIndexingNodeNotBondedToken(ctx).Amount + + resourceNodeList := q.GetAllResourceNodes(ctx) + totalStakeOfResourceNodes := sdk.ZeroInt() + for _, node := range resourceNodeList.GetResourceNodes() { + totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) + } + + indexingNodeList := q.GetAllIndexingNodes(ctx) + totalStakeOfIndexingNodes := sdk.ZeroInt() + for _, node := range indexingNodeList.GetIndexingNodes() { + totalStakeOfIndexingNodes = totalStakeOfIndexingNodes.Add(node.Tokens) + } + + totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfIndexingNodes) + totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfIndexingNodes) + totalUnbondingStake := q.GetAllUnbondingNodesTotalBalance(ctx) + totalUnbondedStake = totalUnbondedStake.Sub(totalUnbondingStake) + res := types.NewQueryNodesStakingInfo( + totalStakeOfResourceNodes, + totalStakeOfIndexingNodes, + totalBondedStake, + totalUnbondedStake, + totalUnbondingStake, + ) + + return &types.QueryTotalStakeResponse{TotalStakes: res}, nil +} diff --git a/x/register/types/errors.go b/x/register/types/errors.go index 91fcf1f9..a9da1107 100644 --- a/x/register/types/errors.go +++ b/x/register/types/errors.go @@ -50,6 +50,7 @@ const ( codeErrInvalidNodeType codeErrUnknownAccountAddress codeErrUnknownPubKey + codeErrNoNodeFound ) var ( @@ -98,4 +99,5 @@ var ( ErrInvalidNodeType = sdkerrors.Register(ModuleName, codeErrInvalidNodeType, "invalid node type") ErrUnknownAccountAddress = sdkerrors.Register(ModuleName, codeErrUnknownAccountAddress, "account address does not exist") ErrUnknownPubKey = sdkerrors.Register(ModuleName, codeErrUnknownPubKey, "unknown pubKey ") + ErrNoNodeFound = sdkerrors.Register(ModuleName, codeErrNoNodeFound, "node does not exist ") ) diff --git a/x/register/types/query.pb.go b/x/register/types/query.pb.go index 659f46a8..2cba149d 100644 --- a/x/register/types/query.pb.go +++ b/x/register/types/query.pb.go @@ -218,6 +218,8 @@ type QueryStakeByNodeRequest struct { // acc_addr defines the node network address to query for. AccAddr string `protobuf:"bytes,1,opt,name=acc_addr,json=accAddr,proto3" json:"acc_addr,omitempty"` QueryType int64 `protobuf:"varint,2,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryStakeByNodeRequest) Reset() { *m = QueryStakeByNodeRequest{} } @@ -267,10 +269,19 @@ func (m *QueryStakeByNodeRequest) GetQueryType() int64 { return 0 } +func (m *QueryStakeByNodeRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + // QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method type QueryStakeByNodeResponse struct { // staking_info defines the the staking_info info of the node. StakingInfo *StakingInfo `protobuf:"bytes,1,opt,name=staking_info,json=stakingInfo,proto3" json:"staking_info,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryStakeByNodeResponse) Reset() { *m = QueryStakeByNodeResponse{} } @@ -313,12 +324,21 @@ func (m *QueryStakeByNodeResponse) GetStakingInfo() *StakingInfo { return nil } +func (m *QueryStakeByNodeResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + // QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method type QueryStakeByOwnerRequest struct { // owner_addr defines the owner address to query for. NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` OwnerAddr string `protobuf:"bytes,3,opt,name=owner_addr,json=ownerAddr,proto3" json:"owner_addr,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryStakeByOwnerRequest) Reset() { *m = QueryStakeByOwnerRequest{} } @@ -375,12 +395,19 @@ func (m *QueryStakeByOwnerRequest) GetOwnerAddr() string { return "" } +func (m *QueryStakeByOwnerRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + // QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method type QueryStakeByOwnerResponse struct { // staking_infos defines the the node staking info of this owner. StakingInfos []*StakingInfo `protobuf:"bytes,1,rep,name=staking_infos,json=stakingInfos,proto3" json:"staking_infos,omitempty"` // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryStakeByOwnerResponse) Reset() { *m = QueryStakeByOwnerResponse{} } @@ -423,7 +450,7 @@ func (m *QueryStakeByOwnerResponse) GetStakingInfos() []*StakingInfo { return nil } -func (m *QueryStakeByOwnerResponse) GetPagination() *query.PageRequest { +func (m *QueryStakeByOwnerResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -614,56 +641,58 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/query.proto", fileDescriptor_59a612d1da8c0670) } var fileDescriptor_59a612d1da8c0670 = []byte{ - // 773 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xd1, 0x4e, 0x13, 0x4d, - 0x14, 0xc7, 0x59, 0xf8, 0x3e, 0xb0, 0xd3, 0x7a, 0x33, 0x18, 0x2d, 0x45, 0x6a, 0x59, 0x12, 0xad, - 0x4a, 0x77, 0x6c, 0x41, 0x63, 0x48, 0x4c, 0x14, 0xa3, 0x09, 0x9a, 0x20, 0x2e, 0x5c, 0x79, 0xd3, - 0x4c, 0xb7, 0xc3, 0xb2, 0x29, 0x9d, 0x29, 0x3b, 0xd3, 0x42, 0x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x79, - 0x78, 0xf9, 0xf3, 0x36, 0x96, 0x2b, 0x8d, 0x99, 0xad, 0x88, 0x1e, 0x4b, 0xa2, 0x35, 0xf8, 0x50, - 0x4b, 0x14, 0x5e, 0x45, 0x35, 0x78, 0x53, 0xa8, 0x17, 0xb9, 0x63, 0x1f, 0xf5, 0x06, 0x6e, 0xd8, - 0x87, 0x9f, 0x0c, 0x90, 0x89, 0xfb, 0x03, 0xbc, 0x98, 0x20, 0x6e, 0x60, 0xa3, 0xb6, 0xab, 0xb3, - 0x1d, 0xf3, 0x81, 0x24, 0xbe, 0x07, 0xad, 0x51, 0xc4, 0xd2, 0xc3, 0x50, 0x6f, 0x60, 0x6e, 0x7d, - 0xf8, 0xc1, 0x00, 0x40, 0x16, 0x94, 0x77, 0x0c, 0xef, 0x0e, 0x6f, 0x7b, 0xce, 0x41, 0x72, 0xcb, - 0xe3, 0x25, 0x2b, 0xc2, 0xdb, 0x92, 0x70, 0x09, 0x2e, 0x6a, 0x09, 0xe3, 0x7e, 0xb3, 0xbe, 0xf9, - 0xed, 0x24, 0x6f, 0x1c, 0x9f, 0xe4, 0x8d, 0x5f, 0x27, 0x79, 0xe3, 0xfd, 0x69, 0x7e, 0xe2, 0xf8, - 0x34, 0x3f, 0xf1, 0xf3, 0x34, 0x3f, 0xf1, 0x66, 0xd5, 0xf5, 0xc4, 0x5e, 0xbb, 0x66, 0x39, 0xac, - 0x19, 0x95, 0xa1, 0x44, 0x44, 0x7f, 0x96, 0x9c, 0x3d, 0xec, 0x51, 0x74, 0x34, 0xa8, 0x1c, 0x2c, - 0x83, 0xd7, 0xa6, 0xe5, 0x3f, 0x03, 0x2b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xee, 0x79, 0x7b, - 0x75, 0xb2, 0x08, 0x00, 0x00, + // 805 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f,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, 0x6b, 0xfa, 0x0e, 0xd9, 0x64, 0x55, 0x62, 0x93, 0x83, 0x26, 0xe1, 0x02, 0xcd, + 0xc3, 0x34, 0x25, 0xe2, 0x88, 0xf9, 0xb5, 0x32, 0xae, 0x56, 0xfd, 0x0c, 0xc8, 0x83, 0x42, 0xd2, + 0x4e, 0xa9, 0xb3, 0x5b, 0xd5, 0xaa, 0x6f, 0xd8, 0x70, 0x46, 0x23, 0xe7, 0x0d, 0x46, 0x39, 0x41, + 0x57, 0xe1, 0x04, 0x65, 0x55, 0x22, 0x75, 0xa9, 0xe5, 0x79, 0x53, 0xd3, 0xad, 0x19, 0x13, 0xca, + 0xf0, 0x73, 0xa4, 0x0d, 0x5a, 0x25, 0xc7, 0x1e, 0x75, 0x2f, 0x89, 0x14, 0x97, 0xff, 0x00, 0x52, + 0x4c, 0x18, 0x22, 0xbd, 0x04, 0xf0, 0x4f, 0x99, 0x74, 0x5b, 0xe0, 0x1a, 0x59, 0x6f, 0x45, 0x91, + 0x66, 0xe0, 0xaf, 0xd8, 0x71, 0xa2, 0x38, 0x53, 0xd8, 0x71, 0x02, 0x14, 0x34, 0x07, 0xa1, 0x5c, + 0x51, 0x59, 0xb4, 0x1a, 0x24, 0x33, 0x9e, 0x07, 0x85, 0x84, 0x9d, 0x94, 0x27, 0x3b, 0xad, 0x06, + 0x41, 0x77, 0x21, 0xec, 0xed, 0x2c, 0x93, 0x90, 0x48, 0xff, 0x98, 0xe1, 0x82, 0xcd, 0x60, 0xc1, + 0x66, 0x78, 0x59, 0xd4, 0x82, 0xcd, 0x2d, 0xec, 0x76, 0xab, 0xda, 0x11, 0xa5, 0xf1, 0x1a, 0xa8, + 0x89, 0xc5, 0xe8, 0x54, 0xc7, 0xb7, 0x61, 0x9a, 0x0b, 0x5c, 0xf3, 0xa8, 0x5b, 0xf6, 0xe8, 0x2e, + 0x53, 0x9d, 0xe7, 0xb5, 0x9d, 0x6f, 0x87, 0x81, 0x1b, 0x74, 0x97, 0xd9, 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, 0x2f, 0xa7, 0x39, 0xf0, 0xec, 0x2c, 0x37, 0x76, 0x72, + 0x96, 0x1b, 0xfb, 0x7c, 0x96, 0x1b, 0x7b, 0xbc, 0xea, 0x7a, 0x62, 0xaf, 0x59, 0x31, 0x1d, 0x56, + 0xef, 0xa6, 0xa1, 0x44, 0x74, 0x7f, 0x16, 0x9d, 0x3d, 0xec, 0x51, 0xeb, 0xb8, 0x97, 0x39, 0x58, + 0x06, 0xaf, 0x4c, 0xca, 0x7f, 0x3a, 0x2b, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x6a, 0x60, + 0xb9, 0x8f, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1088,6 +1117,18 @@ func (m *QueryStakeByNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = 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] = 0x1a + } if m.QueryType != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.QueryType)) i-- @@ -1123,6 +1164,18 @@ func (m *QueryStakeByNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if m.StakingInfo != nil { { size, err := m.StakingInfo.MarshalToSizedBuffer(dAtA[:i]) @@ -1158,6 +1211,18 @@ func (m *QueryStakeByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error _ = 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] = 0x22 + } if len(m.OwnerAddr) > 0 { i -= len(m.OwnerAddr) copy(dAtA[i:], m.OwnerAddr) @@ -1423,6 +1488,10 @@ func (m *QueryStakeByNodeRequest) Size() (n int) { if m.QueryType != 0 { n += 1 + sovQuery(uint64(m.QueryType)) } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1436,6 +1505,10 @@ func (m *QueryStakeByNodeResponse) Size() (n int) { l = m.StakingInfo.Size() n += 1 + l + sovQuery(uint64(l)) } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1457,6 +1530,10 @@ func (m *QueryStakeByOwnerRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1945,6 +2022,42 @@ func (m *QueryStakeByNodeRequest) Unmarshal(dAtA []byte) error { break } } + case 3: + 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:]) @@ -2031,6 +2144,42 @@ func (m *QueryStakeByNodeResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2177,6 +2326,42 @@ func (m *QueryStakeByOwnerRequest) Unmarshal(dAtA []byte) error { } m.OwnerAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + 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:]) @@ -2291,7 +2476,7 @@ func (m *QueryStakeByOwnerResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Pagination == nil { - m.Pagination = &query.PageRequest{} + m.Pagination = &query.PageResponse{} } if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/register/types/query.pb.gw.go b/x/register/types/query.pb.gw.go index d1a956d2..bb73b5ea 100644 --- a/x/register/types/query.pb.gw.go +++ b/x/register/types/query.pb.gw.go @@ -157,6 +157,10 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +var ( + filter_Query_StakeByNode_0 = &utilities.DoubleArray{Encoding: map[string]int{"acc_addr": 0, "query_type": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + func request_Query_StakeByNode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryStakeByNodeRequest var metadata runtime.ServerMetadata @@ -190,6 +194,13 @@ func request_Query_StakeByNode_0(ctx context.Context, marshaler runtime.Marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_type", 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_StakeByNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.StakeByNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -228,6 +239,13 @@ func local_request_Query_StakeByNode_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_type", 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_StakeByNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.StakeByNode(ctx, &protoReq) return msg, metadata, err diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 1917fe95..7d2ffe72 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -896,6 +896,47 @@ func (m *UnbondingNodeEntry) GetCompletionTime() *time.Time { return nil } +type Staking struct { + // network_address is the bech32-encoded address of the node. + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + // owner_address is the bech32-encoded address of owner of the node. + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + // shares define the delegation shares received. + Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"value" yaml:"value"` +} + +func (m *Staking) Reset() { *m = Staking{} } +func (*Staking) ProtoMessage() {} +func (*Staking) Descriptor() ([]byte, []int) { + return fileDescriptor_fef1e3aeec8499d6, []int{12} +} +func (m *Staking) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Staking) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Staking.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 *Staking) XXX_Merge(src proto.Message) { + xxx_messageInfo_Staking.Merge(m, src) +} +func (m *Staking) XXX_Size() int { + return m.Size() +} +func (m *Staking) XXX_DiscardUnknown() { + xxx_messageInfo_Staking.DiscardUnknown(m) +} + +var xxx_messageInfo_Staking proto.InternalMessageInfo + func init() { proto.RegisterType((*Params)(nil), "stratos.register.v1.Params") proto.RegisterType((*ResourceNode)(nil), "stratos.register.v1.ResourceNode") @@ -909,6 +950,7 @@ func init() { proto.RegisterType((*StakingInfo)(nil), "stratos.register.v1.StakingInfo") proto.RegisterType((*UnbondingNode)(nil), "stratos.register.v1.UnbondingNode") proto.RegisterType((*UnbondingNodeEntry)(nil), "stratos.register.v1.UnbondingNodeEntry") + proto.RegisterType((*Staking)(nil), "stratos.register.v1.Staking") } func init() { @@ -916,108 +958,112 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1611 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1c, 0x45, - 0x16, 0xf7, 0x78, 0xe2, 0xaf, 0x9a, 0x19, 0xdb, 0xdb, 0x76, 0x36, 0x63, 0xef, 0xae, 0xdb, 0xa9, - 0xfd, 0x88, 0x57, 0x59, 0xcf, 0xc8, 0xce, 0x4a, 0x08, 0x24, 0x0e, 0xee, 0xc4, 0x0a, 0x56, 0x48, - 0x30, 0x6d, 0x63, 0x03, 0x12, 0x1a, 0x7a, 0xba, 0x2b, 0xe3, 0xc2, 0x33, 0x55, 0xa3, 0xae, 0x1a, - 0xdb, 0x73, 0x40, 0xe2, 0x2f, 0x40, 0xb9, 0x71, 0xe1, 0xc8, 0x89, 0x33, 0x7f, 0x03, 0x8a, 0x38, - 0xe5, 0x88, 0x38, 0x34, 0x28, 0x11, 0x97, 0x11, 0xa7, 0x39, 0x21, 0x4e, 0xa8, 0x3e, 0xba, 0xbb, - 0xba, 0xed, 0x64, 0x14, 0xc4, 0x05, 0xe4, 0x93, 0xa7, 0x7e, 0xef, 0xbd, 0xdf, 0xab, 0x7a, 0xf5, - 0xde, 0xeb, 0xe7, 0x02, 0x90, 0xf1, 0xd0, 0xe3, 0x94, 0xd5, 0x43, 0xd4, 0xc2, 0x8c, 0xa3, 0xb0, - 0x7e, 0xb2, 0x91, 0xfc, 0xae, 0x75, 0x43, 0xca, 0xa9, 0xb5, 0xa0, 0x75, 0x6a, 0x09, 0x7e, 0xb2, - 0xb1, 0xbc, 0xd8, 0xa2, 0x2d, 0x2a, 0xe5, 0x75, 0xf1, 0x4b, 0xa9, 0x2e, 0x2f, 0xb5, 0x28, 0x6d, - 0xb5, 0x51, 0x5d, 0xae, 0x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, - 0x04, 0xbf, 0x2e, 0x02, 0xeb, 0xbc, 0xb9, 0x75, 0x00, 0xe6, 0x92, 0x74, 0x3f, 0x42, 0xb8, 0x75, - 0xc4, 0x65, 0x88, 0x8a, 0xaa, 0x43, 0xe7, 0x44, 0xe9, 0x3d, 0xe4, 0x04, 0xd0, 0x9d, 0x8d, 0x91, - 0x37, 0x24, 0x60, 0x85, 0x60, 0x2e, 0xff, 0x6e, 0x35, 0x3e, 0xb2, 0x30, 0xd7, 0x5f, 0xae, 0x28, - 0x67, 0xfd, 0xec, 0xb3, 0xd5, 0x27, 0x05, 0x30, 0x87, 0x09, 0xe6, 0x58, 0x7c, 0x61, 0xbd, 0xb6, - 0x47, 0xfc, 0x78, 0xbe, 0x3c, 0x7c, 0xa9, 0x6e, 0x99, 0x27, 0x49, 0x8f, 0x9d, 0x13, 0x88, 0x7b, - 0x54, 0x88, 0xa3, 0x00, 0xcb, 0x03, 0x53, 0xb1, 0x67, 0x35, 0x8e, 0xde, 0x7d, 0x29, 0xcf, 0x53, - 0xa9, 0x47, 0x7d, 0x91, 0x89, 0xa7, 0x58, 0xe4, 0x3c, 0x78, 0xfc, 0x74, 0xa5, 0xf0, 0xe4, 0xe9, - 0x4a, 0xe1, 0x87, 0xa7, 0x2b, 0x85, 0x47, 0xcf, 0x56, 0xc6, 0x9e, 0x3c, 0x5b, 0x19, 0xfb, 0xf6, - 0xd9, 0xca, 0xd8, 0xfb, 0xff, 0x37, 0xfc, 0xe8, 0xec, 0x21, 0x88, 0xc7, 0x3f, 0xd7, 0xfd, 0x23, - 0x0f, 0x93, 0xfa, 0x59, 0xfa, 0x1a, 0x2c, 0x3d, 0x37, 0x27, 0xe5, 0x45, 0xdc, 0xfa, 0x35, 0x00, - 0x00, 0xff, 0xff, 0xba, 0x22, 0xf4, 0xfb, 0x2e, 0x16, 0x00, 0x00, + // 1678 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0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x05, 0x33, 0xf2, 0xcc, 0x7d, 0xf7, 0x45, 0x0c, 0x0b, 0xb2, + 0x4f, 0xb1, 0xd5, 0xd2, 0x3e, 0xc5, 0x46, 0x91, 0x57, 0xb1, 0x73, 0xfb, 0x1a, 0xac, 0x0c, 0x69, + 0x3b, 0x9b, 0xd6, 0x95, 0x59, 0xe6, 0x9e, 0x18, 0x73, 0x37, 0x54, 0x27, 0x31, 0x7c, 0x98, 0xbc, + 0x2a, 0x64, 0x25, 0xc8, 0xab, 0x0f, 0xa9, 0x6b, 0x95, 0x01, 0x47, 0x80, 0x65, 0x33, 0x69, 0xba, + 0xcf, 0xea, 0x2c, 0xc3, 0xdb, 0xc6, 0x70, 0x5e, 0x33, 0xad, 0x0c, 0x39, 0x01, 0xf2, 0x6a, 0xda, + 0xac, 0xd9, 0x2f, 0xfa, 0x75, 0x11, 0xd4, 0xa6, 0xf5, 0x48, 0x7d, 0x41, 0x1d, 0xde, 0x56, 0x7e, + 0x54, 0xd3, 0x67, 0x57, 0x99, 0xd4, 0x99, 0x36, 0x9a, 0x2b, 0x3c, 0x3f, 0x06, 0x2b, 0x84, 0xb7, + 0x33, 0x37, 0x83, 0x2a, 0x41, 0x8b, 0xea, 0x6d, 0xe4, 0x86, 0x2c, 0xf5, 0x56, 0x5e, 0x82, 0xbc, + 0x3a, 0xe1, 0x99, 0xef, 0xbc, 0x9f, 0x82, 0x72, 0xf2, 0xda, 0x52, 0x52, 0x97, 0xe4, 0x3b, 0xb7, + 0x26, 0x4b, 0x66, 0x6b, 0xfb, 0x54, 0x44, 0x23, 0x5d, 0x99, 0xd2, 0x27, 0x19, 0x53, 0x99, 0x92, + 0xe7, 0x18, 0x2f, 0x11, 0xa1, 0x3f, 0x95, 0x80, 0x73, 0x53, 0xdd, 0x39, 0x05, 0xcb, 0xd3, 0x70, + 0x3f, 0xc7, 0xa4, 0x7b, 0x2e, 0x94, 0x8b, 0x4a, 0xba, 0x42, 0xe7, 0x44, 0xe9, 0x39, 0x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, 0xae, 0xd3, 0xe7, 0x72, 0xb5, 0x82, 0xce, 0x82, 0x8a, 0xd4, 0x27, + 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x67, 0xba, 0xe7, 0xb3, 0x4f, 0x17, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1827,6 +1873,53 @@ func (m *UnbondingNodeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Staking) 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 *Staking) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Staking) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRegister(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintRegister(dAtA []byte, offset int, v uint64) int { offset -= sovRegister(v) base := offset @@ -2168,6 +2261,25 @@ func (m *UnbondingNodeEntry) Size() (n int) { return n } +func (m *Staking) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NetworkAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovRegister(uint64(l)) + } + l = m.Value.Size() + n += 1 + l + sovRegister(uint64(l)) + return n +} + func sovRegister(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4593,6 +4705,154 @@ func (m *UnbondingNodeEntry) Unmarshal(dAtA []byte) error { } return nil } +func (m *Staking) 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 ErrIntOverflowRegister + } + 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: Staking: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Staking: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRegister + } + 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 ErrInvalidLengthRegister + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRegister + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRegister(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRegister + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipRegister(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From c1b27301c6e1c834bd9e7061d1706ec188060254 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 9 May 2022 17:17:23 -0400 Subject: [PATCH 034/113] minor updates --- x/register/types/resource_node.go | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 62db846b..e05321eb 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -4,8 +4,11 @@ import ( "bytes" "fmt" "strconv" + "strings" "time" + "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -232,3 +235,42 @@ func (v1 ResourceNode) Equal(v2 ResourceNode) bool { bz2 := goamino.MustMarshalBinaryLengthPrefixed(&v2) return bytes.Equal(bz1, bz2) } + +func (s Staking) GetNetworkAddress() stratos.SdsAddress { + networkAddr, err := stratos.SdsAddressFromBech32(s.NetworkAddress) + if err != nil { + panic(err) + } + return networkAddr +} +func (s Staking) GetOwnerAddr() sdk.ValAddress { + addr, err := sdk.ValAddressFromBech32(s.OwnerAddress) + if err != nil { + panic(err) + } + return addr +} +func (s Staking) GetShares() sdk.Dec { return s.Value } + +// String returns a human readable string representation of a node. +func (s Staking) String() string { + out, _ := yaml.Marshal(s) + return string(out) +} + +// Stakings is a collection of Staking +type Stakings []Staking + +func (ss Stakings) String() (out string) { + for _, del := range ss { + out += del.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// UnmarshalStaking returns the resource node staking +func UnmarshalStaking(cdc codec.BinaryCodec, value []byte) (staking Staking, err error) { + err = cdc.Unmarshal(value, &staking) + return staking, err +} From 8aaf6605be3cd1838484e928df5270579022f49b Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 9 May 2022 18:25:35 -0400 Subject: [PATCH 035/113] - qb-1163: fix some typos --- x/register/types/resource_node.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index e05321eb..03b2b0b8 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -243,8 +243,8 @@ func (s Staking) GetNetworkAddress() stratos.SdsAddress { } return networkAddr } -func (s Staking) GetOwnerAddr() sdk.ValAddress { - addr, err := sdk.ValAddressFromBech32(s.OwnerAddress) +func (s Staking) GetOwnerAddr() sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(s.OwnerAddress) if err != nil { panic(err) } From 35e18e156e83749d735715ea3cedded2b89e66a8 Mon Sep 17 00:00:00 2001 From: jialbai Date: Tue, 10 May 2022 10:58:06 -0400 Subject: [PATCH 036/113] - qb-1164: fix register query --- x/register/client/cli/query.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/x/register/client/cli/query.go b/x/register/client/cli/query.go index 939163ca..08e7eebd 100644 --- a/x/register/client/cli/query.go +++ b/x/register/client/cli/query.go @@ -35,12 +35,12 @@ func GetQueryCmd() *cobra.Command { // GetCmdQueryResourceNode implements the query resource nodes by network address command. func GetCmdQueryResourceNode() *cobra.Command { cmd := &cobra.Command{ - Use: "get-resource-nodes [flag]", + Use: "get-resource-node [flag]", Short: "Query a resource node by its network address", Long: strings.TrimSpace( fmt.Sprintf(`Query details about an individual resource node by its network address. Example: -$ %s query register get-resource-nodes --network-id=%sstsds1np4d8re98lpgrcdqcas8yt85gl3rvj268leg6v +$ %s query register get-resource-node --network-address=%sstsds1np4d8re98lpgrcdqcas8yt85gl3rvj268leg6v `, version.AppName, ), @@ -54,12 +54,12 @@ $ %s query register get-resource-nodes --network-id=%sstsds1np4d8re98lpgrcdqcas8 // query resource node by network address queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) - if queryFlagNetworkAddr == "" { + if len(queryFlagNetworkAddr) == 0 { return sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") } result, err := queryClient.ResourceNode(cmd.Context(), &types.QueryResourceNodeRequest{ - // Leaving status empty on purpose to query all validators. + NetworkAddr: queryFlagNetworkAddr, }) if err != nil { return err @@ -75,12 +75,12 @@ $ %s query register get-resource-nodes --network-id=%sstsds1np4d8re98lpgrcdqcas8 // GetCmdQueryIndexingNode implements the query indexing nodes by network address command. func GetCmdQueryIndexingNode() *cobra.Command { cmd := &cobra.Command{ - Use: "get-indexing-nodes [flag]", + Use: "get-indexing-node [flag]", Short: "Query an indexing node by its network address", Long: strings.TrimSpace( fmt.Sprintf(`Query details about an individual indexing node by its network address. Example: -$ %s query register get-indexing-nodes --network-id=%sstsds1faej5w4q6hgnt0ft598dlm408g4p747y4krwca +$ %s query register get-indexing-node --network-address=%sstsds1faej5w4q6hgnt0ft598dlm408g4p747y4krwca `, version.AppName, ), @@ -94,12 +94,13 @@ $ %s query register get-indexing-nodes --network-id=%sstsds1faej5w4q6hgnt0ft598d // query resource node by network address queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) - if queryFlagNetworkAddr == "" { + if len(queryFlagNetworkAddr) == 0 { return sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") } result, err := queryClient.IndexingNode(cmd.Context(), &types.QueryIndexingNodeRequest{ // Leaving status empty on purpose to query all validators. + NetworkAddr: queryFlagNetworkAddr, }) if err != nil { return err From 5d17bf3d39d534ef82b38b2027f7870fec4f13f8 Mon Sep 17 00:00:00 2001 From: Xiong Date: Tue, 10 May 2022 16:49:23 -0400 Subject: [PATCH 037/113] initialize logs property --- x/evm/statedb/statedb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index f8c892d2..e075308d 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -60,8 +60,8 @@ func New(ctx sdk.Context, keeper Keeper, txConfig TxConfig) *StateDB { stateObjects: make(map[common.Address]*stateObject), journal: newJournal(), accessList: newAccessList(), - - txConfig: txConfig, + logs: make([]*ethtypes.Log, 0), + txConfig: txConfig, } } From 417f68441e108478234358d18521ed63e57f833a Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 11 May 2022 12:33:07 -0400 Subject: [PATCH 038/113] - qb-1163: fix module acc related logic --- x/register/keeper/resource_node.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 9ccd8433..09170750 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -108,10 +108,6 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc if err != nil { return sdk.ZeroInt(), err } - err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins) - if err != nil { - return sdk.ZeroInt(), err - } switch resourceNode.GetStatus() { case stakingtypes.Unbonded: @@ -202,10 +198,6 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re // deduct slashing amount first coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc - err = k.bankKeeper.MintCoins(ctx, types.ModuleName, coins) - if err != nil { - return err - } err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { return err From c6ae62766ee5abda2d21f40eb16578d04d5b6448 Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 11 May 2022 12:34:10 -0400 Subject: [PATCH 039/113] - qb-1163: modify bankKeeper related logic --- x/register/keeper/indexing_node.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 61f77588..0c9a84fe 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -141,10 +141,6 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin if err != nil { return sdk.ZeroInt(), err } - err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins) - if err != nil { - return sdk.ZeroInt(), err - } indexingNode = indexingNode.AddToken(tokenToAdd.Amount) @@ -215,10 +211,6 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In // deduct slashing amount first coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc - err = k.bankKeeper.MintCoins(ctx, types.ModuleName, coins) - if err != nil { - return err - } err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { return err From d31ccc03de02a584fc30f8e8c28b2b331bfeaa90 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 11 May 2022 15:36:25 -0400 Subject: [PATCH 040/113] updates --- proto/stratos/register/v1/genesis.proto | 2 +- types/address.go | 103 +++++++++++++------ x/register/keeper/keeper.go | 49 +++++---- x/register/keeper/keeper_tests.go | 130 ++++++++++++------------ x/register/keeper/node_state_change.go | 5 +- x/register/keeper/slashing.go | 8 +- x/register/types/codec.go | 30 +++--- x/register/types/genesis.pb.go | 98 +++++++++--------- x/register/types/indexing_node.go | 24 ++--- x/register/types/msg.go | 2 +- x/register/types/resource_node.go | 6 +- 11 files changed, 246 insertions(+), 211 deletions(-) diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto index 0d251a38..12858c06 100644 --- a/proto/stratos/register/v1/genesis.proto +++ b/proto/stratos/register/v1/genesis.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package stratos.evm.v1; +package stratos.register.v1; diff --git a/types/address.go b/types/address.go index e98bb57a..3c0a38bd 100644 --- a/types/address.go +++ b/types/address.go @@ -8,19 +8,29 @@ import ( "fmt" "strings" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" + + "github.com/cosmos/cosmos-sdk/codec/legacy" ) -// Bech32 conversion constants +// Bech32PubKeyType defines a string type alias for a Bech32 public key type. +type Bech32PubKeyType string + const ( StratosBech32Prefix = "st" // PrefixSds is the prefix for sds keys PrefixSds = "sds" + Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" + Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" + Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" + Bech32PubKeyTypeSdsP2PPub Bech32PubKeyType = "sdsp2p" + // AccountAddressPrefix defines the Bech32 prefix of an account's address (st) AccountAddressPrefix = StratosBech32Prefix // AccountPubKeyPrefix defines the Bech32 prefix of an account's public key (stpub) @@ -39,18 +49,52 @@ const ( SdsNodeP2PAddressPrefix = StratosBech32Prefix + PrefixSds ) +// GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with +// a given key type. +func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (cryptotypes.PubKey, error) { + var bech32Prefix string + + switch pkt { + case Bech32PubKeyTypeAccPub: + bech32Prefix = GetConfig().GetBech32AccountPubPrefix() + + case Bech32PubKeyTypeValPub: + bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() + + case Bech32PubKeyTypeConsPub: + bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() + + case Bech32PubKeyTypeSdsP2PPub: + bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() + } + + bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) + if err != nil { + return nil, err + } + + pk, err := legacy.PubKeyFromBytes(bz) + if err != nil { + return nil, err + } + + return pk, nil +} + var _ sdk.Address = SdsAddress{} var _ yaml.Marshaler = SdsAddress{} type SdsAddress []byte +var _ sdk.Address = SdsAddress{} + // SdsAddressFromHex creates an SdsAddress from a hex string. func SdsAddressFromHex(address string) (addr SdsAddress, err error) { bz, err := addressBytesFromHexString(address) - return SdsAddress(bz), err + return bz, err } -// AccAddressFromBech32 creates an SdsAddress from a Bech32 string. +// SdsAddressFromBech32 creates an SdsAddress from a Bech32 string. func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { if len(strings.TrimSpace(address)) == 0 { return SdsAddress{}, errors.New("empty address string is not allowed") @@ -71,45 +115,46 @@ func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { return SdsAddress(bz), nil } -// Returns boolean for whether two SdsAddress are Equal -func (aa SdsAddress) Equals(aa2 sdk.Address) bool { - if aa.Empty() && aa2.Empty() { +// Equals Returns boolean for whether two SdsAddress are Equal +func (a SdsAddress) Equals(addr sdk.Address) bool { + if a.Empty() && addr.Empty() { + return true + } + + return bytes.Equal(a.Bytes(), addr.Bytes()) +} + +func (a SdsAddress) Empty() bool { + if a == nil || len(a) == 0 { return true } - return bytes.Equal(aa.Bytes(), aa2.Bytes()) + aa2 := SdsAddress{} + return bytes.Equal(a.Bytes(), aa2.Bytes()) } -// Returns boolean for whether a SdsAddress is empty -func (aa SdsAddress) Empty() bool { - return aa == nil || len(aa) == 0 +func (a SdsAddress) Marshal() ([]byte, error) { + return a, nil } -// Marshal returns the raw address bytes. It is needed for protobuf -// compatibility. -func (aa SdsAddress) Marshal() ([]byte, error) { - return aa, nil +func (a SdsAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(a.String()) } // Unmarshal sets the address to the given data. It is needed for protobuf // compatibility. -func (aa *SdsAddress) Unmarshal(data []byte) error { - *aa = data +func (a *SdsAddress) Unmarshal(data []byte) error { + *a = data return nil } -// MarshalJSON marshals to JSON using Bech32. -func (aa SdsAddress) MarshalJSON() ([]byte, error) { - return json.Marshal(aa.String()) -} - // MarshalYAML marshals to YAML using Bech32. -func (aa SdsAddress) MarshalYAML() (interface{}, error) { - return aa.String(), nil +func (a SdsAddress) MarshalYAML() (interface{}, error) { + return a.String(), nil } // UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (aa *SdsAddress) UnmarshalJSON(data []byte) error { +func (a *SdsAddress) UnmarshalJSON(data []byte) error { var s string err := json.Unmarshal(data, &s) @@ -117,7 +162,7 @@ func (aa *SdsAddress) UnmarshalJSON(data []byte) error { return err } if s == "" { - *aa = SdsAddress{} + *a = SdsAddress{} return nil } @@ -126,19 +171,19 @@ func (aa *SdsAddress) UnmarshalJSON(data []byte) error { return err } - *aa = aa2 + *a = aa2 return nil } // UnmarshalYAML unmarshals from JSON assuming Bech32 encoding. -func (aa *SdsAddress) UnmarshalYAML(data []byte) error { +func (a *SdsAddress) UnmarshalYAML(data []byte) error { var s string err := yaml.Unmarshal(data, &s) if err != nil { return err } if s == "" { - *aa = SdsAddress{} + *a = SdsAddress{} return nil } @@ -147,7 +192,7 @@ func (aa *SdsAddress) UnmarshalYAML(data []byte) error { return err } - *aa = aa2 + *a = aa2 return nil } diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 823c1493..bf92ec29 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -12,14 +12,13 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/log" ) // Keeper of the register store type Keeper struct { storeKey sdk.StoreKey - cdc codec.BinaryCodec + cdc codec.Codec // module specific parameter space that can be configured through governance paramSpace paramtypes.Subspace accountKeeper types.AccountKeeper @@ -32,7 +31,7 @@ type Keeper struct { } // NewKeeper creates a register keeper -func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, +func NewKeeper(cdc codec.Codec, key sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper) Keeper { keeper := Keeper{ @@ -66,7 +65,7 @@ func (k *Keeper) SetHooks(sh types.RegisterHooks) *Keeper { func (k Keeper) SetInitialUOzonePrice(ctx sdk.Context, price sdk.Dec) { store := ctx.KVStore(k.storeKey) - b := amino.MustMarshalBinaryLengthPrefixed(&price) + b := types.ModuleCdc.MustMarshalLengthPrefixed(&price) store.Set(types.InitialUOzonePriceKey, b) } @@ -76,13 +75,13 @@ func (k Keeper) GetInitialUOzonePrice(ctx sdk.Context) (price sdk.Dec) { if b == nil { panic("Stored initial uOzone price should not have been nil") } - amino.MustUnmarshalBinaryLengthPrefixed(b, &price) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &price) return } func (k Keeper) SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) { store := ctx.KVStore(k.storeKey) - b := amino.MustMarshalBinaryLengthPrefixed(totalUnissuedPrepay) + b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) store.Set(types.TotalUnissuedPrepayKey, b) } @@ -92,13 +91,13 @@ func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk if b == nil { return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) } - amino.MustUnmarshalBinaryLengthPrefixed(b, &totalUnissuedPrepay) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &totalUnissuedPrepay) return } func (k Keeper) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) { store := ctx.KVStore(k.storeKey) - b := amino.MustMarshalBinaryLengthPrefixed(stake) + b := types.ModuleCdc.MustMarshalLengthPrefixed(stake) store.Set(types.InitialGenesisStakeTotalKey, b) } @@ -108,13 +107,13 @@ func (k Keeper) GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) { if b == nil { return sdk.ZeroInt() } - amino.MustUnmarshalBinaryLengthPrefixed(b, &stake) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &stake) return } func (k Keeper) SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int) { store := ctx.KVStore(k.storeKey) - b := amino.MustMarshalBinaryLengthPrefixed(value) + b := types.ModuleCdc.MustMarshalLengthPrefixed(value) store.Set(types.UpperBoundOfTotalOzoneKey, b) } @@ -124,7 +123,7 @@ func (k Keeper) GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int) { if b == nil { return sdk.ZeroInt() } - amino.MustUnmarshalBinaryLengthPrefixed(b, &value) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &value) return } @@ -222,7 +221,7 @@ func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res return res[:len(res)-1] } -// return a given amount of all the UnbondingIndexingNodes +// GetUnbondingNodes return a given amount of all the UnbondingIndexingNodes func (k Keeper) GetUnbondingNodes(ctx sdk.Context, networkAddr stratos.SdsAddress, maxRetrieve uint16) (unbondingIndexingNodes []types.UnbondingNode) { @@ -242,7 +241,7 @@ func (k Keeper) GetUnbondingNodes(ctx sdk.Context, networkAddr stratos.SdsAddres return unbondingIndexingNodes[:i] // trim if the array length < maxRetrieve } -// return a unbonding UnbondingIndexingNode +// GetUnbondingNode return a unbonding UnbondingIndexingNode func (k Keeper) GetUnbondingNode(ctx sdk.Context, networkAddr stratos.SdsAddress) (ubd types.UnbondingNode, found bool) { @@ -257,7 +256,7 @@ func (k Keeper) GetUnbondingNode(ctx sdk.Context, return ubd, true } -// iterate through all of the unbonding indexingNodes +// IterateUnbondingNodes iterates through all of the unbonding indexingNodes func (k Keeper) IterateUnbondingNodes(ctx sdk.Context, fn func(index int64, ubd types.UnbondingNode) (stop bool)) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.UBDNodeKey) @@ -281,7 +280,7 @@ func (k Keeper) HasMaxUnbondingNodeEntries(ctx sdk.Context, networkAddr stratos. return len(ubd.Entries) >= int(k.MaxEntries(ctx)) } -// set the unbonding IndexingNode +// SetUnbondingNode sets the unbonding IndexingNode func (k Keeper) SetUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalUnbondingNode(k.cdc, ubd) @@ -293,7 +292,7 @@ func (k Keeper) SetUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store.Set(key, bz) } -// remove the unbonding IndexingNode object +// RemoveUnbondingNode removes the unbonding IndexingNode object func (k Keeper) RemoveUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) networkAddr, err := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) @@ -321,7 +320,7 @@ func (k Keeper) SetUnbondingNodeEntry(ctx sdk.Context, networkAddr stratos.SdsAd // unbonding delegation queue timeslice operations -// gets a specific unbonding queue timeslice. A timeslice is a slice of DVPairs +// GetUnbondingNodeQueueTimeSlice gets a specific unbonding queue timeslice. A timeslice is a slice of DVPairs // corresponding to unbonding delegations that expire at a certain time. func (k Keeper) GetUnbondingNodeQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (networkAddrs []stratos.SdsAddress) { store := ctx.KVStore(k.storeKey) @@ -329,18 +328,18 @@ func (k Keeper) GetUnbondingNodeQueueTimeSlice(ctx sdk.Context, timestamp time.T if bz == nil { return []stratos.SdsAddress{} } - amino.MustUnmarshalBinaryLengthPrefixed(bz, &networkAddrs) + types.ModuleCdc.MustUnmarshalLengthPrefixed(bz, &networkAddrs) return networkAddrs } -// Sets a specific unbonding queue timeslice. +// SetUnbondingNodeQueueTimeSlice sets a specific unbonding queue timeslice. func (k Keeper) SetUnbondingNodeQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []stratos.SdsAddress) { store := ctx.KVStore(k.storeKey) - bz := amino.MustMarshalBinaryLengthPrefixed(keys) + bz := types.ModuleCdc.MustMarshalLengthPrefixed(keys) store.Set(types.GetUBDTimeKey(timestamp), bz) } -// Insert an unbonding delegation to the appropriate timeslice in the unbonding queue +// InsertUnbondingNodeQueue inserts an unbonding delegation to the appropriate timeslice in the unbonding queue func (k Keeper) InsertUnbondingNodeQueue(ctx sdk.Context, ubd types.UnbondingNode, completionTime time.Time) { @@ -357,14 +356,14 @@ func (k Keeper) InsertUnbondingNodeQueue(ctx sdk.Context, ubd types.UnbondingNod } } -// Returns all the unbonding queue timeslices from time 0 until endTime +// UnbondingNodeQueueIterator returns all the unbonding queue timeslices from time 0 until endTime func (k Keeper) UnbondingNodeQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator { store := ctx.KVStore(k.storeKey) return store.Iterator(types.UBDNodeQueueKey, sdk.InclusiveEndBytes(types.GetUBDTimeKey(endTime))) } -// Returns a concatenated list of all the timeslices inclusively previous to +// DequeueAllMatureUBDQueue returns a concatenated list of all the timeslices inclusively previous to // currTime, and deletes the timeslices from the queue func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []stratos.SdsAddress) { @@ -377,7 +376,7 @@ func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, for ; unbondingTimesliceIterator.Valid(); unbondingTimesliceIterator.Next() { timeslice := []stratos.SdsAddress{} value := unbondingTimesliceIterator.Value() - amino.MustUnmarshalBinaryLengthPrefixed(value, ×lice) + types.ModuleCdc.MustUnmarshalLengthPrefixed(value, ×lice) matureUnbonds = append(matureUnbonds, timeslice...) store.Delete(unbondingTimesliceIterator.Key()) } @@ -603,7 +602,7 @@ func (k Keeper) GetUnbondingNodeBalance(ctx sdk.Context, return balance } -// calc current uoz price +// CurrUozPrice calcs current uoz price func (k Keeper) CurrUozPrice(ctx sdk.Context) sdk.Dec { S := k.GetInitialGenesisStakeTotal(ctx) Pt := k.GetTotalUnissuedPrepay(ctx).Amount diff --git a/x/register/keeper/keeper_tests.go b/x/register/keeper/keeper_tests.go index 7351845b..e4a64f45 100644 --- a/x/register/keeper/keeper_tests.go +++ b/x/register/keeper/keeper_tests.go @@ -1,67 +1,67 @@ package keeper -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/params" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" -) - -func TestMain(m *testing.M) { - config := stratos.GetConfig() - - config.Seal() -} - -func CreateTestInput(t *testing.T, isCheckTx bool) (sdk.Context, auth.AccountKeeper, bank.Keeper, Keeper, params.Keeper) { - - keyParams := sdk.NewKVStoreKey(params.StoreKey) - tkeyParams := sdk.NewTransientStoreKey(params.TStoreKey) - keyAcc := sdk.NewKVStoreKey(auth.StoreKey) - keyRegister := sdk.NewKVStoreKey(types.StoreKey) - - db := dbm.NewMemDB() - ms := store.NewCommitMultiStore(db) - - ms.MountStoreWithDB(keyParams, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(tkeyParams, sdk.StoreTypeTransient, db) - ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) - err := ms.LoadLatestVersion() - require.Nil(t, err) - - cdc := MakeTestCodec() - pk := params.NewKeeper(cdc, keyParams, tkeyParams) - ctx := sdk.NewContext(ms, abci.Header{ChainID: "foochainid"}, isCheckTx, log.NewNopLogger()) - - accountKeeper := auth.NewAccountKeeper(cdc, keyAcc, pk.Subspace(auth.DefaultParamspace), auth.ProtoBaseAccount) - bankKeeper := bank.NewBaseKeeper(accountKeeper, pk.Subspace(bank.DefaultParamspace), nil) - - keeper := NewKeeper(cdc, keyRegister, pk.Subspace(types.DefaultParamSpace), accountKeeper, bankKeeper) - keeper.SetParams(ctx, types.DefaultParams()) - - return ctx, accountKeeper, bankKeeper, keeper, pk -} - -// create a codec used only for testing -func MakeTestCodec() *codec.Codec { - var cdc = codec.New() - - // Register AppAccount - cdc.RegisterInterface((*authexported.Account)(nil), nil) - cdc.RegisterConcrete(&auth.BaseAccount{}, "test/pot/BaseAccount", nil) - codec.RegisterCrypto(cdc) - - return cdc -} +//import ( +// "testing" +// +// "github.com/cosmos/cosmos-sdk/codec" +// "github.com/cosmos/cosmos-sdk/store" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/cosmos/cosmos-sdk/x/params" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/register/types" +// "github.com/stretchr/testify/require" +// abci "github.com/tendermint/tendermint/abci/types" +// "github.com/tendermint/tendermint/libs/log" +// dbm "github.com/tendermint/tm-db" +//) +// +//func TestMain(m *testing.M) { +// config := stratos.GetConfig() +// +// config.Seal() +//} +// +//func CreateTestInput(t *testing.T, isCheckTx bool) (sdk.Context, auth.AccountKeeper, bank.Keeper, Keeper, params.Keeper) { +// +// keyParams := sdk.NewKVStoreKey(params.StoreKey) +// tkeyParams := sdk.NewTransientStoreKey(params.TStoreKey) +// keyAcc := sdk.NewKVStoreKey(auth.StoreKey) +// keyRegister := sdk.NewKVStoreKey(types.StoreKey) +// +// db := dbm.NewMemDB() +// ms := store.NewCommitMultiStore(db) +// +// ms.MountStoreWithDB(keyParams, sdk.StoreTypeIAVL, db) +// ms.MountStoreWithDB(tkeyParams, sdk.StoreTypeTransient, db) +// ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) +// ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) +// err := ms.LoadLatestVersion() +// require.Nil(t, err) +// +// cdc := MakeTestCodec() +// pk := params.NewKeeper(cdc, keyParams, tkeyParams) +// ctx := sdk.NewContext(ms, abci.Header{ChainID: "foochainid"}, isCheckTx, log.NewNopLogger()) +// +// accountKeeper := auth.NewAccountKeeper(cdc, keyAcc, pk.Subspace(auth.DefaultParamspace), auth.ProtoBaseAccount) +// bankKeeper := bank.NewBaseKeeper(accountKeeper, pk.Subspace(bank.DefaultParamspace), nil) +// +// keeper := NewKeeper(cdc, keyRegister, pk.Subspace(types.DefaultParamSpace), accountKeeper, bankKeeper) +// keeper.SetParams(ctx, types.DefaultParams()) +// +// return ctx, accountKeeper, bankKeeper, keeper, pk +//} +// +//// create a codec used only for testing +//func MakeTestCodec() *codec.Codec { +// var cdc = codec.New() +// +// // Register AppAccount +// cdc.RegisterInterface((*authexported.Account)(nil), nil) +// cdc.RegisterConcrete(&auth.BaseAccount{}, "test/pot/BaseAccount", nil) +// codec.RegisterCrypto(cdc) +// +// return cdc +//} diff --git a/x/register/keeper/node_state_change.go b/x/register/keeper/node_state_change.go index 040ca1b8..b43ee7d1 100644 --- a/x/register/keeper/node_state_change.go +++ b/x/register/keeper/node_state_change.go @@ -8,7 +8,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/tendermint/go-amino" abci "github.com/tendermint/tendermint/abci/types" ) @@ -159,7 +158,7 @@ func (k Keeper) GetAllMatureUBDNodeQueue(ctx sdk.Context, currTime time.Time) (m for ; ubdTimesliceIterator.Valid(); ubdTimesliceIterator.Next() { timeslice := []sdk.AccAddress{} - amino.MustUnmarshalBinaryLengthPrefixed(ubdTimesliceIterator.Value(), ×lice) + types.ModuleCdc.MustUnmarshalLengthPrefixed(ubdTimesliceIterator.Value(), ×lice) matureNetworkAddrs = append(matureNetworkAddrs, timeslice...) } @@ -174,7 +173,7 @@ func (k Keeper) UnbondAllMatureUBDNodeQueue(ctx sdk.Context) { for ; nodeTimesliceIterator.Valid(); nodeTimesliceIterator.Next() { timeslice := []stratos.SdsAddress{} - amino.MustUnmarshalBinaryLengthPrefixed(nodeTimesliceIterator.Value(), ×lice) + types.ModuleCdc.MustUnmarshalLengthPrefixed(nodeTimesliceIterator.Value(), ×lice) for _, networkAddr := range timeslice { ubd, found := k.GetUnbondingNode(ctx, networkAddr) diff --git a/x/register/keeper/slashing.go b/x/register/keeper/slashing.go index 95c864e6..47f022f8 100644 --- a/x/register/keeper/slashing.go +++ b/x/register/keeper/slashing.go @@ -2,8 +2,6 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/go-amino" - "github.com/stratosnet/stratos-chain/x/register/types" ) @@ -37,7 +35,7 @@ func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress for ; iter.Valid(); iter.Next() { walletAddress := sdk.AccAddress(iter.Key()[len(types.SlashingPrefix):]) var slashing sdk.Int - amino.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &slashing) + types.ModuleCdc.MustUnmarshalLengthPrefixed(iter.Value(), &slashing) if handler(walletAddress, slashing) { break } @@ -47,7 +45,7 @@ func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress func (k Keeper) SetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, slashing sdk.Int) { store := ctx.KVStore(k.storeKey) storeKey := types.GetSlashingKey(walletAddress) - bz := amino.MustMarshalBinaryLengthPrefixed(slashing) + bz := types.ModuleCdc.MustMarshalLengthPrefixed(slashing) store.Set(storeKey, bz) } @@ -57,6 +55,6 @@ func (k Keeper) GetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress) (res if bz == nil { return sdk.ZeroInt() } - amino.MustUnmarshalBinaryLengthPrefixed(bz, &res) + types.ModuleCdc.MustUnmarshalLengthPrefixed(bz, &res) return } diff --git a/x/register/types/codec.go b/x/register/types/codec.go index abb126c8..726b5ec2 100644 --- a/x/register/types/codec.go +++ b/x/register/types/codec.go @@ -44,21 +44,23 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/register module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/register and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) +//var ( +// amino = codec.NewLegacyAmino() +// +// // ModuleCdc references the global x/register module codec. Note, the codec should +// // ONLY be used in certain instances of tests and for JSON encoding as Amino is +// // still used for that purpose. +// // +// // The actual codec used for serialization should be provided to x/register and +// // defined at the application level. +//) // ModuleCdc defines the module codec +var ModuleCdc *codec.LegacyAmino + func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() + ModuleCdc = codec.NewLegacyAmino() + RegisterLegacyAminoCodec(ModuleCdc) + cryptocodec.RegisterCrypto(ModuleCdc) + ModuleCdc.Seal() } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go index 3ecd1eda..112c0d57 100644 --- a/x/register/types/genesis.pb.go +++ b/x/register/types/genesis.pb.go @@ -184,60 +184,60 @@ func (m *GenesisIndexingNode) GetDescription() *Description { } func init() { - proto.RegisterType((*GenesisState)(nil), "stratos.evm.v1.GenesisState") - proto.RegisterType((*GenesisIndexingNode)(nil), "stratos.evm.v1.GenesisIndexingNode") + proto.RegisterType((*GenesisState)(nil), "stratos.register.v1.GenesisState") + proto.RegisterType((*GenesisIndexingNode)(nil), "stratos.register.v1.GenesisIndexingNode") } func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } var fileDescriptor_5bdab54ebea9e48e = []byte{ - // 729 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x4e, 0xdb, 0x48, - 0x1c, 0xc7, 0x93, 0x05, 0x02, 0x38, 0xc0, 0x6a, 0x4d, 0x76, 0x65, 0xd8, 0xdd, 0x38, 0x1d, 0x55, - 0x15, 0x95, 0xc0, 0x56, 0x68, 0x4f, 0x15, 0xaa, 0x84, 0x85, 0x5a, 0xd1, 0xaa, 0x28, 0x72, 0x8a, - 0x2a, 0xf5, 0x62, 0x4d, 0xec, 0xc1, 0x8c, 0x92, 0xcc, 0x58, 0x33, 0xe3, 0x80, 0x39, 0xf5, 0x11, - 0xfa, 0x0e, 0x7d, 0x85, 0x3e, 0x04, 0xea, 0x89, 0x63, 0xd5, 0x83, 0x55, 0xc1, 0xbd, 0x87, 0x3c, - 0x41, 0x95, 0x99, 0x31, 0x31, 0x55, 0x54, 0x89, 0x13, 0x33, 0xfc, 0xbe, 0xbf, 0xcf, 0xd7, 0xf3, - 0xfb, 0x13, 0xe3, 0x01, 0x17, 0x0c, 0x0a, 0xca, 0x5d, 0x86, 0x62, 0xcc, 0x05, 0x62, 0xee, 0xa8, - 0xed, 0xc6, 0x88, 0x20, 0x8e, 0xb9, 0x93, 0x30, 0x2a, 0xa8, 0xb9, 0xa6, 0x25, 0x0e,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xe9, 0x45, 0x87, 0xe1, 0x10, 0x59, 0xf3, 0xad, 0xea, 0xd6, 0xb2, - 0xf7, 0xea, 0x32, 0xb7, 0x2b, 0xdf, 0x72, 0xfb, 0x51, 0x8c, 0xc5, 0x69, 0xda, 0x73, 0x42, 0x3a, - 0xd4, 0x6d, 0xd2, 0x7f, 0x76, 0x78, 0xd4, 0x77, 0x45, 0x96, 0x20, 0xee, 0x1c, 0xa0, 0x70, 0x9c, - 0xdb, 0x56, 0x61, 0x28, 0x71, 0x41, 0x4a, 0x2f, 0x82, 0x64, 0x02, 0x04, 0xfe, 0xaf, 0x16, 0xe6, - 0x87, 0xaa, 0xb1, 0x2e, 0xa8, 0x80, 0x83, 0x63, 0x82, 0x39, 0x4f, 0x51, 0xd4, 0x61, 0x28, 0x81, - 0x99, 0xb5, 0x20, 0xad, 0x8f, 0xee, 0x61, 0x7d, 0x48, 0xc4, 0x38, 0xb7, 0xff, 0x53, 0xd6, 0x12, - 0x19, 0xa4, 0x9a, 0x19, 0x24, 0x12, 0x0a, 0xfc, 0x59, 0x56, 0x66, 0xd7, 0x58, 0xe2, 0x03, 0xc8, - 0x4f, 0x31, 0x89, 0xad, 0x5a, 0x6b, 0x6e, 0xab, 0xbe, 0xfb, 0xff, 0xcc, 0xc2, 0x76, 0xb5, 0xc8, - 0xb3, 0xc6, 0xb9, 0xdd, 0x50, 0x3e, 0x45, 0x62, 0x80, 0xc9, 0x09, 0x05, 0xfe, 0x2d, 0x08, 0x7c, - 0x9a, 0x37, 0xd6, 0xf5, 0xc0, 0x95, 0x1b, 0x62, 0xee, 0x19, 0x75, 0x82, 0xc4, 0x19, 0x65, 0xfd, - 0xfd, 0x28, 0x62, 0x72, 0xf8, 0x96, 0xbd, 0xcd, 0x71, 0x6e, 0xff, 0xa3, 0x80, 0x3a, 0x18, 0xc0, - 0x28, 0x62, 0x88, 0x73, 0xe0, 0x97, 0xe5, 0xe6, 0x3b, 0xa3, 0x96, 0xa4, 0xbd, 0xd7, 0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, 0x56, 0x3f, 0xde, 0x34, 0x2b, 0x57, 0x37, 0xcd, 0xca, 0xd7, 0x9b, - 0x66, 0xe5, 0xfd, 0xd3, 0xd2, 0xe3, 0xb5, 0x29, 0x41, 0xa2, 0x38, 0xee, 0x84, 0xa7, 0x10, 0x13, - 0xf7, 0x7c, 0xfa, 0x93, 0x27, 0xcb, 0xd1, 0xab, 0xc9, 0x39, 0x78, 0xf2, 0x33, 0x00, 0x00, 0xff, - 0xff, 0x35, 0xdb, 0xf5, 0x98, 0xb8, 0x05, 0x00, 0x00, + // 725 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4f, 0x4f, 0xdb, 0x3c, + 0x1c, 0xc7, 0xdb, 0x07, 0x28, 0x90, 0x02, 0x8f, 0x9e, 0xd0, 0x67, 0x0a, 0x6c, 0x6b, 0x3a, 0x6b, + 0x9a, 0x98, 0x04, 0x89, 0xca, 0x76, 0x9a, 0xd0, 0x24, 0x22, 0xb4, 0x89, 0x4d, 0x43, 0x55, 0x3a, + 0x34, 0x69, 0x97, 0xc8, 0x4d, 0x4c, 0xb0, 0xda, 0xda, 0x91, 0xed, 0x00, 0xe1, 0xb4, 0x97, 0xb0, + 0xf7, 0xb0, 0xb7, 0xb0, 0x17, 0x81, 0x76, 0xe2, 0x38, 0xed, 0x10, 0x4d, 0x70, 0xdf, 0xa1, 0xaf, + 0x60, 0xaa, 0xed, 0xd0, 0x30, 0x55, 0x93, 0x38, 0xd5, 0xee, 0xef, 0xeb, 0xcf, 0xd7, 0xfe, 0xfd, + 0x89, 0xf1, 0x88, 0x0b, 0x06, 0x05, 0xe5, 0x2e, 0x43, 0x31, 0xe6, 0x02, 0x31, 0xf7, 0xa4, 0xed, + 0xc6, 0x88, 0x20, 0x8e, 0xb9, 0x93, 0x30, 0x2a, 0xa8, 0xb9, 0xaa, 0x25, 0x4e, 0x21, 0x71, 0x4e, + 0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x79, 0xdd, 0xac, 0x7c, 0xbf, 0x6e, 0x56, 0x3e, 0x3e, 0x2f, + 0x3d, 0x5e, 0x9b, 0x12, 0x24, 0x8a, 0xe5, 0x56, 0x78, 0x0c, 0x31, 0x71, 0xcf, 0x26, 0x9f, 0x3c, + 0x99, 0x8e, 0x5e, 0x4d, 0xf6, 0xc1, 0xb3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xd8, 0x26, + 0x1f, 0xbd, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index 44834d5e..d26930a1 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -11,7 +11,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - goamino "github.com/tendermint/go-amino" ) // IndexingNodes is a collection of indexing node @@ -171,12 +170,12 @@ func (v IndexingNode) IsUnBonding() bool { } // MustMarshalIndexingNode returns the indexingNode bytes. Panics if fails -func MustMarshalIndexingNode(cdc codec.BinaryCodec, indexingNode IndexingNode) []byte { +func MustMarshalIndexingNode(cdc codec.Codec, indexingNode IndexingNode) []byte { return cdc.MustMarshal(&indexingNode) } // MustUnmarshalIndexingNode unmarshal an indexing node from a store value. Panics if fails -func MustUnmarshalIndexingNode(cdc codec.BinaryCodec, value []byte) IndexingNode { +func MustUnmarshalIndexingNode(cdc codec.Codec, value []byte) IndexingNode { indexingNode, err := UnmarshalIndexingNode(cdc, value) if err != nil { panic(err) @@ -185,7 +184,7 @@ func MustUnmarshalIndexingNode(cdc codec.BinaryCodec, value []byte) IndexingNode } // UnmarshalIndexingNode unmarshal an indexing node from a store value -func UnmarshalIndexingNode(cdc codec.BinaryCodec, value []byte) (indexingNode IndexingNode, err error) { +func UnmarshalIndexingNode(cdc codec.Codec, value []byte) (indexingNode IndexingNode, err error) { err = cdc.Unmarshal(value, &indexingNode) return indexingNode, err } @@ -221,13 +220,6 @@ func (v VoteOpinion) String() string { } } -//type IndexingNodeRegistrationVotePool struct { -// NodeAddress stratos.SdsAddress `json:"node_address" yaml:"node_address"` -// ApproveList []stratos.SdsAddress `json:"approve_list" yaml:"approve_list"` -// RejectList []stratos.SdsAddress `json:"reject_list" yaml:"reject_list"` -// ExpireTime time.Time `json:"expire_time" yaml:"expire_time"` -//} - func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []stratos.SdsAddress, rejectList []stratos.SdsAddress, expireTime time.Time) IndexingNodeRegistrationVotePool { approveSlice := make([]string, len(approveList)) rejectSlice := make([]string, len(rejectList)) @@ -246,12 +238,12 @@ func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []strat } // MustMarshalIndexingNodeRegistrationVotePool returns the indexingNode bytes. Panics if fails -func MustMarshalIndexingNodeRegistrationVotePool(cdc codec.BinaryCodec, votePool IndexingNodeRegistrationVotePool) []byte { +func MustMarshalIndexingNodeRegistrationVotePool(cdc codec.Codec, votePool IndexingNodeRegistrationVotePool) []byte { return cdc.MustMarshal(&votePool) } // MustUnmarshalIndexingNodeRegistrationVotePool unmarshal an indexing node from a store value. Panics if fails -func MustUnmarshalIndexingNodeRegistrationVotePool(cdc codec.BinaryCodec, value []byte) IndexingNodeRegistrationVotePool { +func MustUnmarshalIndexingNodeRegistrationVotePool(cdc codec.Codec, value []byte) IndexingNodeRegistrationVotePool { votePool, err := UnmarshalIndexingNodeRegistrationVotePool(cdc, value) if err != nil { panic(err) @@ -260,13 +252,13 @@ func MustUnmarshalIndexingNodeRegistrationVotePool(cdc codec.BinaryCodec, value } // UnmarshalIndexingNodeRegistrationVotePool unmarshal an indexing node from a store value -func UnmarshalIndexingNodeRegistrationVotePool(cdc codec.BinaryCodec, value []byte) (votePool IndexingNodeRegistrationVotePool, err error) { +func UnmarshalIndexingNodeRegistrationVotePool(cdc codec.Codec, value []byte) (votePool IndexingNodeRegistrationVotePool, err error) { err = cdc.Unmarshal(value, &votePool) return votePool, err } func (v1 IndexingNode) Equal(v2 IndexingNode) bool { - bz1 := goamino.MustMarshalBinaryLengthPrefixed(&v1) - bz2 := goamino.MustMarshalBinaryLengthPrefixed(&v2) + bz1 := ModuleCdc.MustMarshalLengthPrefixed(&v1) + bz2 := ModuleCdc.MustMarshalLengthPrefixed(&v2) return bytes.Equal(bz1, bz2) } diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 86367c21..3f38bfb9 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -201,7 +201,7 @@ func (msg MsgCreateIndexingNode) GetSigners() []sdk.AccAddress { // Owner pays the tx fees addr, err := sdk.AccAddressFromBech32(msg.GetOwnerAddress()) if err != nil { - panic(err) + return []sdk.AccAddress{} } return []sdk.AccAddress{addr.Bytes()} diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 03b2b0b8..55fe38da 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -7,6 +7,7 @@ import ( "strings" "time" + "github.com/stratosnet/stratos-chain/x/evm/types" "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec" @@ -15,7 +16,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - goamino "github.com/tendermint/go-amino" ) type NodeType uint8 @@ -231,8 +231,8 @@ func UnmarshalResourceNode(cdc codec.BinaryCodec, value []byte) (v ResourceNode, } func (v1 ResourceNode) Equal(v2 ResourceNode) bool { - bz1 := goamino.MustMarshalBinaryLengthPrefixed(&v1) - bz2 := goamino.MustMarshalBinaryLengthPrefixed(&v2) + bz1 := types.ModuleCdc.MustMarshalLengthPrefixed(&v1) + bz2 := types.ModuleCdc.MustMarshalLengthPrefixed(&v2) return bytes.Equal(bz1, bz2) } From d97eeadac48e6722bf021e67c32022418e5a6fa6 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 11 May 2022 15:57:06 -0400 Subject: [PATCH 041/113] updates --- proto/stratos/sds/v1/genesis.proto | 24 +++++++++++ proto/stratos/sds/v1/sds.proto | 67 ++++++++++++++++++++++++++++++ x/sds/keeper/keeper.go | 36 ++++++++-------- x/sds/types/codec.go | 30 ++++++++++--- x/sds/types/errors.go | 24 +++++++---- x/sds/types/genesis.go | 32 +++++--------- x/sds/types/msg.go | 59 ++++++++++++++++---------- x/sds/types/params.go | 33 ++++----------- x/sds/types/querier.go | 4 +- x/sds/types/uploaded_file.go | 34 ++++----------- 10 files changed, 215 insertions(+), 128 deletions(-) create mode 100644 proto/stratos/sds/v1/genesis.proto create mode 100644 proto/stratos/sds/v1/sds.proto diff --git a/proto/stratos/sds/v1/genesis.proto b/proto/stratos/sds/v1/genesis.proto new file mode 100644 index 00000000..85ce423a --- /dev/null +++ b/proto/stratos/sds/v1/genesis.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package stratos.sds.v1; + +import "gogoproto/gogo.proto"; + +import "stratos/sds/v1/sds.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/sds/types"; + +// GenesisState defines the register module's genesis state. +message GenesisState { + Params params = 1 [ + (gogoproto.jsontag) = "params", + (gogoproto.moretags) = "yaml:\"params\"" + ]; + repeated FileUpload fileUploads = 2 [ + (gogoproto.jsontag) = "file_uploads", + (gogoproto.moretags) = "yaml:\"file_uploads\"" + ]; +} + + + + diff --git a/proto/stratos/sds/v1/sds.proto b/proto/stratos/sds/v1/sds.proto new file mode 100644 index 00000000..63c65372 --- /dev/null +++ b/proto/stratos/sds/v1/sds.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; +package stratos.sds.v1; + +import "gogoproto/gogo.proto"; + +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/sds/types"; + +// Params defines the Register module parameters +message Params { + string bond_denom = 1 [ + (gogoproto.jsontag) = "bond_denom", + (gogoproto.moretags) = "yaml:\"bond_denom\"" + ]; +} + +message FileUpload { + string fileHash = 1 [ + (gogoproto.jsontag) = "file_hash", + (gogoproto.moretags) = "yaml:\"file_hash\"" + ]; + FileInfo fileInfo = 2 [ + (gogoproto.jsontag) = "file_info", + (gogoproto.moretags) = "yaml:\"file_info\"" ]; +} + +message FileInfo { + string height = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string reporter = 2; + string uploader = 3; +} + +message MsgFileUpload { + string fileHash = 1 [ + (gogoproto.jsontag) = "file_hash", + (gogoproto.moretags) = "yaml:\"file_hash\"" + ]; + string from = 2 [ + (gogoproto.jsontag) = "from", + (gogoproto.moretags) = "yaml:\"from\"" + ]; + string reporter = 3 [ + (gogoproto.jsontag) = "reporter", + (gogoproto.moretags) = "yaml:\"reporter\"" + ]; + string uploader = 4 [ + (gogoproto.jsontag) = "uploader", + (gogoproto.moretags) = "yaml:\"uploader\"" + ]; +} + +message MsgPrepay { + string sender = 1 [ + (gogoproto.jsontag) = "sender", + (gogoproto.moretags) = "yaml:\"sender\"" + ]; + + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (gogoproto.jsontag) = "coins", + (gogoproto.moretags) = "yaml:\"coins\"", + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} diff --git a/x/sds/keeper/keeper.go b/x/sds/keeper/keeper.go index ecc02f44..0bbd57a6 100644 --- a/x/sds/keeper/keeper.go +++ b/x/sds/keeper/keeper.go @@ -7,10 +7,10 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/params" - "github.com/stratosnet/stratos-chain/x/pot" - "github.com/stratosnet/stratos-chain/x/register" + bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + potKeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" + registerKeeper "github.com/stratosnet/stratos-chain/x/register/keeper" "github.com/stratosnet/stratos-chain/x/sds/types" "github.com/tendermint/tendermint/libs/log" ) @@ -23,29 +23,29 @@ var ( // encoding/decoding library. type Keeper struct { key sdk.StoreKey - cdc *codec.Codec - paramSpace params.Subspace - BankKeeper bank.Keeper - RegisterKeeper register.Keeper - PotKeeper pot.Keeper + cdc codec.Codec + paramSpace paramtypes.Subspace + bankKeeper bankKeeper.Keeper + RegisterKeeper registerKeeper.Keeper + PotKeeper potKeeper.Keeper } // NewKeeper returns a new sdk.NewKeeper that uses go-amino to // (binary) encode and decode concrete sdk.MsgUploadFile. // nolint func NewKeeper( - cdc *codec.Codec, + cdc codec.Codec, key sdk.StoreKey, - paramSpace params.Subspace, - bankKeeper bank.Keeper, - registerKeeper register.Keeper, - potKeeper pot.Keeper, + paramSpace paramtypes.Subspace, + bankKeeper bankKeeper.Keeper, + registerKeeper registerKeeper.Keeper, + potKeeper potKeeper.Keeper, ) Keeper { return Keeper{ key: key, cdc: cdc, paramSpace: paramSpace.WithKeyTable(types.ParamKeyTable()), - BankKeeper: bankKeeper, + bankKeeper: bankKeeper, RegisterKeeper: registerKeeper, PotKeeper: potKeeper, } @@ -118,7 +118,7 @@ func (k Keeper) simulatePurchaseUoz(ctx sdk.Context, amount sdk.Int) sdk.Int { // Prepay transfers coins from bank to sds (volumn) pool func (k Keeper) Prepay(ctx sdk.Context, sender sdk.AccAddress, coins sdk.Coins) (sdk.Int, error) { // src - hasCoins? - if !k.BankKeeper.HasCoins(ctx, sender, coins) { + if !k.bankKeeper.HasCoins(ctx, sender, coins) { return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "No valid coins to be deducted from acc %s", hex.EncodeToString(types.PrepayBalanceKey(sender))) } @@ -127,7 +127,7 @@ func (k Keeper) Prepay(ctx sdk.Context, sender sdk.AccAddress, coins sdk.Coins) return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "Failed prepay from acc %s", hex.EncodeToString(types.PrepayBalanceKey(sender))) } - _, err = k.BankKeeper.SubtractCoins(ctx, sender, coins) + _, err = k.bankKeeper.SubtractCoins(ctx, sender, coins) if err != nil { return sdk.ZeroInt(), err } @@ -225,7 +225,7 @@ func (k Keeper) IterateFileUpload(ctx sdk.Context, handler func(string, types.Fi for ; iter.Valid(); iter.Next() { fileHash := string(iter.Key()[len(types.FileStoreKeyPrefix):]) var fileInfo types.FileInfo - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &fileInfo) + k.cdc.MustUnmarshalLengthPrefixed(iter.Value(), &fileInfo) if handler(fileHash, fileInfo) { break } diff --git a/x/sds/types/codec.go b/x/sds/types/codec.go index db05a2e5..3d6dd153 100644 --- a/x/sds/types/codec.go +++ b/x/sds/types/codec.go @@ -2,21 +2,39 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/cosmos/cosmos-sdk/x/authz" ) -// RegisterCodec registers concrete types on codec -func RegisterCodec(cdc *codec.Codec) { +// RegisterLegacyAminoCodec registers concrete types on codec +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // this line is used by starport scaffolding # 1 cdc.RegisterConcrete(MsgFileUpload{}, "sds/FileUploadTx", nil) cdc.RegisterConcrete(MsgPrepay{}, "sds/PrepayTx", nil) } +// RegisterInterfaces registers the x/register interfaces types with the interface registry +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgFileUpload{}, + &MsgPrepay{}, + ) + registry.RegisterImplementations( + (*authz.Authorization)(nil), + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + // ModuleCdc defines the module codec -var ModuleCdc *codec.Codec +var ModuleCdc *codec.LegacyAmino func init() { - ModuleCdc = codec.New() - RegisterCodec(ModuleCdc) - codec.RegisterCrypto(ModuleCdc) + ModuleCdc = codec.NewLegacyAmino() + RegisterLegacyAminoCodec(ModuleCdc) + cryptocodec.RegisterCrypto(ModuleCdc) ModuleCdc.Seal() } diff --git a/x/sds/types/errors.go b/x/sds/types/errors.go index 69f59c37..e7b4dd9f 100644 --- a/x/sds/types/errors.go +++ b/x/sds/types/errors.go @@ -4,12 +4,22 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +const ( + codeErrInvalid = uint32(iota) + 2 // NOTE: code 1 is reserved for internal errors + codeErrInvalidHeight + codeErrEmptyUploaderAddr + codeErrEmptyReporterAddr + codeErrEmptyFileHash + codeErrEmptySenderAddr + codeErrInvalidCoins +) + var ( - ErrInvalid = sdkerrors.Register(ModuleName, 1, "error invalid") - ErrInvalidHeight = sdkerrors.Register(ModuleName, 2, "invalid height") - ErrEmptyUploaderAddr = sdkerrors.Register(ModuleName, 3, "missing uploader address") - ErrEmptyReporterAddr = sdkerrors.Register(ModuleName, 4, "missing reporter address") - ErrEmptyFileHash = sdkerrors.Register(ModuleName, 5, "missing file hash") - ErrEmptySenderAddr = sdkerrors.Register(ModuleName, 6, "missing sender address") - ErrInvalidCoins = sdkerrors.Register(ModuleName, 7, "invalid coins") + ErrInvalid = sdkerrors.Register(ModuleName, codeErrInvalid, "error invalid") + ErrInvalidHeight = sdkerrors.Register(ModuleName, codeErrInvalidHeight, "invalid height") + ErrEmptyUploaderAddr = sdkerrors.Register(ModuleName, codeErrEmptyUploaderAddr, "missing uploader address") + ErrEmptyReporterAddr = sdkerrors.Register(ModuleName, codeErrEmptyReporterAddr, "missing reporter address") + ErrEmptyFileHash = sdkerrors.Register(ModuleName, codeErrEmptyFileHash, "missing file hash") + ErrEmptySenderAddr = sdkerrors.Register(ModuleName, codeErrEmptySenderAddr, "missing sender address") + ErrInvalidCoins = sdkerrors.Register(ModuleName, codeErrInvalidCoins, "invalid coins") ) diff --git a/x/sds/types/genesis.go b/x/sds/types/genesis.go index 82696704..3298509a 100644 --- a/x/sds/types/genesis.go +++ b/x/sds/types/genesis.go @@ -7,36 +7,24 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// GenesisState - all sds state that must be provided at genesis -type GenesisState struct { - Params Params `json:"params" yaml:"params"` - FileUpload []FileUpload `json:"file_upload" yaml:"file_upload"` -} - -// FileUpload required for fileInfo set update logic -type FileUpload struct { - FileHash string `json:"file_hash" yaml:"file_hash"` - FileInfo FileInfo `json:"file_info" yaml:"file_info"` -} - // NewGenesisState creates a new GenesisState object -func NewGenesisState(params Params, fileUpload []FileUpload) GenesisState { +func NewGenesisState(params *Params, fileUploads []*FileUpload) GenesisState { return GenesisState{ - Params: params, - FileUpload: fileUpload, + Params: params, + FileUploads: fileUploads, } } // DefaultGenesisState - default GenesisState used by Cosmos Hub -func DefaultGenesisState() GenesisState { - return GenesisState{ +func DefaultGenesisState() *GenesisState { + return &GenesisState{ Params: DefaultParams(), } } // GetGenesisStateFromAppState returns x/auth GenesisState given raw application // genesis state. -func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState { +func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) GenesisState { var genesisState GenesisState if appState[ModuleName] != nil { cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) @@ -51,18 +39,18 @@ func ValidateGenesis(data GenesisState) error { return err } - if len(data.FileUpload) > 0 { - for _, upload := range data.FileUpload { + if len(data.FileUploads) > 0 { + for _, upload := range data.FileUploads { if len(upload.FileHash) == 0 { return ErrEmptyFileHash } if upload.FileInfo.Height.LT(sdk.ZeroInt()) { return ErrInvalidHeight } - if upload.FileInfo.Reporter.Empty() { + if len(upload.FileInfo.Reporter) == 0 { return ErrEmptyReporterAddr } - if upload.FileInfo.Uploader.Empty() { + if len(upload.FileInfo.Uploader) == 0 { return ErrEmptyUploaderAddr } } diff --git a/x/sds/types/msg.go b/x/sds/types/msg.go index 4433a957..2042d010 100644 --- a/x/sds/types/msg.go +++ b/x/sds/types/msg.go @@ -11,18 +11,11 @@ const ( ConstSdsPrepay = "SdsPrepayTx" ) -type MsgFileUpload struct { - FileHash string `json:"file_hash" yaml:"file_hash"` // hash of file - From sdk.AccAddress `json:"from" yaml:"from"` // wallet addr who will pay this tx - Reporter stratos.SdsAddress `json:"reporter" yaml:"reporter"` // p2pAddr of sp node who reports this tx - Uploader sdk.AccAddress `json:"uploader" yaml:"uploader"` // user who uploads the file -} - // verify interface at compile time var _ sdk.Msg = &MsgFileUpload{} -// NewMsg creates a new Msg instance -func NewMsgUpload(fileHash string, from sdk.AccAddress, reporter stratos.SdsAddress, uploader sdk.AccAddress) MsgFileUpload { +// NewMsgUpload creates a new Msg instance +func NewMsgUpload(fileHash string, from, reporter, uploader string) MsgFileUpload { return MsgFileUpload{ FileHash: fileHash, From: from, @@ -35,21 +28,35 @@ func NewMsgUpload(fileHash string, from sdk.AccAddress, reporter stratos.SdsAddr func (msg MsgFileUpload) Route() string { return RouterKey } func (msg MsgFileUpload) Type() string { return ConstFileUpload } func (msg MsgFileUpload) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.From} + accAddr, err := sdk.AccAddressFromBech32(msg.GetFrom()) + if err != nil { + return []sdk.AccAddress{} + } + return []sdk.AccAddress{accAddr.Bytes()} } // GetSignBytes gets the bytes for the message signer to sign on func (msg MsgFileUpload) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic validity check for the AnteHandler func (msg MsgFileUpload) ValidateBasic() error { - if msg.Reporter.Empty() { + reporter, err := stratos.SdsAddressFromBech32(msg.GetReporter()) + if err != nil { + return err + } + + uploader, err := stratos.SdsAddressFromBech32(msg.GetUploader()) + if err != nil { + return err + } + + if reporter.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing address of tx reporter") } - if msg.Uploader.Empty() { + if uploader.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing address of file uploader") } if len(msg.FileHash) == 0 { @@ -58,16 +65,12 @@ func (msg MsgFileUpload) ValidateBasic() error { return nil } -type MsgPrepay struct { - Sender sdk.AccAddress `json:"sender" yaml:"sender"` // sender of tx - Coins sdk.Coins `json:"coins" yaml:"coins"` // coins to send -} - // verify interface at compile time var _ sdk.Msg = &MsgPrepay{} -// NewMsg creates a new Msg instance -func NewMsgPrepay(sender sdk.AccAddress, coins sdk.Coins) MsgPrepay { +// NewMsgPrepay NewMsg creates a new Msg instance +func NewMsgPrepay(sender string, coins sdk.Coins) MsgPrepay { + return MsgPrepay{ Sender: sender, Coins: coins, @@ -78,18 +81,28 @@ func NewMsgPrepay(sender sdk.AccAddress, coins sdk.Coins) MsgPrepay { func (msg MsgPrepay) Route() string { return RouterKey } func (msg MsgPrepay) Type() string { return ConstSdsPrepay } func (msg MsgPrepay) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender} + sender, err := sdk.AccAddressFromBech32(msg.GetSender()) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{sender.Bytes()} } // GetSignBytes gets the bytes for the message signer to sign on func (msg MsgPrepay) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic validity check for the AnteHandler func (msg MsgPrepay) ValidateBasic() error { - if msg.Sender.Empty() { + sender, err := stratos.SdsAddressFromBech32(msg.GetSender()) + if err != nil { + return err + } + + if sender.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing sender address") } if msg.Coins.Empty() { diff --git a/x/sds/types/params.go b/x/sds/types/params.go index 2a7556c6..32d9a308 100644 --- a/x/sds/types/params.go +++ b/x/sds/types/params.go @@ -6,9 +6,7 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/params/subspace" - - "github.com/cosmos/cosmos-sdk/x/params" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // Default parameter namespace @@ -22,16 +20,9 @@ var ( KeyBondDenom = []byte("BondDenom") ) -var _ subspace.ParamSet = &Params{} - -// Params - used for initializing default parameter for sds at genesis -type Params struct { - BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination -} - // ParamKeyTable for sds module -func ParamKeyTable() params.KeyTable { - return params.NewKeyTable().RegisterParamSet(&Params{}) +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } // NewParams creates a new Params object @@ -42,21 +33,15 @@ func NewParams(bondDenom string) Params { } // DefaultParams defines the parameters for this module -func DefaultParams() Params { - return NewParams(DefaultBondDenom) -} - -// String implements the stringer interface for Params -func (p Params) String() string { - return fmt.Sprintf(`Params: - BondDenom: %s`, - p.BondDenom) +func DefaultParams() *Params { + p := NewParams(DefaultBondDenom) + return &p } // ParamSetPairs - Implements params.ParamSet -func (p *Params) ParamSetPairs() params.ParamSetPairs { - return params.ParamSetPairs{ - params.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), } } diff --git a/x/sds/types/querier.go b/x/sds/types/querier.go index d6d737bf..0ed4995d 100644 --- a/x/sds/types/querier.go +++ b/x/sds/types/querier.go @@ -12,12 +12,12 @@ const ( QueryUozSupply = "uoz_supply" ) -// params for query 'custom/distr/validator_outstanding_rewards' +// QueryUploadedFileParams for query 'custom/distr/validator_outstanding_rewards' type QueryUploadedFileParams struct { Sender types.AccAddress `json:"sender" yaml:"sender"` } -// creates a new instance of QueryValidatorSlashesParams +// NewQueryUploadedFileParams creates a new instance of QueryValidatorSlashesParams func NewQueryUploadedFileParams(sender types.AccAddress) QueryUploadedFileParams { return QueryUploadedFileParams{ Sender: sender, diff --git a/x/sds/types/uploaded_file.go b/x/sds/types/uploaded_file.go index b0c7baeb..0682e08e 100644 --- a/x/sds/types/uploaded_file.go +++ b/x/sds/types/uploaded_file.go @@ -1,21 +1,12 @@ package types import ( - "fmt" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - stratos "github.com/stratosnet/stratos-chain/types" ) -type FileInfo struct { - Height sdk.Int - Reporter stratos.SdsAddress - Uploader sdk.AccAddress -} - -// constructor -func NewFileInfo(height sdk.Int, reporter stratos.SdsAddress, uploader sdk.AccAddress) FileInfo { +// NewFileInfo constructor +func NewFileInfo(height *sdk.Int, reporter, uploader string) FileInfo { return FileInfo{ Height: height, Reporter: reporter, @@ -24,12 +15,12 @@ func NewFileInfo(height sdk.Int, reporter stratos.SdsAddress, uploader sdk.AccAd } // MustMarshalFileInfo returns the fileInfo's bytes. Panics if fails -func MustMarshalFileInfo(cdc *codec.Codec, file FileInfo) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(file) +func MustMarshalFileInfo(cdc codec.Codec, file FileInfo) []byte { + return cdc.MustMarshalLengthPrefixed(&file) } // MustUnmarshalFileInfo unmarshal a file's info from a store value. Panics if fails -func MustUnmarshalFileInfo(cdc *codec.Codec, value []byte) FileInfo { +func MustUnmarshalFileInfo(cdc codec.Codec, value []byte) FileInfo { file, err := UnmarshalFileInfo(cdc, value) if err != nil { panic(err) @@ -37,17 +28,8 @@ func MustUnmarshalFileInfo(cdc *codec.Codec, value []byte) FileInfo { return file } -// UnmarshalResourceNode unmarshal a file's info from a store value -func UnmarshalFileInfo(cdc *codec.Codec, value []byte) (fi FileInfo, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &fi) +// UnmarshalFileInfo unmarshal a file's info from a store value +func UnmarshalFileInfo(cdc codec.Codec, value []byte) (fi FileInfo, err error) { + err = cdc.UnmarshalLengthPrefixed(value, &fi) return fi, err } - -// String returns a human readable string representation of a resource node. -func (fi FileInfo) String() string { - return fmt.Sprintf(`FileInfo:{ - Height: %s - Reporter: %s - Uploader: %s - }`, fi.Height.String(), fi.Reporter.String(), fi.Uploader.String()) -} From 6004860651abe2213561f17bd01c3484df186eea Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 11 May 2022 15:58:36 -0400 Subject: [PATCH 042/113] updates --- proto/stratos/sds/v1/query.proto | 123 +++ proto/stratos/sds/v1/tx.proto | 277 ++++++ x/sds/types/genesis.pb.go | 394 +++++++++ x/sds/types/sds.pb.go | 1401 ++++++++++++++++++++++++++++++ 4 files changed, 2195 insertions(+) create mode 100644 proto/stratos/sds/v1/query.proto create mode 100644 proto/stratos/sds/v1/tx.proto create mode 100644 x/sds/types/genesis.pb.go create mode 100644 x/sds/types/sds.pb.go diff --git a/proto/stratos/sds/v1/query.proto b/proto/stratos/sds/v1/query.proto new file mode 100644 index 00000000..aa23eb0a --- /dev/null +++ b/proto/stratos/sds/v1/query.proto @@ -0,0 +1,123 @@ +syntax = "proto3"; +package stratos.sds.v1; + +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +import "stratos/register/v1/register.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; + +// Query defines the gRPC querier service. +service Query { + // ResourceNode queries ResourceNode info for given ResourceNode address. + rpc ResourceNode(QueryResourceNodeRequest) returns (QueryResourceNodeResponse) { + option (google.api.http).get = "/stratos/register/v1/resource-nodes/{network_addr}"; + } + + // IndexingNode queries IndexingNode info for given IndexingNode address. + rpc IndexingNode(QueryIndexingNodeRequest) returns (QueryIndexingNodeResponse) { + option (google.api.http).get = "/stratos/register/v1/indexing-nodes/{network_addr}"; + } + + // Params queries Register module Params info. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/stratos/register/v1/params"; + } + + // StakeByNode queries all staking info for given node network address. + rpc StakeByNode(QueryStakeByNodeRequest) returns (QueryStakeByNodeResponse) { + option (google.api.http).get = "/stratos/register/v1/stakes_node/{acc_addr}/{query_type}"; + } + + // StakeByOwner queries all staking info for given owner address. + rpc StakeByOwner(QueryStakeByOwnerRequest) returns (QueryStakeByOwnerResponse) { + option (google.api.http).get = "/stratos/register/v1/stakes_owner/{owner_addr}"; + } + + // StakeTotal queries all staking info. + rpc StakeTotal(QueryTotalStakeRequest) returns (QueryTotalStakeResponse) { + option (google.api.http).get = "/stratos/register/v1/total_stakes"; + } +} + +// QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method +message QueryResourceNodeRequest { + // network_addr defines the node network address to query for. + string network_addr = 1; +} + +// QueryResourceNodeResponse is response type for the Query/ResourceNode RPC method +message QueryResourceNodeResponse { + // node defines the the resourceNode info. + ResourceNode node = 1; +} + +// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method +message QueryIndexingNodeRequest { + // network_addr defines the node network address to query for. + string network_addr = 1; +} + +// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method +message QueryIndexingNodeResponse { + // node defines the the indexing info. + IndexingNode node = 1; +} + +// QueryStakeByNodeRequest is request type for the Query/StakeByNode RPC method +message QueryStakeByNodeRequest { + // acc_addr defines the node network address to query for. + string acc_addr = 1; + int64 query_type = 2; + // pagination defines an optional pagination for the request. +// cosmos.base.query.v1beta1.PageRequest pagination = 3; +} + +// QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method +message QueryStakeByNodeResponse { + // staking_info defines the the staking_info info of the node. + StakingInfo staking_info = 1; + // pagination defines an optional pagination for the request. +// cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method +message QueryStakeByOwnerRequest { + // owner_addr defines the owner address to query for. + string network_addr = 1; + string moniker = 2; + string owner_addr = 3; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 4; +} + +// QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method +message QueryStakeByOwnerResponse { + // staking_infos defines the the node staking info of this owner. + repeated StakingInfo staking_infos = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryTotalStakeRequest is request type for the Query/TotalStake RPC method +message QueryTotalStakeRequest {} + +// QueryTotalStakeResponse is response type for the Query/TotalStake RPC method +message QueryTotalStakeResponse { + // total_stakes defines the total staking info. + TotalStakesResponse total_stakes= 1; +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1; +} + + + + diff --git a/proto/stratos/sds/v1/tx.proto b/proto/stratos/sds/v1/tx.proto new file mode 100644 index 00000000..6589273d --- /dev/null +++ b/proto/stratos/sds/v1/tx.proto @@ -0,0 +1,277 @@ +syntax = "proto3"; +package stratos.sds.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; + +import "cosmos_proto/cosmos.proto"; +import "stratos/register/v1/register.proto"; +import "cosmos/base/v1beta1/coin.proto"; + + +option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; + +// Msg defines the evm Msg service. +service Msg { + // CreateResourceNode defines a method for creating a new resource node. + rpc HandleMsgCreateResourceNode(MsgCreateResourceNode) returns (MsgCreateResourceNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/create_resource_node"; + }; + rpc HandleMsgRemoveResourceNode(MsgRemoveResourceNode) returns (MsgRemoveResourceNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/remove_resource_node"; + }; + rpc HandleMsgUpdateResourceNode(MsgUpdateResourceNode) returns (MsgUpdateResourceNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_resource_node"; + }; + rpc HandleMsgUpdateResourceNodeStake(MsgUpdateResourceNodeStake) returns (MsgUpdateResourceNodeStakeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_resource_node_stake"; + }; + + rpc HandleMsgCreateIndexingNode(MsgCreateIndexingNode) returns (MsgCreateIndexingNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/create_indexing_node"; + }; + rpc HandleMsgRemoveIndexingNode(MsgRemoveIndexingNode) returns (MsgRemoveIndexingNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/remove_indexing_node"; + }; + rpc HandleMsgUpdateIndexingNode(MsgUpdateIndexingNode) returns (MsgUpdateIndexingNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_indexing_node"; + }; + rpc HandleMsgUpdateIndexingNodeStake(MsgUpdateIndexingNodeStake) returns (MsgUpdateIndexingNodeStakeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_indexing_node_stake"; + }; + rpc HandleMsgIndexingNodeRegistrationVote(MsgIndexingNodeRegistrationVote) returns (MsgIndexingNodeRegistrationVoteResponse) { + option (google.api.http).post = "/stratos/register/v1/indexing_node_registration_vote"; + }; + +} + +// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +message MsgCreateResourceNode { + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; + cosmos.base.v1beta1.Coin value = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "value", + (gogoproto.moretags) = "yaml:\"value\"" + ]; + string ownerAddress = 4 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + Description description = 5 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + string nodeType = 6 [ + (gogoproto.jsontag) = "node_type", + (gogoproto.moretags) = "yaml:\"node_type\"" + ]; +} + +// MsgCreateResourceNodeTxResponse defines the CreateResourceNodeTx response type +message MsgCreateResourceNodeResponse {} + +// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +message MsgCreateIndexingNode { + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + google.protobuf.Any pubKey = 2 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", + (gogoproto.moretags) = "yaml:\"pubkey\"" + ]; + cosmos.base.v1beta1.Coin value = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "value", + (gogoproto.moretags) = "yaml:\"value\"" + ]; + string ownerAddress = 4 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + Description description = 5 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; +} + +// MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message +message MsgRemoveResourceNode { + option (gogoproto.goproto_getters) = false; + + string resource_node_address = 1 [ + (gogoproto.jsontag) = "resource_node_address", + (gogoproto.moretags) = "yaml:\"resource_node_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; +} + +// MsgRemoveResourceNodeResponse defines the Msg/RemoveResourceNode response type. +message MsgRemoveResourceNodeResponse {} + +// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type +message MsgCreateIndexingNodeResponse {} + + +// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message +message MsgRemoveIndexingNode { + option (gogoproto.goproto_getters) = false; + + string indexing_node_address = 1 [ + (gogoproto.jsontag) = "indexing_node_address", + (gogoproto.moretags) = "yaml:\"indexing_node_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; +} + +// MsgRemoveIndexingNodeResponse defines the Msg/RemoveIndexingNode response type. +message MsgRemoveIndexingNodeResponse {} + + +// MsgUpdateResourceNode defines a SDK message for updating an existing resource node. +message MsgUpdateResourceNode { + option (gogoproto.goproto_getters) = false; + + Description description = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + string network_address = 2 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 3 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + string nodeType = 4 [ + (gogoproto.jsontag) = "node_type", + (gogoproto.moretags) = "yaml:\"node_type\"" + ]; +} + +// MsgUpdateResourceNodeResponse defines the Msg/UpdateResourceNode response type. +message MsgUpdateResourceNodeResponse {} + + +// MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. +message MsgUpdateIndexingNode { + option (gogoproto.goproto_getters) = false; + + Description description = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\"" + ]; + string network_address = 2 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 3 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; +} + +// MsgUpdateIndexingNodeResponse defines the Msg/UpdateIndexingNode response type. +message MsgUpdateIndexingNodeResponse {} + + +// MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. +message MsgUpdateResourceNodeStake { + option (gogoproto.goproto_getters) = false; + + string network_address = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + bool incrStake = 3 [ + (gogoproto.jsontag) = "incr_stake", + (gogoproto.moretags) = "yaml:\"incr_stake\"" + ]; + cosmos.base.v1beta1.Coin StakeDelta = 4 [ + (gogoproto.jsontag) = "stake_delta", + (gogoproto.moretags) = "yaml:\"stake_delta\"" + ]; +} + +// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. +message MsgUpdateResourceNodeStakeResponse {} + + +// MsgUpdateIndexingNodeStake defines a SDK message for updating the stake of an existing indexing node. +message MsgUpdateIndexingNodeStake { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string network_address = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string owner_address = 2 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; + bool incrStake = 3 [ + (gogoproto.jsontag) = "incr_stake", + (gogoproto.moretags) = "yaml:\"incr_stake\"" + ]; + cosmos.base.v1beta1.Coin StakeDelta = 4 [ + (gogoproto.jsontag) = "stake_delta", + (gogoproto.moretags) = "yaml:\"stake_delta\"" + ]; +} + +// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. +message MsgUpdateIndexingNodeStakeResponse {} + +// MsgIndexingNodeRegistrationVote defines a SDK message for registration vote of an existing indexing node. +message MsgIndexingNodeRegistrationVote { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string candidate_network_address = 1 [ + (gogoproto.jsontag) = "candidate_network_address", + (gogoproto.moretags) = "yaml:\"candidate_network_address\"" + ]; // node address of indexing node + string candidate_owner_address = 2 [ + (gogoproto.jsontag) = "candidate_owner_address", + (gogoproto.moretags) = "yaml:\"candidate_owner_address\"" + ]; // owner address of indexing node + bool opinion = 3 [ + (gogoproto.jsontag) = "opinion", + (gogoproto.moretags) = "yaml:\"opinion\"" + ]; + string voter_network_address = 4 [ + (gogoproto.jsontag) = "voter_network_address", + (gogoproto.moretags) = "yaml:\"voter_network_address\"" + ]; // address of voter (other existed indexing node) + string voter_owner_address = 5 [ + (gogoproto.jsontag) = "voter_owner_address", + (gogoproto.moretags) = "yaml:\"voter_owner_address\"" + ]; // address of owner of the voter (other existed indexing node) +} + +// MsgUpdateResourceNodeStakeResponse defines the Msg/IndexingNodeRegistrationVote response type. +message MsgIndexingNodeRegistrationVoteResponse {} diff --git a/x/sds/types/genesis.pb.go b/x/sds/types/genesis.pb.go new file mode 100644 index 00000000..d7d4b17b --- /dev/null +++ b/x/sds/types/genesis.pb.go @@ -0,0 +1,394 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/sds/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the register module's genesis state. +type GenesisState struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` + FileUploads []*FileUpload `protobuf:"bytes,2,rep,name=fileUploads,proto3" json:"file_uploads" yaml:"file_uploads"` +} + +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_a3396301dd7676d6, []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 nil +} + +func (m *GenesisState) GetFileUploads() []*FileUpload { + if m != nil { + return m.FileUploads + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "stratos.sds.v1.GenesisState") +} + +func init() { proto.RegisterFile("stratos/sds/v1/genesis.proto", fileDescriptor_a3396301dd7676d6) } + +var fileDescriptor_a3396301dd7676d6 = []byte{ + // 268 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x2e, 0x29, 0x4a, + 0x2c, 0xc9, 0x2f, 0xd6, 0x2f, 0x4e, 0x29, 0xd6, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, + 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xea, 0x15, 0xa7, 0x14, + 0xeb, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xa5, 0xf4, 0x41, 0x2c, 0x88, 0x2a, + 0x29, 0x09, 0x34, 0x33, 0x40, 0x8a, 0xc1, 0x32, 0x4a, 0x87, 0x18, 0xb9, 0x78, 0xdc, 0x21, 0x26, + 0x06, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x79, 0x73, 0xb1, 0x15, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x4b, + 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0xe9, 0xa1, 0xda, 0xa0, 0x17, 0x00, 0x96, 0x75, 0x92, + 0x7e, 0x75, 0x4f, 0x1e, 0xaa, 0xf2, 0xd3, 0x3d, 0x79, 0xde, 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, + 0x08, 0x5f, 0x29, 0x08, 0x2a, 0x21, 0x94, 0xca, 0xc5, 0x9d, 0x96, 0x99, 0x93, 0x1a, 0x5a, 0x90, + 0x93, 0x9f, 0x98, 0x52, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0x24, 0x85, 0x6e, 0xa2, 0x1b, + 0x5c, 0x89, 0x93, 0xfa, 0xab, 0x7b, 0xf2, 0x3c, 0x20, 0x2d, 0xf1, 0xa5, 0x10, 0x3d, 0x9f, 0xee, + 0xc9, 0x0b, 0x43, 0xcc, 0x46, 0x16, 0x55, 0x0a, 0x42, 0x36, 0xd7, 0xc9, 0xf3, 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, 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0xa1, 0xb6, 0xe6, 0xa5, 0x96, 0xc0, 0x98, 0xba, 0xc9, 0x19, 0x89, 0x99, 0x79, + 0xfa, 0x15, 0xe0, 0x60, 0x29, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x07, 0x8b, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0x19, 0x35, 0x48, 0xef, 0x76, 0x01, 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.FileUploads) > 0 { + for iNdEx := len(m.FileUploads) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FileUploads[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Params != nil { + { + 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 + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.FileUploads) > 0 { + for _, e := range m.FileUploads { + 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 m.Params == nil { + m.Params = &Params{} + } + 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 FileUploads", 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.FileUploads = append(m.FileUploads, &FileUpload{}) + if err := m.FileUploads[len(m.FileUploads)-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/sds/types/sds.pb.go b/x/sds/types/sds.pb.go new file mode 100644 index 00000000..ee64fbc1 --- /dev/null +++ b/x/sds/types/sds.pb.go @@ -0,0 +1,1401 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/sds/v1/sds.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the Register module parameters +type Params struct { + BondDenom string `protobuf:"bytes,1,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom" yaml:"bond_denom"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_a89f3959b8649eb2, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetBondDenom() string { + if m != nil { + return m.BondDenom + } + return "" +} + +type FileUpload struct { + FileHash string `protobuf:"bytes,1,opt,name=fileHash,proto3" json:"file_hash" yaml:"file_hash"` + FileInfo *FileInfo `protobuf:"bytes,2,opt,name=fileInfo,proto3" json:"file_info" yaml:"file_info"` +} + +func (m *FileUpload) Reset() { *m = FileUpload{} } +func (m *FileUpload) String() string { return proto.CompactTextString(m) } +func (*FileUpload) ProtoMessage() {} +func (*FileUpload) Descriptor() ([]byte, []int) { + return fileDescriptor_a89f3959b8649eb2, []int{1} +} +func (m *FileUpload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FileUpload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FileUpload.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 *FileUpload) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileUpload.Merge(m, src) +} +func (m *FileUpload) XXX_Size() int { + return m.Size() +} +func (m *FileUpload) XXX_DiscardUnknown() { + xxx_messageInfo_FileUpload.DiscardUnknown(m) +} + +var xxx_messageInfo_FileUpload proto.InternalMessageInfo + +func (m *FileUpload) GetFileHash() string { + if m != nil { + return m.FileHash + } + return "" +} + +func (m *FileUpload) GetFileInfo() *FileInfo { + if m != nil { + return m.FileInfo + } + return nil +} + +type FileInfo struct { + Height *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=height,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"height,omitempty"` + Reporter string `protobuf:"bytes,2,opt,name=reporter,proto3" json:"reporter,omitempty"` + Uploader string `protobuf:"bytes,3,opt,name=uploader,proto3" json:"uploader,omitempty"` +} + +func (m *FileInfo) Reset() { *m = FileInfo{} } +func (m *FileInfo) String() string { return proto.CompactTextString(m) } +func (*FileInfo) ProtoMessage() {} +func (*FileInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_a89f3959b8649eb2, []int{2} +} +func (m *FileInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FileInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FileInfo.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 *FileInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileInfo.Merge(m, src) +} +func (m *FileInfo) XXX_Size() int { + return m.Size() +} +func (m *FileInfo) XXX_DiscardUnknown() { + xxx_messageInfo_FileInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_FileInfo proto.InternalMessageInfo + +func (m *FileInfo) GetReporter() string { + if m != nil { + return m.Reporter + } + return "" +} + +func (m *FileInfo) GetUploader() string { + if m != nil { + return m.Uploader + } + return "" +} + +type MsgFileUpload struct { + FileHash string `protobuf:"bytes,1,opt,name=fileHash,proto3" json:"file_hash" yaml:"file_hash"` + From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from" yaml:"from"` + Reporter string `protobuf:"bytes,3,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` + Uploader string `protobuf:"bytes,4,opt,name=uploader,proto3" json:"uploader" yaml:"uploader"` +} + +func (m *MsgFileUpload) Reset() { *m = MsgFileUpload{} } +func (m *MsgFileUpload) String() string { return proto.CompactTextString(m) } +func (*MsgFileUpload) ProtoMessage() {} +func (*MsgFileUpload) Descriptor() ([]byte, []int) { + return fileDescriptor_a89f3959b8649eb2, []int{3} +} +func (m *MsgFileUpload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFileUpload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFileUpload.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 *MsgFileUpload) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFileUpload.Merge(m, src) +} +func (m *MsgFileUpload) XXX_Size() int { + return m.Size() +} +func (m *MsgFileUpload) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFileUpload.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFileUpload proto.InternalMessageInfo + +func (m *MsgFileUpload) GetFileHash() string { + if m != nil { + return m.FileHash + } + return "" +} + +func (m *MsgFileUpload) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgFileUpload) GetReporter() string { + if m != nil { + return m.Reporter + } + return "" +} + +func (m *MsgFileUpload) GetUploader() string { + if m != nil { + return m.Uploader + } + return "" +} + +type MsgPrepay struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender" yaml:"sender"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" yaml:"coins"` +} + +func (m *MsgPrepay) Reset() { *m = MsgPrepay{} } +func (m *MsgPrepay) String() string { return proto.CompactTextString(m) } +func (*MsgPrepay) ProtoMessage() {} +func (*MsgPrepay) Descriptor() ([]byte, []int) { + return fileDescriptor_a89f3959b8649eb2, []int{4} +} +func (m *MsgPrepay) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPrepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPrepay.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 *MsgPrepay) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPrepay.Merge(m, src) +} +func (m *MsgPrepay) XXX_Size() int { + return m.Size() +} +func (m *MsgPrepay) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPrepay.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPrepay proto.InternalMessageInfo + +func (m *MsgPrepay) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgPrepay) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Coins + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "stratos.sds.v1.Params") + proto.RegisterType((*FileUpload)(nil), "stratos.sds.v1.FileUpload") + proto.RegisterType((*FileInfo)(nil), "stratos.sds.v1.FileInfo") + proto.RegisterType((*MsgFileUpload)(nil), "stratos.sds.v1.MsgFileUpload") + proto.RegisterType((*MsgPrepay)(nil), "stratos.sds.v1.MsgPrepay") +} + +func init() { proto.RegisterFile("stratos/sds/v1/sds.proto", fileDescriptor_a89f3959b8649eb2) } + +var fileDescriptor_a89f3959b8649eb2 = []byte{ + // 544 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x4f, 0x8b, 0xd3, 0x40, + 0x1c, 0x6d, 0x76, 0xd7, 0xd2, 0x4e, 0x5d, 0xff, 0x04, 0xc1, 0x58, 0x21, 0x53, 0x23, 0x48, 0x51, + 0x36, 0xa1, 0xbb, 0x37, 0x17, 0x2f, 0x51, 0x16, 0x0b, 0x2e, 0x2c, 0x01, 0x11, 0xbc, 0x2c, 0xd3, + 0x76, 0x9a, 0x04, 0x9b, 0x4c, 0x99, 0x99, 0x2d, 0xd6, 0x0f, 0xe0, 0xd9, 0x0f, 0xe1, 0xc9, 0xcf, + 0xe0, 0x07, 0xd8, 0xe3, 0x1e, 0xc5, 0xc3, 0x28, 0xed, 0x2d, 0xc7, 0x80, 0x77, 0x99, 0x3f, 0x4d, + 0xa3, 0x27, 0x0f, 0x9e, 0x66, 0x7e, 0xef, 0xcd, 0x7b, 0xfc, 0xde, 0xcc, 0x6f, 0x80, 0xc3, 0x38, + 0x45, 0x9c, 0xb0, 0x80, 0x4d, 0x58, 0xb0, 0x18, 0xc8, 0xc5, 0x9f, 0x53, 0xc2, 0x89, 0x7d, 0xc3, + 0x30, 0xbe, 0x84, 0x16, 0x83, 0xee, 0x9d, 0x98, 0xc4, 0x44, 0x51, 0x81, 0xdc, 0xe9, 0x53, 0x5d, + 0x77, 0x4c, 0x58, 0x46, 0x58, 0x30, 0x42, 0x0c, 0x07, 0x8b, 0xc1, 0x08, 0x73, 0x34, 0x08, 0xc6, + 0x24, 0xcd, 0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, 0xcc, 0xa8, 0xe6, + 0x98, 0x6f, 0xb6, 0x07, 0xe3, 0x04, 0xa5, 0x79, 0xf0, 0x5e, 0x7d, 0x66, 0xe5, 0x3b, 0x6a, 0xaa, + 0x6f, 0x78, 0xf4, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x49, 0xe4, 0xaa, 0x02, 0xe8, 0x03, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BondDenom) > 0 { + i -= len(m.BondDenom) + copy(dAtA[i:], m.BondDenom) + i = encodeVarintSds(dAtA, i, uint64(len(m.BondDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FileUpload) 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 *FileUpload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FileUpload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.FileInfo != nil { + { + size, err := m.FileInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSds(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.FileHash) > 0 { + i -= len(m.FileHash) + copy(dAtA[i:], m.FileHash) + i = encodeVarintSds(dAtA, i, uint64(len(m.FileHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FileInfo) 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 *FileInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FileInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Uploader) > 0 { + i -= len(m.Uploader) + copy(dAtA[i:], m.Uploader) + i = encodeVarintSds(dAtA, i, uint64(len(m.Uploader))) + i-- + dAtA[i] = 0x1a + } + if len(m.Reporter) > 0 { + i -= len(m.Reporter) + copy(dAtA[i:], m.Reporter) + i = encodeVarintSds(dAtA, i, uint64(len(m.Reporter))) + i-- + dAtA[i] = 0x12 + } + if m.Height != nil { + { + size := m.Height.Size() + i -= size + if _, err := m.Height.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintSds(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgFileUpload) 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 *MsgFileUpload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFileUpload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Uploader) > 0 { + i -= len(m.Uploader) + copy(dAtA[i:], m.Uploader) + i = encodeVarintSds(dAtA, i, uint64(len(m.Uploader))) + i-- + dAtA[i] = 0x22 + } + if len(m.Reporter) > 0 { + i -= len(m.Reporter) + copy(dAtA[i:], m.Reporter) + i = encodeVarintSds(dAtA, i, uint64(len(m.Reporter))) + i-- + dAtA[i] = 0x1a + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintSds(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0x12 + } + if len(m.FileHash) > 0 { + i -= len(m.FileHash) + copy(dAtA[i:], m.FileHash) + i = encodeVarintSds(dAtA, i, uint64(len(m.FileHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPrepay) 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 *MsgPrepay) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPrepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Coins) > 0 { + for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSds(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintSds(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSds(dAtA []byte, offset int, v uint64) int { + offset -= sovSds(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + return n +} + +func (m *FileUpload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FileHash) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + if m.FileInfo != nil { + l = m.FileInfo.Size() + n += 1 + l + sovSds(uint64(l)) + } + return n +} + +func (m *FileInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != nil { + l = m.Height.Size() + n += 1 + l + sovSds(uint64(l)) + } + l = len(m.Reporter) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + l = len(m.Uploader) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + return n +} + +func (m *MsgFileUpload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FileHash) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + l = len(m.From) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + l = len(m.Reporter) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + l = len(m.Uploader) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + return n +} + +func (m *MsgPrepay) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovSds(uint64(l)) + } + if len(m.Coins) > 0 { + for _, e := range m.Coins { + l = e.Size() + n += 1 + l + sovSds(uint64(l)) + } + } + return n +} + +func sovSds(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSds(x uint64) (n int) { + return sovSds(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSds(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FileUpload) 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 ErrIntOverflowSds + } + 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: FileUpload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FileUpload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSds + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FileInfo == nil { + m.FileInfo = &FileInfo{} + } + if err := m.FileInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSds(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FileInfo) 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 ErrIntOverflowSds + } + 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: FileInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FileInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.Height = &v + if err := m.Height.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reporter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uploader", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uploader = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSds(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgFileUpload) 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 ErrIntOverflowSds + } + 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: MsgFileUpload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFileUpload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reporter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uploader", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uploader = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSds(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPrepay) 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 ErrIntOverflowSds + } + 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: MsgPrepay: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPrepay: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + 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 ErrInvalidLengthSds + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSds + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSds + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSds + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Coins = append(m.Coins, types.Coin{}) + if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSds(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSds + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSds(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, ErrIntOverflowSds + } + 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, ErrIntOverflowSds + } + 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, ErrIntOverflowSds + } + 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, ErrInvalidLengthSds + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSds + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSds + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSds = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSds = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSds = fmt.Errorf("proto: unexpected end of group") +) From 7f6c2a67cc2cb3b90f5422d45fb5e557839c53e4 Mon Sep 17 00:00:00 2001 From: Xiong Date: Thu, 12 May 2022 15:40:17 -0400 Subject: [PATCH 043/113] issues fix --- app/ante/eth.go | 33 +- app/ante/handler_options.go | 12 +- app/ante/interfaces.go | 4 +- go.mod | 11 +- go.sum | 9 +- proto/stratos/evm/v1/query.proto | 10 +- rpc/apis.go | 42 +- rpc/backend/backend.go | 117 ++++ .../backend.go => backend/evm_backend.go} | 540 +++++++++--------- rpc/{ethereum => }/backend/utils.go | 154 ++++- rpc/ethereum/backend/feebackend.go | 221 ------- .../ethereum}/debug/api.go | 10 +- .../ethereum}/debug/trace.go | 0 .../ethereum}/debug/trace_fallback.go | 0 .../ethereum}/debug/utils.go | 0 .../ethereum}/eth/api.go | 12 +- .../ethereum}/eth/filters/api.go | 47 +- .../ethereum}/eth/filters/filter_system.go | 4 +- .../ethereum}/eth/filters/filters.go | 4 +- .../ethereum}/eth/filters/subscription.go | 6 +- .../ethereum}/eth/filters/utils.go | 0 .../ethereum}/miner/api.go | 16 +- .../ethereum}/miner/unsupported.go | 4 +- .../ethereum}/net/api.go | 0 .../ethereum}/personal/api.go | 10 +- .../ethereum}/txpool/api.go | 2 +- .../ethereum}/web3/api.go | 4 +- rpc/{ethereum => }/types/addrlock.go | 0 rpc/{ethereum => }/types/block.go | 4 +- rpc/{ethereum => }/types/query_client.go | 3 - rpc/{ethereum => }/types/types.go | 0 rpc/{ethereum => }/types/utils.go | 5 +- rpc/websockets.go | 15 +- server/start.go | 17 +- x/evm/client/cli/feemarket_query.go | 2 +- x/evm/client/cli/query.go | 2 +- x/evm/client/cli/tx.go | 8 +- x/evm/client/rest/rest.go | 7 +- x/evm/keeper/abci.go | 2 +- x/evm/keeper/eip1559.go | 13 +- x/evm/keeper/grpc_query.go | 21 +- x/evm/keeper/keeper.go | 4 +- x/evm/keeper/params.go | 8 +- x/evm/keeper/state_transition.go | 4 +- x/evm/keeper/statedb.go | 1 - x/evm/keeper/utils.go | 2 +- x/evm/simulation/decoder.go | 12 +- x/evm/simulation/genesis.go | 39 +- x/evm/simulation/operations.go | 17 +- x/evm/simulation/params.go | 25 +- x/evm/types/genesis.go | 4 +- x/evm/types/params.go | 6 +- x/evm/types/query.pb.go | 249 ++++---- x/evm/types/query.pb.gw.go | 86 ++- 54 files changed, 1011 insertions(+), 817 deletions(-) create mode 100644 rpc/backend/backend.go rename rpc/{ethereum/backend/backend.go => backend/evm_backend.go} (57%) rename rpc/{ethereum => }/backend/utils.go (63%) delete mode 100644 rpc/ethereum/backend/feebackend.go rename rpc/{ethereum/namespaces => namespaces/ethereum}/debug/api.go (98%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/debug/trace.go (100%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/debug/trace_fallback.go (100%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/debug/utils.go (100%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/eth/api.go (99%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/eth/filters/api.go (95%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/eth/filters/filter_system.go (100%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/eth/filters/filters.go (99%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/eth/filters/subscription.go (96%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/eth/filters/utils.go (100%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/miner/api.go (96%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/miner/unsupported.go (97%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/net/api.go (100%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/personal/api.go (98%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/txpool/api.go (96%) rename rpc/{ethereum/namespaces => namespaces/ethereum}/web3/api.go (84%) rename rpc/{ethereum => }/types/addrlock.go (100%) rename rpc/{ethereum => }/types/block.go (100%) rename rpc/{ethereum => }/types/query_client.go (91%) rename rpc/{ethereum => }/types/types.go (100%) rename rpc/{ethereum => }/types/utils.go (99%) diff --git a/app/ante/eth.go b/app/ante/eth.go index a13375dc..16e0510b 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -68,17 +68,15 @@ func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, s // EthAccountVerificationDecorator validates an account balance checks type EthAccountVerificationDecorator struct { - ak evmtypes.AccountKeeper - bankKeeper evmtypes.BankKeeper - evmKeeper EVMKeeper + ak evmtypes.AccountKeeper + evmKeeper EVMKeeper } // NewEthAccountVerificationDecorator creates a new EthAccountVerificationDecorator -func NewEthAccountVerificationDecorator(ak evmtypes.AccountKeeper, bankKeeper evmtypes.BankKeeper, ek EVMKeeper) EthAccountVerificationDecorator { +func NewEthAccountVerificationDecorator(ak evmtypes.AccountKeeper, ek EVMKeeper) EthAccountVerificationDecorator { return EthAccountVerificationDecorator{ - ak: ak, - bankKeeper: bankKeeper, - evmKeeper: ek, + ak: ak, + evmKeeper: ek, } } @@ -263,7 +261,7 @@ func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) } - baseFee := ctd.evmKeeper.BaseFee(ctx, ethCfg) + baseFee := ctd.evmKeeper.GetBaseFee(ctx, ethCfg) coreMsg, err := msgEthTx.AsMessage(signer, baseFee) if err != nil { @@ -412,11 +410,17 @@ func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu txFee := sdk.Coins{} txGasLimit := uint64(0) + params := vbd.evmKeeper.GetParams(ctx) + chainID := vbd.evmKeeper.ChainID() + ethCfg := params.ChainConfig.EthereumConfig(chainID) + baseFee := vbd.evmKeeper.GetBaseFee(ctx, ethCfg) + for _, msg := range protoTx.GetMsgs() { msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) if !ok { return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) } + txGasLimit += msgEthTx.GetGas() txData, err := evmtypes.UnpackTxData(msgEthTx.Data) @@ -424,10 +428,13 @@ func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu return ctx, sdkerrors.Wrap(err, "failed to unpack MsgEthereumTx Data") } - params := vbd.evmKeeper.GetParams(ctx) - chainID := vbd.evmKeeper.ChainID() - ethCfg := params.ChainConfig.EthereumConfig(chainID) - baseFee := vbd.evmKeeper.BaseFee(ctx, ethCfg) + // return error if contract creation or call are disabled through governance + if !params.EnableCreate && txData.GetTo() == nil { + return ctx, sdkerrors.Wrap(evmtypes.ErrCreateDisabled, "failed to create new contract") + } else if !params.EnableCall && txData.GetTo() != nil { + return ctx, sdkerrors.Wrap(evmtypes.ErrCallDisabled, "failed to call contract") + } + if baseFee == nil && txData.TxType() == ethtypes.DynamicFeeTxType { return ctx, sdkerrors.Wrap(ethtypes.ErrTxTypeNotSupported, "dynamic fee tx not supported") } @@ -511,7 +518,7 @@ func (mfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat if ctx.IsCheckTx() && !simulate { params := mfd.evmKeeper.GetParams(ctx) ethCfg := params.ChainConfig.EthereumConfig(mfd.evmKeeper.ChainID()) - baseFee := mfd.evmKeeper.BaseFee(ctx, ethCfg) + baseFee := mfd.evmKeeper.GetBaseFee(ctx, ethCfg) if baseFee == nil { for _, msg := range tx.GetMsgs() { ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go index 443a7cc8..b6411e22 100644 --- a/app/ante/handler_options.go +++ b/app/ante/handler_options.go @@ -17,10 +17,9 @@ import ( // HandlerOptions extend the SDK's AnteHandler options by requiring the IBC // channel keeper, EVM Keeper and Fee Market Keeper. type HandlerOptions struct { - AccountKeeper evmtypes.AccountKeeper - BankKeeper evmtypes.BankKeeper - IBCKeeper *ibckeeper.Keeper - //FeeMarketKeeper evmtypes.FeeMarketKeeper + AccountKeeper evmtypes.AccountKeeper + BankKeeper evmtypes.BankKeeper + IBCKeeper *ibckeeper.Keeper EvmKeeper EVMKeeper FeegrantKeeper ante.FeegrantKeeper SignModeHandler authsigning.SignModeHandler @@ -38,9 +37,6 @@ func (options HandlerOptions) Validate() error { if options.SignModeHandler == nil { return sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") } - //if options.FeeMarketKeeper == nil { - // return sdkerrors.Wrap(sdkerrors.ErrLogic, "fee market keeper is required for AnteHandler") - //} if options.EvmKeeper == nil { return sdkerrors.Wrap(sdkerrors.ErrLogic, "evm keeper is required for AnteHandler") } @@ -53,7 +49,7 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler { NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices NewEthValidateBasicDecorator(options.EvmKeeper), NewEthSigVerificationDecorator(options.EvmKeeper), - NewEthAccountVerificationDecorator(options.AccountKeeper, options.BankKeeper, options.EvmKeeper), + NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper), NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted), NewCanTransferDecorator(options.EvmKeeper), NewEthIncrementSenderSequenceDecorator(options.AccountKeeper), // innermost AnteDecorator. diff --git a/app/ante/interfaces.go b/app/ante/interfaces.go index 0c00f3b6..f3a5a777 100644 --- a/app/ante/interfaces.go +++ b/app/ante/interfaces.go @@ -5,10 +5,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/params" + "github.com/stratosnet/stratos-chain/x/evm/statedb" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) @@ -23,7 +25,7 @@ type EVMKeeper interface { DeductTxCostsFromUserBalance( ctx sdk.Context, msgEthTx evmtypes.MsgEthereumTx, txData evmtypes.TxData, denom string, homestead, istanbul, london bool, ) (sdk.Coins, error) - BaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int + GetBaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int GetBalance(ctx sdk.Context, addr common.Address) *big.Int ResetTransientGasUsed(ctx sdk.Context) } diff --git a/go.mod b/go.mod index 3b71e34d..b695d65e 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,10 @@ module github.com/stratosnet/stratos-chain go 1.17 require ( - github.com/btcsuite/btcd v0.22.0-beta + github.com/btcsuite/btcd v0.22.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce - github.com/cosmos/cosmos-sdk v0.45.3 + github.com/cosmos/cosmos-sdk v0.45.4 + github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-go/v3 v3.0.0 github.com/davecgh/go-spew v1.1.1 github.com/ethereum/go-ethereum v1.10.16 @@ -14,9 +15,11 @@ require ( github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/improbable-eng/grpc-web v0.15.0 github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 github.com/regen-network/cosmos-proto v0.3.1 + github.com/rs/cors v1.8.2 github.com/spf13/cast v1.4.1 github.com/spf13/cobra v1.4.0 github.com/spf13/viper v1.11.0 @@ -41,13 +44,13 @@ require ( github.com/armon/go-metrics v0.3.10 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.1.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect github.com/confio/ics23/go v0.7.0 // indirect github.com/cosmos/btcutil v1.0.4 // indirect - github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/iavl v0.17.3 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect @@ -88,7 +91,6 @@ require ( github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.0 // indirect github.com/huin/goupnp v1.0.2 // indirect - github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmhodges/levigo v1.0.0 // indirect @@ -117,7 +119,6 @@ require ( github.com/prometheus/tsdb v0.7.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect github.com/rjeczalik/notify v0.9.1 // indirect - github.com/rs/cors v1.8.2 // indirect github.com/rs/zerolog v1.23.0 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect diff --git a/go.sum b/go.sum index 795169e4..1249dd1c 100644 --- a/go.sum +++ b/go.sum @@ -177,8 +177,11 @@ github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BR github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= -github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= +github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= +github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= @@ -252,8 +255,8 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-sdk v0.45.1/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= -github.com/cosmos/cosmos-sdk v0.45.3 h1:PiVSU3IkNEDPhoxOZHk2lPnhwBBJgEYAtAR0jGXRN4g= -github.com/cosmos/cosmos-sdk v0.45.3/go.mod h1:qYm5JEr0ZlbnmoP/Q3b+dYMOliHf4ddHirpILiwZzqg= +github.com/cosmos/cosmos-sdk v0.45.4 h1:eStDAhJdMY8n5arbBRe+OwpNeBSunxSBHp1g55ulfdA= +github.com/cosmos/cosmos-sdk v0.45.4/go.mod h1:WOqtDxN3eCCmnYLVla10xG7lEXkFjpTaqm2a2WasgCc= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= diff --git a/proto/stratos/evm/v1/query.proto b/proto/stratos/evm/v1/query.proto index 51c49f63..181a5dc0 100644 --- a/proto/stratos/evm/v1/query.proto +++ b/proto/stratos/evm/v1/query.proto @@ -72,11 +72,17 @@ service Query { option (google.api.http).get = "/stratos/evm/v1/trace_block"; } - // BaseFee queries the base fee of the parent block of the current block. - rpc QueryBaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) { + // BaseFee queries the base fee of the parent block of the current block, + // it's similar to feemarket module's method, but also checks london hardfork status. + rpc BaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) { option (google.api.http).get = "/stratos/evm/v1/base_fee"; } + // BaseFeeParam queries the base fee of the parent block of the current block. + rpc BaseFeeParam(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) { + option (google.api.http).get = "/stratos/evm/v1/base_fee_param"; + } + // BlockGas queries the gas used at a given block height rpc BlockGas(QueryBlockGasRequest) returns (QueryBlockGasResponse) { option (google.api.http).get = "/stratos/evm/v1/block_gas"; diff --git a/rpc/apis.go b/rpc/apis.go index 05e7bc2a..432b0128 100644 --- a/rpc/apis.go +++ b/rpc/apis.go @@ -5,27 +5,33 @@ package rpc import ( "fmt" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/ethereum/go-ethereum/rpc" - "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/debug" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/eth" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/eth/filters" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/miner" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/net" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/personal" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/txpool" - "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/web3" - "github.com/stratosnet/stratos-chain/rpc/ethereum/types" - - rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + "github.com/stratosnet/stratos-chain/rpc/backend" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/debug" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/eth" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/eth/filters" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/miner" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/net" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/personal" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/txpool" + "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/web3" + "github.com/stratosnet/stratos-chain/rpc/types" ) // RPC namespaces and API version const ( + // Cosmos namespaces + + CosmosNamespace = "cosmos" + + // Ethereum namespaces + Web3Namespace = "web3" EthNamespace = "eth" PersonalNamespace = "personal" @@ -37,17 +43,17 @@ const ( apiVersion = "1.0" ) -// APICreator creates the json-rpc api implementations. +// APICreator creates the JSON-RPC API implementations. type APICreator = func(*server.Context, client.Context, *rpcclient.WSClient) []rpc.API -// apiCreators defines the json-rpc api namespaces. +// apiCreators defines the JSON-RPC API namespaces. var apiCreators map[string]APICreator func init() { apiCreators = map[string]APICreator{ EthNamespace: func(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient) []rpc.API { nonceLock := new(types.AddrLocker) - evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx) return []rpc.API{ { Namespace: EthNamespace, @@ -84,7 +90,7 @@ func init() { } }, PersonalNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient) []rpc.API { - evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx) return []rpc.API{ { Namespace: PersonalNamespace, @@ -105,7 +111,7 @@ func init() { } }, DebugNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient) []rpc.API { - evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx) return []rpc.API{ { Namespace: DebugNamespace, @@ -116,7 +122,7 @@ func init() { } }, MinerNamespace: func(ctx *server.Context, clientCtx client.Context, _ *rpcclient.WSClient) []rpc.API { - evmBackend := backend.NewEVMBackend(ctx, ctx.Logger, clientCtx) + evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx) return []rpc.API{ { Namespace: MinerNamespace, diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go new file mode 100644 index 00000000..0a8f7d85 --- /dev/null +++ b/rpc/backend/backend.go @@ -0,0 +1,117 @@ +package backend + +import ( + "context" + "math/big" + "time" + + "github.com/tendermint/tendermint/libs/log" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rpc" + + "github.com/stratosnet/stratos-chain/rpc/types" + "github.com/stratosnet/stratos-chain/server/config" + stratos "github.com/stratosnet/stratos-chain/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" +) + +// BackendI implements the Cosmos and EVM backend. +type BackendI interface { // nolint: revive + CosmosBackend + EVMBackend +} + +// CosmosBackend implements the functionality shared within cosmos namespaces +// as defined by Wallet Connect V2: https://docs.walletconnect.com/2.0/json-rpc/cosmos. +// Implemented by Backend. +type CosmosBackend interface { + // TODO: define + // GetAccounts() + // SignDirect() + // SignAmino() +} + +// EVMBackend implements the functionality shared within ethereum namespaces +// as defined by EIP-1474: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md +// Implemented by Backend. +type EVMBackend interface { + // General Ethereum API + RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection + RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection + RPCTxFeeCap() float64 // RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for send-transaction variants. The unit is ether. + + RPCMinGasPrice() int64 + SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) + + // Blockchain API + BlockNumber() (hexutil.Uint64, error) + GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) + GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) + GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) + GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) + BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) + BlockByHash(blockHash common.Hash) (*ethtypes.Block, error) + CurrentHeader() *ethtypes.Header + HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) + HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) + PendingTransactions() ([]*sdk.Tx, error) + GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) + SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) + GetCoinbase() (sdk.AccAddress, error) + GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) + GetTxByEthHash(txHash common.Hash) (*tmrpctypes.ResultTx, error) + GetTxByTxIndex(height int64, txIndex uint) (*tmrpctypes.ResultTx, error) + EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) + BaseFee(height int64) (*big.Int, error) + + // Fee API + FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*types.FeeHistoryResult, error) + + // Filter API + BloomStatus() (uint64, uint64) + GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) + GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) + ChainConfig() *params.ChainConfig + SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) + GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx +} + +var _ BackendI = (*Backend)(nil) + +// Backend implements the BackendI interface +type Backend struct { + ctx context.Context + clientCtx client.Context + queryClient *types.QueryClient // gRPC query client + logger log.Logger + chainID *big.Int + cfg config.Config +} + +// NewBackend creates a new Backend instance for cosmos and ethereum namespaces +func NewBackend(ctx *server.Context, logger log.Logger, clientCtx client.Context) *Backend { + chainID, err := stratos.ParseChainID(clientCtx.ChainID) + if err != nil { + panic(err) + } + + appConf := config.GetConfig(ctx.Viper) + + return &Backend{ + ctx: context.Background(), + clientCtx: clientCtx, + queryClient: types.NewQueryClient(clientCtx), + logger: logger.With("module", "backend"), + chainID: chainID, + cfg: appConf, + } +} diff --git a/rpc/ethereum/backend/backend.go b/rpc/backend/evm_backend.go similarity index 57% rename from rpc/ethereum/backend/backend.go rename to rpc/backend/evm_backend.go index 1c45e58f..998649c4 100644 --- a/rpc/ethereum/backend/backend.go +++ b/rpc/backend/evm_backend.go @@ -2,126 +2,45 @@ package backend import ( "bytes" - "context" "encoding/json" "fmt" "math/big" "strconv" "time" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/pkg/errors" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "github.com/ethereum/go-ethereum/accounts/keystore" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" - - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" - "github.com/pkg/errors" - "github.com/tendermint/tendermint/libs/log" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" tmtypes "github.com/tendermint/tendermint/types" - "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/stratosnet/stratos-chain/rpc/ethereum/types" - "github.com/stratosnet/stratos-chain/server/config" + "github.com/stratosnet/stratos-chain/rpc/types" stratos "github.com/stratosnet/stratos-chain/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" - //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" ) -// Backend implements the functionality shared within namespaces. -// Implemented by EVMBackend. -type Backend interface { - // Fee API - FeeHistory(blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*types.FeeHistoryResult, error) - - // General Ethereum API - RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection - RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection - RPCTxFeeCap() float64 // RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for send-transaction variants. The unit is ether. - - RPCMinGasPrice() int64 - SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) - - // Blockchain API - BlockNumber() (hexutil.Uint64, error) - GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) - GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) - GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) - GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) - BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) - BlockByHash(blockHash common.Hash) (*ethtypes.Block, error) - CurrentHeader() *ethtypes.Header - HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) - HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) - PendingTransactions() ([]*sdk.Tx, error) - GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) - SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) - GetCoinbase() (sdk.AccAddress, error) - GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) - GetTxByEthHash(txHash common.Hash) (*tmrpctypes.ResultTx, error) - GetTxByTxIndex(height int64, txIndex uint) (*tmrpctypes.ResultTx, error) - EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) - BaseFee(height int64) (*big.Int, error) - - // Filter API - BloomStatus() (uint64, uint64) - GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) - GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) - ChainConfig() *params.ChainConfig - SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) - GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx -} - -var _ Backend = (*EVMBackend)(nil) - var bAttributeKeyEthereumBloom = []byte(evmtypes.AttributeKeyEthereumBloom) -// EVMBackend implements the Backend interface -type EVMBackend struct { - ctx context.Context - clientCtx client.Context - queryClient *types.QueryClient // gRPC query client - logger log.Logger - chainID *big.Int - cfg config.Config -} - -// NewEVMBackend creates a new EVMBackend instance -func NewEVMBackend(ctx *server.Context, logger log.Logger, clientCtx client.Context) *EVMBackend { - chainID, err := stratos.ParseChainID(clientCtx.ChainID) - if err != nil { - panic(err) - } - - appConf := config.GetConfig(ctx.Viper) - - return &EVMBackend{ - ctx: context.Background(), - clientCtx: clientCtx, - queryClient: types.NewQueryClient(clientCtx), - logger: logger.With("module", "evm-backend"), - chainID: chainID, - cfg: appConf, - } -} - // BlockNumber returns the current block number in abci app state. // Because abci app state could lag behind from tendermint latest block, it's more stable // for the client to use the latest block number in abci app state than tendermint rpc. -func (e *EVMBackend) BlockNumber() (hexutil.Uint64, error) { +func (b *Backend) BlockNumber() (hexutil.Uint64, error) { // do any grpc query, ignore the response and use the returned block height var header metadata.MD - _, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}, grpc.Header(&header)) + _, err := b.queryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{}, grpc.Header(&header)) if err != nil { return hexutil.Uint64(0), err } @@ -140,8 +59,8 @@ func (e *EVMBackend) BlockNumber() (hexutil.Uint64, error) { } // GetBlockByNumber returns the block identified by number. -func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) { - resBlock, err := e.GetTendermintBlockByNumber(blockNum) +func (b *Backend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) { + resBlock, err := b.GetTendermintBlockByNumber(blockNum) if err != nil { return nil, err } @@ -151,9 +70,9 @@ func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) ( return nil, nil } - res, err := e.EthBlockFromTendermint(resBlock.Block, fullTx) + res, err := b.EthBlockFromTendermint(resBlock.Block, fullTx) if err != nil { - e.logger.Debug("EthBlockFromTendermint failed", "height", blockNum, "error", err.Error()) + b.logger.Debug("EthBlockFromTendermint failed", "height", blockNum, "error", err.Error()) return nil, err } @@ -161,33 +80,33 @@ func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) ( } // GetBlockByHash returns the block identified by hash. -func (e *EVMBackend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { - resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) +func (b *Backend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { + resBlock, err := b.clientCtx.Client.BlockByHash(b.ctx, hash.Bytes()) if err != nil { - e.logger.Debug("BlockByHash block not found", "hash", hash.Hex(), "error", err.Error()) + b.logger.Debug("BlockByHash block not found", "hash", hash.Hex(), "error", err.Error()) return nil, err } if resBlock == nil || resBlock.Block == nil { - e.logger.Debug("BlockByHash block not found", "hash", hash.Hex()) + b.logger.Debug("BlockByHash block not found", "hash", hash.Hex()) return nil, nil } - return e.EthBlockFromTendermint(resBlock.Block, fullTx) + return b.EthBlockFromTendermint(resBlock.Block, fullTx) } // BlockByNumber returns the block identified by number. -func (e *EVMBackend) BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) { +func (b *Backend) BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, error) { height := blockNum.Int64() switch blockNum { case types.EthLatestBlockNumber: - currentBlockNumber, _ := e.BlockNumber() + currentBlockNumber, _ := b.BlockNumber() if currentBlockNumber > 0 { height = int64(currentBlockNumber) } case types.EthPendingBlockNumber: - currentBlockNumber, _ := e.BlockNumber() + currentBlockNumber, _ := b.BlockNumber() if currentBlockNumber > 0 { height = int64(currentBlockNumber) } @@ -199,9 +118,9 @@ func (e *EVMBackend) BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, } } - resBlock, err := e.clientCtx.Client.Block(e.ctx, &height) + resBlock, err := b.clientCtx.Client.Block(b.ctx, &height) if err != nil { - e.logger.Debug("HeaderByNumber failed", "height", height) + b.logger.Debug("HeaderByNumber failed", "height", height) return nil, err } @@ -209,14 +128,14 @@ func (e *EVMBackend) BlockByNumber(blockNum types.BlockNumber) (*ethtypes.Block, return nil, errors.Errorf("block not found for height %d", height) } - return e.EthBlockFromTm(resBlock.Block) + return b.EthBlockFromTm(resBlock.Block) } // BlockByHash returns the block identified by hash. -func (e *EVMBackend) BlockByHash(hash common.Hash) (*ethtypes.Block, error) { - resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) +func (b *Backend) BlockByHash(hash common.Hash) (*ethtypes.Block, error) { + resBlock, err := b.clientCtx.Client.BlockByHash(b.ctx, hash.Bytes()) if err != nil { - e.logger.Debug("HeaderByHash failed", "hash", hash.Hex()) + b.logger.Debug("HeaderByHash failed", "hash", hash.Hex()) return nil, err } @@ -224,19 +143,19 @@ func (e *EVMBackend) BlockByHash(hash common.Hash) (*ethtypes.Block, error) { return nil, errors.Errorf("block not found for hash %s", hash) } - return e.EthBlockFromTm(resBlock.Block) + return b.EthBlockFromTm(resBlock.Block) } -func (e *EVMBackend) EthBlockFromTm(block *tmtypes.Block) (*ethtypes.Block, error) { +func (b *Backend) EthBlockFromTm(block *tmtypes.Block) (*ethtypes.Block, error) { height := block.Height - bloom, err := e.BlockBloom(&height) + bloom, err := b.BlockBloom(&height) if err != nil { - e.logger.Debug("HeaderByNumber BlockBloom failed", "height", height) + b.logger.Debug("HeaderByNumber BlockBloom failed", "height", height) } - baseFee, err := e.BaseFee(height) + baseFee, err := b.BaseFee(height) if err != nil { - e.logger.Debug("HeaderByNumber BaseFee failed", "height", height, "error", err.Error()) + b.logger.Debug("HeaderByNumber BaseFee failed", "height", height, "error", err.Error()) return nil, err } @@ -244,9 +163,9 @@ func (e *EVMBackend) EthBlockFromTm(block *tmtypes.Block) (*ethtypes.Block, erro var txs []*ethtypes.Transaction for _, txBz := range block.Txs { - tx, err := e.clientCtx.TxConfig.TxDecoder()(txBz) + tx, err := b.clientCtx.TxConfig.TxDecoder()(txBz) if err != nil { - e.logger.Debug("failed to decode transaction in block", "height", height, "error", err.Error()) + b.logger.Debug("failed to decode transaction in block", "height", height, "error", err.Error()) continue } @@ -267,9 +186,9 @@ func (e *EVMBackend) EthBlockFromTm(block *tmtypes.Block) (*ethtypes.Block, erro } // GetTendermintBlockByNumber returns a Tendermint format block by block number -func (e *EVMBackend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) { +func (b *Backend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) { height := blockNum.Int64() - currentBlockNumber, _ := e.BlockNumber() + currentBlockNumber, _ := b.BlockNumber() switch blockNum { case types.EthLatestBlockNumber: @@ -291,16 +210,16 @@ func (e *EVMBackend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tm } } - resBlock, err := e.clientCtx.Client.Block(e.ctx, &height) + resBlock, err := b.clientCtx.Client.Block(b.ctx, &height) if err != nil { - if resBlock, err = e.clientCtx.Client.Block(e.ctx, nil); err != nil { - e.logger.Debug("tendermint client failed to get latest block", "height", height, "error", err.Error()) + if resBlock, err = b.clientCtx.Client.Block(b.ctx, nil); err != nil { + b.logger.Debug("tendermint client failed to get latest block", "height", height, "error", err.Error()) return nil, nil } } if resBlock.Block == nil { - e.logger.Debug("GetBlockByNumber block not found", "height", height) + b.logger.Debug("GetBlockByNumber block not found", "height", height) return nil, nil } @@ -308,14 +227,14 @@ func (e *EVMBackend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tm } // GetTendermintBlockByHash returns a Tendermint format block by block number -func (e *EVMBackend) GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) { - resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, blockHash.Bytes()) +func (b *Backend) GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error) { + resBlock, err := b.clientCtx.Client.BlockByHash(b.ctx, blockHash.Bytes()) if err != nil { - e.logger.Debug("tendermint client failed to get block", "blockHash", blockHash.Hex(), "error", err.Error()) + b.logger.Debug("tendermint client failed to get block", "blockHash", blockHash.Hex(), "error", err.Error()) } if resBlock == nil || resBlock.Block == nil { - e.logger.Debug("GetBlockByNumber block not found", "blockHash", blockHash.Hex()) + b.logger.Debug("GetBlockByNumber block not found", "blockHash", blockHash.Hex()) return nil, nil } @@ -323,8 +242,8 @@ func (e *EVMBackend) GetTendermintBlockByHash(blockHash common.Hash) (*tmrpctype } // BlockBloom query block bloom filter from block results -func (e *EVMBackend) BlockBloom(height *int64) (ethtypes.Bloom, error) { - result, err := e.clientCtx.Client.BlockResults(e.ctx, height) +func (b *Backend) BlockBloom(height *int64) (ethtypes.Bloom, error) { + result, err := b.clientCtx.Client.BlockResults(b.ctx, height) if err != nil { return ethtypes.Bloom{}, err } @@ -343,7 +262,7 @@ func (e *EVMBackend) BlockBloom(height *int64) (ethtypes.Bloom, error) { } // EthBlockFromTendermint returns a JSON-RPC compatible Ethereum block from a given Tendermint block and its block result. -func (e *EVMBackend) EthBlockFromTendermint( +func (b *Backend) EthBlockFromTendermint( block *tmtypes.Block, fullTx bool, ) (map[string]interface{}, error) { @@ -351,12 +270,12 @@ func (e *EVMBackend) EthBlockFromTendermint( ctx := types.ContextWithHeight(block.Height) - baseFee, err := e.BaseFee(block.Height) + baseFee, err := b.BaseFee(block.Height) if err != nil { return nil, err } - resBlockResult, err := e.clientCtx.Client.BlockResults(ctx, &block.Height) + resBlockResult, err := b.clientCtx.Client.BlockResults(ctx, &block.Height) if err != nil { return nil, err } @@ -365,9 +284,9 @@ func (e *EVMBackend) EthBlockFromTendermint( txIndex := uint64(0) for i, txBz := range block.Txs { - tx, err := e.clientCtx.TxConfig.TxDecoder()(txBz) + tx, err := b.clientCtx.TxConfig.TxDecoder()(txBz) if err != nil { - e.logger.Debug("failed to decode transaction in block", "height", block.Height, "error", err.Error()) + b.logger.Debug("failed to decode transaction in block", "height", block.Height, "error", err.Error()) continue } @@ -381,7 +300,7 @@ func (e *EVMBackend) EthBlockFromTendermint( // check tx exists on EVM by cross checking with blockResults if txResults[i].Code != 0 { - e.logger.Debug("invalid tx result code", "hash", tx.Hash().Hex()) + b.logger.Debug("invalid tx result code", "hash", tx.Hash().Hex()) continue } @@ -399,7 +318,7 @@ func (e *EVMBackend) EthBlockFromTendermint( baseFee, ) if err != nil { - e.logger.Debug("NewTransactionFromData for receipt failed", "hash", tx.Hash().Hex(), "error", err.Error()) + b.logger.Debug("NewTransactionFromData for receipt failed", "hash", tx.Hash().Hex(), "error", err.Error()) continue } ethRPCTxs = append(ethRPCTxs, rpcTx) @@ -407,18 +326,18 @@ func (e *EVMBackend) EthBlockFromTendermint( } } - bloom, err := e.BlockBloom(&block.Height) + bloom, err := b.BlockBloom(&block.Height) if err != nil { - e.logger.Debug("failed to query BlockBloom", "height", block.Height, "error", err.Error()) + b.logger.Debug("failed to query BlockBloom", "height", block.Height, "error", err.Error()) } req := &evmtypes.QueryValidatorAccountRequest{ ConsAddress: sdk.ConsAddress(block.Header.ProposerAddress).String(), } - res, err := e.queryClient.ValidatorAccount(ctx, req) + res, err := b.queryClient.ValidatorAccount(ctx, req) if err != nil { - e.logger.Debug( + b.logger.Debug( "failed to query validator operator address", "height", block.Height, "cons-address", req.ConsAddress, @@ -434,9 +353,9 @@ func (e *EVMBackend) EthBlockFromTendermint( validatorAddr := common.BytesToAddress(addr) - gasLimit, err := types.BlockMaxGasFromConsensusParams(ctx, e.clientCtx, block.Height) + gasLimit, err := types.BlockMaxGasFromConsensusParams(ctx, b.clientCtx, block.Height) if err != nil { - e.logger.Error("failed to query consensus params", "error", err.Error()) + b.logger.Error("failed to query consensus params", "error", err.Error()) } gasUsed := uint64(0) @@ -459,23 +378,23 @@ func (e *EVMBackend) EthBlockFromTendermint( } // CurrentHeader returns the latest block header -func (e *EVMBackend) CurrentHeader() *ethtypes.Header { - header, _ := e.HeaderByNumber(types.EthLatestBlockNumber) +func (b *Backend) CurrentHeader() *ethtypes.Header { + header, _ := b.HeaderByNumber(types.EthLatestBlockNumber) return header } // HeaderByNumber returns the block header identified by height. -func (e *EVMBackend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) { +func (b *Backend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) { height := blockNum.Int64() switch blockNum { case types.EthLatestBlockNumber: - currentBlockNumber, _ := e.BlockNumber() + currentBlockNumber, _ := b.BlockNumber() if currentBlockNumber > 0 { height = int64(currentBlockNumber) } case types.EthPendingBlockNumber: - currentBlockNumber, _ := e.BlockNumber() + currentBlockNumber, _ := b.BlockNumber() if currentBlockNumber > 0 { height = int64(currentBlockNumber) } @@ -487,20 +406,20 @@ func (e *EVMBackend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Heade } } - resBlock, err := e.clientCtx.Client.Block(e.ctx, &height) + resBlock, err := b.clientCtx.Client.Block(b.ctx, &height) if err != nil { - e.logger.Debug("HeaderByNumber failed") + b.logger.Debug("HeaderByNumber failed") return nil, err } - bloom, err := e.BlockBloom(&resBlock.Block.Height) + bloom, err := b.BlockBloom(&resBlock.Block.Height) if err != nil { - e.logger.Debug("HeaderByNumber BlockBloom failed", "height", resBlock.Block.Height) + b.logger.Debug("HeaderByNumber BlockBloom failed", "height", resBlock.Block.Height) } - baseFee, err := e.BaseFee(resBlock.Block.Height) + baseFee, err := b.BaseFee(resBlock.Block.Height) if err != nil { - e.logger.Debug("HeaderByNumber BaseFee failed", "height", resBlock.Block.Height, "error", err.Error()) + b.logger.Debug("HeaderByNumber BaseFee failed", "height", resBlock.Block.Height, "error", err.Error()) return nil, err } @@ -509,10 +428,10 @@ func (e *EVMBackend) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Heade } // HeaderByHash returns the block header identified by hash. -func (e *EVMBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) { - resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, blockHash.Bytes()) +func (b *Backend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) { + resBlock, err := b.clientCtx.Client.BlockByHash(b.ctx, blockHash.Bytes()) if err != nil { - e.logger.Debug("HeaderByHash failed", "hash", blockHash.Hex()) + b.logger.Debug("HeaderByHash failed", "hash", blockHash.Hex()) return nil, err } @@ -520,14 +439,14 @@ func (e *EVMBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, erro return nil, errors.Errorf("block not found for hash %s", blockHash.Hex()) } - bloom, err := e.BlockBloom(&resBlock.Block.Height) + bloom, err := b.BlockBloom(&resBlock.Block.Height) if err != nil { - e.logger.Debug("HeaderByHash BlockBloom failed", "height", resBlock.Block.Height) + b.logger.Debug("HeaderByHash BlockBloom failed", "height", resBlock.Block.Height) } - baseFee, err := e.BaseFee(resBlock.Block.Height) + baseFee, err := b.BaseFee(resBlock.Block.Height) if err != nil { - e.logger.Debug("HeaderByHash BaseFee failed", "height", resBlock.Block.Height, "error", err.Error()) + b.logger.Debug("HeaderByHash BaseFee failed", "height", resBlock.Block.Height, "error", err.Error()) return nil, err } @@ -537,15 +456,15 @@ func (e *EVMBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, erro // PendingTransactions returns the transactions that are in the transaction pool // and have a from address that is one of the accounts this node manages. -func (e *EVMBackend) PendingTransactions() ([]*sdk.Tx, error) { - res, err := e.clientCtx.Client.UnconfirmedTxs(e.ctx, nil) +func (b *Backend) PendingTransactions() ([]*sdk.Tx, error) { + res, err := b.clientCtx.Client.UnconfirmedTxs(b.ctx, nil) if err != nil { return nil, err } result := make([]*sdk.Tx, 0, len(res.Txs)) for _, txBz := range res.Txs { - tx, err := e.clientCtx.TxConfig.TxDecoder()(txBz) + tx, err := b.clientCtx.TxConfig.TxDecoder()(txBz) if err != nil { return nil, err } @@ -556,9 +475,9 @@ func (e *EVMBackend) PendingTransactions() ([]*sdk.Tx, error) { } // GetLogsByHeight returns all the logs from all the ethereum transactions in a block. -func (e *EVMBackend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) { +func (b *Backend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) { // NOTE: we query the state in case the tx result logs are not persisted after an upgrade. - blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, height) + blockRes, err := b.clientCtx.Client.BlockResults(b.ctx, height) if err != nil { return nil, err } @@ -577,25 +496,25 @@ func (e *EVMBackend) GetLogsByHeight(height *int64) ([][]*ethtypes.Log, error) { } // GetLogs returns all the logs from all the ethereum transactions in a block. -func (e *EVMBackend) GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) { - block, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) +func (b *Backend) GetLogs(hash common.Hash) ([][]*ethtypes.Log, error) { + block, err := b.clientCtx.Client.BlockByHash(b.ctx, hash.Bytes()) if err != nil { return nil, err } - return e.GetLogsByHeight(&block.Block.Header.Height) + return b.GetLogsByHeight(&block.Block.Header.Height) } -func (e *EVMBackend) GetLogsByNumber(blockNum types.BlockNumber) ([][]*ethtypes.Log, error) { +func (b *Backend) GetLogsByNumber(blockNum types.BlockNumber) ([][]*ethtypes.Log, error) { height := blockNum.Int64() switch blockNum { case types.EthLatestBlockNumber: - currentBlockNumber, _ := e.BlockNumber() + currentBlockNumber, _ := b.BlockNumber() if currentBlockNumber > 0 { height = int64(currentBlockNumber) } case types.EthPendingBlockNumber: - currentBlockNumber, _ := e.BlockNumber() + currentBlockNumber, _ := b.BlockNumber() if currentBlockNumber > 0 { height = int64(currentBlockNumber) } @@ -607,23 +526,23 @@ func (e *EVMBackend) GetLogsByNumber(blockNum types.BlockNumber) ([][]*ethtypes. } } - return e.GetLogsByHeight(&height) + return b.GetLogsByHeight(&height) } // BloomStatus returns the BloomBitsBlocks and the number of processed sections maintained // by the chain indexer. -func (e *EVMBackend) BloomStatus() (uint64, uint64) { +func (b *Backend) BloomStatus() (uint64, uint64) { return 4096, 0 } // GetCoinbase is the address that staking rewards will be send to (alias for Etherbase). -func (e *EVMBackend) GetCoinbase() (sdk.AccAddress, error) { - node, err := e.clientCtx.GetNode() +func (b *Backend) GetCoinbase() (sdk.AccAddress, error) { + node, err := b.clientCtx.GetNode() if err != nil { return nil, err } - status, err := node.Status(e.ctx) + status, err := node.Status(b.ctx) if err != nil { return nil, err } @@ -632,7 +551,7 @@ func (e *EVMBackend) GetCoinbase() (sdk.AccAddress, error) { ConsAddress: sdk.ConsAddress(status.ValidatorInfo.Address).String(), } - res, err := e.queryClient.ValidatorAccount(e.ctx, req) + res, err := b.queryClient.ValidatorAccount(b.ctx, req) if err != nil { return nil, err } @@ -642,14 +561,14 @@ func (e *EVMBackend) GetCoinbase() (sdk.AccAddress, error) { } // GetTransactionByHash returns the Ethereum format transaction identified by Ethereum transaction hash -func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) { - res, err := e.GetTxByEthHash(txHash) +func (b *Backend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransaction, error) { + res, err := b.GetTxByEthHash(txHash) hexTx := txHash.Hex() if err != nil { // try to find tx in mempool - txs, err := e.PendingTransactions() + txs, err := b.PendingTransactions() if err != nil { - e.logger.Debug("tx not found", "hash", hexTx, "error", err.Error()) + b.logger.Debug("tx not found", "hash", hexTx, "error", err.Error()) return nil, nil } @@ -666,7 +585,7 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac common.Hash{}, uint64(0), uint64(0), - e.chainID, + b.chainID, ) if err != nil { return nil, err @@ -675,7 +594,7 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac } } - e.logger.Debug("tx not found", "hash", hexTx) + b.logger.Debug("tx not found", "hash", hexTx) return nil, nil } @@ -688,7 +607,7 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac return nil, fmt.Errorf("ethereum tx not found in msgs: %s", hexTx) } - tx, err := e.clientCtx.TxConfig.TxDecoder()(res.Tx) + tx, err := b.clientCtx.TxConfig.TxDecoder()(res.Tx) if err != nil { return nil, err } @@ -699,9 +618,9 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac return nil, errors.New("invalid ethereum tx") } - block, err := e.clientCtx.Client.Block(e.ctx, &res.Height) + block, err := b.clientCtx.Client.Block(b.ctx, &res.Height) if err != nil { - e.logger.Debug("block not found", "height", res.Height, "error", err.Error()) + b.logger.Debug("block not found", "height", res.Height, "error", err.Error()) return nil, err } @@ -712,11 +631,11 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac found = true } else { // Fallback to find tx index by iterating all valid eth transactions - blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &block.Block.Height) + blockRes, err := b.clientCtx.Client.BlockResults(b.ctx, &block.Block.Height) if err != nil { return nil, nil } - msgs := e.GetEthereumMsgsFromTendermintBlock(block, blockRes) + msgs := b.GetEthereumMsgsFromTendermintBlock(block, blockRes) for i := range msgs { if msgs[i].Hash == hexTx { txIndex = uint64(i) @@ -734,16 +653,16 @@ func (e *EVMBackend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransac common.BytesToHash(block.BlockID.Hash.Bytes()), uint64(res.Height), txIndex, - e.chainID, + b.chainID, ) } // GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash // TODO: Don't need to convert once hashing is fixed on Tendermint // https://github.com/tendermint/tendermint/issues/6539 -func (e *EVMBackend) GetTxByEthHash(hash common.Hash) (*tmrpctypes.ResultTx, error) { +func (b *Backend) GetTxByEthHash(hash common.Hash) (*tmrpctypes.ResultTx, error) { query := fmt.Sprintf("%s.%s='%s'", evmtypes.TypeMsgEthereumTx, evmtypes.AttributeKeyEthereumTxHash, hash.Hex()) - resTxs, err := e.clientCtx.Client.TxSearch(e.ctx, query, false, nil, nil, "") + resTxs, err := b.clientCtx.Client.TxSearch(b.ctx, query, false, nil, nil, "") if err != nil { return nil, err } @@ -754,12 +673,12 @@ func (e *EVMBackend) GetTxByEthHash(hash common.Hash) (*tmrpctypes.ResultTx, err } // GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs -func (e *EVMBackend) GetTxByTxIndex(height int64, index uint) (*tmrpctypes.ResultTx, error) { +func (b *Backend) GetTxByTxIndex(height int64, index uint) (*tmrpctypes.ResultTx, error) { query := fmt.Sprintf("tx.height=%d AND %s.%s=%d", height, evmtypes.TypeMsgEthereumTx, evmtypes.AttributeKeyTxIndex, index, ) - resTxs, err := e.clientCtx.Client.TxSearch(e.ctx, query, false, nil, nil, "") + resTxs, err := b.clientCtx.Client.TxSearch(b.ctx, query, false, nil, nil, "") if err != nil { return nil, err } @@ -769,63 +688,63 @@ func (e *EVMBackend) GetTxByTxIndex(height int64, index uint) (*tmrpctypes.Resul return resTxs.Txs[0], nil } -func (e *EVMBackend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { +func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { // Look up the wallet containing the requested signer - _, err := e.clientCtx.Keyring.KeyByAddress(sdk.AccAddress(args.From.Bytes())) + _, err := b.clientCtx.Keyring.KeyByAddress(sdk.AccAddress(args.From.Bytes())) if err != nil { - e.logger.Error("failed to find key in keyring", "address", args.From, "error", err.Error()) + b.logger.Error("failed to find key in keyring", "address", args.From, "error", err.Error()) return common.Hash{}, fmt.Errorf("%s; %s", keystore.ErrNoMatch, err.Error()) } - args, err = e.SetTxDefaults(args) + args, err = b.SetTxDefaults(args) if err != nil { return common.Hash{}, err } - args, err = e.parseGasUnit(args) + args, err = b.parseGasUnit(args) if err != nil { return common.Hash{}, err } msg := args.ToTransaction() if err := msg.ValidateBasic(); err != nil { - e.logger.Debug("tx failed basic validation", "error", err.Error()) + b.logger.Debug("tx failed basic validation", "error", err.Error()) return common.Hash{}, err } - bn, err := e.BlockNumber() + bn, err := b.BlockNumber() if err != nil { - e.logger.Debug("failed to fetch latest block number", "error", err.Error()) + b.logger.Debug("failed to fetch latest block number", "error", err.Error()) return common.Hash{}, err } - signer := ethtypes.MakeSigner(e.ChainConfig(), new(big.Int).SetUint64(uint64(bn))) + signer := ethtypes.MakeSigner(b.ChainConfig(), new(big.Int).SetUint64(uint64(bn))) // Sign transaction - if err := msg.Sign(signer, e.clientCtx.Keyring); err != nil { - e.logger.Debug("failed to sign tx", "error", err.Error()) + if err := msg.Sign(signer, b.clientCtx.Keyring); err != nil { + b.logger.Debug("failed to sign tx", "error", err.Error()) return common.Hash{}, err } // Query params to use the EVM denomination - res, err := e.queryClient.QueryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) + res, err := b.queryClient.QueryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{}) if err != nil { - e.logger.Error("failed to query evm params", "error", err.Error()) + b.logger.Error("failed to query evm params", "error", err.Error()) return common.Hash{}, err } // Assemble transaction from fields - tx, err := msg.BuildTx(e.clientCtx.TxConfig.NewTxBuilder(), res.Params.EvmDenom) + tx, err := msg.BuildTx(b.clientCtx.TxConfig.NewTxBuilder(), res.Params.EvmDenom) if err != nil { - e.logger.Error("build cosmos tx failed", "error", err.Error()) + b.logger.Error("build cosmos tx failed", "error", err.Error()) return common.Hash{}, err } // Encode transaction by default Tx encoder - txEncoder := e.clientCtx.TxConfig.TxEncoder() + txEncoder := b.clientCtx.TxConfig.TxEncoder() txBytes, err := txEncoder(tx) if err != nil { - e.logger.Error("failed to encode eth tx using default encoder", "error", err.Error()) + b.logger.Error("failed to encode eth tx using default encoder", "error", err.Error()) return common.Hash{}, err } @@ -833,13 +752,13 @@ func (e *EVMBackend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash // Broadcast transaction in sync mode (default) // NOTE: If error is encountered on the node, the broadcast will not return an error - syncCtx := e.clientCtx.WithBroadcastMode(flags.BroadcastSync) + syncCtx := b.clientCtx.WithBroadcastMode(flags.BroadcastSync) rsp, err := syncCtx.BroadcastTx(txBytes) if rsp != nil && rsp.Code != 0 { err = sdkerrors.ABCIError(rsp.Codespace, rsp.Code, rsp.RawLog) } if err != nil { - e.logger.Error("failed to broadcast tx", "error", err.Error()) + b.logger.Error("failed to broadcast tx", "error", err.Error()) return txHash, err } @@ -848,7 +767,7 @@ func (e *EVMBackend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash } // EstimateGas returns an estimate of gas usage for the given smart contract call. -func (e *EVMBackend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) { +func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *types.BlockNumber) (hexutil.Uint64, error) { blockNr := types.EthPendingBlockNumber if blockNrOptional != nil { blockNr = *blockNrOptional @@ -861,13 +780,13 @@ func (e *EVMBackend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional req := evmtypes.EthCallRequest{ Args: bz, - GasCap: e.RPCGasCap(), + GasCap: b.RPCGasCap(), } // From ContextWithHeight: if the provided height is 0, // it will return an empty context and the gRPC query will use // the latest block height for querying. - res, err := e.queryClient.EstimateGas(types.ContextWithHeight(blockNr.Int64()), &req) + res, err := b.queryClient.EstimateGas(types.ContextWithHeight(blockNr.Int64()), &req) if err != nil { return 0, err } @@ -875,12 +794,12 @@ func (e *EVMBackend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional } // GetTransactionCount returns the number of transactions at the given address up to the given block number. -func (e *EVMBackend) GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) { +func (b *Backend) GetTransactionCount(address common.Address, blockNum types.BlockNumber) (*hexutil.Uint64, error) { // Get nonce (sequence) from account from := sdk.AccAddress(address.Bytes()) - accRet := e.clientCtx.AccountRetriever + accRet := b.clientCtx.AccountRetriever - err := accRet.EnsureExists(e.clientCtx, from) + err := accRet.EnsureExists(b.clientCtx, from) if err != nil { // account doesn't exist yet, return 0 n := hexutil.Uint64(0) @@ -888,7 +807,7 @@ func (e *EVMBackend) GetTransactionCount(address common.Address, blockNum types. } includePending := blockNum == types.EthPendingBlockNumber - nonce, err := e.getAccountNonce(address, includePending, blockNum.Int64(), e.logger) + nonce, err := b.getAccountNonce(address, includePending, blockNum.Int64(), b.logger) if err != nil { return nil, err } @@ -898,50 +817,50 @@ func (e *EVMBackend) GetTransactionCount(address common.Address, blockNum types. } // RPCGasCap is the global gas cap for eth-call variants. -func (e *EVMBackend) RPCGasCap() uint64 { - return e.cfg.JSONRPC.GasCap +func (b *Backend) RPCGasCap() uint64 { + return b.cfg.JSONRPC.GasCap } // RPCEVMTimeout is the global evm timeout for eth-call variants. -func (e *EVMBackend) RPCEVMTimeout() time.Duration { - return e.cfg.JSONRPC.EVMTimeout +func (b *Backend) RPCEVMTimeout() time.Duration { + return b.cfg.JSONRPC.EVMTimeout } // RPCGasCap is the global gas cap for eth-call variants. -func (e *EVMBackend) RPCTxFeeCap() float64 { - return e.cfg.JSONRPC.TxFeeCap +func (b *Backend) RPCTxFeeCap() float64 { + return b.cfg.JSONRPC.TxFeeCap } // RPCFilterCap is the limit for total number of filters that can be created -func (e *EVMBackend) RPCFilterCap() int32 { - return e.cfg.JSONRPC.FilterCap +func (b *Backend) RPCFilterCap() int32 { + return b.cfg.JSONRPC.FilterCap } // RPCFeeHistoryCap is the limit for total number of blocks that can be fetched -func (e *EVMBackend) RPCFeeHistoryCap() int32 { - return e.cfg.JSONRPC.FeeHistoryCap +func (b *Backend) RPCFeeHistoryCap() int32 { + return b.cfg.JSONRPC.FeeHistoryCap } // RPCLogsCap defines the max number of results can be returned from single `eth_getLogs` query. -func (e *EVMBackend) RPCLogsCap() int32 { - return e.cfg.JSONRPC.LogsCap +func (b *Backend) RPCLogsCap() int32 { + return b.cfg.JSONRPC.LogsCap } // RPCBlockRangeCap defines the max block range allowed for `eth_getLogs` query. -func (e *EVMBackend) RPCBlockRangeCap() int32 { - return e.cfg.JSONRPC.BlockRangeCap +func (b *Backend) RPCBlockRangeCap() int32 { + return b.cfg.JSONRPC.BlockRangeCap } // RPCMinGasPrice returns the minimum gas price for a transaction obtained from // the node config. If set value is 0, it will default to 20. -func (e *EVMBackend) RPCMinGasPrice() int64 { - evmParams, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) +func (b *Backend) RPCMinGasPrice() int64 { + evmParams, err := b.queryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{}) if err != nil { return stratos.DefaultGasPrice } - minGasPrice := e.cfg.GetMinGasPrices() + minGasPrice := b.cfg.GetMinGasPrices() amt := minGasPrice.AmountOf(evmParams.Params.EvmDenom).TruncateInt64() if amt == 0 { return stratos.DefaultGasPrice @@ -950,26 +869,26 @@ func (e *EVMBackend) RPCMinGasPrice() int64 { return amt } -// ChainConfig return the ethereum chain configuration -func (e *EVMBackend) ChainConfig() *params.ChainConfig { - params, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) +// ChainConfig returns the latest ethereum chain configuration +func (b *Backend) ChainConfig() *params.ChainConfig { + params, err := b.queryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{}) if err != nil { return nil } - return params.Params.ChainConfig.EthereumConfig(e.chainID) + return params.Params.ChainConfig.EthereumConfig(b.chainID) } // SuggestGasTipCap returns the suggested tip cap // Although we don't support tx prioritization yet, but we return a positive value to help client to // mitigate the base fee changes. -func (e *EVMBackend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) { +func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) { if baseFee == nil { - // london hardfork not enabled or feemarket not enabeld + // london hardfork not enabled or feemarket not enabled return big.NewInt(0), nil } - params, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{}) + params, err := b.queryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{}) if err != nil { return nil, err } @@ -991,47 +910,122 @@ func (e *EVMBackend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) { return big.NewInt(maxDelta), nil } -// BaseFee returns the base fee tracked by the Fee Market module. If the base fee is not enabled, -// it returns the initial base fee amount. Return nil if London is not activated. -func (e *EVMBackend) BaseFee(height int64) (*big.Int, error) { - cfg := e.ChainConfig() - if !cfg.IsLondon(new(big.Int).SetInt64(height)) { +// BaseFee returns the base fee tracked by the Fee Market module. +// If the base fee is not enabled globally, the query returns nil. +// If the London hard fork is not activated at the current height, the query will +// return nil. +func (b *Backend) BaseFee(height int64) (*big.Int, error) { + // return BaseFee if London hard fork is activated and feemarket is enabled + res, err := b.queryClient.BaseFee(types.ContextWithHeight(height), &evmtypes.QueryBaseFeeRequest{}) + if err != nil { + return nil, err + } + + if res.BaseFee == nil { return nil, nil } - // Checks the feemarket param NoBaseFee settings, return 0 if it is enabled. - resParams, err := e.queryClient.Params(types.ContextWithHeight(height), &evmtypes.QueryParamsRequest{}) - if err != nil { - return nil, err + return res.BaseFee.BigInt(), nil +} + +// FeeHistory returns data relevant for fee estimation based on the specified range of blocks. +func (b *Backend) FeeHistory( + userBlockCount rpc.DecimalOrHex, // number blocks to fetch, maximum is 100 + lastBlock rpc.BlockNumber, // the block to start search , to oldest + rewardPercentiles []float64, // percentiles to fetch reward +) (*types.FeeHistoryResult, error) { + blockEnd := int64(lastBlock) + + if blockEnd <= 0 { + blockNumber, err := b.BlockNumber() + if err != nil { + return nil, err + } + blockEnd = int64(blockNumber) + } + userBlockCountInt := int64(userBlockCount) + maxBlockCount := int64(b.cfg.JSONRPC.FeeHistoryCap) + if userBlockCountInt > maxBlockCount { + return nil, fmt.Errorf("FeeHistory user block count %d higher than %d", userBlockCountInt, maxBlockCount) + } + blockStart := blockEnd - userBlockCountInt + if blockStart < 0 { + blockStart = 0 } - if resParams.Params.FeeMarketParams.NoBaseFee { - return big.NewInt(0), nil + blockCount := blockEnd - blockStart + + oldestBlock := (*hexutil.Big)(big.NewInt(blockStart)) + + // prepare space + reward := make([][]*hexutil.Big, blockCount) + rewardCount := len(rewardPercentiles) + for i := 0; i < int(blockCount); i++ { + reward[i] = make([]*hexutil.Big, rewardCount) } + thisBaseFee := make([]*hexutil.Big, blockCount) + thisGasUsedRatio := make([]float64, blockCount) - blockRes, err := e.clientCtx.Client.BlockResults(e.ctx, &height) - if err != nil { - return nil, err + // rewards should only be calculated if reward percentiles were included + calculateRewards := rewardCount != 0 + + // fetch block + for blockID := blockStart; blockID < blockEnd; blockID++ { + index := int32(blockID - blockStart) + // eth block + ethBlock, err := b.GetBlockByNumber(types.BlockNumber(blockID), true) + if ethBlock == nil { + return nil, err + } + + // tendermint block + tendermintblock, err := b.GetTendermintBlockByNumber(types.BlockNumber(blockID)) + if tendermintblock == nil { + return nil, err + } + + // tendermint block result + tendermintBlockResult, err := b.clientCtx.Client.BlockResults(b.ctx, &tendermintblock.Block.Height) + if tendermintBlockResult == nil { + b.logger.Debug("block result not found", "height", tendermintblock.Block.Height, "error", err.Error()) + return nil, err + } + + oneFeeHistory := types.OneFeeHistory{} + err = b.processBlock(tendermintblock, ðBlock, rewardPercentiles, tendermintBlockResult, &oneFeeHistory) + if err != nil { + return nil, err + } + + // copy + thisBaseFee[index] = (*hexutil.Big)(oneFeeHistory.BaseFee) + thisGasUsedRatio[index] = oneFeeHistory.GasUsedRatio + if calculateRewards { + for j := 0; j < rewardCount; j++ { + reward[index][j] = (*hexutil.Big)(oneFeeHistory.Reward[j]) + if reward[index][j] == nil { + reward[index][j] = (*hexutil.Big)(big.NewInt(0)) + } + } + } } - baseFee := types.BaseFeeFromEvents(blockRes.BeginBlockEvents) - if baseFee != nil { - return baseFee, nil + feeHistory := types.FeeHistoryResult{ + OldestBlock: oldestBlock, + BaseFee: thisBaseFee, + GasUsedRatio: thisGasUsedRatio, } - // If we cannot find in events, we tried to get it from the state. - // It will return feemarket.baseFee if london is activated but feemarket is not enable - res, err := e.queryClient.QueryBaseFee(types.ContextWithHeight(height), &evmtypes.QueryBaseFeeRequest{}) - if err == nil && res.BaseFee != nil { - return res.BaseFee.BigInt(), nil + if calculateRewards { + feeHistory.Reward = reward } - return nil, nil + return &feeHistory, nil } // GetEthereumMsgsFromTendermintBlock returns all real MsgEthereumTxs from a Tendermint block. // It also ensures consistency over the correct txs indexes across RPC endpoints -func (e *EVMBackend) GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx { +func (b *Backend) GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*evmtypes.MsgEthereumTx { var result []*evmtypes.MsgEthereumTx txResults := blockRes.TxsResults @@ -1039,13 +1033,13 @@ func (e *EVMBackend) GetEthereumMsgsFromTendermintBlock(block *tmrpctypes.Result for i, tx := range block.Block.Txs { // check tx exists on EVM by cross checking with blockResults if txResults[i].Code != 0 { - e.logger.Debug("invalid tx result code", "cosmos-hash", hexutil.Encode(tx.Hash())) + b.logger.Debug("invalid tx result code", "cosmos-hash", hexutil.Encode(tx.Hash())) continue } - tx, err := e.clientCtx.TxConfig.TxDecoder()(tx) + tx, err := b.clientCtx.TxConfig.TxDecoder()(tx) if err != nil { - e.logger.Debug("failed to decode transaction in block", "height", block.Block.Height, "error", err.Error()) + b.logger.Debug("failed to decode transaction in block", "height", block.Block.Height, "error", err.Error()) continue } diff --git a/rpc/ethereum/backend/utils.go b/rpc/backend/utils.go similarity index 63% rename from rpc/ethereum/backend/utils.go rename to rpc/backend/utils.go index cb026967..c76821eb 100644 --- a/rpc/ethereum/backend/utils.go +++ b/rpc/backend/utils.go @@ -6,30 +6,48 @@ import ( "errors" "fmt" "math/big" - - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" + "sort" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stratos "github.com/stratosnet/stratos-chain/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/stratosnet/stratos-chain/rpc/ethereum/types" - stratos "github.com/stratosnet/stratos-chain/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + + "github.com/stratosnet/stratos-chain/rpc/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) +type txGasAndReward struct { + gasUsed uint64 + reward *big.Int +} + +type sortGasAndReward []txGasAndReward + +func (s sortGasAndReward) Len() int { return len(s) } +func (s sortGasAndReward) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s sortGasAndReward) Less(i, j int) bool { + return s[i].reward.Cmp(s[j].reward) < 0 +} + // SetTxDefaults populates tx message with default values in case they are not // provided on the args -func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) { +func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) { if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { return args, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") } - head := e.CurrentHeader() + head := b.CurrentHeader() if head == nil { return args, errors.New("latest header is nil") } @@ -40,7 +58,7 @@ func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Tran // In this clause, user left some fields unspecified. if head.BaseFee != nil && args.GasPrice == nil { if args.MaxPriorityFeePerGas == nil { - tip, err := e.SuggestGasTipCap(head.BaseFee) + tip, err := b.SuggestGasTipCap(head.BaseFee) if err != nil { return args, err } @@ -65,7 +83,7 @@ func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Tran } if args.GasPrice == nil { - price, err := e.SuggestGasTipCap(head.BaseFee) + price, err := b.SuggestGasTipCap(head.BaseFee) if err != nil { return args, err } @@ -91,7 +109,7 @@ func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Tran if args.Nonce == nil { // get the nonce from the account retriever // ignore error in case tge account doesn't exist yet - nonce, _ := e.getAccountNonce(*args.From, true, 0, e.logger) + nonce, _ := b.getAccountNonce(*args.From, true, 0, b.logger) args.Nonce = (*hexutil.Uint64)(&nonce) } @@ -134,16 +152,16 @@ func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Tran } blockNr := types.NewBlockNumber(big.NewInt(0)) - estimated, err := e.EstimateGas(callArgs, &blockNr) + estimated, err := b.EstimateGas(callArgs, &blockNr) if err != nil { return args, err } args.Gas = &estimated - e.logger.Debug("estimate gas usage automatically", "gas", args.Gas) + b.logger.Debug("estimate gas usage automatically", "gas", args.Gas) } if args.ChainID == nil { - args.ChainID = (*hexutil.Big)(e.chainID) + args.ChainID = (*hexutil.Big)(b.chainID) } return args, nil @@ -153,14 +171,14 @@ func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Tran // If the pending value is true, it will iterate over the mempool (pending) // txs in order to compute and return the pending tx sequence. // Todo: include the ability to specify a blockNumber -func (e *EVMBackend) getAccountNonce(accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) { - queryClient := authtypes.NewQueryClient(e.clientCtx) +func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) { + queryClient := authtypes.NewQueryClient(b.clientCtx) res, err := queryClient.Account(types.ContextWithHeight(height), &authtypes.QueryAccountRequest{Address: sdk.AccAddress(accAddr.Bytes()).String()}) if err != nil { return 0, err } var acc authtypes.AccountI - if err := e.clientCtx.InterfaceRegistry.UnpackAny(res.Account, &acc); err != nil { + if err := b.clientCtx.InterfaceRegistry.UnpackAny(res.Account, &acc); err != nil { return 0, err } @@ -172,7 +190,7 @@ func (e *EVMBackend) getAccountNonce(accAddr common.Address, pending bool, heigh // the account retriever doesn't include the uncommitted transactions on the nonce so we need to // to manually add them. - pendingTxs, err := e.PendingTransactions() + pendingTxs, err := b.PendingTransactions() if err != nil { logger.Error("failed to fetch pending transactions", "error", err.Error()) return nonce, nil @@ -188,7 +206,7 @@ func (e *EVMBackend) getAccountNonce(accAddr common.Address, pending bool, heigh break } - sender, err := ethMsg.GetSender(e.chainID) + sender, err := ethMsg.GetSender(b.chainID) if err != nil { continue } @@ -201,6 +219,104 @@ func (e *EVMBackend) getAccountNonce(accAddr common.Address, pending bool, heigh return nonce, nil } +// output: targetOneFeeHistory +func (b *Backend) processBlock( + tendermintBlock *tmrpctypes.ResultBlock, + ethBlock *map[string]interface{}, + rewardPercentiles []float64, + tendermintBlockResult *tmrpctypes.ResultBlockResults, + targetOneFeeHistory *types.OneFeeHistory, +) error { + blockHeight := tendermintBlock.Block.Height + blockBaseFee, err := b.BaseFee(blockHeight) + if err != nil { + return err + } + + // set basefee + targetOneFeeHistory.BaseFee = blockBaseFee + + // set gas used ratio + gasLimitUint64, ok := (*ethBlock)["gasLimit"].(hexutil.Uint64) + if !ok { + return fmt.Errorf("invalid gas limit type: %T", (*ethBlock)["gasLimit"]) + } + + gasUsedBig, ok := (*ethBlock)["gasUsed"].(*hexutil.Big) + if !ok { + return fmt.Errorf("invalid gas used type: %T", (*ethBlock)["gasUsed"]) + } + + gasusedfloat, _ := new(big.Float).SetInt(gasUsedBig.ToInt()).Float64() + + if gasLimitUint64 <= 0 { + return fmt.Errorf("gasLimit of block height %d should be bigger than 0 , current gaslimit %d", blockHeight, gasLimitUint64) + } + + gasUsedRatio := gasusedfloat / float64(gasLimitUint64) + blockGasUsed := gasusedfloat + targetOneFeeHistory.GasUsedRatio = gasUsedRatio + + rewardCount := len(rewardPercentiles) + targetOneFeeHistory.Reward = make([]*big.Int, rewardCount) + for i := 0; i < rewardCount; i++ { + targetOneFeeHistory.Reward[i] = big.NewInt(0) + } + + // check tendermintTxs + tendermintTxs := tendermintBlock.Block.Txs + tendermintTxResults := tendermintBlockResult.TxsResults + tendermintTxCount := len(tendermintTxs) + + var sorter sortGasAndReward + + for i := 0; i < tendermintTxCount; i++ { + eachTendermintTx := tendermintTxs[i] + eachTendermintTxResult := tendermintTxResults[i] + + tx, err := b.clientCtx.TxConfig.TxDecoder()(eachTendermintTx) + if err != nil { + b.logger.Debug("failed to decode transaction in block", "height", blockHeight, "error", err.Error()) + continue + } + txGasUsed := uint64(eachTendermintTxResult.GasUsed) + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + continue + } + tx := ethMsg.AsTransaction() + reward := tx.EffectiveGasTipValue(blockBaseFee) + if reward == nil { + reward = big.NewInt(0) + } + sorter = append(sorter, txGasAndReward{gasUsed: txGasUsed, reward: reward}) + } + } + + // return an all zero row if there are no transactions to gather data from + ethTxCount := len(sorter) + if ethTxCount == 0 { + return nil + } + + sort.Sort(sorter) + + var txIndex int + sumGasUsed := sorter[0].gasUsed + + for i, p := range rewardPercentiles { + thresholdGasUsed := uint64(blockGasUsed * p / 100) + for sumGasUsed < thresholdGasUsed && txIndex < ethTxCount-1 { + txIndex++ + sumGasUsed += sorter[txIndex].gasUsed + } + targetOneFeeHistory.Reward[i] = sorter[txIndex].reward + } + + return nil +} + // AllTxLogsFromEvents parses all ethereum logs from cosmos events func AllTxLogsFromEvents(events []abci.Event) ([][]*ethtypes.Log, error) { allLogs := make([][]*ethtypes.Log, 0, 4) @@ -255,7 +371,7 @@ func ParseTxLogsFromEvent(event abci.Event) ([]*ethtypes.Log, error) { return evmtypes.LogsToEthereum(logs), nil } -func (e *EVMBackend) parseGasUnit(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) { +func (b *Backend) parseGasUnit(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) { var err error args.GasPrice, err = stratos.WeiToUstosBigInt(args.GasPrice) diff --git a/rpc/ethereum/backend/feebackend.go b/rpc/ethereum/backend/feebackend.go deleted file mode 100644 index e9926431..00000000 --- a/rpc/ethereum/backend/feebackend.go +++ /dev/null @@ -1,221 +0,0 @@ -package backend - -import ( - "fmt" - "math/big" - "sort" - - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/rpc" - - tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" - - rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" - evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" -) - -type ( - txGasAndReward struct { - gasUsed uint64 - reward *big.Int - } - sortGasAndReward []txGasAndReward -) - -func (s sortGasAndReward) Len() int { return len(s) } -func (s sortGasAndReward) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s sortGasAndReward) Less(i, j int) bool { - return s[i].reward.Cmp(s[j].reward) < 0 -} - -// output: targetOneFeeHistory -func (e *EVMBackend) processBlock( - tendermintBlock *tmrpctypes.ResultBlock, - ethBlock *map[string]interface{}, - rewardPercentiles []float64, - tendermintBlockResult *tmrpctypes.ResultBlockResults, - targetOneFeeHistory *rpctypes.OneFeeHistory) error { - blockHeight := tendermintBlock.Block.Height - blockBaseFee, err := e.BaseFee(blockHeight) - if err != nil { - return err - } - - // set basefee - targetOneFeeHistory.BaseFee = blockBaseFee - - // set gas used ratio - gasLimitUint64, ok := (*ethBlock)["gasLimit"].(hexutil.Uint64) - if !ok { - return fmt.Errorf("invalid gas limit type: %T", (*ethBlock)["gasLimit"]) - } - - gasUsedBig, ok := (*ethBlock)["gasUsed"].(*hexutil.Big) - if !ok { - return fmt.Errorf("invalid gas used type: %T", (*ethBlock)["gasUsed"]) - } - - gasusedfloat, _ := new(big.Float).SetInt(gasUsedBig.ToInt()).Float64() - - if gasLimitUint64 <= 0 { - return fmt.Errorf("gasLimit of block height %d should be bigger than 0 , current gaslimit %d", blockHeight, gasLimitUint64) - } - - gasUsedRatio := gasusedfloat / float64(gasLimitUint64) - blockGasUsed := gasusedfloat - targetOneFeeHistory.GasUsedRatio = gasUsedRatio - - rewardCount := len(rewardPercentiles) - targetOneFeeHistory.Reward = make([]*big.Int, rewardCount) - for i := 0; i < rewardCount; i++ { - targetOneFeeHistory.Reward[i] = big.NewInt(2000) - } - - // check tendermintTxs - tendermintTxs := tendermintBlock.Block.Txs - tendermintTxResults := tendermintBlockResult.TxsResults - tendermintTxCount := len(tendermintTxs) - sorter := make(sortGasAndReward, tendermintTxCount) - - for i := 0; i < tendermintTxCount; i++ { - eachTendermintTx := tendermintTxs[i] - eachTendermintTxResult := tendermintTxResults[i] - - tx, err := e.clientCtx.TxConfig.TxDecoder()(eachTendermintTx) - if err != nil { - e.logger.Debug("failed to decode transaction in block", "height", blockHeight, "error", err.Error()) - continue - } - txGasUsed := uint64(eachTendermintTxResult.GasUsed) - for _, msg := range tx.GetMsgs() { - ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) - if !ok { - continue - } - tx := ethMsg.AsTransaction() - reward := tx.EffectiveGasTipValue(blockBaseFee) - sorter[i] = txGasAndReward{gasUsed: txGasUsed, reward: reward} - break - } - } - sort.Sort(sorter) - - var txIndex int - sumGasUsed := uint64(0) - if len(sorter) > 0 { - sumGasUsed = sorter[0].gasUsed - } - for i, p := range rewardPercentiles { - thresholdGasUsed := uint64(blockGasUsed * p / 100) - for sumGasUsed < thresholdGasUsed && txIndex < tendermintTxCount-1 { - txIndex++ - sumGasUsed += sorter[txIndex].gasUsed - } - - chosenReward := big.NewInt(0) - if 0 <= txIndex && txIndex < len(sorter) { - chosenReward = sorter[txIndex].reward - } - targetOneFeeHistory.Reward[i] = chosenReward - } - - return nil -} - -// FeeHistory returns data relevant for fee estimation based on the specified range of blocks. -func (e *EVMBackend) FeeHistory( - userBlockCount rpc.DecimalOrHex, // number blocks to fetch, maximum is 100 - lastBlock rpc.BlockNumber, // the block to start search , to oldest - rewardPercentiles []float64, // percentiles to fetch reward -) (*rpctypes.FeeHistoryResult, error) { - blockEnd := int64(lastBlock) - - if blockEnd <= 0 { - blockNumber, err := e.BlockNumber() - if err != nil { - return nil, err - } - blockEnd = int64(blockNumber) - } - userBlockCountInt := int64(userBlockCount) - maxBlockCount := int64(e.cfg.JSONRPC.FeeHistoryCap) - if userBlockCountInt > maxBlockCount { - return nil, fmt.Errorf("FeeHistory user block count %d higher than %d", userBlockCountInt, maxBlockCount) - } - blockStart := blockEnd - userBlockCountInt - if blockStart < 0 { - blockStart = 0 - } - - blockCount := blockEnd - blockStart - - oldestBlock := (*hexutil.Big)(big.NewInt(blockStart)) - - // prepare space - reward := make([][]*hexutil.Big, blockCount) - rewardCount := len(rewardPercentiles) - for i := 0; i < int(blockCount); i++ { - reward[i] = make([]*hexutil.Big, rewardCount) - } - thisBaseFee := make([]*hexutil.Big, blockCount) - thisGasUsedRatio := make([]float64, blockCount) - - // rewards should only be calculated if reward percentiles were included - calculateRewards := rewardCount != 0 - - // fetch block - for blockID := blockStart; blockID < blockEnd; blockID++ { - index := int32(blockID - blockStart) - // eth block - ethBlock, err := e.GetBlockByNumber(rpctypes.BlockNumber(blockID), true) - if ethBlock == nil { - return nil, err - } - - // tendermint block - tendermintblock, err := e.GetTendermintBlockByNumber(rpctypes.BlockNumber(blockID)) - if tendermintblock == nil { - return nil, err - } - - // tendermint block result - tendermintBlockResult, err := e.clientCtx.Client.BlockResults(e.ctx, &tendermintblock.Block.Height) - if tendermintBlockResult == nil { - e.logger.Debug("block result not found", "height", tendermintblock.Block.Height, "error", err.Error()) - return nil, err - } - - oneFeeHistory := rpctypes.OneFeeHistory{} - err = e.processBlock(tendermintblock, ðBlock, rewardPercentiles, tendermintBlockResult, &oneFeeHistory) - if err != nil { - return nil, err - } - - // copy - thisBaseFee[index] = (*hexutil.Big)(oneFeeHistory.BaseFee) - thisGasUsedRatio[index] = oneFeeHistory.GasUsedRatio - if calculateRewards { - for j := 0; j < rewardCount; j++ { - reward[index][j] = (*hexutil.Big)(oneFeeHistory.Reward[j]) - if reward[index][j] == nil { - reward[index][j] = (*hexutil.Big)(big.NewInt(0)) - } - } - } - } - - feeHistory := rpctypes.FeeHistoryResult{ - OldestBlock: oldestBlock, - BaseFee: thisBaseFee, - GasUsedRatio: thisGasUsedRatio, - } - - if calculateRewards { - feeHistory.Reward = reward - } - - return &feeHistory, nil -} diff --git a/rpc/ethereum/namespaces/debug/api.go b/rpc/namespaces/ethereum/debug/api.go similarity index 98% rename from rpc/ethereum/namespaces/debug/api.go rename to rpc/namespaces/ethereum/debug/api.go index 1f782738..363f12ab 100644 --- a/rpc/ethereum/namespaces/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -14,21 +14,21 @@ import ( "time" "github.com/davecgh/go-spew/spew" + stderrors "github.com/pkg/errors" "github.com/tendermint/tendermint/libs/log" tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - stderrors "github.com/pkg/errors" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/rlp" - "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" - rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/rpc/backend" + rpctypes "github.com/stratosnet/stratos-chain/rpc/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) @@ -45,7 +45,7 @@ type HandlerT struct { type API struct { ctx *server.Context logger log.Logger - backend backend.Backend + backend backend.EVMBackend clientCtx client.Context queryClient *rpctypes.QueryClient handler *HandlerT @@ -54,7 +54,7 @@ type API struct { // NewAPI creates a new API definition for the tracing methods of the Ethereum service. func NewAPI( ctx *server.Context, - backend backend.Backend, + backend backend.EVMBackend, clientCtx client.Context, ) *API { return &API{ diff --git a/rpc/ethereum/namespaces/debug/trace.go b/rpc/namespaces/ethereum/debug/trace.go similarity index 100% rename from rpc/ethereum/namespaces/debug/trace.go rename to rpc/namespaces/ethereum/debug/trace.go diff --git a/rpc/ethereum/namespaces/debug/trace_fallback.go b/rpc/namespaces/ethereum/debug/trace_fallback.go similarity index 100% rename from rpc/ethereum/namespaces/debug/trace_fallback.go rename to rpc/namespaces/ethereum/debug/trace_fallback.go diff --git a/rpc/ethereum/namespaces/debug/utils.go b/rpc/namespaces/ethereum/debug/utils.go similarity index 100% rename from rpc/ethereum/namespaces/debug/utils.go rename to rpc/namespaces/ethereum/debug/utils.go diff --git a/rpc/ethereum/namespaces/eth/api.go b/rpc/namespaces/ethereum/eth/api.go similarity index 99% rename from rpc/ethereum/namespaces/eth/api.go rename to rpc/namespaces/ethereum/eth/api.go index d26159d7..853c213a 100644 --- a/rpc/ethereum/namespaces/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -34,8 +34,8 @@ import ( "github.com/stratosnet/stratos-chain/crypto/hd" "github.com/stratosnet/stratos-chain/ethereum/eip712" - "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" - rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/rpc/backend" + rpctypes "github.com/stratosnet/stratos-chain/rpc/types" stratos "github.com/stratosnet/stratos-chain/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) @@ -47,7 +47,7 @@ type PublicAPI struct { queryClient *rpctypes.QueryClient chainIDEpoch *big.Int logger log.Logger - backend backend.Backend + backend backend.EVMBackend nonceLock *rpctypes.AddrLocker signer ethtypes.Signer } @@ -56,7 +56,7 @@ type PublicAPI struct { func NewPublicAPI( logger log.Logger, clientCtx client.Context, - backend backend.Backend, + backend backend.EVMBackend, nonceLock *rpctypes.AddrLocker, ) *PublicAPI { eip155ChainID, err := stratos.ParseChainID(clientCtx.ChainID) @@ -192,7 +192,7 @@ func (e *PublicAPI) Hashrate() hexutil.Uint64 { return 0 } -// GasPrice returns the current gas price based on Stratos's gas price oracle. +// GasPrice returns the current gas price based on stratos's gas price oracle. func (e *PublicAPI) GasPrice() (*hexutil.Big, error) { e.logger.Debug("eth_gasPrice") var ( @@ -1095,7 +1095,7 @@ func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, block Balance: (*hexutil.Big)(balance.BigInt()), CodeHash: common.HexToHash(res.CodeHash), Nonce: hexutil.Uint64(res.Nonce), - StorageHash: common.Hash{}, // NOTE: Stratos doesn't have a storage hash. TODO: implement? + StorageHash: common.Hash{}, // NOTE: stratos doesn't have a storage hash. TODO: implement? StorageProof: storageProofs, }, nil } diff --git a/rpc/ethereum/namespaces/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go similarity index 95% rename from rpc/ethereum/namespaces/eth/filters/api.go rename to rpc/namespaces/ethereum/eth/filters/api.go index b0a458c1..11f6867c 100644 --- a/rpc/ethereum/namespaces/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -6,20 +6,19 @@ import ( "sync" "time" - "github.com/cosmos/cosmos-sdk/client" - "github.com/stratosnet/stratos-chain/rpc/ethereum/types" - "github.com/tendermint/tendermint/libs/log" - coretypes "github.com/tendermint/tendermint/rpc/core/types" rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" + "github.com/stratosnet/stratos-chain/rpc/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) @@ -144,11 +143,20 @@ func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID { continue } - txHash := common.BytesToHash(tmtypes.Tx(data.Tx).Hash()) + tx, err := api.clientCtx.TxConfig.TxDecoder()(data.Tx) + if err != nil { + api.logger.Debug("fail to decode tx", "error", err.Error()) + continue + } api.filtersMu.Lock() if f, found := api.filters[pendingTxSub.ID()]; found { - f.hashes = append(f.hashes, txHash) + for _, msg := range tx.GetMsgs() { + ethTx, ok := msg.(*evmtypes.MsgEthereumTx) + if ok { + f.hashes = append(f.hashes, common.HexToHash(ethTx.Hash)) + } + } } api.filtersMu.Unlock() case <-errCh: @@ -201,13 +209,17 @@ func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Su continue } - txHash := common.BytesToHash(tmtypes.Tx(data.Tx).Hash()) - - // To keep the original behavior, send a single tx hash in one notification. - // TODO(rjl493456442) Send a batch of tx hashes in one notification - err = notifier.Notify(rpcSub.ID, txHash) + tx, err := api.clientCtx.TxConfig.TxDecoder()(data.Tx) if err != nil { - return + api.logger.Debug("fail to decode tx", "error", err.Error()) + continue + } + + for _, msg := range tx.GetMsgs() { + ethTx, ok := msg.(*evmtypes.MsgEthereumTx) + if ok { + _ = notifier.Notify(rpcSub.ID, common.HexToHash(ethTx.Hash)) + } } case <-rpcSub.Err(): pendingTxSub.Unsubscribe(api.events) @@ -317,11 +329,7 @@ func (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, er // TODO: fetch bloom from events header := types.EthHeaderFromTendermint(data.Header, ethtypes.Bloom{}, baseFee) - err = notifier.Notify(rpcSub.ID, header) - if err != nil { - headersSub.err <- err - return - } + _ = notifier.Notify(rpcSub.ID, header) case <-rpcSub.Err(): headersSub.Unsubscribe(api.events) return @@ -384,10 +392,7 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit filters.FilterCriteri logs := FilterLogs(evmtypes.LogsToEthereum(txResponse.Logs), crit.FromBlock, crit.ToBlock, crit.Addresses, crit.Topics) for _, log := range logs { - err = notifier.Notify(rpcSub.ID, log) - if err != nil { - return - } + _ = notifier.Notify(rpcSub.ID, log) } case <-rpcSub.Err(): // client send an unsubscribe request logsSub.Unsubscribe(api.events) diff --git a/rpc/ethereum/namespaces/eth/filters/filter_system.go b/rpc/namespaces/ethereum/eth/filters/filter_system.go similarity index 100% rename from rpc/ethereum/namespaces/eth/filters/filter_system.go rename to rpc/namespaces/ethereum/eth/filters/filter_system.go index 12087d4e..a8b0ec72 100644 --- a/rpc/ethereum/namespaces/eth/filters/filter_system.go +++ b/rpc/namespaces/ethereum/eth/filters/filter_system.go @@ -15,13 +15,13 @@ import ( rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" tmtypes "github.com/tendermint/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stratosnet/stratos-chain/rpc/ethereum/pubsub" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) diff --git a/rpc/ethereum/namespaces/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go similarity index 99% rename from rpc/ethereum/namespaces/eth/filters/filters.go rename to rpc/namespaces/ethereum/eth/filters/filters.go index 6766ab6d..1b6cb647 100644 --- a/rpc/ethereum/namespaces/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -5,8 +5,6 @@ import ( "encoding/binary" "math/big" - "github.com/stratosnet/stratos-chain/rpc/ethereum/types" - "github.com/pkg/errors" "github.com/tendermint/tendermint/libs/log" @@ -14,6 +12,8 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth/filters" + + "github.com/stratosnet/stratos-chain/rpc/types" ) // BloomIV represents the bit indexes and value inside the bloom filter that belong diff --git a/rpc/ethereum/namespaces/eth/filters/subscription.go b/rpc/namespaces/ethereum/eth/filters/subscription.go similarity index 96% rename from rpc/ethereum/namespaces/eth/filters/subscription.go rename to rpc/namespaces/ethereum/eth/filters/subscription.go index e8881177..d9b22798 100644 --- a/rpc/ethereum/namespaces/eth/filters/subscription.go +++ b/rpc/namespaces/ethereum/eth/filters/subscription.go @@ -3,12 +3,12 @@ package filters import ( "time" + coretypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" - - coretypes "github.com/tendermint/tendermint/rpc/core/types" ) // Subscription defines a wrapper for the private subscription @@ -32,7 +32,7 @@ func (s Subscription) ID() rpc.ID { } // Unsubscribe from the current subscription to Tendermint Websocket. It sends an error to the -// subscription error channel if unsubscription fails. +// subscription error channel if unsubscribe fails. func (s *Subscription) Unsubscribe(es *EventSystem) { go func() { uninstallLoop: diff --git a/rpc/ethereum/namespaces/eth/filters/utils.go b/rpc/namespaces/ethereum/eth/filters/utils.go similarity index 100% rename from rpc/ethereum/namespaces/eth/filters/utils.go rename to rpc/namespaces/ethereum/eth/filters/utils.go diff --git a/rpc/ethereum/namespaces/miner/api.go b/rpc/namespaces/ethereum/miner/api.go similarity index 96% rename from rpc/ethereum/namespaces/miner/api.go rename to rpc/namespaces/ethereum/miner/api.go index 0cf2ca2a..6ab5e2f2 100644 --- a/rpc/ethereum/namespaces/miner/api.go +++ b/rpc/namespaces/ethereum/miner/api.go @@ -3,26 +3,24 @@ package miner import ( "math/big" - "github.com/cosmos/cosmos-sdk/client" + "github.com/tendermint/tendermint/libs/log" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/server" sdkconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/tendermint/tendermint/libs/log" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" - rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/rpc/backend" + rpctypes "github.com/stratosnet/stratos-chain/rpc/types" "github.com/stratosnet/stratos-chain/server/config" ) @@ -31,14 +29,14 @@ type API struct { ctx *server.Context logger log.Logger clientCtx client.Context - backend backend.Backend + backend backend.EVMBackend } // NewPrivateAPI creates an instance of the Miner API. func NewPrivateAPI( ctx *server.Context, clientCtx client.Context, - backend backend.Backend, + backend backend.EVMBackend, ) *API { return &API{ ctx: ctx, diff --git a/rpc/ethereum/namespaces/miner/unsupported.go b/rpc/namespaces/ethereum/miner/unsupported.go similarity index 97% rename from rpc/ethereum/namespaces/miner/unsupported.go rename to rpc/namespaces/ethereum/miner/unsupported.go index 81c08f4e..6485383f 100644 --- a/rpc/ethereum/namespaces/miner/unsupported.go +++ b/rpc/namespaces/ethereum/miner/unsupported.go @@ -7,7 +7,7 @@ import ( ) // GetHashrate returns the current hashrate for local CPU miner and remote miner. -// Unsupported in Stratos +// Unsupported in stratos func (api *API) GetHashrate() uint64 { api.logger.Debug("miner_getHashrate") api.logger.Debug("Unsupported rpc function: miner_getHashrate") @@ -15,7 +15,7 @@ func (api *API) GetHashrate() uint64 { } // SetExtra sets the extra data string that is included when this miner mines a block. -// Unsupported in Stratos +// Unsupported in stratos func (api *API) SetExtra(extra string) (bool, error) { api.logger.Debug("miner_setExtra") api.logger.Debug("Unsupported rpc function: miner_setExtra") diff --git a/rpc/ethereum/namespaces/net/api.go b/rpc/namespaces/ethereum/net/api.go similarity index 100% rename from rpc/ethereum/namespaces/net/api.go rename to rpc/namespaces/ethereum/net/api.go diff --git a/rpc/ethereum/namespaces/personal/api.go b/rpc/namespaces/ethereum/personal/api.go similarity index 98% rename from rpc/ethereum/namespaces/personal/api.go rename to rpc/namespaces/ethereum/personal/api.go index e2a26e00..62d61272 100644 --- a/rpc/ethereum/namespaces/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -20,7 +20,7 @@ import ( "github.com/stratosnet/stratos-chain/crypto/ethsecp256k1" "github.com/stratosnet/stratos-chain/crypto/hd" - "github.com/stratosnet/stratos-chain/rpc/ethereum/backend" + "github.com/stratosnet/stratos-chain/rpc/backend" stratos "github.com/stratosnet/stratos-chain/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) @@ -28,13 +28,17 @@ import ( // PrivateAccountAPI is the personal_ prefixed set of APIs in the Web3 JSON-RPC spec. type PrivateAccountAPI struct { clientCtx client.Context - backend backend.Backend + backend backend.EVMBackend logger log.Logger hdPathIter stratos.HDPathIterator } // NewAPI creates an instance of the public Personal Eth API. -func NewAPI(logger log.Logger, clientCtx client.Context, backend backend.Backend) *PrivateAccountAPI { +func NewAPI( + logger log.Logger, + clientCtx client.Context, + backend backend.EVMBackend, +) *PrivateAccountAPI { cfg := stratos.GetConfig() basePath := cfg.GetFullBIP44Path() diff --git a/rpc/ethereum/namespaces/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go similarity index 96% rename from rpc/ethereum/namespaces/txpool/api.go rename to rpc/namespaces/ethereum/txpool/api.go index 223c2b05..8517acdb 100644 --- a/rpc/ethereum/namespaces/txpool/api.go +++ b/rpc/namespaces/ethereum/txpool/api.go @@ -5,7 +5,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + "github.com/stratosnet/stratos-chain/rpc/types" ) // PublicAPI offers and API for the transaction pool. It only operates on data that is non-confidential. diff --git a/rpc/ethereum/namespaces/web3/api.go b/rpc/namespaces/ethereum/web3/api.go similarity index 84% rename from rpc/ethereum/namespaces/web3/api.go rename to rpc/namespaces/ethereum/web3/api.go index b64cad7e..f1b98d45 100644 --- a/rpc/ethereum/namespaces/web3/api.go +++ b/rpc/namespaces/ethereum/web3/api.go @@ -21,6 +21,6 @@ func (a *PublicAPI) ClientVersion() string { } // Sha3 returns the keccak-256 hash of the passed-in input. -func (a *PublicAPI) Sha3(input hexutil.Bytes) hexutil.Bytes { - return crypto.Keccak256(input) +func (a *PublicAPI) Sha3(input string) hexutil.Bytes { + return crypto.Keccak256(hexutil.Bytes(input)) } diff --git a/rpc/ethereum/types/addrlock.go b/rpc/types/addrlock.go similarity index 100% rename from rpc/ethereum/types/addrlock.go rename to rpc/types/addrlock.go diff --git a/rpc/ethereum/types/block.go b/rpc/types/block.go similarity index 100% rename from rpc/ethereum/types/block.go rename to rpc/types/block.go index 0b3c6975..809505b3 100644 --- a/rpc/ethereum/types/block.go +++ b/rpc/types/block.go @@ -12,11 +12,11 @@ import ( "github.com/spf13/cast" "google.golang.org/grpc/metadata" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - stratos "github.com/stratosnet/stratos-chain/types" ) diff --git a/rpc/ethereum/types/query_client.go b/rpc/types/query_client.go similarity index 91% rename from rpc/ethereum/types/query_client.go rename to rpc/types/query_client.go index 4edd0e43..1594a11d 100644 --- a/rpc/ethereum/types/query_client.go +++ b/rpc/types/query_client.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" - //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" ) // QueryClient defines a gRPC Client used for: @@ -21,7 +20,6 @@ import ( type QueryClient struct { tx.ServiceClient evmtypes.QueryClient - //FeeMarket feemarkettypes.QueryClient } // NewQueryClient creates a new gRPC query client @@ -29,7 +27,6 @@ func NewQueryClient(clientCtx client.Context) *QueryClient { return &QueryClient{ ServiceClient: tx.NewServiceClient(clientCtx), QueryClient: evmtypes.NewQueryClient(clientCtx), - //FeeMarket: feemarkettypes.NewQueryClient(clientCtx), } } diff --git a/rpc/ethereum/types/types.go b/rpc/types/types.go similarity index 100% rename from rpc/ethereum/types/types.go rename to rpc/types/types.go diff --git a/rpc/ethereum/types/utils.go b/rpc/types/utils.go similarity index 99% rename from rpc/ethereum/types/utils.go rename to rpc/types/utils.go index 29bb9280..21dfb729 100644 --- a/rpc/ethereum/types/utils.go +++ b/rpc/types/utils.go @@ -14,13 +14,12 @@ import ( "github.com/cosmos/cosmos-sdk/client" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" - //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" ethtypes "github.com/ethereum/go-ethereum/core/types" + + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) // RawTxToEthTx returns a evm MsgEthereum transaction from raw tx bytes. diff --git a/rpc/websockets.go b/rpc/websockets.go index 46b9fba7..1bc2e73b 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -11,24 +11,25 @@ import ( "net/http" "sync" - "github.com/cosmos/cosmos-sdk/client" "github.com/gorilla/mux" "github.com/gorilla/websocket" "github.com/pkg/errors" + "github.com/tendermint/tendermint/libs/log" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - "github.com/tendermint/tendermint/libs/log" - rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" - tmtypes "github.com/tendermint/tendermint/types" - - rpcfilters "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/eth/filters" "github.com/stratosnet/stratos-chain/rpc/ethereum/pubsub" - "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + rpcfilters "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/eth/filters" + "github.com/stratosnet/stratos-chain/rpc/types" "github.com/stratosnet/stratos-chain/server/config" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" ) diff --git a/server/start.go b/server/start.go index a5c42f9e..87a695e4 100644 --- a/server/start.go +++ b/server/start.go @@ -11,11 +11,7 @@ import ( "strings" "time" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/spf13/cobra" - "google.golang.org/grpc" abciserver "github.com/tendermint/tendermint/abci/server" @@ -28,20 +24,21 @@ import ( "github.com/tendermint/tendermint/rpc/client/local" dbm "github.com/tendermint/tm-db" - "github.com/cosmos/cosmos-sdk/server/rosetta" - crgserver "github.com/cosmos/cosmos-sdk/server/rosetta/lib/server" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/api" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servergrpc "github.com/cosmos/cosmos-sdk/server/grpc" + "github.com/cosmos/cosmos-sdk/server/rosetta" + crgserver "github.com/cosmos/cosmos-sdk/server/rosetta/lib/server" "github.com/cosmos/cosmos-sdk/server/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - ethdebug "github.com/stratosnet/stratos-chain/rpc/ethereum/namespaces/debug" + ethdebug "github.com/stratosnet/stratos-chain/rpc/namespaces/ethereum/debug" "github.com/stratosnet/stratos-chain/server/config" srvflags "github.com/stratosnet/stratos-chain/server/flags" ) @@ -130,7 +127,7 @@ which accepts a path for the resulting pprof file. cmd.Flags().String(srvflags.Address, "tcp://0.0.0.0:26658", "Listen address") cmd.Flags().String(srvflags.Transport, "socket", "Transport protocol: socket, grpc") cmd.Flags().String(srvflags.TraceStore, "", "Enable KVStore tracing to an output file") - cmd.Flags().String(server.FlagMinGasPrices, "", "Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 0.01photon;0.0001stake)") + cmd.Flags().String(server.FlagMinGasPrices, "", "Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 0.01stos)") cmd.Flags().IntSlice(server.FlagUnsafeSkipUpgrades, []int{}, "Skip a set of upgrade heights to continue the old binary") cmd.Flags().Uint64(server.FlagHaltHeight, 0, "Block height at which to gracefully halt the chain and shutdown the node") cmd.Flags().Uint64(server.FlagHaltTime, 0, "Minimum block time (in Unix seconds) at which to gracefully halt the chain and shutdown the node") @@ -157,7 +154,7 @@ which accepts a path for the resulting pprof file. cmd.Flags().String(srvflags.JSONRPCAddress, config.DefaultJSONRPCAddress, "the JSON-RPC server address to listen on") cmd.Flags().String(srvflags.JSONWsAddress, config.DefaultJSONRPCWsAddress, "the JSON-RPC WS server address to listen on") cmd.Flags().Uint64(srvflags.JSONRPCGasCap, config.DefaultGasCap, "Sets a cap on gas that can be used in eth_call/estimateGas unit is ustos (0=infinite)") - cmd.Flags().Float64(srvflags.JSONRPCTxFeeCap, config.DefaultTxFeeCap, "Sets a cap on transaction fee that can be sent via the RPC APIs (1 = default 1 photon)") + cmd.Flags().Float64(srvflags.JSONRPCTxFeeCap, config.DefaultTxFeeCap, "Sets a cap on transaction fee that can be sent via the RPC APIs (1 = default 1 ustos)") cmd.Flags().Int32(srvflags.JSONRPCFilterCap, config.DefaultFilterCap, "Sets the global cap for total number of filters that can be created") cmd.Flags().Duration(srvflags.JSONRPCEVMTimeout, config.DefaultEVMTimeout, "Sets a timeout used for eth_call (0=infinite)") cmd.Flags().Duration(srvflags.JSONRPCHTTPTimeout, config.DefaultHTTPTimeout, "Sets a read/write timeout for json-rpc http server (0=infinite)") diff --git a/x/evm/client/cli/feemarket_query.go b/x/evm/client/cli/feemarket_query.go index 62f532cd..b080db0c 100644 --- a/x/evm/client/cli/feemarket_query.go +++ b/x/evm/client/cli/feemarket_query.go @@ -122,7 +122,7 @@ If the height is not provided, it will use the latest height from context.`, queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.QueryBaseFee(ctx, &types.QueryBaseFeeRequest{}) + res, err := queryClient.BaseFeeParam(ctx, &types.QueryBaseFeeRequest{}) if err != nil { return err } diff --git a/x/evm/client/cli/query.go b/x/evm/client/cli/query.go index e15f61d7..060e0481 100644 --- a/x/evm/client/cli/query.go +++ b/x/evm/client/cli/query.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + rpctypes "github.com/stratosnet/stratos-chain/rpc/types" "github.com/stratosnet/stratos-chain/x/evm/types" ) diff --git a/x/evm/client/cli/tx.go b/x/evm/client/cli/tx.go index 50cca48e..466fd98e 100644 --- a/x/evm/client/cli/tx.go +++ b/x/evm/client/cli/tx.go @@ -5,14 +5,16 @@ import ( "fmt" "os" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/input" + "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/pkg/errors" - "github.com/spf13/cobra" - rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" + rpctypes "github.com/stratosnet/stratos-chain/rpc/types" "github.com/stratosnet/stratos-chain/x/evm/types" ) diff --git a/x/evm/client/rest/rest.go b/x/evm/client/rest/rest.go index c11457ef..c6927aa5 100644 --- a/x/evm/client/rest/rest.go +++ b/x/evm/client/rest/rest.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/gorilla/mux" - "github.com/stratosnet/stratos-chain/x/evm/types" "github.com/cosmos/cosmos-sdk/client" clientrest "github.com/cosmos/cosmos-sdk/client/rest" @@ -19,8 +18,8 @@ import ( "github.com/ethereum/go-ethereum/common" - rpctypes "github.com/stratosnet/stratos-chain/rpc/ethereum/types" - //feemarkettypes "github.com/stratosnet/stratos-chain/x/feemarket/types" + rpctypes "github.com/stratosnet/stratos-chain/rpc/types" + "github.com/stratosnet/stratos-chain/x/evm/types" ) // RegisterTxRoutes - Central function to define routes that get registered by the main application @@ -84,7 +83,7 @@ func getEthTransactionByHash(clientCtx client.Context, hashHex string) ([]byte, } client := types.NewQueryClient(clientCtx) - res, err := client.QueryBaseFee(context.Background(), &types.QueryBaseFeeRequest{}) + res, err := client.BaseFee(context.Background(), &types.QueryBaseFeeRequest{}) if err != nil { return nil, err } diff --git a/x/evm/keeper/abci.go b/x/evm/keeper/abci.go index 63a5d12a..5c3a1cb6 100644 --- a/x/evm/keeper/abci.go +++ b/x/evm/keeper/abci.go @@ -22,7 +22,7 @@ func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { return } - k.SetBaseFee(ctx, baseFee) + k.SetBaseFeeParam(ctx, baseFee) // Store current base fee in event ctx.EventManager().EmitEvents(sdk.Events{ diff --git a/x/evm/keeper/eip1559.go b/x/evm/keeper/eip1559.go index f5d985fd..ce1a0cdc 100644 --- a/x/evm/keeper/eip1559.go +++ b/x/evm/keeper/eip1559.go @@ -16,19 +16,24 @@ import ( func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int { params := k.GetParams(ctx) - // Ignore the calculation if not enable + // Ignore the calculation if not enabled if !params.FeeMarketParams.IsBaseFeeEnabled(ctx.BlockHeight()) { return nil } consParams := ctx.ConsensusParams() - // If the current block is the first EIP-1559 block, return the InitialBaseFee. + // If the current block is the first EIP-1559 block, return the base fee + // defined in the parameters (DefaultBaseFee if it hasn't been changed by + // governance). if ctx.BlockHeight() == params.FeeMarketParams.EnableHeight { return params.FeeMarketParams.BaseFee.BigInt() } // get the block gas used and the base fee values for the parent block. + // NOTE: this is not the parent's base fee but the current block's base fee, + // as it is retrieved from the transient store, which is committed to the + // persistent KVStore after EndBlock (ABCI Commit). parentBaseFee := params.FeeMarketParams.BaseFee.BigInt() if parentBaseFee == nil { return nil @@ -37,6 +42,8 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int { parentGasUsed := k.GetBlockGasUsed(ctx) gasLimit := new(big.Int).SetUint64(math.MaxUint64) + + // NOTE: a MaxGas equal to -1 means that block gas is unlimited if consParams != nil && consParams.Block.MaxGas > -1 { gasLimit = big.NewInt(consParams.Block.MaxGas) } @@ -46,6 +53,8 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int { return nil } + // CONTRACT: ElasticityMultiplier cannot be 0 as it's checked in the params + // validation parentGasTarget := parentGasTargetBig.Uint64() baseFeeChangeDenominator := new(big.Int).SetUint64(uint64(params.FeeMarketParams.BaseFeeChangeDenominator)) diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index cf0b51f2..4833114b 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -583,11 +583,28 @@ func (k *Keeper) traceTx( } // BaseFee implements the Query/BaseFee gRPC method -func (k Keeper) QueryBaseFee(c context.Context, _ *types.QueryBaseFeeRequest) (*types.QueryBaseFeeResponse, error) { +func (k Keeper) BaseFee(c context.Context, _ *types.QueryBaseFeeRequest) (*types.QueryBaseFeeResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + params := k.GetParams(ctx) + ethCfg := params.ChainConfig.EthereumConfig(k.eip155ChainID) + baseFee := k.GetBaseFee(ctx, ethCfg) + + res := &types.QueryBaseFeeResponse{} + if baseFee != nil { + aux := sdk.NewIntFromBigInt(baseFee) + res.BaseFee = &aux + } + + return res, nil +} + +// BaseFeeParam implements the Query/BaseFeeParam gRPC method +func (k Keeper) BaseFeeParam(c context.Context, _ *types.QueryBaseFeeRequest) (*types.QueryBaseFeeResponse, error) { ctx := sdk.UnwrapSDKContext(c) res := &types.QueryBaseFeeResponse{} - baseFee := k.GetBaseFee(ctx) + baseFee := k.GetBaseFeeParam(ctx) if baseFee != nil { aux := sdk.NewIntFromBigInt(baseFee) diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 584ebb9b..58db2c11 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -289,11 +289,11 @@ func (k *Keeper) GetBalance(ctx sdk.Context, addr common.Address) *big.Int { // - `nil`: london hardfork not enabled. // - `0`: london hardfork enabled but feemarket is not enabled. // - `n`: both london hardfork and feemarket are enabled. -func (k Keeper) BaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int { +func (k Keeper) GetBaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int { if !types.IsLondon(ethCfg, ctx.BlockHeight()) { return nil } - baseFee := k.GetBaseFee(ctx) + baseFee := k.GetBaseFeeParam(ctx) if baseFee == nil { // return 0 if feemarket not enabled. baseFee = big.NewInt(0) diff --git a/x/evm/keeper/params.go b/x/evm/keeper/params.go index 04dd23e6..0d7e12be 100644 --- a/x/evm/keeper/params.go +++ b/x/evm/keeper/params.go @@ -24,9 +24,9 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { // Required by EIP1559 base fee calculation. // ---------------------------------------------------------------------------- -// GetBaseFee get's the base fee from the paramSpace +// GetBaseFeeParam get's the base fee from the paramSpace // return nil if base fee is not enabled -func (k Keeper) GetBaseFee(ctx sdk.Context) *big.Int { +func (k Keeper) GetBaseFeeParam(ctx sdk.Context) *big.Int { params := k.GetParams(ctx) if params.FeeMarketParams.NoBaseFee { return nil @@ -35,7 +35,7 @@ func (k Keeper) GetBaseFee(ctx sdk.Context) *big.Int { return params.FeeMarketParams.BaseFee.BigInt() } -// SetBaseFee set's the base fee in the paramSpace -func (k Keeper) SetBaseFee(ctx sdk.Context, baseFee *big.Int) { +// SetBaseFeeParam set's the base fee in the paramSpace +func (k Keeper) SetBaseFeeParam(ctx sdk.Context, baseFee *big.Int) { k.paramSpace.Set(ctx, types.ParamStoreKeyBaseFee, sdk.NewIntFromBigInt(baseFee)) } diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index f1920cc7..f9310756 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -46,7 +46,7 @@ func (k *Keeper) EVMConfig(ctx sdk.Context) (*types.EVMConfig, error) { return nil, sdkerrors.Wrap(err, "failed to obtain coinbase address") } - baseFee := k.BaseFee(ctx, ethCfg) + baseFee := k.GetBaseFee(ctx, ethCfg) return &types.EVMConfig{ Params: params, ChainConfig: ethCfg, @@ -55,7 +55,7 @@ func (k *Keeper) EVMConfig(ctx sdk.Context) (*types.EVMConfig, error) { }, nil } -// TxConfig load `TxConfig` from current transient storage +// TxConfig loads `TxConfig` from current transient storage func (k *Keeper) TxConfig(ctx sdk.Context, txHash common.Hash) statedb.TxConfig { return statedb.NewTxConfig( common.BytesToHash(ctx.HeaderHash()), // BlockHash diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go index bb4c9ae8..4dd94445 100644 --- a/x/evm/keeper/statedb.go +++ b/x/evm/keeper/statedb.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/ethereum/go-ethereum/common" stratos "github.com/stratosnet/stratos-chain/types" diff --git a/x/evm/keeper/utils.go b/x/evm/keeper/utils.go index 8e1ad026..d6e0f5ca 100644 --- a/x/evm/keeper/utils.go +++ b/x/evm/keeper/utils.go @@ -57,7 +57,7 @@ func (k Keeper) DeductTxCostsFromUserBalance( feeMktParams := k.GetParams(ctx).FeeMarketParams if london && !feeMktParams.NoBaseFee && txData.TxType() == ethtypes.DynamicFeeTxType { - baseFee := k.GetBaseFee(ctx) + baseFee := k.GetBaseFeeParam(ctx) if txData.GetGasFeeCap().Cmp(baseFee) < 0 { return nil, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "the tx gasfeecap is lower than the tx baseFee: %s (gasfeecap), %s (basefee) ", txData.GetGasFeeCap(), baseFee) } diff --git a/x/evm/simulation/decoder.go b/x/evm/simulation/decoder.go index 8e4d206a..5ab15e3f 100644 --- a/x/evm/simulation/decoder.go +++ b/x/evm/simulation/decoder.go @@ -12,18 +12,18 @@ import ( ) // NewDecodeStore returns a decoder function closure that unmarshals the KVPair's -// Value to the corresponding evm type. +// value to the corresponding EVM type. func NewDecodeStore() func(kvA, kvB kv.Pair) string { return func(kvA, kvB kv.Pair) string { switch { case bytes.Equal(kvA.Key[:1], types.KeyPrefixStorage): - storageHashA := common.BytesToHash(kvA.Value).Hex() - storageHashB := common.BytesToHash(kvB.Value).Hex() + storageA := common.BytesToHash(kvA.Value).Hex() + storageB := common.BytesToHash(kvB.Value).Hex() - return fmt.Sprintf("%v\n%v", storageHashA, storageHashB) + return fmt.Sprintf("%v\n%v", storageA, storageB) case bytes.Equal(kvA.Key[:1], types.KeyPrefixCode): - codeHashA := common.BytesToHash(kvA.Value).Hex() - codeHashB := common.BytesToHash(kvB.Value).Hex() + codeHashA := common.Bytes2Hex(kvA.Value) + codeHashB := common.Bytes2Hex(kvB.Value) return fmt.Sprintf("%v\n%v", codeHashA, codeHashB) default: diff --git a/x/evm/simulation/genesis.go b/x/evm/simulation/genesis.go index 5fc3b122..7cd73a3c 100644 --- a/x/evm/simulation/genesis.go +++ b/x/evm/simulation/genesis.go @@ -10,23 +10,48 @@ import ( "github.com/stratosnet/stratos-chain/x/evm/types" ) -// GenExtraEIPs randomly generates specific extra eips or not. -func genExtraEIPs(r *rand.Rand) []int64 { +const ( + extraEIPsKey = "extra_eips" +) + +// GenExtraEIPs defines a set of extra EIPs with 50% probability +func GenExtraEIPs(r *rand.Rand) []int64 { var extraEIPs []int64 - if r.Uint32()%2 == 0 { + // 50% chance of having extra EIPs + if r.Intn(2) == 0 { extraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529} } return extraEIPs } -// RandomizedGenState generates a random GenesisState for nft +// GenEnableCreate enables the EnableCreate param with 80% probability +func GenEnableCreate(r *rand.Rand) bool { + // 80% chance of enabling create contract + enableCreate := r.Intn(100) < 80 + return enableCreate +} + +// GenEnableCall enables the EnableCall param with 80% probability +func GenEnableCall(r *rand.Rand) bool { + // 80% chance of enabling evm account transfer and calling contract + enableCall := r.Intn(100) < 80 + return enableCall +} + +// RandomizedGenState generates a random GenesisState for the EVM module func RandomizedGenState(simState *module.SimulationState) { feeMarketParams := types.NewFeeMarketParams(simState.Rand.Uint32()%2 == 0, simState.Rand.Uint32(), simState.Rand.Uint32(), simState.Rand.Uint64(), simState.Rand.Int63()) - blockGas := simState.Rand.Uint64() - extraEIPs := genExtraEIPs(simState.Rand) + // evm params + var extraEIPs []int64 + + simState.AppParams.GetOrGenerate( + simState.Cdc, extraEIPsKey, &extraEIPs, simState.Rand, + func(r *rand.Rand) { extraEIPs = GenExtraEIPs(r) }, + ) + params := types.NewParams(types.DefaultEVMDenom, true, true, types.DefaultChainConfig(), feeMarketParams, extraEIPs...) - evmGenesis := types.NewGenesisState(params, []types.GenesisAccount{}, blockGas) + evmGenesis := types.NewGenesisState(params, []types.GenesisAccount{}) bz, err := json.MarshalIndent(evmGenesis, "", " ") if err != nil { diff --git a/x/evm/simulation/operations.go b/x/evm/simulation/operations.go index 2b050c68..ae75dfd4 100644 --- a/x/evm/simulation/operations.go +++ b/x/evm/simulation/operations.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/stratosnet/stratos-chain/encoding" - "github.com/stratosnet/stratos-chain/server/config" "github.com/stratosnet/stratos-chain/tests" "github.com/stratosnet/stratos-chain/x/evm/keeper" "github.com/stratosnet/stratos-chain/x/evm/types" @@ -204,20 +203,22 @@ func SimulateEthTx( // CreateRandomValidEthTx create the ethereum tx with valid random values func CreateRandomValidEthTx(ctx *simulateContext, from, to *common.Address, amount *big.Int, data *hexutil.Bytes) (ethTx *types.MsgEthereumTx, err error) { - estimateGas, err := EstimateGas(ctx, from, to, data) + gasCap := ctx.rand.Uint64() + estimateGas, err := EstimateGas(ctx, from, to, data, gasCap) if err != nil { return nil, err } + // we suppose that gasLimit should be larger than estimateGas to ensure tx validity gasLimit := estimateGas + uint64(ctx.rand.Intn(int(sdktx.MaxGasWanted-estimateGas))) ethChainID := ctx.keeper.ChainID() chainConfig := ctx.keeper.GetParams(ctx.context).ChainConfig.EthereumConfig(ethChainID) - gasPrice := ctx.keeper.BaseFee(ctx.context, chainConfig) + gasPrice := ctx.keeper.GetBaseFee(ctx.context, chainConfig) gasFeeCap := new(big.Int).Add(gasPrice, big.NewInt(int64(ctx.rand.Int()))) gasTipCap := big.NewInt(int64(ctx.rand.Int())) nonce := ctx.keeper.GetNonce(ctx.context, *from) if amount == nil { - amount, err = RandomTransferableAmount(ctx, *from, gasLimit, gasFeeCap) + amount, err = RandomTransferableAmount(ctx, *from, estimateGas, gasFeeCap) if err != nil { return nil, err } @@ -229,7 +230,7 @@ func CreateRandomValidEthTx(ctx *simulateContext, from, to *common.Address, amou } // EstimateGas estimates the gas used by quering the keeper. -func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.Bytes) (gas uint64, err error) { +func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.Bytes, gasCap uint64) (gas uint64, err error) { args, err := json.Marshal(&types.TransactionArgs{To: to, From: from, Data: data}) if err != nil { return 0, err @@ -237,7 +238,7 @@ func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.B res, err := ctx.keeper.EstimateGas(sdk.WrapSDKContext(ctx.context), &types.EthCallRequest{ Args: args, - GasCap: config.DefaultGasCap, + GasCap: gasCap, }) if err != nil { return 0, err @@ -247,9 +248,9 @@ func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.B // RandomTransferableAmount generates a random valid transferable amount. // Transferable amount is between the range [0, spendable), spendable = balance - gasFeeCap * GasLimit. -func RandomTransferableAmount(ctx *simulateContext, address common.Address, gasLimit uint64, gasFeeCap *big.Int) (amount *big.Int, err error) { +func RandomTransferableAmount(ctx *simulateContext, address common.Address, estimateGas uint64, gasFeeCap *big.Int) (amount *big.Int, err error) { balance := ctx.keeper.GetBalance(ctx.context, address) - feeLimit := new(big.Int).Mul(gasFeeCap, big.NewInt(int64(gasLimit))) + feeLimit := new(big.Int).Mul(gasFeeCap, big.NewInt(int64(estimateGas))) if (feeLimit.Cmp(balance)) > 0 { return nil, ErrNoEnoughBalance } diff --git a/x/evm/simulation/params.go b/x/evm/simulation/params.go index 1770b8d7..82fb891e 100644 --- a/x/evm/simulation/params.go +++ b/x/evm/simulation/params.go @@ -6,23 +6,36 @@ import ( "fmt" "math/rand" + amino "github.com/cosmos/cosmos-sdk/codec" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/stratosnet/stratos-chain/x/evm/types" ) -const ( - keyExtraEIPs = "ExtraEIPs" -) - // ParamChanges defines the parameters that can be modified by param change proposals // on the simulation. func ParamChanges(r *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ - simulation.NewSimParamChange(types.ModuleName, keyExtraEIPs, + simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyExtraEIPs), + func(r *rand.Rand) string { + extraEIPs := GenExtraEIPs(r) + amino := amino.NewLegacyAmino() + bz, err := amino.MarshalJSON(extraEIPs) + if err != nil { + panic(err) + } + return string(bz) + }, + ), + simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyEnableCreate), + func(r *rand.Rand) string { + return fmt.Sprintf("%v", GenEnableCreate(r)) + }, + ), + simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyEnableCall), func(r *rand.Rand) string { - return fmt.Sprintf("\"%d\"", genExtraEIPs(r)) + return fmt.Sprintf("%v", GenEnableCall(r)) }, ), } diff --git a/x/evm/types/genesis.go b/x/evm/types/genesis.go index bbb5bc94..d015c173 100644 --- a/x/evm/types/genesis.go +++ b/x/evm/types/genesis.go @@ -20,16 +20,14 @@ func DefaultGenesisState() *GenesisState { return &GenesisState{ Accounts: []GenesisAccount{}, Params: DefaultParams(), - BlockGas: 0, } } // NewGenesisState creates a new genesis state. -func NewGenesisState(params Params, accounts []GenesisAccount, blockGas uint64) *GenesisState { +func NewGenesisState(params Params, accounts []GenesisAccount) *GenesisState { return &GenesisState{ Accounts: accounts, Params: params, - BlockGas: blockGas, } } diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 520e699b..14f2c176 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -4,12 +4,12 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" - sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" + stratos "github.com/stratosnet/stratos-chain/types" ) diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index 5020ad23..ce439dbf 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -1343,96 +1343,97 @@ func init() { func init() { proto.RegisterFile("stratos/evm/v1/query.proto", fileDescriptor_f35039d5386d306b) } var fileDescriptor_f35039d5386d306b = []byte{ - // 1414 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdf, 0x6f, 0x13, 0xc7, - 0x16, 0xce, 0xc6, 0x4e, 0x1c, 0x4e, 0x12, 0x6e, 0xee, 0x10, 0x82, 0xd9, 0x10, 0x3b, 0xd9, 0x00, - 0x4e, 0x22, 0xb2, 0x4b, 0x72, 0xaf, 0xae, 0x6e, 0x2b, 0xb5, 0x55, 0x12, 0x05, 0x8a, 0xa0, 0x15, - 0x75, 0xa3, 0x3e, 0x54, 0xaa, 0xac, 0xf1, 0x7a, 0x58, 0x5b, 0xb1, 0x77, 0xcd, 0xce, 0xd8, 0x72, - 0x40, 0xa8, 0x15, 0x52, 0x7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0xbb, 0x4b, 0x49, 0x82, 0xd2, 0x7e, 0x3f, 0xfb, - 0xec, 0x45, 0x71, 0xa2, 0xac, 0x6c, 0xad, 0xf7, 0xe0, 0xec, 0x21, 0xab, 0x1f, 0xe0, 0x66, 0x33, - 0x12, 0x64, 0x1c, 0x7a, 0x54, 0x5f, 0x07, 0x1f, 0xa3, 0x0b, 0x90, 0xf3, 0x30, 0xad, 0xb8, 0xb8, - 0xad, 0x5e, 0xc6, 0xb4, 0x87, 0xe9, 0x01, 0x6e, 0x5b, 0x25, 0x38, 0x77, 0x48, 0x59, 0xa3, 0x85, - 0x19, 0xb9, 0x89, 0x07, 0x5c, 0x16, 0x20, 0xe3, 0x61, 0xe9, 0x22, 0x5b, 0xe6, 0x43, 0xeb, 0xf9, - 0xa4, 0x0e, 0x6a, 0x88, 0x5d, 0x72, 0xd4, 0xd3, 0x68, 0x0e, 0x64, 0x5a, 0xd4, 0x53, 0x94, 0x57, - 0x92, 0x94, 0x3f, 0xa2, 0xde, 0x21, 0xab, 0x93, 0x90, 0x74, 0x5a, 0x47, 0xbd, 0x32, 0xb7, 0x44, - 0xef, 0xc3, 0x1c, 0xe3, 0x2e, 0x2a, 0x6e, 0xe0, 0xdf, 0x6b, 0x78, 0x2a, 0xbc, 0xcb, 0xc9, 0x9d, - 0x02, 0xe6, 0x40, 0x98, 0x94, 0x67, 0xd9, 0xe0, 0x07, 0xed, 0xc1, 0x5c, 0x3b, 0x24, 0x35, 0xe2, - 0x12, 0x4a, 0x83, 0x90, 0xe6, 0x33, 0xe2, 0x36, 0xc7, 0x20, 0xc7, 0xb6, 0xf0, 0x02, 0x55, 0x6d, - 0x06, 0xee, 0xb1, 0x2e, 0x05, 0xd9, 0x55, 0x63, 0x23, 0x53, 0x9e, 0x15, 0x73, 0xb2, 0x10, 0xa0, - 0x15, 0x00, 0x69, 0x22, 0xf2, 0x75, 0x4a, 0xe4, 0xeb, 0x19, 0x31, 0x23, 0x4a, 0xfc, 0x81, 0x5e, - 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, 0xdd, 0xbf, 0xf5, 0xec, 0x65, 0xc1, 0x78, 0xfe, 0xb2, 0x60, 0xfc, 0xf1, - 0xb2, 0x60, 0x3c, 0x79, 0x55, 0x98, 0x78, 0xfe, 0xaa, 0x30, 0xf1, 0xeb, 0xab, 0xc2, 0xc4, 0xe7, - 0x4e, 0x44, 0x37, 0xd5, 0x76, 0x9f, 0x30, 0x3d, 0xdc, 0x76, 0xeb, 0xb8, 0xe1, 0x3b, 0x3d, 0xe1, - 0x51, 0x88, 0x68, 0x75, 0x5a, 0x74, 0x01, 0xff, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x71, 0xef, - 0x53, 0x77, 0xb6, 0x10, 0x00, 0x00, + // 1434 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6f, 0x13, 0xc7, + 0x16, 0xcf, 0xc6, 0x4e, 0x1c, 0x8e, 0x43, 0x6e, 0xee, 0x10, 0x82, 0xd9, 0x10, 0x3b, 0xd9, 0x40, + 0x9c, 0x44, 0x64, 0x97, 0xe4, 0x5e, 0x5d, 0xdd, 0x56, 0x6a, 0xab, 0x24, 0x0a, 0x14, 0x41, 0x2b, + 0xea, 0x46, 0x7d, 0xa8, 0x54, 0x59, 0xe3, 0xf5, 0xb0, 0xb6, 0x62, 0xef, 0x9a, 0x9d, 0xb1, 0xe5, + 0x80, 0x50, 0x5b, 0xa4, 0x7e, 0x48, 0x7d, 0x41, 0xea, 0x4b, 0x1f, 0x79, 0xaa, 0xd4, 0xff, 0x84, + 0x47, 0xa4, 0xbe, 0x54, 0x7d, 0xa0, 0x15, 0xf4, 0xa1, 0x7f, 0x46, 0x35, 0x5f, 0xb6, 0x77, 0xed, + 0x8d, 0x01, 0xf1, 0xb4, 0xb3, 0x33, 0x67, 0xce, 0xef, 0x77, 0x3e, 0xe6, 0x9c, 0x03, 0x26, 0x65, + 0x21, 0x66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3, 0x98, 0x5b, 0xaf, 0x22, 0xaa, 0x38, 0x5d, 0x13, 0x9c, 0xb6, 0xd0, 0x46, 0x9c, 0x93, + 0x1e, 0x71, 0x86, 0xa8, 0xfd, 0x62, 0xc0, 0x7c, 0x7c, 0x84, 0x40, 0x57, 0x47, 0x42, 0x26, 0xcc, + 0x2d, 0xe6, 0xf6, 0x2b, 0x4a, 0x2b, 0x8e, 0xff, 0x17, 0x1c, 0x77, 0xd1, 0xb5, 0x38, 0xc7, 0x8e, + 0xbe, 0xd1, 0xa7, 0x39, 0x38, 0x0f, 0x3d, 0x44, 0x5f, 0x19, 0x90, 0x51, 0x63, 0x42, 0x42, 0x20, + 0xa3, 0xf3, 0x47, 0x42, 0x20, 0x63, 0x93, 0x86, 0xb5, 0x25, 0x08, 0x5d, 0x46, 0x56, 0x9c, 0x90, + 0x1a, 0x38, 0xe8, 0x80, 0xbb, 0xbe, 0x31, 0x20, 0xa3, 0x46, 0x85, 0x04, 0x0a, 0xd1, 0xa9, 0x24, + 0x81, 0x42, 0x6c, 0xda, 0xb0, 0x1c, 0x41, 0x61, 0x13, 0x15, 0xe3, 0x14, 0xa8, 0x14, 0xec, 0x33, + 0x70, 0x1e, 0x1c, 0x93, 0x93, 0x87, 0x88, 0x41, 0x9a, 0xcf, 0x12, 0x68, 0x25, 0x21, 0x39, 0x7a, + 0xe3, 0x89, 0xb9, 0x7a, 0x8a, 0x84, 0x42, 0x2f, 0x0a, 0xf4, 0x55, 0x54, 0x18, 0xce, 0x9a, 0x6a, + 0xc4, 0xfa, 0x7b, 0x30, 0x2d, 0x9b, 0x29, 0xb2, 0x46, 0x6a, 0x8d, 0xf4, 0x6b, 0x73, 0xed, 0x54, + 0x19, 0x85, 0x9d, 0x17, 0xd8, 0x39, 0xb4, 0x18, 0xc7, 0x96, 0x7d, 0x1a, 0x85, 0x90, 0x51, 0x7d, + 0x1a, 0xe5, 0xe3, 0xfa, 0xa2, 0x0d, 0xdc, 0xbc, 0x72, 0x7a, 0x0d, 0xd7, 0x88, 0x2b, 0x02, 0xd1, + 0x44, 0xb9, 0x38, 0x22, 0x61, 0xb5, 0xb2, 0xcb, 0x81, 0xba, 0x90, 0x1d, 0x68, 0xee, 0x63, 0x71, + 0x87, 0xec, 0x1c, 0x31, 0x19, 0x58, 0x97, 0x05, 0x6a, 0x1e, 0x5d, 0x1a, 0x42, 0x55, 0xc2, 0x65, + 0x0f, 0x53, 0xd4, 0x81, 0x8c, 0xea, 0x6a, 0x09, 0xd9, 0x15, 0x9d, 0x22, 0x12, 0xb2, 0x2b, 0xd6, + 0x18, 0x93, 0x2d, 0x96, 0xed, 0x8c, 0x75, 0xd1, 0x23, 0x03, 0xa0, 0xdf, 0x0f, 0xd0, 0x7a, 0xb2, + 0xda, 0xc1, 0x16, 0x6a, 0x16, 0xc7, 0xca, 0x29, 0x06, 0x6b, 0x82, 0xc1, 0x32, 0x5a, 0x1a, 0xcd, + 0x40, 0x34, 0x27, 0x6e, 0xbc, 0xea, 0x26, 0x89, 0xaf, 0x7b, 0xb0, 0x05, 0x25, 0xbe, 0xee, 0x48, + 0x43, 0x4a, 0x36, 0x5e, 0xb7, 0x29, 0xf4, 0xb5, 0x01, 0xb3, 0xea, 0x96, 0x48, 0xce, 0xb7, 0x89, + 0xbe, 0x2e, 0xd0, 0x57, 0x50, 0x3e, 0x09, 0xbd, 0x2c, 0xf2, 0x1c, 0xdd, 0x87, 0x19, 0xdd, 0xd2, + 0x50, 0x82, 0xe6, 0x68, 0x27, 0x1c, 0xce, 0xf6, 0x91, 0x7d, 0xd1, 0x5a, 0x15, 0x04, 0x96, 0xd0, + 0xc5, 0x21, 0x02, 0x62, 0x90, 0xf0, 0x30, 0xdd, 0xbf, 0xf9, 0xf4, 0x45, 0xde, 0x78, 0xf6, 0x22, + 0x6f, 0xfc, 0xf9, 0x22, 0x6f, 0x3c, 0x7e, 0x99, 0x9f, 0x78, 0xf6, 0x32, 0x3f, 0xf1, 0xdb, 0xcb, + 0xfc, 0xc4, 0xe7, 0xce, 0x40, 0xdb, 0x56, 0xd7, 0x7d, 0xc2, 0xf4, 0x72, 0xdb, 0xad, 0xe1, 0xba, + 0xef, 0x74, 0x85, 0x46, 0xd1, 0xc3, 0x2b, 0xd3, 0x62, 0x08, 0xf9, 0xcf, 0x3f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xa4, 0x2e, 0x29, 0x62, 0x35, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1471,8 +1472,11 @@ type QueryClient interface { TraceTx(ctx context.Context, in *QueryTraceTxRequest, opts ...grpc.CallOption) (*QueryTraceTxResponse, error) // TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api TraceBlock(ctx context.Context, in *QueryTraceBlockRequest, opts ...grpc.CallOption) (*QueryTraceBlockResponse, error) - // BaseFee queries the base fee of the parent block of the current block. - QueryBaseFee(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) + // BaseFee queries the base fee of the parent block of the current block, + // it's similar to feemarket module's method, but also checks london hardfork status. + BaseFee(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) + // BaseFeeParam queries the base fee of the parent block of the current block. + BaseFeeParam(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) // BlockGas queries the gas used at a given block height BlockGas(ctx context.Context, in *QueryBlockGasRequest, opts ...grpc.CallOption) (*QueryBlockGasResponse, error) } @@ -1584,9 +1588,18 @@ func (c *queryClient) TraceBlock(ctx context.Context, in *QueryTraceBlockRequest return out, nil } -func (c *queryClient) QueryBaseFee(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) { +func (c *queryClient) BaseFee(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) { out := new(QueryBaseFeeResponse) - err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/QueryBaseFee", in, out, opts...) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/BaseFee", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BaseFeeParam(ctx context.Context, in *QueryBaseFeeRequest, opts ...grpc.CallOption) (*QueryBaseFeeResponse, error) { + out := new(QueryBaseFeeResponse) + err := c.cc.Invoke(ctx, "/stratos.evm.v1.Query/BaseFeeParam", in, out, opts...) if err != nil { return nil, err } @@ -1628,8 +1641,11 @@ type QueryServer interface { TraceTx(context.Context, *QueryTraceTxRequest) (*QueryTraceTxResponse, error) // TraceBlock implements the `debug_traceBlockByNumber` and `debug_traceBlockByHash` rpc api TraceBlock(context.Context, *QueryTraceBlockRequest) (*QueryTraceBlockResponse, error) - // BaseFee queries the base fee of the parent block of the current block. - QueryBaseFee(context.Context, *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) + // BaseFee queries the base fee of the parent block of the current block, + // it's similar to feemarket module's method, but also checks london hardfork status. + BaseFee(context.Context, *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) + // BaseFeeParam queries the base fee of the parent block of the current block. + BaseFeeParam(context.Context, *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) // BlockGas queries the gas used at a given block height BlockGas(context.Context, *QueryBlockGasRequest) (*QueryBlockGasResponse, error) } @@ -1671,8 +1687,11 @@ func (*UnimplementedQueryServer) TraceTx(ctx context.Context, req *QueryTraceTxR func (*UnimplementedQueryServer) TraceBlock(ctx context.Context, req *QueryTraceBlockRequest) (*QueryTraceBlockResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TraceBlock not implemented") } -func (*UnimplementedQueryServer) QueryBaseFee(ctx context.Context, req *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryBaseFee not implemented") +func (*UnimplementedQueryServer) BaseFee(ctx context.Context, req *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BaseFee not implemented") +} +func (*UnimplementedQueryServer) BaseFeeParam(ctx context.Context, req *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BaseFeeParam not implemented") } func (*UnimplementedQueryServer) BlockGas(ctx context.Context, req *QueryBlockGasRequest) (*QueryBlockGasResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BlockGas not implemented") @@ -1880,20 +1899,38 @@ func _Query_TraceBlock_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _Query_QueryBaseFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_BaseFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBaseFeeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BaseFee(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.evm.v1.Query/BaseFee", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BaseFee(ctx, req.(*QueryBaseFeeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BaseFeeParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryBaseFeeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryBaseFee(ctx, in) + return srv.(QueryServer).BaseFeeParam(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.evm.v1.Query/QueryBaseFee", + FullMethod: "/stratos.evm.v1.Query/BaseFeeParam", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryBaseFee(ctx, req.(*QueryBaseFeeRequest)) + return srv.(QueryServer).BaseFeeParam(ctx, req.(*QueryBaseFeeRequest)) } return interceptor(ctx, in, info, handler) } @@ -1965,8 +2002,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_TraceBlock_Handler, }, { - MethodName: "QueryBaseFee", - Handler: _Query_QueryBaseFee_Handler, + MethodName: "BaseFee", + Handler: _Query_BaseFee_Handler, + }, + { + MethodName: "BaseFeeParam", + Handler: _Query_BaseFeeParam_Handler, }, { MethodName: "BlockGas", diff --git a/x/evm/types/query.pb.gw.go b/x/evm/types/query.pb.gw.go index e4b4c17c..f94eed5b 100644 --- a/x/evm/types/query.pb.gw.go +++ b/x/evm/types/query.pb.gw.go @@ -539,20 +539,38 @@ func local_request_Query_TraceBlock_0(ctx context.Context, marshaler runtime.Mar } -func request_Query_QueryBaseFee_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryBaseFeeRequest var metadata runtime.ServerMetadata - msg, err := client.QueryBaseFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.BaseFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryBaseFee_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryBaseFeeRequest var metadata runtime.ServerMetadata - msg, err := server.QueryBaseFee(ctx, &protoReq) + msg, err := server.BaseFee(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BaseFeeParam_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBaseFeeRequest + var metadata runtime.ServerMetadata + + msg, err := client.BaseFeeParam(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BaseFeeParam_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBaseFeeRequest + var metadata runtime.ServerMetadata + + msg, err := server.BaseFeeParam(ctx, &protoReq) return msg, metadata, err } @@ -801,7 +819,27 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueryBaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BaseFee_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BaseFeeParam_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) @@ -810,14 +848,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryBaseFee_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BaseFeeParam_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_QueryBaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BaseFeeParam_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1102,7 +1140,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueryBaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BaseFee_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) @@ -1111,14 +1149,34 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryBaseFee_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_BaseFee_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_QueryBaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BaseFeeParam_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_BaseFeeParam_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_BaseFeeParam_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1168,7 +1226,9 @@ var ( pattern_Query_TraceBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "trace_block"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_QueryBaseFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "base_fee"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_BaseFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "base_fee"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_BaseFeeParam_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "base_fee_param"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_BlockGas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "evm", "v1", "block_gas"}, "", runtime.AssumeColonVerbOpt(true))) ) @@ -1196,7 +1256,9 @@ var ( forward_Query_TraceBlock_0 = runtime.ForwardResponseMessage - forward_Query_QueryBaseFee_0 = runtime.ForwardResponseMessage + forward_Query_BaseFee_0 = runtime.ForwardResponseMessage + + forward_Query_BaseFeeParam_0 = runtime.ForwardResponseMessage forward_Query_BlockGas_0 = runtime.ForwardResponseMessage ) From e5c4b6ee501f5d49fa10063e305b58581433408d Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 13 May 2022 13:09:52 -0400 Subject: [PATCH 044/113] updated sds module --- proto/stratos/register/v1/tx.proto | 2 +- proto/stratos/sds/v1/query.proto | 109 +-- proto/stratos/sds/v1/sds.proto | 34 - proto/stratos/sds/v1/tx.proto | 277 +----- x/register/client/rest/tx.go | 2 +- x/register/genesis.go | 5 +- x/register/module.go | 5 +- x/sds/alias.go | 2 +- x/sds/app_test.go | 1099 +++++++++++------------ x/sds/client/cli/query.go | 91 +- x/sds/client/cli/tx.go | 118 ++- x/sds/client/common/common.go | 51 +- x/sds/client/rest/query.go | 35 +- x/sds/client/rest/rest.go | 177 ++-- x/sds/client/rest/tx.go | 96 ++ x/sds/genesis.go | 16 +- x/sds/handler.go | 72 +- x/sds/keeper/grpc_query.go | 82 ++ x/sds/keeper/keeper.go | 21 +- x/sds/keeper/migrations.go | 21 + x/sds/keeper/msg_server.go | 102 +++ x/sds/keeper/querier.go | 33 +- x/sds/module.go | 119 ++- x/sds/sds_test.go | 667 +++++++------- x/sds/types/msg.go | 8 +- x/sds/types/querier.go | 1 - x/sds/types/query.pb.go | 1329 ++++++++++++++++++++++++++++ x/sds/types/query.pb.gw.go | 344 +++++++ x/sds/types/sds.pb.go | 615 +------------ x/sds/types/tx.pb.go | 1089 +++++++++++++++++++++++ x/sds/types/tx.pb.gw.go | 246 +++++ 31 files changed, 4687 insertions(+), 2181 deletions(-) create mode 100644 x/sds/client/rest/tx.go create mode 100644 x/sds/keeper/grpc_query.go create mode 100644 x/sds/keeper/migrations.go create mode 100644 x/sds/keeper/msg_server.go create mode 100644 x/sds/types/query.pb.go create mode 100644 x/sds/types/query.pb.gw.go create mode 100644 x/sds/types/tx.pb.go create mode 100644 x/sds/types/tx.pb.gw.go diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto index a4e92a3c..d254d9ca 100644 --- a/proto/stratos/register/v1/tx.proto +++ b/proto/stratos/register/v1/tx.proto @@ -12,7 +12,7 @@ import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; -// Msg defines the evm Msg service. +// Msg defines the register module Msg service. service Msg { // CreateResourceNode defines a method for creating a new resource node. rpc HandleMsgCreateResourceNode(MsgCreateResourceNode) returns (MsgCreateResourceNodeResponse) { diff --git a/proto/stratos/sds/v1/query.proto b/proto/stratos/sds/v1/query.proto index aa23eb0a..92718685 100644 --- a/proto/stratos/sds/v1/query.proto +++ b/proto/stratos/sds/v1/query.proto @@ -1,112 +1,53 @@ syntax = "proto3"; package stratos.sds.v1; +import "gogoproto/gogo.proto"; + import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "stratos/register/v1/register.proto"; +import "stratos/sds/v1/sds.proto"; option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; // Query defines the gRPC querier service. service Query { - // ResourceNode queries ResourceNode info for given ResourceNode address. - rpc ResourceNode(QueryResourceNodeRequest) returns (QueryResourceNodeResponse) { - option (google.api.http).get = "/stratos/register/v1/resource-nodes/{network_addr}"; + // Query uploaded file info by hash + rpc Fileupload(QueryFileUploadRequest) returns (QueryFileUploadResponse) { + option (google.api.http).get = "/stratos/sds/v1/file_upload/{file_hash}"; } - - // IndexingNode queries IndexingNode info for given IndexingNode address. - rpc IndexingNode(QueryIndexingNodeRequest) returns (QueryIndexingNodeResponse) { - option (google.api.http).get = "/stratos/register/v1/indexing-nodes/{network_addr}"; + // Query balance of prepayment in Volume Pool + rpc Prepay(QueryPrepayRequest) returns (QueryPrepayResponse) { + option (google.api.http).get = "/stratos/sds/v1/prepay/{acct_addr}"; } - // Params queries Register module Params info. + // Params queries SDS module Params info. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/stratos/register/v1/params"; - } - - // StakeByNode queries all staking info for given node network address. - rpc StakeByNode(QueryStakeByNodeRequest) returns (QueryStakeByNodeResponse) { - option (google.api.http).get = "/stratos/register/v1/stakes_node/{acc_addr}/{query_type}"; - } - - // StakeByOwner queries all staking info for given owner address. - rpc StakeByOwner(QueryStakeByOwnerRequest) returns (QueryStakeByOwnerResponse) { - option (google.api.http).get = "/stratos/register/v1/stakes_owner/{owner_addr}"; + option (google.api.http).get = "/stratos/sds/v1/params"; } - // StakeTotal queries all staking info. - rpc StakeTotal(QueryTotalStakeRequest) returns (QueryTotalStakeResponse) { - option (google.api.http).get = "/stratos/register/v1/total_stakes"; - } } -// QueryResourceNodeRequest is request type for the Query/ResourceNode RPC method -message QueryResourceNodeRequest { +// QueryFileuploadRequest is request type for the Query/Fileupload RPC method +message QueryFileUploadRequest { // network_addr defines the node network address to query for. - string network_addr = 1; + string file_hash = 1; } -// QueryResourceNodeResponse is response type for the Query/ResourceNode RPC method -message QueryResourceNodeResponse { - // node defines the the resourceNode info. - ResourceNode node = 1; -} - -// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method -message QueryIndexingNodeRequest { - // network_addr defines the node network address to query for. - string network_addr = 1; +// QueryFileuploadResponse is response type for the Query/Fileupload RPC method +message QueryFileUploadResponse { + FileInfo file_info = 1; } -// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method -message QueryIndexingNodeResponse { - // node defines the the indexing info. - IndexingNode node = 1; +// QueryPrepayRequest is request type for the Query/Prepay RPC method +message QueryPrepayRequest { + string acct_addr = 1; } -// QueryStakeByNodeRequest is request type for the Query/StakeByNode RPC method -message QueryStakeByNodeRequest { - // acc_addr defines the node network address to query for. - string acc_addr = 1; - int64 query_type = 2; - // pagination defines an optional pagination for the request. -// cosmos.base.query.v1beta1.PageRequest pagination = 3; -} - -// QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method -message QueryStakeByNodeResponse { - // staking_info defines the the staking_info info of the node. - StakingInfo staking_info = 1; - // pagination defines an optional pagination for the request. -// cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method -message QueryStakeByOwnerRequest { - // owner_addr defines the owner address to query for. - string network_addr = 1; - string moniker = 2; - string owner_addr = 3; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 4; -} - -// QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method -message QueryStakeByOwnerResponse { - // staking_infos defines the the node staking info of this owner. - repeated StakingInfo staking_infos = 1; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryTotalStakeRequest is request type for the Query/TotalStake RPC method -message QueryTotalStakeRequest {} - -// QueryTotalStakeResponse is response type for the Query/TotalStake RPC method -message QueryTotalStakeResponse { - // total_stakes defines the total staking info. - TotalStakesResponse total_stakes= 1; +// QueryPrepayResponse is response type for the Query/Prepay RPC method +message QueryPrepayResponse { + string balance = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; } // QueryParamsRequest is request type for the Query/Params RPC method. diff --git a/proto/stratos/sds/v1/sds.proto b/proto/stratos/sds/v1/sds.proto index 63c65372..e8c22634 100644 --- a/proto/stratos/sds/v1/sds.proto +++ b/proto/stratos/sds/v1/sds.proto @@ -3,8 +3,6 @@ package stratos.sds.v1; import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; - option go_package = "github.com/stratosnet/stratos-chain/x/sds/types"; // Params defines the Register module parameters @@ -33,35 +31,3 @@ message FileInfo { string uploader = 3; } -message MsgFileUpload { - string fileHash = 1 [ - (gogoproto.jsontag) = "file_hash", - (gogoproto.moretags) = "yaml:\"file_hash\"" - ]; - string from = 2 [ - (gogoproto.jsontag) = "from", - (gogoproto.moretags) = "yaml:\"from\"" - ]; - string reporter = 3 [ - (gogoproto.jsontag) = "reporter", - (gogoproto.moretags) = "yaml:\"reporter\"" - ]; - string uploader = 4 [ - (gogoproto.jsontag) = "uploader", - (gogoproto.moretags) = "yaml:\"uploader\"" - ]; -} - -message MsgPrepay { - string sender = 1 [ - (gogoproto.jsontag) = "sender", - (gogoproto.moretags) = "yaml:\"sender\"" - ]; - - repeated cosmos.base.v1beta1.Coin coins = 2 [ - (gogoproto.jsontag) = "coins", - (gogoproto.moretags) = "yaml:\"coins\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} diff --git a/proto/stratos/sds/v1/tx.proto b/proto/stratos/sds/v1/tx.proto index 6589273d..2a1fdd9c 100644 --- a/proto/stratos/sds/v1/tx.proto +++ b/proto/stratos/sds/v1/tx.proto @@ -2,276 +2,57 @@ syntax = "proto3"; package stratos.sds.v1; import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; import "google/api/annotations.proto"; -import "cosmos_proto/cosmos.proto"; -import "stratos/register/v1/register.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; +option go_package = "github.com/stratosnet/stratos-chain/x/sds/types"; -// Msg defines the evm Msg service. +// Msg defines the sds module Msg service. service Msg { // CreateResourceNode defines a method for creating a new resource node. - rpc HandleMsgCreateResourceNode(MsgCreateResourceNode) returns (MsgCreateResourceNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/create_resource_node"; + rpc HandleMsgFileUpload(MsgFileUpload) returns (MsgFileUploadResponse) { + option (google.api.http).post = "/stratos/sds/v1/file_upload"; }; - rpc HandleMsgRemoveResourceNode(MsgRemoveResourceNode) returns (MsgRemoveResourceNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/remove_resource_node"; + rpc HandleMsgPrepay(MsgPrepay) returns (MsgPrepayResponse) { + option (google.api.http).post = "/stratos/sds/v1/prepay"; }; - rpc HandleMsgUpdateResourceNode(MsgUpdateResourceNode) returns (MsgUpdateResourceNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/update_resource_node"; - }; - rpc HandleMsgUpdateResourceNodeStake(MsgUpdateResourceNodeStake) returns (MsgUpdateResourceNodeStakeResponse) { - option (google.api.http).post = "/stratos/register/v1/update_resource_node_stake"; - }; - - rpc HandleMsgCreateIndexingNode(MsgCreateIndexingNode) returns (MsgCreateIndexingNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/create_indexing_node"; - }; - rpc HandleMsgRemoveIndexingNode(MsgRemoveIndexingNode) returns (MsgRemoveIndexingNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/remove_indexing_node"; - }; - rpc HandleMsgUpdateIndexingNode(MsgUpdateIndexingNode) returns (MsgUpdateIndexingNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/update_indexing_node"; - }; - rpc HandleMsgUpdateIndexingNodeStake(MsgUpdateIndexingNodeStake) returns (MsgUpdateIndexingNodeStakeResponse) { - option (google.api.http).post = "/stratos/register/v1/update_indexing_node_stake"; - }; - rpc HandleMsgIndexingNodeRegistrationVote(MsgIndexingNodeRegistrationVote) returns (MsgIndexingNodeRegistrationVoteResponse) { - option (google.api.http).post = "/stratos/register/v1/indexing_node_registration_vote"; - }; - -} - -// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. -message MsgCreateResourceNode { - string networkAddr = 1 [ - (gogoproto.jsontag) = "network_address", - (gogoproto.moretags) = "yaml:\"network_address\"" - ]; - google.protobuf.Any pubKey = 2 [ - (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", - (gogoproto.jsontag) = "pubkey", - (gogoproto.moretags) = "yaml:\"pubkey\"" - ]; - cosmos.base.v1beta1.Coin value = 3 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "value", - (gogoproto.moretags) = "yaml:\"value\"" - ]; - string ownerAddress = 4 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" - ]; - Description description = 5 [ - (gogoproto.jsontag) = "description", - (gogoproto.moretags) = "yaml:\"description\"" - ]; - string nodeType = 6 [ - (gogoproto.jsontag) = "node_type", - (gogoproto.moretags) = "yaml:\"node_type\"" - ]; } -// MsgCreateResourceNodeTxResponse defines the CreateResourceNodeTx response type -message MsgCreateResourceNodeResponse {} -// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. -message MsgCreateIndexingNode { - string networkAddr = 1 [ - (gogoproto.jsontag) = "network_address", - (gogoproto.moretags) = "yaml:\"network_address\"" +message MsgFileUpload { + string fileHash = 1 [ + (gogoproto.jsontag) = "file_hash", + (gogoproto.moretags) = "yaml:\"file_hash\"" ]; - google.protobuf.Any pubKey = 2 [ - (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", - (gogoproto.jsontag) = "pubkey", - (gogoproto.moretags) = "yaml:\"pubkey\"" + string from = 2 [ + (gogoproto.jsontag) = "from", + (gogoproto.moretags) = "yaml:\"from\"" ]; - cosmos.base.v1beta1.Coin value = 3 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "value", - (gogoproto.moretags) = "yaml:\"value\"" - ]; - string ownerAddress = 4 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" + string reporter = 3 [ + (gogoproto.jsontag) = "reporter", + (gogoproto.moretags) = "yaml:\"reporter\"" ]; - Description description = 5 [ - (gogoproto.jsontag) = "description", - (gogoproto.moretags) = "yaml:\"description\"" + string uploader = 4 [ + (gogoproto.jsontag) = "uploader", + (gogoproto.moretags) = "yaml:\"uploader\"" ]; } -// MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message -message MsgRemoveResourceNode { - option (gogoproto.goproto_getters) = false; - - string resource_node_address = 1 [ - (gogoproto.jsontag) = "resource_node_address", - (gogoproto.moretags) = "yaml:\"resource_node_address\"" +message MsgPrepay { + string sender = 1 [ + (gogoproto.jsontag) = "sender", + (gogoproto.moretags) = "yaml:\"sender\"" ]; - string owner_address = 2 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" - ]; -} - -// MsgRemoveResourceNodeResponse defines the Msg/RemoveResourceNode response type. -message MsgRemoveResourceNodeResponse {} - -// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type -message MsgCreateIndexingNodeResponse {} - - -// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message -message MsgRemoveIndexingNode { - option (gogoproto.goproto_getters) = false; - string indexing_node_address = 1 [ - (gogoproto.jsontag) = "indexing_node_address", - (gogoproto.moretags) = "yaml:\"indexing_node_address\"" - ]; - string owner_address = 2 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" - ]; -} - -// MsgRemoveIndexingNodeResponse defines the Msg/RemoveIndexingNode response type. -message MsgRemoveIndexingNodeResponse {} - - -// MsgUpdateResourceNode defines a SDK message for updating an existing resource node. -message MsgUpdateResourceNode { - option (gogoproto.goproto_getters) = false; - - Description description = 1 [ + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (gogoproto.jsontag) = "coins", + (gogoproto.moretags) = "yaml:\"coins\"", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "description", - (gogoproto.moretags) = "yaml:\"description\"" - ]; - string network_address = 2 [ - (gogoproto.jsontag) = "network_address", - (gogoproto.moretags) = "yaml:\"network_address\"" - ]; - string owner_address = 3 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" - ]; - string nodeType = 4 [ - (gogoproto.jsontag) = "node_type", - (gogoproto.moretags) = "yaml:\"node_type\"" - ]; -} - -// MsgUpdateResourceNodeResponse defines the Msg/UpdateResourceNode response type. -message MsgUpdateResourceNodeResponse {} - - -// MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. -message MsgUpdateIndexingNode { - option (gogoproto.goproto_getters) = false; - - Description description = 1 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "description", - (gogoproto.moretags) = "yaml:\"description\"" - ]; - string network_address = 2 [ - (gogoproto.jsontag) = "network_address", - (gogoproto.moretags) = "yaml:\"network_address\"" - ]; - string owner_address = 3 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" - ]; -} - -// MsgUpdateIndexingNodeResponse defines the Msg/UpdateIndexingNode response type. -message MsgUpdateIndexingNodeResponse {} - - -// MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. -message MsgUpdateResourceNodeStake { - option (gogoproto.goproto_getters) = false; - - string network_address = 1 [ - (gogoproto.jsontag) = "network_address", - (gogoproto.moretags) = "yaml:\"network_address\"" - ]; - string owner_address = 2 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" - ]; - bool incrStake = 3 [ - (gogoproto.jsontag) = "incr_stake", - (gogoproto.moretags) = "yaml:\"incr_stake\"" - ]; - cosmos.base.v1beta1.Coin StakeDelta = 4 [ - (gogoproto.jsontag) = "stake_delta", - (gogoproto.moretags) = "yaml:\"stake_delta\"" - ]; -} - -// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. -message MsgUpdateResourceNodeStakeResponse {} - - -// MsgUpdateIndexingNodeStake defines a SDK message for updating the stake of an existing indexing node. -message MsgUpdateIndexingNodeStake { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string network_address = 1 [ - (gogoproto.jsontag) = "network_address", - (gogoproto.moretags) = "yaml:\"network_address\"" - ]; - string owner_address = 2 [ - (gogoproto.jsontag) = "owner_address", - (gogoproto.moretags) = "yaml:\"owner_address\"" - ]; - bool incrStake = 3 [ - (gogoproto.jsontag) = "incr_stake", - (gogoproto.moretags) = "yaml:\"incr_stake\"" - ]; - cosmos.base.v1beta1.Coin StakeDelta = 4 [ - (gogoproto.jsontag) = "stake_delta", - (gogoproto.moretags) = "yaml:\"stake_delta\"" - ]; -} - -// MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. -message MsgUpdateIndexingNodeStakeResponse {} - -// MsgIndexingNodeRegistrationVote defines a SDK message for registration vote of an existing indexing node. -message MsgIndexingNodeRegistrationVote { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string candidate_network_address = 1 [ - (gogoproto.jsontag) = "candidate_network_address", - (gogoproto.moretags) = "yaml:\"candidate_network_address\"" - ]; // node address of indexing node - string candidate_owner_address = 2 [ - (gogoproto.jsontag) = "candidate_owner_address", - (gogoproto.moretags) = "yaml:\"candidate_owner_address\"" - ]; // owner address of indexing node - bool opinion = 3 [ - (gogoproto.jsontag) = "opinion", - (gogoproto.moretags) = "yaml:\"opinion\"" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - string voter_network_address = 4 [ - (gogoproto.jsontag) = "voter_network_address", - (gogoproto.moretags) = "yaml:\"voter_network_address\"" - ]; // address of voter (other existed indexing node) - string voter_owner_address = 5 [ - (gogoproto.jsontag) = "voter_owner_address", - (gogoproto.moretags) = "yaml:\"voter_owner_address\"" - ]; // address of owner of the voter (other existed indexing node) } -// MsgUpdateResourceNodeStakeResponse defines the Msg/IndexingNodeRegistrationVote response type. -message MsgIndexingNodeRegistrationVoteResponse {} +message MsgFileUploadResponse {} +message MsgPrepayResponse {} \ No newline at end of file diff --git a/x/register/client/rest/tx.go b/x/register/client/rest/tx.go index 65ef7039..4f0c3594 100644 --- a/x/register/client/rest/tx.go +++ b/x/register/client/rest/tx.go @@ -153,7 +153,7 @@ func postCreateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } nodeType := types.NodeType(nodeTypeRef) - msg, _ := types.NewMsgCreateResourceNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description, + msg, err := types.NewMsgCreateResourceNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description, &nodeType) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) diff --git a/x/register/genesis.go b/x/register/genesis.go index 404121d2..d7569516 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -5,18 +5,17 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stratosnet/stratos-chain/x/register/keeper" "github.com/stratosnet/stratos-chain/x/register/types" - abci "github.com/tendermint/tendermint/abci/types" ) // InitGenesis initialize default parameters // and the keeper's address to pubkey map -func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) (res []abci.ValidatorUpdate) { +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) { keeper.SetParams(ctx, *data.Params) initialStakeTotal := sdk.ZeroInt() resNodeBondedToken := sdk.ZeroInt() resNodeNotBondedToken := sdk.ZeroInt() - for _, resourceNode := range data.ResourceNodes.GetResourceNodes() { + for _, resourceNode := range data.GetResourceNodes().GetResourceNodes() { if resourceNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(resourceNode.Tokens) resNodeBondedToken = resNodeBondedToken.Add(resourceNode.Tokens) diff --git a/x/register/module.go b/x/register/module.go index df194678..86715471 100644 --- a/x/register/module.go +++ b/x/register/module.go @@ -166,8 +166,9 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. var genesisState types.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, &genesisState) - return InitGenesis(ctx, am.keeper, &genesisState) + return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the staking @@ -177,7 +178,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(gs) } -// Route returns the message routing key for the staking module. +// Route returns the message routing key for the register module. func (am AppModule) Route() sdk.Route { return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) } diff --git a/x/sds/alias.go b/x/sds/alias.go index 43fc57e6..ad8fd1f8 100644 --- a/x/sds/alias.go +++ b/x/sds/alias.go @@ -14,7 +14,7 @@ const ( var ( NewKeeper = keeper.NewKeeper - RegisterCodec = types.RegisterCodec + RegisterCodec = types.RegisterLegacyAminoCodec NewGenesisState = types.NewGenesisState ) diff --git a/x/sds/app_test.go b/x/sds/app_test.go index e9d4cfa0..34737184 100644 --- a/x/sds/app_test.go +++ b/x/sds/app_test.go @@ -1,551 +1,552 @@ package sds -import ( - "log" - "math/rand" - "os" - "strconv" - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/mock" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" - supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/pot" - pottypes "github.com/stratosnet/stratos-chain/x/pot/types" - "github.com/stratosnet/stratos-chain/x/register" - regtypes "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/stratosnet/stratos-chain/x/sds/types" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/ed25519" -) - -var ( - paramSpecificMinedReward = sdk.NewInt(160000000000) - paramSpecificEpoch = sdk.NewInt(100) - - ppNodeOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwnerNew = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - - ppNodePubKey1 = ed25519.GenPrivKey().PubKey() - ppNodeAddr1 = sdk.AccAddress(ppNodePubKey1.Address()) - ppNodeNetworkId1 = stratos.SdsAddress(ppNodePubKey1.Address()) - ppInitialStake1 = sdk.NewInt(100000000) - - ppNodePubKey2 = ed25519.GenPrivKey().PubKey() - ppNodeAddr2 = sdk.AccAddress(ppNodePubKey2.Address()) - ppNodeNetworkId2 = stratos.SdsAddress(ppNodePubKey2.Address()) - ppInitialStake2 = sdk.NewInt(100000000) - - ppNodePubKey3 = ed25519.GenPrivKey().PubKey() - ppNodeAddr3 = sdk.AccAddress(ppNodePubKey3.Address()) - ppNodeNetworkId3 = stratos.SdsAddress(ppNodePubKey3.Address()) - ppInitialStake3 = sdk.NewInt(100000000) - - ppNodePubKey4 = ed25519.GenPrivKey().PubKey() - ppNodeAddr4 = sdk.AccAddress(ppNodePubKey4.Address()) - ppNodeNetworkId4 = stratos.SdsAddress(ppNodePubKey4.Address()) - ppInitialStake4 = sdk.NewInt(100000000) - - ppNodePubKeyNew = ed25519.GenPrivKey().PubKey() - ppNodeAddrNew = sdk.AccAddress(ppNodePubKeyNew.Address()) - ppNodeNetworkIdNew = stratos.SdsAddress(ppNodePubKeyNew.Address()) - ppNodeStakeNew = sdk.NewInt(100000000) -) - -func TestMain(m *testing.M) { - config := stratos.GetConfig() - config.Seal() - exitVal := m.Run() - os.Exit(exitVal) -} - -func TestRandomPurchasedUoz(t *testing.T) { - /********************* initialize mock app *********************/ - - mApp, k, _, registerKeeper, _ := getMockAppPrepay(t) - accs := setupAccounts(mApp) - mock.SetGenesis(mApp, accs) - //mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) - - header := abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx := mApp.BaseApp.NewContext(true, header) - - initialStakeTotal := sdk.NewInt(43000000000000) - registerKeeper.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) - - // setup resource nodes - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - - resourceNodeStake := sdk.NewInt(19000000000000) - resouceNodeTokens := make([]sdk.Int, 0) - numNodes := 10 - for i := 0; i < numNodes; i++ { - resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) - } - - log.Printf("Before: initial stake supply is %v \n\n", initialStakeTotal) - initialUOzonePrice := registerKeeper.GetInitialUOzonePrice(ctx) - log.Printf("Before: initial uozone price is %v \n\n", initialUOzonePrice) - initOzoneLimit := initialStakeTotal.ToDec().Quo(initialUOzonePrice).TruncateInt() - registerKeeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) - log.Printf("Before: remaining ozone limit is %v \n\n", registerKeeper.GetRemainingOzoneLimit(ctx)) - for i, val := range resouceNodeTokens { - tmpResourceNode := regtypes.NewResourceNode(ppNodeNetworkId1, ppNodePubKey1, ppNodeOwner1, regtypes.NewDescription("sds://resourceNode"+strconv.Itoa(i+1), "", "", "", ""), 4, time) - tmpResourceNode.Tokens = val - tmpResourceNode.Status = sdk.Bonded - tmpResourceNode.OwnerAddress = accs[i%5].GetAddress() - ozoneLimitChange, _ := registerKeeper.AddResourceNodeStake(ctx, tmpResourceNode, sdk.NewCoin("ustos", val)) - log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, registerKeeper.GetRemainingOzoneLimit(ctx)) - // doPrepay - randomPurchase := sdk.NewInt(int64(rand.Float64() * 100 * 1000000000)) - purchased, _ := k.Prepay(ctx, accs[i%5].GetAddress(), sdk.NewCoins(sdk.NewCoin("ustos", randomPurchase))) - log.Printf("%v Uoz purchased by %v ustos, remaining ozone limit drops to %v", purchased, randomPurchase, registerKeeper.GetRemainingOzoneLimit(ctx)) - } -} - -func TestPurchasedUoz(t *testing.T) { - /********************* initialize mock app *********************/ - mApp, k, _, registerKeeper, _ := getMockAppPrepay(t) - accs := setupAccounts(mApp) - mock.SetGenesis(mApp, accs) - //mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) - - header := abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx := mApp.BaseApp.NewContext(true, header) - - initialStakeTotal := sdk.NewInt(43000000000000) - registerKeeper.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) - - // setup resource nodes - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - - resourceNodeStake := sdk.NewInt(19000000000000) - resouceNodeTokens := make([]sdk.Int, 0) - numNodes := 10 - for i := 0; i < numNodes; i++ { - resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) - } - - log.Printf("Before: initial stake supply is %v \n\n", initialStakeTotal) - initialUOzonePrice := registerKeeper.GetInitialUOzonePrice(ctx) - log.Printf("Before: initial uozone price is %v \n\n", initialUOzonePrice) - initOzoneLimit := initialStakeTotal.ToDec().Quo(initialUOzonePrice).TruncateInt() - registerKeeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) - log.Printf("Before: remaining ozone limit is %v \n\n", registerKeeper.GetRemainingOzoneLimit(ctx)) - for i, val := range resouceNodeTokens { - tmpResourceNode := regtypes.NewResourceNode(ppNodeNetworkId1, ppNodePubKey1, ppNodeOwner1, regtypes.NewDescription("sds://resourceNode"+strconv.Itoa(i+1), "", "", "", ""), 4, time) - tmpResourceNode.Tokens = val - tmpResourceNode.Status = sdk.Bonded - tmpResourceNode.OwnerAddress = accs[i%5].GetAddress() - ozoneLimitChange, _ := registerKeeper.AddResourceNodeStake(ctx, tmpResourceNode, sdk.NewCoin("ustos", val)) - log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, registerKeeper.GetRemainingOzoneLimit(ctx)) - // doPrepay - purchased, _ := k.Prepay(ctx, accs[i%5].GetAddress(), sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(10000000000)))) - log.Printf("%v Uoz purchased by 10 stos, remaining ozone limit drops to %v", purchased, registerKeeper.GetRemainingOzoneLimit(ctx)) - } -} - -func TestOzoneLimitChange(t *testing.T) { - /********************* initialize mock app *********************/ - mApp, k, _, registerKeeper, _ := getMockApp(t) - accs := setupAccounts(mApp) - mock.SetGenesis(mApp, accs) - - header := abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx := mApp.BaseApp.NewContext(true, header) - - initialStakeTotal := sdk.NewInt(43000000000000) - registerKeeper.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) - - // setup resource nodes - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - - resourceNodeStake := sdk.NewInt(19000000000000) - resouceNodeTokens := make([]sdk.Int, 0) - numNodes := 10 - for i := 0; i < numNodes; i++ { - resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) - } - - //init pp nodes. - log.Printf("Before: initial stake supply is %v \n\n", initialStakeTotal) - initialUOzonePrice := registerKeeper.GetInitialUOzonePrice(ctx) - log.Printf("Before: initial uozone price is %v \n\n", initialUOzonePrice) - //initOzoneLimit := initialStakeTotal.ToDec().Quo(initialUOzonePrice.ToDec()).TruncateInt() - //registerKeeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) - log.Printf("Before: remaining ozone limit is %v \n\n", registerKeeper.GetRemainingOzoneLimit(ctx)) - for i, val := range resouceNodeTokens { - tmpResourceNode := regtypes.NewResourceNode(ppNodeNetworkId1, ppNodePubKey1, ppNodeOwner1, regtypes.NewDescription("sds://resourceNode"+strconv.Itoa(i+1), "", "", "", ""), 4, time) - tmpResourceNode.Tokens = val - tmpResourceNode.Status = sdk.Bonded - tmpResourceNode.OwnerAddress = accs[i%5].GetAddress() - ozoneLimitChange, _ := registerKeeper.AddResourceNodeStake(ctx, tmpResourceNode, sdk.NewCoin("ustos", val)) - log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, registerKeeper.GetRemainingOzoneLimit(ctx)) - // doPrepay - purchased, _ := k.Prepay(ctx, accs[i%5].GetAddress(), sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(10000000000)))) - log.Printf("%v Uoz purchased by 10 stos", purchased) - } -} - -func TestSdsMsgs(t *testing.T) { - - /********************* initialize mock app *********************/ - mApp, keeper, _, _, _ := getMockApp(t) - accs := setupAccounts(mApp) - mock.SetGenesis(mApp, accs) - //mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) - - ///********************* create fileUpload msg *********************/ - log.Print("====== Testing MsgFileUpload ======") - //fileHash, _ := hex.DecodeString(testFileHashHex) - fileUploadMsg := types.NewMsgUpload(testFileHashHex, sdsAccAddr1, stratos.SdsAddress(spP2pAddr), sdsAccAddr2) - headerUpload := abci.Header{Height: mApp.LastBlockHeight() + 1} - mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, headerUpload, []sdk.Msg{fileUploadMsg}, []uint64{18}, []uint64{0}, true, true, sdsAccPrivKey1) - coin := sdk.NewCoin(DefaultDenom, spNodeInitialStakeIdx1) - mock.CheckBalance(t, mApp, spNodeAddrIdx1, sdk.Coins{coin}) - ///********************* create prepay msg *********************/ - log.Print("====== Testing MsgPrepay ======") - coinToPrepay := sdk.NewCoin(DefaultDenom, prepayAmt) - prepayMsg := types.NewMsgPrepay(sdsAccAddr3, sdk.NewCoins(coinToPrepay)) - headerPrepay := abci.Header{Height: mApp.LastBlockHeight() + 1} - mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, headerPrepay, []sdk.Msg{prepayMsg}, []uint64{20}, []uint64{0}, true, true, sdsAccPrivKey3) - newBalanceInt := sdsAccBal3.Sub(prepayAmt) - newBalanceCoin := sdk.NewCoin(DefaultDenom, newBalanceInt) - mock.CheckBalance(t, mApp, sdsAccAddr3, sdk.NewCoins(newBalanceCoin)) - - ///********************* test uozPrice *********************/ - header := abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx := mApp.BaseApp.NewContext(true, header) - log.Print("====== Testing uozPrice ======\n\n") - initS := sdk.NewInt(43000) - initLt := sdk.NewInt(43000) - initPt := sdk.NewCoin(keeper.BondDenom(ctx), sdk.ZeroInt()) - - keeper.RegisterKeeper.SetInitialGenesisStakeTotal(ctx, initS) - keeper.RegisterKeeper.SetTotalUnissuedPrepay(ctx, initPt) - keeper.RegisterKeeper.SetRemainingOzoneLimit(ctx, initLt) - - log.Printf("==== init stake total is %v", keeper.RegisterKeeper.GetInitialGenesisStakeTotal(ctx)) - log.Printf("==== init prepay is %v", keeper.RegisterKeeper.GetTotalUnissuedPrepay(ctx)) - log.Printf("==== ozone limit is %v\n\n", keeper.RegisterKeeper.GetRemainingOzoneLimit(ctx)) - - numPrepay := 5 - prepaySeq := make([]sdk.Int, 0) - for i := 0; i < numPrepay; i++ { - prepaySeq = append(prepaySeq, sdk.NewInt(19000)) - } - - for i, val := range prepaySeq { - S := keeper.RegisterKeeper.GetInitialGenesisStakeTotal(ctx) - Pt := keeper.RegisterKeeper.GetTotalUnissuedPrepay(ctx).Amount - Lt := keeper.RegisterKeeper.GetRemainingOzoneLimit(ctx) - - uozPriceBefore := S.ToDec().Add(Pt.ToDec()).Quo(Lt.ToDec()).TruncateInt() - - uozPurchased := Lt.ToDec(). - Mul(val.ToDec()). - Quo((S. - Add(Pt). - Add(val)).ToDec()). - TruncateInt() - - uozPriceAfter := S.ToDec().Add(Pt.ToDec()).Add(val.ToDec()).Quo(Lt.ToDec().Sub(uozPurchased.ToDec())).TruncateInt() - - Pt = Pt.Add(val) - Lt = Lt.Sub(uozPurchased) - keeper.RegisterKeeper.SetTotalUnissuedPrepay(ctx, sdk.NewCoin(keeper.BondDenom(ctx), Pt)) - keeper.RegisterKeeper.SetRemainingOzoneLimit(ctx, Lt) - log.Printf("---- prepay #%v: %v ustos----", i, val) - log.Printf("uozPriceBefore is %v", uozPriceBefore) - log.Printf("uozPurchased is %v", uozPurchased) - log.Printf("uozPriceAfter is %v", uozPriceAfter) - log.Printf("New Pt is %v", Pt) - log.Printf("New Lt is %v", Lt) - log.Print("\n") - } -} - -func getMockApp(t *testing.T) (*mock.App, Keeper, bank.Keeper, register.Keeper, pot.Keeper) { - mApp := mock.NewApp() - - RegisterCodec(mApp.Cdc) - supply.RegisterCodec(mApp.Cdc) - staking.RegisterCodec(mApp.Cdc) - register.RegisterCodec(mApp.Cdc) - pot.RegisterCodec(mApp.Cdc) - - //keyAcc := sdk.NewKVStoreKey(auth.StoreKey) - keySupply := sdk.NewKVStoreKey(supply.StoreKey) - keyStaking := sdk.NewKVStoreKey(staking.StoreKey) - keyRegister := sdk.NewKVStoreKey(register.StoreKey) - keyPot := sdk.NewKVStoreKey(pot.StoreKey) - keySds := sdk.NewKVStoreKey(StoreKey) - - //db := dbm.NewMemDB() - //ms := store.NewCommitMultiStore(db) - // - //ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keySupply, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keyStaking, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keyPot, sdk.StoreTypeIAVL, db) - //err := ms.LoadLatestVersion() - //require.Nil(t, err) - - feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) - notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) - bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) - - blacklistedAddrs := make(map[string]bool) - blacklistedAddrs[feeCollector.GetAddress().String()] = true - blacklistedAddrs[notBondedPool.GetAddress().String()] = true - blacklistedAddrs[bondPool.GetAddress().String()] = true - - bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) - maccPerms := map[string][]string{ - auth.FeeCollectorName: {"fee_collector"}, - staking.NotBondedPoolName: {supply.Burner, supply.Staking}, - staking.BondedPoolName: {supply.Burner, supply.Staking}, - } - supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) - stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) - registerKeeper := register.NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(register.DefaultParamSpace), mApp.AccountKeeper, bankKeeper) - potKeeper := pot.NewKeeper(mApp.Cdc, keyPot, mApp.ParamsKeeper.Subspace(pot.DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, mApp.AccountKeeper, stakingKeeper, registerKeeper) - keeper := NewKeeper(mApp.Cdc, keySds, mApp.ParamsKeeper.Subspace(DefaultParamSpace), bankKeeper, registerKeeper, potKeeper) - - mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) - mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) - mApp.SetEndBlocker(getEndBlocker(keeper)) - mApp.SetInitChainer(getInitChainer(mApp, keeper, mApp.AccountKeeper, supplyKeeper, - []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, registerKeeper, potKeeper)) - - err := mApp.CompleteSetup(keySds, keyStaking, keySupply, keyRegister, keyPot) - require.NoError(t, err) - - return mApp, keeper, bankKeeper, registerKeeper, potKeeper -} - -func getMockAppPrepay(t *testing.T) (*mock.App, Keeper, bank.Keeper, register.Keeper, pot.Keeper) { - mApp := mock.NewApp() - - RegisterCodec(mApp.Cdc) - supply.RegisterCodec(mApp.Cdc) - staking.RegisterCodec(mApp.Cdc) - register.RegisterCodec(mApp.Cdc) - pot.RegisterCodec(mApp.Cdc) - - //keyAcc := sdk.NewKVStoreKey(auth.StoreKey) - keySupply := sdk.NewKVStoreKey(supply.StoreKey) - keyStaking := sdk.NewKVStoreKey(staking.StoreKey) - keyRegister := sdk.NewKVStoreKey(register.StoreKey) - keyPot := sdk.NewKVStoreKey(pot.StoreKey) - keySds := sdk.NewKVStoreKey(StoreKey) - - //db := dbm.NewMemDB() - //ms := store.NewCommitMultiStore(db) - // - //ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keySupply, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keyStaking, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keyPot, sdk.StoreTypeIAVL, db) - //ms.MountStoreWithDB(keySds, sdk.StoreTypeIAVL, db) - //err := ms.LoadLatestVersion() - //require.Nil(t, err) - - //ctx := sdk.NewContext(ms, abci.Header{ChainID: "foochainid"}, false, tmtLog.NewNopLogger()) - - feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) - notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) - bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) - foundationAccount := supply.NewEmptyModuleAccount(pot.FoundationAccount) - - blacklistedAddrs := make(map[string]bool) - blacklistedAddrs[feeCollector.GetAddress().String()] = true - blacklistedAddrs[notBondedPool.GetAddress().String()] = true - blacklistedAddrs[bondPool.GetAddress().String()] = true - blacklistedAddrs[foundationAccount.GetAddress().String()] = true - - //accountKeeper := auth.NewAccountKeeper(mApp.Cdc, keyAcc, mApp.ParamsKeeper.Subspace(auth.DefaultParamspace), auth.ProtoBaseAccount) - bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) - maccPerms := map[string][]string{ - auth.FeeCollectorName: {"fee_collector"}, - staking.NotBondedPoolName: {supply.Burner, supply.Staking}, - staking.BondedPoolName: {supply.Burner, supply.Staking}, - } - supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) - stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) - registerKeeper := register.NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(register.DefaultParamSpace), mApp.AccountKeeper, bankKeeper) - potKeeper := pot.NewKeeper(mApp.Cdc, keyPot, mApp.ParamsKeeper.Subspace(pot.DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, mApp.AccountKeeper, stakingKeeper, registerKeeper) - - keeper := NewKeeper(mApp.Cdc, keySds, mApp.ParamsKeeper.Subspace(DefaultParamSpace), bankKeeper, registerKeeper, potKeeper) - - mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) - mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) - mApp.SetEndBlocker(getEndBlocker(keeper)) - mApp.SetInitChainer(getInitChainerTestPurchase(mApp, keeper, mApp.AccountKeeper, supplyKeeper, - []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, registerKeeper, potKeeper)) - - err := mApp.CompleteSetup(keySds, keyStaking, keySupply, keyRegister, keyPot) - require.NoError(t, err) - - return mApp, keeper, bankKeeper, registerKeeper, potKeeper -} - -// getInitChainer initializes the chainer of the mock app and sets the genesis -// state. It returns an empty ResponseInitChain. -func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, - blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper, potKeeper pot.Keeper) sdk.InitChainer { - return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - mapp.InitChainer(ctx, req) - - resourceNodes := setupAllResourceNodes() - indexingNodes := setupAllIndexingNodes() - - registerGenesis := register.NewGenesisState( - register.DefaultParams(), - resourceNodes, - indexingNodes, - initialUOzonePrice, - sdk.ZeroInt(), - make([]register.Slashing, 0), - ) - - register.InitGenesis(ctx, registerKeeper, registerGenesis) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, DefaultDenom), nil, nil) - - totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) - supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) - - //preset - registerKeeper.SetRemainingOzoneLimit(ctx, remainingOzoneLimit) - registerKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrepay) - - //pot genesis data load - pot.InitGenesis(ctx, potKeeper, pot.NewGenesisState( - pottypes.DefaultParams(), - sdk.NewCoin(pottypes.DefaultRewardDenom, sdk.ZeroInt()), - 0, - make([]pottypes.ImmatureTotal, 0), - make([]pottypes.MatureTotal, 0), - make([]pottypes.Reward, 0), - )) - - // init bank genesis - keeper.BankKeeper.SetSendEnabled(ctx, true) - - InitGenesis(ctx, keeper, NewGenesisState(types.DefaultParams(), nil)) - - return abci.ResponseInitChain{ - Validators: validators, - } - } -} - -// getInitChainer initializes the chainer of the mock app and sets the genesis -// state. It returns an empty ResponseInitChain. -func getInitChainerTestPurchase(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, - blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper, potKeeper pot.Keeper) sdk.InitChainer { - return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - mapp.InitChainer(ctx, req) - - //resourceNodes := setupAllResourceNodes() - indexingNodes := setupAllIndexingNodes() - - registerGenesis := register.NewGenesisState( - register.DefaultParams(), - nil, - indexingNodes, - initialUOzonePriceTestPurchase, - sdk.ZeroInt(), - make([]register.Slashing, 0), - ) - - register.InitGenesis(ctx, registerKeeper, registerGenesis) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, DefaultDenom), nil, nil) - - totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) - supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) - - //preset - registerKeeper.SetRemainingOzoneLimit(ctx, remainingOzoneLimitTestPurchase) - - //pot genesis data load - pot.InitGenesis(ctx, potKeeper, pot.NewGenesisState( - pottypes.DefaultParams(), - sdk.NewCoin(pottypes.DefaultRewardDenom, sdk.ZeroInt()), - 0, - make([]pottypes.ImmatureTotal, 0), - make([]pottypes.MatureTotal, 0), - make([]pottypes.Reward, 0), - )) - - registerKeeper.SetTotalUnissuedPrepay(ctx, sdk.NewCoin(potKeeper.BondDenom(ctx), totalUnissuedPrepayTestPurchase)) - // init bank genesis - keeper.BankKeeper.SetSendEnabled(ctx, true) - - InitGenesis(ctx, keeper, NewGenesisState(types.DefaultParams(), nil)) - - return abci.ResponseInitChain{ - Validators: validators, - } - } -} - -// getEndBlocker returns a staking endblocker. -func getEndBlocker(keeper Keeper) sdk.EndBlocker { - return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - validatorUpdates := keeper.PotKeeper.StakingKeeper.BlockValidatorUpdates(ctx) - - return abci.ResponseEndBlock{ - ValidatorUpdates: validatorUpdates, - } - } - return nil -} +// +//import ( +// "log" +// "math/rand" +// "os" +// "strconv" +// "testing" +// "time" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/cosmos/cosmos-sdk/x/mock" +// "github.com/cosmos/cosmos-sdk/x/staking" +// "github.com/cosmos/cosmos-sdk/x/supply" +// supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/pot" +// pottypes "github.com/stratosnet/stratos-chain/x/pot/types" +// "github.com/stratosnet/stratos-chain/x/register" +// regtypes "github.com/stratosnet/stratos-chain/x/register/types" +// "github.com/stratosnet/stratos-chain/x/sds/types" +// "github.com/stretchr/testify/require" +// abci "github.com/tendermint/tendermint/abci/types" +// "github.com/tendermint/tendermint/crypto/ed25519" +//) +// +//var ( +// paramSpecificMinedReward = sdk.NewInt(160000000000) +// paramSpecificEpoch = sdk.NewInt(100) +// +// ppNodeOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwnerNew = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// +// ppNodePubKey1 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr1 = sdk.AccAddress(ppNodePubKey1.Address()) +// ppNodeNetworkId1 = stratos.SdsAddress(ppNodePubKey1.Address()) +// ppInitialStake1 = sdk.NewInt(100000000) +// +// ppNodePubKey2 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr2 = sdk.AccAddress(ppNodePubKey2.Address()) +// ppNodeNetworkId2 = stratos.SdsAddress(ppNodePubKey2.Address()) +// ppInitialStake2 = sdk.NewInt(100000000) +// +// ppNodePubKey3 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr3 = sdk.AccAddress(ppNodePubKey3.Address()) +// ppNodeNetworkId3 = stratos.SdsAddress(ppNodePubKey3.Address()) +// ppInitialStake3 = sdk.NewInt(100000000) +// +// ppNodePubKey4 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr4 = sdk.AccAddress(ppNodePubKey4.Address()) +// ppNodeNetworkId4 = stratos.SdsAddress(ppNodePubKey4.Address()) +// ppInitialStake4 = sdk.NewInt(100000000) +// +// ppNodePubKeyNew = ed25519.GenPrivKey().PubKey() +// ppNodeAddrNew = sdk.AccAddress(ppNodePubKeyNew.Address()) +// ppNodeNetworkIdNew = stratos.SdsAddress(ppNodePubKeyNew.Address()) +// ppNodeStakeNew = sdk.NewInt(100000000) +//) +// +//func TestMain(m *testing.M) { +// config := stratos.GetConfig() +// config.Seal() +// exitVal := m.Run() +// os.Exit(exitVal) +//} +// +//func TestRandomPurchasedUoz(t *testing.T) { +// /********************* initialize mock app *********************/ +// +// mApp, k, _, registerKeeper, _ := getMockAppPrepay(t) +// accs := setupAccounts(mApp) +// mock.SetGenesis(mApp, accs) +// //mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) +// +// header := abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx := mApp.BaseApp.NewContext(true, header) +// +// initialStakeTotal := sdk.NewInt(43000000000000) +// registerKeeper.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) +// +// // setup resource nodes +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// +// resourceNodeStake := sdk.NewInt(19000000000000) +// resouceNodeTokens := make([]sdk.Int, 0) +// numNodes := 10 +// for i := 0; i < numNodes; i++ { +// resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) +// } +// +// log.Printf("Before: initial stake supply is %v \n\n", initialStakeTotal) +// initialUOzonePrice := registerKeeper.GetInitialUOzonePrice(ctx) +// log.Printf("Before: initial uozone price is %v \n\n", initialUOzonePrice) +// initOzoneLimit := initialStakeTotal.ToDec().Quo(initialUOzonePrice).TruncateInt() +// registerKeeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) +// log.Printf("Before: remaining ozone limit is %v \n\n", registerKeeper.GetRemainingOzoneLimit(ctx)) +// for i, val := range resouceNodeTokens { +// tmpResourceNode := regtypes.NewResourceNode(ppNodeNetworkId1, ppNodePubKey1, ppNodeOwner1, regtypes.NewDescription("sds://resourceNode"+strconv.Itoa(i+1), "", "", "", ""), 4, time) +// tmpResourceNode.Tokens = val +// tmpResourceNode.Status = sdk.Bonded +// tmpResourceNode.OwnerAddress = accs[i%5].GetAddress() +// ozoneLimitChange, _ := registerKeeper.AddResourceNodeStake(ctx, tmpResourceNode, sdk.NewCoin("ustos", val)) +// log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, registerKeeper.GetRemainingOzoneLimit(ctx)) +// // doPrepay +// randomPurchase := sdk.NewInt(int64(rand.Float64() * 100 * 1000000000)) +// purchased, _ := k.Prepay(ctx, accs[i%5].GetAddress(), sdk.NewCoins(sdk.NewCoin("ustos", randomPurchase))) +// log.Printf("%v Uoz purchased by %v ustos, remaining ozone limit drops to %v", purchased, randomPurchase, registerKeeper.GetRemainingOzoneLimit(ctx)) +// } +//} +// +//func TestPurchasedUoz(t *testing.T) { +// /********************* initialize mock app *********************/ +// mApp, k, _, registerKeeper, _ := getMockAppPrepay(t) +// accs := setupAccounts(mApp) +// mock.SetGenesis(mApp, accs) +// //mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) +// +// header := abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx := mApp.BaseApp.NewContext(true, header) +// +// initialStakeTotal := sdk.NewInt(43000000000000) +// registerKeeper.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) +// +// // setup resource nodes +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// +// resourceNodeStake := sdk.NewInt(19000000000000) +// resouceNodeTokens := make([]sdk.Int, 0) +// numNodes := 10 +// for i := 0; i < numNodes; i++ { +// resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) +// } +// +// log.Printf("Before: initial stake supply is %v \n\n", initialStakeTotal) +// initialUOzonePrice := registerKeeper.GetInitialUOzonePrice(ctx) +// log.Printf("Before: initial uozone price is %v \n\n", initialUOzonePrice) +// initOzoneLimit := initialStakeTotal.ToDec().Quo(initialUOzonePrice).TruncateInt() +// registerKeeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) +// log.Printf("Before: remaining ozone limit is %v \n\n", registerKeeper.GetRemainingOzoneLimit(ctx)) +// for i, val := range resouceNodeTokens { +// tmpResourceNode := regtypes.NewResourceNode(ppNodeNetworkId1, ppNodePubKey1, ppNodeOwner1, regtypes.NewDescription("sds://resourceNode"+strconv.Itoa(i+1), "", "", "", ""), 4, time) +// tmpResourceNode.Tokens = val +// tmpResourceNode.Status = sdk.Bonded +// tmpResourceNode.OwnerAddress = accs[i%5].GetAddress() +// ozoneLimitChange, _ := registerKeeper.AddResourceNodeStake(ctx, tmpResourceNode, sdk.NewCoin("ustos", val)) +// log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, registerKeeper.GetRemainingOzoneLimit(ctx)) +// // doPrepay +// purchased, _ := k.Prepay(ctx, accs[i%5].GetAddress(), sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(10000000000)))) +// log.Printf("%v Uoz purchased by 10 stos, remaining ozone limit drops to %v", purchased, registerKeeper.GetRemainingOzoneLimit(ctx)) +// } +//} +// +//func TestOzoneLimitChange(t *testing.T) { +// /********************* initialize mock app *********************/ +// mApp, k, _, registerKeeper, _ := getMockApp(t) +// accs := setupAccounts(mApp) +// mock.SetGenesis(mApp, accs) +// +// header := abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx := mApp.BaseApp.NewContext(true, header) +// +// initialStakeTotal := sdk.NewInt(43000000000000) +// registerKeeper.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) +// +// // setup resource nodes +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// +// resourceNodeStake := sdk.NewInt(19000000000000) +// resouceNodeTokens := make([]sdk.Int, 0) +// numNodes := 10 +// for i := 0; i < numNodes; i++ { +// resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) +// } +// +// //init pp nodes. +// log.Printf("Before: initial stake supply is %v \n\n", initialStakeTotal) +// initialUOzonePrice := registerKeeper.GetInitialUOzonePrice(ctx) +// log.Printf("Before: initial uozone price is %v \n\n", initialUOzonePrice) +// //initOzoneLimit := initialStakeTotal.ToDec().Quo(initialUOzonePrice.ToDec()).TruncateInt() +// //registerKeeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) +// log.Printf("Before: remaining ozone limit is %v \n\n", registerKeeper.GetRemainingOzoneLimit(ctx)) +// for i, val := range resouceNodeTokens { +// tmpResourceNode := regtypes.NewResourceNode(ppNodeNetworkId1, ppNodePubKey1, ppNodeOwner1, regtypes.NewDescription("sds://resourceNode"+strconv.Itoa(i+1), "", "", "", ""), 4, time) +// tmpResourceNode.Tokens = val +// tmpResourceNode.Status = sdk.Bonded +// tmpResourceNode.OwnerAddress = accs[i%5].GetAddress() +// ozoneLimitChange, _ := registerKeeper.AddResourceNodeStake(ctx, tmpResourceNode, sdk.NewCoin("ustos", val)) +// log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, registerKeeper.GetRemainingOzoneLimit(ctx)) +// // doPrepay +// purchased, _ := k.Prepay(ctx, accs[i%5].GetAddress(), sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(10000000000)))) +// log.Printf("%v Uoz purchased by 10 stos", purchased) +// } +//} +// +//func TestSdsMsgs(t *testing.T) { +// +// /********************* initialize mock app *********************/ +// mApp, keeper, _, _, _ := getMockApp(t) +// accs := setupAccounts(mApp) +// mock.SetGenesis(mApp, accs) +// //mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) +// +// ///********************* create fileUpload msg *********************/ +// log.Print("====== Testing MsgFileUpload ======") +// //fileHash, _ := hex.DecodeString(testFileHashHex) +// fileUploadMsg := types.NewMsgUpload(testFileHashHex, sdsAccAddr1, stratos.SdsAddress(spP2pAddr), sdsAccAddr2) +// headerUpload := abci.Header{Height: mApp.LastBlockHeight() + 1} +// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, headerUpload, []sdk.Msg{fileUploadMsg}, []uint64{18}, []uint64{0}, true, true, sdsAccPrivKey1) +// coin := sdk.NewCoin(DefaultDenom, spNodeInitialStakeIdx1) +// mock.CheckBalance(t, mApp, spNodeAddrIdx1, sdk.Coins{coin}) +// ///********************* create prepay msg *********************/ +// log.Print("====== Testing MsgPrepay ======") +// coinToPrepay := sdk.NewCoin(DefaultDenom, prepayAmt) +// prepayMsg := types.NewMsgPrepay(sdsAccAddr3, sdk.NewCoins(coinToPrepay)) +// headerPrepay := abci.Header{Height: mApp.LastBlockHeight() + 1} +// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, headerPrepay, []sdk.Msg{prepayMsg}, []uint64{20}, []uint64{0}, true, true, sdsAccPrivKey3) +// newBalanceInt := sdsAccBal3.Sub(prepayAmt) +// newBalanceCoin := sdk.NewCoin(DefaultDenom, newBalanceInt) +// mock.CheckBalance(t, mApp, sdsAccAddr3, sdk.NewCoins(newBalanceCoin)) +// +// ///********************* test uozPrice *********************/ +// header := abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx := mApp.BaseApp.NewContext(true, header) +// log.Print("====== Testing uozPrice ======\n\n") +// initS := sdk.NewInt(43000) +// initLt := sdk.NewInt(43000) +// initPt := sdk.NewCoin(keeper.BondDenom(ctx), sdk.ZeroInt()) +// +// keeper.RegisterKeeper.SetInitialGenesisStakeTotal(ctx, initS) +// keeper.RegisterKeeper.SetTotalUnissuedPrepay(ctx, initPt) +// keeper.RegisterKeeper.SetRemainingOzoneLimit(ctx, initLt) +// +// log.Printf("==== init stake total is %v", keeper.RegisterKeeper.GetInitialGenesisStakeTotal(ctx)) +// log.Printf("==== init prepay is %v", keeper.RegisterKeeper.GetTotalUnissuedPrepay(ctx)) +// log.Printf("==== ozone limit is %v\n\n", keeper.RegisterKeeper.GetRemainingOzoneLimit(ctx)) +// +// numPrepay := 5 +// prepaySeq := make([]sdk.Int, 0) +// for i := 0; i < numPrepay; i++ { +// prepaySeq = append(prepaySeq, sdk.NewInt(19000)) +// } +// +// for i, val := range prepaySeq { +// S := keeper.RegisterKeeper.GetInitialGenesisStakeTotal(ctx) +// Pt := keeper.RegisterKeeper.GetTotalUnissuedPrepay(ctx).Amount +// Lt := keeper.RegisterKeeper.GetRemainingOzoneLimit(ctx) +// +// uozPriceBefore := S.ToDec().Add(Pt.ToDec()).Quo(Lt.ToDec()).TruncateInt() +// +// uozPurchased := Lt.ToDec(). +// Mul(val.ToDec()). +// Quo((S. +// Add(Pt). +// Add(val)).ToDec()). +// TruncateInt() +// +// uozPriceAfter := S.ToDec().Add(Pt.ToDec()).Add(val.ToDec()).Quo(Lt.ToDec().Sub(uozPurchased.ToDec())).TruncateInt() +// +// Pt = Pt.Add(val) +// Lt = Lt.Sub(uozPurchased) +// keeper.RegisterKeeper.SetTotalUnissuedPrepay(ctx, sdk.NewCoin(keeper.BondDenom(ctx), Pt)) +// keeper.RegisterKeeper.SetRemainingOzoneLimit(ctx, Lt) +// log.Printf("---- prepay #%v: %v ustos----", i, val) +// log.Printf("uozPriceBefore is %v", uozPriceBefore) +// log.Printf("uozPurchased is %v", uozPurchased) +// log.Printf("uozPriceAfter is %v", uozPriceAfter) +// log.Printf("New Pt is %v", Pt) +// log.Printf("New Lt is %v", Lt) +// log.Print("\n") +// } +//} +// +//func getMockApp(t *testing.T) (*mock.App, Keeper, bank.Keeper, register.Keeper, pot.Keeper) { +// mApp := mock.NewApp() +// +// RegisterCodec(mApp.Cdc) +// supply.RegisterCodec(mApp.Cdc) +// staking.RegisterCodec(mApp.Cdc) +// register.RegisterCodec(mApp.Cdc) +// pot.RegisterCodec(mApp.Cdc) +// +// //keyAcc := sdk.NewKVStoreKey(auth.StoreKey) +// keySupply := sdk.NewKVStoreKey(supply.StoreKey) +// keyStaking := sdk.NewKVStoreKey(staking.StoreKey) +// keyRegister := sdk.NewKVStoreKey(register.StoreKey) +// keyPot := sdk.NewKVStoreKey(pot.StoreKey) +// keySds := sdk.NewKVStoreKey(StoreKey) +// +// //db := dbm.NewMemDB() +// //ms := store.NewCommitMultiStore(db) +// // +// //ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keySupply, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keyStaking, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keyPot, sdk.StoreTypeIAVL, db) +// //err := ms.LoadLatestVersion() +// //require.Nil(t, err) +// +// feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) +// notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) +// bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) +// +// blacklistedAddrs := make(map[string]bool) +// blacklistedAddrs[feeCollector.GetAddress().String()] = true +// blacklistedAddrs[notBondedPool.GetAddress().String()] = true +// blacklistedAddrs[bondPool.GetAddress().String()] = true +// +// bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) +// maccPerms := map[string][]string{ +// auth.FeeCollectorName: {"fee_collector"}, +// staking.NotBondedPoolName: {supply.Burner, supply.Staking}, +// staking.BondedPoolName: {supply.Burner, supply.Staking}, +// } +// supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) +// stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) +// registerKeeper := register.NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(register.DefaultParamSpace), mApp.AccountKeeper, bankKeeper) +// potKeeper := pot.NewKeeper(mApp.Cdc, keyPot, mApp.ParamsKeeper.Subspace(pot.DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, mApp.AccountKeeper, stakingKeeper, registerKeeper) +// keeper := NewKeeper(mApp.Cdc, keySds, mApp.ParamsKeeper.Subspace(DefaultParamSpace), bankKeeper, registerKeeper, potKeeper) +// +// mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) +// mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) +// mApp.SetEndBlocker(getEndBlocker(keeper)) +// mApp.SetInitChainer(getInitChainer(mApp, keeper, mApp.AccountKeeper, supplyKeeper, +// []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, registerKeeper, potKeeper)) +// +// err := mApp.CompleteSetup(keySds, keyStaking, keySupply, keyRegister, keyPot) +// require.NoError(t, err) +// +// return mApp, keeper, bankKeeper, registerKeeper, potKeeper +//} +// +//func getMockAppPrepay(t *testing.T) (*mock.App, Keeper, bank.Keeper, register.Keeper, pot.Keeper) { +// mApp := mock.NewApp() +// +// RegisterCodec(mApp.Cdc) +// supply.RegisterCodec(mApp.Cdc) +// staking.RegisterCodec(mApp.Cdc) +// register.RegisterCodec(mApp.Cdc) +// pot.RegisterCodec(mApp.Cdc) +// +// //keyAcc := sdk.NewKVStoreKey(auth.StoreKey) +// keySupply := sdk.NewKVStoreKey(supply.StoreKey) +// keyStaking := sdk.NewKVStoreKey(staking.StoreKey) +// keyRegister := sdk.NewKVStoreKey(register.StoreKey) +// keyPot := sdk.NewKVStoreKey(pot.StoreKey) +// keySds := sdk.NewKVStoreKey(StoreKey) +// +// //db := dbm.NewMemDB() +// //ms := store.NewCommitMultiStore(db) +// // +// //ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keySupply, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keyStaking, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keyPot, sdk.StoreTypeIAVL, db) +// //ms.MountStoreWithDB(keySds, sdk.StoreTypeIAVL, db) +// //err := ms.LoadLatestVersion() +// //require.Nil(t, err) +// +// //ctx := sdk.NewContext(ms, abci.Header{ChainID: "foochainid"}, false, tmtLog.NewNopLogger()) +// +// feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) +// notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) +// bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) +// foundationAccount := supply.NewEmptyModuleAccount(pot.FoundationAccount) +// +// blacklistedAddrs := make(map[string]bool) +// blacklistedAddrs[feeCollector.GetAddress().String()] = true +// blacklistedAddrs[notBondedPool.GetAddress().String()] = true +// blacklistedAddrs[bondPool.GetAddress().String()] = true +// blacklistedAddrs[foundationAccount.GetAddress().String()] = true +// +// //accountKeeper := auth.NewAccountKeeper(mApp.Cdc, keyAcc, mApp.ParamsKeeper.Subspace(auth.DefaultParamspace), auth.ProtoBaseAccount) +// bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) +// maccPerms := map[string][]string{ +// auth.FeeCollectorName: {"fee_collector"}, +// staking.NotBondedPoolName: {supply.Burner, supply.Staking}, +// staking.BondedPoolName: {supply.Burner, supply.Staking}, +// } +// supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) +// stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) +// registerKeeper := register.NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(register.DefaultParamSpace), mApp.AccountKeeper, bankKeeper) +// potKeeper := pot.NewKeeper(mApp.Cdc, keyPot, mApp.ParamsKeeper.Subspace(pot.DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, mApp.AccountKeeper, stakingKeeper, registerKeeper) +// +// keeper := NewKeeper(mApp.Cdc, keySds, mApp.ParamsKeeper.Subspace(DefaultParamSpace), bankKeeper, registerKeeper, potKeeper) +// +// mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) +// mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) +// mApp.SetEndBlocker(getEndBlocker(keeper)) +// mApp.SetInitChainer(getInitChainerTestPurchase(mApp, keeper, mApp.AccountKeeper, supplyKeeper, +// []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, registerKeeper, potKeeper)) +// +// err := mApp.CompleteSetup(keySds, keyStaking, keySupply, keyRegister, keyPot) +// require.NoError(t, err) +// +// return mApp, keeper, bankKeeper, registerKeeper, potKeeper +//} +// +//// getInitChainer initializes the chainer of the mock app and sets the genesis +//// state. It returns an empty ResponseInitChain. +//func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, +// blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper, potKeeper pot.Keeper) sdk.InitChainer { +// return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// mapp.InitChainer(ctx, req) +// +// resourceNodes := setupAllResourceNodes() +// indexingNodes := setupAllIndexingNodes() +// +// registerGenesis := register.NewGenesisState( +// register.DefaultParams(), +// resourceNodes, +// indexingNodes, +// initialUOzonePrice, +// sdk.ZeroInt(), +// make([]register.Slashing, 0), +// ) +// +// register.InitGenesis(ctx, registerKeeper, registerGenesis) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, DefaultDenom), nil, nil) +// +// totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) +// supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) +// +// //preset +// registerKeeper.SetRemainingOzoneLimit(ctx, remainingOzoneLimit) +// registerKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrepay) +// +// //pot genesis data load +// pot.InitGenesis(ctx, potKeeper, pot.NewGenesisState( +// pottypes.DefaultParams(), +// sdk.NewCoin(pottypes.DefaultRewardDenom, sdk.ZeroInt()), +// 0, +// make([]pottypes.ImmatureTotal, 0), +// make([]pottypes.MatureTotal, 0), +// make([]pottypes.Reward, 0), +// )) +// +// // init bank genesis +// keeper.BankKeeper.SetSendEnabled(ctx, true) +// +// InitGenesis(ctx, keeper, NewGenesisState(types.DefaultParams(), nil)) +// +// return abci.ResponseInitChain{ +// Validators: validators, +// } +// } +//} +// +//// getInitChainer initializes the chainer of the mock app and sets the genesis +//// state. It returns an empty ResponseInitChain. +//func getInitChainerTestPurchase(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, +// blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper, potKeeper pot.Keeper) sdk.InitChainer { +// return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// mapp.InitChainer(ctx, req) +// +// //resourceNodes := setupAllResourceNodes() +// indexingNodes := setupAllIndexingNodes() +// +// registerGenesis := register.NewGenesisState( +// register.DefaultParams(), +// nil, +// indexingNodes, +// initialUOzonePriceTestPurchase, +// sdk.ZeroInt(), +// make([]register.Slashing, 0), +// ) +// +// register.InitGenesis(ctx, registerKeeper, registerGenesis) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, DefaultDenom), nil, nil) +// +// totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) +// supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) +// +// //preset +// registerKeeper.SetRemainingOzoneLimit(ctx, remainingOzoneLimitTestPurchase) +// +// //pot genesis data load +// pot.InitGenesis(ctx, potKeeper, pot.NewGenesisState( +// pottypes.DefaultParams(), +// sdk.NewCoin(pottypes.DefaultRewardDenom, sdk.ZeroInt()), +// 0, +// make([]pottypes.ImmatureTotal, 0), +// make([]pottypes.MatureTotal, 0), +// make([]pottypes.Reward, 0), +// )) +// +// registerKeeper.SetTotalUnissuedPrepay(ctx, sdk.NewCoin(potKeeper.BondDenom(ctx), totalUnissuedPrepayTestPurchase)) +// // init bank genesis +// keeper.BankKeeper.SetSendEnabled(ctx, true) +// +// InitGenesis(ctx, keeper, NewGenesisState(types.DefaultParams(), nil)) +// +// return abci.ResponseInitChain{ +// Validators: validators, +// } +// } +//} +// +//// getEndBlocker returns a staking endblocker. +//func getEndBlocker(keeper Keeper) sdk.EndBlocker { +// return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { +// validatorUpdates := keeper.PotKeeper.StakingKeeper.BlockValidatorUpdates(ctx) +// +// return abci.ResponseEndBlock{ +// ValidatorUpdates: validatorUpdates, +// } +// } +// return nil +//} diff --git a/x/sds/client/cli/query.go b/x/sds/client/cli/query.go index 95d34ee8..9f1ca999 100644 --- a/x/sds/client/cli/query.go +++ b/x/sds/client/cli/query.go @@ -2,24 +2,18 @@ package cli import ( "fmt" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/version" - "github.com/stratosnet/stratos-chain/x/sds/client/common" "strings" - // "strings" - - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + "github.com/spf13/viper" "github.com/stratosnet/stratos-chain/x/sds/types" ) // GetQueryCmd returns the cli query commands for sds module -func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { +func GetQueryCmd() *cobra.Command { // Group sds queries under a subcommand sdsQueryCmd := &cobra.Command{ Use: types.ModuleName, @@ -30,18 +24,17 @@ func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { } sdsQueryCmd.AddCommand( - flags.GetCommands( - GetCmdQueryUploadedFile(queryRoute, cdc), - GetCmdQueryPrepayBalance(queryRoute, cdc), - )..., + GetCmdQueryUploadedFile(), + GetCmdQueryPrepayBalance(), ) return sdsQueryCmd } // GetCmdQueryUploadedFile implements the query uploaded file command. -func GetCmdQueryUploadedFile(queryRoute string, cdc *codec.Codec) *cobra.Command { - return &cobra.Command{ +func GetCmdQueryUploadedFile() *cobra.Command { + cmd := &cobra.Command{ + //return &cobra.Command{ Use: "upload [file_hash]", Args: cobra.ExactArgs(1), Short: "Query uploaded file info by hash", @@ -51,52 +44,80 @@ func GetCmdQueryUploadedFile(queryRoute string, cdc *codec.Codec) *cobra.Command Example: $ %s query sds upload c03661732294feb49caf6dc16c7cbb2534986d73 `, - version.ClientName, + version.AppName, ), ), RunE: func(cmd *cobra.Command, args []string) error { - cliCtx := context.NewCLIContext().WithCodec(cdc) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + queryFileHash := viper.GetString(FlagFileHash) + if len(queryFileHash) == 0 { + return sdkerrors.Wrap(types.ErrEmptyFileHash, "Missing file hash") + } // query file by fileHash - resp, _, err := common.QueryUploadedFile(cliCtx, queryRoute, args[0]) + //resp, _, err := common.QueryUploadedFile(clientCtx, queryRoute, args[0]) + //if err != nil { + // return err + //} + //fi := types.MustUnmarshalFileInfo(cdc, resp) + //return cliCtx.PrintOutput(fi.String()) + + result, err := queryClient.Fileupload(cmd.Context(), &types.QueryFileUploadRequest{ + FileHash: queryFileHash, + }) if err != nil { return err } - fi := types.MustUnmarshalFileInfo(cdc, resp) - return cliCtx.PrintOutput(fi.String()) + + return clientCtx.PrintProto(result) }, } + cmd.Flags().String(FlagFileHash, "", "the file hash") + return cmd } // GetCmdQueryPrepayBalance implements the query prepay balance command. -func GetCmdQueryPrepayBalance(queryRoute string, cdc *codec.Codec) *cobra.Command { - return &cobra.Command{ +func GetCmdQueryPrepayBalance() *cobra.Command { + cmd := &cobra.Command{ Use: "prepay [acct_addr]", Args: cobra.ExactArgs(1), - Short: "Query balance of prepayment in Volumn Pool", + Short: "Query balance of prepayment in Volume Pool", Long: strings.TrimSpace( fmt.Sprintf(`Query balance of prepayment in Volumn Pool. Example: $ %s query sds prepay st1yx3kkx9jnqeck59j744nc5qgtv4lt4dc45jcwz `, - version.ClientName, + version.AppName, ), ), RunE: func(cmd *cobra.Command, args []string) error { - cliCtx := context.NewCLIContext().WithCodec(cdc) - - // query prepay balance - resp, _, err := common.QueryPrepayBalance(cliCtx, queryRoute, args[0]) + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } - var prepaidBalance sdk.Int - error := prepaidBalance.UnmarshalJSON(resp) - if error != nil { - return error + queryClient := types.NewQueryClient(clientCtx) + + queryAccAddr := viper.GetString(args[0]) + if len(queryAccAddr) == 0 { + return sdkerrors.Wrap(types.ErrEmptySenderAddr, "Missing sender address") + } + + result, err := queryClient.Prepay(cmd.Context(), &types.QueryPrepayRequest{ + AcctAddr: queryAccAddr, + }) + if err != nil { + return err } - return cliCtx.PrintOutput(prepaidBalance.String()) + + return clientCtx.PrintProto(result) }, } + cmd.Flags().String(FlagFileHash, "", "the file hash") + return cmd } diff --git a/x/sds/client/cli/tx.go b/x/sds/client/cli/tx.go index d29c46af..a80d7d6a 100644 --- a/x/sds/client/cli/tx.go +++ b/x/sds/client/cli/tx.go @@ -1,26 +1,23 @@ package cli import ( - "bufio" "encoding/hex" "fmt" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" "github.com/spf13/viper" stratos "github.com/stratosnet/stratos-chain/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + flag "github.com/spf13/pflag" "github.com/stratosnet/stratos-chain/x/sds/types" ) // GetTxCmd returns the transaction commands for this module -func GetTxCmd(cdc *codec.Codec) *cobra.Command { +func GetTxCmd() *cobra.Command { sdsTxCmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), @@ -30,81 +27,126 @@ func GetTxCmd(cdc *codec.Codec) *cobra.Command { } sdsTxCmd.AddCommand( - FileUploadTxCmd(cdc), - PrepayTxCmd(cdc), + FileUploadTxCmd(), + PrepayTxCmd(), ) return sdsTxCmd } // FileUploadTxCmd will create a file upload tx and sign it with the given key. -func FileUploadTxCmd(cdc *codec.Codec) *cobra.Command { +func FileUploadTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: "upload [flags]", Short: "Create and sign a file upload tx", Args: cobra.RangeArgs(0, 3), RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - - fileHash := viper.GetString(FlagFileHash) - _, err := hex.DecodeString(fileHash) - if err != nil { - return err - } - - reporter, err := stratos.SdsAddressFromBech32(viper.GetString(FlagReporter)) + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - uploader, err := sdk.AccAddressFromBech32(viper.GetString(FlagUploader)) + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildFileuploadMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - // build and sign the transaction, then broadcast to Tendermint - msg := types.NewMsgUpload(fileHash, cliCtx.GetFromAddress(), reporter, uploader) - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } - cmd = flags.PostCommands(cmd)[0] + //cmd = flags.PostCommands(cmd)[0] //cmd.Flags().String(flags.FlagFrom, "", "from address") cmd.Flags().String(FlagFileHash, "", "Hash of uploaded file") cmd.Flags().String(FlagReporter, "", "Reporter of file") cmd.Flags().String(FlagUploader, "", "Uploader of file") - cmd.MarkFlagRequired(flags.FlagFrom) - cmd.MarkFlagRequired(FlagFileHash) - cmd.MarkFlagRequired(FlagReporter) - cmd.MarkFlagRequired(FlagUploader) + _ = cmd.MarkFlagRequired(flags.FlagFrom) + _ = cmd.MarkFlagRequired(FlagFileHash) + _ = cmd.MarkFlagRequired(FlagReporter) + _ = cmd.MarkFlagRequired(FlagUploader) return cmd } // PrepayTxCmd will create a prepay tx and sign it with the given key. -func PrepayTxCmd(cdc *codec.Codec) *cobra.Command { +func PrepayTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: "prepay [from_address] [coins]", Short: "Create and sign a prepay tx", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, args[0]).WithCodec(cdc) + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } - coins, err := sdk.ParseCoins(args[1]) + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildPrepayMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - // build and sign the transaction, then broadcast to Tendermint - msg := types.NewMsgPrepay(cliCtx.GetFromAddress(), coins) - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + // + // + // + //inBuf := bufio.NewReader(cmd.InOrStdin()) + //txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) + //cliCtx := context.NewCLIContextWithInputAndFrom(inBuf, args[0]).WithCodec(cdc) + // + //coins, err := sdk.ParseCoins(args[1]) + //if err != nil { + // return err + //} + // + //// build and sign the transaction, then broadcast to Tendermint + //msg := types.NewMsgPrepay(cliCtx.GetFromAddress(), coins) + //return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) }, } - cmd = flags.PostCommands(cmd)[0] + //cmd = flags.PostCommands(cmd)[0] return cmd } + +// makes a new newBuildFileuploadMsg +func newBuildFileuploadMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgFileUpload, error) { + fileHash := viper.GetString(FlagFileHash) + _, err := hex.DecodeString(fileHash) + if err != nil { + return txf, nil, err + } + + _, err = stratos.SdsAddressFromBech32(viper.GetString(FlagReporter)) + if err != nil { + return txf, nil, err + } + + _, err = sdk.AccAddressFromBech32(viper.GetString(FlagUploader)) + if err != nil { + return txf, nil, err + } + + msg := types.NewMsgUpload(fileHash, + clientCtx.GetFromAddress().String(), + viper.GetString(FlagReporter), + viper.GetString(FlagUploader)) + + return txf, msg, nil +} + +// makes a new newBuildPrepayMsg +func newBuildPrepayMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgPrepay, error) { + coin, err := sdk.ParseCoinNormalized(fs.Arg(1)) + if err != nil { + return txf, nil, err + } + + // build and sign the transaction, then broadcast to Tendermint + msg := types.NewMsgPrepay(clientCtx.GetFromAddress().String(), sdk.NewCoins(coin)) + + return txf, msg, nil +} diff --git a/x/sds/client/common/common.go b/x/sds/client/common/common.go index e1190a6b..083e724d 100644 --- a/x/sds/client/common/common.go +++ b/x/sds/client/common/common.go @@ -1,52 +1,51 @@ package common import ( - "encoding/hex" "fmt" + + "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" sds "github.com/stratosnet/stratos-chain/x/sds/types" - - "github.com/cosmos/cosmos-sdk/client/context" ) // QueryUploadedFile queries the hash of an uploaded file by sender -func QueryUploadedFile(cliCtx context.CLIContext, queryRoute, fileHashHex string) ([]byte, int64, error) { - fileHashByteArr, err := hex.DecodeString(fileHashHex) - if err != nil { - return nil, 0, fmt.Errorf("invalid file hash, please specify a hash in hex format %w", err) - } - route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryUploadedFile) - return cliCtx.QueryWithData(route, fileHashByteArr) -} +//func QueryUploadedFile(clientCtx client.Context, queryRoute, fileHashHex string) ([]byte, int64, error) { +// fileHashByteArr, err := hex.DecodeString(fileHashHex) +// if err != nil { +// return nil, 0, fmt.Errorf("invalid file hash, please specify a hash in hex format %w", err) +// } +// route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryUploadedFile) +// return clientCtx.QueryWithData(route, fileHashByteArr) +//} // QueryPrepayBalance queries the prepaid balance by sender in VolumnPool -func QueryPrepayBalance(cliCtx context.CLIContext, queryRoute, sender string) ([]byte, int64, error) { - accAddr, err := sdk.AccAddressFromBech32(sender) - if err != nil { - return nil, 0, fmt.Errorf("invalid sender, please specify a sender in Bech32 format %w", err) - } - route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryPrepay) - return cliCtx.QueryWithData(route, accAddr) -} +//func QueryPrepayBalance(clientCtx client.Context, queryRoute, sender string) ([]byte, int64, error) { +// accAddr, err := sdk.AccAddressFromBech32(sender) +// if err != nil { +// return nil, 0, fmt.Errorf("invalid sender, please specify a sender in Bech32 format %w", err) +// } +// route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryPrepay) +// return clientCtx.QueryWithData(route, accAddr) +//} // QuerySimulatePrepay queries the ongoing price for prepay -func QuerySimulatePrepay(cliCtx context.CLIContext, queryRoute string, amtToPrepay sdk.Int) ([]byte, int64, error) { +func QuerySimulatePrepay(clientCtx client.Context, queryRoute string, amtToPrepay sdk.Int) ([]byte, int64, error) { amtByteArray, err := amtToPrepay.MarshalJSON() if err != nil { return nil, 0, fmt.Errorf("invalid amount, please specify a valid amount to simulate prepay %w", err) } route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QuerySimulatePrepay) - return cliCtx.QueryWithData(route, amtByteArray) + return clientCtx.QueryWithData(route, amtByteArray) } // QueryCurrUozPrice queries the current price for uoz -func QueryCurrUozPrice(cliCtx context.CLIContext, queryRoute string) ([]byte, int64, error) { +func QueryCurrUozPrice(clientCtx client.Context, queryRoute string) ([]byte, int64, error) { route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryCurrUozPrice) - return cliCtx.QueryWithData(route, nil) + return clientCtx.QueryWithData(route, nil) } -// QueryCurrUozPrice queries the current price for uoz -func QueryUozSupply(cliCtx context.CLIContext, queryRoute string) ([]byte, int64, error) { +// QueryUozSupply QueryCurrUozPrice queries the current price for uoz +func QueryUozSupply(clientCtx client.Context, queryRoute string) ([]byte, int64, error) { route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryUozSupply) - return cliCtx.QueryWithData(route, nil) + return clientCtx.QueryWithData(route, nil) } diff --git a/x/sds/client/rest/query.go b/x/sds/client/rest/query.go index e9bb069a..cc1e7a33 100644 --- a/x/sds/client/rest/query.go +++ b/x/sds/client/rest/query.go @@ -4,35 +4,36 @@ import ( "encoding/json" "net/http" + "github.com/cosmos/cosmos-sdk/client" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stratosnet/stratos-chain/x/sds/client/common" + "github.com/stratosnet/stratos-chain/x/sds/keeper" "github.com/gorilla/mux" - "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" ) -func registerSdsQueryRoutes(cliCtx context.CLIContext, r *mux.Router, queryRoute string) { +func sdsQueryRoutes(clientCtx client.Context, r *mux.Router) { r.HandleFunc( "/sds/simulatePrepay/{amtToPrepay}", - SimulatePrepayHandlerFn(cliCtx, queryRoute), + SimulatePrepayHandlerFn(clientCtx, keeper.QueryPrepay), ).Methods("GET") r.HandleFunc( "/sds/uozPrice", - UozPriceHandlerFn(cliCtx, queryRoute), + UozPriceHandlerFn(clientCtx, keeper.QueryCurrUozPrice), ).Methods("GET") r.HandleFunc( "/sds/uozSupply", - UozSupplyHandlerFn(cliCtx, queryRoute), + UozSupplyHandlerFn(clientCtx, keeper.QueryUozSupply), ).Methods("GET") } -// HTTP request handler to query the simulated purchased amt of prepay -func SimulatePrepayHandlerFn(cliCtx context.CLIContext, queryRoute string) http.HandlerFunc { +// SimulatePrepayHandlerFn HTTP request handler to query the simulated purchased amt of prepay +func SimulatePrepayHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } @@ -40,7 +41,7 @@ func SimulatePrepayHandlerFn(cliCtx context.CLIContext, queryRoute string) http. if !ok { return } - resp, height, err := common.QuerySimulatePrepay(cliCtx, queryRoute, amtToPrepay) + resp, height, err := common.QuerySimulatePrepay(cliCtx, queryPath, amtToPrepay) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) @@ -57,14 +58,14 @@ func SimulatePrepayHandlerFn(cliCtx context.CLIContext, queryRoute string) http. } } -// HTTP request handler to query ongoing uoz price -func UozPriceHandlerFn(cliCtx context.CLIContext, queryRoute string) http.HandlerFunc { +// UozPriceHandlerFn HTTP request handler to query ongoing uoz price +func UozPriceHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } - resp, height, err := common.QueryCurrUozPrice(cliCtx, queryRoute) + resp, height, err := common.QueryCurrUozPrice(cliCtx, queryPath) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) @@ -81,14 +82,14 @@ func UozPriceHandlerFn(cliCtx context.CLIContext, queryRoute string) http.Handle } } -// HTTP request handler to query uoz supply details -func UozSupplyHandlerFn(cliCtx context.CLIContext, queryRoute string) http.HandlerFunc { +// UozSupplyHandlerFn HTTP request handler to query uoz supply details +func UozSupplyHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } - resp, height, err := common.QueryUozSupply(cliCtx, queryRoute) + resp, height, err := common.QueryUozSupply(cliCtx, queryPath) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) diff --git a/x/sds/client/rest/rest.go b/x/sds/client/rest/rest.go index 359d93dc..1b904b4f 100644 --- a/x/sds/client/rest/rest.go +++ b/x/sds/client/rest/rest.go @@ -1,103 +1,108 @@ package rest import ( - "encoding/hex" - "net/http" - + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/rest" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + sdktrest "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/sds/types" - - "github.com/cosmos/cosmos-sdk/client/context" ) -// RegisterRoutes registers sds-related REST handlers to a router -func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, queryRoute string) { - r.HandleFunc("/sds/file/upload", FileUploadRequestHandlerFn(cliCtx)).Methods("POST") - r.HandleFunc("/sds/prepay", PrepayRequestHandlerFn(cliCtx)).Methods("POST") - registerSdsQueryRoutes(cliCtx, r, queryRoute) +// RegisterHandlers registers register-related REST handlers to a router +func RegisterHandlers(clientCtx client.Context, rtr *mux.Router) { + r := rest.WithHTTPDeprecationHeaders(rtr) + sdsQueryRoutes(clientCtx, r) + sdsTxHandlers(clientCtx, r) + + //// RegisterRoutes registers sds-related REST handlers to a router + //func RegisterRoutes(clientCtx client.Context, r *mux.Router, queryRoute string) { + // r.HandleFunc("/sds/file/upload", FileUploadRequestHandlerFn(cliCtx)).Methods("POST") + // r.HandleFunc("/sds/prepay", PrepayRequestHandlerFn(cliCtx)).Methods("POST") + // registerSdsQueryRoutes(cliCtx, r, queryRoute) } // FileUploadReq defines the properties of a file upload request's body. type FileUploadReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - Reporter string `json:"reporter" yaml:"reporter"` - FileHash string `json:"file_hash" yaml:"file_hash"` - Uploader string `json:"uploader" yaml:"uploader"` + BaseReq sdktrest.BaseReq `json:"base_req" yaml:"base_req"` + Reporter string `json:"reporter" yaml:"reporter"` + FileHash string `json:"file_hash" yaml:"file_hash"` + Uploader string `json:"uploader" yaml:"uploader"` } // PrepayReq defines the properties of a prepay request's body. type PrepayReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - Amount sdk.Coins `json:"amount" yaml:"amount"` -} - -// FileUploadRequestHandlerFn - http request handler for file uploading. -func FileUploadRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req FileUploadReq - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - reporter, err := stratos.SdsAddressFromBech32(req.Reporter) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - fileHash := req.FileHash - _, err = hex.DecodeString(fileHash) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - uploader, err := sdk.AccAddressFromBech32(req.Uploader) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - msg := types.NewMsgUpload(fileHash, fromAddr, reporter, uploader) - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) - } + BaseReq sdktrest.BaseReq `json:"base_req" yaml:"base_req"` + Amount sdk.Coins `json:"amount" yaml:"amount"` } -// PrepayRequestHandlerFn - http request handler for prepay. -func PrepayRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req PrepayReq - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - msg := types.NewMsgPrepay(fromAddr, req.Amount) - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) - } -} +//// FileUploadRequestHandlerFn - http request handler for file uploading. +//func FileUploadRequestHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { +// return func(w http.ResponseWriter, r *http.Request) { +// cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) +// if !ok { +// return +// } +// +// var req FileUploadReq +// if !rest.ReadRESTReq(w, r, clientCtx.Codec, &req) { +// return +// } +// +// req.BaseReq = req.BaseReq.Sanitize() +// if !req.BaseReq.ValidateBasic(w) { +// return +// } +// +// fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) +// return +// } +// +// reporter, err := stratos.SdsAddressFromBech32(req.Reporter) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) +// return +// } +// +// fileHash := req.FileHash +// _, err = hex.DecodeString(fileHash) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) +// return +// } +// +// uploader, err := sdk.AccAddressFromBech32(req.Uploader) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) +// return +// } +// +// msg := types.NewMsgUpload(fileHash, fromAddr, reporter, uploader) +// utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) +// } +//} +// +//// PrepayRequestHandlerFn - http request handler for prepay. +//func PrepayRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +// return func(w http.ResponseWriter, r *http.Request) { +// var req PrepayReq +// if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { +// return +// } +// +// req.BaseReq = req.BaseReq.Sanitize() +// if !req.BaseReq.ValidateBasic(w) { +// return +// } +// +// fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) +// return +// } +// +// msg := types.NewMsgPrepay(fromAddr, req.Amount) +// utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) +// } +//} diff --git a/x/sds/client/rest/tx.go b/x/sds/client/rest/tx.go new file mode 100644 index 00000000..962c1158 --- /dev/null +++ b/x/sds/client/rest/tx.go @@ -0,0 +1,96 @@ +package rest + +import ( + "encoding/hex" + "net/http" + + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/gorilla/mux" + stratos "github.com/stratosnet/stratos-chain/types" + + "github.com/cosmos/cosmos-sdk/client" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/rest" + "github.com/stratosnet/stratos-chain/x/sds/types" +) + +func sdsTxHandlers(cliCtx client.Context, r *mux.Router) { + r.HandleFunc("/sds/file/upload", postFileUploadHandlerFn(cliCtx)).Methods("POST") + r.HandleFunc("/sds/prepay", postPrepayHandlerFn(cliCtx)).Methods("POST") +} + +// postFileUploadHandlerFn - http request handler for file uploading. +func postFileUploadHandlerFn(clientCtx client.Context) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) + if !ok { + return + } + + var req FileUploadReq + if !rest.ReadRESTReq(w, r, types.ModuleCdc, &req) { + return + } + + req.BaseReq = req.BaseReq.Sanitize() + if !req.BaseReq.ValidateBasic(w) { + return + } + + fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + + reporter, err := stratos.SdsAddressFromBech32(req.Reporter) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + + fileHash := req.FileHash + _, err = hex.DecodeString(fileHash) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + + uploader, err := sdk.AccAddressFromBech32(req.Uploader) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + + msg := types.NewMsgUpload(fileHash, fromAddr.String(), reporter.String(), uploader.String()) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) + } +} + +// postPrepayHandlerFn - http request handler for prepay. +func postPrepayHandlerFn(clientCtx client.Context) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) + if !ok { + return + } + var req PrepayReq + if !rest.ReadRESTReq(w, r, types.ModuleCdc, &req) { + return + } + + req.BaseReq = req.BaseReq.Sanitize() + if !req.BaseReq.ValidateBasic(w) { + return + } + + fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + + msg := types.NewMsgPrepay(fromAddr.String(), req.Amount) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) + } +} diff --git a/x/sds/genesis.go b/x/sds/genesis.go index 7df79042..fb9af84d 100644 --- a/x/sds/genesis.go +++ b/x/sds/genesis.go @@ -2,17 +2,19 @@ package sds import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stratosnet/stratos-chain/x/sds/keeper" "github.com/stratosnet/stratos-chain/x/sds/types" ) // InitGenesis initialize default parameters // and the keeper's address to pubkey map -func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) { - keeper.SetParams(ctx, data.Params) +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) { + keeper.SetParams(ctx, *data.Params) - for _, file := range data.FileUpload { - keeper.SetFileHash(ctx, []byte(file.FileHash), file.FileInfo) + for _, file := range data.GetFileUploads() { + keeper.SetFileHash(ctx, []byte(file.FileHash), *file.FileInfo) } + return } // ExportGenesis writes the current store values @@ -21,11 +23,11 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) { func ExportGenesis(ctx sdk.Context, keeper Keeper) (data types.GenesisState) { params := keeper.GetParams(ctx) - var fileUpload []types.FileUpload + var fileUpload []*types.FileUpload keeper.IterateFileUpload(ctx, func(fileHash string, fileInfo types.FileInfo) (stop bool) { - fileUpload = append(fileUpload, types.FileUpload{FileHash: fileHash, FileInfo: fileInfo}) + fileUpload = append(fileUpload, &types.FileUpload{FileHash: fileHash, FileInfo: &fileInfo}) return false }) - return types.NewGenesisState(params, fileUpload) + return types.NewGenesisState(¶ms, fileUpload) } diff --git a/x/sds/handler.go b/x/sds/handler.go index 280c2fc1..a947c606 100644 --- a/x/sds/handler.go +++ b/x/sds/handler.go @@ -11,13 +11,17 @@ import ( // NewHandler ... func NewHandler(k keeper.Keeper) sdk.Handler { + msgServer := keeper.NewMsgServerImpl(k) + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { ctx = ctx.WithEventManager(sdk.NewEventManager()) switch msg := msg.(type) { - case types.MsgFileUpload: - return handleMsgFileUpload(ctx, k, msg) - case types.MsgPrepay: - return handleMsgPrepay(ctx, k, msg) + case *types.MsgFileUpload: + res, err := msgServer.HandleMsgFileUpload(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgPrepay: + res, err := msgServer.HandleMsgPrepay(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) @@ -25,63 +29,3 @@ func NewHandler(k keeper.Keeper) sdk.Handler { } } } - -// Handle MsgFileUpload. -func handleMsgFileUpload(ctx sdk.Context, k keeper.Keeper, msg types.MsgFileUpload) (*sdk.Result, error) { - // check if reporter addr belongs to an registered sp node - if _, found := k.RegisterKeeper.GetIndexingNode(ctx, msg.Reporter); found == false { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "Reporter %s isn't an SP node", msg.Reporter.String()) - } - height := sdk.NewInt(ctx.BlockHeight()) - heightByteArr, _ := height.MarshalJSON() - var heightReEncoded sdk.Int - heightReEncoded.UnmarshalJSON(heightByteArr) - - fileInfo := types.NewFileInfo(heightReEncoded, msg.Reporter, msg.Uploader) - fileHashByte := []byte(msg.FileHash) - k.SetFileHash(ctx, fileHashByte, fileInfo) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeFileUpload, - sdk.NewAttribute(sdk.AttributeKeySender, msg.From.String()), - sdk.NewAttribute(types.AttributeKeyReporter, msg.Reporter.String()), - sdk.NewAttribute(types.AttributeKeyUploader, msg.Uploader.String()), - sdk.NewAttribute(types.AttributeKeyFileHash, msg.FileHash), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.From.String()), - ), - }) - - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -// Handle MsgPrepay. -func handleMsgPrepay(ctx sdk.Context, k keeper.Keeper, msg types.MsgPrepay) (*sdk.Result, error) { - if k.BankKeeper.GetSendEnabled(ctx) == false { - return nil, nil - } - purchased, err := k.Prepay(ctx, msg.Sender, msg.Coins) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypePrepay, - sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.String()), - sdk.NewAttribute(types.AttributeKeyCoins, msg.Coins.String()), - sdk.NewAttribute(types.AttributeKeyPurchasedUoz, purchased.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.String()), - ), - }) - - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} diff --git a/x/sds/keeper/grpc_query.go b/x/sds/keeper/grpc_query.go new file mode 100644 index 00000000..c839fc9d --- /dev/null +++ b/x/sds/keeper/grpc_query.go @@ -0,0 +1,82 @@ +package keeper + +import ( + "context" + "encoding/hex" + "fmt" + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stratosnet/stratos-chain/x/sds/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper +type Querier struct { + Keeper +} + +func (q Querier) Fileupload(c context.Context, req *types.QueryFileUploadRequest) (*types.QueryFileUploadResponse, error) { + if req == nil { + return &types.QueryFileUploadResponse{}, status.Error(codes.InvalidArgument, "empty request") + } + + if req.GetFileHash() == "" { + return &types.QueryFileUploadResponse{}, status.Error(codes.InvalidArgument, " Network address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(c) + + fileHashByteArr, err := hex.DecodeString(req.GetFileHash()) + if err != nil { + return &types.QueryFileUploadResponse{}, fmt.Errorf("invalid file hash, please specify a hash in hex format %w", err) + } + fileInfoBytes, err := q.GetFileInfoBytesByFileHash(ctx, fileHashByteArr) + if err != nil { + return &types.QueryFileUploadResponse{}, err + } + fileInfo, err := types.UnmarshalFileInfo(q.cdc, fileInfoBytes) + if err != nil { + return &types.QueryFileUploadResponse{}, err + } + + return &types.QueryFileUploadResponse{FileInfo: &fileInfo}, nil +} + +func (q Querier) Prepay(c context.Context, req *types.QueryPrepayRequest) (*types.QueryPrepayResponse, error) { + if req == nil { + return &types.QueryPrepayResponse{}, status.Error(codes.InvalidArgument, "empty request") + } + + if req.GetAcctAddr() == "" { + return &types.QueryPrepayResponse{}, status.Error(codes.InvalidArgument, " Network address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(c) + + accAddr, err := sdk.AccAddressFromBech32(req.GetAcctAddr()) + if err != nil { + return &types.QueryPrepayResponse{}, err + } + balanceBytes, err := q.GetPrepayBytes(ctx, accAddr) + if err != nil { + return &types.QueryPrepayResponse{}, fmt.Errorf("invalid sender address: %w", err) + } + + balanceInt64, err := strconv.ParseInt(string(balanceBytes), 10, 64) + if err != nil { + return &types.QueryPrepayResponse{}, err + } + + balance := sdk.NewInt(balanceInt64) + return &types.QueryPrepayResponse{Balance: &balance}, nil +} + +func (q Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.GetParams(ctx) + return &types.QueryParamsResponse{Params: ¶ms}, nil +} + +var _ types.QueryServer = Querier{} diff --git a/x/sds/keeper/keeper.go b/x/sds/keeper/keeper.go index 0bbd57a6..1f5571dc 100644 --- a/x/sds/keeper/keeper.go +++ b/x/sds/keeper/keeper.go @@ -118,19 +118,30 @@ func (k Keeper) simulatePurchaseUoz(ctx sdk.Context, amount sdk.Int) sdk.Int { // Prepay transfers coins from bank to sds (volumn) pool func (k Keeper) Prepay(ctx sdk.Context, sender sdk.AccAddress, coins sdk.Coins) (sdk.Int, error) { // src - hasCoins? - if !k.bankKeeper.HasCoins(ctx, sender, coins) { - return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "No valid coins to be deducted from acc %s", hex.EncodeToString(types.PrepayBalanceKey(sender))) + //if !k.bankKeeper.HasCoins(ctx, sender, coins) { + // return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "No valid coins to be deducted from acc %s", hex.EncodeToString(types.PrepayBalanceKey(sender))) + //} + for _, coin := range coins { + hasCoin := k.bankKeeper.HasBalance(ctx, sender, coin) + if !hasCoin { + return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "No valid coins to be deducted from acc %s", hex.EncodeToString(types.PrepayBalanceKey(sender))) + } } err := k.doPrepay(ctx, sender, coins) if err != nil { return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "Failed prepay from acc %s", hex.EncodeToString(types.PrepayBalanceKey(sender))) } - - _, err = k.bankKeeper.SubtractCoins(ctx, sender, coins) + // sub coins from sender's wallet + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, coins) if err != nil { return sdk.ZeroInt(), err } + // + //_, err = k.bankKeeper.SubtractCoins(ctx, sender, coins) + //if err != nil { + // return sdk.ZeroInt(), err + //} prepay := coins.AmountOf(k.BondDenom(ctx)) purchased := k.purchaseUoz(ctx, prepay) @@ -159,7 +170,7 @@ func (k Keeper) GetPrepay(ctx sdk.Context, sender sdk.AccAddress) (sdk.Int, erro return prepaidBalance, nil } -// GetPrepay Returns bytearr of the existing prepay coins +// GetPrepayBytes returns bytearr of the existing prepay coins func (k Keeper) GetPrepayBytes(ctx sdk.Context, sender sdk.AccAddress) ([]byte, error) { store := ctx.KVStore(k.key) storeValue := store.Get(types.PrepayBalanceKey(sender)) diff --git a/x/sds/keeper/migrations.go b/x/sds/keeper/migrations.go new file mode 100644 index 00000000..d4e4c6df --- /dev/null +++ b/x/sds/keeper/migrations.go @@ -0,0 +1,21 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v043 "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v043" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{keeper: keeper} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v043.MigrateStore(ctx, m.keeper.key) +} diff --git a/x/sds/keeper/msg_server.go b/x/sds/keeper/msg_server.go new file mode 100644 index 00000000..97c5fcc1 --- /dev/null +++ b/x/sds/keeper/msg_server.go @@ -0,0 +1,102 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/sds/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the bank MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// HandleMsgFileUpload Handles MsgFileUpload. +func (k msgServer) HandleMsgFileUpload(c context.Context, msg *types.MsgFileUpload) (*types.MsgFileUploadResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + reporter, err := stratos.SdsAddressFromBech32(msg.GetReporter()) + if err != nil { + return &types.MsgFileUploadResponse{}, err + } + + if _, found := k.RegisterKeeper.GetIndexingNode(ctx, reporter); found == false { + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "Reporter %s isn't an SP node", msg.GetReporter()) + } + height := sdk.NewInt(ctx.BlockHeight()) + heightByteArr, _ := height.MarshalJSON() + var heightReEncoded sdk.Int + err = heightReEncoded.UnmarshalJSON(heightByteArr) + if err != nil { + return &types.MsgFileUploadResponse{}, err + } + + fileInfo := types.NewFileInfo(&heightReEncoded, msg.Reporter, msg.Uploader) + fileHashByte := []byte(msg.FileHash) + k.SetFileHash(ctx, fileHashByte, fileInfo) + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeFileUpload, + sdk.NewAttribute(sdk.AttributeKeySender, msg.From), + sdk.NewAttribute(types.AttributeKeyReporter, msg.GetReporter()), + sdk.NewAttribute(types.AttributeKeyUploader, msg.GetUploader()), + sdk.NewAttribute(types.AttributeKeyFileHash, msg.GetFileHash()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.GetFrom()), + ), + }) + + return &types.MsgFileUploadResponse{}, nil +} + +// HandleMsgPrepay Handles MsgPrepay. +func (k msgServer) HandleMsgPrepay(c context.Context, msg *types.MsgPrepay) (*types.MsgPrepayResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + //if k.BankKeeper.GetSendEnabled(ctx) == false { + // return nil, nil + //} + + if k.bankKeeper.IsSendEnabledCoin(ctx, sdk.NewCoin(types.DefaultBondDenom, sdk.OneInt())) == false { + return &types.MsgPrepayResponse{}, nil + } + + sender, err := sdk.AccAddressFromBech32(msg.GetSender()) + if err != nil { + return &types.MsgPrepayResponse{}, nil + } + + purchased, err := k.Prepay(ctx, sender, msg.Coins) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypePrepay, + sdk.NewAttribute(sdk.AttributeKeySender, msg.GetSender()), + sdk.NewAttribute(types.AttributeKeyCoins, msg.Coins.String()), + sdk.NewAttribute(types.AttributeKeyPurchasedUoz, purchased.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.GetSender()), + ), + }) + + return &types.MsgPrepayResponse{}, nil +} diff --git a/x/sds/keeper/querier.go b/x/sds/keeper/querier.go index 2e3ffdc9..1b608dab 100644 --- a/x/sds/keeper/querier.go +++ b/x/sds/keeper/querier.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "encoding/json" + "github.com/cosmos/cosmos-sdk/codec" // this line is used by starport scaffolding # 1 abci "github.com/tendermint/tendermint/abci/types" @@ -12,7 +13,7 @@ import ( ) const ( - QueryFileHash = "uploaded_file" + QueryUploadedFile = "uploaded_file" QueryPrepay = "prepay" QuerySimulatePrepay = "simulate_prepay" QueryCurrUozPrice = "curr_uoz_price" @@ -20,37 +21,37 @@ const ( ) // NewQuerier creates a new querier for sds clients. -func NewQuerier(k Keeper) sdk.Querier { +func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) { switch path[0] { - case QueryFileHash: - return queryFileHash(ctx, req, k) + case QueryUploadedFile: + return queryUploadedFileByHash(ctx, req, k, legacyQuerierCdc) case QueryPrepay: - return queryPrepay(ctx, req, k) + return queryPrepay(ctx, req, k, legacyQuerierCdc) case QuerySimulatePrepay: - return querySimulatePrepay(ctx, req, k) + return querySimulatePrepay(ctx, req, k, legacyQuerierCdc) case QueryCurrUozPrice: - return queryCurrUozPrice(ctx, req, k) + return queryCurrUozPrice(ctx, req, k, legacyQuerierCdc) case QueryUozSupply: - return queryUozSupply(ctx, req, k) + return queryUozSupply(ctx, req, k, legacyQuerierCdc) default: return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown sds query endpoint "+req.String()+hex.EncodeToString(req.Data)) } } } -// queryFileHash fetch an file's hash for the supplied height. -func queryFileHash(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { - fileHash, err := k.GetFileInfoBytesByFileHash(ctx, req.Data) +// queryFileHash fetch a file's hash for the supplied height. +func queryUploadedFileByHash(ctx sdk.Context, req abci.RequestQuery, k Keeper, _ *codec.LegacyAmino) ([]byte, error) { + fileInfo, err := k.GetFileInfoBytesByFileHash(ctx, req.Data) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } - return fileHash, nil + return fileInfo, nil } // queryPrepay fetch prepaid balance of an account. -func queryPrepay(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryPrepay(ctx sdk.Context, req abci.RequestQuery, k Keeper, _ *codec.LegacyAmino) ([]byte, error) { balance, err := k.GetPrepayBytes(ctx, req.Data) if err != nil { return []byte{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) @@ -59,7 +60,7 @@ func queryPrepay(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, erro } // querySimulatePrepay fetch amt of uoz with a simulated prepay of X ustos. -func querySimulatePrepay(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func querySimulatePrepay(ctx sdk.Context, req abci.RequestQuery, k Keeper, _ *codec.LegacyAmino) ([]byte, error) { var amtToPrepay sdk.Int err := amtToPrepay.UnmarshalJSON(req.Data) if err != nil { @@ -71,14 +72,14 @@ func querySimulatePrepay(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]by } // queryCurrUozPrice fetch current uoz price. -func queryCurrUozPrice(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryCurrUozPrice(ctx sdk.Context, _ abci.RequestQuery, k Keeper, _ *codec.LegacyAmino) ([]byte, error) { uozPrice := k.RegisterKeeper.CurrUozPrice(ctx) uozPriceByte, _ := uozPrice.MarshalJSON() return uozPriceByte, nil } // queryUozSupply fetch remaining/total uoz supply. -func queryUozSupply(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryUozSupply(ctx sdk.Context, _ abci.RequestQuery, k Keeper, _ *codec.LegacyAmino) ([]byte, error) { type Supply struct { Remaining sdk.Int Total sdk.Int diff --git a/x/sds/module.go b/x/sds/module.go index a7d0fac0..d0ce9b52 100644 --- a/x/sds/module.go +++ b/x/sds/module.go @@ -1,21 +1,24 @@ package sds import ( + "context" "encoding/json" - "github.com/stratosnet/stratos-chain/x/pot" - "github.com/stratosnet/stratos-chain/x/register" - + "github.com/cosmos/cosmos-sdk/client" + bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" + "github.com/stratosnet/stratos-chain/x/pot" + potKeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" + registerKeeper "github.com/stratosnet/stratos-chain/x/register/keeper" abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/cosmos-sdk/client/context" "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/x/bank" "github.com/stratosnet/stratos-chain/x/sds/client/cli" "github.com/stratosnet/stratos-chain/x/sds/client/rest" "github.com/stratosnet/stratos-chain/x/sds/keeper" @@ -29,28 +32,48 @@ var ( ) // AppModuleBasic defines the basic application module used by the sds module. -type AppModuleBasic struct{} +type AppModuleBasic struct { + cdc codec.Codec +} + +var _ module.AppModuleBasic = AppModuleBasic{} // Name returns the sds module's name. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the sds module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { - types.RegisterCodec(cdc) +//// RegisterCodec registers the sds module's types for the given codec. +//func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { +// types.RegisterCodec(cdc) +//} + +// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the sds // module. -func (AppModuleBasic) DefaultGenesis() json.RawMessage { - return types.ModuleCdc.MustMarshalJSON(types.DefaultGenesisState()) +//func (AppModuleBasic) DefaultGenesis() json.RawMessage { +// return types.ModuleCdc.MustMarshalJSON(types.DefaultGenesisState()) +//} + +// DefaultGenesis returns default genesis state as raw bytes for the register +// module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the sds module. -func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState - err := types.ModuleCdc.UnmarshalJSON(bz, &data) + err := cdc.UnmarshalJSON(bz, &data) if err != nil { return err } @@ -58,18 +81,23 @@ func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error { } // RegisterRESTRoutes registers the REST routes for the sds module. -func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router) { - rest.RegisterRoutes(ctx, rtr, StoreKey) +func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { + rest.RegisterHandlers(ctx, rtr) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) } // GetTxCmd returns the root tx command for the sds module. -func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetTxCmd(cdc) +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() } // GetQueryCmd returns no root query command for the sds module. -func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetQueryCmd(types.StoreKey, cdc) +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() } //____________________________________________________________________________ @@ -78,13 +106,13 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { type AppModule struct { AppModuleBasic keeper keeper.Keeper - coinKeeper bank.Keeper - registerKeeper register.Keeper - potKeeper pot.Keeper + coinKeeper bankKeeper.Keeper + registerKeeper registerKeeper.Keeper + potKeeper potKeeper.Keeper } // NewAppModule creates a new AppModule object -func NewAppModule(k keeper.Keeper, bankKeeper bank.Keeper, registerKeeper register.Keeper, potKeeper pot.Keeper) AppModule { +func NewAppModule(k keeper.Keeper, bankKeeper bankKeeper.Keeper, registerKeeper registerKeeper.Keeper, potKeeper pot.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: k, @@ -95,16 +123,19 @@ func NewAppModule(k keeper.Keeper, bankKeeper bank.Keeper, registerKeeper regist } // Name returns the sds module's name. -func (AppModule) Name() string { - return types.ModuleName -} +//func (AppModule) Name() string { +// return types.ModuleName +//} // RegisterInvariants registers the sds module invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // Route returns the message routing key for the sds module. -func (AppModule) Route() string { - return types.RouterKey +//func (AppModule) Route() string { +// return types.RouterKey +//} +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) } // NewHandler returns an sdk.Handler for the sds module. @@ -118,24 +149,24 @@ func (AppModule) QuerierRoute() string { } // NewQuerierHandler returns the sds module sdk.Querier. -func (am AppModule) NewQuerierHandler() sdk.Querier { - return keeper.NewQuerier(am.keeper) +func (am AppModule) NewQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) } // InitGenesis performs genesis initialization for the sds module. It returns // no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { var genesisState types.GenesisState - types.ModuleCdc.MustUnmarshalJSON(data, &genesisState) - InitGenesis(ctx, am.keeper, genesisState) + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, &genesisState) return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the sds // module. -func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage { +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { gs := ExportGenesis(ctx, am.keeper) - return types.ModuleCdc.MustMarshalJSON(gs) + return cdc.MustMarshalJSON(&gs) } // BeginBlock returns the begin blocker for the sds module. @@ -148,3 +179,21 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// LegacyQuerierHandler returns the staking module sdk.Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) +} + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) + + m := keeper.NewMigrator(am.keeper) + _ = cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) +} diff --git a/x/sds/sds_test.go b/x/sds/sds_test.go index d1af7379..9dbf840d 100644 --- a/x/sds/sds_test.go +++ b/x/sds/sds_test.go @@ -1,335 +1,336 @@ package sds -import ( - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/mock" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/register" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/secp256k1" -) - -const ( - chainID = "" - DefaultDenom = "ustos" - stos2ustos = 1000000000 -) - -var ( - testFileHashHex = "c03661732294feb49caf6dc16c7cbb2534986d73" - - resourceNodeVolume1 = sdk.NewInt(500000000000) - resourceNodeVolume2 = sdk.NewInt(300000000000) - resourceNodeVolume3 = sdk.NewInt(200000000000) - prepayAmt = sdk.NewInt(2 * stos2ustos) - - depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") - initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz - totalUnissuedPrepayVal, _ = sdk.NewIntFromString("100000000000000000") - totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) - remainingOzoneLimit, _ = sdk.NewIntFromString("500000000000000000000") - totalUnissuedPrepayTestPurchase, _ = sdk.NewIntFromString("0") - remainingOzoneLimitTestPurchase, _ = sdk.NewIntFromString("100000000000") - initialUOzonePriceTestPurchase = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz - - foundationDeposit = sdk.NewInt(40000000000000000) - - resOwnerPrivKey1 = secp256k1.GenPrivKey() - resOwnerPrivKey2 = secp256k1.GenPrivKey() - resOwnerPrivKey3 = secp256k1.GenPrivKey() - resOwnerPrivKey4 = secp256k1.GenPrivKey() - resOwnerPrivKey5 = secp256k1.GenPrivKey() - idxOwnerPrivKey1 = secp256k1.GenPrivKey() - idxOwnerPrivKey2 = secp256k1.GenPrivKey() - idxOwnerPrivKey3 = secp256k1.GenPrivKey() - - resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) - resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) - resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) - resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) - resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) - idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) - idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) - idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) - - pubKeyRes1 = secp256k1.GenPrivKey().PubKey() - addrRes1 = sdk.AccAddress(pubKeyRes1.Address()) - initialStakeRes1 = sdk.NewInt(3 * stos2ustos) - initialStakeRes1TestPurchase = sdk.NewInt(100000000000) - - pubKeyRes2 = secp256k1.GenPrivKey().PubKey() - addrRes2 = sdk.AccAddress(pubKeyRes2.Address()) - initialStakeRes2 = sdk.NewInt(3 * stos2ustos) - - pubKeyRes3 = secp256k1.GenPrivKey().PubKey() - addrRes3 = sdk.AccAddress(pubKeyRes3.Address()) - initialStakeRes3 = sdk.NewInt(3 * stos2ustos) - - pubKeyRes4 = secp256k1.GenPrivKey().PubKey() - addrRes4 = sdk.AccAddress(pubKeyRes4.Address()) - initialStakeRes4 = sdk.NewInt(3 * stos2ustos) - - pubKeyRes5 = secp256k1.GenPrivKey().PubKey() - addrRes5 = sdk.AccAddress(pubKeyRes5.Address()) - initialStakeRes5 = sdk.NewInt(3 * stos2ustos) - - privKeyIdx1 = ed25519.GenPrivKey() - pubKeyIdx1 = privKeyIdx1.PubKey() - addrIdx1 = stratos.SdsAddress(pubKeyIdx1.Address()) - initialStakeIdx1 = sdk.NewInt(5 * stos2ustos) - initialStakeIdx1TestPurchase = sdk.NewInt(100 * stos2ustos) - - pubKeyIdx2 = ed25519.GenPrivKey().PubKey() - addrIdx2 = stratos.SdsAddress(pubKeyIdx2.Address()) - initialStakeIdx2 = sdk.NewInt(5 * stos2ustos) - - pubKeyIdx3 = ed25519.GenPrivKey().PubKey() - addrIdx3 = stratos.SdsAddress(pubKeyIdx3.Address()) - initialStakeIdx3 = sdk.NewInt(5 * stos2ustos) - - valOpPrivKey1 = secp256k1.GenPrivKey() - valOpPubKey1 = valOpPrivKey1.PubKey() - valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) - valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) - - valConsPrivKey1 = secp256k1.GenPrivKey() - valConsPubk1 = valConsPrivKey1.PubKey() - valInitialStake = sdk.NewInt(15 * stos2ustos) - - // accs for sds module - sdsAccPrivKey1 = secp256k1.GenPrivKey() - sdsAccPubKey1 = sdsAccPrivKey1.PubKey() - sdsAccAddr1 = sdk.AccAddress(sdsAccPubKey1.Address()) - sdsAccBal1 = sdk.NewInt(100 * stos2ustos) - initialStakeSdsIdx1 = sdk.NewInt(5 * stos2ustos) - - sdsAccPrivKey2 = secp256k1.GenPrivKey() - sdsAccPubKey2 = sdsAccPrivKey2.PubKey() - sdsAccAddr2 = sdk.AccAddress(sdsAccPubKey2.Address()) - sdsAccBal2 = sdk.NewInt(100 * stos2ustos) - - sdsAccPrivKey3 = secp256k1.GenPrivKey() - sdsAccPubKey3 = sdsAccPrivKey3.PubKey() - sdsAccAddr3 = sdk.AccAddress(sdsAccPubKey3.Address()) - sdsAccBal3 = sdk.NewInt(100 * stos2ustos) - - // sp node used in sds module - spNodePrivKeyIdx1 = secp256k1.GenPrivKey() - spNodePubKeyIdx1 = spNodePrivKeyIdx1.PubKey() - spNodeAddrIdx1 = sdk.AccAddress(spNodePubKeyIdx1.Address()) - spNodeInitialStakeIdx1 = sdk.NewInt(5 * stos2ustos) - spP2pAddr = ed25519.GenPrivKey().PubKey().Address() -) - -func setupAccounts(mApp *mock.App) []authexported.Account { - - str, _ := stratos.Bech32ifyPubKey(stratos.Bech32PubKeyTypeSdsP2PPub, sdsAccPubKey1) - fmt.Println("sdsAccPubKey1=" + str) - - //************************** setup resource nodes owners' accounts ************************** - resOwnerAcc1 := &auth.BaseAccount{ - Address: resOwner1, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, - } - resOwnerAcc2 := &auth.BaseAccount{ - Address: resOwner2, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, - } - resOwnerAcc3 := &auth.BaseAccount{ - Address: resOwner3, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, - } - resOwnerAcc4 := &auth.BaseAccount{ - Address: resOwner4, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, - } - resOwnerAcc5 := &auth.BaseAccount{ - Address: resOwner5, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, - } - - //************************** setup indexing nodes owners' accounts ************************** - idxOwnerAcc1 := &auth.BaseAccount{ - Address: idxOwner1, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.ZeroInt())}, - } - idxOwnerAcc2 := &auth.BaseAccount{ - Address: idxOwner2, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.ZeroInt())}, - } - idxOwnerAcc3 := &auth.BaseAccount{ - Address: idxOwner3, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.ZeroInt())}, - } - - //************************** setup validator delegators' accounts ************************** - valOwnerAcc1 := &auth.BaseAccount{ - Address: valOpAccAddr1, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, valInitialStake)}, - } - - //************************** setup resource nodes' accounts ************************** - resNodeAcc1 := &auth.BaseAccount{ - Address: addrRes1, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes1)}, - } - resNodeAcc2 := &auth.BaseAccount{ - Address: addrRes2, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes2)}, - } - resNodeAcc3 := &auth.BaseAccount{ - Address: addrRes3, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes3)}, - } - resNodeAcc4 := &auth.BaseAccount{ - Address: addrRes4, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes4)}, - } - resNodeAcc5 := &auth.BaseAccount{ - Address: addrRes5, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes5)}, - } - - //************************** setup indexing nodes' accounts ************************** - idxNodeAcc1 := &auth.BaseAccount{ - Address: idxOwner1, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeIdx1.Add(depositForSendingTx))}, - } - idxNodeAcc2 := &auth.BaseAccount{ - Address: idxOwner2, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeIdx2)}, - } - idxNodeAcc3 := &auth.BaseAccount{ - Address: idxOwner3, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeIdx3)}, - } - spNodeIdxNodeAcc1 := &auth.BaseAccount{ - Address: spNodeAddrIdx1, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, spNodeInitialStakeIdx1)}, - } - - //************************** setup sds module's accounts ************************** - sdsAcc1 := &auth.BaseAccount{ // sp node owner - Address: sdsAccAddr1, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdsAccBal1)}, - } - sdsAcc2 := &auth.BaseAccount{ - Address: sdsAccAddr2, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdsAccBal2)}, - } - sdsAcc3 := &auth.BaseAccount{ - Address: sdsAccAddr3, - Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdsAccBal3)}, - } - - // the sequence of the account list is related to the value of parameter "accNums" of mock.SignCheckDeliver() method - accs := []authexported.Account{ - resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, - idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, - valOwnerAcc1, - resNodeAcc1, resNodeAcc2, resNodeAcc3, resNodeAcc4, resNodeAcc5, - idxNodeAcc1, idxNodeAcc2, idxNodeAcc3, spNodeIdxNodeAcc1, - sdsAcc1, sdsAcc2, sdsAcc3, - } - - ctx1 := mApp.BaseApp.NewContext(true, abci.Header{}) - ctx1.Logger().Info("resNodeAcc1 -> " + resNodeAcc1.String()) - ctx1.Logger().Info("resNodeAcc2 -> " + resNodeAcc2.String()) - ctx1.Logger().Info("resNodeAcc3 -> " + resNodeAcc3.String()) - ctx1.Logger().Info("resNodeAcc4 -> " + resNodeAcc4.String()) - ctx1.Logger().Info("resNodeAcc5 -> " + resNodeAcc5.String()) - ctx1.Logger().Info("idxNodeAcc1 -> " + idxNodeAcc1.String()) - ctx1.Logger().Info("idxNodeAcc2 -> " + idxNodeAcc2.String()) - ctx1.Logger().Info("idxNodeAcc3 -> " + idxNodeAcc3.String()) - ctx1.Logger().Info("spNodeIdxNodeAcc1 -> " + spNodeIdxNodeAcc1.String()) - //ctx1.Logger().Info("foundationAcc -> " + foundationAcc.String()) - ctx1.Logger().Info("sdsAcc1 -> " + sdsAcc1.String()) - ctx1.Logger().Info("sdsAcc2 -> " + sdsAcc2.String()) - ctx1.Logger().Info("sdsAcc3 -> " + sdsAcc3.String()) - - return accs -} - -func setupAllResourceNodes() []register.ResourceNode { - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - resourceNode1 := register.NewResourceNode(stratos.SdsAddress(addrRes1), pubKeyRes1, resOwner1, register.NewDescription("sds://resourceNode1", "", "", "", ""), 4, time) - resourceNode2 := register.NewResourceNode(stratos.SdsAddress(addrRes2), pubKeyRes2, resOwner2, register.NewDescription("sds://resourceNode2", "", "", "", ""), 4, time) - resourceNode3 := register.NewResourceNode(stratos.SdsAddress(addrRes3), pubKeyRes3, resOwner3, register.NewDescription("sds://resourceNode3", "", "", "", ""), 4, time) - resourceNode4 := register.NewResourceNode(stratos.SdsAddress(addrRes4), pubKeyRes4, resOwner4, register.NewDescription("sds://resourceNode4", "", "", "", ""), 4, time) - resourceNode5 := register.NewResourceNode(stratos.SdsAddress(addrRes5), pubKeyRes5, resOwner5, register.NewDescription("sds://resourceNode5", "", "", "", ""), 4, time) - - resourceNode1 = resourceNode1.AddToken(initialStakeRes1) - resourceNode2 = resourceNode2.AddToken(initialStakeRes2) - resourceNode3 = resourceNode3.AddToken(initialStakeRes3) - resourceNode4 = resourceNode4.AddToken(initialStakeRes4) - resourceNode5 = resourceNode5.AddToken(initialStakeRes5) - - var resourceNodes []register.ResourceNode - resourceNodes = append(resourceNodes, resourceNode1) - resourceNodes = append(resourceNodes, resourceNode2) - resourceNodes = append(resourceNodes, resourceNode3) - resourceNodes = append(resourceNodes, resourceNode4) - resourceNodes = append(resourceNodes, resourceNode5) - return resourceNodes -} - -func setupAllIndexingNodes() []register.IndexingNode { - var indexingNodes []register.IndexingNode - - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - indexingNode1 := register.NewIndexingNode(stratos.SdsAddress(addrIdx1), pubKeyIdx1, idxOwner1, register.NewDescription("sds://indexingNode1", "", "", "", ""), time) - indexingNode2 := register.NewIndexingNode(stratos.SdsAddress(addrIdx2), pubKeyIdx2, idxOwner2, register.NewDescription("sds://indexingNode2", "", "", "", ""), time) - indexingNode3 := register.NewIndexingNode(stratos.SdsAddress(addrIdx2), pubKeyIdx3, idxOwner3, register.NewDescription("sds://indexingNode3", "", "", "", ""), time) - spNodeIndexingNode1 := register.NewIndexingNode(stratos.SdsAddress(addrIdx2), spNodePubKeyIdx1, sdsAccAddr1, register.NewDescription("sds://sdsIndexingNode1", "", "", "", ""), time) - - indexingNode1 = indexingNode1.AddToken(initialStakeIdx1) - indexingNode2 = indexingNode2.AddToken(initialStakeIdx2) - indexingNode3 = indexingNode3.AddToken(initialStakeIdx3) - spNodeIndexingNode1 = spNodeIndexingNode1.AddToken(spNodeInitialStakeIdx1) - - indexingNode1.Status = sdk.Bonded - indexingNode2.Status = sdk.Bonded - indexingNode3.Status = sdk.Bonded - spNodeIndexingNode1.Status = sdk.Bonded - - indexingNodes = append(indexingNodes, indexingNode1) - indexingNodes = append(indexingNodes, indexingNode2) - indexingNodes = append(indexingNodes, indexingNode3) - indexingNodes = append(indexingNodes, spNodeIndexingNode1) - - return indexingNodes - -} - -// GenTx generates a signed mock transaction. -func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx { - // Make the transaction free - fee := auth.StdFee{ - Amount: sdk.NewCoins(sdk.NewInt64Coin("foocoin", 0)), - Gas: 300000, - } - - sigs := make([]auth.StdSignature, len(priv)) - memo := "testmemotestmemo" - - for i, p := range priv { - sig, err := p.Sign(auth.StdSignBytes(chainID, accnums[i], seq[i], fee, msgs, memo)) - if err != nil { - panic(err) - } - - sigs[i] = auth.StdSignature{ - PubKey: p.PubKey(), - Signature: sig, - } - } - - return auth.NewStdTx(msgs, fee, sigs, memo) -} +// +//import ( +// "fmt" +// "time" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" +// "github.com/cosmos/cosmos-sdk/x/mock" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/register" +// abci "github.com/tendermint/tendermint/abci/types" +// "github.com/tendermint/tendermint/crypto" +// "github.com/tendermint/tendermint/crypto/ed25519" +// "github.com/tendermint/tendermint/crypto/secp256k1" +//) +// +//const ( +// chainID = "" +// DefaultDenom = "ustos" +// stos2ustos = 1000000000 +//) +// +//var ( +// testFileHashHex = "c03661732294feb49caf6dc16c7cbb2534986d73" +// +// resourceNodeVolume1 = sdk.NewInt(500000000000) +// resourceNodeVolume2 = sdk.NewInt(300000000000) +// resourceNodeVolume3 = sdk.NewInt(200000000000) +// prepayAmt = sdk.NewInt(2 * stos2ustos) +// +// depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") +// initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz +// totalUnissuedPrepayVal, _ = sdk.NewIntFromString("100000000000000000") +// totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) +// remainingOzoneLimit, _ = sdk.NewIntFromString("500000000000000000000") +// totalUnissuedPrepayTestPurchase, _ = sdk.NewIntFromString("0") +// remainingOzoneLimitTestPurchase, _ = sdk.NewIntFromString("100000000000") +// initialUOzonePriceTestPurchase = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz +// +// foundationDeposit = sdk.NewInt(40000000000000000) +// +// resOwnerPrivKey1 = secp256k1.GenPrivKey() +// resOwnerPrivKey2 = secp256k1.GenPrivKey() +// resOwnerPrivKey3 = secp256k1.GenPrivKey() +// resOwnerPrivKey4 = secp256k1.GenPrivKey() +// resOwnerPrivKey5 = secp256k1.GenPrivKey() +// idxOwnerPrivKey1 = secp256k1.GenPrivKey() +// idxOwnerPrivKey2 = secp256k1.GenPrivKey() +// idxOwnerPrivKey3 = secp256k1.GenPrivKey() +// +// resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) +// resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) +// resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) +// resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) +// resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) +// idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) +// idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) +// idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) +// +// pubKeyRes1 = secp256k1.GenPrivKey().PubKey() +// addrRes1 = sdk.AccAddress(pubKeyRes1.Address()) +// initialStakeRes1 = sdk.NewInt(3 * stos2ustos) +// initialStakeRes1TestPurchase = sdk.NewInt(100000000000) +// +// pubKeyRes2 = secp256k1.GenPrivKey().PubKey() +// addrRes2 = sdk.AccAddress(pubKeyRes2.Address()) +// initialStakeRes2 = sdk.NewInt(3 * stos2ustos) +// +// pubKeyRes3 = secp256k1.GenPrivKey().PubKey() +// addrRes3 = sdk.AccAddress(pubKeyRes3.Address()) +// initialStakeRes3 = sdk.NewInt(3 * stos2ustos) +// +// pubKeyRes4 = secp256k1.GenPrivKey().PubKey() +// addrRes4 = sdk.AccAddress(pubKeyRes4.Address()) +// initialStakeRes4 = sdk.NewInt(3 * stos2ustos) +// +// pubKeyRes5 = secp256k1.GenPrivKey().PubKey() +// addrRes5 = sdk.AccAddress(pubKeyRes5.Address()) +// initialStakeRes5 = sdk.NewInt(3 * stos2ustos) +// +// privKeyIdx1 = ed25519.GenPrivKey() +// pubKeyIdx1 = privKeyIdx1.PubKey() +// addrIdx1 = stratos.SdsAddress(pubKeyIdx1.Address()) +// initialStakeIdx1 = sdk.NewInt(5 * stos2ustos) +// initialStakeIdx1TestPurchase = sdk.NewInt(100 * stos2ustos) +// +// pubKeyIdx2 = ed25519.GenPrivKey().PubKey() +// addrIdx2 = stratos.SdsAddress(pubKeyIdx2.Address()) +// initialStakeIdx2 = sdk.NewInt(5 * stos2ustos) +// +// pubKeyIdx3 = ed25519.GenPrivKey().PubKey() +// addrIdx3 = stratos.SdsAddress(pubKeyIdx3.Address()) +// initialStakeIdx3 = sdk.NewInt(5 * stos2ustos) +// +// valOpPrivKey1 = secp256k1.GenPrivKey() +// valOpPubKey1 = valOpPrivKey1.PubKey() +// valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) +// valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) +// +// valConsPrivKey1 = secp256k1.GenPrivKey() +// valConsPubk1 = valConsPrivKey1.PubKey() +// valInitialStake = sdk.NewInt(15 * stos2ustos) +// +// // accs for sds module +// sdsAccPrivKey1 = secp256k1.GenPrivKey() +// sdsAccPubKey1 = sdsAccPrivKey1.PubKey() +// sdsAccAddr1 = sdk.AccAddress(sdsAccPubKey1.Address()) +// sdsAccBal1 = sdk.NewInt(100 * stos2ustos) +// initialStakeSdsIdx1 = sdk.NewInt(5 * stos2ustos) +// +// sdsAccPrivKey2 = secp256k1.GenPrivKey() +// sdsAccPubKey2 = sdsAccPrivKey2.PubKey() +// sdsAccAddr2 = sdk.AccAddress(sdsAccPubKey2.Address()) +// sdsAccBal2 = sdk.NewInt(100 * stos2ustos) +// +// sdsAccPrivKey3 = secp256k1.GenPrivKey() +// sdsAccPubKey3 = sdsAccPrivKey3.PubKey() +// sdsAccAddr3 = sdk.AccAddress(sdsAccPubKey3.Address()) +// sdsAccBal3 = sdk.NewInt(100 * stos2ustos) +// +// // sp node used in sds module +// spNodePrivKeyIdx1 = secp256k1.GenPrivKey() +// spNodePubKeyIdx1 = spNodePrivKeyIdx1.PubKey() +// spNodeAddrIdx1 = sdk.AccAddress(spNodePubKeyIdx1.Address()) +// spNodeInitialStakeIdx1 = sdk.NewInt(5 * stos2ustos) +// spP2pAddr = ed25519.GenPrivKey().PubKey().Address() +//) +// +//func setupAccounts(mApp *mock.App) []authexported.Account { +// +// str, _ := stratos.Bech32ifyPubKey(stratos.Bech32PubKeyTypeSdsP2PPub, sdsAccPubKey1) +// fmt.Println("sdsAccPubKey1=" + str) +// +// //************************** setup resource nodes owners' accounts ************************** +// resOwnerAcc1 := &auth.BaseAccount{ +// Address: resOwner1, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, +// } +// resOwnerAcc2 := &auth.BaseAccount{ +// Address: resOwner2, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, +// } +// resOwnerAcc3 := &auth.BaseAccount{ +// Address: resOwner3, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, +// } +// resOwnerAcc4 := &auth.BaseAccount{ +// Address: resOwner4, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, +// } +// resOwnerAcc5 := &auth.BaseAccount{ +// Address: resOwner5, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.NewInt(10000000000000000))}, +// } +// +// //************************** setup indexing nodes owners' accounts ************************** +// idxOwnerAcc1 := &auth.BaseAccount{ +// Address: idxOwner1, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.ZeroInt())}, +// } +// idxOwnerAcc2 := &auth.BaseAccount{ +// Address: idxOwner2, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.ZeroInt())}, +// } +// idxOwnerAcc3 := &auth.BaseAccount{ +// Address: idxOwner3, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdk.ZeroInt())}, +// } +// +// //************************** setup validator delegators' accounts ************************** +// valOwnerAcc1 := &auth.BaseAccount{ +// Address: valOpAccAddr1, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, valInitialStake)}, +// } +// +// //************************** setup resource nodes' accounts ************************** +// resNodeAcc1 := &auth.BaseAccount{ +// Address: addrRes1, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes1)}, +// } +// resNodeAcc2 := &auth.BaseAccount{ +// Address: addrRes2, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes2)}, +// } +// resNodeAcc3 := &auth.BaseAccount{ +// Address: addrRes3, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes3)}, +// } +// resNodeAcc4 := &auth.BaseAccount{ +// Address: addrRes4, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes4)}, +// } +// resNodeAcc5 := &auth.BaseAccount{ +// Address: addrRes5, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeRes5)}, +// } +// +// //************************** setup indexing nodes' accounts ************************** +// idxNodeAcc1 := &auth.BaseAccount{ +// Address: idxOwner1, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeIdx1.Add(depositForSendingTx))}, +// } +// idxNodeAcc2 := &auth.BaseAccount{ +// Address: idxOwner2, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeIdx2)}, +// } +// idxNodeAcc3 := &auth.BaseAccount{ +// Address: idxOwner3, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, initialStakeIdx3)}, +// } +// spNodeIdxNodeAcc1 := &auth.BaseAccount{ +// Address: spNodeAddrIdx1, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, spNodeInitialStakeIdx1)}, +// } +// +// //************************** setup sds module's accounts ************************** +// sdsAcc1 := &auth.BaseAccount{ // sp node owner +// Address: sdsAccAddr1, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdsAccBal1)}, +// } +// sdsAcc2 := &auth.BaseAccount{ +// Address: sdsAccAddr2, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdsAccBal2)}, +// } +// sdsAcc3 := &auth.BaseAccount{ +// Address: sdsAccAddr3, +// Coins: sdk.Coins{sdk.NewCoin(DefaultDenom, sdsAccBal3)}, +// } +// +// // the sequence of the account list is related to the value of parameter "accNums" of mock.SignCheckDeliver() method +// accs := []authexported.Account{ +// resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, +// idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, +// valOwnerAcc1, +// resNodeAcc1, resNodeAcc2, resNodeAcc3, resNodeAcc4, resNodeAcc5, +// idxNodeAcc1, idxNodeAcc2, idxNodeAcc3, spNodeIdxNodeAcc1, +// sdsAcc1, sdsAcc2, sdsAcc3, +// } +// +// ctx1 := mApp.BaseApp.NewContext(true, abci.Header{}) +// ctx1.Logger().Info("resNodeAcc1 -> " + resNodeAcc1.String()) +// ctx1.Logger().Info("resNodeAcc2 -> " + resNodeAcc2.String()) +// ctx1.Logger().Info("resNodeAcc3 -> " + resNodeAcc3.String()) +// ctx1.Logger().Info("resNodeAcc4 -> " + resNodeAcc4.String()) +// ctx1.Logger().Info("resNodeAcc5 -> " + resNodeAcc5.String()) +// ctx1.Logger().Info("idxNodeAcc1 -> " + idxNodeAcc1.String()) +// ctx1.Logger().Info("idxNodeAcc2 -> " + idxNodeAcc2.String()) +// ctx1.Logger().Info("idxNodeAcc3 -> " + idxNodeAcc3.String()) +// ctx1.Logger().Info("spNodeIdxNodeAcc1 -> " + spNodeIdxNodeAcc1.String()) +// //ctx1.Logger().Info("foundationAcc -> " + foundationAcc.String()) +// ctx1.Logger().Info("sdsAcc1 -> " + sdsAcc1.String()) +// ctx1.Logger().Info("sdsAcc2 -> " + sdsAcc2.String()) +// ctx1.Logger().Info("sdsAcc3 -> " + sdsAcc3.String()) +// +// return accs +//} +// +//func setupAllResourceNodes() []register.ResourceNode { +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// resourceNode1 := register.NewResourceNode(stratos.SdsAddress(addrRes1), pubKeyRes1, resOwner1, register.NewDescription("sds://resourceNode1", "", "", "", ""), 4, time) +// resourceNode2 := register.NewResourceNode(stratos.SdsAddress(addrRes2), pubKeyRes2, resOwner2, register.NewDescription("sds://resourceNode2", "", "", "", ""), 4, time) +// resourceNode3 := register.NewResourceNode(stratos.SdsAddress(addrRes3), pubKeyRes3, resOwner3, register.NewDescription("sds://resourceNode3", "", "", "", ""), 4, time) +// resourceNode4 := register.NewResourceNode(stratos.SdsAddress(addrRes4), pubKeyRes4, resOwner4, register.NewDescription("sds://resourceNode4", "", "", "", ""), 4, time) +// resourceNode5 := register.NewResourceNode(stratos.SdsAddress(addrRes5), pubKeyRes5, resOwner5, register.NewDescription("sds://resourceNode5", "", "", "", ""), 4, time) +// +// resourceNode1 = resourceNode1.AddToken(initialStakeRes1) +// resourceNode2 = resourceNode2.AddToken(initialStakeRes2) +// resourceNode3 = resourceNode3.AddToken(initialStakeRes3) +// resourceNode4 = resourceNode4.AddToken(initialStakeRes4) +// resourceNode5 = resourceNode5.AddToken(initialStakeRes5) +// +// var resourceNodes []register.ResourceNode +// resourceNodes = append(resourceNodes, resourceNode1) +// resourceNodes = append(resourceNodes, resourceNode2) +// resourceNodes = append(resourceNodes, resourceNode3) +// resourceNodes = append(resourceNodes, resourceNode4) +// resourceNodes = append(resourceNodes, resourceNode5) +// return resourceNodes +//} +// +//func setupAllIndexingNodes() []register.IndexingNode { +// var indexingNodes []register.IndexingNode +// +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// indexingNode1 := register.NewIndexingNode(stratos.SdsAddress(addrIdx1), pubKeyIdx1, idxOwner1, register.NewDescription("sds://indexingNode1", "", "", "", ""), time) +// indexingNode2 := register.NewIndexingNode(stratos.SdsAddress(addrIdx2), pubKeyIdx2, idxOwner2, register.NewDescription("sds://indexingNode2", "", "", "", ""), time) +// indexingNode3 := register.NewIndexingNode(stratos.SdsAddress(addrIdx2), pubKeyIdx3, idxOwner3, register.NewDescription("sds://indexingNode3", "", "", "", ""), time) +// spNodeIndexingNode1 := register.NewIndexingNode(stratos.SdsAddress(addrIdx2), spNodePubKeyIdx1, sdsAccAddr1, register.NewDescription("sds://sdsIndexingNode1", "", "", "", ""), time) +// +// indexingNode1 = indexingNode1.AddToken(initialStakeIdx1) +// indexingNode2 = indexingNode2.AddToken(initialStakeIdx2) +// indexingNode3 = indexingNode3.AddToken(initialStakeIdx3) +// spNodeIndexingNode1 = spNodeIndexingNode1.AddToken(spNodeInitialStakeIdx1) +// +// indexingNode1.Status = sdk.Bonded +// indexingNode2.Status = sdk.Bonded +// indexingNode3.Status = sdk.Bonded +// spNodeIndexingNode1.Status = sdk.Bonded +// +// indexingNodes = append(indexingNodes, indexingNode1) +// indexingNodes = append(indexingNodes, indexingNode2) +// indexingNodes = append(indexingNodes, indexingNode3) +// indexingNodes = append(indexingNodes, spNodeIndexingNode1) +// +// return indexingNodes +// +//} +// +//// GenTx generates a signed mock transaction. +//func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx { +// // Make the transaction free +// fee := auth.StdFee{ +// Amount: sdk.NewCoins(sdk.NewInt64Coin("foocoin", 0)), +// Gas: 300000, +// } +// +// sigs := make([]auth.StdSignature, len(priv)) +// memo := "testmemotestmemo" +// +// for i, p := range priv { +// sig, err := p.Sign(auth.StdSignBytes(chainID, accnums[i], seq[i], fee, msgs, memo)) +// if err != nil { +// panic(err) +// } +// +// sigs[i] = auth.StdSignature{ +// PubKey: p.PubKey(), +// Signature: sig, +// } +// } +// +// return auth.NewStdTx(msgs, fee, sigs, memo) +//} diff --git a/x/sds/types/msg.go b/x/sds/types/msg.go index 2042d010..b07cebcd 100644 --- a/x/sds/types/msg.go +++ b/x/sds/types/msg.go @@ -15,8 +15,8 @@ const ( var _ sdk.Msg = &MsgFileUpload{} // NewMsgUpload creates a new Msg instance -func NewMsgUpload(fileHash string, from, reporter, uploader string) MsgFileUpload { - return MsgFileUpload{ +func NewMsgUpload(fileHash string, from, reporter, uploader string) *MsgFileUpload { + return &MsgFileUpload{ FileHash: fileHash, From: from, Reporter: reporter, @@ -69,9 +69,9 @@ func (msg MsgFileUpload) ValidateBasic() error { var _ sdk.Msg = &MsgPrepay{} // NewMsgPrepay NewMsg creates a new Msg instance -func NewMsgPrepay(sender string, coins sdk.Coins) MsgPrepay { +func NewMsgPrepay(sender string, coins sdk.Coins) *MsgPrepay { - return MsgPrepay{ + return &MsgPrepay{ Sender: sender, Coins: coins, } diff --git a/x/sds/types/querier.go b/x/sds/types/querier.go index 0ed4995d..6222f438 100644 --- a/x/sds/types/querier.go +++ b/x/sds/types/querier.go @@ -12,7 +12,6 @@ const ( QueryUozSupply = "uoz_supply" ) -// QueryUploadedFileParams for query 'custom/distr/validator_outstanding_rewards' type QueryUploadedFileParams struct { Sender types.AccAddress `json:"sender" yaml:"sender"` } diff --git a/x/sds/types/query.pb.go b/x/sds/types/query.pb.go new file mode 100644 index 00000000..69525626 --- /dev/null +++ b/x/sds/types/query.pb.go @@ -0,0 +1,1329 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/sds/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + types "github.com/stratosnet/stratos-chain/x/sds/types" + _ "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 + +// QueryFileuploadRequest is request type for the Query/Fileupload RPC method +type QueryFileUploadRequest struct { + // network_addr defines the node network address to query for. + FileHash string `protobuf:"bytes,1,opt,name=file_hash,json=fileHash,proto3" json:"file_hash,omitempty"` +} + +func (m *QueryFileUploadRequest) Reset() { *m = QueryFileUploadRequest{} } +func (m *QueryFileUploadRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFileUploadRequest) ProtoMessage() {} +func (*QueryFileUploadRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5b213ac8f144321e, []int{0} +} +func (m *QueryFileUploadRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFileUploadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFileUploadRequest.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 *QueryFileUploadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFileUploadRequest.Merge(m, src) +} +func (m *QueryFileUploadRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFileUploadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFileUploadRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFileUploadRequest proto.InternalMessageInfo + +func (m *QueryFileUploadRequest) GetFileHash() string { + if m != nil { + return m.FileHash + } + return "" +} + +// QueryFileuploadResponse is response type for the Query/Fileupload RPC method +type QueryFileUploadResponse struct { + FileInfo *types.FileInfo `protobuf:"bytes,1,opt,name=file_info,json=fileInfo,proto3" json:"file_info,omitempty"` +} + +func (m *QueryFileUploadResponse) Reset() { *m = QueryFileUploadResponse{} } +func (m *QueryFileUploadResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFileUploadResponse) ProtoMessage() {} +func (*QueryFileUploadResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5b213ac8f144321e, []int{1} +} +func (m *QueryFileUploadResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFileUploadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFileUploadResponse.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 *QueryFileUploadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFileUploadResponse.Merge(m, src) +} +func (m *QueryFileUploadResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFileUploadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFileUploadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFileUploadResponse proto.InternalMessageInfo + +func (m *QueryFileUploadResponse) GetFileInfo() *types.FileInfo { + if m != nil { + return m.FileInfo + } + return nil +} + +// QueryPrepayRequest is request type for the Query/Prepay RPC method +type QueryPrepayRequest struct { + AcctAddr string `protobuf:"bytes,1,opt,name=acct_addr,json=acctAddr,proto3" json:"acct_addr,omitempty"` +} + +func (m *QueryPrepayRequest) Reset() { *m = QueryPrepayRequest{} } +func (m *QueryPrepayRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPrepayRequest) ProtoMessage() {} +func (*QueryPrepayRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5b213ac8f144321e, []int{2} +} +func (m *QueryPrepayRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPrepayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPrepayRequest.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 *QueryPrepayRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPrepayRequest.Merge(m, src) +} +func (m *QueryPrepayRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPrepayRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPrepayRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPrepayRequest proto.InternalMessageInfo + +func (m *QueryPrepayRequest) GetAcctAddr() string { + if m != nil { + return m.AcctAddr + } + return "" +} + +// QueryPrepayResponse is response type for the Query/Prepay RPC method +type QueryPrepayResponse struct { + Balance *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance,omitempty"` +} + +func (m *QueryPrepayResponse) Reset() { *m = QueryPrepayResponse{} } +func (m *QueryPrepayResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPrepayResponse) ProtoMessage() {} +func (*QueryPrepayResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5b213ac8f144321e, []int{3} +} +func (m *QueryPrepayResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPrepayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPrepayResponse.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 *QueryPrepayResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPrepayResponse.Merge(m, src) +} +func (m *QueryPrepayResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPrepayResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPrepayResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPrepayResponse proto.InternalMessageInfo + +// 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_5b213ac8f144321e, []int{4} +} +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 *types.Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +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_5b213ac8f144321e, []int{5} +} +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() *types.Params { + if m != nil { + return m.Params + } + return nil +} + +func init() { + proto.RegisterType((*QueryFileUploadRequest)(nil), "stratos.sds.v1.QueryFileUploadRequest") + proto.RegisterType((*QueryFileUploadResponse)(nil), "stratos.sds.v1.QueryFileUploadResponse") + proto.RegisterType((*QueryPrepayRequest)(nil), "stratos.sds.v1.QueryPrepayRequest") + proto.RegisterType((*QueryPrepayResponse)(nil), "stratos.sds.v1.QueryPrepayResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "stratos.sds.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "stratos.sds.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("stratos/sds/v1/query.proto", fileDescriptor_5b213ac8f144321e) } + +var fileDescriptor_5b213ac8f144321e = []byte{ + // 490 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0x2a, 0x46, 0x3b, 0x82, 0x87, 0xb1, 0xc4, 0xb0, 0xca, 0x2a, 0xa3, 0xb4, 0x5a, 0xe8, + 0x0e, 0xa9, 0xf6, 0x07, 0x58, 0x54, 0xec, 0x45, 0x6a, 0xc0, 0x8b, 0x1e, 0xca, 0x64, 0x77, 0xb2, + 0xbb, 0xb8, 0x99, 0xb7, 0x99, 0x37, 0x29, 0x86, 0x92, 0x8b, 0x47, 0x0f, 0x22, 0xf8, 0xa7, 0x3c, + 0x16, 0xbc, 0x88, 0x07, 0x91, 0xc4, 0x1f, 0x22, 0x3b, 0x3b, 0x5b, 0x92, 0x6d, 0xab, 0xa7, 0x1d, + 0xde, 0xfb, 0xbe, 0xf7, 0x7d, 0xf3, 0xbe, 0x59, 0xe2, 0xa3, 0xd1, 0xc2, 0x00, 0x72, 0x8c, 0x91, + 0x1f, 0xf5, 0xf8, 0x78, 0x22, 0xf5, 0x34, 0x2c, 0x34, 0x18, 0xa0, 0x37, 0x5c, 0x2f, 0xc4, 0x18, + 0xc3, 0xa3, 0x9e, 0xbf, 0x9e, 0x40, 0x02, 0xb6, 0xc5, 0xcb, 0x53, 0x85, 0xf2, 0xef, 0x24, 0x00, + 0x49, 0x2e, 0xb9, 0x28, 0x32, 0x2e, 0x94, 0x02, 0x23, 0x4c, 0x06, 0x0a, 0x5d, 0xb7, 0xdb, 0x98, + 0x5f, 0x8e, 0xb2, 0x1d, 0xb6, 0x4b, 0x3a, 0xaf, 0x4b, 0xb1, 0x17, 0x59, 0x2e, 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12, 0xcf, 0x0f, 0xc7, 0xdf, 0xfc, 0x2f, 0xae, 0x72, 0xc6, 0xf8, 0xc7, 0xef, + 0x7f, 0xbe, 0x5e, 0x7a, 0x44, 0x37, 0x79, 0xe3, 0x09, 0xd8, 0x8c, 0x2a, 0x55, 0x7e, 0x7c, 0x1a, + 0xf4, 0x8c, 0xce, 0x48, 0xbb, 0xda, 0x27, 0x65, 0xe7, 0x6a, 0xac, 0xe4, 0xe3, 0xdf, 0xff, 0x27, + 0xc6, 0x79, 0xd8, 0xb2, 0x1e, 0x1e, 0x50, 0xd6, 0xf4, 0x50, 0x58, 0x1c, 0x3f, 0x3e, 0x8d, 0x78, + 0x46, 0xc7, 0xa4, 0x5d, 0xed, 0xea, 0x22, 0xf9, 0xe5, 0x38, 0x2e, 0x92, 0x5f, 0x09, 0x87, 0x05, + 0x56, 0xbe, 0x4b, 0x3b, 0x67, 0xe4, 0x2d, 0x6e, 0xef, 0xd5, 0xb7, 0x79, 0xe0, 0x9d, 0xcc, 0x03, + 0xef, 0xf7, 0x3c, 0xf0, 0xbe, 0x2c, 0x82, 0xd6, 0xc9, 0x22, 0x68, 0xfd, 0x58, 0x04, 0xad, 0xb7, + 0x4f, 0x96, 0x1e, 0x8d, 0xe3, 0x2a, 0x69, 0xea, 0xe3, 0x76, 0x94, 0x8a, 0x4c, 0xf1, 0x0f, 0x5c, + 0xcb, 0x24, 0x43, 0x23, 0x75, 0xf5, 0x8c, 0x06, 0x6d, 0xfb, 0x67, 0x3d, 0xfe, 0x1b, 0x00, 0x00, + 0xff, 0xff, 0xb7, 0xdd, 0xa2, 0x56, 0xd5, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Query uploaded file info by hash + Fileupload(ctx context.Context, in *QueryFileUploadRequest, opts ...grpc.CallOption) (*QueryFileUploadResponse, error) + // Query balance of prepayment in Volume Pool + Prepay(ctx context.Context, in *QueryPrepayRequest, opts ...grpc.CallOption) (*QueryPrepayResponse, error) + // Params queries SDS module Params info. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Fileupload(ctx context.Context, in *QueryFileUploadRequest, opts ...grpc.CallOption) (*QueryFileUploadResponse, error) { + out := new(QueryFileUploadResponse) + err := c.cc.Invoke(ctx, "/stratos.sds.v1.Query/Fileupload", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Prepay(ctx context.Context, in *QueryPrepayRequest, opts ...grpc.CallOption) (*QueryPrepayResponse, error) { + out := new(QueryPrepayResponse) + err := c.cc.Invoke(ctx, "/stratos.sds.v1.Query/Prepay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/stratos.sds.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Query uploaded file info by hash + Fileupload(context.Context, *QueryFileUploadRequest) (*QueryFileUploadResponse, error) + // Query balance of prepayment in Volume Pool + Prepay(context.Context, *QueryPrepayRequest) (*QueryPrepayResponse, error) + // Params queries SDS module Params info. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Fileupload(ctx context.Context, req *QueryFileUploadRequest) (*QueryFileUploadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Fileupload not implemented") +} +func (*UnimplementedQueryServer) Prepay(ctx context.Context, req *QueryPrepayRequest) (*QueryPrepayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Prepay not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Fileupload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFileUploadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Fileupload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.sds.v1.Query/Fileupload", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Fileupload(ctx, req.(*QueryFileUploadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Prepay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPrepayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Prepay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.sds.v1.Query/Prepay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Prepay(ctx, req.(*QueryPrepayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.sds.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.sds.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Fileupload", + Handler: _Query_Fileupload_Handler, + }, + { + MethodName: "Prepay", + Handler: _Query_Prepay_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/sds/v1/query.proto", +} + +func (m *QueryFileUploadRequest) 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 *QueryFileUploadRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFileUploadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FileHash) > 0 { + i -= len(m.FileHash) + copy(dAtA[i:], m.FileHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FileHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFileUploadResponse) 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 *QueryFileUploadResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFileUploadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.FileInfo != nil { + { + size, err := m.FileInfo.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 *QueryPrepayRequest) 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 *QueryPrepayRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPrepayRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AcctAddr) > 0 { + i -= len(m.AcctAddr) + copy(dAtA[i:], m.AcctAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AcctAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPrepayResponse) 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 *QueryPrepayResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPrepayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Balance != nil { + { + size := m.Balance.Size() + i -= size + if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func 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 *QueryFileUploadRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FileHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFileUploadResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FileInfo != nil { + l = m.FileInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPrepayRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AcctAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPrepayResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Balance != nil { + l = m.Balance.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryFileUploadRequest) 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: QueryFileUploadRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFileUploadRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileHash", 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.FileHash = 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 *QueryFileUploadResponse) 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: QueryFileUploadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFileUploadResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileInfo", 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.FileInfo == nil { + m.FileInfo = &types.FileInfo{} + } + if err := m.FileInfo.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 *QueryPrepayRequest) 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: QueryPrepayRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPrepayRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AcctAddr", 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.AcctAddr = 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 *QueryPrepayResponse) 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: QueryPrepayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPrepayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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 + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.Balance = &v + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &types.Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (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/sds/types/query.pb.gw.go b/x/sds/types/query.pb.gw.go new file mode 100644 index 00000000..e52e64dd --- /dev/null +++ b/x/sds/types/query.pb.gw.go @@ -0,0 +1,344 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/sds/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/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 + +func request_Query_Fileupload_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFileUploadRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["file_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "file_hash") + } + + protoReq.FileHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "file_hash", err) + } + + msg, err := client.Fileupload(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Fileupload_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFileUploadRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["file_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "file_hash") + } + + protoReq.FileHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "file_hash", err) + } + + msg, err := server.Fileupload(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Prepay_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPrepayRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["acct_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "acct_addr") + } + + protoReq.AcctAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "acct_addr", err) + } + + msg, err := client.Prepay(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Prepay_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPrepayRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["acct_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "acct_addr") + } + + protoReq.AcctAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "acct_addr", err) + } + + msg, err := server.Prepay(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Fileupload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Fileupload_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Fileupload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Prepay_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Prepay_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Prepay_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + 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) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Fileupload_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_Fileupload_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_Fileupload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Prepay_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_Prepay_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_Prepay_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Fileupload_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "sds", "v1", "file_upload", "file_hash"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Prepay_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "sds", "v1", "prepay", "acct_addr"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "sds", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Fileupload_0 = runtime.ForwardResponseMessage + + forward_Query_Prepay_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/sds/types/sds.pb.go b/x/sds/types/sds.pb.go index ee64fbc1..1942ce23 100644 --- a/x/sds/types/sds.pb.go +++ b/x/sds/types/sds.pb.go @@ -6,7 +6,6 @@ package types import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -175,172 +174,39 @@ func (m *FileInfo) GetUploader() string { return "" } -type MsgFileUpload struct { - FileHash string `protobuf:"bytes,1,opt,name=fileHash,proto3" json:"file_hash" yaml:"file_hash"` - From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from" yaml:"from"` - Reporter string `protobuf:"bytes,3,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` - Uploader string `protobuf:"bytes,4,opt,name=uploader,proto3" json:"uploader" yaml:"uploader"` -} - -func (m *MsgFileUpload) Reset() { *m = MsgFileUpload{} } -func (m *MsgFileUpload) String() string { return proto.CompactTextString(m) } -func (*MsgFileUpload) ProtoMessage() {} -func (*MsgFileUpload) Descriptor() ([]byte, []int) { - return fileDescriptor_a89f3959b8649eb2, []int{3} -} -func (m *MsgFileUpload) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgFileUpload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgFileUpload.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 *MsgFileUpload) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFileUpload.Merge(m, src) -} -func (m *MsgFileUpload) XXX_Size() int { - return m.Size() -} -func (m *MsgFileUpload) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFileUpload.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFileUpload proto.InternalMessageInfo - -func (m *MsgFileUpload) GetFileHash() string { - if m != nil { - return m.FileHash - } - return "" -} - -func (m *MsgFileUpload) GetFrom() string { - if m != nil { - return m.From - } - return "" -} - -func (m *MsgFileUpload) GetReporter() string { - if m != nil { - return m.Reporter - } - return "" -} - -func (m *MsgFileUpload) GetUploader() string { - if m != nil { - return m.Uploader - } - return "" -} - -type MsgPrepay struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender" yaml:"sender"` - Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" yaml:"coins"` -} - -func (m *MsgPrepay) Reset() { *m = MsgPrepay{} } -func (m *MsgPrepay) String() string { return proto.CompactTextString(m) } -func (*MsgPrepay) ProtoMessage() {} -func (*MsgPrepay) Descriptor() ([]byte, []int) { - return fileDescriptor_a89f3959b8649eb2, []int{4} -} -func (m *MsgPrepay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPrepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPrepay.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 *MsgPrepay) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPrepay.Merge(m, src) -} -func (m *MsgPrepay) XXX_Size() int { - return m.Size() -} -func (m *MsgPrepay) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPrepay.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPrepay proto.InternalMessageInfo - -func (m *MsgPrepay) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgPrepay) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Coins - } - return nil -} - func init() { proto.RegisterType((*Params)(nil), "stratos.sds.v1.Params") proto.RegisterType((*FileUpload)(nil), "stratos.sds.v1.FileUpload") proto.RegisterType((*FileInfo)(nil), "stratos.sds.v1.FileInfo") - proto.RegisterType((*MsgFileUpload)(nil), "stratos.sds.v1.MsgFileUpload") - proto.RegisterType((*MsgPrepay)(nil), "stratos.sds.v1.MsgPrepay") } func init() { proto.RegisterFile("stratos/sds/v1/sds.proto", fileDescriptor_a89f3959b8649eb2) } var fileDescriptor_a89f3959b8649eb2 = []byte{ - // 544 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x51, 0x41, 0x4b, 0xf3, 0x40, + 0x10, 0xed, 0x7e, 0x1f, 0x94, 0x66, 0x05, 0xd1, 0xe0, 0x21, 0xf4, 0x90, 0xd4, 0x08, 0x52, 0x84, + 0x26, 0x54, 0x6f, 0x82, 0x97, 0x20, 0xc5, 0x82, 0x07, 0x09, 0x88, 0xe0, 0xa5, 0x6c, 0x9b, 0x6d, + 0x12, 0x4c, 0x32, 0x21, 0xbb, 0x2d, 0xf6, 0x0f, 0x78, 0xf6, 0x47, 0xf8, 0x63, 0x3c, 0xf6, 0x28, + 0x1e, 0x82, 0xb4, 0xb7, 0x1e, 0xfb, 0x0b, 0x64, 0x37, 0xdb, 0x5a, 0x3d, 0xed, 0xcc, 0x7b, 0xf3, + 0x1e, 0x6f, 0x76, 0xb0, 0xc1, 0x78, 0x41, 0x38, 0x30, 0x97, 0x05, 0xcc, 0x9d, 0x76, 0xc5, 0xe3, + 0xe4, 0x05, 0x70, 0xd0, 0xf7, 0x15, 0xe3, 0x08, 0x68, 0xda, 0x6d, 0x1e, 0x85, 0x10, 0x82, 0xa4, + 0x5c, 0x51, 0x55, 0x53, 0xf6, 0x2d, 0xae, 0xdf, 0x91, 0x82, 0xa4, 0x4c, 0xf7, 0x30, 0x1e, 0x42, + 0x16, 0x0c, 0x02, 0x9a, 0x41, 0x6a, 0xa0, 0x16, 0x6a, 0x6b, 0xde, 0xc9, 0xaa, 0xb4, 0x76, 0xd0, + 0x75, 0x69, 0x1d, 0xce, 0x48, 0x9a, 0x5c, 0xda, 0x3f, 0x98, 0xed, 0x6b, 0xa2, 0xb9, 0x96, 0xf5, + 0x1b, 0xc2, 0xb8, 0x17, 0x27, 0xf4, 0x3e, 0x4f, 0x80, 0x04, 0xfa, 0x15, 0x6e, 0x8c, 0xe3, 0x84, + 0xde, 0x10, 0x16, 0x29, 0xc3, 0xe3, 0x55, 0x69, 0x69, 0x02, 0x1b, 0x44, 0x84, 0x45, 0xeb, 0xd2, + 0x3a, 0xa8, 0xfc, 0xb6, 0x90, 0xed, 0x6f, 0x25, 0xfa, 0x43, 0x25, 0xef, 0x67, 0x63, 0x30, 0xfe, + 0xb5, 0x50, 0x7b, 0xef, 0xdc, 0x70, 0x7e, 0x2f, 0xe5, 0xf4, 0x14, 0xbf, 0x63, 0x1c, 0x67, 0x63, + 0xf8, 0x63, 0x2c, 0x20, 0x65, 0x2c, 0x86, 0xed, 0x17, 0x84, 0x1b, 0x1b, 0xa5, 0xee, 0xe1, 0x7a, + 0x44, 0xe3, 0x30, 0xe2, 0x2a, 0xe2, 0xd9, 0x67, 0x69, 0x9d, 0x86, 0x31, 0x8f, 0x26, 0x43, 0x67, + 0x04, 0xa9, 0x3b, 0x02, 0x96, 0x02, 0x53, 0x4f, 0x87, 0x05, 0x4f, 0x2e, 0x9f, 0xe5, 0x94, 0x39, + 0xfd, 0x8c, 0xfb, 0x4a, 0xa9, 0x37, 0x71, 0xa3, 0xa0, 0x39, 0x14, 0x9c, 0x16, 0x32, 0xa9, 0xe6, + 0x6f, 0x7b, 0xc1, 0x4d, 0xe4, 0x77, 0xd0, 0xc2, 0xf8, 0x5f, 0x71, 0x9b, 0xde, 0xeb, 0xbf, 0x2f, + 0x4c, 0x34, 0x5f, 0x98, 0xe8, 0x6b, 0x61, 0xa2, 0xd7, 0xa5, 0x59, 0x9b, 0x2f, 0xcd, 0xda, 0xc7, + 0xd2, 0xac, 0x3d, 0xba, 0x3b, 0x09, 0xd4, 0xce, 0x19, 0xe5, 0x9b, 0xb2, 0x33, 0x8a, 0x48, 0x9c, + 0xb9, 0xcf, 0xf2, 0xea, 0x32, 0xce, 0xb0, 0x2e, 0xef, 0x79, 0xf1, 0x1d, 0x00, 0x00, 0xff, 0xff, + 0x73, 0x0f, 0xd2, 0x63, 0x11, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -464,101 +330,6 @@ func (m *FileInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgFileUpload) 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 *MsgFileUpload) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgFileUpload) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Uploader) > 0 { - i -= len(m.Uploader) - copy(dAtA[i:], m.Uploader) - i = encodeVarintSds(dAtA, i, uint64(len(m.Uploader))) - i-- - dAtA[i] = 0x22 - } - if len(m.Reporter) > 0 { - i -= len(m.Reporter) - copy(dAtA[i:], m.Reporter) - i = encodeVarintSds(dAtA, i, uint64(len(m.Reporter))) - i-- - dAtA[i] = 0x1a - } - if len(m.From) > 0 { - i -= len(m.From) - copy(dAtA[i:], m.From) - i = encodeVarintSds(dAtA, i, uint64(len(m.From))) - i-- - dAtA[i] = 0x12 - } - if len(m.FileHash) > 0 { - i -= len(m.FileHash) - copy(dAtA[i:], m.FileHash) - i = encodeVarintSds(dAtA, i, uint64(len(m.FileHash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgPrepay) 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 *MsgPrepay) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPrepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Coins) > 0 { - for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSds(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintSds(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintSds(dAtA []byte, offset int, v uint64) int { offset -= sovSds(v) base := offset @@ -621,50 +392,6 @@ func (m *FileInfo) Size() (n int) { return n } -func (m *MsgFileUpload) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FileHash) - if l > 0 { - n += 1 + l + sovSds(uint64(l)) - } - l = len(m.From) - if l > 0 { - n += 1 + l + sovSds(uint64(l)) - } - l = len(m.Reporter) - if l > 0 { - n += 1 + l + sovSds(uint64(l)) - } - l = len(m.Uploader) - if l > 0 { - n += 1 + l + sovSds(uint64(l)) - } - return n -} - -func (m *MsgPrepay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovSds(uint64(l)) - } - if len(m.Coins) > 0 { - for _, e := range m.Coins { - l = e.Size() - n += 1 + l + sovSds(uint64(l)) - } - } - return n -} - func sovSds(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1021,300 +748,6 @@ func (m *FileInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgFileUpload) 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 ErrIntOverflowSds - } - 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: MsgFileUpload: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFileUpload: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FileHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSds - } - 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 ErrInvalidLengthSds - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSds - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FileHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSds - } - 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 ErrInvalidLengthSds - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSds - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.From = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSds - } - 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 ErrInvalidLengthSds - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSds - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reporter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uploader", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSds - } - 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 ErrInvalidLengthSds - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSds - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uploader = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSds(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSds - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPrepay) 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 ErrIntOverflowSds - } - 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: MsgPrepay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPrepay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSds - } - 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 ErrInvalidLengthSds - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSds - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSds - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSds - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSds - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Coins = append(m.Coins, types.Coin{}) - if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSds(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSds - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipSds(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/sds/types/tx.pb.go b/x/sds/types/tx.pb.go new file mode 100644 index 00000000..dfe41463 --- /dev/null +++ b/x/sds/types/tx.pb.go @@ -0,0 +1,1089 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/sds/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgFileUpload struct { + FileHash string `protobuf:"bytes,1,opt,name=fileHash,proto3" json:"file_hash" yaml:"file_hash"` + From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from" yaml:"from"` + Reporter string `protobuf:"bytes,3,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` + Uploader string `protobuf:"bytes,4,opt,name=uploader,proto3" json:"uploader" yaml:"uploader"` +} + +func (m *MsgFileUpload) Reset() { *m = MsgFileUpload{} } +func (m *MsgFileUpload) String() string { return proto.CompactTextString(m) } +func (*MsgFileUpload) ProtoMessage() {} +func (*MsgFileUpload) Descriptor() ([]byte, []int) { + return fileDescriptor_a5a216e2f9435b27, []int{0} +} +func (m *MsgFileUpload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFileUpload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFileUpload.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 *MsgFileUpload) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFileUpload.Merge(m, src) +} +func (m *MsgFileUpload) XXX_Size() int { + return m.Size() +} +func (m *MsgFileUpload) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFileUpload.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFileUpload proto.InternalMessageInfo + +func (m *MsgFileUpload) GetFileHash() string { + if m != nil { + return m.FileHash + } + return "" +} + +func (m *MsgFileUpload) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgFileUpload) GetReporter() string { + if m != nil { + return m.Reporter + } + return "" +} + +func (m *MsgFileUpload) GetUploader() string { + if m != nil { + return m.Uploader + } + return "" +} + +type MsgPrepay struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender" yaml:"sender"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" yaml:"coins"` +} + +func (m *MsgPrepay) Reset() { *m = MsgPrepay{} } +func (m *MsgPrepay) String() string { return proto.CompactTextString(m) } +func (*MsgPrepay) ProtoMessage() {} +func (*MsgPrepay) Descriptor() ([]byte, []int) { + return fileDescriptor_a5a216e2f9435b27, []int{1} +} +func (m *MsgPrepay) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPrepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPrepay.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 *MsgPrepay) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPrepay.Merge(m, src) +} +func (m *MsgPrepay) XXX_Size() int { + return m.Size() +} +func (m *MsgPrepay) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPrepay.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPrepay proto.InternalMessageInfo + +func (m *MsgPrepay) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgPrepay) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Coins + } + return nil +} + +type MsgFileUploadResponse struct { +} + +func (m *MsgFileUploadResponse) Reset() { *m = MsgFileUploadResponse{} } +func (m *MsgFileUploadResponse) String() string { return proto.CompactTextString(m) } +func (*MsgFileUploadResponse) ProtoMessage() {} +func (*MsgFileUploadResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a5a216e2f9435b27, []int{2} +} +func (m *MsgFileUploadResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFileUploadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFileUploadResponse.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 *MsgFileUploadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFileUploadResponse.Merge(m, src) +} +func (m *MsgFileUploadResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgFileUploadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFileUploadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFileUploadResponse proto.InternalMessageInfo + +type MsgPrepayResponse struct { +} + +func (m *MsgPrepayResponse) Reset() { *m = MsgPrepayResponse{} } +func (m *MsgPrepayResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPrepayResponse) ProtoMessage() {} +func (*MsgPrepayResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a5a216e2f9435b27, []int{3} +} +func (m *MsgPrepayResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPrepayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPrepayResponse.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 *MsgPrepayResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPrepayResponse.Merge(m, src) +} +func (m *MsgPrepayResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPrepayResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPrepayResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPrepayResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgFileUpload)(nil), "stratos.sds.v1.MsgFileUpload") + proto.RegisterType((*MsgPrepay)(nil), "stratos.sds.v1.MsgPrepay") + proto.RegisterType((*MsgFileUploadResponse)(nil), "stratos.sds.v1.MsgFileUploadResponse") + proto.RegisterType((*MsgPrepayResponse)(nil), "stratos.sds.v1.MsgPrepayResponse") +} + +func init() { proto.RegisterFile("stratos/sds/v1/tx.proto", fileDescriptor_a5a216e2f9435b27) } + +var fileDescriptor_a5a216e2f9435b27 = []byte{ + // 545 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x41, 0x6f, 0xd3, 0x3c, + 0x18, 0x6e, 0xda, 0x7d, 0xd3, 0xea, 0x7d, 0x63, 0x90, 0x01, 0xcd, 0x3a, 0x16, 0x6f, 0x46, 0x48, + 0x95, 0xd0, 0x62, 0x75, 0xbb, 0x81, 0xb8, 0x14, 0x09, 0x6d, 0x87, 0x4a, 0x28, 0x12, 0x17, 0x2e, + 0xc8, 0x6d, 0xbd, 0x34, 0x22, 0x8d, 0xa3, 0xbc, 0x5e, 0xb5, 0x72, 0x42, 0xfc, 0x02, 0x24, 0xfe, + 0x05, 0xbf, 0x81, 0x1f, 0xb0, 0xe3, 0x24, 0x2e, 0x9c, 0x0c, 0x6a, 0x39, 0xf5, 0x58, 0x89, 0x03, + 0x37, 0x14, 0x3b, 0xc9, 0xe8, 0x04, 0x9c, 0x62, 0x3f, 0x8f, 0x9f, 0xe7, 0xb5, 0x9f, 0xf7, 0x0d, + 0x6a, 0x80, 0x4c, 0x99, 0x14, 0x40, 0x61, 0x00, 0x74, 0xdc, 0xa6, 0xf2, 0xdc, 0x4b, 0x52, 0x21, + 0x85, 0x7d, 0x23, 0x27, 0x3c, 0x18, 0x80, 0x37, 0x6e, 0x37, 0x6f, 0x07, 0x22, 0x10, 0x9a, 0xa2, + 0xd9, 0xca, 0x9c, 0x6a, 0xde, 0x0b, 0x84, 0x08, 0x22, 0x4e, 0x59, 0x12, 0x52, 0x16, 0xc7, 0x42, + 0x32, 0x19, 0x8a, 0x18, 0x72, 0xd6, 0xed, 0x0b, 0x18, 0x09, 0xa0, 0x3d, 0x06, 0x9c, 0x8e, 0xdb, + 0x3d, 0x2e, 0x59, 0x9b, 0xf6, 0x45, 0x18, 0x1b, 0x9e, 0xfc, 0xb0, 0xd0, 0x46, 0x17, 0x82, 0x67, + 0x61, 0xc4, 0x5f, 0x24, 0x91, 0x60, 0x03, 0xfb, 0x09, 0x5a, 0x3b, 0x0d, 0x23, 0x7e, 0xcc, 0x60, + 0xe8, 0x58, 0x7b, 0x56, 0xab, 0xde, 0xd9, 0x9f, 0x2b, 0x5c, 0xcf, 0xb0, 0x57, 0x43, 0x06, 0xc3, + 0x85, 0xc2, 0x37, 0x27, 0x6c, 0x14, 0x3d, 0x22, 0x25, 0x44, 0xfc, 0x52, 0x62, 0x3f, 0x44, 0x2b, + 0xa7, 0xa9, 0x18, 0x39, 0x55, 0x2d, 0x6d, 0xcc, 0x15, 0xd6, 0xfb, 0x85, 0xc2, 0xeb, 0xb9, 0x2a, + 0x15, 0x23, 0xe2, 0x6b, 0xd0, 0x7e, 0x8c, 0xd6, 0x52, 0x9e, 0x88, 0x54, 0xf2, 0xd4, 0xa9, 0x69, + 0x01, 0x9e, 0x2b, 0x5c, 0x62, 0x0b, 0x85, 0x37, 0x8d, 0xa8, 0x40, 0x88, 0x5f, 0x92, 0x99, 0xf8, + 0x4c, 0x5f, 0x99, 0xa7, 0xce, 0xca, 0x95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87, 0xbf, 0xfd, + 0x07, 0x7b, 0x43, 0x35, 0xf7, 0xff, 0x4a, 0x95, 0x55, 0x5d, 0x5d, 0xd5, 0x21, 0x77, 0xaf, 0x57, + 0x4d, 0xf4, 0xb9, 0xce, 0xc9, 0xc5, 0xd4, 0xb5, 0x2e, 0xa7, 0xae, 0xf5, 0x6d, 0xea, 0x5a, 0xef, + 0x67, 0x6e, 0xe5, 0x72, 0xe6, 0x56, 0xbe, 0xcc, 0xdc, 0xca, 0x4b, 0xfa, 0x5b, 0xe8, 0xb9, 0x36, + 0xe6, 0xb2, 0x58, 0x1e, 0xf4, 0x87, 0x2c, 0x8c, 0xe9, 0xb9, 0xb6, 0xd3, 0x1d, 0xe8, 0xad, 0xea, + 0x5f, 0xe6, 0xe8, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0xb5, 0xea, 0x41, 0xb1, 0x03, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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 { + // CreateResourceNode defines a method for creating a new resource node. + HandleMsgFileUpload(ctx context.Context, in *MsgFileUpload, opts ...grpc.CallOption) (*MsgFileUploadResponse, error) + HandleMsgPrepay(ctx context.Context, in *MsgPrepay, opts ...grpc.CallOption) (*MsgPrepayResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) HandleMsgFileUpload(ctx context.Context, in *MsgFileUpload, opts ...grpc.CallOption) (*MsgFileUploadResponse, error) { + out := new(MsgFileUploadResponse) + err := c.cc.Invoke(ctx, "/stratos.sds.v1.Msg/HandleMsgFileUpload", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) HandleMsgPrepay(ctx context.Context, in *MsgPrepay, opts ...grpc.CallOption) (*MsgPrepayResponse, error) { + out := new(MsgPrepayResponse) + err := c.cc.Invoke(ctx, "/stratos.sds.v1.Msg/HandleMsgPrepay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateResourceNode defines a method for creating a new resource node. + HandleMsgFileUpload(context.Context, *MsgFileUpload) (*MsgFileUploadResponse, error) + HandleMsgPrepay(context.Context, *MsgPrepay) (*MsgPrepayResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) HandleMsgFileUpload(ctx context.Context, req *MsgFileUpload) (*MsgFileUploadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgFileUpload not implemented") +} +func (*UnimplementedMsgServer) HandleMsgPrepay(ctx context.Context, req *MsgPrepay) (*MsgPrepayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgPrepay not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_HandleMsgFileUpload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgFileUpload) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HandleMsgFileUpload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.sds.v1.Msg/HandleMsgFileUpload", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HandleMsgFileUpload(ctx, req.(*MsgFileUpload)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_HandleMsgPrepay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPrepay) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HandleMsgPrepay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.sds.v1.Msg/HandleMsgPrepay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HandleMsgPrepay(ctx, req.(*MsgPrepay)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.sds.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "HandleMsgFileUpload", + Handler: _Msg_HandleMsgFileUpload_Handler, + }, + { + MethodName: "HandleMsgPrepay", + Handler: _Msg_HandleMsgPrepay_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/sds/v1/tx.proto", +} + +func (m *MsgFileUpload) 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 *MsgFileUpload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFileUpload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Uploader) > 0 { + i -= len(m.Uploader) + copy(dAtA[i:], m.Uploader) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uploader))) + i-- + dAtA[i] = 0x22 + } + if len(m.Reporter) > 0 { + i -= len(m.Reporter) + copy(dAtA[i:], m.Reporter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Reporter))) + i-- + dAtA[i] = 0x1a + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0x12 + } + if len(m.FileHash) > 0 { + i -= len(m.FileHash) + copy(dAtA[i:], m.FileHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.FileHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPrepay) 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 *MsgPrepay) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPrepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Coins) > 0 { + for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgFileUploadResponse) 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 *MsgFileUploadResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFileUploadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgPrepayResponse) 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 *MsgPrepayResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPrepayResponse) 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 *MsgFileUpload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FileHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Reporter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Uploader) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgPrepay) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Coins) > 0 { + for _, e := range m.Coins { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgFileUploadResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgPrepayResponse) 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 *MsgFileUpload) 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: MsgFileUpload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFileUpload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileHash", 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.FileHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", 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.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reporter", 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.Reporter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uploader", 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.Uploader = 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 *MsgPrepay) 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: MsgPrepay: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPrepay: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coins", 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.Coins = append(m.Coins, types.Coin{}) + if err := m.Coins[len(m.Coins)-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 *MsgFileUploadResponse) 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: MsgFileUploadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFileUploadResponse: 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 *MsgPrepayResponse) 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: MsgPrepayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPrepayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/sds/types/tx.pb.gw.go b/x/sds/types/tx.pb.gw.go new file mode 100644 index 00000000..2d27aa39 --- /dev/null +++ b/x/sds/types/tx.pb.gw.go @@ -0,0 +1,246 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/sds/v1/tx.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/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 ( + filter_Msg_HandleMsgFileUpload_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_HandleMsgFileUpload_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgFileUpload + 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_Msg_HandleMsgFileUpload_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HandleMsgFileUpload(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_HandleMsgFileUpload_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgFileUpload + 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_Msg_HandleMsgFileUpload_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HandleMsgFileUpload(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_HandleMsgPrepay_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_HandleMsgPrepay_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgPrepay + 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_Msg_HandleMsgPrepay_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HandleMsgPrepay(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_HandleMsgPrepay_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgPrepay + 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_Msg_HandleMsgPrepay_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HandleMsgPrepay(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". +// UnaryRPC :call MsgServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. +func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + + mux.Handle("POST", pattern_Msg_HandleMsgFileUpload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_HandleMsgFileUpload_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgFileUpload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgPrepay_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_HandleMsgPrepay_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgPrepay_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMsgHandlerFromEndpoint(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 RegisterMsgHandler(ctx, mux, conn) +} + +// RegisterMsgHandler registers the http handlers for service Msg to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn)) +} + +// RegisterMsgHandlerClient registers the http handlers for service Msg +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MsgClient" to call the correct interceptors. +func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + + mux.Handle("POST", pattern_Msg_HandleMsgFileUpload_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_Msg_HandleMsgFileUpload_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgFileUpload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgPrepay_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_Msg_HandleMsgPrepay_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgPrepay_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Msg_HandleMsgFileUpload_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "sds", "v1", "file_upload"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_HandleMsgPrepay_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "sds", "v1", "prepay"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Msg_HandleMsgFileUpload_0 = runtime.ForwardResponseMessage + + forward_Msg_HandleMsgPrepay_0 = runtime.ForwardResponseMessage +) From de565ebfbcfdfb53f37632ea7ed1f11dc2166d7a Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 13 May 2022 17:42:38 -0400 Subject: [PATCH 045/113] - qb-1165: upgrade pot module --- proto/stratos/pot/v1/genesis.proto | 42 + proto/stratos/pot/v1/pot.proto | 421 +++++ proto/stratos/pot/v1/query.proto | 141 ++ proto/stratos/pot/v1/tx.proto | 128 ++ x/pot/client/cli/query.go | 43 +- x/pot/client/cli/tx.go | 173 +- x/pot/client/rest/query.go | 32 +- x/pot/client/rest/rest.go | 10 +- x/pot/client/rest/tx.go | 54 +- x/pot/handler.go | 110 +- x/pot/keeper/distribute.go | 6 +- x/pot/keeper/keeper.go | 41 +- x/pot/keeper/msg_server.go | 170 ++ x/pot/keeper/store.go | 29 +- x/pot/types/codec.go | 31 +- x/pot/types/distribute.go | 14 +- x/pot/types/errors.go | 87 +- x/pot/types/expected_keepers.go | 51 +- x/pot/types/genesis.go | 61 +- x/pot/types/genesis.pb.go | 625 +++++++ x/pot/types/msg.go | 152 +- x/pot/types/params.go | 26 +- x/pot/types/pot.pb.go | 2514 ++++++++++++++++++++++++++++ x/pot/types/querier.go | 8 +- x/pot/types/query.pb.go | 864 ++++++++++ x/pot/types/query.pb.gw.go | 184 ++ x/pot/types/tx.pb.go | 2263 +++++++++++++++++++++++++ x/pot/types/tx.pb.gw.go | 406 +++++ x/pot/types/types.go | 68 +- 29 files changed, 8344 insertions(+), 410 deletions(-) create mode 100644 proto/stratos/pot/v1/genesis.proto create mode 100644 proto/stratos/pot/v1/pot.proto create mode 100644 proto/stratos/pot/v1/query.proto create mode 100644 proto/stratos/pot/v1/tx.proto create mode 100644 x/pot/keeper/msg_server.go create mode 100644 x/pot/types/genesis.pb.go create mode 100644 x/pot/types/pot.pb.go create mode 100644 x/pot/types/query.pb.go create mode 100644 x/pot/types/query.pb.gw.go create mode 100644 x/pot/types/tx.pb.go create mode 100644 x/pot/types/tx.pb.gw.go diff --git a/proto/stratos/pot/v1/genesis.proto b/proto/stratos/pot/v1/genesis.proto new file mode 100644 index 00000000..b9f00b35 --- /dev/null +++ b/proto/stratos/pot/v1/genesis.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package stratos.pot.v1; + + + +import "gogoproto/gogo.proto"; +//import "google/protobuf/any.proto"; + +//import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +import "stratos/pot/v1/pot.proto"; +//import "stratos/register/v1/register.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; + +// GenesisState defines the register module's genesis state. +message GenesisState { + pot.v1.Params params = 1 [ (gogoproto.moretags) = "yaml:\"params\"" ]; + cosmos.base.v1beta1.Coin totalMinedToken = 2 [ (gogoproto.moretags) = "yaml:\"total_mined_token\"" ]; + int64 lastReportedEpoch = 3 [ (gogoproto.moretags) = "yaml:\"last_reported_epoch\"" ]; + repeated pot.v1.ImmatureTotal immatureTotalInfo = 4 [ (gogoproto.moretags) = "yaml:\"immature_total_info\""]; + repeated pot.v1.MatureTotal matureTotalInfo = 5 [ (gogoproto.moretags) = "yaml:\"mature_total_info\""]; + repeated pot.v1.Reward IndividualRewardInfo = 6 [ (gogoproto.moretags) = "yaml:\"individual_reward_info\""]; +} + +//message GenesisIndexingNode { +// string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the indexing node +// google.protobuf.Any pubKey = 2 [ +// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", +// (gogoproto.moretags) = "yaml:\"pubkey\"" +// ]; // the consensus public key of the indexing node; bech encoded in JSON +// bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; // has the indexing node been suspended from bonded status? +// cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\""]; // indexing node status (Unspecified/Bonded/Unbonding/Unbonded) +// string token = 5 [ +// (gogoproto.nullable) = false, +// (gogoproto.moretags) = "yaml:\"token\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" +// ]; // delegated tokens +// string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the indexing node +// register.v1.Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; // description terms for the indexing node +//} diff --git a/proto/stratos/pot/v1/pot.proto b/proto/stratos/pot/v1/pot.proto new file mode 100644 index 00000000..786f0d8d --- /dev/null +++ b/proto/stratos/pot/v1/pot.proto @@ -0,0 +1,421 @@ +syntax = "proto3"; +package stratos.pot.v1; + +import "gogoproto/gogo.proto"; +//import "google/protobuf/any.proto"; +//import "google/protobuf/timestamp.proto"; + +//import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +//import "cosmos/staking/v1beta1/staking.proto"; + + +option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; + +// Params defines the PoT module parameters +message Params { + string bond_denom = 1 [ + (gogoproto.jsontag) = "bond_denom", + (gogoproto.moretags) = "yaml:\"bond_denom\"" + ]; + string reward_denom = 2 [ + (gogoproto.jsontag) = "reward_denom", + (gogoproto.moretags) = "yaml:\"reward_denom\"" + ]; + int64 mature_epoch = 3 [ + (gogoproto.jsontag) = "mature_epoch", + (gogoproto.moretags) = "yaml:\"mature_epoch\"" + ]; + repeated MiningRewardParam mining_reward_params = 4 [ + (gogoproto.jsontag) = "mining_reward_params", + (gogoproto.moretags) = "yaml:\"mining_reward_params\"" + ]; +} + +message MiningRewardParam { + cosmos.base.v1beta1.Coin totalMinedValveStart = 1 [ (gogoproto.moretags) = "yaml:\"total_mined_valve_start\"" ]; + cosmos.base.v1beta1.Coin totalMinedValveEnd = 2 [ (gogoproto.moretags) = "yaml:\"total_mined_valve_end\"" ]; + cosmos.base.v1beta1.Coin miningReward = 3 [ (gogoproto.moretags) = "yaml:\"mining_reward\"" ]; + string blockChainPercentageInTenThousand = 4 [ + (gogoproto.jsontag) = "block_chain_percentage_in_ten_thousand", + (gogoproto.moretags) = "yaml:\"block_chain_percentage_in_ten_thousand\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string resourceNodePercentageInTenThousand = 5 [ + (gogoproto.jsontag) = "resource_node_percentage_in_ten_thousand", + (gogoproto.moretags) = "yaml:\"resource_node_percentage_in_ten_thousand\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string metaNodePercentageInTenThousand = 6 [ + (gogoproto.jsontag) = "meta_node_percentage_in_ten_thousand", + (gogoproto.moretags) = "yaml:\"meta_node_percentage_in_ten_thousand\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; +} + +message ImmatureTotal { + string walletAddress = 1 [ + (gogoproto.jsontag) = "wallet_address", + (gogoproto.moretags) = "yaml:\"wallet_address\"" + ]; + repeated cosmos.base.v1beta1.Coin value = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +message MatureTotal { + string walletAddress = 1 [ + (gogoproto.jsontag) = "wallet_address", + (gogoproto.moretags) = "yaml:\"wallet_address\"" + ]; + repeated cosmos.base.v1beta1.Coin value = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +message Reward { + string walletAddress = 1 [ + (gogoproto.jsontag) = "wallet_address", + (gogoproto.moretags) = "yaml:\"wallet_address\"" + ]; + repeated cosmos.base.v1beta1.Coin rewardFromMiningPool = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "reward_from_mining_pool", + (gogoproto.moretags) = "yaml:\"reward_from_mining_pool\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + repeated cosmos.base.v1beta1.Coin rewardFromTrafficPool = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "reward_from_traffic_pool", + (gogoproto.moretags) = "yaml:\"reward_from_traffic_pool\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +message SingleWalletVolume { + string walletAddress = 1 [ + (gogoproto.jsontag) = "wallet_address", + (gogoproto.moretags) = "yaml:\"wallet_address\"" + ]; + string volume = 2 [ + (gogoproto.jsontag) = "volume", + (gogoproto.moretags) = "yaml:\"volume\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; +} + +message VolumeReportRecord { + string reporter = 1 [ + (gogoproto.jsontag) = "reporter", + (gogoproto.moretags) = "yaml:\"reporter\"" + ]; + string reportReference = 2 [ + (gogoproto.jsontag) = "report_reference", + (gogoproto.moretags) = "yaml:\"report_reference\"" + ]; + string txHash = 3 [ + (gogoproto.jsontag) = "tx_hash", + (gogoproto.moretags) = "yaml:\"tx_hash\"" + ]; +} + +message BLSSignatureInfo { + repeated bytes pubKeys = 1 [ + (gogoproto.jsontag) = "pub_keys", + (gogoproto.moretags) = "yaml:\"pub_keys\"" + ]; + bytes signature = 2 [ + (gogoproto.jsontag) = "signature", + (gogoproto.moretags) = "yaml:\"signature\"" + ]; + bytes txData = 3 [ + (gogoproto.jsontag) = "tx_data", + (gogoproto.moretags) = "yaml:\"tx_data\"" + ]; +} + + + +// +//message ResourceNode { +// string networkAddr = 1 [ +// (gogoproto.jsontag) = "network_address", +// (gogoproto.moretags) = "yaml:\"network_address\"" +// ]; +// google.protobuf.Any pubKey = 2 [ +// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", +// (gogoproto.jsontag) = "pubkey", +// (gogoproto.moretags) = "yaml:\"pubkey\"" +// ]; +// bool suspend = 3 [ +// (gogoproto.jsontag) = "suspend", +// (gogoproto.moretags) = "yaml:\"suspend\"" +// ]; +// cosmos.staking.v1beta1.BondStatus status = 4 [ +// (gogoproto.jsontag) = "status", +// (gogoproto.moretags) = "yaml:\"status\"" ]; +// string tokens = 5 [ +// (gogoproto.nullable) = false, +// (gogoproto.jsontag) = "tokens", +// (gogoproto.moretags) = "yaml:\"tokens\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" +// ]; +// string ownerAddress = 6 [ +// (gogoproto.jsontag) = "owner_address", +// (gogoproto.moretags) = "yaml:\"owner_address\"" +// ]; +// Description description = 7 [ +// (gogoproto.jsontag) = "description", +// (gogoproto.moretags) = "yaml:\"description\"" +// ]; +// google.protobuf.Timestamp creation_time = 8 [ +// (gogoproto.nullable) = false, +// (gogoproto.stdtime) = true, +// (gogoproto.jsontag) = "creation_time", +// (gogoproto.moretags) = "yaml:\"creation_time\"" +// ]; +// string nodeType = 9 [ +// (gogoproto.jsontag) = "node_type", +// (gogoproto.moretags) = "yaml:\"node_type\"" +// ]; +// +//} +// +//message IndexingNode { +// string networkAddr = 1 [ +// (gogoproto.jsontag) = "network_address", +// (gogoproto.moretags) = "yaml:\"network_address\"" +// ]; +// google.protobuf.Any pubKey = 2 [ +// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", +// (gogoproto.jsontag) = "pubkey", +// (gogoproto.moretags) = "yaml:\"pubkey\"" +// ]; +// bool suspend = 3 [ +// (gogoproto.jsontag) = "suspend", +// (gogoproto.moretags) = "yaml:\"suspend\"" +// ]; +// cosmos.staking.v1beta1.BondStatus status = 4 [ +// (gogoproto.jsontag) = "status", +// (gogoproto.moretags) = "yaml:\"status\"" ]; +// string tokens = 5 [ +// (gogoproto.nullable) = false, +// (gogoproto.jsontag) = "tokens", +// (gogoproto.moretags) = "yaml:\"tokens\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" +// ]; +// string ownerAddress = 6 [ +// (gogoproto.jsontag) = "owner_address", +// (gogoproto.moretags) = "yaml:\"owner_address\"" +// ]; +// Description description = 7 [ +// (gogoproto.jsontag) = "description", +// (gogoproto.moretags) = "yaml:\"description\"" +// ]; +// google.protobuf.Timestamp creation_time = 8 [ +// (gogoproto.nullable) = false, +// (gogoproto.stdtime) = true, +// (gogoproto.jsontag) = "creation_time", +// (gogoproto.moretags) = "yaml:\"creation_time\"" +// ]; +//} +// +//message IndexingNodeRegistrationVotePool { +// string nodeAddress = 1 [ +// (gogoproto.jsontag) = "network_address", +// (gogoproto.moretags) = "yaml:\"network_address\"" +// ]; +// repeated string approveList = 2 [ +// (gogoproto.jsontag) = "approve_list", +// (gogoproto.moretags) = "yaml:\"approve_list\"" +// ]; +// repeated string rejectList = 3 [ +// (gogoproto.jsontag) = "reject_list", +// (gogoproto.moretags) = "yaml:\"reject_list\"" +// ]; +// google.protobuf.Timestamp expireTime = 4 [ +// (gogoproto.stdtime) = true, +// (gogoproto.jsontag) = "expire_time", +// (gogoproto.moretags) = "yaml:\"expire_time\"" +// ]; +//} +// +//message Description { +// string moniker = 1 [ +// (gogoproto.jsontag) = "moniker", +// (gogoproto.moretags) = "yaml:\"moniker\"" +// ]; +// string identity = 2 [ +// (gogoproto.jsontag) = "identity", +// (gogoproto.moretags) = "yaml:\"identity\",omitempty" +// ]; +// string Website = 3 [ +// (gogoproto.jsontag) = "website", +// (gogoproto.moretags) = "yaml:\"website\",omitempty" +// ]; +// string SecurityContact = 4 [ +// (gogoproto.jsontag) = "security_contact", +// (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; +// string Details = 5 [ +// (gogoproto.jsontag) = "details", +// (gogoproto.moretags) = "yaml:\"details\",omitempty" ]; +//} +// +//message Slashing { +// string WalletAddress = 1 [ +// (gogoproto.jsontag) = "wallet_address", +// (gogoproto.moretags) = "yaml:\"wallet_address\"" +// ]; +// int64 Value = 2 [ +// (gogoproto.jsontag) = "value", +// (gogoproto.moretags) = "yaml:\"value\"" +// ]; +//} +// +//message ResourceNodes { +// repeated ResourceNode resourceNodes = 1; +//} +// +//message IndexingNodes { +// repeated IndexingNode indexingNodes = 1; +//} +// +//message TotalStakesResponse { +// cosmos.base.v1beta1.Coin resource_nodes_total_stake = 1; +// cosmos.base.v1beta1.Coin indexing_nodes_total_stake = 2; +// cosmos.base.v1beta1.Coin total_bonded_stake = 3; +// cosmos.base.v1beta1.Coin total_unbonded_stake = 4; +// cosmos.base.v1beta1.Coin total_unbonding_stake = 5; +//} +// +//message StakingInfo { +// string networkAddr = 1 [ +// (gogoproto.jsontag) = "network_address", +// (gogoproto.moretags) = "yaml:\"network_address\"" +// ]; +// google.protobuf.Any pubKey = 2 [ +// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", +// (gogoproto.jsontag) = "pubkey", +// (gogoproto.moretags) = "yaml:\"pubkey\"" +// ]; +// bool suspend = 3 [ +// (gogoproto.jsontag) = "suspend", +// (gogoproto.moretags) = "yaml:\"suspend\"" +// ]; +// cosmos.staking.v1beta1.BondStatus status = 4 [ +// (gogoproto.jsontag) = "status", +// (gogoproto.moretags) = "yaml:\"status\"" ]; +// string tokens = 5 [ +// (gogoproto.jsontag) = "tokens", +// (gogoproto.moretags) = "yaml:\"tokens\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" +// ]; +// string ownerAddress = 6 [ +// (gogoproto.jsontag) = "owner_address", +// (gogoproto.moretags) = "yaml:\"owner_address\"" +// ]; +// Description description = 7 [ +// (gogoproto.jsontag) = "description", +// (gogoproto.moretags) = "yaml:\"description\"" +// ]; +// google.protobuf.Timestamp creation_time = 8 [ +// (gogoproto.nullable) = false, +// (gogoproto.stdtime) = true, +// (gogoproto.jsontag) = "creation_time", +// (gogoproto.moretags) = "yaml:\"creation_time\"" +// ]; +// string nodeType = 9 [ +// (gogoproto.jsontag) = "node_type", +// (gogoproto.moretags) = "yaml:\"node_type\"" +// ]; +// cosmos.base.v1beta1.Coin bonded_stake = 10 [ +// (gogoproto.nullable) = true, +// (gogoproto.jsontag) = "bonded_stake", +// (gogoproto.moretags) = "yaml:\"bonded_stake\"" +// ]; +// cosmos.base.v1beta1.Coin un_bonding_stake = 11 [ +// (gogoproto.nullable) = true, +// (gogoproto.jsontag) = "un_bonding_stake", +// (gogoproto.moretags) = "yaml:\"un_bonding_stake\"" +// ]; +// cosmos.base.v1beta1.Coin un_bonded_stake = 12 [ +// (gogoproto.nullable) = true, +// (gogoproto.jsontag) = "un_bonded_stake", +// (gogoproto.moretags) = "yaml:\"un_bonded_stake\"" +// ]; +// +//} +// +//// UnbondingNode stores all of a single delegator's unbonding bonds +//// for a single unbonding node in a time-ordered list +//message UnbondingNode { +// string networkAddr = 1 [ +// (gogoproto.jsontag) = "network_addr", +// (gogoproto.moretags) = "yaml:\"network_addr\"" +// ]; +// bool is_indexing_node = 2 [ +// (gogoproto.jsontag) = "is_indexing_node", +// (gogoproto.moretags) = "yaml:\"is_indexing_node\"" +// ]; +// repeated UnbondingNodeEntry entries = 3 [ +// (gogoproto.jsontag) = "entries", +// (gogoproto.moretags) = "yaml:\"entries\"" +// ]; +// +//} +// +//message UnbondingNodeEntry { +// int64 creation_height = 1 [ +// (gogoproto.jsontag) = "creation_height", +// (gogoproto.moretags) = "yaml:\"creation_height\"" +// ]; +// google.protobuf.Timestamp completion_time = 2 [ +// (gogoproto.stdtime) = true, +// (gogoproto.jsontag) = "creation_time", +// (gogoproto.moretags) = "yaml:\"creation_time\"" +// ]; +// string initial_balance = 3 [ +// (gogoproto.jsontag) = "initial_balance", +// (gogoproto.moretags) = "yaml:\"initial_balance\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" +// ]; +// string balance = 4 [ +// (gogoproto.jsontag) = "balance", +// (gogoproto.moretags) = "yaml:\"balance\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" +// ]; +//} +// +//message Staking { +// option (gogoproto.equal) = false; +// option (gogoproto.goproto_getters) = false; +// option (gogoproto.goproto_stringer) = false; +// +// // network_address is the bech32-encoded address of the node. +// string network_address = 1 [ +// (gogoproto.jsontag) = "network_address", +// (gogoproto.moretags) = "yaml:\"network_address\"" +// ]; +// // owner_address is the bech32-encoded address of owner of the node. +// string owner_address = 2 [ +// (gogoproto.jsontag) = "owner_address", +// (gogoproto.moretags) = "yaml:\"owner_address\"" +// ]; +// // shares define the delegation shares received. +// string value = 3 [ +// (gogoproto.jsontag) = "value", +// (gogoproto.moretags) = "yaml:\"value\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", +// (gogoproto.nullable) = false +// ]; +//} + +//message QueryNodeStakingParams { +// string acc_addr = 1; +// int64 query_type = 2; +//} +// +//// QueryNodesParams Params for query 'custom/register/resource-nodes' +//message QueryNodesParams { +// string network_addr = 1; +// string moniker = 2; +// string owner_addr = 3; +//} + + diff --git a/proto/stratos/pot/v1/query.proto b/proto/stratos/pot/v1/query.proto new file mode 100644 index 00000000..f5a0d3ef --- /dev/null +++ b/proto/stratos/pot/v1/query.proto @@ -0,0 +1,141 @@ +syntax = "proto3"; +package stratos.pot.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +//import "cosmos/base/query/v1beta1/pagination.proto"; + +//import "stratos/pot/v1/pot.proto"; + +option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; + +// Query defines the gRPC querier service. +service Query { + // VolumeReport queries VolumeReport info for given epoch. + rpc VolumeReport(QueryVolumeReportRequest) returns (QueryVolumeReportResponse) { + option (google.api.http).get = "/stratos/pot/v1/volume-report/{epoch}"; + } +// +// // IndexingNode queries IndexingNode info for given IndexingNode address. +// rpc IndexingNode(QueryIndexingNodeRequest) returns (QueryIndexingNodeResponse) { +// option (google.api.http).get = "/stratos/pot/v1/indexing-nodes/{network_addr}"; +// } +// +// // Params queries Register module Params info. +// rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { +// option (google.api.http).get = "/stratos/pot/v1/params"; +// } +// +// // StakeByNode queries all staking info for given node network address. +// rpc StakeByNode(QueryStakeByNodeRequest) returns (QueryStakeByNodeResponse) { +// option (google.api.http).get = "/stratos/pot/v1/stakes_node/{acc_addr}/{query_type}"; +// } +// +// // StakeByOwner queries all staking info for given owner address. +// rpc StakeByOwner(QueryStakeByOwnerRequest) returns (QueryStakeByOwnerResponse) { +// option (google.api.http).get = "/stratos/pot/v1/stakes_owner/{owner_addr}"; +// } +// +// // StakeTotal queries all staking info. +// rpc StakeTotal(QueryTotalStakeRequest) returns (QueryTotalStakeResponse) { +// option (google.api.http).get = "/stratos/pot/v1/total_stakes"; +// } +} + +// QueryVolumeReportRequest is request type for the Query/VolumeReport RPC method +message QueryVolumeReportRequest { + // epoch defines the epoch number to query for. + string epoch = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; +} + +message ReportInfo { + string epoch = 1; +// [ +// (gogoproto.jsontag) = "epoch", +// (gogoproto.moretags) = "yaml:\"epoch\"", +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" +// ]; + string reference = 2; +// [ +// (gogoproto.jsontag) = "reference", +// (gogoproto.moretags) = "yaml:\"reference\"" +// ]; +} + +// QueryVolumeReportResponse is response type for the Query/ResourceNode RPC method +message QueryVolumeReportResponse { + // node defines the the volumeReport info. + ReportInfo reportInfo = 1; + int64 height = 2; +} + + + +//// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method +//message QueryIndexingNodeRequest { +// // network_addr defines the node network address to query for. +// string network_addr = 1; +//} +// +//// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method +//message QueryIndexingNodeResponse { +// // node defines the the indexing info. +// IndexingNode node = 1; +//} +// +//// QueryStakeByNodeRequest is request type for the Query/StakeByNode RPC method +//message QueryStakeByNodeRequest { +// // acc_addr defines the node network address to query for. +// string acc_addr = 1; +// int64 query_type = 2; +// // pagination defines an optional pagination for the request. +//// cosmos.base.query.v1beta1.PageRequest pagination = 3; +//} +// +//// QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method +//message QueryStakeByNodeResponse { +// // staking_info defines the the staking_info info of the node. +// StakingInfo staking_info = 1; +// // pagination defines an optional pagination for the request. +//// cosmos.base.query.v1beta1.PageResponse pagination = 2; +//} +// +//// QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method +//message QueryStakeByOwnerRequest { +// // owner_addr defines the owner address to query for. +// string network_addr = 1; +// string moniker = 2; +// string owner_addr = 3; +// // pagination defines an optional pagination for the request. +// cosmos.base.query.v1beta1.PageRequest pagination = 4; +//} +// +//// QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method +//message QueryStakeByOwnerResponse { +// // staking_infos defines the the node staking info of this owner. +// repeated StakingInfo staking_infos = 1; +// // pagination defines an optional pagination for the request. +// cosmos.base.query.v1beta1.PageResponse pagination = 2; +//} +// +//// QueryTotalStakeRequest is request type for the Query/TotalStake RPC method +//message QueryTotalStakeRequest {} +// +//// QueryTotalStakeResponse is response type for the Query/TotalStake RPC method +//message QueryTotalStakeResponse { +// // total_stakes defines the total staking info. +// TotalStakesResponse total_stakes= 1; +//} +// +//// QueryParamsRequest is request type for the Query/Params RPC method. +//message QueryParamsRequest {} +// +//// QueryParamsResponse is response type for the Query/Params RPC method. +//message QueryParamsResponse { +// // params holds all the parameters of this module. +// Params params = 1; +//} + + + + diff --git a/proto/stratos/pot/v1/tx.proto b/proto/stratos/pot/v1/tx.proto new file mode 100644 index 00000000..05cbbf59 --- /dev/null +++ b/proto/stratos/pot/v1/tx.proto @@ -0,0 +1,128 @@ +syntax = "proto3"; +package stratos.pot.v1; + +import "gogoproto/gogo.proto"; +//import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; + +//import "cosmos_proto/cosmos.proto"; +import "stratos/pot/v1/pot.proto"; +import "cosmos/base/v1beta1/coin.proto"; + + +option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; + +// Msg defines the evm Msg service. +service Msg { + rpc HandleMsgVolumeReport(MsgVolumeReport) returns (MsgVolumeReportResponse) { + option (google.api.http).post = "/stratos/pot/v1/volume_report"; + }; + rpc HandleMsgWithdraw(MsgWithdraw) returns (MsgWithdrawResponse) { + option (google.api.http).post = "/stratos/pot/v1/withdraw"; + }; + rpc HandleMsgFoundationDeposit(MsgFoundationDeposit) returns (MsgFoundationDepositResponse) { + option (google.api.http).post = "/stratos/pot/v1/foundation_deposit"; + }; + rpc HandleMsgSlashingResourceNode(MsgSlashingResourceNode) returns (MsgSlashingResourceNodeResponse) { + option (google.api.http).post = "/stratos/pot/v1/slashing_resource_node"; + }; +} + +// MsgVolumeReport encapsulates an VolumeReport transaction as an SDK message. +message MsgVolumeReport { + repeated SingleWalletVolume walletVolumes = 1 [ + (gogoproto.jsontag) = "wallet_volumes", + (gogoproto.moretags) = "yaml:\"wallet_volumes\"" + ]; + string reporter = 2 [ + (gogoproto.jsontag) = "reporter", + (gogoproto.moretags) = "yaml:\"reporter\"" + ]; + string epoch = 3 [ + (gogoproto.jsontag) = "epoch", + (gogoproto.moretags) = "yaml:\"epoch\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + string reportReference = 4 [ + (gogoproto.jsontag) = "report_reference", + (gogoproto.moretags) = "yaml:\"report_reference\"" + ]; + string reporterOwner = 5 [ + (gogoproto.jsontag) = "reporter_owner", + (gogoproto.moretags) = "yaml:\"reporter_owner\"" + ]; + BLSSignatureInfo bLSSignature = 6 [ + (gogoproto.jsontag) = "bls_signature", + (gogoproto.moretags) = "yaml:\"bls_signature\"" + ]; +} +// MsgVolumeReportResponse defines the MsgVolumeReport response type +message MsgVolumeReportResponse {} + +// MsgWithdraw encapsulates an withdraw transaction as an SDK message. +message MsgWithdraw { + repeated cosmos.base.v1beta1.Coin Amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "amount", + (gogoproto.moretags) = "yaml:\"amount\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + string walletAddress = 2 [ + (gogoproto.jsontag) = "wallet_address", + (gogoproto.moretags) = "yaml:\"wallet_address\"" + ]; + string targetAddress = 3 [ + (gogoproto.jsontag) = "target_address", + (gogoproto.moretags) = "yaml:\"target_address\"" + ]; +} +// MsgWithdrawResponse defines the Msg/MsgWithdraw response type. +message MsgWithdrawResponse {} + +// MsgFoundationDeposit - encapsulates an FoundationDeposit transaction as an SDK message +message MsgFoundationDeposit { + repeated cosmos.base.v1beta1.Coin Amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "amount", + (gogoproto.moretags) = "yaml:\"amount\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + string from = 2 [ + (gogoproto.jsontag) = "from", + (gogoproto.moretags) = "yaml:\"from\"" + ]; +} +// MsgFoundationDepositResponse defines the MsgFoundationDeposit response type +message MsgFoundationDepositResponse {} + + +// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message +message MsgSlashingResourceNode { + repeated string reporters = 1 [ + (gogoproto.jsontag) = "reporters", + (gogoproto.moretags) = "yaml:\"reporters\"" + ]; + repeated string reporterOwner = 2 [ + (gogoproto.jsontag) = "reporter_owner", + (gogoproto.moretags) = "yaml:\"reporter_owner\"" + ]; + string networkAddress = 3 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; + string walletAddress = 4 [ + (gogoproto.jsontag) = "wallet_address", + (gogoproto.moretags) = "yaml:\"wallet_address\"" + ]; + string slashing = 5 [ + (gogoproto.jsontag) = "slashing", + (gogoproto.moretags) = "yaml:\"slashing\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + ]; + bool suspend = 6 [ + (gogoproto.jsontag) = "suspend", + (gogoproto.moretags) = "yaml:\"suspend\"" + ]; +} +// MsgSlashingResourceNodeResponse defines the Msg/MsgSlashingResourceNode response type. +message MsgSlashingResourceNodeResponse {} \ No newline at end of file diff --git a/x/pot/client/cli/query.go b/x/pot/client/cli/query.go index 7397f746..2034b27e 100644 --- a/x/pot/client/cli/query.go +++ b/x/pot/client/cli/query.go @@ -1,19 +1,15 @@ package cli import ( - "bufio" "fmt" "strconv" "strings" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/stratosnet/stratos-chain/x/pot/keeper" "github.com/stratosnet/stratos-chain/x/pot/types" ) @@ -29,16 +25,14 @@ func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { } potQueryCmd.AddCommand( - flags.GetCommands( - GetCmdQueryVolumeReport(queryRoute, cdc), - )..., + GetCmdQueryVolumeReport(), ) return potQueryCmd } // GetCmdQueryVolumeReport implements the query volume report command. -func GetCmdQueryVolumeReport(queryRoute string, cdc *codec.Codec) *cobra.Command { +func GetCmdQueryVolumeReport() *cobra.Command { cmd := &cobra.Command{ Use: "report [flags]", // reporter: []byte Short: "Query volume report hash by epoch", @@ -48,19 +42,26 @@ func GetCmdQueryVolumeReport(queryRoute string, cdc *codec.Codec) *cobra.Command ), RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + epochStr := viper.GetString(FlagEpoch) epoch, err := checkFlagEpoch(epochStr) if err != nil { return err } - resp, _, err := QueryVolumeReport(cliCtx, queryRoute, epoch) + + result, err := queryClient.VolumeReport(cmd.Context(), &types.QueryVolumeReportRequest{ + Epoch: &epoch, + }) if err != nil { return err } - return cliCtx.PrintOutput(resp) + return clientCtx.PrintProto(result) }, } cmd.Flags().AddFlagSet(FsEpoch) @@ -69,15 +70,15 @@ func GetCmdQueryVolumeReport(queryRoute string, cdc *codec.Codec) *cobra.Command return cmd } -func QueryVolumeReport(cliCtx context.CLIContext, queryRoute string, epoch sdk.Int) (types.ReportInfo, int64, error) { - route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryVolumeReport) - resp, height, err := cliCtx.QueryWithData(route, []byte(epoch.String())) - if err != nil { - return types.ReportInfo{}, height, err - } - reportRes := types.NewReportInfo(epoch, string(resp)) - return reportRes, height, nil -} +//func QueryVolumeReport(cliCtx context.CLIContext, queryRoute string, epoch sdk.Int) (types.ReportInfo, int64, error) { +// route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryVolumeReport) +// resp, height, err := cliCtx.QueryWithData(route, []byte(epoch.String())) +// if err != nil { +// return types.ReportInfo{}, height, err +// } +// reportRes := types.NewReportInfo(epoch, string(resp)) +// return reportRes, height, nil +//} func checkFlagEpoch(epochStr string) (sdk.Int, error) { epochInt64, err := strconv.ParseInt(epochStr, 10, 64) diff --git a/x/pot/client/cli/tx.go b/x/pot/client/cli/tx.go index 6d78a4bb..af86830b 100644 --- a/x/pot/client/cli/tx.go +++ b/x/pot/client/cli/tx.go @@ -1,21 +1,19 @@ package cli import ( - "bufio" + "encoding/json" "fmt" "strconv" - "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/spf13/viper" stratos "github.com/stratosnet/stratos-chain/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/pot/types" ) @@ -34,30 +32,34 @@ func GetTxCmd(cdc *codec.Codec) *cobra.Command { RunE: client.ValidateCmd, } - potTxCmd.AddCommand(flags.PostCommands( - VolumeReportCmd(cdc), - WithdrawCmd(cdc), - FoundationDepositCmd(cdc), - SlashingResourceNodeCmd(cdc), - )...) + potTxCmd.AddCommand( + VolumeReportCmd(), + WithdrawCmd(), + FoundationDepositCmd(), + SlashingResourceNodeCmd(), + ) return potTxCmd } -func WithdrawCmd(cdc *codec.Codec) *cobra.Command { +func WithdrawCmd() *cobra.Command { cmd := &cobra.Command{ Use: "withdraw", Short: "withdraw POT reward", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } - txBldr, msg, err := buildWithdrawMsg(cliCtx, txBldr) + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + txf, msg, err := buildWithdrawMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } @@ -71,21 +73,21 @@ func WithdrawCmd(cdc *codec.Codec) *cobra.Command { } // makes a new WithdrawMsg. -func buildWithdrawMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - amountStr := viper.GetString(FlagAmount) - amount, err := sdk.ParseCoins(amountStr) +func buildWithdrawMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgWithdraw, error) { + amountStr, _ := fs.GetString(FlagAmount) + amount, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } - walletAddress := cliCtx.GetFromAddress() + walletAddress := clientCtx.GetFromAddress() var targetAddress sdk.AccAddress if viper.IsSet(FlagTargetAddress) { targetAddressStr := viper.GetString(FlagTargetAddress) targetAddress, err = sdk.AccAddressFromBech32(targetAddressStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } } else { targetAddress = walletAddress @@ -93,23 +95,38 @@ func buildWithdrawMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.Tx msg := types.NewMsgWithdraw(amount, walletAddress, targetAddress) - return txBldr, msg, nil + return txf, msg, nil } // VolumeReportCmd will report wallets volume and sign it with the given key. -func VolumeReportCmd(cdc *codec.Codec) *cobra.Command { +func VolumeReportCmd() *cobra.Command { cmd := &cobra.Command{ Use: "report [flags]", Short: "Create and sign a volume report", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) - txBldr, msg, err := createVolumeReportMsg(cliCtx, txBldr) + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + txf, msg, err := createVolumeReportMsg(clientCtx, txf, cmd.Flags()) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + + //inBuf := bufio.NewReader(cmd.InOrStdin()) + //txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) + //cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + //txBldr, msg, err := createVolumeReportMsg(cliCtx, txBldr) + //if err != nil { + // return err + //} + //return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) }, } cmd.Flags().AddFlagSet(FsReporterAddr) @@ -126,40 +143,40 @@ func VolumeReportCmd(cdc *codec.Codec) *cobra.Command { return cmd } -func createVolumeReportMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - reporterStr := viper.GetString(FlagReporterAddr) +func createVolumeReportMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgVolumeReport, error) { + reporterStr, _ := fs.GetString(FlagReporterAddr) reporter, err := stratos.SdsAddressFromBech32(reporterStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } reportReference := viper.GetString(FlagReportReference) value, err := strconv.ParseInt(viper.GetString(FlagEpoch), 10, 64) if err != nil { - return txBldr, nil, err + return txf, nil, err } epoch := sdk.NewInt(value) var walletVolumesStr = make([]singleWalletVolumeStr, 0) - err = cliCtx.Codec.UnmarshalJSON([]byte(viper.GetString(FlagWalletVolumes)), &walletVolumesStr) + err = json.Unmarshal([]byte(viper.GetString(FlagWalletVolumes)), &walletVolumesStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } - var walletVolumes = make([]types.SingleWalletVolume, 0) + var walletVolumes = make([]*types.SingleWalletVolume, 0) for _, n := range walletVolumesStr { walletAcc, err := sdk.AccAddressFromBech32(n.WalletAddress) if err != nil { - return txBldr, nil, err + return txf, nil, err } volumeInt64, err := strconv.ParseInt(n.Volume, 10, 64) if err != nil { - return txBldr, nil, err + return txf, nil, err } volume := sdk.NewInt(volumeInt64) walletVolumes = append(walletVolumes, types.NewSingleWalletVolume(walletAcc, volume)) } - reporterOwner := cliCtx.GetFromAddress() + reporterOwner := clientCtx.GetFromAddress() msg := types.NewMsgVolumeReport( walletVolumes, @@ -169,24 +186,28 @@ func createVolumeReportMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (au reporterOwner, types.BLSSignatureInfo{}, ) - return txBldr, msg, nil + return txf, msg, nil } -func FoundationDepositCmd(cdc *codec.Codec) *cobra.Command { +func FoundationDepositCmd() *cobra.Command { cmd := &cobra.Command{ Use: "foundation-deposit", Short: "Deposit to foundation account", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - txBldr, msg, err := buildFoundationDepositMsg(cliCtx, txBldr) + txf, msg, err := buildFoundationDepositMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } cmd.Flags().AddFlagSet(FsAmount) @@ -197,32 +218,36 @@ func FoundationDepositCmd(cdc *codec.Codec) *cobra.Command { return cmd } -func buildFoundationDepositMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { - amountStr := viper.GetString(FlagAmount) - amount, err := sdk.ParseCoins(amountStr) +func buildFoundationDepositMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgFoundationDeposit, error) { + amountStr, _ := fs.GetString(FlagAmount) + amount, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } - from := cliCtx.GetFromAddress() + from := clientCtx.GetFromAddress() msg := types.NewMsgFoundationDeposit(amount, from) - return txBldr, msg, nil + return txf, msg, nil } -func SlashingResourceNodeCmd(cdc *codec.Codec) *cobra.Command { +func SlashingResourceNodeCmd() *cobra.Command { cmd := &cobra.Command{ Use: "slashing", Short: "slashing resource node", RunE: func(cmd *cobra.Command, args []string) error { - inBuf := bufio.NewReader(cmd.InOrStdin()) - txBldr := auth.NewTxBuilderFromCLI(inBuf).WithTxEncoder(utils.GetTxEncoder(cdc)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - txBldr, msg, err := buildSlashingResourceNodeMsg(cliCtx, txBldr) + txf, msg, err := buildSlashingResourceNodeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } cmd.Flags().AddFlagSet(FsReporters) @@ -243,31 +268,31 @@ func SlashingResourceNodeCmd(cdc *codec.Codec) *cobra.Command { return cmd } -func buildSlashingResourceNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuilder) (auth.TxBuilder, sdk.Msg, error) { +func buildSlashingResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgSlashingResourceNode, error) { var reportersStr = make([]string, 0) - err := cliCtx.Codec.UnmarshalJSON([]byte(viper.GetString(FlagReporters)), &reportersStr) + err := json.Unmarshal([]byte(viper.GetString(FlagReporters)), &reportersStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } var reporters = make([]stratos.SdsAddress, 0) for _, val := range reportersStr { reporterAddr, err := stratos.SdsAddressFromBech32(val) if err != nil { - return txBldr, nil, err + return txf, nil, err } reporters = append(reporters, reporterAddr) } var reporterOwnerStr = make([]string, 0) - err = cliCtx.Codec.UnmarshalJSON([]byte(viper.GetString(FlagReporterOwner)), &reporterOwnerStr) + err = json.Unmarshal([]byte(viper.GetString(FlagReporterOwner)), &reporterOwnerStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } var reporterOwner = make([]sdk.AccAddress, 0) for _, val := range reporterOwnerStr { reporterOwnerAddr, err := sdk.AccAddressFromBech32(val) if err != nil { - return txBldr, nil, err + return txf, nil, err } reporterOwner = append(reporterOwner, reporterOwnerAddr) } @@ -275,27 +300,27 @@ func buildSlashingResourceNodeMsg(cliCtx context.CLIContext, txBldr auth.TxBuild networkAddressStr := viper.GetString(FlagNetworkAddress) networkAddress, err := stratos.SdsAddressFromBech32(networkAddressStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } walletAddressStr := viper.GetString(FlagWalletAddress) walletAddress, err := sdk.AccAddressFromBech32(walletAddressStr) if err != nil { - return txBldr, nil, err + return txf, nil, err } slashingVal, err := strconv.ParseInt(viper.GetString(FlagSlashing), 10, 64) if err != nil { - return txBldr, nil, err + return txf, nil, err } slashing := sdk.NewInt(slashingVal) suspendVal := viper.GetString(FlagSuspend) suspend, err := strconv.ParseBool(suspendVal) if err != nil { - return txBldr, nil, err + return txf, nil, err } msg := types.NewMsgSlashingResourceNode(reporters, reporterOwner, networkAddress, walletAddress, slashing, suspend) - return txBldr, msg, nil + return txf, msg, nil } diff --git a/x/pot/client/rest/query.go b/x/pot/client/rest/query.go index caf0ea0b..37fbe4cd 100644 --- a/x/pot/client/rest/query.go +++ b/x/pot/client/rest/query.go @@ -5,7 +5,7 @@ import ( "net/http" "strconv" - "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" @@ -13,14 +13,14 @@ import ( "github.com/stratosnet/stratos-chain/x/pot/types" ) -func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router) { - r.HandleFunc("/pot/report/epoch/{epoch}", getVolumeReportHandlerFn(cliCtx, keeper.QueryVolumeReport)).Methods("GET") - r.HandleFunc("/pot/rewards/epoch/{epoch}", getPotRewardsByEpochHandlerFn(cliCtx, keeper.QueryPotRewardsByReportEpoch)).Methods("GET") - r.HandleFunc("/pot/rewards/wallet/{walletAddress}", getPotRewardsByWalletAddrHandlerFn(cliCtx, keeper.QueryPotRewardsByWalletAddr)).Methods("GET") - r.HandleFunc("/pot/slashing/{walletAddress}", getPotSlashingByWalletAddressHandlerFn(cliCtx, keeper.QueryPotSlashingByWalletAddr)).Methods("GET") +func registerQueryRoutes(clientCtx client.Context, r *mux.Router) { + r.HandleFunc("/pot/report/epoch/{epoch}", getVolumeReportHandlerFn(clientCtx, keeper.QueryVolumeReport)).Methods("GET") + r.HandleFunc("/pot/rewards/epoch/{epoch}", getPotRewardsByEpochHandlerFn(clientCtx, keeper.QueryPotRewardsByReportEpoch)).Methods("GET") + r.HandleFunc("/pot/rewards/wallet/{walletAddress}", getPotRewardsByWalletAddrHandlerFn(clientCtx, keeper.QueryPotRewardsByWalletAddr)).Methods("GET") + r.HandleFunc("/pot/slashing/{walletAddress}", getPotSlashingByWalletAddressHandlerFn(clientCtx, keeper.QueryPotSlashingByWalletAddr)).Methods("GET") } -func getPotRewardsByEpochHandlerFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func getPotRewardsByEpochHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // get and verify params _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) @@ -28,7 +28,7 @@ func getPotRewardsByEpochHandlerFn(cliCtx context.CLIContext, queryPath string) rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } @@ -49,7 +49,7 @@ func getPotRewardsByEpochHandlerFn(cliCtx context.CLIContext, queryPath string) } params := types.NewQueryPotRewardsByEpochParams(page, limit, epoch, walletAddress) - bz, err := cliCtx.Codec.MarshalJSON(params) + bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { rest.PostProcessResponse(w, cliCtx, err.Error()) return @@ -68,9 +68,9 @@ func getPotRewardsByEpochHandlerFn(cliCtx context.CLIContext, queryPath string) } // GET request handler to query Volume report info -func getVolumeReportHandlerFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func getVolumeReportHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } @@ -99,7 +99,7 @@ func getVolumeReportHandlerFn(cliCtx context.CLIContext, queryPath string) http. } // GET request handler to query potRewards info by walletAddr -func getPotRewardsByWalletAddrHandlerFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func getPotRewardsByWalletAddrHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) if err != nil { @@ -107,7 +107,7 @@ func getPotRewardsByWalletAddrHandlerFn(cliCtx context.CLIContext, queryPath str return } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } @@ -132,7 +132,7 @@ func getPotRewardsByWalletAddrHandlerFn(cliCtx context.CLIContext, queryPath str params := types.NewQueryPotRewardsByWalletAddrParams(page, limit, walletAddr, queryHeight) - bz, err := cliCtx.Codec.MarshalJSON(params) + bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -150,9 +150,9 @@ func getPotRewardsByWalletAddrHandlerFn(cliCtx context.CLIContext, queryPath str } } -func getPotSlashingByWalletAddressHandlerFn(cliCtx context.CLIContext, queryPath string) http.HandlerFunc { +func getPotSlashingByWalletAddressHandlerFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) if !ok { return } diff --git a/x/pot/client/rest/rest.go b/x/pot/client/rest/rest.go index 62886a3a..7cde5a8f 100644 --- a/x/pot/client/rest/rest.go +++ b/x/pot/client/rest/rest.go @@ -1,7 +1,8 @@ package rest import ( - "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/rest" "github.com/gorilla/mux" ) @@ -11,7 +12,8 @@ const ( ) // RegisterRoutes registers pot-related REST handlers to a router -func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) { - registerTxRoutes(cliCtx, r) - registerQueryRoutes(cliCtx, r) +func RegisterRoutes(clientCtx client.Context, rtr *mux.Router) { + r := rest.WithHTTPDeprecationHeaders(rtr) + registerTxRoutes(clientCtx, r) + registerQueryRoutes(clientCtx, r) } diff --git a/x/pot/client/rest/tx.go b/x/pot/client/rest/tx.go index 44c13a5b..e54ea9bd 100644 --- a/x/pot/client/rest/tx.go +++ b/x/pot/client/rest/tx.go @@ -4,17 +4,18 @@ import ( "fmt" "net/http" - "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + //"github.com/cosmos/cosmos-sdk/x/auth/client/utils" "github.com/gorilla/mux" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/pot/types" ) //registerTxRoutes registers pot-related REST Tx handlers to a router -func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router) { +func registerTxRoutes(cliCtx client.Context, r *mux.Router) { r.HandleFunc("/pot/volume_report", volumeReportRequestHandlerFn(cliCtx)).Methods("POST") r.HandleFunc("/pot/withdraw", withdrawPotRewardsHandlerFn(cliCtx)).Methods("POST") r.HandleFunc("/pot/foundation_deposit", foundationDepositHandlerFn(cliCtx)).Methods("POST") @@ -53,10 +54,10 @@ type ( ) // volumeReportRequestHandlerFn rest API handler to create a volume report tx. -func volumeReportRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func volumeReportRequestHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req volumeReportReq - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse request") return } @@ -76,9 +77,20 @@ func volumeReportRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { reportReference := req.ReportReference epoch := sdk.NewInt(req.Epoch) - var walletVolumes []types.SingleWalletVolume + var walletVolumes []*types.SingleWalletVolume for _, v := range req.WalletVolumes { - singleWalletVolume := types.NewSingleWalletVolume(v.WalletAddress, v.Volume) + walletAddr, err := sdk.AccAddressFromBech32(v.WalletAddress) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + volumeStr := v.Volume.String() + volume, ok := sdk.NewIntFromString(volumeStr) + if !ok { + rest.WriteErrorResponse(w, http.StatusBadRequest, "invalid volume") + return + } + singleWalletVolume := types.NewSingleWalletVolume(walletAddr, volume) walletVolumes = append(walletVolumes, singleWalletVolume) } @@ -94,16 +106,17 @@ func volumeReportRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) + //utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) } } // rest API handler Withdraw pot rewards -func withdrawPotRewardsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func withdrawPotRewardsHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req withdrawRewardsReq - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse request") return } @@ -140,16 +153,16 @@ func withdrawPotRewardsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) + //utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) } } -func foundationDepositHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func foundationDepositHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req foundationDepositReq - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse request") return } @@ -178,7 +191,8 @@ func foundationDepositHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return } - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) + //utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) } } @@ -193,7 +207,7 @@ func checkAccountAddressVar(w http.ResponseWriter, r *http.Request, accountAddrS } func checkAmountVar(w http.ResponseWriter, r *http.Request, amountStr string) (sdk.Coins, bool) { - amount, err := sdk.ParseCoins(amountStr) + amount, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, "invalid withdraw amount") return sdk.Coins{}, false @@ -201,11 +215,11 @@ func checkAmountVar(w http.ResponseWriter, r *http.Request, amountStr string) (s return amount, true } -func slashingResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { +func slashingResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req slashingResourceNodeReq - if !rest.ReadRESTReq(w, r, cliCtx.Codec, &req) { + if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse request") return } @@ -222,7 +236,7 @@ func slashingResourceNodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - - utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) + tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) + //utils.WriteGenerateStdTxResponse(w, cliCtx, req.BaseReq, []sdk.Msg{msg}) } } diff --git a/x/pot/handler.go b/x/pot/handler.go index 5f2d8d0c..8844f9d4 100644 --- a/x/pot/handler.go +++ b/x/pot/handler.go @@ -1,7 +1,6 @@ package pot import ( - "encoding/hex" "fmt" "strconv" @@ -9,22 +8,31 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stratosnet/stratos-chain/x/pot/keeper" "github.com/stratosnet/stratos-chain/x/pot/types" - "github.com/tendermint/tendermint/crypto/tmhash" ) // NewHandler ... func NewHandler(k keeper.Keeper) sdk.Handler { + msgServer := keeper.NewMsgServerImpl(k) + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { ctx = ctx.WithEventManager(sdk.NewEventManager()) switch msg := msg.(type) { - case types.MsgVolumeReport: - return handleMsgVolumeReport(ctx, k, msg) - case types.MsgWithdraw: - return handleMsgWithdraw(ctx, k, msg) - case types.MsgFoundationDeposit: - return handleMsgFoundationDeposit(ctx, k, msg) - case types.MsgSlashingResourceNode: - return handleMsgSlashingResourceNode(ctx, k, msg) + case *types.MsgVolumeReport: + res, err := msgServer.HandleMsgVolumeReport(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + //return handleMsgVolumeReport(ctx, k, msg) + case *types.MsgWithdraw: + res, err := msgServer.HandleMsgWithdraw(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + //return handleMsgWithdraw(ctx, k, msg) + case *types.MsgFoundationDeposit: + res, err := msgServer.HandleMsgFoundationDeposit(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + //return handleMsgFoundationDeposit(ctx, k, msg) + case *types.MsgSlashingResourceNode: + res, err := msgServer.HandleMsgSlashingResourceNode(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + //return handleMsgSlashingResourceNode(ctx, k, msg) default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) @@ -32,47 +40,47 @@ func NewHandler(k keeper.Keeper) sdk.Handler { } } -// Handle handleMsgVolumeReport. -func handleMsgVolumeReport(ctx sdk.Context, k keeper.Keeper, msg types.MsgVolumeReport) (*sdk.Result, error) { - if !(k.IsSPNode(ctx, msg.Reporter)) { - errMsg := fmt.Sprint("Volume report is not sent by a superior peer") - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, errMsg) - } - - // ensure epoch increment - lastEpoch := k.GetLastReportedEpoch(ctx) - if msg.Epoch.LTE(lastEpoch) { - e := sdkerrors.Wrapf(types.ErrMatureEpoch, "expected epoch should be greater than %s, got %s", - lastEpoch.String(), msg.Epoch.String()) - return nil, e - } - - // TODO: verify BLS signature - - txBytes := ctx.TxBytes() - txhash := fmt.Sprintf("%X", tmhash.Sum(txBytes)) - - totalConsumedOzone, err := k.VolumeReport(ctx, msg.WalletVolumes, msg.Reporter, msg.Epoch, msg.ReportReference, txhash) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeVolumeReport, - sdk.NewAttribute(types.AttributeKeyTotalConsumedOzone, totalConsumedOzone.String()), - sdk.NewAttribute(types.AttributeKeyReportReference, hex.EncodeToString([]byte(msg.ReportReference))), - sdk.NewAttribute(types.AttributeKeyEpoch, msg.Epoch.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.ReporterOwner.String()), - ), - }) - - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} +//// Handle handleMsgVolumeReport. +//func handleMsgVolumeReport(ctx sdk.Context, k keeper.Keeper, msg types.MsgVolumeReport) (*sdk.Result, error) { +// if !(k.IsSPNode(ctx, msg.Reporter)) { +// errMsg := fmt.Sprint("Volume report is not sent by a superior peer") +// return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, errMsg) +// } +// +// // ensure epoch increment +// lastEpoch := k.GetLastReportedEpoch(ctx) +// if msg.Epoch.LTE(lastEpoch) { +// e := sdkerrors.Wrapf(types.ErrMatureEpoch, "expected epoch should be greater than %s, got %s", +// lastEpoch.String(), msg.Epoch.String()) +// return nil, e +// } +// +// // TODO: verify BLS signature +// +// txBytes := ctx.TxBytes() +// txhash := fmt.Sprintf("%X", tmhash.Sum(txBytes)) +// +// totalConsumedOzone, err := k.VolumeReport(ctx, msg.WalletVolumes, msg.Reporter, msg.Epoch, msg.ReportReference, txhash) +// if err != nil { +// return nil, err +// } +// +// ctx.EventManager().EmitEvents(sdk.Events{ +// sdk.NewEvent( +// types.EventTypeVolumeReport, +// sdk.NewAttribute(types.AttributeKeyTotalConsumedOzone, totalConsumedOzone.String()), +// sdk.NewAttribute(types.AttributeKeyReportReference, hex.EncodeToString([]byte(msg.ReportReference))), +// sdk.NewAttribute(types.AttributeKeyEpoch, msg.Epoch.String()), +// ), +// sdk.NewEvent( +// sdk.EventTypeMessage, +// sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), +// sdk.NewAttribute(sdk.AttributeKeySender, msg.ReporterOwner.String()), +// ), +// }) +// +// return &sdk.Result{Events: ctx.EventManager().Events()}, nil +//} func handleMsgWithdraw(ctx sdk.Context, k keeper.Keeper, msg types.MsgWithdraw) (*sdk.Result, error) { err := k.Withdraw(ctx, msg.Amount, msg.WalletAddress, msg.TargetAddress) diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 003b4270..3b13d986 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -5,7 +5,7 @@ import ( "github.com/stratosnet/stratos-chain/x/pot/types" ) -func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { +func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { distributeGoal := types.InitDistributeGoal() rewardDetailMap := make(map[string]types.Reward) //key: wallet address @@ -158,7 +158,7 @@ func (k Keeper) returnBalance(ctx sdk.Context, goal types.DistributeGoal, curren } func (k Keeper) CalcTrafficRewardInTotal( - ctx sdk.Context, trafficList []types.SingleWalletVolume, distributeGoal types.DistributeGoal, + ctx sdk.Context, trafficList []*types.SingleWalletVolume, distributeGoal types.DistributeGoal, ) (sdk.Dec, types.DistributeGoal, error) { totalConsumedOzone, totalTrafficReward := k.GetTrafficReward(ctx, trafficList) @@ -193,7 +193,7 @@ func (k Keeper) CalcTrafficRewardInTotal( // The remaining total Ozone limit [lt] is the upper bound of total Ozone that users can purchase from Stratos blockchain. // the total generated traffic rewards as [R] // R = (S + Pt) * Y / (Lt + Y) -func (k Keeper) GetTrafficReward(ctx sdk.Context, trafficList []types.SingleWalletVolume) (totalConsumedOzone, result sdk.Dec) { +func (k Keeper) GetTrafficReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume) (totalConsumedOzone, result sdk.Dec) { S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() if S.Equal(sdk.ZeroDec()) { ctx.Logger().Info("initial genesis deposit by all resource nodes and meta nodes is 0") diff --git a/x/pot/keeper/keeper.go b/x/pot/keeper/keeper.go index f1b6225c..22db68c1 100644 --- a/x/pot/keeper/keeper.go +++ b/x/pot/keeper/keeper.go @@ -3,13 +3,9 @@ package keeper import ( "fmt" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/params" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + //"github.com/cosmos/cosmos-sdk/x/supply" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/register" "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/codec" @@ -21,19 +17,19 @@ import ( type Keeper struct { storeKey sdk.StoreKey cdc *codec.Codec - paramSpace params.Subspace + paramSpace paramstypes.Subspace feeCollectorName string // name of the FeeCollector ModuleAccount - BankKeeper bank.Keeper - SupplyKeeper supply.Keeper - AccountKeeper auth.AccountKeeper - StakingKeeper staking.Keeper - RegisterKeeper register.Keeper + BankKeeper types.BankKeeper + //SupplyKeeper supply.Keeper + AccountKeeper types.AccountKeeper + StakingKeeper types.StakingKeeper + RegisterKeeper types.RegisterKeeper } // NewKeeper creates a pot keeper -func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, feeCollectorName string, - bankKeeper bank.Keeper, supplyKeeper supply.Keeper, accountKeeper auth.AccountKeeper, stakingKeeper staking.Keeper, - registerKeeper register.Keeper, +func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace paramstypes.Subspace, feeCollectorName string, + bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, stakingKeeper types.StakingKeeper, + registerKeeper types.RegisterKeeper, ) Keeper { keeper := Keeper{ cdc: cdc, @@ -41,10 +37,10 @@ func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, f paramSpace: paramSpace.WithKeyTable(types.ParamKeyTable()), feeCollectorName: feeCollectorName, BankKeeper: bankKeeper, - SupplyKeeper: supplyKeeper, - AccountKeeper: accountKeeper, - StakingKeeper: stakingKeeper, - RegisterKeeper: registerKeeper, + //SupplyKeeper: supplyKeeper, + AccountKeeper: accountKeeper, + StakingKeeper: stakingKeeper, + RegisterKeeper: registerKeeper, } return keeper } @@ -54,7 +50,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []types.SingleWalletVolume, reporter stratos.SdsAddress, +func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []*types.SingleWalletVolume, reporter stratos.SdsAddress, epoch sdk.Int, reportReference string, txHash string) (totalConsumedOzone sdk.Dec, err error) { //record volume report reportRecord := types.NewReportRecord(reporter, reportReference, txHash) @@ -74,13 +70,14 @@ func (k Keeper) IsSPNode(ctx sdk.Context, p2pAddr stratos.SdsAddress) (found boo } func (k Keeper) FoundationDeposit(ctx sdk.Context, amount sdk.Coins, from sdk.AccAddress) (err error) { - _, err = k.BankKeeper.SubtractCoins(ctx, from, amount) + err = k.BankKeeper.SendCoinsFromAccountToModule(ctx, from, types.ModuleName, amount) if err != nil { return err } + //TODO foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) - _, err = k.BankKeeper.AddCoins(ctx, foundationAccountAddr, amount) + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, foundationAccountAddr, amount) if err != nil { return err } diff --git a/x/pot/keeper/msg_server.go b/x/pot/keeper/msg_server.go new file mode 100644 index 00000000..fdaa6155 --- /dev/null +++ b/x/pot/keeper/msg_server.go @@ -0,0 +1,170 @@ +package keeper + +import ( + "context" + "encoding/hex" + "fmt" + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/pot/types" + "github.com/tendermint/tendermint/crypto/tmhash" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the bank MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (k msgServer) HandleMsgVolumeReport(goCtx context.Context, msg *types.MsgVolumeReport) (*types.MsgVolumeReportResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + reporter, err := stratos.SdsAddressFromBech32(msg.Reporter) + if err != nil { + return &types.MsgVolumeReportResponse{}, err + } + if !(k.IsSPNode(ctx, reporter)) { + errMsg := fmt.Sprint("Volume report is not sent by a superior peer") + return &types.MsgVolumeReportResponse{}, sdkerrors.Wrap(types.ErrInvalidAddress, errMsg) + } + + // ensure epoch increment + epoch, ok := sdk.NewIntFromString(msg.Epoch.String()) + if !ok { + return &types.MsgVolumeReportResponse{}, types.ErrInvalid + } + lastEpoch := k.GetLastReportedEpoch(ctx) + if msg.Epoch.LTE(lastEpoch) { + e := sdkerrors.Wrapf(types.ErrMatureEpoch, "expected epoch should be greater than %s, got %s", + lastEpoch.String(), msg.Epoch.String()) + return &types.MsgVolumeReportResponse{}, e + } + + // TODO: verify BLS signature + + txBytes := ctx.TxBytes() + txhash := fmt.Sprintf("%X", tmhash.Sum(txBytes)) + + totalConsumedOzone, err := k.VolumeReport(ctx, msg.WalletVolumes, reporter, epoch, msg.ReportReference, txhash) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeVolumeReport, + sdk.NewAttribute(types.AttributeKeyTotalConsumedOzone, totalConsumedOzone.String()), + sdk.NewAttribute(types.AttributeKeyReportReference, hex.EncodeToString([]byte(msg.ReportReference))), + sdk.NewAttribute(types.AttributeKeyEpoch, msg.Epoch.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.ReporterOwner), + ), + }) + + return &types.MsgVolumeReportResponse{}, nil +} + +func (k msgServer) HandleMsgWithdraw(goCtx context.Context, msg *types.MsgWithdraw) (*types.MsgWithdrawResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + walletAddress, err := sdk.AccAddressFromBech32(msg.WalletAddress) + if err != nil { + return &types.MsgWithdrawResponse{}, err + } + targetAddress, err := sdk.AccAddressFromBech32(msg.TargetAddress) + if err != nil { + return &types.MsgWithdrawResponse{}, err + } + err = k.Withdraw(ctx, msg.Amount, walletAddress, targetAddress) + if err != nil { + return &types.MsgWithdrawResponse{}, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeWithdraw, + sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), + sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.WalletAddress), + ), + }) + return &types.MsgWithdrawResponse{}, nil +} + +func (k msgServer) HandleMsgFoundationDeposit(goCtx context.Context, msg *types.MsgFoundationDeposit) (*types.MsgFoundationDepositResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + from, err := sdk.AccAddressFromBech32(msg.From) + if err != nil { + return &types.MsgFoundationDepositResponse{}, err + } + err = k.FoundationDeposit(ctx, msg.Amount, from) + if err != nil { + return &types.MsgFoundationDepositResponse{}, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeFoundationDeposit, + sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.From), + ), + }) + return &types.MsgFoundationDepositResponse{}, nil +} + +func (k msgServer) HandleMsgSlashingResourceNode(goCtx context.Context, msg *types.MsgSlashingResourceNode) (*types.MsgSlashingResourceNodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + for _, reporter := range msg.Reporters { + reporterSdsAddr, err := stratos.SdsAddressFromBech32(reporter) + if err != nil { + return &types.MsgSlashingResourceNodeResponse{}, err + } + if !(k.IsSPNode(ctx, reporterSdsAddr)) { + errMsg := fmt.Sprint("Slashing msg is not sent by a meta node") + return &types.MsgSlashingResourceNodeResponse{}, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, errMsg) + } + } + networkAddress, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) + if err != nil { + return &types.MsgSlashingResourceNodeResponse{}, err + } + walletAddress, err := sdk.AccAddressFromBech32(msg.WalletAddress) + if err != nil { + return &types.MsgSlashingResourceNodeResponse{}, err + } + slashing, ok := sdk.NewIntFromString(msg.Slashing.String()) + if !ok { + return &types.MsgSlashingResourceNodeResponse{}, types.ErrInvalidAmount + } + amt, nodeType, err := k.SlashingResourceNode(ctx, networkAddress, walletAddress, slashing, msg.Suspend) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSlashing, + sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress), + sdk.NewAttribute(types.AttributeKeyNodeP2PAddress, msg.NetworkAddress), + sdk.NewAttribute(types.AttributeKeyAmount, amt.String()), + sdk.NewAttribute(types.AttributeKeySlashingNodeType, nodeType.String()), + sdk.NewAttribute(types.AttributeKeyNodeSuspended, strconv.FormatBool(msg.Suspend)), + ), + }) + return &types.MsgSlashingResourceNodeResponse{}, err +} diff --git a/x/pot/keeper/store.go b/x/pot/keeper/store.go index 8f93c76e..fe378289 100644 --- a/x/pot/keeper/store.go +++ b/x/pot/keeper/store.go @@ -7,7 +7,7 @@ import ( func (k Keeper) SetTotalMinedTokens(ctx sdk.Context, totalMinedToken sdk.Coin) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(totalMinedToken) + b := types.ModuleCdc.MustMarshalLengthPrefixed(totalMinedToken) store.Set(types.TotalMinedTokensKey, b) } @@ -17,13 +17,13 @@ func (k Keeper) GetTotalMinedTokens(ctx sdk.Context) (totalMinedToken sdk.Coin) if b == nil { return sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &totalMinedToken) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &totalMinedToken) return } func (k Keeper) setMinedTokens(ctx sdk.Context, epoch sdk.Int, minedToken sdk.Coin) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(minedToken) + b := types.ModuleCdc.MustMarshalLengthPrefixed(minedToken) store.Set(types.GetMinedTokensKey(epoch), b) } @@ -33,13 +33,14 @@ func (k Keeper) GetMinedTokens(ctx sdk.Context, epoch sdk.Int) (minedToken sdk.C if b == nil { return sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &minedToken) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &minedToken) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &minedToken) return } func (k Keeper) SetLastReportedEpoch(ctx sdk.Context, epoch sdk.Int) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(epoch) + b := types.ModuleCdc.MustMarshalLengthPrefixed(epoch) store.Set(types.LastReportedEpochKey, b) } @@ -49,13 +50,13 @@ func (k Keeper) GetLastReportedEpoch(ctx sdk.Context) (epoch sdk.Int) { if b == nil { return sdk.ZeroInt() } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &epoch) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &epoch) return } func (k Keeper) SetIndividualReward(ctx sdk.Context, walletAddress sdk.AccAddress, epoch sdk.Int, value types.Reward) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(value) + b := types.ModuleCdc.MustMarshalLengthPrefixed(value) store.Set(types.GetIndividualRewardKey(walletAddress, epoch), b) } @@ -65,13 +66,13 @@ func (k Keeper) GetIndividualReward(ctx sdk.Context, walletAddress sdk.AccAddres if b == nil { return value, false } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &value) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &value) return value, true } func (k Keeper) SetMatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAddress, value sdk.Coins) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(value) + b := types.ModuleCdc.MustMarshalLengthPrefixed(value) store.Set(types.GetMatureTotalRewardKey(walletAddress), b) } @@ -81,13 +82,13 @@ func (k Keeper) GetMatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAddre if b == nil { return sdk.Coins{} } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &value) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &value) return } func (k Keeper) SetImmatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAddress, value sdk.Coins) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(value) + b := types.ModuleCdc.MustMarshalLengthPrefixed(value) store.Set(types.GetImmatureTotalRewardKey(walletAddress), b) } @@ -97,7 +98,7 @@ func (k Keeper) GetImmatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAdd if b == nil { return sdk.Coins{} } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &value) + types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &value) return } @@ -107,13 +108,13 @@ func (k Keeper) GetVolumeReport(ctx sdk.Context, epoch sdk.Int) (res types.Volum if bz == nil { return types.VolumeReportRecord{} } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &res) + types.ModuleCdc.MustUnmarshalLengthPrefixed(bz, &res) return res } func (k Keeper) SetVolumeReport(ctx sdk.Context, epoch sdk.Int, reportRecord types.VolumeReportRecord) { store := ctx.KVStore(k.storeKey) storeKey := types.VolumeReportStoreKey(epoch) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(reportRecord) + bz := types.ModuleCdc.MustMarshalLengthPrefixed(reportRecord) store.Set(storeKey, bz) } diff --git a/x/pot/types/codec.go b/x/pot/types/codec.go index b379b643..c04bcc28 100644 --- a/x/pot/types/codec.go +++ b/x/pot/types/codec.go @@ -2,10 +2,15 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/cosmos/cosmos-sdk/x/authz" ) // RegisterCodec registers concrete types on codec -func RegisterCodec(cdc *codec.Codec) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // this line is used by starport scaffolding # 1 cdc.RegisterConcrete(MsgVolumeReport{}, "pot/VolumeReportTx", nil) cdc.RegisterConcrete(MsgWithdraw{}, "pot/WithdrawTx", nil) @@ -13,12 +18,28 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgSlashingResourceNode{}, "pot/SlashingResourceNodeTx", nil) } +// RegisterInterfaces registers the x/register interfaces types with the interface registry +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgVolumeReport{}, + &MsgWithdraw{}, + &MsgFoundationDeposit{}, + &MsgSlashingResourceNode{}, + ) + registry.RegisterImplementations( + (*authz.Authorization)(nil), + //&StakeAuthorization{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + // ModuleCdc defines the module codec -var ModuleCdc *codec.Codec +var ModuleCdc *codec.LegacyAmino func init() { - ModuleCdc = codec.New() - RegisterCodec(ModuleCdc) - codec.RegisterCrypto(ModuleCdc) + ModuleCdc = codec.NewLegacyAmino() + RegisterLegacyAminoCodec(ModuleCdc) + cryptocodec.RegisterCrypto(ModuleCdc) ModuleCdc.Seal() } diff --git a/x/pot/types/distribute.go b/x/pot/types/distribute.go index 43a153b1..4da1716c 100644 --- a/x/pot/types/distribute.go +++ b/x/pot/types/distribute.go @@ -171,15 +171,15 @@ func (d DistributeGoal) String() string { ) } -type Reward struct { - WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` // account address of node - RewardFromMiningPool sdk.Coins `json:"reward_from_mining_pool" yaml:"reward_from_mining_pool"` - RewardFromTrafficPool sdk.Coins `json:"reward_from_traffic_pool" yaml:"reward_from_traffic_pool"` -} +//type Reward struct { +// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` // account address of node +// RewardFromMiningPool sdk.Coins `json:"reward_from_mining_pool" yaml:"reward_from_mining_pool"` +// RewardFromTrafficPool sdk.Coins `json:"reward_from_traffic_pool" yaml:"reward_from_traffic_pool"` +//} func NewReward(walletAddress sdk.AccAddress, rewardFromMiningPool sdk.Coins, rewardFromTrafficPool sdk.Coins) Reward { return Reward{ - WalletAddress: walletAddress, + WalletAddress: walletAddress.String(), RewardFromMiningPool: rewardFromMiningPool, RewardFromTrafficPool: rewardFromTrafficPool, } @@ -200,7 +200,7 @@ func (r Reward) AddRewardFromTrafficPool(reward sdk.Coin) Reward { } // String returns a human readable string representation of a Reward. -func (r Reward) String() string { +func (r Reward) HrpString() string { return fmt.Sprintf(`Reward:{ WalletAddress: %s RewardFromMiningPool: %s diff --git a/x/pot/types/errors.go b/x/pot/types/errors.go index 56eb95d3..e18e8748 100644 --- a/x/pot/types/errors.go +++ b/x/pot/types/errors.go @@ -4,33 +4,64 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +const ( + codeErrInvalid = uint32(iota) + 2 // NOTE: code 1 is reserved for internal errors + codeErrUnknownAccountAddress + codeErrOutOfIssuance + codeErrWithdrawAmountInvalid + codeErrMissingWalletAddress + codeErrMissingTargetAddress + codeErrInsufficientMatureTotal + codeErrInsufficientFoundationAccBalance + codeErrInsufficientUnissuedPrePayBalance + codeErrNotTheOwner + codeErrMatureEpoch + codeErrEmptyFromAddr + codeErrEmptyReporterAddr + codeErrEmptyWalletVolumes + codeErrEpochNotPositive + codeErrEmptyReportReference + codeErrEmptyReporterOwnerAddr + codeErrNegativeVolume + codeErrFoundationDepositAmountInvalid + codeErrBLSSignatureInvalid + codeErrBLSTxDataInvalid + codeErrBLSPubkeysInvalid + codeErrReporterAddress + codeErrNodeStatusSuspend + codeErrInvalidAmount + codeErrCannotFindReport + codeErrCannotFindReward + codeErrInvalidAddress +) + var ( - ErrInvalid = sdkerrors.Register(ModuleName, 1, "error invalid") - ErrUnknownAccountAddress = sdkerrors.Register(ModuleName, 2, "account address does not exist") - ErrOutOfIssuance = sdkerrors.Register(ModuleName, 3, "mining reward reaches the issuance limit") - ErrWithdrawAmountInvalid = sdkerrors.Register(ModuleName, 4, "withdraw amount is invalid") - ErrMissingWalletAddress = sdkerrors.Register(ModuleName, 5, "missing wallet address") - ErrMissingTargetAddress = sdkerrors.Register(ModuleName, 6, "missing target address") - ErrInsufficientMatureTotal = sdkerrors.Register(ModuleName, 7, "insufficient mature total") - ErrInsufficientFoundationAccBalance = sdkerrors.Register(ModuleName, 8, "insufficient foundation account balance") - ErrInsufficientUnissuedPrePayBalance = sdkerrors.Register(ModuleName, 9, "insufficient unissued prepay balance") - ErrNotTheOwner = sdkerrors.Register(ModuleName, 10, "not the owner of the node") - ErrMatureEpoch = sdkerrors.Register(ModuleName, 11, "the value of epoch must be positive and greater than its previous one") - ErrEmptyFromAddr = sdkerrors.Register(ModuleName, 12, "missing from address") - ErrEmptyReporterAddr = sdkerrors.Register(ModuleName, 13, "missing reporter address") - ErrEmptyWalletVolumes = sdkerrors.Register(ModuleName, 14, "wallet volumes list empty") - ErrEpochNotPositive = sdkerrors.Register(ModuleName, 15, "report epoch is not positive") - ErrEmptyReportReference = sdkerrors.Register(ModuleName, 16, "missing report reference") - ErrEmptyReporterOwnerAddr = sdkerrors.Register(ModuleName, 17, "missing reporter owner address") - ErrNegativeVolume = sdkerrors.Register(ModuleName, 18, "report volume is negative") - ErrFoundationDepositAmountInvalid = sdkerrors.Register(ModuleName, 19, "foundation deposit amount is invalid") - ErrBLSSignatureInvalid = sdkerrors.Register(ModuleName, 20, "BLS signature is invalid") - ErrBLSTxDataInvalid = sdkerrors.Register(ModuleName, 21, "BLS signature txData is invalid") - ErrBLSPubkeysInvalid = sdkerrors.Register(ModuleName, 22, "BLS signature pubkeys are invalid") - ErrReporterAddress = sdkerrors.Register(ModuleName, 23, "invalid reporter address") - ErrNodeStatusSuspend = sdkerrors.Register(ModuleName, 24, "node already in status expected") - ErrInvalidAmount = sdkerrors.Register(ModuleName, 25, "invalid amount") - ErrCannotFindReport = sdkerrors.Register(ModuleName, 26, "Can not find report") - ErrCannotFindReward = sdkerrors.Register(ModuleName, 27, "Can not find Pot rewards") - ErrInvalidAddress = sdkerrors.Register(ModuleName, 28, "invalid address") + ErrInvalid = sdkerrors.Register(ModuleName, codeErrInvalid, "error invalid") + ErrUnknownAccountAddress = sdkerrors.Register(ModuleName, codeErrUnknownAccountAddress, "account address does not exist") + ErrOutOfIssuance = sdkerrors.Register(ModuleName, codeErrOutOfIssuance, "mining reward reaches the issuance limit") + ErrWithdrawAmountInvalid = sdkerrors.Register(ModuleName, codeErrWithdrawAmountInvalid, "withdraw amount is invalid") + ErrMissingWalletAddress = sdkerrors.Register(ModuleName, codeErrMissingWalletAddress, "missing wallet address") + ErrMissingTargetAddress = sdkerrors.Register(ModuleName, codeErrMissingTargetAddress, "missing target address") + ErrInsufficientMatureTotal = sdkerrors.Register(ModuleName, codeErrInsufficientMatureTotal, "insufficient mature total") + ErrInsufficientFoundationAccBalance = sdkerrors.Register(ModuleName, codeErrInsufficientFoundationAccBalance, "insufficient foundation account balance") + ErrInsufficientUnissuedPrePayBalance = sdkerrors.Register(ModuleName, codeErrInsufficientUnissuedPrePayBalance, "insufficient unissued prepay balance") + ErrNotTheOwner = sdkerrors.Register(ModuleName, codeErrNotTheOwner, "not the owner of the node") + ErrMatureEpoch = sdkerrors.Register(ModuleName, codeErrMatureEpoch, "the value of epoch must be positive and greater than its previous one") + ErrEmptyFromAddr = sdkerrors.Register(ModuleName, codeErrEmptyFromAddr, "missing from address") + ErrEmptyReporterAddr = sdkerrors.Register(ModuleName, codeErrEmptyReporterAddr, "missing reporter address") + ErrEmptyWalletVolumes = sdkerrors.Register(ModuleName, codeErrEmptyWalletVolumes, "wallet volumes list empty") + ErrEpochNotPositive = sdkerrors.Register(ModuleName, codeErrEpochNotPositive, "report epoch is not positive") + ErrEmptyReportReference = sdkerrors.Register(ModuleName, codeErrEmptyReportReference, "missing report reference") + ErrEmptyReporterOwnerAddr = sdkerrors.Register(ModuleName, codeErrEmptyReporterOwnerAddr, "missing reporter owner address") + ErrNegativeVolume = sdkerrors.Register(ModuleName, codeErrNegativeVolume, "report volume is negative") + ErrFoundationDepositAmountInvalid = sdkerrors.Register(ModuleName, codeErrFoundationDepositAmountInvalid, "foundation deposit amount is invalid") + ErrBLSSignatureInvalid = sdkerrors.Register(ModuleName, codeErrBLSSignatureInvalid, "BLS signature is invalid") + ErrBLSTxDataInvalid = sdkerrors.Register(ModuleName, codeErrBLSTxDataInvalid, "BLS signature txData is invalid") + ErrBLSPubkeysInvalid = sdkerrors.Register(ModuleName, codeErrBLSPubkeysInvalid, "BLS signature pubkeys are invalid") + ErrReporterAddress = sdkerrors.Register(ModuleName, codeErrReporterAddress, "invalid reporter address") + ErrNodeStatusSuspend = sdkerrors.Register(ModuleName, codeErrNodeStatusSuspend, "node already in status expected") + ErrInvalidAmount = sdkerrors.Register(ModuleName, codeErrInvalidAmount, "invalid amount") + ErrCannotFindReport = sdkerrors.Register(ModuleName, codeErrCannotFindReport, "Can not find report") + ErrCannotFindReward = sdkerrors.Register(ModuleName, codeErrCannotFindReward, "Can not find Pot rewards") + ErrInvalidAddress = sdkerrors.Register(ModuleName, codeErrInvalidAddress, "invalid address") ) diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index a9daf4ef..e1fcdb2a 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -2,20 +2,57 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/params" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/register/types" + //authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" + //"github.com/cosmos/cosmos-sdk/x/params" ) // ParamSubSpace defines the expected Subspace interface type ParamSubSpace interface { - WithKeyTable(table params.KeyTable) params.Subspace + WithKeyTable(table paramstypes.KeyTable) paramstypes.Subspace Get(ctx sdk.Context, key []byte, ptr interface{}) - GetParamSet(ctx sdk.Context, ps params.ParamSet) - SetParamSet(ctx sdk.Context, ps params.ParamSet) + GetParamSet(ctx sdk.Context, ps paramstypes.ParamSet) + SetParamSet(ctx sdk.Context, ps paramstypes.ParamSet) } // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { - IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool)) - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account // only used for simulation + IterateAccounts(ctx sdk.Context, process func(authtypes.AccountI) (stop bool)) + GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // only used for simulation + + GetModuleAddress(name string) sdk.AccAddress + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + + // SetModuleAccount TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 + SetModuleAccount(sdk.Context, authtypes.ModuleAccountI) +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + + GetSupply(ctx sdk.Context, denom string) sdk.Coin + + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx sdk.Context, senderPool, recipientPool string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error +} + +type RegisterKeeper interface { + GetIndexingNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (indexingNode types.IndexingNode, found bool) +} + +type StakingKeeper interface { } diff --git a/x/pot/types/genesis.go b/x/pot/types/genesis.go index cedc7023..b80c1a27 100644 --- a/x/pot/types/genesis.go +++ b/x/pot/types/genesis.go @@ -2,25 +2,26 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + //stratos "github.com/stratosnet/stratos-chain/types" ) -type GenesisState struct { - Params Params `json:"params" yaml:"params"` - TotalMinedToken sdk.Coin `json:"total_mined_token" yaml:"total_mined_token"` - LastReportedEpoch int64 `json:"last_reported_epoch" yaml:"last_reported_epoch"` - ImmatureTotalInfo []ImmatureTotal `json:"immature_total_info" yaml:"immature_total_info"` - MatureTotalInfo []MatureTotal `json:"mature_total_info" yaml:"mature_total_info"` - IndividualRewardInfo []Reward `json:"individual_reward_info" yaml:"individual_reward_info"` -} - +//type GenesisState struct { +// Params Params `json:"params" yaml:"params"` +// TotalMinedToken sdk.Coin `json:"total_mined_token" yaml:"total_mined_token"` +// LastReportedEpoch int64 `json:"last_reported_epoch" yaml:"last_reported_epoch"` +// ImmatureTotalInfo []ImmatureTotal `json:"immature_total_info" yaml:"immature_total_info"` +// MatureTotalInfo []MatureTotal `json:"mature_total_info" yaml:"mature_total_info"` +// IndividualRewardInfo []Reward `json:"individual_reward_info" yaml:"individual_reward_info"` +//} +// // NewGenesisState creates a new GenesisState object func NewGenesisState(params Params, totalMinedToken sdk.Coin, lastReportedEpoch int64, - immatureTotalInfo []ImmatureTotal, matureTotalInfo []MatureTotal, individualRewardInfo []Reward, + immatureTotalInfo []*ImmatureTotal, matureTotalInfo []*MatureTotal, individualRewardInfo []*Reward, ) GenesisState { return GenesisState{ - Params: params, - TotalMinedToken: totalMinedToken, + Params: ¶ms, + TotalMinedToken: &totalMinedToken, LastReportedEpoch: lastReportedEpoch, ImmatureTotalInfo: immatureTotalInfo, MatureTotalInfo: matureTotalInfo, @@ -30,13 +31,15 @@ func NewGenesisState(params Params, totalMinedToken sdk.Coin, lastReportedEpoch // DefaultGenesisState - default GenesisState used by Cosmos Hub func DefaultGenesisState() GenesisState { + params := DefaultParams() + coin := sdk.NewCoin(DefaultRewardDenom, sdk.ZeroInt()) return GenesisState{ - Params: DefaultParams(), - TotalMinedToken: sdk.NewCoin(DefaultRewardDenom, sdk.ZeroInt()), + Params: ¶ms, + TotalMinedToken: &coin, LastReportedEpoch: 0, - ImmatureTotalInfo: make([]ImmatureTotal, 0), - MatureTotalInfo: make([]MatureTotal, 0), - IndividualRewardInfo: make([]Reward, 0), + ImmatureTotalInfo: make([]*ImmatureTotal, 0), + MatureTotalInfo: make([]*MatureTotal, 0), + IndividualRewardInfo: make([]*Reward, 0), } } @@ -45,26 +48,26 @@ func ValidateGenesis(data GenesisState) error { return nil } -type ImmatureTotal struct { - WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` - Value sdk.Coins `json:"value" yaml:"value"` -} - +//type ImmatureTotal struct { +// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` +// Value sdk.Coins `json:"value" yaml:"value"` +//} +// func NewImmatureTotal(walletAddress sdk.AccAddress, value sdk.Coins) ImmatureTotal { return ImmatureTotal{ - WalletAddress: walletAddress, + WalletAddress: walletAddress.String(), Value: value, } } -type MatureTotal struct { - WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` - Value sdk.Coins `json:"value" yaml:"value"` -} - +//type MatureTotal struct { +// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` +// Value sdk.Coins `json:"value" yaml:"value"` +//} +// func NewMatureTotal(walletAddress sdk.AccAddress, value sdk.Coins) MatureTotal { return MatureTotal{ - WalletAddress: walletAddress, + WalletAddress: walletAddress.String(), Value: value, } } diff --git a/x/pot/types/genesis.pb.go b/x/pot/types/genesis.pb.go new file mode 100644 index 00000000..1251c8f0 --- /dev/null +++ b/x/pot/types/genesis.pb.go @@ -0,0 +1,625 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/pot/v1/genesis.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the register module's genesis state. +type GenesisState struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` + TotalMinedToken *types.Coin `protobuf:"bytes,2,opt,name=totalMinedToken,proto3" json:"totalMinedToken,omitempty" yaml:"total_mined_token"` + LastReportedEpoch int64 `protobuf:"varint,3,opt,name=lastReportedEpoch,proto3" json:"lastReportedEpoch,omitempty" yaml:"last_reported_epoch"` + ImmatureTotalInfo []*ImmatureTotal `protobuf:"bytes,4,rep,name=immatureTotalInfo,proto3" json:"immatureTotalInfo,omitempty" yaml:"immature_total_info"` + MatureTotalInfo []*MatureTotal `protobuf:"bytes,5,rep,name=matureTotalInfo,proto3" json:"matureTotalInfo,omitempty" yaml:"mature_total_info"` + IndividualRewardInfo []*Reward `protobuf:"bytes,6,rep,name=IndividualRewardInfo,proto3" json:"IndividualRewardInfo,omitempty" yaml:"individual_reward_info"` +} + +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_abdde08c2564316a, []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 nil +} + +func (m *GenesisState) GetTotalMinedToken() *types.Coin { + if m != nil { + return m.TotalMinedToken + } + return nil +} + +func (m *GenesisState) GetLastReportedEpoch() int64 { + if m != nil { + return m.LastReportedEpoch + } + return 0 +} + +func (m *GenesisState) GetImmatureTotalInfo() []*ImmatureTotal { + if m != nil { + return m.ImmatureTotalInfo + } + return nil +} + +func (m *GenesisState) GetMatureTotalInfo() []*MatureTotal { + if m != nil { + return m.MatureTotalInfo + } + return nil +} + +func (m *GenesisState) GetIndividualRewardInfo() []*Reward { + if m != nil { + return m.IndividualRewardInfo + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "stratos.pot.v1.GenesisState") +} + +func init() { proto.RegisterFile("stratos/pot/v1/genesis.proto", fileDescriptor_abdde08c2564316a) } + +var fileDescriptor_abdde08c2564316a = []byte{ + // 441 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xbf, 0x6e, 0xd3, 0x40, + 0x1c, 0xc7, 0x63, 0x52, 0x32, 0xb8, 0x40, 0x15, 0xab, 0x42, 0x26, 0xb4, 0x4e, 0xf0, 0x94, 0x85, + 0x3b, 0xa5, 0x6c, 0x6c, 0x18, 0x21, 0x14, 0x89, 0x4a, 0xc8, 0x74, 0x62, 0xb1, 0x2e, 0xf6, 0x35, + 0x39, 0x35, 0xbe, 0x9f, 0xe5, 0xfb, 0x25, 0xd0, 0xb7, 0xe0, 0x9d, 0x58, 0x18, 0x3b, 0x32, 0x45, + 0x28, 0x79, 0x83, 0x3c, 0x01, 0xba, 0x3f, 0x45, 0xc6, 0xe9, 0x76, 0xd2, 0xf7, 0xcf, 0xe7, 0x7b, + 0xf6, 0xf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() (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.IndividualRewardInfo) > 0 { + for iNdEx := len(m.IndividualRewardInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.IndividualRewardInfo[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.MatureTotalInfo) > 0 { + for iNdEx := len(m.MatureTotalInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MatureTotalInfo[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.ImmatureTotalInfo) > 0 { + for iNdEx := len(m.ImmatureTotalInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ImmatureTotalInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.LastReportedEpoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.LastReportedEpoch)) + i-- + dAtA[i] = 0x18 + } + if m.TotalMinedToken != nil { + { + size, err := m.TotalMinedToken.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Params != nil { + { + 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 + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.TotalMinedToken != nil { + l = m.TotalMinedToken.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.LastReportedEpoch != 0 { + n += 1 + sovGenesis(uint64(m.LastReportedEpoch)) + } + if len(m.ImmatureTotalInfo) > 0 { + for _, e := range m.ImmatureTotalInfo { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.MatureTotalInfo) > 0 { + for _, e := range m.MatureTotalInfo { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.IndividualRewardInfo) > 0 { + for _, e := range m.IndividualRewardInfo { + 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 m.Params == nil { + m.Params = &Params{} + } + 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 TotalMinedToken", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TotalMinedToken == nil { + m.TotalMinedToken = &types.Coin{} + } + if err := m.TotalMinedToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastReportedEpoch", wireType) + } + m.LastReportedEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastReportedEpoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ImmatureTotalInfo", 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.ImmatureTotalInfo = append(m.ImmatureTotalInfo, &ImmatureTotal{}) + if err := m.ImmatureTotalInfo[len(m.ImmatureTotalInfo)-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 MatureTotalInfo", 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.MatureTotalInfo = append(m.MatureTotalInfo, &MatureTotal{}) + if err := m.MatureTotalInfo[len(m.MatureTotalInfo)-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 IndividualRewardInfo", 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.IndividualRewardInfo = append(m.IndividualRewardInfo, &Reward{}) + if err := m.IndividualRewardInfo[len(m.IndividualRewardInfo)-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/pot/types/msg.go b/x/pot/types/msg.go index 419adcb2..7a6f608d 100644 --- a/x/pot/types/msg.go +++ b/x/pot/types/msg.go @@ -19,31 +19,31 @@ var ( _ sdk.Msg = &MsgSlashingResourceNode{} ) -type MsgVolumeReport struct { - WalletVolumes []SingleWalletVolume `json:"wallet_volumes" yaml:"wallet_volumes"` // volume report - Reporter stratos.SdsAddress `json:"reporter" yaml:"reporter"` // node p2p address of the reporter - Epoch sdk.Int `json:"epoch" yaml:"epoch"` // volume report epoch - ReportReference string `json:"report_reference" yaml:"report_reference"` // volume report reference - ReporterOwner sdk.AccAddress `json:"reporter_owner" yaml:"reporter_owner"` // owner address of the reporter - BLSSignature BLSSignatureInfo `json:"bls_signature" yaml:"bls_signature"` // information about the BLS signature -} +//type MsgVolumeReport struct { +// WalletVolumes []SingleWalletVolume `json:"wallet_volumes" yaml:"wallet_volumes"` // volume report +// Reporter stratos.SdsAddress `json:"reporter" yaml:"reporter"` // node p2p address of the reporter +// Epoch sdk.Int `json:"epoch" yaml:"epoch"` // volume report epoch +// ReportReference string `json:"report_reference" yaml:"report_reference"` // volume report reference +// ReporterOwner sdk.AccAddress `json:"reporter_owner" yaml:"reporter_owner"` // owner address of the reporter +// BLSSignature BLSSignatureInfo `json:"bls_signature" yaml:"bls_signature"` // information about the BLS signature +//} // NewMsgVolumeReport creates a new MsgVolumeReport instance func NewMsgVolumeReport( - walletVolumes []SingleWalletVolume, + walletVolumes []*SingleWalletVolume, reporter stratos.SdsAddress, epoch sdk.Int, reportReference string, reporterOwner sdk.AccAddress, blsSignature BLSSignatureInfo, -) MsgVolumeReport { - return MsgVolumeReport{ +) *MsgVolumeReport { + return &MsgVolumeReport{ WalletVolumes: walletVolumes, - Reporter: reporter, - Epoch: epoch, + Reporter: reporter.String(), + Epoch: &epoch, ReportReference: reportReference, - ReporterOwner: reporterOwner, - BLSSignature: blsSignature, + ReporterOwner: reporterOwner.String(), + BLSSignature: &blsSignature, } } @@ -69,7 +69,11 @@ func (msg MsgVolumeReport) Route() string { return RouterKey } // GetSigners Implement func (msg MsgVolumeReport) GetSigners() []sdk.AccAddress { var addrs []sdk.AccAddress - addrs = append(addrs, msg.ReporterOwner) + reporterOwner, err := sdk.AccAddressFromBech32(msg.ReporterOwner) + if err != nil { + return addrs + } + addrs = append(addrs, reporterOwner) return addrs } @@ -84,7 +88,7 @@ func (msg MsgVolumeReport) GetSignBytes() []byte { // ValidateBasic validity check for the AnteHandler func (msg MsgVolumeReport) ValidateBasic() error { - if msg.Reporter.Empty() { + if len(msg.Reporter) == 0 { return ErrEmptyReporterAddr } if !(len(msg.WalletVolumes) > 0) { @@ -98,7 +102,7 @@ func (msg MsgVolumeReport) ValidateBasic() error { if !(len(msg.ReportReference) > 0) { return ErrEmptyReportReference } - if msg.ReporterOwner.Empty() { + if len(msg.ReporterOwner) == 0 { return ErrEmptyReporterOwnerAddr } @@ -106,7 +110,7 @@ func (msg MsgVolumeReport) ValidateBasic() error { if item.Volume.IsNegative() { return ErrNegativeVolume } - if item.WalletAddress.Empty() { + if len(item.WalletAddress) == 0 { return ErrMissingWalletAddress } } @@ -126,17 +130,17 @@ func (msg MsgVolumeReport) ValidateBasic() error { return nil } -type MsgWithdraw struct { - Amount sdk.Coins `json:"amount" yaml:"amount"` - WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` - TargetAddress sdk.AccAddress `json:"target_address" yaml:"target_address"` -} +//type MsgWithdraw struct { +// Amount sdk.Coins `json:"amount" yaml:"amount"` +// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` +// TargetAddress sdk.AccAddress `json:"target_address" yaml:"target_address"` +//} -func NewMsgWithdraw(amount sdk.Coins, walletAddress sdk.AccAddress, targetAddress sdk.AccAddress) MsgWithdraw { - return MsgWithdraw{ +func NewMsgWithdraw(amount sdk.Coins, walletAddress sdk.AccAddress, targetAddress sdk.AccAddress) *MsgWithdraw { + return &MsgWithdraw{ Amount: amount, - WalletAddress: walletAddress, - TargetAddress: targetAddress, + WalletAddress: walletAddress.String(), + TargetAddress: targetAddress.String(), } } @@ -145,7 +149,13 @@ func (msg MsgWithdraw) Route() string { return RouterKey } // GetSigners Implement func (msg MsgWithdraw) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.WalletAddress} + var addrs []sdk.AccAddress + walletAddress, err := sdk.AccAddressFromBech32(msg.WalletAddress) + if err != nil { + return addrs + } + addrs = append(addrs, walletAddress) + return addrs } // Type Implement @@ -162,24 +172,24 @@ func (msg MsgWithdraw) ValidateBasic() error { if !(msg.Amount.IsValid()) { return ErrWithdrawAmountInvalid } - if msg.WalletAddress.Empty() { + if len(msg.WalletAddress) == 0 { return ErrMissingWalletAddress } - if msg.TargetAddress.Empty() { + if len(msg.TargetAddress) == 0 { return ErrMissingTargetAddress } return nil } -type MsgFoundationDeposit struct { - Amount sdk.Coins `json:"amount" yaml:"amount"` - From sdk.AccAddress `json:"from" yaml:"from"` -} +//type MsgFoundationDeposit struct { +// Amount sdk.Coins `json:"amount" yaml:"amount"` +// From sdk.AccAddress `json:"from" yaml:"from"` +//} -func NewMsgFoundationDeposit(amount sdk.Coins, from sdk.AccAddress) MsgFoundationDeposit { - return MsgFoundationDeposit{ +func NewMsgFoundationDeposit(amount sdk.Coins, from sdk.AccAddress) *MsgFoundationDeposit { + return &MsgFoundationDeposit{ Amount: amount, - From: from, + From: from.String(), } } @@ -188,7 +198,13 @@ func (msg MsgFoundationDeposit) Route() string { return RouterKey } // GetSigners Implement func (msg MsgFoundationDeposit) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.From} + var addrs []sdk.AccAddress + from, err := sdk.AccAddressFromBech32(msg.From) + if err != nil { + return addrs + } + addrs = append(addrs, from) + return addrs } // Type Implement @@ -205,29 +221,39 @@ func (msg MsgFoundationDeposit) ValidateBasic() error { if !(msg.Amount.IsValid()) { return ErrFoundationDepositAmountInvalid } - if msg.From.Empty() { + if len(msg.From) == 0 { return ErrEmptyFromAddr } return nil } -type MsgSlashingResourceNode struct { - Reporters []stratos.SdsAddress `json:"reporters" yaml:"reporters"` // reporter p2p address - ReporterOwner []sdk.AccAddress `json:"reporter_owner" yaml:"reporter_owner"` // reporter wallet address - NetworkAddress stratos.SdsAddress `json:"network_address" yaml:"network_address"` // p2p address of the pp node - WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` // wallet address of the pp node - Slashing sdk.Int `json:"slashing" yaml:"slashing"` // uoz amount - Suspend bool `json:"suspend" yaml:"suspend"` -} +//type MsgSlashingResourceNode struct { +// Reporters []stratos.SdsAddress `json:"reporters" yaml:"reporters"` // reporter p2p address +// ReporterOwner []sdk.AccAddress `json:"reporter_owner" yaml:"reporter_owner"` // reporter wallet address +// NetworkAddress stratos.SdsAddress `json:"network_address" yaml:"network_address"` // p2p address of the pp node +// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` // wallet address of the pp node +// Slashing sdk.Int `json:"slashing" yaml:"slashing"` // uoz amount +// Suspend bool `json:"suspend" yaml:"suspend"` +//} func NewMsgSlashingResourceNode(reporters []stratos.SdsAddress, reporterOwner []sdk.AccAddress, - networkAddress stratos.SdsAddress, walletAddress sdk.AccAddress, slashing sdk.Int, suspend bool) MsgSlashingResourceNode { - return MsgSlashingResourceNode{ - Reporters: reporters, - ReporterOwner: reporterOwner, - NetworkAddress: networkAddress, - WalletAddress: walletAddress, - Slashing: slashing, + networkAddress stratos.SdsAddress, walletAddress sdk.AccAddress, slashing sdk.Int, suspend bool) *MsgSlashingResourceNode { + + reporterStrSlice := make([]string, len(reporters)) + for _, reporter := range reporters { + reporterStrSlice = append(reporterStrSlice, reporter.String()) + } + + reporterOwnerStrSlice := make([]string, len(reporterOwner)) + for _, reporterOwner := range reporterOwner { + reporterOwnerStrSlice = append(reporterOwnerStrSlice, reporterOwner.String()) + } + return &MsgSlashingResourceNode{ + Reporters: reporterStrSlice, + ReporterOwner: reporterOwnerStrSlice, + NetworkAddress: networkAddress.String(), + WalletAddress: walletAddress.String(), + Slashing: &slashing, Suspend: suspend, } } @@ -241,14 +267,14 @@ func (m MsgSlashingResourceNode) Type() string { } func (m MsgSlashingResourceNode) ValidateBasic() error { - if m.NetworkAddress.Empty() { + if len(m.NetworkAddress) == 0 { return ErrMissingTargetAddress } - if m.WalletAddress.Empty() { + if len(m.WalletAddress) == 0 { return ErrMissingWalletAddress } for _, r := range m.Reporters { - if r.Empty() { + if len(r) == 0 { return ErrReporterAddress } } @@ -265,5 +291,13 @@ func (m MsgSlashingResourceNode) GetSignBytes() []byte { } func (m MsgSlashingResourceNode) GetSigners() []sdk.AccAddress { - return m.ReporterOwner + var addrs []sdk.AccAddress + for _, owner := range m.ReporterOwner { + reporterOwner, err := sdk.AccAddressFromBech32(owner) + if err != nil { + continue + } + addrs = append(addrs, reporterOwner) + } + return addrs } diff --git a/x/pot/types/params.go b/x/pot/types/params.go index fe6f0694..af7e91ea 100644 --- a/x/pot/types/params.go +++ b/x/pot/types/params.go @@ -28,19 +28,21 @@ var ( var _ subspace.ParamSet = &Params{} -// Params - used for initializing default parameter for pot at genesis -type Params struct { - BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination - RewardDenom string `json:"reward_denom" yaml:"reward_denom"` - MatureEpoch int64 `json:"mature_epoch" yaml:"mature_epoch"` - MiningRewardParams []MiningRewardParam `json:"mining_reward_params" yaml:"mining_reward_params"` -} - -// ParamKeyTable for pot module +// +//// Params - used for initializing default parameter for pot at genesis +//type Params struct { +// BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination +// RewardDenom string `json:"reward_denom" yaml:"reward_denom"` +// MatureEpoch int64 `json:"mature_epoch" yaml:"mature_epoch"` +// MiningRewardParams []MiningRewardParam `json:"mining_reward_params" yaml:"mining_reward_params"` +//} +// +//// ParamKeyTable for pot module func ParamKeyTable() params.KeyTable { return params.NewKeyTable().RegisterParamSet(&Params{}) } +// // NewParams creates a new Params object func NewParams(bondDenom string, rewardDenom string, matureEpoch int64, miningRewardParams []MiningRewardParam) Params { return Params{ @@ -93,12 +95,12 @@ func DefaultParams() Params { } // String implements the stringer interface for Params -func (p Params) String() string { +func (p Params) HrpString() string { return fmt.Sprintf(`Params: BondDenom: %s - RewardDenom: %s + RewardDenom: %s MatureEpoch: %d - MiningRewardParams: %s`, + MiningRewardParams: %s`, p.BondDenom, p.RewardDenom, p.MatureEpoch, p.MiningRewardParams) } diff --git a/x/pot/types/pot.pb.go b/x/pot/types/pot.pb.go new file mode 100644 index 00000000..2c719a3f --- /dev/null +++ b/x/pot/types/pot.pb.go @@ -0,0 +1,2514 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/pot/v1/pot.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the PoT module parameters +type Params struct { + BondDenom string `protobuf:"bytes,1,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom" yaml:"bond_denom"` + RewardDenom string `protobuf:"bytes,2,opt,name=reward_denom,json=rewardDenom,proto3" json:"reward_denom" yaml:"reward_denom"` + MatureEpoch int64 `protobuf:"varint,3,opt,name=mature_epoch,json=matureEpoch,proto3" json:"mature_epoch" yaml:"mature_epoch"` + MiningRewardParams []*MiningRewardParam `protobuf:"bytes,4,rep,name=mining_reward_params,json=miningRewardParams,proto3" json:"mining_reward_params" yaml:"mining_reward_params"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetBondDenom() string { + if m != nil { + return m.BondDenom + } + return "" +} + +func (m *Params) GetRewardDenom() string { + if m != nil { + return m.RewardDenom + } + return "" +} + +func (m *Params) GetMatureEpoch() int64 { + if m != nil { + return m.MatureEpoch + } + return 0 +} + +func (m *Params) GetMiningRewardParams() []*MiningRewardParam { + if m != nil { + return m.MiningRewardParams + } + return nil +} + +type MiningRewardParam struct { + TotalMinedValveStart *types.Coin `protobuf:"bytes,1,opt,name=totalMinedValveStart,proto3" json:"totalMinedValveStart,omitempty" yaml:"total_mined_valve_start"` + TotalMinedValveEnd *types.Coin `protobuf:"bytes,2,opt,name=totalMinedValveEnd,proto3" json:"totalMinedValveEnd,omitempty" yaml:"total_mined_valve_end"` + MiningReward *types.Coin `protobuf:"bytes,3,opt,name=miningReward,proto3" json:"miningReward,omitempty" yaml:"mining_reward"` + BlockChainPercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=blockChainPercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"block_chain_percentage_in_ten_thousand" yaml:"block_chain_percentage_in_ten_thousand"` + ResourceNodePercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=resourceNodePercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"resource_node_percentage_in_ten_thousand" yaml:"resource_node_percentage_in_ten_thousand"` + MetaNodePercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=metaNodePercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"meta_node_percentage_in_ten_thousand" yaml:"meta_node_percentage_in_ten_thousand"` +} + +func (m *MiningRewardParam) Reset() { *m = MiningRewardParam{} } +func (m *MiningRewardParam) String() string { return proto.CompactTextString(m) } +func (*MiningRewardParam) ProtoMessage() {} +func (*MiningRewardParam) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{1} +} +func (m *MiningRewardParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MiningRewardParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MiningRewardParam.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 *MiningRewardParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_MiningRewardParam.Merge(m, src) +} +func (m *MiningRewardParam) XXX_Size() int { + return m.Size() +} +func (m *MiningRewardParam) XXX_DiscardUnknown() { + xxx_messageInfo_MiningRewardParam.DiscardUnknown(m) +} + +var xxx_messageInfo_MiningRewardParam proto.InternalMessageInfo + +func (m *MiningRewardParam) GetTotalMinedValveStart() *types.Coin { + if m != nil { + return m.TotalMinedValveStart + } + return nil +} + +func (m *MiningRewardParam) GetTotalMinedValveEnd() *types.Coin { + if m != nil { + return m.TotalMinedValveEnd + } + return nil +} + +func (m *MiningRewardParam) GetMiningReward() *types.Coin { + if m != nil { + return m.MiningReward + } + return nil +} + +type ImmatureTotal struct { + WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + Value github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=value,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"value"` +} + +func (m *ImmatureTotal) Reset() { *m = ImmatureTotal{} } +func (m *ImmatureTotal) String() string { return proto.CompactTextString(m) } +func (*ImmatureTotal) ProtoMessage() {} +func (*ImmatureTotal) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{2} +} +func (m *ImmatureTotal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImmatureTotal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImmatureTotal.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 *ImmatureTotal) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImmatureTotal.Merge(m, src) +} +func (m *ImmatureTotal) XXX_Size() int { + return m.Size() +} +func (m *ImmatureTotal) XXX_DiscardUnknown() { + xxx_messageInfo_ImmatureTotal.DiscardUnknown(m) +} + +var xxx_messageInfo_ImmatureTotal proto.InternalMessageInfo + +func (m *ImmatureTotal) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +func (m *ImmatureTotal) GetValue() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Value + } + return nil +} + +type MatureTotal struct { + WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + Value github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=value,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"value"` +} + +func (m *MatureTotal) Reset() { *m = MatureTotal{} } +func (m *MatureTotal) String() string { return proto.CompactTextString(m) } +func (*MatureTotal) ProtoMessage() {} +func (*MatureTotal) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{3} +} +func (m *MatureTotal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MatureTotal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MatureTotal.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 *MatureTotal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MatureTotal.Merge(m, src) +} +func (m *MatureTotal) XXX_Size() int { + return m.Size() +} +func (m *MatureTotal) XXX_DiscardUnknown() { + xxx_messageInfo_MatureTotal.DiscardUnknown(m) +} + +var xxx_messageInfo_MatureTotal proto.InternalMessageInfo + +func (m *MatureTotal) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +func (m *MatureTotal) GetValue() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Value + } + return nil +} + +type Reward struct { + WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + RewardFromMiningPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=rewardFromMiningPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_from_mining_pool" yaml:"reward_from_mining_pool"` + RewardFromTrafficPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=rewardFromTrafficPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_from_traffic_pool" yaml:"reward_from_traffic_pool"` +} + +func (m *Reward) Reset() { *m = Reward{} } +func (m *Reward) String() string { return proto.CompactTextString(m) } +func (*Reward) ProtoMessage() {} +func (*Reward) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{4} +} +func (m *Reward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Reward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Reward.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 *Reward) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reward.Merge(m, src) +} +func (m *Reward) XXX_Size() int { + return m.Size() +} +func (m *Reward) XXX_DiscardUnknown() { + xxx_messageInfo_Reward.DiscardUnknown(m) +} + +var xxx_messageInfo_Reward proto.InternalMessageInfo + +func (m *Reward) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +func (m *Reward) GetRewardFromMiningPool() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.RewardFromMiningPool + } + return nil +} + +func (m *Reward) GetRewardFromTrafficPool() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.RewardFromTrafficPool + } + return nil +} + +type SingleWalletVolume struct { + WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + Volume *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=volume,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"volume" yaml:"volume"` +} + +func (m *SingleWalletVolume) Reset() { *m = SingleWalletVolume{} } +func (m *SingleWalletVolume) String() string { return proto.CompactTextString(m) } +func (*SingleWalletVolume) ProtoMessage() {} +func (*SingleWalletVolume) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{5} +} +func (m *SingleWalletVolume) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SingleWalletVolume) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SingleWalletVolume.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 *SingleWalletVolume) XXX_Merge(src proto.Message) { + xxx_messageInfo_SingleWalletVolume.Merge(m, src) +} +func (m *SingleWalletVolume) XXX_Size() int { + return m.Size() +} +func (m *SingleWalletVolume) XXX_DiscardUnknown() { + xxx_messageInfo_SingleWalletVolume.DiscardUnknown(m) +} + +var xxx_messageInfo_SingleWalletVolume proto.InternalMessageInfo + +func (m *SingleWalletVolume) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +type VolumeReportRecord struct { + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` + ReportReference string `protobuf:"bytes,2,opt,name=reportReference,proto3" json:"report_reference" yaml:"report_reference"` + TxHash string `protobuf:"bytes,3,opt,name=txHash,proto3" json:"tx_hash" yaml:"tx_hash"` +} + +func (m *VolumeReportRecord) Reset() { *m = VolumeReportRecord{} } +func (m *VolumeReportRecord) String() string { return proto.CompactTextString(m) } +func (*VolumeReportRecord) ProtoMessage() {} +func (*VolumeReportRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{6} +} +func (m *VolumeReportRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VolumeReportRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VolumeReportRecord.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 *VolumeReportRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_VolumeReportRecord.Merge(m, src) +} +func (m *VolumeReportRecord) XXX_Size() int { + return m.Size() +} +func (m *VolumeReportRecord) XXX_DiscardUnknown() { + xxx_messageInfo_VolumeReportRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_VolumeReportRecord proto.InternalMessageInfo + +func (m *VolumeReportRecord) GetReporter() string { + if m != nil { + return m.Reporter + } + return "" +} + +func (m *VolumeReportRecord) GetReportReference() string { + if m != nil { + return m.ReportReference + } + return "" +} + +func (m *VolumeReportRecord) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + +type BLSSignatureInfo struct { + PubKeys [][]byte `protobuf:"bytes,1,rep,name=pubKeys,proto3" json:"pub_keys" yaml:"pub_keys"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature" yaml:"signature"` + TxData []byte `protobuf:"bytes,3,opt,name=txData,proto3" json:"tx_data" yaml:"tx_data"` +} + +func (m *BLSSignatureInfo) Reset() { *m = BLSSignatureInfo{} } +func (m *BLSSignatureInfo) String() string { return proto.CompactTextString(m) } +func (*BLSSignatureInfo) ProtoMessage() {} +func (*BLSSignatureInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_a05930b44d981057, []int{7} +} +func (m *BLSSignatureInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BLSSignatureInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BLSSignatureInfo.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 *BLSSignatureInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_BLSSignatureInfo.Merge(m, src) +} +func (m *BLSSignatureInfo) XXX_Size() int { + return m.Size() +} +func (m *BLSSignatureInfo) XXX_DiscardUnknown() { + xxx_messageInfo_BLSSignatureInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_BLSSignatureInfo proto.InternalMessageInfo + +func (m *BLSSignatureInfo) GetPubKeys() [][]byte { + if m != nil { + return m.PubKeys + } + return nil +} + +func (m *BLSSignatureInfo) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *BLSSignatureInfo) GetTxData() []byte { + if m != nil { + return m.TxData + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "stratos.pot.v1.Params") + proto.RegisterType((*MiningRewardParam)(nil), "stratos.pot.v1.MiningRewardParam") + proto.RegisterType((*ImmatureTotal)(nil), "stratos.pot.v1.ImmatureTotal") + proto.RegisterType((*MatureTotal)(nil), "stratos.pot.v1.MatureTotal") + proto.RegisterType((*Reward)(nil), "stratos.pot.v1.Reward") + proto.RegisterType((*SingleWalletVolume)(nil), "stratos.pot.v1.SingleWalletVolume") + proto.RegisterType((*VolumeReportRecord)(nil), "stratos.pot.v1.VolumeReportRecord") + proto.RegisterType((*BLSSignatureInfo)(nil), "stratos.pot.v1.BLSSignatureInfo") +} + +func init() { proto.RegisterFile("stratos/pot/v1/pot.proto", fileDescriptor_a05930b44d981057) } + +var fileDescriptor_a05930b44d981057 = []byte{ + // 1064 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcf, 0x6f, 0x1c, 0xb5, + 0x17, 0xcf, 0x74, 0xdb, 0xcd, 0x37, 0xce, 0x8f, 0xa6, 0xfe, 0xa6, 0xea, 0x52, 0x60, 0x9d, 0xb8, + 0xa8, 0xac, 0x54, 0x65, 0x87, 0x14, 0x21, 0x04, 0x1c, 0x10, 0xdb, 0x06, 0x11, 0x20, 0x28, 0x4c, + 0xa2, 0x56, 0x20, 0xa1, 0x91, 0x77, 0xc6, 0xd9, 0x8c, 0x32, 0x63, 0x2f, 0x1e, 0xef, 0x36, 0x39, + 0x72, 0xe0, 0x80, 0xc4, 0x81, 0xbf, 0x83, 0xbf, 0x81, 0x03, 0x12, 0x02, 0xf5, 0xc0, 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, + 0x74, 0xe4, 0x80, 0xd6, 0x91, 0x3b, 0x37, 0x36, 0x1e, 0x1f, 0x55, 0x9d, 0x27, 0x47, 0x55, 0xe7, + 0xef, 0xa3, 0xaa, 0xf3, 0xcd, 0x71, 0x75, 0xea, 0xc9, 0x71, 0x75, 0xea, 0xb7, 0xe3, 0xea, 0xd4, + 0xa7, 0xee, 0xd0, 0x95, 0xb0, 0xc3, 0x24, 0xa3, 0xb2, 0xf8, 0x5c, 0xd5, 0x03, 0x81, 0x7b, 0xa0, + 0xc7, 0x78, 0x7d, 0x3f, 0x9a, 0x65, 0x3d, 0x80, 0xbf, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x0c, 0xe2, 0xbf, 0x58, 0xe2, 0x0b, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MiningRewardParams) > 0 { + for iNdEx := len(m.MiningRewardParams) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MiningRewardParams[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.MatureEpoch != 0 { + i = encodeVarintPot(dAtA, i, uint64(m.MatureEpoch)) + i-- + dAtA[i] = 0x18 + } + if len(m.RewardDenom) > 0 { + i -= len(m.RewardDenom) + copy(dAtA[i:], m.RewardDenom) + i = encodeVarintPot(dAtA, i, uint64(len(m.RewardDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.BondDenom) > 0 { + i -= len(m.BondDenom) + copy(dAtA[i:], m.BondDenom) + i = encodeVarintPot(dAtA, i, uint64(len(m.BondDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MiningRewardParam) 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 *MiningRewardParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MiningRewardParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MetaNodePercentageInTenThousand != nil { + { + size := m.MetaNodePercentageInTenThousand.Size() + i -= size + if _, err := m.MetaNodePercentageInTenThousand.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.ResourceNodePercentageInTenThousand != nil { + { + size := m.ResourceNodePercentageInTenThousand.Size() + i -= size + if _, err := m.ResourceNodePercentageInTenThousand.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.BlockChainPercentageInTenThousand != nil { + { + size := m.BlockChainPercentageInTenThousand.Size() + i -= size + if _, err := m.BlockChainPercentageInTenThousand.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.MiningReward != nil { + { + size, err := m.MiningReward.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.TotalMinedValveEnd != nil { + { + size, err := m.TotalMinedValveEnd.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.TotalMinedValveStart != nil { + { + size, err := m.TotalMinedValveStart.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImmatureTotal) 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 *ImmatureTotal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImmatureTotal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Value[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintPot(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MatureTotal) 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 *MatureTotal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MatureTotal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Value[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintPot(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Reward) 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 *Reward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Reward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RewardFromTrafficPool) > 0 { + for iNdEx := len(m.RewardFromTrafficPool) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardFromTrafficPool[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.RewardFromMiningPool) > 0 { + for iNdEx := len(m.RewardFromMiningPool) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardFromMiningPool[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintPot(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SingleWalletVolume) 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 *SingleWalletVolume) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SingleWalletVolume) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Volume != nil { + { + size := m.Volume.Size() + i -= size + if _, err := m.Volume.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPot(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintPot(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VolumeReportRecord) 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 *VolumeReportRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VolumeReportRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintPot(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.ReportReference) > 0 { + i -= len(m.ReportReference) + copy(dAtA[i:], m.ReportReference) + i = encodeVarintPot(dAtA, i, uint64(len(m.ReportReference))) + i-- + dAtA[i] = 0x12 + } + if len(m.Reporter) > 0 { + i -= len(m.Reporter) + copy(dAtA[i:], m.Reporter) + i = encodeVarintPot(dAtA, i, uint64(len(m.Reporter))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BLSSignatureInfo) 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 *BLSSignatureInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BLSSignatureInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxData) > 0 { + i -= len(m.TxData) + copy(dAtA[i:], m.TxData) + i = encodeVarintPot(dAtA, i, uint64(len(m.TxData))) + i-- + dAtA[i] = 0x1a + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintPot(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.PubKeys) > 0 { + for iNdEx := len(m.PubKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PubKeys[iNdEx]) + copy(dAtA[i:], m.PubKeys[iNdEx]) + i = encodeVarintPot(dAtA, i, uint64(len(m.PubKeys[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintPot(dAtA []byte, offset int, v uint64) int { + offset -= sovPot(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + l = len(m.RewardDenom) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + if m.MatureEpoch != 0 { + n += 1 + sovPot(uint64(m.MatureEpoch)) + } + if len(m.MiningRewardParams) > 0 { + for _, e := range m.MiningRewardParams { + l = e.Size() + n += 1 + l + sovPot(uint64(l)) + } + } + return n +} + +func (m *MiningRewardParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TotalMinedValveStart != nil { + l = m.TotalMinedValveStart.Size() + n += 1 + l + sovPot(uint64(l)) + } + if m.TotalMinedValveEnd != nil { + l = m.TotalMinedValveEnd.Size() + n += 1 + l + sovPot(uint64(l)) + } + if m.MiningReward != nil { + l = m.MiningReward.Size() + n += 1 + l + sovPot(uint64(l)) + } + if m.BlockChainPercentageInTenThousand != nil { + l = m.BlockChainPercentageInTenThousand.Size() + n += 1 + l + sovPot(uint64(l)) + } + if m.ResourceNodePercentageInTenThousand != nil { + l = m.ResourceNodePercentageInTenThousand.Size() + n += 1 + l + sovPot(uint64(l)) + } + if m.MetaNodePercentageInTenThousand != nil { + l = m.MetaNodePercentageInTenThousand.Size() + n += 1 + l + sovPot(uint64(l)) + } + return n +} + +func (m *ImmatureTotal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + if len(m.Value) > 0 { + for _, e := range m.Value { + l = e.Size() + n += 1 + l + sovPot(uint64(l)) + } + } + return n +} + +func (m *MatureTotal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + if len(m.Value) > 0 { + for _, e := range m.Value { + l = e.Size() + n += 1 + l + sovPot(uint64(l)) + } + } + return n +} + +func (m *Reward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + if len(m.RewardFromMiningPool) > 0 { + for _, e := range m.RewardFromMiningPool { + l = e.Size() + n += 1 + l + sovPot(uint64(l)) + } + } + if len(m.RewardFromTrafficPool) > 0 { + for _, e := range m.RewardFromTrafficPool { + l = e.Size() + n += 1 + l + sovPot(uint64(l)) + } + } + return n +} + +func (m *SingleWalletVolume) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + if m.Volume != nil { + l = m.Volume.Size() + n += 1 + l + sovPot(uint64(l)) + } + return n +} + +func (m *VolumeReportRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Reporter) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + l = len(m.ReportReference) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + return n +} + +func (m *BLSSignatureInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PubKeys) > 0 { + for _, b := range m.PubKeys { + l = len(b) + n += 1 + l + sovPot(uint64(l)) + } + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + l = len(m.TxData) + if l > 0 { + n += 1 + l + sovPot(uint64(l)) + } + return n +} + +func sovPot(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPot(x uint64) (n int) { + return sovPot(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MatureEpoch", wireType) + } + m.MatureEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MatureEpoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MiningRewardParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MiningRewardParams = append(m.MiningRewardParams, &MiningRewardParam{}) + if err := m.MiningRewardParams[len(m.MiningRewardParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MiningRewardParam) 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 ErrIntOverflowPot + } + 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: MiningRewardParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MiningRewardParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMinedValveStart", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TotalMinedValveStart == nil { + m.TotalMinedValveStart = &types.Coin{} + } + if err := m.TotalMinedValveStart.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMinedValveEnd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TotalMinedValveEnd == nil { + m.TotalMinedValveEnd = &types.Coin{} + } + if err := m.TotalMinedValveEnd.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MiningReward", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MiningReward == nil { + m.MiningReward = &types.Coin{} + } + if err := m.MiningReward.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockChainPercentageInTenThousand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.BlockChainPercentageInTenThousand = &v + if err := m.BlockChainPercentageInTenThousand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNodePercentageInTenThousand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.ResourceNodePercentageInTenThousand = &v + if err := m.ResourceNodePercentageInTenThousand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaNodePercentageInTenThousand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.MetaNodePercentageInTenThousand = &v + if err := m.MetaNodePercentageInTenThousand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImmatureTotal) 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 ErrIntOverflowPot + } + 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: ImmatureTotal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImmatureTotal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value, types.Coin{}) + if err := m.Value[len(m.Value)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MatureTotal) 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 ErrIntOverflowPot + } + 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: MatureTotal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MatureTotal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value, types.Coin{}) + if err := m.Value[len(m.Value)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Reward) 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 ErrIntOverflowPot + } + 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: Reward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Reward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardFromMiningPool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardFromMiningPool = append(m.RewardFromMiningPool, types.Coin{}) + if err := m.RewardFromMiningPool[len(m.RewardFromMiningPool)-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 RewardFromTrafficPool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardFromTrafficPool = append(m.RewardFromTrafficPool, types.Coin{}) + if err := m.RewardFromTrafficPool[len(m.RewardFromTrafficPool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SingleWalletVolume) 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 ErrIntOverflowPot + } + 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: SingleWalletVolume: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SingleWalletVolume: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Volume", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.Volume = &v + if err := m.Volume.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VolumeReportRecord) 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 ErrIntOverflowPot + } + 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: VolumeReportRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VolumeReportRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reporter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReportReference", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReportReference = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + 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 ErrInvalidLengthPot + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BLSSignatureInfo) 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 ErrIntOverflowPot + } + 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: BLSSignatureInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BLSSignatureInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKeys", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKeys = append(m.PubKeys, make([]byte, postIndex-iNdEx)) + copy(m.PubKeys[len(m.PubKeys)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPot + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPot + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxData = append(m.TxData[:0], dAtA[iNdEx:postIndex]...) + if m.TxData == nil { + m.TxData = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPot(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPot(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, ErrIntOverflowPot + } + 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, ErrIntOverflowPot + } + 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, ErrIntOverflowPot + } + 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, ErrInvalidLengthPot + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPot + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPot + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPot = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPot = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPot = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pot/types/querier.go b/x/pot/types/querier.go index 7b4a31c4..d73cbfe7 100644 --- a/x/pot/types/querier.go +++ b/x/pot/types/querier.go @@ -62,10 +62,10 @@ func NewQueryPotRewardsByWalletAddrParams(page, limit int, walletAddr sdk.AccAdd } } -type ReportInfo struct { - Epoch sdk.Int - Reference string -} +//type ReportInfo struct { +// Epoch sdk.Int +// Reference string +//} func NewReportInfo(epoch sdk.Int, reference string) ReportInfo { return ReportInfo{ diff --git a/x/pot/types/query.pb.go b/x/pot/types/query.pb.go new file mode 100644 index 00000000..54c5f6c9 --- /dev/null +++ b/x/pot/types/query.pb.go @@ -0,0 +1,864 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/pot/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryVolumeReportRequest is request type for the Query/VolumeReport RPC method +type QueryVolumeReportRequest struct { + // epoch defines the epoch number to query for. + Epoch *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=epoch,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"epoch,omitempty"` +} + +func (m *QueryVolumeReportRequest) Reset() { *m = QueryVolumeReportRequest{} } +func (m *QueryVolumeReportRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVolumeReportRequest) ProtoMessage() {} +func (*QueryVolumeReportRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{0} +} +func (m *QueryVolumeReportRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVolumeReportRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVolumeReportRequest.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 *QueryVolumeReportRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVolumeReportRequest.Merge(m, src) +} +func (m *QueryVolumeReportRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVolumeReportRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVolumeReportRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVolumeReportRequest proto.InternalMessageInfo + +type ReportInfo struct { + Epoch string `protobuf:"bytes,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // [ + // (gogoproto.jsontag) = "epoch", + // (gogoproto.moretags) = "yaml:\"epoch\"", + // (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" + // ]; + Reference string `protobuf:"bytes,2,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (m *ReportInfo) Reset() { *m = ReportInfo{} } +func (m *ReportInfo) String() string { return proto.CompactTextString(m) } +func (*ReportInfo) ProtoMessage() {} +func (*ReportInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{1} +} +func (m *ReportInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ReportInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ReportInfo.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 *ReportInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReportInfo.Merge(m, src) +} +func (m *ReportInfo) XXX_Size() int { + return m.Size() +} +func (m *ReportInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ReportInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ReportInfo proto.InternalMessageInfo + +func (m *ReportInfo) GetEpoch() string { + if m != nil { + return m.Epoch + } + return "" +} + +func (m *ReportInfo) GetReference() string { + if m != nil { + return m.Reference + } + return "" +} + +// QueryVolumeReportResponse is response type for the Query/ResourceNode RPC method +type QueryVolumeReportResponse struct { + // node defines the the volumeReport info. + ReportInfo *ReportInfo `protobuf:"bytes,1,opt,name=reportInfo,proto3" json:"reportInfo,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryVolumeReportResponse) Reset() { *m = QueryVolumeReportResponse{} } +func (m *QueryVolumeReportResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVolumeReportResponse) ProtoMessage() {} +func (*QueryVolumeReportResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{2} +} +func (m *QueryVolumeReportResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVolumeReportResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVolumeReportResponse.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 *QueryVolumeReportResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVolumeReportResponse.Merge(m, src) +} +func (m *QueryVolumeReportResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVolumeReportResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVolumeReportResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVolumeReportResponse proto.InternalMessageInfo + +func (m *QueryVolumeReportResponse) GetReportInfo() *ReportInfo { + if m != nil { + return m.ReportInfo + } + return nil +} + +func (m *QueryVolumeReportResponse) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func init() { + proto.RegisterType((*QueryVolumeReportRequest)(nil), "stratos.pot.v1.QueryVolumeReportRequest") + proto.RegisterType((*ReportInfo)(nil), "stratos.pot.v1.ReportInfo") + proto.RegisterType((*QueryVolumeReportResponse)(nil), "stratos.pot.v1.QueryVolumeReportResponse") +} + +func init() { proto.RegisterFile("stratos/pot/v1/query.proto", fileDescriptor_c09bd09df76a68e0) } + +var fileDescriptor_c09bd09df76a68e0 = []byte{ + // 375 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x4b, 0xe3, 0x40, + 0x14, 0xc7, 0x9b, 0x2e, 0x2d, 0x74, 0x76, 0xd9, 0xc3, 0x50, 0x96, 0x6e, 0x28, 0xd9, 0x25, 0xa0, + 0x56, 0x21, 0x19, 0x5a, 0x6f, 0x9e, 0x4a, 0x6f, 0x3d, 0x9a, 0x83, 0x07, 0xf1, 0x92, 0xc6, 0xd7, + 0x24, 0xd8, 0xce, 0x9b, 0x66, 0x26, 0xc5, 0x22, 0x5e, 0xfc, 0x0b, 0x44, 0xaf, 0xfe, 0x41, 0x1e, + 0x0b, 0x5e, 0xc4, 0x83, 0x48, 0xeb, 0x1f, 0x22, 0x9d, 0x44, 0xfb, 0x03, 0x05, 0x4f, 0xf3, 0x66, + 0xbe, 0xdf, 0xf9, 0xbc, 0x37, 0xef, 0x0d, 0x31, 0xa5, 0x4a, 0x7c, 0x85, 0x92, 0x09, 0x54, 0x6c, + 0xdc, 0x64, 0xa3, 0x14, 0x92, 0x89, 0x2b, 0x12, 0x54, 0x48, 0x7f, 0xe7, 0x9a, 0x2b, 0x50, 0xb9, + 0xe3, 0xa6, 0x59, 0x0d, 0x31, 0x44, 0x2d, 0xb1, 0x45, 0x94, 0xb9, 0xcc, 0x7a, 0x88, 0x18, 0x0e, + 0x80, 0xf9, 0x22, 0x66, 0x3e, 0xe7, 0xa8, 0x7c, 0x15, 0x23, 0x97, 0x99, 0x6a, 0x9f, 0x90, 0xda, + 0xe1, 0x02, 0x79, 0x84, 0x83, 0x74, 0x08, 0x1e, 0x08, 0x4c, 0x94, 0x07, 0xa3, 0x14, 0xa4, 0xa2, + 0x6d, 0x52, 0x02, 0x81, 0x41, 0x54, 0x33, 0xfe, 0x1b, 0x8d, 0x4a, 0x67, 0xef, 0xe9, 0xf9, 0xdf, + 0x76, 0x18, 0xab, 0x28, 0xed, 0xb9, 0x01, 0x0e, 0x59, 0x80, 0x72, 0x88, 0x32, 0x5f, 0x1c, 0x79, + 0x7a, 0xc6, 0xd4, 0x44, 0x80, 0x74, 0xbb, 0x5c, 0x79, 0xd9, 0x45, 0xbb, 0x4d, 0x48, 0x86, 0xec, + 0xf2, 0x3e, 0xd2, 0xea, 0x1a, 0x2f, 0xf7, 0xd0, 0x3a, 0xa9, 0x24, 0xd0, 0x87, 0x04, 0x78, 0x00, + 0xb5, 0xa2, 0x56, 0x96, 0x07, 0x36, 0x92, 0xbf, 0x9f, 0xd4, 0x27, 0x05, 0x72, 0x09, 0xf4, 0x80, + 0x90, 0xe4, 0x03, 0xaf, 0xa9, 0x3f, 0x5b, 0xa6, 0xbb, 0xde, 0x15, 0x77, 0x59, 0x80, 0xb7, 0xe2, + 0xa6, 0x7f, 0x48, 0x39, 0x82, 0x38, 0x8c, 0x94, 0xce, 0xf9, 0xc3, 0xcb, 0x77, 0xad, 0x3b, 0x83, + 0x94, 0x74, 0x46, 0x7a, 0x63, 0x90, 0x5f, 0xab, 0x69, 0x69, 0x63, 0x13, 0xfd, 0x55, 0xe7, 0xcc, + 0xdd, 0x6f, 0x38, 0xb3, 0x37, 0xd8, 0xce, 0xd5, 0xc3, 0xeb, 0x6d, 0x71, 0x87, 0x6e, 0xb1, 0x8d, + 0x49, 0x8f, 0xb5, 0xdb, 0xc9, 0x4a, 0x66, 0x17, 0xba, 0x59, 0x97, 0x9d, 0xee, 0xfd, 0xcc, 0x32, + 0xa6, 0x33, 0xcb, 0x78, 0x99, 0x59, 0xc6, 0xf5, 0xdc, 0x2a, 0x4c, 0xe7, 0x56, 0xe1, 0x71, 0x6e, + 0x15, 0x8e, 0xd9, 0xca, 0x68, 0x72, 0x14, 0x07, 0xf5, 0x1e, 0x3a, 0x41, 0xe4, 0xc7, 0x9c, 0x9d, + 0x6b, 0xba, 0x9e, 0x53, 0xaf, 0xac, 0x7f, 0xc0, 0xfe, 0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5c, + 0x37, 0x55, 0x73, 0x63, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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 { + // VolumeReport queries VolumeReport info for given epoch. + VolumeReport(ctx context.Context, in *QueryVolumeReportRequest, opts ...grpc.CallOption) (*QueryVolumeReportResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) VolumeReport(ctx context.Context, in *QueryVolumeReportRequest, opts ...grpc.CallOption) (*QueryVolumeReportResponse, error) { + out := new(QueryVolumeReportResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Query/VolumeReport", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // VolumeReport queries VolumeReport info for given epoch. + VolumeReport(context.Context, *QueryVolumeReportRequest) (*QueryVolumeReportResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) VolumeReport(ctx context.Context, req *QueryVolumeReportRequest) (*QueryVolumeReportResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VolumeReport not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_VolumeReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVolumeReportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).VolumeReport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Query/VolumeReport", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).VolumeReport(ctx, req.(*QueryVolumeReportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.pot.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "VolumeReport", + Handler: _Query_VolumeReport_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/pot/v1/query.proto", +} + +func (m *QueryVolumeReportRequest) 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 *QueryVolumeReportRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVolumeReportRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Epoch != nil { + { + size := m.Epoch.Size() + i -= size + if _, err := m.Epoch.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ReportInfo) 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 *ReportInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReportInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Reference) > 0 { + i -= len(m.Reference) + copy(dAtA[i:], m.Reference) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Reference))) + i-- + dAtA[i] = 0x12 + } + if len(m.Epoch) > 0 { + i -= len(m.Epoch) + copy(dAtA[i:], m.Epoch) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Epoch))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryVolumeReportResponse) 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 *QueryVolumeReportResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVolumeReportResponse) 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] = 0x10 + } + if m.ReportInfo != nil { + { + size, err := m.ReportInfo.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 *QueryVolumeReportRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != nil { + l = m.Epoch.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *ReportInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Epoch) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Reference) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVolumeReportResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ReportInfo != nil { + l = m.ReportInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + 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 *QueryVolumeReportRequest) 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: QueryVolumeReportRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVolumeReportRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", 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 + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.Epoch = &v + if err := m.Epoch.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 *ReportInfo) 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: ReportInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReportInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", 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.Epoch = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reference", 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.Reference = 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 *QueryVolumeReportResponse) 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: QueryVolumeReportResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVolumeReportResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReportInfo", 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.ReportInfo == nil { + m.ReportInfo = &ReportInfo{} + } + if err := m.ReportInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + 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 |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func 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/pot/types/query.pb.gw.go b/x/pot/types/query.pb.gw.go new file mode 100644 index 00000000..827fc9ea --- /dev/null +++ b/x/pot/types/query.pb.gw.go @@ -0,0 +1,184 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/pot/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/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 + +func request_Query_VolumeReport_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVolumeReportRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", err) + } + + msg, err := client.VolumeReport(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_VolumeReport_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVolumeReportRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", err) + } + + msg, err := server.VolumeReport(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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_VolumeReport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_VolumeReport_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VolumeReport_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_VolumeReport_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_VolumeReport_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_VolumeReport_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_VolumeReport_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "pot", "v1", "volume-report", "epoch"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_VolumeReport_0 = runtime.ForwardResponseMessage +) diff --git a/x/pot/types/tx.pb.go b/x/pot/types/tx.pb.go new file mode 100644 index 00000000..5b28bfc2 --- /dev/null +++ b/x/pot/types/tx.pb.go @@ -0,0 +1,2263 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stratos/pot/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgVolumeReport encapsulates an VolumeReport transaction as an SDK message. +type MsgVolumeReport struct { + WalletVolumes []*SingleWalletVolume `protobuf:"bytes,1,rep,name=walletVolumes,proto3" json:"wallet_volumes" yaml:"wallet_volumes"` + Reporter string `protobuf:"bytes,2,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` + Epoch *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=epoch,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"epoch" yaml:"epoch"` + ReportReference string `protobuf:"bytes,4,opt,name=reportReference,proto3" json:"report_reference" yaml:"report_reference"` + ReporterOwner string `protobuf:"bytes,5,opt,name=reporterOwner,proto3" json:"reporter_owner" yaml:"reporter_owner"` + BLSSignature *BLSSignatureInfo `protobuf:"bytes,6,opt,name=bLSSignature,proto3" json:"bls_signature" yaml:"bls_signature"` +} + +func (m *MsgVolumeReport) Reset() { *m = MsgVolumeReport{} } +func (m *MsgVolumeReport) String() string { return proto.CompactTextString(m) } +func (*MsgVolumeReport) ProtoMessage() {} +func (*MsgVolumeReport) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{0} +} +func (m *MsgVolumeReport) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVolumeReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVolumeReport.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 *MsgVolumeReport) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVolumeReport.Merge(m, src) +} +func (m *MsgVolumeReport) XXX_Size() int { + return m.Size() +} +func (m *MsgVolumeReport) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVolumeReport.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVolumeReport proto.InternalMessageInfo + +func (m *MsgVolumeReport) GetWalletVolumes() []*SingleWalletVolume { + if m != nil { + return m.WalletVolumes + } + return nil +} + +func (m *MsgVolumeReport) GetReporter() string { + if m != nil { + return m.Reporter + } + return "" +} + +func (m *MsgVolumeReport) GetReportReference() string { + if m != nil { + return m.ReportReference + } + return "" +} + +func (m *MsgVolumeReport) GetReporterOwner() string { + if m != nil { + return m.ReporterOwner + } + return "" +} + +func (m *MsgVolumeReport) GetBLSSignature() *BLSSignatureInfo { + if m != nil { + return m.BLSSignature + } + return nil +} + +// MsgVolumeReportResponse defines the MsgVolumeReport response type +type MsgVolumeReportResponse struct { +} + +func (m *MsgVolumeReportResponse) Reset() { *m = MsgVolumeReportResponse{} } +func (m *MsgVolumeReportResponse) String() string { return proto.CompactTextString(m) } +func (*MsgVolumeReportResponse) ProtoMessage() {} +func (*MsgVolumeReportResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{1} +} +func (m *MsgVolumeReportResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVolumeReportResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVolumeReportResponse.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 *MsgVolumeReportResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVolumeReportResponse.Merge(m, src) +} +func (m *MsgVolumeReportResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgVolumeReportResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVolumeReportResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVolumeReportResponse proto.InternalMessageInfo + +// MsgWithdraw encapsulates an withdraw transaction as an SDK message. +type MsgWithdraw struct { + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=Amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` + WalletAddress string `protobuf:"bytes,2,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + TargetAddress string `protobuf:"bytes,3,opt,name=targetAddress,proto3" json:"target_address" yaml:"target_address"` +} + +func (m *MsgWithdraw) Reset() { *m = MsgWithdraw{} } +func (m *MsgWithdraw) String() string { return proto.CompactTextString(m) } +func (*MsgWithdraw) ProtoMessage() {} +func (*MsgWithdraw) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{2} +} +func (m *MsgWithdraw) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdraw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdraw.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 *MsgWithdraw) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdraw.Merge(m, src) +} +func (m *MsgWithdraw) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdraw) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdraw.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdraw proto.InternalMessageInfo + +func (m *MsgWithdraw) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +func (m *MsgWithdraw) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +func (m *MsgWithdraw) GetTargetAddress() string { + if m != nil { + return m.TargetAddress + } + return "" +} + +// MsgWithdrawResponse defines the Msg/MsgWithdraw response type. +type MsgWithdrawResponse struct { +} + +func (m *MsgWithdrawResponse) Reset() { *m = MsgWithdrawResponse{} } +func (m *MsgWithdrawResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawResponse) ProtoMessage() {} +func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{3} +} +func (m *MsgWithdrawResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawResponse.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 *MsgWithdrawResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawResponse.Merge(m, src) +} +func (m *MsgWithdrawResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawResponse proto.InternalMessageInfo + +// MsgFoundationDeposit - encapsulates an FoundationDeposit transaction as an SDK message +type MsgFoundationDeposit struct { + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=Amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` + From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from" yaml:"from"` +} + +func (m *MsgFoundationDeposit) Reset() { *m = MsgFoundationDeposit{} } +func (m *MsgFoundationDeposit) String() string { return proto.CompactTextString(m) } +func (*MsgFoundationDeposit) ProtoMessage() {} +func (*MsgFoundationDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{4} +} +func (m *MsgFoundationDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFoundationDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFoundationDeposit.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 *MsgFoundationDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFoundationDeposit.Merge(m, src) +} +func (m *MsgFoundationDeposit) XXX_Size() int { + return m.Size() +} +func (m *MsgFoundationDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFoundationDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFoundationDeposit proto.InternalMessageInfo + +func (m *MsgFoundationDeposit) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +func (m *MsgFoundationDeposit) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +// MsgFoundationDepositResponse defines the MsgFoundationDeposit response type +type MsgFoundationDepositResponse struct { +} + +func (m *MsgFoundationDepositResponse) Reset() { *m = MsgFoundationDepositResponse{} } +func (m *MsgFoundationDepositResponse) String() string { return proto.CompactTextString(m) } +func (*MsgFoundationDepositResponse) ProtoMessage() {} +func (*MsgFoundationDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{5} +} +func (m *MsgFoundationDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFoundationDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFoundationDepositResponse.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 *MsgFoundationDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFoundationDepositResponse.Merge(m, src) +} +func (m *MsgFoundationDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgFoundationDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFoundationDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFoundationDepositResponse proto.InternalMessageInfo + +// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message +type MsgSlashingResourceNode struct { + Reporters []string `protobuf:"bytes,1,rep,name=reporters,proto3" json:"reporters" yaml:"reporters"` + ReporterOwner []string `protobuf:"bytes,2,rep,name=reporterOwner,proto3" json:"reporter_owner" yaml:"reporter_owner"` + NetworkAddress string `protobuf:"bytes,3,opt,name=networkAddress,proto3" json:"network_address" yaml:"network_address"` + WalletAddress string `protobuf:"bytes,4,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + Slashing *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=slashing,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"slashing" yaml:"slashing"` + Suspend bool `protobuf:"varint,6,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` +} + +func (m *MsgSlashingResourceNode) Reset() { *m = MsgSlashingResourceNode{} } +func (m *MsgSlashingResourceNode) String() string { return proto.CompactTextString(m) } +func (*MsgSlashingResourceNode) ProtoMessage() {} +func (*MsgSlashingResourceNode) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{6} +} +func (m *MsgSlashingResourceNode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSlashingResourceNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSlashingResourceNode.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 *MsgSlashingResourceNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSlashingResourceNode.Merge(m, src) +} +func (m *MsgSlashingResourceNode) XXX_Size() int { + return m.Size() +} +func (m *MsgSlashingResourceNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSlashingResourceNode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSlashingResourceNode proto.InternalMessageInfo + +func (m *MsgSlashingResourceNode) GetReporters() []string { + if m != nil { + return m.Reporters + } + return nil +} + +func (m *MsgSlashingResourceNode) GetReporterOwner() []string { + if m != nil { + return m.ReporterOwner + } + return nil +} + +func (m *MsgSlashingResourceNode) GetNetworkAddress() string { + if m != nil { + return m.NetworkAddress + } + return "" +} + +func (m *MsgSlashingResourceNode) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +func (m *MsgSlashingResourceNode) GetSuspend() bool { + if m != nil { + return m.Suspend + } + return false +} + +// MsgSlashingResourceNodeResponse defines the Msg/MsgSlashingResourceNode response type. +type MsgSlashingResourceNodeResponse struct { +} + +func (m *MsgSlashingResourceNodeResponse) Reset() { *m = MsgSlashingResourceNodeResponse{} } +func (m *MsgSlashingResourceNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSlashingResourceNodeResponse) ProtoMessage() {} +func (*MsgSlashingResourceNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_103c258cace119ca, []int{7} +} +func (m *MsgSlashingResourceNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSlashingResourceNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSlashingResourceNodeResponse.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 *MsgSlashingResourceNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSlashingResourceNodeResponse.Merge(m, src) +} +func (m *MsgSlashingResourceNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSlashingResourceNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSlashingResourceNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSlashingResourceNodeResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgVolumeReport)(nil), "stratos.pot.v1.MsgVolumeReport") + proto.RegisterType((*MsgVolumeReportResponse)(nil), "stratos.pot.v1.MsgVolumeReportResponse") + proto.RegisterType((*MsgWithdraw)(nil), "stratos.pot.v1.MsgWithdraw") + proto.RegisterType((*MsgWithdrawResponse)(nil), "stratos.pot.v1.MsgWithdrawResponse") + proto.RegisterType((*MsgFoundationDeposit)(nil), "stratos.pot.v1.MsgFoundationDeposit") + proto.RegisterType((*MsgFoundationDepositResponse)(nil), "stratos.pot.v1.MsgFoundationDepositResponse") + proto.RegisterType((*MsgSlashingResourceNode)(nil), "stratos.pot.v1.MsgSlashingResourceNode") + proto.RegisterType((*MsgSlashingResourceNodeResponse)(nil), "stratos.pot.v1.MsgSlashingResourceNodeResponse") +} + +func init() { proto.RegisterFile("stratos/pot/v1/tx.proto", fileDescriptor_103c258cace119ca) } + +var fileDescriptor_103c258cace119ca = []byte{ + // 974 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0xae, 0x9b,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b, 0xbf, 0x9c, 0x37, 0x96, 0x3e, 0xb3, 0x67, 0x6e, 0x87, 0xe6, 0x22, 0x98, 0x67, 0x3f, 0xf7, + 0x7b, 0x7d, 0x37, 0x20, 0xf6, 0x23, 0x49, 0x2f, 0xaf, 0x4a, 0x77, 0x45, 0xfe, 0x57, 0xf5, 0xfa, + 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x30, 0x6b, 0x77, 0xd0, 0xee, 0x09, 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 { + HandleMsgVolumeReport(ctx context.Context, in *MsgVolumeReport, opts ...grpc.CallOption) (*MsgVolumeReportResponse, error) + HandleMsgWithdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) + HandleMsgFoundationDeposit(ctx context.Context, in *MsgFoundationDeposit, opts ...grpc.CallOption) (*MsgFoundationDepositResponse, error) + HandleMsgSlashingResourceNode(ctx context.Context, in *MsgSlashingResourceNode, opts ...grpc.CallOption) (*MsgSlashingResourceNodeResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) HandleMsgVolumeReport(ctx context.Context, in *MsgVolumeReport, opts ...grpc.CallOption) (*MsgVolumeReportResponse, error) { + out := new(MsgVolumeReportResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Msg/HandleMsgVolumeReport", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) HandleMsgWithdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) { + out := new(MsgWithdrawResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Msg/HandleMsgWithdraw", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) HandleMsgFoundationDeposit(ctx context.Context, in *MsgFoundationDeposit, opts ...grpc.CallOption) (*MsgFoundationDepositResponse, error) { + out := new(MsgFoundationDepositResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Msg/HandleMsgFoundationDeposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) HandleMsgSlashingResourceNode(ctx context.Context, in *MsgSlashingResourceNode, opts ...grpc.CallOption) (*MsgSlashingResourceNodeResponse, error) { + out := new(MsgSlashingResourceNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Msg/HandleMsgSlashingResourceNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + HandleMsgVolumeReport(context.Context, *MsgVolumeReport) (*MsgVolumeReportResponse, error) + HandleMsgWithdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error) + HandleMsgFoundationDeposit(context.Context, *MsgFoundationDeposit) (*MsgFoundationDepositResponse, error) + HandleMsgSlashingResourceNode(context.Context, *MsgSlashingResourceNode) (*MsgSlashingResourceNodeResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) HandleMsgVolumeReport(ctx context.Context, req *MsgVolumeReport) (*MsgVolumeReportResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgVolumeReport not implemented") +} +func (*UnimplementedMsgServer) HandleMsgWithdraw(ctx context.Context, req *MsgWithdraw) (*MsgWithdrawResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgWithdraw not implemented") +} +func (*UnimplementedMsgServer) HandleMsgFoundationDeposit(ctx context.Context, req *MsgFoundationDeposit) (*MsgFoundationDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgFoundationDeposit not implemented") +} +func (*UnimplementedMsgServer) HandleMsgSlashingResourceNode(ctx context.Context, req *MsgSlashingResourceNode) (*MsgSlashingResourceNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgSlashingResourceNode not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_HandleMsgVolumeReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgVolumeReport) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HandleMsgVolumeReport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Msg/HandleMsgVolumeReport", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HandleMsgVolumeReport(ctx, req.(*MsgVolumeReport)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_HandleMsgWithdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdraw) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HandleMsgWithdraw(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Msg/HandleMsgWithdraw", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HandleMsgWithdraw(ctx, req.(*MsgWithdraw)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_HandleMsgFoundationDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgFoundationDeposit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HandleMsgFoundationDeposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Msg/HandleMsgFoundationDeposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HandleMsgFoundationDeposit(ctx, req.(*MsgFoundationDeposit)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_HandleMsgSlashingResourceNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSlashingResourceNode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HandleMsgSlashingResourceNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Msg/HandleMsgSlashingResourceNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HandleMsgSlashingResourceNode(ctx, req.(*MsgSlashingResourceNode)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.pot.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "HandleMsgVolumeReport", + Handler: _Msg_HandleMsgVolumeReport_Handler, + }, + { + MethodName: "HandleMsgWithdraw", + Handler: _Msg_HandleMsgWithdraw_Handler, + }, + { + MethodName: "HandleMsgFoundationDeposit", + Handler: _Msg_HandleMsgFoundationDeposit_Handler, + }, + { + MethodName: "HandleMsgSlashingResourceNode", + Handler: _Msg_HandleMsgSlashingResourceNode_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/pot/v1/tx.proto", +} + +func (m *MsgVolumeReport) 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 *MsgVolumeReport) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVolumeReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BLSSignature != nil { + { + size, err := m.BLSSignature.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if len(m.ReporterOwner) > 0 { + i -= len(m.ReporterOwner) + copy(dAtA[i:], m.ReporterOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.ReporterOwner))) + i-- + dAtA[i] = 0x2a + } + if len(m.ReportReference) > 0 { + i -= len(m.ReportReference) + copy(dAtA[i:], m.ReportReference) + i = encodeVarintTx(dAtA, i, uint64(len(m.ReportReference))) + i-- + dAtA[i] = 0x22 + } + if m.Epoch != nil { + { + size := m.Epoch.Size() + i -= size + if _, err := m.Epoch.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Reporter) > 0 { + i -= len(m.Reporter) + copy(dAtA[i:], m.Reporter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Reporter))) + i-- + dAtA[i] = 0x12 + } + if len(m.WalletVolumes) > 0 { + for iNdEx := len(m.WalletVolumes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.WalletVolumes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgVolumeReportResponse) 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 *MsgVolumeReportResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVolumeReportResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgWithdraw) 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 *MsgWithdraw) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdraw) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TargetAddress) > 0 { + i -= len(m.TargetAddress) + copy(dAtA[i:], m.TargetAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TargetAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawResponse) 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 *MsgWithdrawResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgFoundationDeposit) 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 *MsgFoundationDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFoundationDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0x12 + } + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgFoundationDepositResponse) 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 *MsgFoundationDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFoundationDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSlashingResourceNode) 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 *MsgSlashingResourceNode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSlashingResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Suspend { + i-- + if m.Suspend { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.Slashing != nil { + { + size := m.Slashing.Size() + i -= size + if _, err := m.Slashing.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ReporterOwner) > 0 { + for iNdEx := len(m.ReporterOwner) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ReporterOwner[iNdEx]) + copy(dAtA[i:], m.ReporterOwner[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.ReporterOwner[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Reporters) > 0 { + for iNdEx := len(m.Reporters) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Reporters[iNdEx]) + copy(dAtA[i:], m.Reporters[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Reporters[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgSlashingResourceNodeResponse) 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 *MsgSlashingResourceNodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSlashingResourceNodeResponse) 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 *MsgVolumeReport) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.WalletVolumes) > 0 { + for _, e := range m.WalletVolumes { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Reporter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Epoch != nil { + l = m.Epoch.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ReportReference) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ReporterOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BLSSignature != nil { + l = m.BLSSignature.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgVolumeReportResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdraw) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TargetAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgWithdrawResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgFoundationDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgFoundationDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSlashingResourceNode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Reporters) > 0 { + for _, s := range m.Reporters { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.ReporterOwner) > 0 { + for _, s := range m.ReporterOwner { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.NetworkAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Slashing != nil { + l = m.Slashing.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Suspend { + n += 2 + } + return n +} + +func (m *MsgSlashingResourceNodeResponse) 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 *MsgVolumeReport) 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: MsgVolumeReport: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVolumeReport: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WalletVolumes", 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.WalletVolumes = append(m.WalletVolumes, &SingleWalletVolume{}) + if err := m.WalletVolumes[len(m.WalletVolumes)-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 Reporter", 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.Reporter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", 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 + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.Epoch = &v + if err := m.Epoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReportReference", 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.ReportReference = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReporterOwner", 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.ReporterOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BLSSignature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BLSSignature == nil { + m.BLSSignature = &BLSSignatureInfo{} + } + if err := m.BLSSignature.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 *MsgVolumeReportResponse) 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: MsgVolumeReportResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVolumeReportResponse: 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 *MsgWithdraw) 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: MsgWithdraw: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdraw: 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 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.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-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 WalletAddress", 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.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetAddress", 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.TargetAddress = 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 *MsgWithdrawResponse) 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: MsgWithdrawResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawResponse: 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 *MsgFoundationDeposit) 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: MsgFoundationDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFoundationDeposit: 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 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.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-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 From", 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.From = 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 *MsgFoundationDepositResponse) 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: MsgFoundationDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFoundationDepositResponse: 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 *MsgSlashingResourceNode) 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: MsgSlashingResourceNode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSlashingResourceNode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reporters", 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.Reporters = append(m.Reporters, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReporterOwner", 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.ReporterOwner = append(m.ReporterOwner, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", 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.NetworkAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", 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.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Slashing", 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 + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.Slashing = &v + if err := m.Slashing.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Suspend", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Suspend = bool(v != 0) + 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 *MsgSlashingResourceNodeResponse) 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: MsgSlashingResourceNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSlashingResourceNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pot/types/tx.pb.gw.go b/x/pot/types/tx.pb.gw.go new file mode 100644 index 00000000..52ea21eb --- /dev/null +++ b/x/pot/types/tx.pb.gw.go @@ -0,0 +1,406 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stratos/pot/v1/tx.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/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 ( + filter_Msg_HandleMsgVolumeReport_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_HandleMsgVolumeReport_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgVolumeReport + 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_Msg_HandleMsgVolumeReport_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HandleMsgVolumeReport(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_HandleMsgVolumeReport_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgVolumeReport + 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_Msg_HandleMsgVolumeReport_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HandleMsgVolumeReport(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_HandleMsgWithdraw_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_HandleMsgWithdraw_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgWithdraw + 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_Msg_HandleMsgWithdraw_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HandleMsgWithdraw(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_HandleMsgWithdraw_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgWithdraw + 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_Msg_HandleMsgWithdraw_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HandleMsgWithdraw(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_HandleMsgFoundationDeposit_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_HandleMsgFoundationDeposit_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgFoundationDeposit + 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_Msg_HandleMsgFoundationDeposit_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HandleMsgFoundationDeposit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_HandleMsgFoundationDeposit_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgFoundationDeposit + 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_Msg_HandleMsgFoundationDeposit_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HandleMsgFoundationDeposit(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_HandleMsgSlashingResourceNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_HandleMsgSlashingResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgSlashingResourceNode + 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_Msg_HandleMsgSlashingResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HandleMsgSlashingResourceNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_HandleMsgSlashingResourceNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgSlashingResourceNode + 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_Msg_HandleMsgSlashingResourceNode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HandleMsgSlashingResourceNode(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". +// UnaryRPC :call MsgServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. +func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + + mux.Handle("POST", pattern_Msg_HandleMsgVolumeReport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_HandleMsgVolumeReport_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgVolumeReport_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgWithdraw_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_HandleMsgWithdraw_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgWithdraw_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgFoundationDeposit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_HandleMsgFoundationDeposit_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgFoundationDeposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgSlashingResourceNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_HandleMsgSlashingResourceNode_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgSlashingResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMsgHandlerFromEndpoint(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 RegisterMsgHandler(ctx, mux, conn) +} + +// RegisterMsgHandler registers the http handlers for service Msg to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn)) +} + +// RegisterMsgHandlerClient registers the http handlers for service Msg +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MsgClient" to call the correct interceptors. +func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + + mux.Handle("POST", pattern_Msg_HandleMsgVolumeReport_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_Msg_HandleMsgVolumeReport_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgVolumeReport_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgWithdraw_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_Msg_HandleMsgWithdraw_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgWithdraw_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgFoundationDeposit_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_Msg_HandleMsgFoundationDeposit_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgFoundationDeposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_HandleMsgSlashingResourceNode_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_Msg_HandleMsgSlashingResourceNode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_HandleMsgSlashingResourceNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Msg_HandleMsgVolumeReport_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "pot", "v1", "volume_report"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_HandleMsgWithdraw_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "pot", "v1", "withdraw"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_HandleMsgFoundationDeposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "pot", "v1", "foundation_deposit"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Msg_HandleMsgSlashingResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "pot", "v1", "slashing_resource_node"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Msg_HandleMsgVolumeReport_0 = runtime.ForwardResponseMessage + + forward_Msg_HandleMsgWithdraw_0 = runtime.ForwardResponseMessage + + forward_Msg_HandleMsgFoundationDeposit_0 = runtime.ForwardResponseMessage + + forward_Msg_HandleMsgSlashingResourceNode_0 = runtime.ForwardResponseMessage +) diff --git a/x/pot/types/types.go b/x/pot/types/types.go index 0a8c9bee..f196316b 100644 --- a/x/pot/types/types.go +++ b/x/pot/types/types.go @@ -5,62 +5,62 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -type SingleWalletVolume struct { - WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` - Volume sdk.Int `json:"volume" yaml:"volume"` //uoz -} +//type SingleWalletVolume struct { +// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` +// Volume sdk.Int `json:"volume" yaml:"volume"` //uoz +//} // NewSingleWalletVolume creates a new Msg instance func NewSingleWalletVolume( walletAddress sdk.AccAddress, volume sdk.Int, -) SingleWalletVolume { - return SingleWalletVolume{ - WalletAddress: walletAddress, - Volume: volume, +) *SingleWalletVolume { + return &SingleWalletVolume{ + WalletAddress: walletAddress.String(), + Volume: &volume, } } -type MiningRewardParam struct { - TotalMinedValveStart sdk.Coin `json:"total_mined_valve_start" yaml:"total_mined_valve_start"` - TotalMinedValveEnd sdk.Coin `json:"total_mined_valve_end" yaml:"total_mined_valve_end"` - MiningReward sdk.Coin `json:"mining_reward" yaml:"mining_reward"` - BlockChainPercentageInTenThousand sdk.Int `json:"block_chain_percentage_in_ten_thousand" yaml:"block_chain_percentage_in_ten_thousand"` - ResourceNodePercentageInTenThousand sdk.Int `json:"resource_node_percentage_in_ten_thousand" yaml:"resource_node_percentage_in_ten_thousand"` - MetaNodePercentageInTenThousand sdk.Int `json:"meta_node_percentage_in_ten_thousand" yaml:"meta_node_percentage_in_ten_thousand"` -} - +//type MiningRewardParam struct { +// TotalMinedValveStart sdk.Coin `json:"total_mined_valve_start" yaml:"total_mined_valve_start"` +// TotalMinedValveEnd sdk.Coin `json:"total_mined_valve_end" yaml:"total_mined_valve_end"` +// MiningReward sdk.Coin `json:"mining_reward" yaml:"mining_reward"` +// BlockChainPercentageInTenThousand sdk.Int `json:"block_chain_percentage_in_ten_thousand" yaml:"block_chain_percentage_in_ten_thousand"` +// ResourceNodePercentageInTenThousand sdk.Int `json:"resource_node_percentage_in_ten_thousand" yaml:"resource_node_percentage_in_ten_thousand"` +// MetaNodePercentageInTenThousand sdk.Int `json:"meta_node_percentage_in_ten_thousand" yaml:"meta_node_percentage_in_ten_thousand"` +//} +// func NewMiningRewardParam(totalMinedValveStart sdk.Coin, totalMinedValveEnd sdk.Coin, miningReward sdk.Coin, resourceNodePercentageInTenThousand sdk.Int, metaNodePercentageInTenThousand sdk.Int, blockChainPercentageInTenThousand sdk.Int) MiningRewardParam { return MiningRewardParam{ - TotalMinedValveStart: totalMinedValveStart, - TotalMinedValveEnd: totalMinedValveEnd, - MiningReward: miningReward, - BlockChainPercentageInTenThousand: blockChainPercentageInTenThousand, - ResourceNodePercentageInTenThousand: resourceNodePercentageInTenThousand, - MetaNodePercentageInTenThousand: metaNodePercentageInTenThousand, + TotalMinedValveStart: &totalMinedValveStart, + TotalMinedValveEnd: &totalMinedValveEnd, + MiningReward: &miningReward, + BlockChainPercentageInTenThousand: &blockChainPercentageInTenThousand, + ResourceNodePercentageInTenThousand: &resourceNodePercentageInTenThousand, + MetaNodePercentageInTenThousand: &metaNodePercentageInTenThousand, } } -type VolumeReportRecord struct { - Reporter stratos.SdsAddress - ReportReference string - TxHash string -} +//type VolumeReportRecord struct { +// Reporter stratos.SdsAddress +// ReportReference string +// TxHash string +//} func NewReportRecord(reporter stratos.SdsAddress, reportReference string, txHash string) VolumeReportRecord { return VolumeReportRecord{ - Reporter: reporter, + Reporter: reporter.String(), ReportReference: reportReference, TxHash: txHash, } } -type BLSSignatureInfo struct { - PubKeys [][]byte `json:"pub_keys" yaml:"pub_keys"` - Signature []byte `json:"signature" yaml:"signature"` - TxData []byte `json:"tx_data" yaml:"tx_data"` -} +//type BLSSignatureInfo struct { +// PubKeys [][]byte `json:"pub_keys" yaml:"pub_keys"` +// Signature []byte `json:"signature" yaml:"signature"` +// TxData []byte `json:"tx_data" yaml:"tx_data"` +//} func NewBLSSignatureInfo(pubKeys [][]byte, signature []byte, txData []byte) BLSSignatureInfo { return BLSSignatureInfo{ From 4350848f15780d7c600a93b5b58949a02195b881 Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 13 May 2022 19:41:16 -0400 Subject: [PATCH 046/113] - qb-1165: upgrade pot module (keeper) --- x/pot/handler.go | 127 ++++++++++++++++---------------- x/pot/keeper/distribute.go | 66 +++++++++++------ x/pot/keeper/querier.go | 10 +-- x/pot/keeper/slashing.go | 6 +- x/pot/keeper/withdraw.go | 2 +- x/pot/types/expected_keepers.go | 25 +++++++ 6 files changed, 142 insertions(+), 94 deletions(-) diff --git a/x/pot/handler.go b/x/pot/handler.go index 8844f9d4..f49b8889 100644 --- a/x/pot/handler.go +++ b/x/pot/handler.go @@ -2,7 +2,6 @@ package pot import ( "fmt" - "strconv" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -81,66 +80,66 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // // return &sdk.Result{Events: ctx.EventManager().Events()}, nil //} - -func handleMsgWithdraw(ctx sdk.Context, k keeper.Keeper, msg types.MsgWithdraw) (*sdk.Result, error) { - err := k.Withdraw(ctx, msg.Amount, msg.WalletAddress, msg.TargetAddress) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeWithdraw, - sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), - sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.WalletAddress.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgFoundationDeposit(ctx sdk.Context, k keeper.Keeper, msg types.MsgFoundationDeposit) (*sdk.Result, error) { - err := k.FoundationDeposit(ctx, msg.Amount, msg.From) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeFoundationDeposit, - sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.From.String()), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, nil -} - -func handleMsgSlashingResourceNode(ctx sdk.Context, k keeper.Keeper, msg types.MsgSlashingResourceNode) (*sdk.Result, error) { - for _, reporter := range msg.Reporters { - if !(k.IsSPNode(ctx, reporter)) { - errMsg := fmt.Sprint("Slashing msg is not sent by a meta node") - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, errMsg) - } - } - - amt, nodeType, err := k.SlashingResourceNode(ctx, msg.NetworkAddress, msg.WalletAddress, msg.Slashing, msg.Suspend) - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeSlashing, - sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress.String()), - sdk.NewAttribute(types.AttributeKeyNodeP2PAddress, msg.NetworkAddress.String()), - sdk.NewAttribute(types.AttributeKeyAmount, amt.String()), - sdk.NewAttribute(types.AttributeKeySlashingNodeType, nodeType.String()), - sdk.NewAttribute(types.AttributeKeyNodeSuspended, strconv.FormatBool(msg.Suspend)), - ), - }) - return &sdk.Result{Events: ctx.EventManager().Events()}, err -} +// +//func handleMsgWithdraw(ctx sdk.Context, k keeper.Keeper, msg types.MsgWithdraw) (*sdk.Result, error) { +// err := k.Withdraw(ctx, msg.Amount, msg.WalletAddress, msg.TargetAddress) +// if err != nil { +// return nil, err +// } +// +// ctx.EventManager().EmitEvents(sdk.Events{ +// sdk.NewEvent( +// types.EventTypeWithdraw, +// sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), +// sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress.String()), +// ), +// sdk.NewEvent( +// sdk.EventTypeMessage, +// sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), +// sdk.NewAttribute(sdk.AttributeKeySender, msg.WalletAddress.String()), +// ), +// }) +// return &sdk.Result{Events: ctx.EventManager().Events()}, nil +//} +// +//func handleMsgFoundationDeposit(ctx sdk.Context, k keeper.Keeper, msg types.MsgFoundationDeposit) (*sdk.Result, error) { +// err := k.FoundationDeposit(ctx, msg.Amount, msg.From) +// if err != nil { +// return nil, err +// } +// +// ctx.EventManager().EmitEvents(sdk.Events{ +// sdk.NewEvent( +// types.EventTypeFoundationDeposit, +// sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), +// ), +// sdk.NewEvent( +// sdk.EventTypeMessage, +// sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), +// sdk.NewAttribute(sdk.AttributeKeySender, msg.From.String()), +// ), +// }) +// return &sdk.Result{Events: ctx.EventManager().Events()}, nil +//} +// +//func handleMsgSlashingResourceNode(ctx sdk.Context, k keeper.Keeper, msg types.MsgSlashingResourceNode) (*sdk.Result, error) { +// for _, reporter := range msg.Reporters { +// if !(k.IsSPNode(ctx, reporter)) { +// errMsg := fmt.Sprint("Slashing msg is not sent by a meta node") +// return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, errMsg) +// } +// } +// +// amt, nodeType, err := k.SlashingResourceNode(ctx, msg.NetworkAddress, msg.WalletAddress, msg.Slashing, msg.Suspend) +// ctx.EventManager().EmitEvents(sdk.Events{ +// sdk.NewEvent( +// types.EventTypeSlashing, +// sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress.String()), +// sdk.NewAttribute(types.AttributeKeyNodeP2PAddress, msg.NetworkAddress.String()), +// sdk.NewAttribute(types.AttributeKeyAmount, amt.String()), +// sdk.NewAttribute(types.AttributeKeySlashingNodeType, nodeType.String()), +// sdk.NewAttribute(types.AttributeKeyNodeSuspended, strconv.FormatBool(msg.Suspend)), +// ), +// }) +// return &sdk.Result{Events: ctx.EventManager().Events()}, err +//} diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 3b13d986..259d5f2b 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -91,13 +91,13 @@ func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal type return types.ErrUnknownAccountAddress } - amountToDeduct := sdk.NewCoins(totalRewardFromMiningPool) - hasCoin := k.BankKeeper.HasCoins(ctx, foundationAccountAddr, amountToDeduct) + hasCoin := k.BankKeeper.HasBalance(ctx, foundationAccountAddr, totalRewardFromMiningPool) if !hasCoin { ctx.Logger().Info("balance of foundation account is 0") return types.ErrInsufficientFoundationAccBalance } - _, err = k.BankKeeper.SubtractCoins(ctx, foundationAccountAddr, amountToDeduct) + amountToDeduct := sdk.NewCoins(totalRewardFromMiningPool) + err = k.BankKeeper.SendCoinsFromAccountToModule(ctx, foundationAccountAddr, types.ModuleName, amountToDeduct) if err != nil { return err } @@ -136,7 +136,7 @@ func (k Keeper) returnBalance(ctx sdk.Context, goal types.DistributeGoal, curren return types.ErrUnknownAccountAddress } amountToAdd := sdk.NewCoins(balanceOfMiningPool) - _, err = k.BankKeeper.AddCoins(ctx, foundationAccountAddr, amountToAdd) + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, foundationAccountAddr, amountToAdd) if err != nil { return err } @@ -249,7 +249,10 @@ func (k Keeper) distributeRewardToSdsNodes(ctx sdk.Context, rewardDetailList []t matureEpoch := k.getMatureEpochByCurrentEpoch(ctx, currentEpoch) for _, reward := range rewardDetailList { - walletAddr := reward.WalletAddress + walletAddr, err := sdk.AccAddressFromBech32(reward.WalletAddress) + if err != nil { + continue + } k.addNewIndividualAndUpdateImmatureTotal(ctx, walletAddr, matureEpoch, reward) } return nil @@ -311,7 +314,7 @@ func (k Keeper) distributeValidatorRewardToFeePool(ctx sdk.Context, distributeGo return distributeGoal, types.ErrUnknownAccountAddress } - _, err := k.BankKeeper.AddCoins(ctx, feePoolAccAddr, totalRewardSendToFeePool) + err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, feePoolAccAddr, totalRewardSendToFeePool) if err != nil { return distributeGoal, err } @@ -322,7 +325,7 @@ func (k Keeper) distributeValidatorRewardToFeePool(ctx sdk.Context, distributeGo return distributeGoal, nil } -func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []types.SingleWalletVolume, +func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types.SingleWalletVolume, distributeGoal types.DistributeGoal, rewardDetailMap map[string]types.Reward, ) (map[string]types.Reward, types.DistributeGoal) { @@ -332,10 +335,16 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []types.S // 1, calc stake reward totalStakeOfResourceNodes := k.RegisterKeeper.GetResourceNodeBondedToken(ctx).Amount resourceNodeList := k.RegisterKeeper.GetAllResourceNodes(ctx) - for _, node := range resourceNodeList { - walletAddr := node.GetOwnerAddr() - - shareOfToken := node.GetTokens().ToDec().Quo(totalStakeOfResourceNodes.ToDec()) + for _, node := range resourceNodeList.ResourceNodes { + walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) + if err != nil { + continue + } + tokens, ok := sdk.NewIntFromString(node.Tokens.String()) + if !ok { + continue + } + shareOfToken := tokens.ToDec().Quo(totalStakeOfResourceNodes.ToDec()) stakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) stakeRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), @@ -368,7 +377,11 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []types.S totalConsumedOzone := k.GetTotalConsumedUoz(trafficList) // 2, calc traffic reward for _, walletTraffic := range trafficList { - walletAddr := walletTraffic.WalletAddress + walletAddr, err := sdk.AccAddressFromBech32(walletTraffic.WalletAddress) + if err != nil { + continue + } + //walletAddr := walletTraffic.WalletAddress trafficVolume := walletTraffic.Volume shareOfTraffic := trafficVolume.ToDec().Quo(totalConsumedOzone.ToDec()) @@ -409,12 +422,19 @@ func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoal types. totalStakeOfIndexingNodes := k.RegisterKeeper.GetIndexingNodeBondedToken(ctx).Amount indexingNodeList := k.RegisterKeeper.GetAllIndexingNodes(ctx) - indexingNodeCnt := sdk.NewInt(int64(len(indexingNodeList))) - for _, node := range indexingNodeList { - walletAddr := node.GetOwnerAddr() + indexingNodeCnt := sdk.NewInt(int64(len(indexingNodeList.IndexingNodes))) + for _, node := range indexingNodeList.IndexingNodes { + walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) + if err != nil { + continue + } + tokens, ok := sdk.NewIntFromString(node.Tokens.String()) + if !ok { + continue + } // 1, calc stake reward - shareOfToken := node.GetTokens().ToDec().Quo(totalStakeOfIndexingNodes.ToDec()) + shareOfToken := tokens.ToDec().Quo(totalStakeOfIndexingNodes.ToDec()) stakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) stakeRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), @@ -455,10 +475,14 @@ func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoal types. return rewardDetailMap, distributeGoal } -func (k Keeper) GetTotalConsumedUoz(trafficList []types.SingleWalletVolume) sdk.Int { +func (k Keeper) GetTotalConsumedUoz(trafficList []*types.SingleWalletVolume) sdk.Int { totalTraffic := sdk.ZeroInt() for _, vol := range trafficList { - totalTraffic = totalTraffic.Add(vol.Volume) + toAdd, ok := sdk.NewIntFromString(vol.Volume.String()) + if !ok { + continue + } + totalTraffic = totalTraffic.Add(toAdd) } return totalTraffic } @@ -487,7 +511,7 @@ func (k Keeper) IteratorIndividualReward(ctx sdk.Context, epoch sdk.Int, handler addr := sdk.AccAddress(iter.Key()[len(types.GetIndividualRewardIteratorKey(epoch)):]) var individualReward types.Reward - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &individualReward) + types.ModuleCdc.MustUnmarshalLengthPrefixed(iter.Value(), &individualReward) if handler(addr, individualReward) { break } @@ -501,7 +525,7 @@ func (k Keeper) IteratorImmatureTotal(ctx sdk.Context, handler func(walletAddres for ; iter.Valid(); iter.Next() { addr := sdk.AccAddress(iter.Key()[len(types.ImmatureTotalRewardKeyPrefix):]) var immatureTotal sdk.Coins - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &immatureTotal) + types.ModuleCdc.MustUnmarshalLengthPrefixed(iter.Value(), &immatureTotal) if handler(addr, immatureTotal) { break } @@ -515,7 +539,7 @@ func (k Keeper) IteratorMatureTotal(ctx sdk.Context, handler func(walletAddress for ; iter.Valid(); iter.Next() { addr := sdk.AccAddress(iter.Key()[len(types.MatureTotalRewardKeyPrefix):]) var matureTotal sdk.Coins - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &matureTotal) + types.ModuleCdc.MustUnmarshalLengthPrefixed(iter.Value(), &matureTotal) if handler(addr, matureTotal) { break } diff --git a/x/pot/keeper/querier.go b/x/pot/keeper/querier.go index 5bab5263..0acd4c81 100644 --- a/x/pot/keeper/querier.go +++ b/x/pot/keeper/querier.go @@ -52,7 +52,7 @@ func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte epoch, k.GetLastReportedEpoch(ctx).String())) return []byte{}, e } - bz, err := codec.MarshalJSONIndent(k.cdc, reportRecord) + bz, err := codec.MarshalJSONIndent(types.ModuleCdc, reportRecord) if err != nil { return []byte{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -62,7 +62,7 @@ func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte // queryPotRewardsByReportEpoch fetches total rewards and owner individual rewards from traffic and mining. func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { var params types.QueryPotRewardsByReportEpochParams - err := k.cdc.UnmarshalJSON(req.Data, ¶ms) + err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return []byte{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -71,7 +71,7 @@ func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keep e := sdkerrors.Wrapf(types.ErrCannotFindReward, fmt.Sprintf("no Pot rewards information at epoch %s", params.Epoch.String())) return []byte{}, e } - bz, err := codec.MarshalJSONIndent(k.cdc, potEpochRewards) + bz, err := codec.MarshalJSONIndent(types.ModuleCdc, potEpochRewards) if err != nil { return []byte{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -107,7 +107,7 @@ func (k Keeper) getPotRewardsByReportEpoch(ctx sdk.Context, params types.QueryPo func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { var params types.QueryPotRewardsByWalletAddrParams - err := k.cdc.UnmarshalJSON(req.Data, ¶ms) + err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } @@ -115,7 +115,7 @@ func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Ke matureTotalReward := k.GetMatureTotalReward(ctx, params.WalletAddr) reward := types.NewPotRewardInfo(params.WalletAddr, matureTotalReward, immatureTotalReward) - bz, err := codec.MarshalJSONIndent(k.cdc, reward) + bz, err := codec.MarshalJSONIndent(types.ModuleCdc, reward) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } diff --git a/x/pot/keeper/slashing.go b/x/pot/keeper/slashing.go index 09fea146..6b97531d 100644 --- a/x/pot/keeper/slashing.go +++ b/x/pot/keeper/slashing.go @@ -26,9 +26,9 @@ func (k Keeper) SlashingResourceNode(ctx sdk.Context, p2pAddr stratos.SdsAddress node.Suspend = suspend //slashing amt is equivalent to reward traffic calculation - _, slash := k.GetTrafficReward(ctx, []types.SingleWalletVolume{{ - WalletAddress: node.GetOwnerAddr(), - Volume: ozAmt, + _, slash := k.GetTrafficReward(ctx, []*types.SingleWalletVolume{{ + WalletAddress: node.OwnerAddress, + Volume: &ozAmt, }}) oldSlashing := k.RegisterKeeper.GetSlashing(ctx, walletAddr) diff --git a/x/pot/keeper/withdraw.go b/x/pot/keeper/withdraw.go index 3c11a41d..b65de20b 100644 --- a/x/pot/keeper/withdraw.go +++ b/x/pot/keeper/withdraw.go @@ -10,7 +10,7 @@ func (k Keeper) Withdraw(ctx sdk.Context, amount sdk.Coins, walletAddress sdk.Ac if !matureReward.IsAllGTE(amount) { return types.ErrInsufficientMatureTotal } - _, err := k.BankKeeper.AddCoins(ctx, targetAddress, amount) + err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, targetAddress, amount) if err != nil { return err } diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index e1fcdb2a..27626249 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -52,7 +52,32 @@ type BankKeeper interface { type RegisterKeeper interface { GetIndexingNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (indexingNode types.IndexingNode, found bool) + SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode) + + GetResourceNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (resourceNode types.ResourceNode, found bool) + SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode) + + GetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress) (res sdk.Int) + SetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, slashing sdk.Int) + DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins + + GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int) + SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int) + GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk.Coin) + SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) + + GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) + SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) + GetIndexingNodeBondedToken(ctx sdk.Context) (token sdk.Coin) + SetIndexingNodeBondedToken(ctx sdk.Context, token sdk.Coin) + + GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) + SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) + + GetAllResourceNodes(ctx sdk.Context) (resourceNodes *types.ResourceNodes) + GetAllIndexingNodes(ctx sdk.Context) (indexingNodes *types.IndexingNodes) } type StakingKeeper interface { + TotalBondedTokens(ctx sdk.Context) sdk.Int } From 3eb83a547dda34d55cf4831b82bd2cad10bd9384 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 16 May 2022 09:39:26 -0400 Subject: [PATCH 047/113] updated pot module --- app/app.go | 58 +++++++++++++++++++++----------------- x/pot/keeper/distribute.go | 4 +-- x/pot/keeper/keeper.go | 5 ++-- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/app/app.go b/app/app.go index 74c0748f..50437d27 100644 --- a/app/app.go +++ b/app/app.go @@ -98,13 +98,13 @@ import ( evmrest "github.com/stratosnet/stratos-chain/x/evm/client/rest" evmkeeper "github.com/stratosnet/stratos-chain/x/evm/keeper" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" - registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" - //"github.com/stratosnet/stratos-chain/x/pot" + //potkeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" //pottypes "github.com/stratosnet/stratos-chain/x/pot/types" - //"github.com/stratosnet/stratos-chain/x/register" + registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" registertypes "github.com/stratosnet/stratos-chain/x/register/types" - //"github.com/stratosnet/stratos-chain/x/sds" - //sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" + "github.com/stratosnet/stratos-chain/x/sds" + sdskeeper "github.com/stratosnet/stratos-chain/x/sds/keeper" + sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) const ( @@ -141,7 +141,7 @@ var ( // stratos modules register.AppModuleBasic{}, //pot.AppModuleBasic{}, - //sds.AppModuleBasic{}, + sds.AppModuleBasic{}, evm.AppModuleBasic{}, ) @@ -204,8 +204,8 @@ type NewApp struct { // stratos keepers registerKeeper registerkeeper.Keeper - //potKeeper pot.Keeper - //sdsKeeper sds.Keeper + //potKeeper potkeeper.Keeper + sdsKeeper sdskeeper.Keeper evmKeeper *evmkeeper.Keeper // the module manager @@ -250,7 +250,8 @@ func NewInitApp( ibchost.StoreKey, ibctransfertypes.StoreKey, // stratos keys registertypes.StoreKey, - //pot.StoreKey, sds.StoreKey, + //pottypes.StoreKey, + sdstypes.StoreKey, evmtypes.StoreKey, ) @@ -381,26 +382,26 @@ func NewInitApp( app.bankKeeper, ) - //app.potKeeper = pot.NewKeeper( - // app.cdc, + //app.potKeeper = potkeeper.NewKeeper( + // appCodec, // keys[pot.StoreKey], - // app.subspaces[pot.ModuleName], - // auth.FeeCollectorName, + // app.GetSubspace(pot.ModuleName), + // authtypes.FeeCollectorName, // app.bankKeeper, // app.supplyKeeper, // app.accountKeeper, // app.stakingKeeper, // app.registerKeeper, //) - // - //app.sdsKeeper = sds.NewKeeper( - // app.cdc, - // keys[sds.StoreKey], - // app.subspaces[sds.ModuleName], - // app.bankKeeper, - // app.registerKeeper, - // app.potKeeper, - //) + + app.sdsKeeper = sdskeeper.NewKeeper( + appCodec, + keys[sdstypes.StoreKey], + app.GetSubspace(sdstypes.ModuleName), + app.bankKeeper, + app.registerKeeper, + app.potKeeper, + ) /**** Module Options ****/ @@ -433,7 +434,7 @@ func NewInitApp( evm.NewAppModule(app.evmKeeper, app.accountKeeper), register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), //pot.NewAppModule(app.potKeeper, app.bankKeeper, app.supplyKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), - //sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), + sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -446,7 +447,6 @@ func NewInitApp( upgradetypes.ModuleName, capabilitytypes.ModuleName, evmtypes.ModuleName, - registertypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -464,6 +464,10 @@ func NewInitApp( feegrant.ModuleName, paramstypes.ModuleName, vestingtypes.ModuleName, + // stratos + registertypes.ModuleName, + sdstypes.ModuleName, + // ) // NOTE: fee market module must go last in order to retrieve the block gas used. @@ -472,6 +476,7 @@ func NewInitApp( govtypes.ModuleName, stakingtypes.ModuleName, registertypes.ModuleName, + sdstypes.ModuleName, evmtypes.ModuleName, // no-op modules ibchost.ModuleName, @@ -517,10 +522,11 @@ func NewInitApp( vestingtypes.ModuleName, // Stratos modules evmtypes.ModuleName, + registertypes.ModuleName, + sdstypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module crisistypes.ModuleName, - registertypes.ModuleName, ) app.mm.RegisterInvariants(&app.crisisKeeper) @@ -701,7 +707,7 @@ func initParamsKeeper( // stratos subspaces paramsKeeper.Subspace(registertypes.ModuleName) //paramsKeeper.Subspace(pottypes.ModuleName) - //paramsKeeper.Subspace(sdstypes.ModuleName) + paramsKeeper.Subspace(sdstypes.ModuleName) paramsKeeper.Subspace(evmtypes.ModuleName) return paramsKeeper diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 3b13d986..3468361b 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -5,7 +5,7 @@ import ( "github.com/stratosnet/stratos-chain/x/pot/types" ) -func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { +func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { distributeGoal := types.InitDistributeGoal() rewardDetailMap := make(map[string]types.Reward) //key: wallet address @@ -85,7 +85,7 @@ func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal type Add(goal.TrafficRewardToResourceNodeFromTrafficPool) // deduct mining reward from foundation account - foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) + foundationAccountAddr := k.AccountKeeper.GetModuleAddress(types.FoundationAccount) if foundationAccountAddr == nil { ctx.Logger().Error("foundation account address of distribution module does not exist.") return types.ErrUnknownAccountAddress diff --git a/x/pot/keeper/keeper.go b/x/pot/keeper/keeper.go index 22db68c1..cb18112b 100644 --- a/x/pot/keeper/keeper.go +++ b/x/pot/keeper/keeper.go @@ -4,7 +4,6 @@ import ( "fmt" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - //"github.com/cosmos/cosmos-sdk/x/supply" stratos "github.com/stratosnet/stratos-chain/types" "github.com/tendermint/tendermint/libs/log" @@ -50,7 +49,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []*types.SingleWalletVolume, reporter stratos.SdsAddress, +func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []types.SingleWalletVolume, reporter stratos.SdsAddress, epoch sdk.Int, reportReference string, txHash string) (totalConsumedOzone sdk.Dec, err error) { //record volume report reportRecord := types.NewReportRecord(reporter, reportReference, txHash) @@ -76,7 +75,7 @@ func (k Keeper) FoundationDeposit(ctx sdk.Context, amount sdk.Coins, from sdk.Ac } //TODO - foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) + foundationAccountAddr := k.AccountKeeper.GetModuleAddress(types.FoundationAccount) err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, foundationAccountAddr, amount) if err != nil { return err From 44e864dd285d9b8a159c10031c7cdb7c7aa07ea4 Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 16 May 2022 12:19:30 -0400 Subject: [PATCH 048/113] - qb-1165: add grpc query impl --- proto/stratos/pot/v1/query.proto | 25 ------------------- x/pot/keeper/grpc_query.go | 43 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 x/pot/keeper/grpc_query.go diff --git a/proto/stratos/pot/v1/query.proto b/proto/stratos/pot/v1/query.proto index f5a0d3ef..20c221ae 100644 --- a/proto/stratos/pot/v1/query.proto +++ b/proto/stratos/pot/v1/query.proto @@ -15,31 +15,6 @@ service Query { rpc VolumeReport(QueryVolumeReportRequest) returns (QueryVolumeReportResponse) { option (google.api.http).get = "/stratos/pot/v1/volume-report/{epoch}"; } -// -// // IndexingNode queries IndexingNode info for given IndexingNode address. -// rpc IndexingNode(QueryIndexingNodeRequest) returns (QueryIndexingNodeResponse) { -// option (google.api.http).get = "/stratos/pot/v1/indexing-nodes/{network_addr}"; -// } -// -// // Params queries Register module Params info. -// rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { -// option (google.api.http).get = "/stratos/pot/v1/params"; -// } -// -// // StakeByNode queries all staking info for given node network address. -// rpc StakeByNode(QueryStakeByNodeRequest) returns (QueryStakeByNodeResponse) { -// option (google.api.http).get = "/stratos/pot/v1/stakes_node/{acc_addr}/{query_type}"; -// } -// -// // StakeByOwner queries all staking info for given owner address. -// rpc StakeByOwner(QueryStakeByOwnerRequest) returns (QueryStakeByOwnerResponse) { -// option (google.api.http).get = "/stratos/pot/v1/stakes_owner/{owner_addr}"; -// } -// -// // StakeTotal queries all staking info. -// rpc StakeTotal(QueryTotalStakeRequest) returns (QueryTotalStakeResponse) { -// option (google.api.http).get = "/stratos/pot/v1/total_stakes"; -// } } // QueryVolumeReportRequest is request type for the Query/VolumeReport RPC method diff --git a/x/pot/keeper/grpc_query.go b/x/pot/keeper/grpc_query.go new file mode 100644 index 00000000..6ae36560 --- /dev/null +++ b/x/pot/keeper/grpc_query.go @@ -0,0 +1,43 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stratosnet/stratos-chain/x/pot/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper +type Querier struct { + Keeper +} + +var _ types.QueryServer = Querier{} + +func (q Querier) VolumeReport(c context.Context, req *types.QueryVolumeReportRequest) (*types.QueryVolumeReportResponse, error) { + if req == nil { + return &types.QueryVolumeReportResponse{}, status.Error(codes.InvalidArgument, "empty request") + } + + if req.Epoch.LTE(sdk.ZeroInt()) { + return &types.QueryVolumeReportResponse{}, status.Error(codes.InvalidArgument, "epoch should be positive value") + } + + epoch, ok := sdk.NewIntFromString(req.Epoch.String()) + if !ok { + return &types.QueryVolumeReportResponse{}, status.Error(codes.InvalidArgument, "invalid epoch") + } + ctx := sdk.UnwrapSDKContext(c) + height := ctx.BlockHeight() + volumeReport := q.GetVolumeReport(ctx, epoch) + + return &types.QueryVolumeReportResponse{ + ReportInfo: &types.ReportInfo{ + Epoch: epoch.String(), + Reference: volumeReport.ReportReference, + }, + Height: height, + }, nil +} From 47bf02aba2cf640c7cb58a3117510763dc4817a0 Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 16 May 2022 12:53:12 -0400 Subject: [PATCH 049/113] - qb-1165: test commented temporarily --- x/pot/keeper/distribute_test.go | 1604 +++++++++++++++---------------- x/pot/keeper/keeper_tests.go | 215 ++--- 2 files changed, 910 insertions(+), 909 deletions(-) diff --git a/x/pot/keeper/distribute_test.go b/x/pot/keeper/distribute_test.go index 608e129c..cf894666 100644 --- a/x/pot/keeper/distribute_test.go +++ b/x/pot/keeper/distribute_test.go @@ -1,804 +1,804 @@ package keeper -import ( - "fmt" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/staking" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/pot/types" - "github.com/stratosnet/stratos-chain/x/register" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/ed25519" -) - -const ( - stos2ustos = 1000000000 - oz2uoz = 1000000000 - - resourceNodeVolume1 = 500 * oz2uoz - resourceNodeVolume2 = 300 * oz2uoz - resourceNodeVolume3 = 200 * oz2uoz - totalVolume = resourceNodeVolume1 + resourceNodeVolume2 + resourceNodeVolume3 -) - -var ( - foundationDeposit = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(40000000*stos2ustos))) - - resOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - resOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - resOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - resOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - resOwner5 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - idxOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - idxOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - idxOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - - pubKeyRes1 = ed25519.GenPrivKey().PubKey() - addrRes1 = stratos.SdsAddress(pubKeyRes1.Address()) - initialStakeRes1 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) - - pubKeyRes2 = ed25519.GenPrivKey().PubKey() - addrRes2 = stratos.SdsAddress(pubKeyRes2.Address()) - initialStakeRes2 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) - - pubKeyRes3 = ed25519.GenPrivKey().PubKey() - addrRes3 = stratos.SdsAddress(pubKeyRes3.Address()) - initialStakeRes3 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) - - pubKeyRes4 = ed25519.GenPrivKey().PubKey() - addrRes4 = stratos.SdsAddress(pubKeyRes4.Address()) - initialStakeRes4 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) - - pubKeyRes5 = ed25519.GenPrivKey().PubKey() - addrRes5 = stratos.SdsAddress(pubKeyRes5.Address()) - initialStakeRes5 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) - - pubKeyIdx1 = ed25519.GenPrivKey().PubKey() - addrIdx1 = stratos.SdsAddress(pubKeyIdx1.Address()) - initialStakeIdx1 = sdk.NewCoin("ustos", sdk.NewInt(5*stos2ustos)) - - pubKeyIdx2 = ed25519.GenPrivKey().PubKey() - addrIdx2 = stratos.SdsAddress(pubKeyIdx2.Address()) - initialStakeIdx2 = sdk.NewCoin("ustos", sdk.NewInt(5*stos2ustos)) - - pubKeyIdx3 = ed25519.GenPrivKey().PubKey() - addrIdx3 = stratos.SdsAddress(pubKeyIdx3.Address()) - initialStakeIdx3 = sdk.NewCoin("ustos", sdk.NewInt(5*stos2ustos)) - - valOpPk1 = ed25519.GenPrivKey().PubKey() - valOpAddr1 = sdk.ValAddress(valOpPk1.Address()) - valAccAddr1 = sdk.AccAddress(valOpPk1.Address()) - valConsPk1 = ed25519.GenPrivKey().PubKey() - valInitialStake = sdk.NewCoin("ustos", sdk.NewInt(15*stos2ustos)) - - totalUnissuedPrePay = sdk.NewCoin("ustos", sdk.NewInt(5000*stos2ustos)) - remainingOzoneLimit = sdk.NewInt(5000 * oz2uoz) - initialUOzonePrice = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz - - epoch1 = sdk.NewInt(1) - epoch2017 = epoch1.Add(sdk.NewInt(2016)) - epoch4033 = epoch2017.Add(sdk.NewInt(2016)) -) - -func Test(t *testing.T) { - - //prepare keepers - ctx, accountKeeper, bankKeeper, k, stakingKeeper, _, supplyKeeper, registerKeeper := CreateTestInput(t, false) - - // create validator with 50% commission - stakingHandler := staking.NewHandler(stakingKeeper) - createAccount(t, ctx, accountKeeper, bankKeeper, valAccAddr1, sdk.NewCoins(valInitialStake)) - commission := staking.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) - msgVal := staking.NewMsgCreateValidator(valOpAddr1, valConsPk1, valInitialStake, staking.Description{}, commission, sdk.OneInt()) - res, err := stakingHandler(ctx, msgVal) - require.NoError(t, err) - require.NotNil(t, res) - stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - - /************************************************** pot reward distribution part start ************************************************************/ - //initial genesis stake total value - initialGenesisStakeTotal := initialStakeRes1.Add(initialStakeRes2).Add(initialStakeRes3).Add(initialStakeRes4).Add(initialStakeRes5). - Add(initialStakeIdx1).Add(initialStakeIdx2).Add(initialStakeIdx3) - registerKeeper.SetInitialGenesisStakeTotal(ctx, initialGenesisStakeTotal.Amount) - - //PrePay - registerKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrePay) - //remaining ozone limit - registerKeeper.SetRemainingOzoneLimit(ctx, remainingOzoneLimit) - //initial uoz price - registerKeeper.SetInitialUOzonePrice(ctx, initialUOzonePrice) - - //pot genesis data load - foundationAccountAddr := supplyKeeper.GetModuleAddress(types.FoundationAccount) - err = bankKeeper.SetCoins(ctx, foundationAccountAddr, foundationDeposit) - require.NoError(t, err) - - //initialize owner accounts - createAccount(t, ctx, accountKeeper, bankKeeper, resOwner1, sdk.NewCoins(initialStakeRes1)) - createAccount(t, ctx, accountKeeper, bankKeeper, resOwner2, sdk.NewCoins(initialStakeRes2)) - createAccount(t, ctx, accountKeeper, bankKeeper, resOwner3, sdk.NewCoins(initialStakeRes3)) - createAccount(t, ctx, accountKeeper, bankKeeper, resOwner4, sdk.NewCoins(initialStakeRes4)) - createAccount(t, ctx, accountKeeper, bankKeeper, resOwner5, sdk.NewCoins(initialStakeRes5)) - createAccount(t, ctx, accountKeeper, bankKeeper, idxOwner1, sdk.NewCoins(initialStakeIdx1)) - createAccount(t, ctx, accountKeeper, bankKeeper, idxOwner2, sdk.NewCoins(initialStakeIdx2)) - createAccount(t, ctx, accountKeeper, bankKeeper, idxOwner3, sdk.NewCoins(initialStakeIdx3)) - //initialize sds node register msg - msgRes1 := register.NewMsgCreateResourceNode(addrRes1, pubKeyRes1, initialStakeRes1, resOwner1, register.NewDescription("sds://resourceNode1", "", "", "", ""), 4) - msgRes2 := register.NewMsgCreateResourceNode(addrRes2, pubKeyRes2, initialStakeRes2, resOwner2, register.NewDescription("sds://resourceNode2", "", "", "", ""), 4) - msgRes3 := register.NewMsgCreateResourceNode(addrRes3, pubKeyRes3, initialStakeRes3, resOwner3, register.NewDescription("sds://resourceNode3", "", "", "", ""), 4) - msgRes4 := register.NewMsgCreateResourceNode(addrRes4, pubKeyRes4, initialStakeRes4, resOwner4, register.NewDescription("sds://resourceNode4", "", "", "", ""), 4) - msgRes5 := register.NewMsgCreateResourceNode(addrRes5, pubKeyRes5, initialStakeRes5, resOwner5, register.NewDescription("sds://resourceNode5", "", "", "", ""), 4) - msgIdx1 := register.NewMsgCreateIndexingNode(addrIdx1, pubKeyIdx1, initialStakeIdx1, idxOwner1, register.NewDescription("sds://indexingNode1", "", "", "", "")) - msgIdx2 := register.NewMsgCreateIndexingNode(addrIdx2, pubKeyIdx2, initialStakeIdx2, idxOwner2, register.NewDescription("sds://indexingNode2", "", "", "", "")) - msgIdx3 := register.NewMsgCreateIndexingNode(addrIdx3, pubKeyIdx3, initialStakeIdx3, idxOwner3, register.NewDescription("sds://indexingNode3", "", "", "", "")) - - //register sds nodes - registerHandler := register.NewHandler(registerKeeper) - res, err = registerHandler(ctx, msgRes1) - require.NoError(t, err) - require.NotNil(t, res) - res, err = registerHandler(ctx, msgRes2) - require.NoError(t, err) - require.NotNil(t, res) - res, err = registerHandler(ctx, msgRes3) - require.NoError(t, err) - require.NotNil(t, res) - res, err = registerHandler(ctx, msgRes4) - require.NoError(t, err) - require.NotNil(t, res) - res, err = registerHandler(ctx, msgRes5) - require.NoError(t, err) - require.NotNil(t, res) - res, err = registerHandler(ctx, msgIdx1) - require.NoError(t, err) - require.NotNil(t, res) - res, err = registerHandler(ctx, msgIdx2) - require.NoError(t, err) - require.NotNil(t, res) - res, err = registerHandler(ctx, msgIdx3) - require.NoError(t, err) - require.NotNil(t, res) - - // set the status of indexing nodes to bonded - idxUnBondedPool := k.RegisterKeeper.GetIndexingNodeNotBondedToken(ctx) - k.RegisterKeeper.SetIndexingNodeBondedToken(ctx, idxUnBondedPool) - k.RegisterKeeper.SetIndexingNodeNotBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) - idxNode1, _ := k.RegisterKeeper.GetIndexingNode(ctx, stratos.SdsAddress(addrIdx1)) - idxNode2, _ := k.RegisterKeeper.GetIndexingNode(ctx, stratos.SdsAddress(addrIdx2)) - idxNode3, _ := k.RegisterKeeper.GetIndexingNode(ctx, stratos.SdsAddress(addrIdx3)) - idxNode1.Status = sdk.Bonded - idxNode2.Status = sdk.Bonded - idxNode3.Status = sdk.Bonded - k.RegisterKeeper.SetIndexingNode(ctx, idxNode1) - k.RegisterKeeper.SetIndexingNode(ctx, idxNode2) - k.RegisterKeeper.SetIndexingNode(ctx, idxNode3) - - //build traffic list - var trafficList []types.SingleWalletVolume - trafficList = append(trafficList, types.NewSingleWalletVolume(resOwner1, sdk.NewInt(resourceNodeVolume1))) - trafficList = append(trafficList, types.NewSingleWalletVolume(resOwner2, sdk.NewInt(resourceNodeVolume2))) - trafficList = append(trafficList, types.NewSingleWalletVolume(resOwner3, sdk.NewInt(resourceNodeVolume3))) - - //check prepared data - S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() - fmt.Println("S=" + S.String()) - Pt := registerKeeper.GetTotalUnissuedPrepay(ctx).Amount.ToDec() - fmt.Println("Pt=" + Pt.String()) - Y := k.GetTotalConsumedUoz(trafficList).ToDec() - fmt.Println("Y=" + Y.String()) - Lt := k.RegisterKeeper.GetRemainingOzoneLimit(ctx).ToDec() - fmt.Println("Lt=" + Lt.String()) - R := S.Add(Pt).Mul(Y).Quo(Lt.Add(Y)) - fmt.Println("R=" + R.String()) - - fmt.Println("***************************************************************************************") - - testBlockChainRewardFromTrafficPool(t, ctx, k, bankKeeper, trafficList) - testMetaNodeRewardFromTrafficPool(t, ctx, k, bankKeeper, trafficList) - testTrafficRewardFromTrafficPool(t, ctx, k, bankKeeper, trafficList) - - testBlockChainRewardFromMiningPool(t, ctx, k, bankKeeper, trafficList) - testMetaNodeRewardFromMiningPool(t, ctx, k, bankKeeper, trafficList) - testTrafficRewardFromMiningPool(t, ctx, k, bankKeeper, trafficList) - - testFullDistributeProcessAtEpoch1(t, ctx, k, trafficList) - testFullDistributeProcessAtEpoch2017(t, ctx, k, trafficList) - testWithdraw(t, ctx, k, bankKeeper) - -} - -func testWithdraw(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper) { - AccountBalanceBefore := bankKeeper.GetCoins(ctx, resOwner1) - - err := k.Withdraw(ctx, sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(68846296294))), resOwner2, resOwner2) - require.Error(t, err, types.ErrNotTheOwner) - - err = k.Withdraw(ctx, sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(68846296295))), resOwner1, resOwner1) - require.Error(t, err, types.ErrInsufficientMatureTotal) - - err = k.Withdraw(ctx, sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(68846296294))), resOwner1, resOwner1) - require.NoError(t, err) - - AccountBalanceAfter := bankKeeper.GetCoins(ctx, resOwner1) - require.Equal(t, AccountBalanceAfter.Sub(AccountBalanceBefore).AmountOf("ustos"), sdk.NewInt(68846296294)) - - matureTotalResNode1 := k.GetMatureTotalReward(ctx, resOwner1) - require.Equal(t, matureTotalResNode1, sdk.ZeroInt()) -} - -func testFullDistributeProcessAtEpoch2017(t *testing.T, ctx sdk.Context, k Keeper, trafficList []types.SingleWalletVolume) { - _, err := k.DistributePotReward(ctx, trafficList, epoch2017) - require.NoError(t, err) - fmt.Println("Distribution result at Epoch2017: ") - fmt.Println("----------------------------------------------------------------------------------") - - idvRwdResNode1Ep1, _ := k.GetIndividualReward(ctx, resOwner1, epoch4033) - individualTotalReward := idvRwdResNode1Ep1.RewardFromMiningPool.Add(idvRwdResNode1Ep1.RewardFromTrafficPool...) - matureTotalResNode1 := k.GetMatureTotalReward(ctx, resOwner1) - immatureTotalResNode1 := k.GetImmatureTotalReward(ctx, resOwner1) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode1.String() + ",\timmatureTotal = " + immatureTotalResNode1.String()) - require.Equal(t, individualTotalReward, sdk.NewInt(67630195471)) - require.Equal(t, matureTotalResNode1, sdk.NewInt(68846296294)) - require.Equal(t, immatureTotalResNode1, sdk.NewInt(67630195471)) - - idvRwdResNode2Ep1, _ := k.GetIndividualReward(ctx, resOwner2, epoch4033) - individualTotalReward = idvRwdResNode2Ep1.RewardFromMiningPool.Add(idvRwdResNode2Ep1.RewardFromTrafficPool...) - matureTotalResNode2 := k.GetMatureTotalReward(ctx, resOwner2) - immatureTotalResNode2 := k.GetImmatureTotalReward(ctx, resOwner2) - require.Equal(t, individualTotalReward, sdk.NewInt(41729269545)) - require.Equal(t, matureTotalResNode2, sdk.NewInt(42479629627)) - require.Equal(t, immatureTotalResNode2, sdk.NewInt(41729269545)) - fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode2.String() + ",\timmatureTotal = " + immatureTotalResNode2.String()) - - idvRwdResNode3Ep1, _ := k.GetIndividualReward(ctx, resOwner3, epoch4033) - individualTotalReward = idvRwdResNode3Ep1.RewardFromMiningPool.Add(idvRwdResNode3Ep1.RewardFromTrafficPool...) - matureTotalResNode3 := k.GetMatureTotalReward(ctx, resOwner3) - immatureTotalResNode3 := k.GetImmatureTotalReward(ctx, resOwner3) - require.Equal(t, individualTotalReward, sdk.NewInt(28778806582)) - require.Equal(t, matureTotalResNode3, sdk.NewInt(29296296294)) - require.Equal(t, immatureTotalResNode3, sdk.NewInt(28778806582)) - fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode3.String() + ",\timmatureTotal = " + immatureTotalResNode3.String()) - - idvRwdResNode4Ep1, _ := k.GetIndividualReward(ctx, resOwner4, epoch4033) - individualTotalReward = idvRwdResNode4Ep1.RewardFromMiningPool.Add(idvRwdResNode4Ep1.RewardFromTrafficPool...) - matureTotalResNode4 := k.GetMatureTotalReward(ctx, resOwner4) - immatureTotalResNode4 := k.GetImmatureTotalReward(ctx, resOwner4) - require.Equal(t, individualTotalReward, sdk.NewInt(2877880657)) - require.Equal(t, matureTotalResNode4, sdk.NewInt(2929629628)) - require.Equal(t, immatureTotalResNode4, sdk.NewInt(2877880657)) - fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode4.String() + ",\timmatureTotal = " + immatureTotalResNode4.String()) - - idvRwdResNode5Ep1, _ := k.GetIndividualReward(ctx, resOwner5, epoch4033) - individualTotalReward = idvRwdResNode5Ep1.RewardFromMiningPool.Add(idvRwdResNode5Ep1.RewardFromTrafficPool...) - matureTotalResNode5 := k.GetMatureTotalReward(ctx, resOwner5) - immatureTotalResNode5 := k.GetImmatureTotalReward(ctx, resOwner5) - require.Equal(t, individualTotalReward, sdk.NewInt(2877880657)) - require.Equal(t, matureTotalResNode5, sdk.NewInt(2929629628)) - require.Equal(t, immatureTotalResNode5, sdk.NewInt(2877880657)) - fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode5.String() + ",\timmatureTotal = " + immatureTotalResNode5.String()) - - idvRwdIdxNode1Ep1, _ := k.GetIndividualReward(ctx, idxOwner1, epoch4033) - individualTotalReward = idvRwdIdxNode1Ep1.RewardFromMiningPool.Add(idvRwdIdxNode1Ep1.RewardFromTrafficPool...) - matureTotalIdxNode1 := k.GetMatureTotalReward(ctx, idxOwner1) - immatureTotalIdxNode1 := k.GetImmatureTotalReward(ctx, idxOwner1) - require.Equal(t, individualTotalReward, sdk.NewInt(19185871053)) - require.Equal(t, matureTotalIdxNode1, sdk.NewInt(19530864195)) - require.Equal(t, immatureTotalIdxNode1, sdk.NewInt(19185871053)) - fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode1.String() + ",\timmatureTotal = " + immatureTotalIdxNode1.String()) - - idvRwdIdxNode2Ep1, _ := k.GetIndividualReward(ctx, idxOwner2, epoch4033) - individualTotalReward = idvRwdIdxNode2Ep1.RewardFromMiningPool.Add(idvRwdIdxNode2Ep1.RewardFromTrafficPool...) - matureTotalIdxNode2 := k.GetMatureTotalReward(ctx, idxOwner2) - immatureTotalIdxNode2 := k.GetImmatureTotalReward(ctx, idxOwner2) - require.Equal(t, individualTotalReward, sdk.NewInt(19185871053)) - require.Equal(t, matureTotalIdxNode2, sdk.NewInt(19530864195)) - require.Equal(t, immatureTotalIdxNode2, sdk.NewInt(19185871053)) - fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode2.String() + ",\timmatureTotal = " + immatureTotalIdxNode2.String()) - - idvRwdIdxNode3Ep1, _ := k.GetIndividualReward(ctx, idxOwner3, epoch4033) - individualTotalReward = idvRwdIdxNode3Ep1.RewardFromMiningPool.Add(idvRwdIdxNode3Ep1.RewardFromTrafficPool...) - matureTotalIdxNode3 := k.GetMatureTotalReward(ctx, idxOwner3) - immatureTotalIdxNode3 := k.GetImmatureTotalReward(ctx, idxOwner3) - require.Equal(t, individualTotalReward, sdk.NewInt(19185871053)) - require.Equal(t, matureTotalIdxNode3, sdk.NewInt(19530864195)) - require.Equal(t, immatureTotalIdxNode3, sdk.NewInt(19185871053)) - fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode3.String() + ",\timmatureTotal = " + immatureTotalIdxNode3.String()) - fmt.Println("***************************************************************************************") -} - -func testFullDistributeProcessAtEpoch1(t *testing.T, ctx sdk.Context, k Keeper, trafficList []types.SingleWalletVolume) { - //PrePay - k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrePay) - - _, err := k.DistributePotReward(ctx, trafficList, epoch1) - require.NoError(t, err) - - fmt.Println("Distribution result at Epoch1: ") - fmt.Println("----------------------------------------------------------------------------------") - - idvRwdResNode1Ep1, _ := k.GetIndividualReward(ctx, resOwner1, epoch2017) - individualTotalReward := idvRwdResNode1Ep1.RewardFromMiningPool.Add(idvRwdResNode1Ep1.RewardFromTrafficPool...) - matureTotalResNode1 := k.GetMatureTotalReward(ctx, resOwner1) - immatureTotalResNode1 := k.GetImmatureTotalReward(ctx, resOwner1) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode1.String() + ",\timmatureTotal = " + immatureTotalResNode1.String()) - require.Equal(t, individualTotalReward, sdk.NewInt(68846296294)) - require.Equal(t, matureTotalResNode1, sdk.ZeroInt()) - require.Equal(t, immatureTotalResNode1, sdk.NewInt(68846296294)) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode1.String() + ",\timmatureTotal = " + immatureTotalResNode1.String()) - - idvRwdResNode2Ep1, _ := k.GetIndividualReward(ctx, resOwner2, epoch2017) - individualTotalReward = idvRwdResNode2Ep1.RewardFromMiningPool.Add(idvRwdResNode2Ep1.RewardFromTrafficPool...) - matureTotalResNode2 := k.GetMatureTotalReward(ctx, resOwner2) - immatureTotalResNode2 := k.GetImmatureTotalReward(ctx, resOwner2) - require.Equal(t, individualTotalReward, sdk.NewInt(42479629627)) - require.Equal(t, matureTotalResNode2, sdk.ZeroInt()) - require.Equal(t, immatureTotalResNode2, sdk.NewInt(42479629627)) - fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode2.String() + ",\timmatureTotal = " + immatureTotalResNode2.String()) - - idvRwdResNode3Ep1, _ := k.GetIndividualReward(ctx, resOwner3, epoch2017) - individualTotalReward = idvRwdResNode3Ep1.RewardFromMiningPool.Add(idvRwdResNode3Ep1.RewardFromTrafficPool...) - matureTotalResNode3 := k.GetMatureTotalReward(ctx, resOwner3) - immatureTotalResNode3 := k.GetImmatureTotalReward(ctx, resOwner3) - require.Equal(t, individualTotalReward, sdk.NewInt(29296296294)) - require.Equal(t, matureTotalResNode3, sdk.ZeroInt()) - require.Equal(t, immatureTotalResNode3, sdk.NewInt(29296296294)) - fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode3.String() + ",\timmatureTotal = " + immatureTotalResNode3.String()) - - idvRwdResNode4Ep1, _ := k.GetIndividualReward(ctx, resOwner4, epoch2017) - individualTotalReward = idvRwdResNode4Ep1.RewardFromMiningPool.Add(idvRwdResNode4Ep1.RewardFromTrafficPool...) - matureTotalResNode4 := k.GetMatureTotalReward(ctx, resOwner4) - immatureTotalResNode4 := k.GetImmatureTotalReward(ctx, resOwner4) - require.Equal(t, individualTotalReward, sdk.NewInt(2929629628)) - require.Equal(t, matureTotalResNode4, sdk.ZeroInt()) - require.Equal(t, immatureTotalResNode4, sdk.NewInt(2929629628)) - fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode4.String() + ",\timmatureTotal = " + immatureTotalResNode4.String()) - - idvRwdResNode5Ep1, _ := k.GetIndividualReward(ctx, resOwner5, epoch2017) - individualTotalReward = idvRwdResNode5Ep1.RewardFromMiningPool.Add(idvRwdResNode5Ep1.RewardFromTrafficPool...) - matureTotalResNode5 := k.GetMatureTotalReward(ctx, resOwner5) - immatureTotalResNode5 := k.GetImmatureTotalReward(ctx, resOwner5) - require.Equal(t, individualTotalReward, sdk.NewInt(2929629628)) - require.Equal(t, matureTotalResNode5, sdk.ZeroInt()) - require.Equal(t, immatureTotalResNode5, sdk.NewInt(2929629628)) - fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode5.String() + ",\timmatureTotal = " + immatureTotalResNode5.String()) - - idvRwdIdxNode1Ep1, _ := k.GetIndividualReward(ctx, idxOwner1, epoch2017) - individualTotalReward = idvRwdIdxNode1Ep1.RewardFromMiningPool.Add(idvRwdIdxNode1Ep1.RewardFromTrafficPool...) - matureTotalIdxNode1 := k.GetMatureTotalReward(ctx, idxOwner1) - immatureTotalIdxNode1 := k.GetImmatureTotalReward(ctx, idxOwner1) - require.Equal(t, individualTotalReward, sdk.NewInt(19530864195)) - require.Equal(t, matureTotalIdxNode1, sdk.ZeroInt()) - require.Equal(t, immatureTotalIdxNode1, sdk.NewInt(19530864195)) - fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode1.String() + ",\timmatureTotal = " + immatureTotalIdxNode1.String()) - - idvRwdIdxNode2Ep1, _ := k.GetIndividualReward(ctx, idxOwner2, epoch2017) - individualTotalReward = idvRwdIdxNode2Ep1.RewardFromMiningPool.Add(idvRwdIdxNode2Ep1.RewardFromTrafficPool...) - matureTotalIdxNode2 := k.GetMatureTotalReward(ctx, idxOwner2) - immatureTotalIdxNode2 := k.GetImmatureTotalReward(ctx, idxOwner2) - require.Equal(t, individualTotalReward, sdk.NewInt(19530864195)) - require.Equal(t, matureTotalIdxNode2, sdk.ZeroInt()) - require.Equal(t, immatureTotalIdxNode2, sdk.NewInt(19530864195)) - fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode2.String() + ",\timmatureTotal = " + immatureTotalIdxNode2.String()) - - idvRwdIdxNode3Ep1, _ := k.GetIndividualReward(ctx, idxOwner3, epoch2017) - individualTotalReward = idvRwdIdxNode3Ep1.RewardFromMiningPool.Add(idvRwdIdxNode3Ep1.RewardFromTrafficPool...) - matureTotalIdxNode3 := k.GetMatureTotalReward(ctx, idxOwner3) - immatureTotalIdxNode3 := k.GetImmatureTotalReward(ctx, idxOwner3) - require.Equal(t, individualTotalReward, sdk.NewInt(19530864195)) - require.Equal(t, matureTotalIdxNode3, sdk.ZeroInt()) - require.Equal(t, immatureTotalIdxNode3, sdk.NewInt(19530864195)) - fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode3.String() + ",\timmatureTotal = " + immatureTotalIdxNode3.String()) - fmt.Println("***************************************************************************************") -} - -// 20% of traffic reward distribute to all validators/delegators by shares of stake -func testBlockChainRewardFromTrafficPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { - distributeGoal := types.InitDistributeGoal() - rewardDetailMap := make(map[string]types.Reward) - - //1, calc traffic reward in total - _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) - require.NoError(t, err) - - // stake reward split by the amount of delegation/deposit - // total delegation of validator/resource node/indexing node is 15stos - require.Equal(t, distributeGoal.BlockChainRewardToValidatorFromTrafficPool, distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool) - require.Equal(t, distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool, distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool) - - //Only keep blockchain reward to test - distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - distributeGoal.TrafficRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - fmt.Println("testBlockChainRewardFromTrafficPool: \n" + distributeGoal.String()) - - //Get excepted reward before calculation method changed the value of distributeGoal - exceptedValRwd := distributeGoal.BlockChainRewardToValidatorFromTrafficPool.Amount - exceptedResNodeRwd := distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool.Amount.ToDec().Quo(sdk.NewDec(5)).TruncateInt() - exceptedIdxNodeRwd := distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() - feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) - - /********************************* after calculation method, value of distributeGoal object will change ******************************************/ - //3, calc reward for resource node - rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) - //4, calc reward from indexing node - rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) - //5, deduct reward from provider account - err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) - require.NoError(t, err) - //6, distribute skate reward to fee pool for validators - distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) - require.NoError(t, err) - - feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) - - require.Equal(t, feePoolBefore.Add(sdk.NewCoin(k.BondDenom(ctx), exceptedValRwd)), feePoolAfter) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool) - - fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) - fmt.Println("***************************************************************************************") -} - -// 20% of traffic reward equally distribute to all indexing nodes -func testMetaNodeRewardFromTrafficPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { - distributeGoal := types.InitDistributeGoal() - rewardDetailMap := make(map[string]types.Reward) - - _, totalReward := k.GetTrafficReward(ctx, trafficList) - - //1, calc traffic reward in total - _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) - require.NoError(t, err) - - //Only keep meta node reward to test - distributeGoal.BlockChainRewardToValidatorFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - distributeGoal.TrafficRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - fmt.Println("testMetaNodeRewardFromTrafficPool: \n" + distributeGoal.String()) - - //20% of traffic reward to meta nodes - exceptedTotalRewardToMetaNodes := totalReward.Mul(sdk.NewDecWithPrec(20, 2)).TruncateInt() - require.Equal(t, exceptedTotalRewardToMetaNodes, distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool) - - //indexing node 1,2,3 have the same share of the meta node reward - exceptedIdxNodeRwd := distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() - exceptedResNodeRwd := sdk.ZeroInt() - feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) - - /********************************* after calculation method, value of distributeGoal object will change ******************************************/ - //3, calc reward for resource node - rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) - //4, calc reward from indexing node - rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) - //5, deduct reward from provider account - err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) - require.NoError(t, err) - //6, distribute skate reward to fee pool for validators - distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) - require.NoError(t, err) - - feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) - - require.Equal(t, feePoolBefore, feePoolAfter) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool) - - fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) - fmt.Println("***************************************************************************************") -} - -// 60% of traffic reward distribute to resource nodes by traffic -func testTrafficRewardFromTrafficPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { - distributeGoal := types.InitDistributeGoal() - rewardDetailMap := make(map[string]types.Reward) - - _, totalReward := k.GetTrafficReward(ctx, trafficList) - - //1, calc traffic reward in total - _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) - require.NoError(t, err) - - //Only keep traffic reward to test - distributeGoal.BlockChainRewardToValidatorFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - fmt.Println("testTrafficRewardFromTrafficPool: \n" + distributeGoal.String()) - - //60% of traffic reward to resource nodes - exceptedTotalRewardToResNodes := totalReward.Mul(sdk.NewDecWithPrec(60, 2)).TruncateInt() - require.Equal(t, exceptedTotalRewardToResNodes, distributeGoal.TrafficRewardToResourceNodeFromTrafficPool) - - //resource node 1,2,3 are in the volume report, so they have stake reward AND traffic reward in this epoch - exceptedResNode1Rwd := distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume1)).Quo(sdk.NewDec(totalVolume)).TruncateInt() - exceptedResNode2Rwd := distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume2)).Quo(sdk.NewDec(totalVolume)).TruncateInt() - exceptedResNode3Rwd := distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume3)).Quo(sdk.NewDec(totalVolume)).TruncateInt() - //resource node 4&5 are not in the volume report, so they only have stake reward in this epoch - exceptedResNode4Rwd := sdk.ZeroInt() - exceptedResNode5Rwd := sdk.ZeroInt() - //indexing node 1,2,3 only have stake reward and meta node reward in this epoch - exceptedIdxNodeRwd := sdk.ZeroInt() - feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) - - /********************************* after calculation method, value of distributeGoal object will change ******************************************/ - //3, calc reward for resource node - rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) - //4, calc reward from indexing node - rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) - //5, deduct reward from provider account - err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) - require.NoError(t, err) - //6, distribute skate reward to fee pool for validators - distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) - require.NoError(t, err) - feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) - - require.Equal(t, feePoolBefore, feePoolAfter) - require.Equal(t, exceptedResNode1Rwd, rewardDetailMap[resOwner1.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNode2Rwd, rewardDetailMap[resOwner2.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNode3Rwd, rewardDetailMap[resOwner3.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNode4Rwd, rewardDetailMap[resOwner4.String()].RewardFromTrafficPool) - require.Equal(t, exceptedResNode5Rwd, rewardDetailMap[resOwner5.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool) - - fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) - fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) - fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) - fmt.Println("***************************************************************************************") -} - -// 20% of mining reward distribute to all validators/delegators by shares of stake -func testBlockChainRewardFromMiningPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { - distributeGoal := types.InitDistributeGoal() - rewardDetailMap := make(map[string]types.Reward) - - //2, calc mining reward in total - distributeGoal, err := k.CalcMiningRewardInTotal(ctx, distributeGoal) - require.NoError(t, err) - - totalMiningReward := distributeGoal.BlockChainRewardToValidatorFromMiningPool.Add(distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool). - Add(distributeGoal.BlockChainRewardToResourceNodeFromMiningPool) - - // since validators, indexing nodes and resource nodes have the same total stake in this test case, - // total block chain reward from mining pool needs to be divisible by 3 - exceptedTotalReward := sdk.NewDec(80000000000).Mul(sdk.NewDecWithPrec(20, 2)).Quo(sdk.NewDec(3)).TruncateDec().Mul(sdk.NewDec(3)).TruncateInt() - require.Equal(t, exceptedTotalReward, totalMiningReward) - // stake reward split by the amount of delegation/deposit - // total delegation of validator/resource node/indexing node is 15stos - require.Equal(t, distributeGoal.BlockChainRewardToValidatorFromMiningPool, distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool) - require.Equal(t, distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool, distributeGoal.BlockChainRewardToResourceNodeFromMiningPool) - - //Only keep blockchain reward to test - distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - distributeGoal.TrafficRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - fmt.Println("testBlockChainRewardFromMiningPool: \n" + distributeGoal.String()) - - //Get excepted reward before calculation method changed the value of distributeGoal - exceptedValRwd := distributeGoal.BlockChainRewardToValidatorFromMiningPool.Amount - exceptedResNodeRwd := distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(5)).TruncateInt() - exceptedIdxNodeRwd := distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() - feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) - - /********************************* after calculation method, value of distributeGoal object will change ******************************************/ - //3, calc reward for resource node - rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) - //4, calc reward from indexing node - rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) - //5, deduct reward from provider account - err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) - require.NoError(t, err) - //6, distribute skate reward to fee pool for validators - distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) - require.NoError(t, err) - - feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) - - require.Equal(t, feePoolBefore.Add(sdk.NewCoin(k.BondDenom(ctx), exceptedValRwd)), feePoolAfter) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromMiningPool) - - fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) - fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) - fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) - fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) - fmt.Println("***************************************************************************************") -} - -// 20% of mining reward equally distribute to all indexing nodes -func testMetaNodeRewardFromMiningPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { - distributeGoal := types.InitDistributeGoal() - rewardDetailMap := make(map[string]types.Reward) - - totalReward := sdk.NewDec(80000000000) - - //2, calc mining reward in total - distributeGoal, err := k.CalcMiningRewardInTotal(ctx, distributeGoal) - require.NoError(t, err) - - //Only keep meta node reward to test - distributeGoal.BlockChainRewardToValidatorFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - distributeGoal.TrafficRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - fmt.Println("testMetaNodeRewardFromMiningPool: \n" + distributeGoal.String()) - - //20% of mining reward to meta nodes - exceptedTotalRewardToMetaNodes := totalReward.Mul(sdk.NewDecWithPrec(20, 2)).TruncateInt() - require.Equal(t, exceptedTotalRewardToMetaNodes, distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool) - - //indexing node 1,2,3 have the same share of the meta node reward - exceptedIdxNodeRwd := distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() - exceptedResNodeRwd := sdk.ZeroInt() - feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) - - /********************************* after calculation method, value of distributeGoal object will change ******************************************/ - //3, calc reward for resource node - rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) - //4, calc reward from indexing node - rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) - //5, deduct reward from provider account - err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) - require.NoError(t, err) - //6, distribute skate reward to fee pool for validators - distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) - require.NoError(t, err) - - feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) - - require.Equal(t, feePoolBefore, feePoolAfter) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromMiningPool) - - fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) - fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) - fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) - fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) - fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) - fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) - fmt.Println("***************************************************************************************") -} - -// 60% of mining reward distribute to resource nodes by traffic -func testTrafficRewardFromMiningPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { - distributeGoal := types.InitDistributeGoal() - rewardDetailMap := make(map[string]types.Reward) - - totalReward := sdk.NewDec(80000000000) - - //2, calc mining reward in total - distributeGoal, err := k.CalcMiningRewardInTotal(ctx, distributeGoal) - require.NoError(t, err) - - //Only keep traffic reward to test - distributeGoal.BlockChainRewardToValidatorFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - distributeGoal.BlockChainRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - fmt.Println("testTrafficRewardFromMiningPool: \n" + distributeGoal.String()) - - //60% of mining reward to resource nodes - exceptedTotalRewardToResNodes := totalReward.Mul(sdk.NewDecWithPrec(60, 2)).TruncateInt() - require.Equal(t, exceptedTotalRewardToResNodes, distributeGoal.TrafficRewardToResourceNodeFromMiningPool) - - //resource node 1,2,3 are in the volume report, so they have stake reward AND traffic reward in this epoch - exceptedResNode1Rwd := distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume1)).Quo(sdk.NewDec(totalVolume)).TruncateInt() - exceptedResNode2Rwd := distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume2)).Quo(sdk.NewDec(totalVolume)).TruncateInt() - exceptedResNode3Rwd := distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume3)).Quo(sdk.NewDec(totalVolume)).TruncateInt() - //resource node 4&5 are not in the volume report, so they only have stake reward in this epoch - exceptedResNode4Rwd := sdk.ZeroInt() - exceptedResNode5Rwd := sdk.ZeroInt() - //indexing node 1,2,3 only have stake reward and meta node reward in this epoch - exceptedIdxNodeRwd := sdk.ZeroInt() - feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) - - /********************************* after calculation method, value of distributeGoal object will change ******************************************/ - //3, calc reward for resource node - rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) - //4, calc reward from indexing node - rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) - //5, deduct reward from provider account - err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) - require.NoError(t, err) - //6, distribute skate reward to fee pool for validators - distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) - require.NoError(t, err) - feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) - - require.Equal(t, feePoolBefore, feePoolAfter) - require.Equal(t, exceptedResNode1Rwd, rewardDetailMap[resOwner1.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNode2Rwd, rewardDetailMap[resOwner2.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNode3Rwd, rewardDetailMap[resOwner3.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNode4Rwd, rewardDetailMap[resOwner4.String()].RewardFromMiningPool) - require.Equal(t, exceptedResNode5Rwd, rewardDetailMap[resOwner5.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromMiningPool) - require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromMiningPool) - - fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) - fmt.Println("resourceNode1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) - fmt.Println("resourceNode2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) - fmt.Println("resourceNode3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) - fmt.Println("resourceNode4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) - fmt.Println("resourceNode5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) - fmt.Println("indexingNode1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) - fmt.Println("indexingNode2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) - fmt.Println("indexingNode3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) - fmt.Println("***************************************************************************************") -} - -func createAccount(t *testing.T, ctx sdk.Context, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, acc sdk.AccAddress, coins sdk.Coins) { - account := accountKeeper.GetAccount(ctx, acc) - if account == nil { - account = accountKeeper.NewAccountWithAddress(ctx, acc) - //fmt.Printf("create account: " + account.String() + "\n") - } - coins, err := bankKeeper.AddCoins(ctx, acc, coins) - require.NoError(t, err) -} - -func getFeePoolBalance(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper) sdk.Coins { - feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(k.feeCollectorName) - require.NotNil(t, feePoolAccAddr) - coins := bankKeeper.GetCoins(ctx, feePoolAccAddr) - return coins -} +//import ( +// "fmt" +// "testing" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/cosmos/cosmos-sdk/x/staking" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/pot/types" +// "github.com/stratosnet/stratos-chain/x/register" +// "github.com/stretchr/testify/require" +// "github.com/tendermint/tendermint/crypto/ed25519" +//) +// +//const ( +// stos2ustos = 1000000000 +// oz2uoz = 1000000000 +// +// resourceNodeVolume1 = 500 * oz2uoz +// resourceNodeVolume2 = 300 * oz2uoz +// resourceNodeVolume3 = 200 * oz2uoz +// totalVolume = resourceNodeVolume1 + resourceNodeVolume2 + resourceNodeVolume3 +//) +// +//var ( +// foundationDeposit = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(40000000*stos2ustos))) +// +// resOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// resOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// resOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// resOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// resOwner5 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// idxOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// idxOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// idxOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// +// pubKeyRes1 = ed25519.GenPrivKey().PubKey() +// addrRes1 = stratos.SdsAddress(pubKeyRes1.Address()) +// initialStakeRes1 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) +// +// pubKeyRes2 = ed25519.GenPrivKey().PubKey() +// addrRes2 = stratos.SdsAddress(pubKeyRes2.Address()) +// initialStakeRes2 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) +// +// pubKeyRes3 = ed25519.GenPrivKey().PubKey() +// addrRes3 = stratos.SdsAddress(pubKeyRes3.Address()) +// initialStakeRes3 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) +// +// pubKeyRes4 = ed25519.GenPrivKey().PubKey() +// addrRes4 = stratos.SdsAddress(pubKeyRes4.Address()) +// initialStakeRes4 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) +// +// pubKeyRes5 = ed25519.GenPrivKey().PubKey() +// addrRes5 = stratos.SdsAddress(pubKeyRes5.Address()) +// initialStakeRes5 = sdk.NewCoin("ustos", sdk.NewInt(3*stos2ustos)) +// +// pubKeyIdx1 = ed25519.GenPrivKey().PubKey() +// addrIdx1 = stratos.SdsAddress(pubKeyIdx1.Address()) +// initialStakeIdx1 = sdk.NewCoin("ustos", sdk.NewInt(5*stos2ustos)) +// +// pubKeyIdx2 = ed25519.GenPrivKey().PubKey() +// addrIdx2 = stratos.SdsAddress(pubKeyIdx2.Address()) +// initialStakeIdx2 = sdk.NewCoin("ustos", sdk.NewInt(5*stos2ustos)) +// +// pubKeyIdx3 = ed25519.GenPrivKey().PubKey() +// addrIdx3 = stratos.SdsAddress(pubKeyIdx3.Address()) +// initialStakeIdx3 = sdk.NewCoin("ustos", sdk.NewInt(5*stos2ustos)) +// +// valOpPk1 = ed25519.GenPrivKey().PubKey() +// valOpAddr1 = sdk.ValAddress(valOpPk1.Address()) +// valAccAddr1 = sdk.AccAddress(valOpPk1.Address()) +// valConsPk1 = ed25519.GenPrivKey().PubKey() +// valInitialStake = sdk.NewCoin("ustos", sdk.NewInt(15*stos2ustos)) +// +// totalUnissuedPrePay = sdk.NewCoin("ustos", sdk.NewInt(5000*stos2ustos)) +// remainingOzoneLimit = sdk.NewInt(5000 * oz2uoz) +// initialUOzonePrice = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz +// +// epoch1 = sdk.NewInt(1) +// epoch2017 = epoch1.Add(sdk.NewInt(2016)) +// epoch4033 = epoch2017.Add(sdk.NewInt(2016)) +//) +// +//func Test(t *testing.T) { +// +// //prepare keepers +// ctx, accountKeeper, bankKeeper, k, stakingKeeper, _, supplyKeeper, registerKeeper := CreateTestInput(t, false) +// +// // create validator with 50% commission +// stakingHandler := staking.NewHandler(stakingKeeper) +// createAccount(t, ctx, accountKeeper, bankKeeper, valAccAddr1, sdk.NewCoins(valInitialStake)) +// commission := staking.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) +// msgVal := staking.NewMsgCreateValidator(valOpAddr1, valConsPk1, valInitialStake, staking.Description{}, commission, sdk.OneInt()) +// res, err := stakingHandler(ctx, msgVal) +// require.NoError(t, err) +// require.NotNil(t, res) +// stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) +// +// /************************************************** pot reward distribution part start ************************************************************/ +// //initial genesis stake total value +// initialGenesisStakeTotal := initialStakeRes1.Add(initialStakeRes2).Add(initialStakeRes3).Add(initialStakeRes4).Add(initialStakeRes5). +// Add(initialStakeIdx1).Add(initialStakeIdx2).Add(initialStakeIdx3) +// registerKeeper.SetInitialGenesisStakeTotal(ctx, initialGenesisStakeTotal.Amount) +// +// //PrePay +// registerKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrePay) +// //remaining ozone limit +// registerKeeper.SetRemainingOzoneLimit(ctx, remainingOzoneLimit) +// //initial uoz price +// registerKeeper.SetInitialUOzonePrice(ctx, initialUOzonePrice) +// +// //pot genesis data load +// foundationAccountAddr := supplyKeeper.GetModuleAddress(types.FoundationAccount) +// err = bankKeeper.SetCoins(ctx, foundationAccountAddr, foundationDeposit) +// require.NoError(t, err) +// +// //initialize owner accounts +// createAccount(t, ctx, accountKeeper, bankKeeper, resOwner1, sdk.NewCoins(initialStakeRes1)) +// createAccount(t, ctx, accountKeeper, bankKeeper, resOwner2, sdk.NewCoins(initialStakeRes2)) +// createAccount(t, ctx, accountKeeper, bankKeeper, resOwner3, sdk.NewCoins(initialStakeRes3)) +// createAccount(t, ctx, accountKeeper, bankKeeper, resOwner4, sdk.NewCoins(initialStakeRes4)) +// createAccount(t, ctx, accountKeeper, bankKeeper, resOwner5, sdk.NewCoins(initialStakeRes5)) +// createAccount(t, ctx, accountKeeper, bankKeeper, idxOwner1, sdk.NewCoins(initialStakeIdx1)) +// createAccount(t, ctx, accountKeeper, bankKeeper, idxOwner2, sdk.NewCoins(initialStakeIdx2)) +// createAccount(t, ctx, accountKeeper, bankKeeper, idxOwner3, sdk.NewCoins(initialStakeIdx3)) +// //initialize sds node register msg +// msgRes1 := register.NewMsgCreateResourceNode(addrRes1, pubKeyRes1, initialStakeRes1, resOwner1, register.NewDescription("sds://resourceNode1", "", "", "", ""), 4) +// msgRes2 := register.NewMsgCreateResourceNode(addrRes2, pubKeyRes2, initialStakeRes2, resOwner2, register.NewDescription("sds://resourceNode2", "", "", "", ""), 4) +// msgRes3 := register.NewMsgCreateResourceNode(addrRes3, pubKeyRes3, initialStakeRes3, resOwner3, register.NewDescription("sds://resourceNode3", "", "", "", ""), 4) +// msgRes4 := register.NewMsgCreateResourceNode(addrRes4, pubKeyRes4, initialStakeRes4, resOwner4, register.NewDescription("sds://resourceNode4", "", "", "", ""), 4) +// msgRes5 := register.NewMsgCreateResourceNode(addrRes5, pubKeyRes5, initialStakeRes5, resOwner5, register.NewDescription("sds://resourceNode5", "", "", "", ""), 4) +// msgIdx1 := register.NewMsgCreateIndexingNode(addrIdx1, pubKeyIdx1, initialStakeIdx1, idxOwner1, register.NewDescription("sds://indexingNode1", "", "", "", "")) +// msgIdx2 := register.NewMsgCreateIndexingNode(addrIdx2, pubKeyIdx2, initialStakeIdx2, idxOwner2, register.NewDescription("sds://indexingNode2", "", "", "", "")) +// msgIdx3 := register.NewMsgCreateIndexingNode(addrIdx3, pubKeyIdx3, initialStakeIdx3, idxOwner3, register.NewDescription("sds://indexingNode3", "", "", "", "")) +// +// //register sds nodes +// registerHandler := register.NewHandler(registerKeeper) +// res, err = registerHandler(ctx, msgRes1) +// require.NoError(t, err) +// require.NotNil(t, res) +// res, err = registerHandler(ctx, msgRes2) +// require.NoError(t, err) +// require.NotNil(t, res) +// res, err = registerHandler(ctx, msgRes3) +// require.NoError(t, err) +// require.NotNil(t, res) +// res, err = registerHandler(ctx, msgRes4) +// require.NoError(t, err) +// require.NotNil(t, res) +// res, err = registerHandler(ctx, msgRes5) +// require.NoError(t, err) +// require.NotNil(t, res) +// res, err = registerHandler(ctx, msgIdx1) +// require.NoError(t, err) +// require.NotNil(t, res) +// res, err = registerHandler(ctx, msgIdx2) +// require.NoError(t, err) +// require.NotNil(t, res) +// res, err = registerHandler(ctx, msgIdx3) +// require.NoError(t, err) +// require.NotNil(t, res) +// +// // set the status of indexing nodes to bonded +// idxUnBondedPool := k.RegisterKeeper.GetIndexingNodeNotBondedToken(ctx) +// k.RegisterKeeper.SetIndexingNodeBondedToken(ctx, idxUnBondedPool) +// k.RegisterKeeper.SetIndexingNodeNotBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) +// idxNode1, _ := k.RegisterKeeper.GetIndexingNode(ctx, stratos.SdsAddress(addrIdx1)) +// idxNode2, _ := k.RegisterKeeper.GetIndexingNode(ctx, stratos.SdsAddress(addrIdx2)) +// idxNode3, _ := k.RegisterKeeper.GetIndexingNode(ctx, stratos.SdsAddress(addrIdx3)) +// idxNode1.Status = sdk.Bonded +// idxNode2.Status = sdk.Bonded +// idxNode3.Status = sdk.Bonded +// k.RegisterKeeper.SetIndexingNode(ctx, idxNode1) +// k.RegisterKeeper.SetIndexingNode(ctx, idxNode2) +// k.RegisterKeeper.SetIndexingNode(ctx, idxNode3) +// +// //build traffic list +// var trafficList []types.SingleWalletVolume +// trafficList = append(trafficList, types.NewSingleWalletVolume(resOwner1, sdk.NewInt(resourceNodeVolume1))) +// trafficList = append(trafficList, types.NewSingleWalletVolume(resOwner2, sdk.NewInt(resourceNodeVolume2))) +// trafficList = append(trafficList, types.NewSingleWalletVolume(resOwner3, sdk.NewInt(resourceNodeVolume3))) +// +// //check prepared data +// S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() +// fmt.Println("S=" + S.String()) +// Pt := registerKeeper.GetTotalUnissuedPrepay(ctx).Amount.ToDec() +// fmt.Println("Pt=" + Pt.String()) +// Y := k.GetTotalConsumedUoz(trafficList).ToDec() +// fmt.Println("Y=" + Y.String()) +// Lt := k.RegisterKeeper.GetRemainingOzoneLimit(ctx).ToDec() +// fmt.Println("Lt=" + Lt.String()) +// R := S.Add(Pt).Mul(Y).Quo(Lt.Add(Y)) +// fmt.Println("R=" + R.String()) +// +// fmt.Println("***************************************************************************************") +// +// testBlockChainRewardFromTrafficPool(t, ctx, k, bankKeeper, trafficList) +// testMetaNodeRewardFromTrafficPool(t, ctx, k, bankKeeper, trafficList) +// testTrafficRewardFromTrafficPool(t, ctx, k, bankKeeper, trafficList) +// +// testBlockChainRewardFromMiningPool(t, ctx, k, bankKeeper, trafficList) +// testMetaNodeRewardFromMiningPool(t, ctx, k, bankKeeper, trafficList) +// testTrafficRewardFromMiningPool(t, ctx, k, bankKeeper, trafficList) +// +// testFullDistributeProcessAtEpoch1(t, ctx, k, trafficList) +// testFullDistributeProcessAtEpoch2017(t, ctx, k, trafficList) +// testWithdraw(t, ctx, k, bankKeeper) +// +//} +// +//func testWithdraw(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper) { +// AccountBalanceBefore := bankKeeper.GetCoins(ctx, resOwner1) +// +// err := k.Withdraw(ctx, sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(68846296294))), resOwner2, resOwner2) +// require.Error(t, err, types.ErrNotTheOwner) +// +// err = k.Withdraw(ctx, sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(68846296295))), resOwner1, resOwner1) +// require.Error(t, err, types.ErrInsufficientMatureTotal) +// +// err = k.Withdraw(ctx, sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(68846296294))), resOwner1, resOwner1) +// require.NoError(t, err) +// +// AccountBalanceAfter := bankKeeper.GetCoins(ctx, resOwner1) +// require.Equal(t, AccountBalanceAfter.Sub(AccountBalanceBefore).AmountOf("ustos"), sdk.NewInt(68846296294)) +// +// matureTotalResNode1 := k.GetMatureTotalReward(ctx, resOwner1) +// require.Equal(t, matureTotalResNode1, sdk.ZeroInt()) +//} +// +//func testFullDistributeProcessAtEpoch2017(t *testing.T, ctx sdk.Context, k Keeper, trafficList []types.SingleWalletVolume) { +// _, err := k.DistributePotReward(ctx, trafficList, epoch2017) +// require.NoError(t, err) +// fmt.Println("Distribution result at Epoch2017: ") +// fmt.Println("----------------------------------------------------------------------------------") +// +// idvRwdResNode1Ep1, _ := k.GetIndividualReward(ctx, resOwner1, epoch4033) +// individualTotalReward := idvRwdResNode1Ep1.RewardFromMiningPool.Add(idvRwdResNode1Ep1.RewardFromTrafficPool...) +// matureTotalResNode1 := k.GetMatureTotalReward(ctx, resOwner1) +// immatureTotalResNode1 := k.GetImmatureTotalReward(ctx, resOwner1) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode1.String() + ",\timmatureTotal = " + immatureTotalResNode1.String()) +// require.Equal(t, individualTotalReward, sdk.NewInt(67630195471)) +// require.Equal(t, matureTotalResNode1, sdk.NewInt(68846296294)) +// require.Equal(t, immatureTotalResNode1, sdk.NewInt(67630195471)) +// +// idvRwdResNode2Ep1, _ := k.GetIndividualReward(ctx, resOwner2, epoch4033) +// individualTotalReward = idvRwdResNode2Ep1.RewardFromMiningPool.Add(idvRwdResNode2Ep1.RewardFromTrafficPool...) +// matureTotalResNode2 := k.GetMatureTotalReward(ctx, resOwner2) +// immatureTotalResNode2 := k.GetImmatureTotalReward(ctx, resOwner2) +// require.Equal(t, individualTotalReward, sdk.NewInt(41729269545)) +// require.Equal(t, matureTotalResNode2, sdk.NewInt(42479629627)) +// require.Equal(t, immatureTotalResNode2, sdk.NewInt(41729269545)) +// fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode2.String() + ",\timmatureTotal = " + immatureTotalResNode2.String()) +// +// idvRwdResNode3Ep1, _ := k.GetIndividualReward(ctx, resOwner3, epoch4033) +// individualTotalReward = idvRwdResNode3Ep1.RewardFromMiningPool.Add(idvRwdResNode3Ep1.RewardFromTrafficPool...) +// matureTotalResNode3 := k.GetMatureTotalReward(ctx, resOwner3) +// immatureTotalResNode3 := k.GetImmatureTotalReward(ctx, resOwner3) +// require.Equal(t, individualTotalReward, sdk.NewInt(28778806582)) +// require.Equal(t, matureTotalResNode3, sdk.NewInt(29296296294)) +// require.Equal(t, immatureTotalResNode3, sdk.NewInt(28778806582)) +// fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode3.String() + ",\timmatureTotal = " + immatureTotalResNode3.String()) +// +// idvRwdResNode4Ep1, _ := k.GetIndividualReward(ctx, resOwner4, epoch4033) +// individualTotalReward = idvRwdResNode4Ep1.RewardFromMiningPool.Add(idvRwdResNode4Ep1.RewardFromTrafficPool...) +// matureTotalResNode4 := k.GetMatureTotalReward(ctx, resOwner4) +// immatureTotalResNode4 := k.GetImmatureTotalReward(ctx, resOwner4) +// require.Equal(t, individualTotalReward, sdk.NewInt(2877880657)) +// require.Equal(t, matureTotalResNode4, sdk.NewInt(2929629628)) +// require.Equal(t, immatureTotalResNode4, sdk.NewInt(2877880657)) +// fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode4.String() + ",\timmatureTotal = " + immatureTotalResNode4.String()) +// +// idvRwdResNode5Ep1, _ := k.GetIndividualReward(ctx, resOwner5, epoch4033) +// individualTotalReward = idvRwdResNode5Ep1.RewardFromMiningPool.Add(idvRwdResNode5Ep1.RewardFromTrafficPool...) +// matureTotalResNode5 := k.GetMatureTotalReward(ctx, resOwner5) +// immatureTotalResNode5 := k.GetImmatureTotalReward(ctx, resOwner5) +// require.Equal(t, individualTotalReward, sdk.NewInt(2877880657)) +// require.Equal(t, matureTotalResNode5, sdk.NewInt(2929629628)) +// require.Equal(t, immatureTotalResNode5, sdk.NewInt(2877880657)) +// fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode5.String() + ",\timmatureTotal = " + immatureTotalResNode5.String()) +// +// idvRwdIdxNode1Ep1, _ := k.GetIndividualReward(ctx, idxOwner1, epoch4033) +// individualTotalReward = idvRwdIdxNode1Ep1.RewardFromMiningPool.Add(idvRwdIdxNode1Ep1.RewardFromTrafficPool...) +// matureTotalIdxNode1 := k.GetMatureTotalReward(ctx, idxOwner1) +// immatureTotalIdxNode1 := k.GetImmatureTotalReward(ctx, idxOwner1) +// require.Equal(t, individualTotalReward, sdk.NewInt(19185871053)) +// require.Equal(t, matureTotalIdxNode1, sdk.NewInt(19530864195)) +// require.Equal(t, immatureTotalIdxNode1, sdk.NewInt(19185871053)) +// fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode1.String() + ",\timmatureTotal = " + immatureTotalIdxNode1.String()) +// +// idvRwdIdxNode2Ep1, _ := k.GetIndividualReward(ctx, idxOwner2, epoch4033) +// individualTotalReward = idvRwdIdxNode2Ep1.RewardFromMiningPool.Add(idvRwdIdxNode2Ep1.RewardFromTrafficPool...) +// matureTotalIdxNode2 := k.GetMatureTotalReward(ctx, idxOwner2) +// immatureTotalIdxNode2 := k.GetImmatureTotalReward(ctx, idxOwner2) +// require.Equal(t, individualTotalReward, sdk.NewInt(19185871053)) +// require.Equal(t, matureTotalIdxNode2, sdk.NewInt(19530864195)) +// require.Equal(t, immatureTotalIdxNode2, sdk.NewInt(19185871053)) +// fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode2.String() + ",\timmatureTotal = " + immatureTotalIdxNode2.String()) +// +// idvRwdIdxNode3Ep1, _ := k.GetIndividualReward(ctx, idxOwner3, epoch4033) +// individualTotalReward = idvRwdIdxNode3Ep1.RewardFromMiningPool.Add(idvRwdIdxNode3Ep1.RewardFromTrafficPool...) +// matureTotalIdxNode3 := k.GetMatureTotalReward(ctx, idxOwner3) +// immatureTotalIdxNode3 := k.GetImmatureTotalReward(ctx, idxOwner3) +// require.Equal(t, individualTotalReward, sdk.NewInt(19185871053)) +// require.Equal(t, matureTotalIdxNode3, sdk.NewInt(19530864195)) +// require.Equal(t, immatureTotalIdxNode3, sdk.NewInt(19185871053)) +// fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode3.String() + ",\timmatureTotal = " + immatureTotalIdxNode3.String()) +// fmt.Println("***************************************************************************************") +//} +// +//func testFullDistributeProcessAtEpoch1(t *testing.T, ctx sdk.Context, k Keeper, trafficList []types.SingleWalletVolume) { +// //PrePay +// k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrePay) +// +// _, err := k.DistributePotReward(ctx, trafficList, epoch1) +// require.NoError(t, err) +// +// fmt.Println("Distribution result at Epoch1: ") +// fmt.Println("----------------------------------------------------------------------------------") +// +// idvRwdResNode1Ep1, _ := k.GetIndividualReward(ctx, resOwner1, epoch2017) +// individualTotalReward := idvRwdResNode1Ep1.RewardFromMiningPool.Add(idvRwdResNode1Ep1.RewardFromTrafficPool...) +// matureTotalResNode1 := k.GetMatureTotalReward(ctx, resOwner1) +// immatureTotalResNode1 := k.GetImmatureTotalReward(ctx, resOwner1) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode1.String() + ",\timmatureTotal = " + immatureTotalResNode1.String()) +// require.Equal(t, individualTotalReward, sdk.NewInt(68846296294)) +// require.Equal(t, matureTotalResNode1, sdk.ZeroInt()) +// require.Equal(t, immatureTotalResNode1, sdk.NewInt(68846296294)) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode1.String() + ",\timmatureTotal = " + immatureTotalResNode1.String()) +// +// idvRwdResNode2Ep1, _ := k.GetIndividualReward(ctx, resOwner2, epoch2017) +// individualTotalReward = idvRwdResNode2Ep1.RewardFromMiningPool.Add(idvRwdResNode2Ep1.RewardFromTrafficPool...) +// matureTotalResNode2 := k.GetMatureTotalReward(ctx, resOwner2) +// immatureTotalResNode2 := k.GetImmatureTotalReward(ctx, resOwner2) +// require.Equal(t, individualTotalReward, sdk.NewInt(42479629627)) +// require.Equal(t, matureTotalResNode2, sdk.ZeroInt()) +// require.Equal(t, immatureTotalResNode2, sdk.NewInt(42479629627)) +// fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode2.String() + ",\timmatureTotal = " + immatureTotalResNode2.String()) +// +// idvRwdResNode3Ep1, _ := k.GetIndividualReward(ctx, resOwner3, epoch2017) +// individualTotalReward = idvRwdResNode3Ep1.RewardFromMiningPool.Add(idvRwdResNode3Ep1.RewardFromTrafficPool...) +// matureTotalResNode3 := k.GetMatureTotalReward(ctx, resOwner3) +// immatureTotalResNode3 := k.GetImmatureTotalReward(ctx, resOwner3) +// require.Equal(t, individualTotalReward, sdk.NewInt(29296296294)) +// require.Equal(t, matureTotalResNode3, sdk.ZeroInt()) +// require.Equal(t, immatureTotalResNode3, sdk.NewInt(29296296294)) +// fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalResNode3.String() + ",\timmatureTotal = " + immatureTotalResNode3.String()) +// +// idvRwdResNode4Ep1, _ := k.GetIndividualReward(ctx, resOwner4, epoch2017) +// individualTotalReward = idvRwdResNode4Ep1.RewardFromMiningPool.Add(idvRwdResNode4Ep1.RewardFromTrafficPool...) +// matureTotalResNode4 := k.GetMatureTotalReward(ctx, resOwner4) +// immatureTotalResNode4 := k.GetImmatureTotalReward(ctx, resOwner4) +// require.Equal(t, individualTotalReward, sdk.NewInt(2929629628)) +// require.Equal(t, matureTotalResNode4, sdk.ZeroInt()) +// require.Equal(t, immatureTotalResNode4, sdk.NewInt(2929629628)) +// fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode4.String() + ",\timmatureTotal = " + immatureTotalResNode4.String()) +// +// idvRwdResNode5Ep1, _ := k.GetIndividualReward(ctx, resOwner5, epoch2017) +// individualTotalReward = idvRwdResNode5Ep1.RewardFromMiningPool.Add(idvRwdResNode5Ep1.RewardFromTrafficPool...) +// matureTotalResNode5 := k.GetMatureTotalReward(ctx, resOwner5) +// immatureTotalResNode5 := k.GetImmatureTotalReward(ctx, resOwner5) +// require.Equal(t, individualTotalReward, sdk.NewInt(2929629628)) +// require.Equal(t, matureTotalResNode5, sdk.ZeroInt()) +// require.Equal(t, immatureTotalResNode5, sdk.NewInt(2929629628)) +// fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", individual = " + individualTotalReward.String() + ", \tmatureTotal = " + matureTotalResNode5.String() + ",\timmatureTotal = " + immatureTotalResNode5.String()) +// +// idvRwdIdxNode1Ep1, _ := k.GetIndividualReward(ctx, idxOwner1, epoch2017) +// individualTotalReward = idvRwdIdxNode1Ep1.RewardFromMiningPool.Add(idvRwdIdxNode1Ep1.RewardFromTrafficPool...) +// matureTotalIdxNode1 := k.GetMatureTotalReward(ctx, idxOwner1) +// immatureTotalIdxNode1 := k.GetImmatureTotalReward(ctx, idxOwner1) +// require.Equal(t, individualTotalReward, sdk.NewInt(19530864195)) +// require.Equal(t, matureTotalIdxNode1, sdk.ZeroInt()) +// require.Equal(t, immatureTotalIdxNode1, sdk.NewInt(19530864195)) +// fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode1.String() + ",\timmatureTotal = " + immatureTotalIdxNode1.String()) +// +// idvRwdIdxNode2Ep1, _ := k.GetIndividualReward(ctx, idxOwner2, epoch2017) +// individualTotalReward = idvRwdIdxNode2Ep1.RewardFromMiningPool.Add(idvRwdIdxNode2Ep1.RewardFromTrafficPool...) +// matureTotalIdxNode2 := k.GetMatureTotalReward(ctx, idxOwner2) +// immatureTotalIdxNode2 := k.GetImmatureTotalReward(ctx, idxOwner2) +// require.Equal(t, individualTotalReward, sdk.NewInt(19530864195)) +// require.Equal(t, matureTotalIdxNode2, sdk.ZeroInt()) +// require.Equal(t, immatureTotalIdxNode2, sdk.NewInt(19530864195)) +// fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode2.String() + ",\timmatureTotal = " + immatureTotalIdxNode2.String()) +// +// idvRwdIdxNode3Ep1, _ := k.GetIndividualReward(ctx, idxOwner3, epoch2017) +// individualTotalReward = idvRwdIdxNode3Ep1.RewardFromMiningPool.Add(idvRwdIdxNode3Ep1.RewardFromTrafficPool...) +// matureTotalIdxNode3 := k.GetMatureTotalReward(ctx, idxOwner3) +// immatureTotalIdxNode3 := k.GetImmatureTotalReward(ctx, idxOwner3) +// require.Equal(t, individualTotalReward, sdk.NewInt(19530864195)) +// require.Equal(t, matureTotalIdxNode3, sdk.ZeroInt()) +// require.Equal(t, immatureTotalIdxNode3, sdk.NewInt(19530864195)) +// fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", individual = " + individualTotalReward.String() + ",\tmatureTotal = " + matureTotalIdxNode3.String() + ",\timmatureTotal = " + immatureTotalIdxNode3.String()) +// fmt.Println("***************************************************************************************") +//} +// +//// 20% of traffic reward distribute to all validators/delegators by shares of stake +//func testBlockChainRewardFromTrafficPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { +// distributeGoal := types.InitDistributeGoal() +// rewardDetailMap := make(map[string]types.Reward) +// +// //1, calc traffic reward in total +// _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) +// require.NoError(t, err) +// +// // stake reward split by the amount of delegation/deposit +// // total delegation of validator/resource node/indexing node is 15stos +// require.Equal(t, distributeGoal.BlockChainRewardToValidatorFromTrafficPool, distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool) +// require.Equal(t, distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool, distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool) +// +// //Only keep blockchain reward to test +// distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// distributeGoal.TrafficRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// fmt.Println("testBlockChainRewardFromTrafficPool: \n" + distributeGoal.String()) +// +// //Get excepted reward before calculation method changed the value of distributeGoal +// exceptedValRwd := distributeGoal.BlockChainRewardToValidatorFromTrafficPool.Amount +// exceptedResNodeRwd := distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool.Amount.ToDec().Quo(sdk.NewDec(5)).TruncateInt() +// exceptedIdxNodeRwd := distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() +// feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// /********************************* after calculation method, value of distributeGoal object will change ******************************************/ +// //3, calc reward for resource node +// rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) +// //4, calc reward from indexing node +// rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) +// //5, deduct reward from provider account +// err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) +// require.NoError(t, err) +// //6, distribute skate reward to fee pool for validators +// distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) +// require.NoError(t, err) +// +// feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// require.Equal(t, feePoolBefore.Add(sdk.NewCoin(k.BondDenom(ctx), exceptedValRwd)), feePoolAfter) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool) +// +// fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) +// fmt.Println("***************************************************************************************") +//} +// +//// 20% of traffic reward equally distribute to all indexing nodes +//func testMetaNodeRewardFromTrafficPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { +// distributeGoal := types.InitDistributeGoal() +// rewardDetailMap := make(map[string]types.Reward) +// +// _, totalReward := k.GetTrafficReward(ctx, trafficList) +// +// //1, calc traffic reward in total +// _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) +// require.NoError(t, err) +// +// //Only keep meta node reward to test +// distributeGoal.BlockChainRewardToValidatorFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// distributeGoal.TrafficRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// fmt.Println("testMetaNodeRewardFromTrafficPool: \n" + distributeGoal.String()) +// +// //20% of traffic reward to meta nodes +// exceptedTotalRewardToMetaNodes := totalReward.Mul(sdk.NewDecWithPrec(20, 2)).TruncateInt() +// require.Equal(t, exceptedTotalRewardToMetaNodes, distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool) +// +// //indexing node 1,2,3 have the same share of the meta node reward +// exceptedIdxNodeRwd := distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() +// exceptedResNodeRwd := sdk.ZeroInt() +// feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// /********************************* after calculation method, value of distributeGoal object will change ******************************************/ +// //3, calc reward for resource node +// rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) +// //4, calc reward from indexing node +// rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) +// //5, deduct reward from provider account +// err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) +// require.NoError(t, err) +// //6, distribute skate reward to fee pool for validators +// distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) +// require.NoError(t, err) +// +// feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// require.Equal(t, feePoolBefore, feePoolAfter) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool) +// +// fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) +// fmt.Println("***************************************************************************************") +//} +// +//// 60% of traffic reward distribute to resource nodes by traffic +//func testTrafficRewardFromTrafficPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { +// distributeGoal := types.InitDistributeGoal() +// rewardDetailMap := make(map[string]types.Reward) +// +// _, totalReward := k.GetTrafficReward(ctx, trafficList) +// +// //1, calc traffic reward in total +// _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) +// require.NoError(t, err) +// +// //Only keep traffic reward to test +// distributeGoal.BlockChainRewardToValidatorFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) +// fmt.Println("testTrafficRewardFromTrafficPool: \n" + distributeGoal.String()) +// +// //60% of traffic reward to resource nodes +// exceptedTotalRewardToResNodes := totalReward.Mul(sdk.NewDecWithPrec(60, 2)).TruncateInt() +// require.Equal(t, exceptedTotalRewardToResNodes, distributeGoal.TrafficRewardToResourceNodeFromTrafficPool) +// +// //resource node 1,2,3 are in the volume report, so they have stake reward AND traffic reward in this epoch +// exceptedResNode1Rwd := distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume1)).Quo(sdk.NewDec(totalVolume)).TruncateInt() +// exceptedResNode2Rwd := distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume2)).Quo(sdk.NewDec(totalVolume)).TruncateInt() +// exceptedResNode3Rwd := distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume3)).Quo(sdk.NewDec(totalVolume)).TruncateInt() +// //resource node 4&5 are not in the volume report, so they only have stake reward in this epoch +// exceptedResNode4Rwd := sdk.ZeroInt() +// exceptedResNode5Rwd := sdk.ZeroInt() +// //indexing node 1,2,3 only have stake reward and meta node reward in this epoch +// exceptedIdxNodeRwd := sdk.ZeroInt() +// feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// /********************************* after calculation method, value of distributeGoal object will change ******************************************/ +// //3, calc reward for resource node +// rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) +// //4, calc reward from indexing node +// rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) +// //5, deduct reward from provider account +// err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) +// require.NoError(t, err) +// //6, distribute skate reward to fee pool for validators +// distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) +// require.NoError(t, err) +// feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// require.Equal(t, feePoolBefore, feePoolAfter) +// require.Equal(t, exceptedResNode1Rwd, rewardDetailMap[resOwner1.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNode2Rwd, rewardDetailMap[resOwner2.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNode3Rwd, rewardDetailMap[resOwner3.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNode4Rwd, rewardDetailMap[resOwner4.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedResNode5Rwd, rewardDetailMap[resOwner5.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool) +// +// fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) +// fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) +// fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) +// fmt.Println("***************************************************************************************") +//} +// +//// 20% of mining reward distribute to all validators/delegators by shares of stake +//func testBlockChainRewardFromMiningPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { +// distributeGoal := types.InitDistributeGoal() +// rewardDetailMap := make(map[string]types.Reward) +// +// //2, calc mining reward in total +// distributeGoal, err := k.CalcMiningRewardInTotal(ctx, distributeGoal) +// require.NoError(t, err) +// +// totalMiningReward := distributeGoal.BlockChainRewardToValidatorFromMiningPool.Add(distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool). +// Add(distributeGoal.BlockChainRewardToResourceNodeFromMiningPool) +// +// // since validators, indexing nodes and resource nodes have the same total stake in this test case, +// // total block chain reward from mining pool needs to be divisible by 3 +// exceptedTotalReward := sdk.NewDec(80000000000).Mul(sdk.NewDecWithPrec(20, 2)).Quo(sdk.NewDec(3)).TruncateDec().Mul(sdk.NewDec(3)).TruncateInt() +// require.Equal(t, exceptedTotalReward, totalMiningReward) +// // stake reward split by the amount of delegation/deposit +// // total delegation of validator/resource node/indexing node is 15stos +// require.Equal(t, distributeGoal.BlockChainRewardToValidatorFromMiningPool, distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool) +// require.Equal(t, distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool, distributeGoal.BlockChainRewardToResourceNodeFromMiningPool) +// +// //Only keep blockchain reward to test +// distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// distributeGoal.TrafficRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// fmt.Println("testBlockChainRewardFromMiningPool: \n" + distributeGoal.String()) +// +// //Get excepted reward before calculation method changed the value of distributeGoal +// exceptedValRwd := distributeGoal.BlockChainRewardToValidatorFromMiningPool.Amount +// exceptedResNodeRwd := distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(5)).TruncateInt() +// exceptedIdxNodeRwd := distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() +// feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// /********************************* after calculation method, value of distributeGoal object will change ******************************************/ +// //3, calc reward for resource node +// rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) +// //4, calc reward from indexing node +// rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) +// //5, deduct reward from provider account +// err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) +// require.NoError(t, err) +// //6, distribute skate reward to fee pool for validators +// distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) +// require.NoError(t, err) +// +// feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// require.Equal(t, feePoolBefore.Add(sdk.NewCoin(k.BondDenom(ctx), exceptedValRwd)), feePoolAfter) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromMiningPool) +// +// fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) +// fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) +// fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) +// fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) +// fmt.Println("***************************************************************************************") +//} +// +//// 20% of mining reward equally distribute to all indexing nodes +//func testMetaNodeRewardFromMiningPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { +// distributeGoal := types.InitDistributeGoal() +// rewardDetailMap := make(map[string]types.Reward) +// +// totalReward := sdk.NewDec(80000000000) +// +// //2, calc mining reward in total +// distributeGoal, err := k.CalcMiningRewardInTotal(ctx, distributeGoal) +// require.NoError(t, err) +// +// //Only keep meta node reward to test +// distributeGoal.BlockChainRewardToValidatorFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// distributeGoal.TrafficRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// fmt.Println("testMetaNodeRewardFromMiningPool: \n" + distributeGoal.String()) +// +// //20% of mining reward to meta nodes +// exceptedTotalRewardToMetaNodes := totalReward.Mul(sdk.NewDecWithPrec(20, 2)).TruncateInt() +// require.Equal(t, exceptedTotalRewardToMetaNodes, distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool) +// +// //indexing node 1,2,3 have the same share of the meta node reward +// exceptedIdxNodeRwd := distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(3)).TruncateInt() +// exceptedResNodeRwd := sdk.ZeroInt() +// feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// /********************************* after calculation method, value of distributeGoal object will change ******************************************/ +// //3, calc reward for resource node +// rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) +// //4, calc reward from indexing node +// rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) +// //5, deduct reward from provider account +// err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) +// require.NoError(t, err) +// //6, distribute skate reward to fee pool for validators +// distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) +// require.NoError(t, err) +// +// feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// require.Equal(t, feePoolBefore, feePoolAfter) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner1.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner2.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner3.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner4.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNodeRwd, rewardDetailMap[resOwner5.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromMiningPool) +// +// fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) +// fmt.Println("resource_wallet1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) +// fmt.Println("resource_wallet5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) +// fmt.Println("indexing_wallet1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) +// fmt.Println("indexing_wallet2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) +// fmt.Println("indexing_wallet3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) +// fmt.Println("***************************************************************************************") +//} +// +//// 60% of mining reward distribute to resource nodes by traffic +//func testTrafficRewardFromMiningPool(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper, trafficList []types.SingleWalletVolume) { +// distributeGoal := types.InitDistributeGoal() +// rewardDetailMap := make(map[string]types.Reward) +// +// totalReward := sdk.NewDec(80000000000) +// +// //2, calc mining reward in total +// distributeGoal, err := k.CalcMiningRewardInTotal(ctx, distributeGoal) +// require.NoError(t, err) +// +// //Only keep traffic reward to test +// distributeGoal.BlockChainRewardToValidatorFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// distributeGoal.BlockChainRewardToResourceNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// fmt.Println("testTrafficRewardFromMiningPool: \n" + distributeGoal.String()) +// +// //60% of mining reward to resource nodes +// exceptedTotalRewardToResNodes := totalReward.Mul(sdk.NewDecWithPrec(60, 2)).TruncateInt() +// require.Equal(t, exceptedTotalRewardToResNodes, distributeGoal.TrafficRewardToResourceNodeFromMiningPool) +// +// //resource node 1,2,3 are in the volume report, so they have stake reward AND traffic reward in this epoch +// exceptedResNode1Rwd := distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume1)).Quo(sdk.NewDec(totalVolume)).TruncateInt() +// exceptedResNode2Rwd := distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume2)).Quo(sdk.NewDec(totalVolume)).TruncateInt() +// exceptedResNode3Rwd := distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(sdk.NewDec(resourceNodeVolume3)).Quo(sdk.NewDec(totalVolume)).TruncateInt() +// //resource node 4&5 are not in the volume report, so they only have stake reward in this epoch +// exceptedResNode4Rwd := sdk.ZeroInt() +// exceptedResNode5Rwd := sdk.ZeroInt() +// //indexing node 1,2,3 only have stake reward and meta node reward in this epoch +// exceptedIdxNodeRwd := sdk.ZeroInt() +// feePoolBefore := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// /********************************* after calculation method, value of distributeGoal object will change ******************************************/ +// //3, calc reward for resource node +// rewardDetailMap, distributeGoal = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoal, rewardDetailMap) +// //4, calc reward from indexing node +// rewardDetailMap, distributeGoal = k.CalcRewardForIndexingNode(ctx, distributeGoal, rewardDetailMap) +// //5, deduct reward from provider account +// err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch1) +// require.NoError(t, err) +// //6, distribute skate reward to fee pool for validators +// distributeGoal, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoal) +// require.NoError(t, err) +// feePoolAfter := getFeePoolBalance(t, ctx, k, bankKeeper) +// +// require.Equal(t, feePoolBefore, feePoolAfter) +// require.Equal(t, exceptedResNode1Rwd, rewardDetailMap[resOwner1.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNode2Rwd, rewardDetailMap[resOwner2.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNode3Rwd, rewardDetailMap[resOwner3.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNode4Rwd, rewardDetailMap[resOwner4.String()].RewardFromMiningPool) +// require.Equal(t, exceptedResNode5Rwd, rewardDetailMap[resOwner5.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner1.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner2.String()].RewardFromMiningPool) +// require.Equal(t, exceptedIdxNodeRwd, rewardDetailMap[idxOwner3.String()].RewardFromMiningPool) +// +// fmt.Println("reward to fee pool: " + feePoolAfter.Sub(feePoolBefore).String()) +// fmt.Println("resourceNode1: address = " + resOwner1.String() + ", reward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) +// fmt.Println("resourceNode2: address = " + resOwner2.String() + ", reward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) +// fmt.Println("resourceNode3: address = " + resOwner3.String() + ", reward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) +// fmt.Println("resourceNode4: address = " + resOwner4.String() + ", reward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) +// fmt.Println("resourceNode5: address = " + resOwner5.String() + ", reward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) +// fmt.Println("indexingNode1: address = " + idxOwner1.String() + ", reward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) +// fmt.Println("indexingNode2: address = " + idxOwner2.String() + ", reward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) +// fmt.Println("indexingNode3: address = " + idxOwner3.String() + ", reward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) +// fmt.Println("***************************************************************************************") +//} +// +//func createAccount(t *testing.T, ctx sdk.Context, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, acc sdk.AccAddress, coins sdk.Coins) { +// account := accountKeeper.GetAccount(ctx, acc) +// if account == nil { +// account = accountKeeper.NewAccountWithAddress(ctx, acc) +// //fmt.Printf("create account: " + account.String() + "\n") +// } +// coins, err := bankKeeper.AddCoins(ctx, acc, coins) +// require.NoError(t, err) +//} +// +//func getFeePoolBalance(t *testing.T, ctx sdk.Context, k Keeper, bankKeeper bank.Keeper) sdk.Coins { +// feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(k.feeCollectorName) +// require.NotNil(t, feePoolAccAddr) +// coins := bankKeeper.GetCoins(ctx, feePoolAccAddr) +// return coins +//} diff --git a/x/pot/keeper/keeper_tests.go b/x/pot/keeper/keeper_tests.go index 3abb9a5a..606ba38a 100644 --- a/x/pot/keeper/keeper_tests.go +++ b/x/pot/keeper/keeper_tests.go @@ -1,109 +1,110 @@ package keeper -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/params" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/pot/types" - "github.com/stratosnet/stratos-chain/x/register" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" -) - -func TestMain(m *testing.M) { - config := stratos.GetConfig() - - config.Seal() - -} - -func CreateTestInput(t *testing.T, isCheckTx bool) ( - sdk.Context, auth.AccountKeeper, bank.Keeper, Keeper, staking.Keeper, params.Keeper, supply.Keeper, register.Keeper) { - - keyParams := sdk.NewKVStoreKey(params.StoreKey) - tkeyParams := sdk.NewTransientStoreKey(params.TStoreKey) - keySupply := sdk.NewKVStoreKey(supply.StoreKey) - keyAcc := sdk.NewKVStoreKey(auth.StoreKey) - keyStaking := sdk.NewKVStoreKey(staking.StoreKey) - keyRegister := sdk.NewKVStoreKey(register.StoreKey) - keyPot := sdk.NewKVStoreKey(types.StoreKey) - - db := dbm.NewMemDB() - ms := store.NewCommitMultiStore(db) - - ms.MountStoreWithDB(keyParams, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(tkeyParams, sdk.StoreTypeTransient, db) - ms.MountStoreWithDB(keySupply, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(keyStaking, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(keyPot, sdk.StoreTypeIAVL, db) - err := ms.LoadLatestVersion() - require.Nil(t, err) - - feeCollectorAcc := supply.NewEmptyModuleAccount(auth.FeeCollectorName) - notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) - bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) - foundationAccount := supply.NewEmptyModuleAccount(types.FoundationAccount) - - blacklistedAddrs := make(map[string]bool) - blacklistedAddrs[feeCollectorAcc.GetAddress().String()] = true - blacklistedAddrs[notBondedPool.GetAddress().String()] = true - blacklistedAddrs[bondPool.GetAddress().String()] = true - blacklistedAddrs[foundationAccount.GetAddress().String()] = true - - cdc := MakeTestCodec() - pk := params.NewKeeper(cdc, keyParams, tkeyParams) - ctx := sdk.NewContext(ms, abci.Header{ChainID: "foochainid"}, isCheckTx, log.NewNopLogger()) - - accountKeeper := auth.NewAccountKeeper(cdc, keyAcc, pk.Subspace(auth.DefaultParamspace), auth.ProtoBaseAccount) - bankKeeper := bank.NewBaseKeeper(accountKeeper, pk.Subspace(bank.DefaultParamspace), blacklistedAddrs) - maccPerms := map[string][]string{ - auth.FeeCollectorName: nil, - staking.NotBondedPoolName: {supply.Burner, supply.Staking}, - staking.BondedPoolName: {supply.Burner, supply.Staking}, - types.FoundationAccount: nil, - } - supplyKeeper := supply.NewKeeper(cdc, keySupply, accountKeeper, bankKeeper, maccPerms) - stakingKeeper := staking.NewKeeper(cdc, keyStaking, supplyKeeper, pk.Subspace(staking.DefaultParamspace)) - StakingParam := staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, "ustos") - stakingKeeper.SetParams(ctx, StakingParam) - registerKeeper := register.NewKeeper(cdc, keyRegister, pk.Subspace(register.DefaultParamSpace), accountKeeper, bankKeeper) - registerKeeper.SetParams(ctx, register.DefaultParams()) - - keeper := NewKeeper(cdc, keyPot, pk.Subspace(types.DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, accountKeeper, stakingKeeper, registerKeeper) - keeper.SetParams(ctx, types.DefaultParams()) - - supplyKeeper.SetModuleAccount(ctx, feeCollectorAcc) - - return ctx, accountKeeper, bankKeeper, keeper, stakingKeeper, pk, supplyKeeper, registerKeeper -} - -// create a codec used only for testing -func MakeTestCodec() *codec.Codec { - var cdc = codec.New() - - // Register Msgs - cdc.RegisterInterface((*sdk.Msg)(nil), nil) - cdc.RegisterConcrete(register.MsgCreateResourceNode{}, "register/MsgCreateResourceNode", nil) - cdc.RegisterConcrete(register.MsgCreateIndexingNode{}, "register/MsgCreateIndexingNode", nil) - - // Register AppAccount - cdc.RegisterInterface((*authexported.Account)(nil), nil) - cdc.RegisterConcrete(&auth.BaseAccount{}, "test/pot/BaseAccount", nil) - supply.RegisterCodec(cdc) - codec.RegisterCrypto(cdc) - - return cdc -} +// +//import ( +// "testing" +// +// "github.com/cosmos/cosmos-sdk/codec" +// "github.com/cosmos/cosmos-sdk/store" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/cosmos/cosmos-sdk/x/params" +// "github.com/cosmos/cosmos-sdk/x/staking" +// "github.com/cosmos/cosmos-sdk/x/supply" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/pot/types" +// "github.com/stratosnet/stratos-chain/x/register" +// "github.com/stretchr/testify/require" +// abci "github.com/tendermint/tendermint/abci/types" +// "github.com/tendermint/tendermint/libs/log" +// dbm "github.com/tendermint/tm-db" +//) +// +//func TestMain(m *testing.M) { +// config := stratos.GetConfig() +// +// config.Seal() +// +//} +// +//func CreateTestInput(t *testing.T, isCheckTx bool) ( +// sdk.Context, auth.AccountKeeper, bank.Keeper, Keeper, staking.Keeper, params.Keeper, supply.Keeper, register.Keeper) { +// +// keyParams := sdk.NewKVStoreKey(params.StoreKey) +// tkeyParams := sdk.NewTransientStoreKey(params.TStoreKey) +// keySupply := sdk.NewKVStoreKey(supply.StoreKey) +// keyAcc := sdk.NewKVStoreKey(auth.StoreKey) +// keyStaking := sdk.NewKVStoreKey(staking.StoreKey) +// keyRegister := sdk.NewKVStoreKey(register.StoreKey) +// keyPot := sdk.NewKVStoreKey(types.StoreKey) +// +// db := dbm.NewMemDB() +// ms := store.NewCommitMultiStore(db) +// +// ms.MountStoreWithDB(keyParams, sdk.StoreTypeIAVL, db) +// ms.MountStoreWithDB(tkeyParams, sdk.StoreTypeTransient, db) +// ms.MountStoreWithDB(keySupply, sdk.StoreTypeIAVL, db) +// ms.MountStoreWithDB(keyAcc, sdk.StoreTypeIAVL, db) +// ms.MountStoreWithDB(keyStaking, sdk.StoreTypeIAVL, db) +// ms.MountStoreWithDB(keyRegister, sdk.StoreTypeIAVL, db) +// ms.MountStoreWithDB(keyPot, sdk.StoreTypeIAVL, db) +// err := ms.LoadLatestVersion() +// require.Nil(t, err) +// +// feeCollectorAcc := supply.NewEmptyModuleAccount(auth.FeeCollectorName) +// notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) +// bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) +// foundationAccount := supply.NewEmptyModuleAccount(types.FoundationAccount) +// +// blacklistedAddrs := make(map[string]bool) +// blacklistedAddrs[feeCollectorAcc.GetAddress().String()] = true +// blacklistedAddrs[notBondedPool.GetAddress().String()] = true +// blacklistedAddrs[bondPool.GetAddress().String()] = true +// blacklistedAddrs[foundationAccount.GetAddress().String()] = true +// +// cdc := MakeTestCodec() +// pk := params.NewKeeper(cdc, keyParams, tkeyParams) +// ctx := sdk.NewContext(ms, abci.Header{ChainID: "foochainid"}, isCheckTx, log.NewNopLogger()) +// +// accountKeeper := auth.NewAccountKeeper(cdc, keyAcc, pk.Subspace(auth.DefaultParamspace), auth.ProtoBaseAccount) +// bankKeeper := bank.NewBaseKeeper(accountKeeper, pk.Subspace(bank.DefaultParamspace), blacklistedAddrs) +// maccPerms := map[string][]string{ +// auth.FeeCollectorName: nil, +// staking.NotBondedPoolName: {supply.Burner, supply.Staking}, +// staking.BondedPoolName: {supply.Burner, supply.Staking}, +// types.FoundationAccount: nil, +// } +// supplyKeeper := supply.NewKeeper(cdc, keySupply, accountKeeper, bankKeeper, maccPerms) +// stakingKeeper := staking.NewKeeper(cdc, keyStaking, supplyKeeper, pk.Subspace(staking.DefaultParamspace)) +// StakingParam := staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, "ustos") +// stakingKeeper.SetParams(ctx, StakingParam) +// registerKeeper := register.NewKeeper(cdc, keyRegister, pk.Subspace(register.DefaultParamSpace), accountKeeper, bankKeeper) +// registerKeeper.SetParams(ctx, register.DefaultParams()) +// +// keeper := NewKeeper(cdc, keyPot, pk.Subspace(types.DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, accountKeeper, stakingKeeper, registerKeeper) +// keeper.SetParams(ctx, types.DefaultParams()) +// +// supplyKeeper.SetModuleAccount(ctx, feeCollectorAcc) +// +// return ctx, accountKeeper, bankKeeper, keeper, stakingKeeper, pk, supplyKeeper, registerKeeper +//} +// +//// create a codec used only for testing +//func MakeTestCodec() *codec.Codec { +// var cdc = codec.New() +// +// // Register Msgs +// cdc.RegisterInterface((*sdk.Msg)(nil), nil) +// cdc.RegisterConcrete(register.MsgCreateResourceNode{}, "register/MsgCreateResourceNode", nil) +// cdc.RegisterConcrete(register.MsgCreateIndexingNode{}, "register/MsgCreateIndexingNode", nil) +// +// // Register AppAccount +// cdc.RegisterInterface((*authexported.Account)(nil), nil) +// cdc.RegisterConcrete(&auth.BaseAccount{}, "test/pot/BaseAccount", nil) +// supply.RegisterCodec(cdc) +// codec.RegisterCrypto(cdc) +// +// return cdc +//} From fed78599520caa4e77914eb9c840d4245f412943 Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 16 May 2022 14:26:15 -0400 Subject: [PATCH 050/113] - qb-1163: upgrade PoT module --- x/pot/client/cli/query.go | 3 +- x/pot/client/cli/tx.go | 5 +- x/pot/genesis.go | 36 ++++++---- x/pot/keeper/querier.go | 24 +++---- x/pot/module.go | 147 ++++++++++++++++++++++++-------------- x/pot/types/genesis.go | 4 +- 6 files changed, 134 insertions(+), 85 deletions(-) diff --git a/x/pot/client/cli/query.go b/x/pot/client/cli/query.go index 2034b27e..43804f90 100644 --- a/x/pot/client/cli/query.go +++ b/x/pot/client/cli/query.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -14,7 +13,7 @@ import ( ) // GetQueryCmd returns the cli query commands for pot module -func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { +func GetQueryCmd() *cobra.Command { // Group pot queries under a subcommand potQueryCmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/pot/client/cli/tx.go b/x/pot/client/cli/tx.go index af86830b..6ac56caa 100644 --- a/x/pot/client/cli/tx.go +++ b/x/pot/client/cli/tx.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" flag "github.com/spf13/pflag" @@ -22,8 +21,8 @@ type singleWalletVolumeStr struct { Volume string `json:"volume"` } -// GetTxCmd returns the transaction commands for this module -func GetTxCmd(cdc *codec.Codec) *cobra.Command { +// NewTxCmd returns the transaction commands for this module +func NewTxCmd() *cobra.Command { potTxCmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), diff --git a/x/pot/genesis.go b/x/pot/genesis.go index a56b1d14..db5e4651 100644 --- a/x/pot/genesis.go +++ b/x/pot/genesis.go @@ -7,21 +7,33 @@ import ( // InitGenesis initialize default parameters // and the keeper's address to pubkey map -func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) { - keeper.SetParams(ctx, data.Params) - keeper.SetTotalMinedTokens(ctx, data.TotalMinedToken) +func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) { + keeper.SetParams(ctx, *data.Params) + keeper.SetTotalMinedTokens(ctx, *data.TotalMinedToken) keeper.SetLastReportedEpoch(ctx, sdk.NewInt(data.LastReportedEpoch)) for _, immatureTotal := range data.ImmatureTotalInfo { - keeper.SetImmatureTotalReward(ctx, immatureTotal.WalletAddress, immatureTotal.Value) + walletAddr, err := sdk.AccAddressFromBech32(immatureTotal.WalletAddress) + if err != nil { + panic("invliad wallet address when init genesis of PoT module") + } + keeper.SetImmatureTotalReward(ctx, walletAddr, immatureTotal.Value) } for _, matureTotal := range data.MatureTotalInfo { - keeper.SetMatureTotalReward(ctx, matureTotal.WalletAddress, matureTotal.Value) + walletAddr, err := sdk.AccAddressFromBech32(matureTotal.WalletAddress) + if err != nil { + panic("invliad wallet address when init genesis of PoT module") + } + keeper.SetMatureTotalReward(ctx, walletAddr, matureTotal.Value) } for _, individual := range data.IndividualRewardInfo { - keeper.SetIndividualReward(ctx, individual.WalletAddress, sdk.NewInt(data.LastReportedEpoch+1), individual) + walletAddr, err := sdk.AccAddressFromBech32(individual.WalletAddress) + if err != nil { + panic("invliad wallet address when init genesis of PoT module") + } + keeper.SetIndividualReward(ctx, walletAddr, sdk.NewInt(data.LastReportedEpoch+1), *individual) } } @@ -34,27 +46,27 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) (data types.GenesisState) { totalMinedToken := keeper.GetTotalMinedTokens(ctx) lastReportedEpoch := keeper.GetLastReportedEpoch(ctx) - var individualRewardInfo []types.Reward - var immatureTotalInfo []types.ImmatureTotal + var individualRewardInfo []*types.Reward + var immatureTotalInfo []*types.ImmatureTotal keeper.IteratorImmatureTotal(ctx, func(walletAddress sdk.AccAddress, reward sdk.Coins) (stop bool) { if !reward.Empty() && !reward.IsZero() { immatureTotal := types.NewImmatureTotal(walletAddress, reward) - immatureTotalInfo = append(immatureTotalInfo, immatureTotal) + immatureTotalInfo = append(immatureTotalInfo, &immatureTotal) miningReward := sdk.NewCoins(sdk.NewCoin(types.DefaultRewardDenom, reward.AmountOf(types.DefaultRewardDenom))) trafficReward := sdk.NewCoins(sdk.NewCoin(types.DefaultBondDenom, reward.AmountOf(types.DefaultBondDenom))) individualReward := types.NewReward(walletAddress, miningReward, trafficReward) - individualRewardInfo = append(individualRewardInfo, individualReward) + individualRewardInfo = append(individualRewardInfo, &individualReward) } return false }) - var matureTotalInfo []types.MatureTotal + var matureTotalInfo []*types.MatureTotal keeper.IteratorMatureTotal(ctx, func(walletAddress sdk.AccAddress, reward sdk.Coins) (stop bool) { if !reward.Empty() && !reward.IsZero() { matureTotal := types.NewMatureTotal(walletAddress, reward) - matureTotalInfo = append(matureTotalInfo, matureTotal) + matureTotalInfo = append(matureTotalInfo, &matureTotal) } return false }) diff --git a/x/pot/keeper/querier.go b/x/pot/keeper/querier.go index 0acd4c81..6e93a215 100644 --- a/x/pot/keeper/querier.go +++ b/x/pot/keeper/querier.go @@ -21,17 +21,17 @@ const ( ) // NewQuerier creates a new querier for pot clients. -func NewQuerier(k Keeper) sdk.Querier { +func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) { switch path[0] { case QueryVolumeReport: - return queryVolumeReport(ctx, req, k) + return queryVolumeReport(ctx, req, k, legacyQuerierCdc) case QueryPotRewardsByReportEpoch: - return queryPotRewardsByReportEpoch(ctx, req, k) + return queryPotRewardsByReportEpoch(ctx, req, k, legacyQuerierCdc) case QueryPotRewardsByWalletAddr: - return queryPotRewardsByWalletAddress(ctx, req, k) + return queryPotRewardsByWalletAddress(ctx, req, k, legacyQuerierCdc) case QueryPotSlashingByWalletAddr: - return queryPotSlashingByWalletAddress(ctx, req, k) + return queryPotSlashingByWalletAddress(ctx, req, k, legacyQuerierCdc) default: return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown pot query endpoint") } @@ -39,7 +39,7 @@ func NewQuerier(k Keeper) sdk.Querier { } // queryVolumeReport fetches a hash of report volume for the supplied epoch. -func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { epoch, err := strconv.ParseInt(string(req.Data), 10, 64) if err != nil { return []byte{}, err @@ -52,7 +52,7 @@ func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte epoch, k.GetLastReportedEpoch(ctx).String())) return []byte{}, e } - bz, err := codec.MarshalJSONIndent(types.ModuleCdc, reportRecord) + bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, reportRecord) if err != nil { return []byte{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -60,7 +60,7 @@ func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte } // queryPotRewardsByReportEpoch fetches total rewards and owner individual rewards from traffic and mining. -func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var params types.QueryPotRewardsByReportEpochParams err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { @@ -71,7 +71,7 @@ func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keep e := sdkerrors.Wrapf(types.ErrCannotFindReward, fmt.Sprintf("no Pot rewards information at epoch %s", params.Epoch.String())) return []byte{}, e } - bz, err := codec.MarshalJSONIndent(types.ModuleCdc, potEpochRewards) + bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, potEpochRewards) if err != nil { return []byte{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -105,7 +105,7 @@ func (k Keeper) getPotRewardsByReportEpoch(ctx sdk.Context, params types.QueryPo } } -func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var params types.QueryPotRewardsByWalletAddrParams err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { @@ -115,14 +115,14 @@ func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Ke matureTotalReward := k.GetMatureTotalReward(ctx, params.WalletAddr) reward := types.NewPotRewardInfo(params.WalletAddr, matureTotalReward, immatureTotalReward) - bz, err := codec.MarshalJSONIndent(types.ModuleCdc, reward) + bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, reward) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil } -func queryPotSlashingByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryPotSlashingByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { addr, err := sdk.AccAddressFromBech32(string(req.Data)) if err != nil { return []byte(sdk.ZeroInt().String()), types.ErrUnknownAccountAddress diff --git a/x/pot/module.go b/x/pot/module.go index 4ff8f137..a32da7f7 100644 --- a/x/pot/module.go +++ b/x/pot/module.go @@ -1,22 +1,21 @@ package pot import ( + "context" "encoding/json" + "fmt" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/stratosnet/stratos-chain/x/register" - + "github.com/cosmos/cosmos-sdk/client" "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/cosmos-sdk/client/context" "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/x/bank" "github.com/stratosnet/stratos-chain/x/pot/client/cli" "github.com/stratosnet/stratos-chain/x/pot/client/rest" "github.com/stratosnet/stratos-chain/x/pot/keeper" @@ -30,7 +29,9 @@ var ( ) // AppModuleBasic defines the basic application module used by the pot module. -type AppModuleBasic struct{} +type AppModuleBasic struct { + cdc codec.Codec +} // Name returns the pot module's name. func (AppModuleBasic) Name() string { @@ -38,39 +39,48 @@ func (AppModuleBasic) Name() string { } // RegisterCodec registers the pot module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { - types.RegisterCodec(cdc) +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) } -// DefaultGenesis returns default genesis state as raw bytes for the pot +// DefaultGenesis returns default genesis state as raw bytes for the register // module. -func (AppModuleBasic) DefaultGenesis() json.RawMessage { - return types.ModuleCdc.MustMarshalJSON(types.DefaultGenesisState()) +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) } -// ValidateGenesis performs genesis state validation for the pot module. -func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error { +// ValidateGenesis performs genesis state validation for the register module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState - err := types.ModuleCdc.UnmarshalJSON(bz, &data) - if err != nil { - return err + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } return types.ValidateGenesis(data) } // RegisterRESTRoutes registers the REST routes for the pot module. -func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { rest.RegisterRoutes(ctx, rtr) } +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the pot module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) +} + // GetTxCmd returns the root tx command for the pot module. -func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetTxCmd(cdc) +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.NewTxCmd() } // GetQueryCmd returns no root query command for the pot module. -func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetQueryCmd(types.StoreKey, cdc) +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() } //____________________________________________________________________________ @@ -78,22 +88,51 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { // AppModule implements an application module for the pot module. type AppModule struct { AppModuleBasic - keeper keeper.Keeper - bankKeeper bank.Keeper - supplyKeeper supply.Keeper + keeper keeper.Keeper + bankKeeper types.BankKeeper + //supplyKeeper supply.Keeper accountKeeper types.AccountKeeper - stakingKeeper staking.Keeper - registerKeeper register.Keeper + stakingKeeper types.StakingKeeper + registerKeeper types.RegisterKeeper +} + +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, &genesisState) + + return []abci.ValidatorUpdate{} +} + +func (am AppModule) ExportGenesis(sdk.Context, codec.JSONCodec) json.RawMessage { + panic("implement me") +} + +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) +} + +func (am AppModule) RegisterServices(module.Configurator) { + panic("implement me") +} + +func (am AppModule) ConsensusVersion() uint64 { + panic("implement me") } // NewAppModule creates a new AppModule object -func NewAppModule(k keeper.Keeper, bankKeeper bank.Keeper, supplyKeeper supply.Keeper, - accountKeeper types.AccountKeeper, stakingKeeper staking.Keeper, registerKeeper register.Keeper) AppModule { +func NewAppModule(k keeper.Keeper, bankKeeper types.BankKeeper, + accountKeeper types.AccountKeeper, stakingKeeper types.StakingKeeper, registerKeeper types.RegisterKeeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: k, bankKeeper: bankKeeper, - supplyKeeper: supplyKeeper, + //supplyKeeper: supplyKeeper, accountKeeper: accountKeeper, stakingKeeper: stakingKeeper, registerKeeper: registerKeeper, @@ -108,10 +147,10 @@ func (AppModule) Name() string { // RegisterInvariants registers the pot module invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// Route returns the message routing key for the pot module. -func (AppModule) Route() string { - return types.RouterKey -} +//// Route returns the message routing key for the pot module. +//func (AppModule) Route() string { +// return types.RouterKey +//} // NewHandler returns an sdk.Handler for the pot module. func (am AppModule) NewHandler() sdk.Handler { @@ -123,26 +162,26 @@ func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// NewQuerierHandler returns the pot module sdk.Querier. -func (am AppModule) NewQuerierHandler() sdk.Querier { - return keeper.NewQuerier(am.keeper) -} - -// InitGenesis performs genesis initialization for the pot module. It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState - types.ModuleCdc.MustUnmarshalJSON(data, &genesisState) - InitGenesis(ctx, am.keeper, genesisState) - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the exported genesis state as raw bytes for the pot -// module. -func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage { - gs := ExportGenesis(ctx, am.keeper) - return types.ModuleCdc.MustMarshalJSON(gs) -} +// NewQuerierHandler returns the register module sdk.Querier. +func (am AppModule) NewQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) +} + +//// InitGenesis performs genesis initialization for the pot module. It returns +//// no validator updates. +//func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate { +// var genesisState types.GenesisState +// types.ModuleCdc.MustUnmarshalJSON(data, &genesisState) +// InitGenesis(ctx, am.keeper, genesisState) +// return []abci.ValidatorUpdate{} +//} +// +//// ExportGenesis returns the exported genesis state as raw bytes for the pot +//// module. +//func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage { +// gs := ExportGenesis(ctx, am.keeper) +// return types.ModuleCdc.MustMarshalJSON(gs) +//} // BeginBlock returns the begin blocker for the pot module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { diff --git a/x/pot/types/genesis.go b/x/pot/types/genesis.go index b80c1a27..e0e5e84d 100644 --- a/x/pot/types/genesis.go +++ b/x/pot/types/genesis.go @@ -30,10 +30,10 @@ func NewGenesisState(params Params, totalMinedToken sdk.Coin, lastReportedEpoch } // DefaultGenesisState - default GenesisState used by Cosmos Hub -func DefaultGenesisState() GenesisState { +func DefaultGenesisState() *GenesisState { params := DefaultParams() coin := sdk.NewCoin(DefaultRewardDenom, sdk.ZeroInt()) - return GenesisState{ + return &GenesisState{ Params: ¶ms, TotalMinedToken: &coin, LastReportedEpoch: 0, From ecb91c23974b446afb62665201c4aabf32e6a09f Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 16 May 2022 15:29:13 -0400 Subject: [PATCH 051/113] - qb-1165: upgrade PoT --- x/pot/alias.go | 2 +- x/pot/keeper/incentive_testnet_distribute.go | 32 ++++++++++++++------ x/pot/keeper/keeper.go | 8 ----- x/pot/types/expected_keepers.go | 2 ++ 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/x/pot/alias.go b/x/pot/alias.go index 675e7f33..cde42207 100644 --- a/x/pot/alias.go +++ b/x/pot/alias.go @@ -15,7 +15,7 @@ const ( var ( NewKeeper = keeper.NewKeeper - RegisterCodec = types.RegisterCodec + RegisterCodec = types.RegisterLegacyAminoCodec ParamKeyTable = types.ParamKeyTable NewGenesisState = types.NewGenesisState NewMsgFoundationDeposit = types.NewMsgFoundationDeposit diff --git a/x/pot/keeper/incentive_testnet_distribute.go b/x/pot/keeper/incentive_testnet_distribute.go index 5bd5f027..da57eb82 100644 --- a/x/pot/keeper/incentive_testnet_distribute.go +++ b/x/pot/keeper/incentive_testnet_distribute.go @@ -6,7 +6,7 @@ import ( regtypes "github.com/stratosnet/stratos-chain/x/register/types" ) -func (k Keeper) DistributePotRewardForTestnet(ctx sdk.Context, trafficList []types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { +func (k Keeper) DistributePotRewardForTestnet(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { distributeGoal := types.InitDistributeGoal() rewardDetailMap := make(map[string]types.Reward) //key: wallet address @@ -113,18 +113,18 @@ func (k Keeper) splitRewardEvenly(ctx sdk.Context, totalReward sdk.Int, } indexingNodeList := k.RegisterKeeper.GetAllIndexingNodes(ctx) - for _, indexingNode := range indexingNodeList { + for _, indexingNode := range indexingNodeList.IndexingNodes { if indexingNode.IsBonded() && !indexingNode.IsSuspended() { indexingNodeCnt = indexingNodeCnt.Add(sdk.OneDec()) - indNodes = append(indNodes, indexingNode) + indNodes = append(indNodes, *indexingNode) } } resourceNodeList := k.RegisterKeeper.GetAllResourceNodes(ctx) - for _, resourceNode := range resourceNodeList { + for _, resourceNode := range resourceNodeList.ResourceNodes { if resourceNode.IsBonded() && !resourceNode.IsSuspended() { resourceNodeCnt = resourceNodeCnt.Add(sdk.OneDec()) - resNodes = append(resNodes, resourceNode) + resNodes = append(resNodes, *resourceNode) } } @@ -136,7 +136,7 @@ func (k Keeper) splitRewardEvenly(ctx sdk.Context, totalReward sdk.Int, return } -func (k Keeper) CalcRewardForResourceNodeForTestnet(ctx sdk.Context, trafficList []types.SingleWalletVolume, +func (k Keeper) CalcRewardForResourceNodeForTestnet(ctx sdk.Context, trafficList []*types.SingleWalletVolume, distributeGoal types.DistributeGoal, rewardDetailMap map[string]types.Reward, resourceNodes []regtypes.ResourceNode, ) (map[string]types.Reward, types.DistributeGoal) { @@ -147,9 +147,15 @@ func (k Keeper) CalcRewardForResourceNodeForTestnet(ctx sdk.Context, trafficList totalStakeOfResourceNodes := k.RegisterKeeper.GetResourceNodeBondedToken(ctx).Amount resourceNodeCnt := sdk.NewDec(int64(len(resourceNodes))) for _, node := range resourceNodes { - walletAddr := node.GetOwnerAddr() - - shareOfToken := node.GetTokens().ToDec().Quo(totalStakeOfResourceNodes.ToDec()) + walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) + if err != nil { + continue + } + tokens, ok := sdk.NewIntFromString(node.Tokens.String()) + if !ok { + continue + } + shareOfToken := tokens.ToDec().Quo(totalStakeOfResourceNodes.ToDec()) stakeRewardFromMiningPool := distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Amount.ToDec().Quo(resourceNodeCnt).TruncateInt() stakeRewardFromTrafficPool := distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt() @@ -180,7 +186,11 @@ func (k Keeper) CalcRewardForResourceNodeForTestnet(ctx sdk.Context, trafficList totalConsumedOzone := k.GetTotalConsumedUoz(trafficList) // 2, calc traffic reward for _, walletTraffic := range trafficList { - walletAddr := walletTraffic.WalletAddress + walletAddr, err := sdk.AccAddressFromBech32(walletTraffic.WalletAddress) + if err != nil { + continue + } + //walletAddr := walletTraffic.WalletAddress trafficVolume := walletTraffic.Volume shareOfTraffic := trafficVolume.ToDec().Quo(totalConsumedOzone.ToDec()) @@ -223,6 +233,8 @@ func (k Keeper) CalcRewardForIndexingNodeForTestnet(ctx sdk.Context, distributeG totalStakeOfIndexingNodes := k.RegisterKeeper.GetIndexingNodeBondedToken(ctx).Amount indexingNodeCnt := sdk.NewDec(int64(len(indexNodes))) for _, node := range indexNodes { + walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) + walletAddr := node.GetOwnerAddr() // 1, calc stake reward diff --git a/x/pot/keeper/keeper.go b/x/pot/keeper/keeper.go index 22db68c1..478e3bc0 100644 --- a/x/pot/keeper/keeper.go +++ b/x/pot/keeper/keeper.go @@ -74,14 +74,6 @@ func (k Keeper) FoundationDeposit(ctx sdk.Context, amount sdk.Coins, from sdk.Ac if err != nil { return err } - - //TODO - foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) - err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, foundationAccountAddr, amount) - if err != nil { - return err - } - return nil } diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 27626249..6e7e46f1 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" //authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" @@ -80,4 +81,5 @@ type RegisterKeeper interface { type StakingKeeper interface { TotalBondedTokens(ctx sdk.Context) sdk.Int + GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) } From d9a62759b88a1523bcc98654f7741a5e4c53fc3a Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 16 May 2022 15:38:34 -0400 Subject: [PATCH 052/113] updated pot module --- x/pot/client/cli/query.go | 3 +- x/pot/client/cli/tx.go | 5 +- x/pot/keeper/migrations.go | 21 ++++++ x/pot/keeper/querier.go | 18 ++--- x/pot/module.go | 132 ++++++++++++++++++++++++------------- x/pot/types/genesis.go | 13 +--- 6 files changed, 121 insertions(+), 71 deletions(-) create mode 100644 x/pot/keeper/migrations.go diff --git a/x/pot/client/cli/query.go b/x/pot/client/cli/query.go index 2034b27e..43804f90 100644 --- a/x/pot/client/cli/query.go +++ b/x/pot/client/cli/query.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -14,7 +13,7 @@ import ( ) // GetQueryCmd returns the cli query commands for pot module -func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { +func GetQueryCmd() *cobra.Command { // Group pot queries under a subcommand potQueryCmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/pot/client/cli/tx.go b/x/pot/client/cli/tx.go index af86830b..6ac56caa 100644 --- a/x/pot/client/cli/tx.go +++ b/x/pot/client/cli/tx.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" flag "github.com/spf13/pflag" @@ -22,8 +21,8 @@ type singleWalletVolumeStr struct { Volume string `json:"volume"` } -// GetTxCmd returns the transaction commands for this module -func GetTxCmd(cdc *codec.Codec) *cobra.Command { +// NewTxCmd returns the transaction commands for this module +func NewTxCmd() *cobra.Command { potTxCmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), diff --git a/x/pot/keeper/migrations.go b/x/pot/keeper/migrations.go new file mode 100644 index 00000000..84f19c01 --- /dev/null +++ b/x/pot/keeper/migrations.go @@ -0,0 +1,21 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v043 "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v043" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{keeper: keeper} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v043.MigrateStore(ctx, m.keeper.storeKey) +} diff --git a/x/pot/keeper/querier.go b/x/pot/keeper/querier.go index 0acd4c81..cf1014b2 100644 --- a/x/pot/keeper/querier.go +++ b/x/pot/keeper/querier.go @@ -21,17 +21,17 @@ const ( ) // NewQuerier creates a new querier for pot clients. -func NewQuerier(k Keeper) sdk.Querier { +func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) { switch path[0] { case QueryVolumeReport: - return queryVolumeReport(ctx, req, k) + return queryVolumeReport(ctx, req, k, legacyQuerierCdc) case QueryPotRewardsByReportEpoch: - return queryPotRewardsByReportEpoch(ctx, req, k) + return queryPotRewardsByReportEpoch(ctx, req, k, legacyQuerierCdc) case QueryPotRewardsByWalletAddr: - return queryPotRewardsByWalletAddress(ctx, req, k) + return queryPotRewardsByWalletAddress(ctx, req, k, legacyQuerierCdc) case QueryPotSlashingByWalletAddr: - return queryPotSlashingByWalletAddress(ctx, req, k) + return queryPotSlashingByWalletAddress(ctx, req, k, legacyQuerierCdc) default: return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown pot query endpoint") } @@ -39,7 +39,7 @@ func NewQuerier(k Keeper) sdk.Querier { } // queryVolumeReport fetches a hash of report volume for the supplied epoch. -func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { epoch, err := strconv.ParseInt(string(req.Data), 10, 64) if err != nil { return []byte{}, err @@ -60,7 +60,7 @@ func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte } // queryPotRewardsByReportEpoch fetches total rewards and owner individual rewards from traffic and mining. -func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var params types.QueryPotRewardsByReportEpochParams err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { @@ -105,7 +105,7 @@ func (k Keeper) getPotRewardsByReportEpoch(ctx sdk.Context, params types.QueryPo } } -func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var params types.QueryPotRewardsByWalletAddrParams err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { @@ -122,7 +122,7 @@ func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Ke return bz, nil } -func queryPotSlashingByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { +func queryPotSlashingByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { addr, err := sdk.AccAddressFromBech32(string(req.Data)) if err != nil { return []byte(sdk.ZeroInt().String()), types.ErrUnknownAccountAddress diff --git a/x/pot/module.go b/x/pot/module.go index 4ff8f137..0b7be714 100644 --- a/x/pot/module.go +++ b/x/pot/module.go @@ -1,22 +1,26 @@ package pot import ( + "context" "encoding/json" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/stratosnet/stratos-chain/x/register" + "github.com/cosmos/cosmos-sdk/client" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" "github.com/gorilla/mux" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/cosmos-sdk/client/context" + //"github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/bank" "github.com/stratosnet/stratos-chain/x/pot/client/cli" "github.com/stratosnet/stratos-chain/x/pot/client/rest" "github.com/stratosnet/stratos-chain/x/pot/keeper" @@ -29,27 +33,55 @@ var ( _ module.AppModuleBasic = AppModuleBasic{} ) -// AppModuleBasic defines the basic application module used by the pot module. -type AppModuleBasic struct{} +type AppModuleBasic struct { + cdc codec.Codec +} -// Name returns the pot module's name. +var _ module.AppModuleBasic = AppModuleBasic{} + +// Name returns the staking module's name. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterCodec registers the pot module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { - types.RegisterCodec(cdc) +// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) } -// DefaultGenesis returns default genesis state as raw bytes for the pot +// DefaultGenesis returns default genesis state as raw bytes for the register // module. -func (AppModuleBasic) DefaultGenesis() json.RawMessage { - return types.ModuleCdc.MustMarshalJSON(types.DefaultGenesisState()) +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// RegisterRESTRoutes registers the REST routes for the register module. +func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { + rest.RegisterRoutes(ctx, rtr) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) +} + +// GetTxCmd returns the root tx command for the register module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.NewTxCmd() +} + +// GetQueryCmd returns no root query command for the register module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() } // ValidateGenesis performs genesis state validation for the pot module. -func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState err := types.ModuleCdc.UnmarshalJSON(bz, &data) if err != nil { @@ -58,42 +90,27 @@ func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error { return types.ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the pot module. -func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router) { - rest.RegisterRoutes(ctx, rtr) -} - -// GetTxCmd returns the root tx command for the pot module. -func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetTxCmd(cdc) -} - -// GetQueryCmd returns no root query command for the pot module. -func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { - return cli.GetQueryCmd(types.StoreKey, cdc) -} - //____________________________________________________________________________ // AppModule implements an application module for the pot module. type AppModule struct { AppModuleBasic - keeper keeper.Keeper - bankKeeper bank.Keeper - supplyKeeper supply.Keeper + keeper keeper.Keeper + bankKeeper bankkeeper.Keeper + //supplyKeeper supply.Keeper accountKeeper types.AccountKeeper - stakingKeeper staking.Keeper - registerKeeper register.Keeper + stakingKeeper stakingkeeper.Keeper + registerKeeper registerkeeper.Keeper } // NewAppModule creates a new AppModule object -func NewAppModule(k keeper.Keeper, bankKeeper bank.Keeper, supplyKeeper supply.Keeper, - accountKeeper types.AccountKeeper, stakingKeeper staking.Keeper, registerKeeper register.Keeper) AppModule { +func NewAppModule(k keeper.Keeper, bankKeeper bankkeeper.Keeper, + accountKeeper types.AccountKeeper, stakingKeeper stakingkeeper.Keeper, registerKeeper registerkeeper.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: k, bankKeeper: bankKeeper, - supplyKeeper: supplyKeeper, + //supplyKeeper: supplyKeeper, accountKeeper: accountKeeper, stakingKeeper: stakingKeeper, registerKeeper: registerKeeper, @@ -108,11 +125,6 @@ func (AppModule) Name() string { // RegisterInvariants registers the pot module invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// Route returns the message routing key for the pot module. -func (AppModule) Route() string { - return types.RouterKey -} - // NewHandler returns an sdk.Handler for the pot module. func (am AppModule) NewHandler() sdk.Handler { return NewHandler(am.keeper) @@ -130,16 +142,16 @@ func (am AppModule) NewQuerierHandler() sdk.Querier { // InitGenesis performs genesis initialization for the pot module. It returns // no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { var genesisState types.GenesisState - types.ModuleCdc.MustUnmarshalJSON(data, &genesisState) + cdc.MustUnmarshalJSON(data, &genesisState) InitGenesis(ctx, am.keeper, genesisState) return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the pot // module. -func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage { +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { gs := ExportGenesis(ctx, am.keeper) return types.ModuleCdc.MustMarshalJSON(gs) } @@ -154,3 +166,31 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) + + m := keeper.NewMigrator(am.keeper) + _ = cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// LegacyQuerierHandler returns the staking module sdk.Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) +} + +// Route returns the message routing key for the register module. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} diff --git a/x/pot/types/genesis.go b/x/pot/types/genesis.go index b80c1a27..d27f195d 100644 --- a/x/pot/types/genesis.go +++ b/x/pot/types/genesis.go @@ -5,15 +5,6 @@ import ( //stratos "github.com/stratosnet/stratos-chain/types" ) -//type GenesisState struct { -// Params Params `json:"params" yaml:"params"` -// TotalMinedToken sdk.Coin `json:"total_mined_token" yaml:"total_mined_token"` -// LastReportedEpoch int64 `json:"last_reported_epoch" yaml:"last_reported_epoch"` -// ImmatureTotalInfo []ImmatureTotal `json:"immature_total_info" yaml:"immature_total_info"` -// MatureTotalInfo []MatureTotal `json:"mature_total_info" yaml:"mature_total_info"` -// IndividualRewardInfo []Reward `json:"individual_reward_info" yaml:"individual_reward_info"` -//} -// // NewGenesisState creates a new GenesisState object func NewGenesisState(params Params, totalMinedToken sdk.Coin, lastReportedEpoch int64, immatureTotalInfo []*ImmatureTotal, matureTotalInfo []*MatureTotal, individualRewardInfo []*Reward, @@ -30,10 +21,10 @@ func NewGenesisState(params Params, totalMinedToken sdk.Coin, lastReportedEpoch } // DefaultGenesisState - default GenesisState used by Cosmos Hub -func DefaultGenesisState() GenesisState { +func DefaultGenesisState() *GenesisState { params := DefaultParams() coin := sdk.NewCoin(DefaultRewardDenom, sdk.ZeroInt()) - return GenesisState{ + return &GenesisState{ Params: ¶ms, TotalMinedToken: &coin, LastReportedEpoch: 0, From f0e6ba31ab1370b6e83ba5850a2a859c576de76c Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 16 May 2022 16:34:28 -0400 Subject: [PATCH 053/113] - qb-1165: upgrade module account related stuff in PoT --- app/app.go | 9 ++- x/pot/keeper/incentive_testnet_distribute.go | 60 +++++++++++++------- x/pot/keeper/keeper.go | 2 +- x/pot/keeper/withdraw.go | 3 +- x/pot/types/distribute.go | 2 + 5 files changed, 51 insertions(+), 25 deletions(-) diff --git a/app/app.go b/app/app.go index 74c0748f..7e8b635c 100644 --- a/app/app.go +++ b/app/app.go @@ -9,6 +9,7 @@ import ( "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" + pottypes "github.com/stratosnet/stratos-chain/x/pot/types" "github.com/stratosnet/stratos-chain/x/register" abci "github.com/tendermint/tendermint/abci/types" @@ -154,8 +155,12 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, //pot.FoundationAccount: nil, - registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + pottypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + pottypes.MiningRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + pottypes.TrafficRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account } // module accounts that are allowed to receive tokens diff --git a/x/pot/keeper/incentive_testnet_distribute.go b/x/pot/keeper/incentive_testnet_distribute.go index da57eb82..561ed3f3 100644 --- a/x/pot/keeper/incentive_testnet_distribute.go +++ b/x/pot/keeper/incentive_testnet_distribute.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stratosnet/stratos-chain/x/pot/types" regtypes "github.com/stratosnet/stratos-chain/x/register/types" ) @@ -114,7 +115,7 @@ func (k Keeper) splitRewardEvenly(ctx sdk.Context, totalReward sdk.Int, indexingNodeList := k.RegisterKeeper.GetAllIndexingNodes(ctx) for _, indexingNode := range indexingNodeList.IndexingNodes { - if indexingNode.IsBonded() && !indexingNode.IsSuspended() { + if indexingNode.IsBonded() && !indexingNode.Suspend { indexingNodeCnt = indexingNodeCnt.Add(sdk.OneDec()) indNodes = append(indNodes, *indexingNode) } @@ -122,7 +123,7 @@ func (k Keeper) splitRewardEvenly(ctx sdk.Context, totalReward sdk.Int, resourceNodeList := k.RegisterKeeper.GetAllResourceNodes(ctx) for _, resourceNode := range resourceNodeList.ResourceNodes { - if resourceNode.IsBonded() && !resourceNode.IsSuspended() { + if resourceNode.IsBonded() && !resourceNode.Suspend { resourceNodeCnt = resourceNodeCnt.Add(sdk.OneDec()) resNodes = append(resNodes, *resourceNode) } @@ -234,11 +235,15 @@ func (k Keeper) CalcRewardForIndexingNodeForTestnet(ctx sdk.Context, distributeG indexingNodeCnt := sdk.NewDec(int64(len(indexNodes))) for _, node := range indexNodes { walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) - - walletAddr := node.GetOwnerAddr() - + if err != nil { + continue + } + tokens, ok := sdk.NewIntFromString(node.Tokens.String()) + if !ok { + continue + } // 1, calc stake reward - shareOfToken := node.GetTokens().ToDec().Quo(totalStakeOfIndexingNodes.ToDec()) + shareOfToken := tokens.ToDec().Quo(totalStakeOfIndexingNodes.ToDec()) stakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(indexingNodeCnt).TruncateInt()) stakeRewardFromTrafficPool := @@ -293,9 +298,10 @@ func (k Keeper) distributeValidatorRewardForTestnet(ctx sdk.Context, distributeG validatorWalletList = append(validatorWalletList, sdk.AccAddress(validator.GetOperator())) } } + //TODO doublecheck logic: replace pools with module accounts? rewardPerValidator := sdk.NewCoin(k.RewardDenom(ctx), rewardFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(int64(len(validatorWalletList)))).TruncateInt()) for _, validatorWallet := range validatorWalletList { - _, err := k.BankKeeper.AddCoins(ctx, validatorWallet, sdk.NewCoins(rewardPerValidator)) + err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.MiningRewardPool, validatorWallet, sdk.NewCoins(rewardPerValidator)) if err != nil { return distributeGoal, err } @@ -303,18 +309,24 @@ func (k Keeper) distributeValidatorRewardForTestnet(ctx sdk.Context, distributeG } // distribute rewards from traffic pool to fee_pool - feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(k.feeCollectorName) - - if feePoolAccAddr == nil { - ctx.Logger().Error("account address of distribution module does not exist.") - return distributeGoal, types.ErrUnknownAccountAddress - } - - _, err := k.BankKeeper.AddCoins(ctx, feePoolAccAddr, sdk.NewCoins(rewardFromTrafficPool)) + //TODO doublecheck logic + err := k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.TrafficRewardPool, authtypes.FeeCollectorName, sdk.NewCoins(rewardFromTrafficPool)) if err != nil { return distributeGoal, err } + //feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(k.feeCollectorName) + // + //if feePoolAccAddr == nil { + // ctx.Logger().Error("account address of distribution module does not exist.") + // return distributeGoal, types.ErrUnknownAccountAddress + //} + // + //_, err := k.BankKeeper.AddCoins(ctx, feePoolAccAddr, sdk.NewCoins(rewardFromTrafficPool)) + //if err != nil { + // return distributeGoal, err + //} + distributeGoal.BlockChainRewardToValidatorFromMiningPool = rewardFromMiningPool.Sub(usedRewardFromMiningPool) distributeGoal.BlockChainRewardToValidatorFromTrafficPool = sdk.Coin{} @@ -333,16 +345,22 @@ func (k Keeper) returnBalanceForTestnet(ctx sdk.Context, goal types.DistributeGo Add(goal.TrafficRewardToResourceNodeFromTrafficPool) // return balance to foundation account - foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) - if foundationAccountAddr == nil { - ctx.Logger().Error("foundation account address of distribution module does not exist.") - return types.ErrUnknownAccountAddress - } amountToAdd := sdk.NewCoins(balanceOfMiningPool) - _, err = k.BankKeeper.AddCoins(ctx, foundationAccountAddr, amountToAdd) + //TODO doublecheck logic + err = k.BankKeeper.MintCoins(ctx, types.FoundationAccount, amountToAdd) if err != nil { return err } + //foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) + //if foundationAccountAddr == nil { + // ctx.Logger().Error("foundation account address of distribution module does not exist.") + // return types.ErrUnknownAccountAddress + //} + //amountToAdd := sdk.NewCoins(balanceOfMiningPool) + //_, err = k.BankKeeper.AddCoins(ctx, foundationAccountAddr, amountToAdd) + //if err != nil { + // return err + //} //return balance to minedToken record oldTotalMinedToken := k.GetTotalMinedTokens(ctx) diff --git a/x/pot/keeper/keeper.go b/x/pot/keeper/keeper.go index 478e3bc0..d8de4e29 100644 --- a/x/pot/keeper/keeper.go +++ b/x/pot/keeper/keeper.go @@ -70,7 +70,7 @@ func (k Keeper) IsSPNode(ctx sdk.Context, p2pAddr stratos.SdsAddress) (found boo } func (k Keeper) FoundationDeposit(ctx sdk.Context, amount sdk.Coins, from sdk.AccAddress) (err error) { - err = k.BankKeeper.SendCoinsFromAccountToModule(ctx, from, types.ModuleName, amount) + err = k.BankKeeper.SendCoinsFromAccountToModule(ctx, from, types.FoundationAccount, amount) if err != nil { return err } diff --git a/x/pot/keeper/withdraw.go b/x/pot/keeper/withdraw.go index b65de20b..3dffd5aa 100644 --- a/x/pot/keeper/withdraw.go +++ b/x/pot/keeper/withdraw.go @@ -10,7 +10,8 @@ func (k Keeper) Withdraw(ctx sdk.Context, amount sdk.Coins, walletAddress sdk.Ac if !matureReward.IsAllGTE(amount) { return types.ErrInsufficientMatureTotal } - err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, targetAddress, amount) + //TODO doublecheck logic + err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.FoundationAccount, targetAddress, amount) if err != nil { return err } diff --git a/x/pot/types/distribute.go b/x/pot/types/distribute.go index 4da1716c..b28f9239 100644 --- a/x/pot/types/distribute.go +++ b/x/pot/types/distribute.go @@ -8,6 +8,8 @@ import ( const ( FoundationAccount = "foundation_account" + MiningRewardPool = "mining_reward_pool" + TrafficRewardPool = "traffic_reward_pool" ) type DistributeGoal struct { From b11fa5d3b59c4110f544088ee91b2299ee77fa90 Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 16 May 2022 16:36:33 -0400 Subject: [PATCH 054/113] - qb-1165: upgrade module account related stuff in PoT --- x/pot/keeper/incentive_testnet_distribute.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/pot/keeper/incentive_testnet_distribute.go b/x/pot/keeper/incentive_testnet_distribute.go index 561ed3f3..f2aec944 100644 --- a/x/pot/keeper/incentive_testnet_distribute.go +++ b/x/pot/keeper/incentive_testnet_distribute.go @@ -347,7 +347,7 @@ func (k Keeper) returnBalanceForTestnet(ctx sdk.Context, goal types.DistributeGo // return balance to foundation account amountToAdd := sdk.NewCoins(balanceOfMiningPool) //TODO doublecheck logic - err = k.BankKeeper.MintCoins(ctx, types.FoundationAccount, amountToAdd) + err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.MiningRewardPool, types.FoundationAccount, amountToAdd) if err != nil { return err } From 93b7db2831cc32ca7e744c48d440c53a86eb237e Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 16 May 2022 18:02:40 -0400 Subject: [PATCH 055/113] updated pot module --- app/app.go | 44 +- x/pot/app_test.go | 1103 ++++++++++++++++++------------------ x/pot/keeper/distribute.go | 6 +- x/pot/keeper/keeper.go | 6 +- x/pot/keeper/params.go | 2 +- x/pot/keeper/querier.go | 6 +- x/pot/keeper/slashing.go | 14 +- x/pot/module.go | 34 +- x/pot/pot_test.go | 633 ++++++++++----------- x/pot/types/codec.go | 2 +- x/pot/types/genesis.go | 10 - x/pot/types/params.go | 38 +- x/pot/types/types.go | 30 +- x/register/module.go | 14 +- x/sds/module.go | 6 +- 15 files changed, 955 insertions(+), 993 deletions(-) diff --git a/app/app.go b/app/app.go index 01933164..67efc6bb 100644 --- a/app/app.go +++ b/app/app.go @@ -9,7 +9,7 @@ import ( "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" - pottypes "github.com/stratosnet/stratos-chain/x/pot/types" + "github.com/stratosnet/stratos-chain/x/pot" "github.com/stratosnet/stratos-chain/x/register" abci "github.com/tendermint/tendermint/abci/types" @@ -99,8 +99,8 @@ import ( evmrest "github.com/stratosnet/stratos-chain/x/evm/client/rest" evmkeeper "github.com/stratosnet/stratos-chain/x/evm/keeper" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" - //potkeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" - //pottypes "github.com/stratosnet/stratos-chain/x/pot/types" + potkeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" + pottypes "github.com/stratosnet/stratos-chain/x/pot/types" registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" registertypes "github.com/stratosnet/stratos-chain/x/register/types" "github.com/stratosnet/stratos-chain/x/sds" @@ -209,9 +209,9 @@ type NewApp struct { // stratos keepers registerKeeper registerkeeper.Keeper - //potKeeper potkeeper.Keeper - sdsKeeper sdskeeper.Keeper - evmKeeper *evmkeeper.Keeper + potKeeper potkeeper.Keeper + sdsKeeper sdskeeper.Keeper + evmKeeper *evmkeeper.Keeper // the module manager mm *module.Manager @@ -255,7 +255,7 @@ func NewInitApp( ibchost.StoreKey, ibctransfertypes.StoreKey, // stratos keys registertypes.StoreKey, - //pottypes.StoreKey, + pottypes.StoreKey, sdstypes.StoreKey, evmtypes.StoreKey, ) @@ -387,17 +387,17 @@ func NewInitApp( app.bankKeeper, ) - //app.potKeeper = potkeeper.NewKeeper( - // appCodec, - // keys[pot.StoreKey], - // app.GetSubspace(pot.ModuleName), - // authtypes.FeeCollectorName, - // app.bankKeeper, - // app.supplyKeeper, - // app.accountKeeper, - // app.stakingKeeper, - // app.registerKeeper, - //) + app.potKeeper = potkeeper.NewKeeper( + appCodec, + keys[pot.StoreKey], + app.GetSubspace(pot.ModuleName), + authtypes.FeeCollectorName, + app.bankKeeper, + //app.supplyKeeper, + app.accountKeeper, + app.stakingKeeper, + app.registerKeeper, + ) app.sdsKeeper = sdskeeper.NewKeeper( appCodec, @@ -438,7 +438,7 @@ func NewInitApp( // Stratos app modules evm.NewAppModule(app.evmKeeper, app.accountKeeper), register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), - //pot.NewAppModule(app.potKeeper, app.bankKeeper, app.supplyKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), + pot.NewAppModule(app.potKeeper, app.bankKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), ) @@ -471,8 +471,8 @@ func NewInitApp( vestingtypes.ModuleName, // stratos registertypes.ModuleName, + pottypes.ModuleName, sdstypes.ModuleName, - // ) // NOTE: fee market module must go last in order to retrieve the block gas used. @@ -481,6 +481,7 @@ func NewInitApp( govtypes.ModuleName, stakingtypes.ModuleName, registertypes.ModuleName, + pottypes.ModuleName, sdstypes.ModuleName, evmtypes.ModuleName, // no-op modules @@ -528,6 +529,7 @@ func NewInitApp( // Stratos modules evmtypes.ModuleName, registertypes.ModuleName, + pottypes.ModuleName, sdstypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module @@ -711,7 +713,7 @@ func initParamsKeeper( paramsKeeper.Subspace(ibchost.ModuleName) // stratos subspaces paramsKeeper.Subspace(registertypes.ModuleName) - //paramsKeeper.Subspace(pottypes.ModuleName) + paramsKeeper.Subspace(pottypes.ModuleName) paramsKeeper.Subspace(sdstypes.ModuleName) paramsKeeper.Subspace(evmtypes.ModuleName) diff --git a/x/pot/app_test.go b/x/pot/app_test.go index 11afdb40..e138c520 100644 --- a/x/pot/app_test.go +++ b/x/pot/app_test.go @@ -1,333 +1,408 @@ package pot -import ( - "testing" - - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stretchr/testify/require" - - abci "github.com/tendermint/tendermint/abci/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/mock" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" - supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" - "github.com/stratosnet/stratos-chain/x/pot/types" - "github.com/stratosnet/stratos-chain/x/register" -) - -const ( - stopFlagOutOfTotalMiningReward = true - stopFlagSpecificMinedReward = false - stopFlagSpecificEpoch = true -) - -var ( - paramSpecificMinedReward = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(160000000000))) - paramSpecificEpoch = sdk.NewInt(10) -) - -// initialize data of volume report -func setupMsgVolumeReport(newEpoch int64) types.MsgVolumeReport { - volume1 := types.NewSingleWalletVolume(resOwner1, resourceNodeVolume1) - volume2 := types.NewSingleWalletVolume(resOwner2, resourceNodeVolume2) - volume3 := types.NewSingleWalletVolume(resOwner3, resourceNodeVolume3) - - nodesVolume := []types.SingleWalletVolume{volume1, volume2, volume3} - reporter := idxNodeNetworkId1 - epoch := sdk.NewInt(newEpoch) - reportReference := "report for epoch " + epoch.String() - reporterOwner := idxOwner1 - - pubKeys := make([][]byte, 1) - for i := range pubKeys { - pubKeys[i] = make([]byte, 1) - } - - signature := types.NewBLSSignatureInfo(pubKeys, []byte("signature"), []byte("txData")) - - volumeReportMsg := types.NewMsgVolumeReport(nodesVolume, reporter, epoch, reportReference, reporterOwner, signature) - - return volumeReportMsg -} - -func setupSlashingMsg() types.MsgSlashingResourceNode { - reporters := make([]stratos.SdsAddress, 0) - reporters = append(reporters, idxNodeNetworkId1) - reportOwner := make([]sdk.AccAddress, 0) - reportOwner = append(reportOwner, idxOwner1) - - slashingMsg := types.NewMsgSlashingResourceNode(reporters, reportOwner, resNodeNetworkId1, resOwner1, resNodeSlashingUOZAmt1, true) - return slashingMsg -} - -// Test case termination conditions -// modify stop flag & variable could make the test case stop when reach a specific condition -func isNeedStop(ctx sdk.Context, k Keeper, epoch sdk.Int, minedToken sdk.Coin) bool { - - if stopFlagOutOfTotalMiningReward && (minedToken.Amount.GT(foundationDeposit.AmountOf(k.BondDenom(ctx))) || - minedToken.Amount.GT(foundationDeposit.AmountOf(k.RewardDenom(ctx)))) { - return true - } - if stopFlagSpecificMinedReward && minedToken.Amount.GT(paramSpecificMinedReward.AmountOf(k.BondDenom(ctx))) { - return true - } - if stopFlagSpecificEpoch && epoch.GT(paramSpecificEpoch) { - return true - } - return false -} - -func TestPotVolumeReportMsgs(t *testing.T) { - /********************* initialize mock app *********************/ - mApp, k, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper := getMockApp(t) - accs := setupAccounts(mApp) - mock.SetGenesis(mApp, accs) - - /********************* foundation account deposit *********************/ - header := abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx := mApp.BaseApp.NewContext(true, header) - foundationDepositMsg := NewMsgFoundationDeposit(foundationDeposit, foundationDepositorAccAddr) - foundationDepositorAcc := mApp.AccountKeeper.GetAccount(ctx, foundationDepositorAccAddr) - accNum := foundationDepositorAcc.GetAccountNumber() - accSeq := foundationDepositorAcc.GetSequence() - mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{foundationDepositMsg}, []uint64{accNum}, []uint64{accSeq}, true, true, foundationDepositorPrivKey) - foundationAccAddr := supplyKeeper.GetModuleAddress(types.FoundationAccount) - mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) - - /********************* create validator with 50% commission *********************/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - commission := staking.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) - description := staking.NewDescription("foo_moniker", "", "", "", "") - createValidatorMsg := staking.NewMsgCreateValidator(valOpValAddr1, valConsPubk1, sdk.NewCoin("ustos", valInitialStake), description, commission, sdk.OneInt()) - - valOpAcc1 := mApp.AccountKeeper.GetAccount(ctx, valOpAccAddr1) - accNum = valOpAcc1.GetAccountNumber() - accSeq = valOpAcc1.GetSequence() - mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{createValidatorMsg}, []uint64{accNum}, []uint64{accSeq}, true, true, valOpPrivKey1) - mock.CheckBalance(t, mApp, valOpAccAddr1, nil) - - /********************** commit **********************/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - mApp.BeginBlock(abci.RequestBeginBlock{Header: header}) - stakingKeeper.ApplyAndReturnValidatorSetUpdates(mApp.BaseApp.NewContext(true, header)) - validator := checkValidator(t, mApp, stakingKeeper, valOpValAddr1, true) - - require.Equal(t, valOpValAddr1, validator.OperatorAddress) - require.Equal(t, sdk.Bonded, validator.Status) - require.True(sdk.IntEq(t, valInitialStake, validator.BondedTokens())) - - /********************** loop sending volume report **********************/ - var i int64 - var slashingAmtSetup sdk.Int - i = 0 - slashingAmtSetup = sdk.ZeroInt() - for { - - /********************* test slashing msg when i==2 *********************/ - if i == 2 { - ctx.Logger().Info("********************************* Deliver Slashing Tx START ********************************************") - slashingMsg := setupSlashingMsg() - /********************* deliver tx *********************/ - - idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwner1) - ownerAccNum := idxOwnerAcc1.GetAccountNumber() - ownerAccSeq := idxOwnerAcc1.GetSequence() - - SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{slashingMsg}, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) - /********************* commit & check result *********************/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - slashingAmtSetup = registerKeeper.GetSlashing(ctx, resOwner1) - - _, slashingAmtCheck := k.GetTrafficReward(ctx, []types.SingleWalletVolume{{ - WalletAddress: resOwner1, - Volume: resNodeSlashingUOZAmt1, - }}) - println("slashingAmtSetup=" + slashingAmtSetup.String()) - require.Equal(t, slashingAmtSetup, slashingAmtCheck.TruncateInt()) - - ctx.Logger().Info("********************************* Deliver Slashing Tx END ********************************************") - } - - ctx.Logger().Info("*****************************************************************************") - /********************* prepare tx data *********************/ - volumeReportMsg := setupMsgVolumeReport(i + 1) - - lastTotalMinedToken := k.GetTotalMinedTokens(ctx) - ctx.Logger().Info("last committed mined token = " + lastTotalMinedToken.String()) - if isNeedStop(ctx, k, volumeReportMsg.Epoch, lastTotalMinedToken) { - break - } - - /********************* print info *********************/ - ctx.Logger().Info("epoch " + volumeReportMsg.Epoch.String()) - S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() - Pt := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx).Amount.ToDec() - Y := k.GetTotalConsumedUoz(volumeReportMsg.WalletVolumes).ToDec() - Lt := k.RegisterKeeper.GetRemainingOzoneLimit(ctx).ToDec() - R := S.Add(Pt).Mul(Y).Quo(Lt.Add(Y)) - //ctx.Logger().Info("R = (S + Pt) * Y / (Lt + Y)") - ctx.Logger().Info("S=" + S.String() + "\nPt=" + Pt.String() + "\nY=" + Y.String() + "\nLt=" + Lt.String() + "\nR=" + R.String() + "\n") - - ctx.Logger().Info("---------------------------") - distributeGoal := types.InitDistributeGoal() - _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, volumeReportMsg.WalletVolumes, distributeGoal) - require.NoError(t, err) - - //TODO: recovery when shift to main net - /********************************************************** Main net part Start *********************************************************************/ - distributeGoal, err = k.CalcMiningRewardInTotal(ctx, distributeGoal) //for main net - require.NoError(t, err) - ctx.Logger().Info(distributeGoal.String()) - - ctx.Logger().Info("---------------------------") - distributeGoalBalance := distributeGoal - rewardDetailMap := make(map[string]types.Reward) - rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNode(ctx, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap) - /********************************************************** Main net part End *********************************************************************/ - - //TODO: remove when shift to main net - /********************************************************** Incentive testnet part Start *********************************************************************/ - //distributeGoal, idxNodeCnt, resNodeCnt, err := k.CalcMiningRewardInTotalForTestnet(ctx, distributeGoal) //for incentive test net - //require.NoError(t, err) - //ctx.Logger().Info(distributeGoal.String()) - //ctx.Logger().Info("---------------------------") - //distributeGoalBalance := distributeGoal - //rewardDetailMap := make(map[string]types.Reward) - // - //rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNodeForTestnet(ctx, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap, resNodeCnt) - //rewardDetailMap, distributeGoalBalance = k.CalcRewardForIndexingNodeForTestnet(ctx, distributeGoalBalance, rewardDetailMap, idxNodeCnt) - // - ////calc mining reward to distribute to validators - //rewardFromMiningPool := distributeGoal.BlockChainRewardToValidatorFromMiningPool - //usedRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - //validatorWalletList := make([]sdk.AccAddress, 0) - //validators := k.StakingKeeper.GetAllValidators(ctx) - //for _, validator := range validators { - // if validator.IsBonded() && !validator.IsJailed() { - // validatorWalletList = append(validatorWalletList, sdk.AccAddress(validator.GetOperator())) - // } - //} - //rewardPerValidator := sdk.NewCoin(k.RewardDenom(ctx), rewardFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(int64(len(validatorWalletList)))).TruncateInt()) - //usedRewardFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), rewardPerValidator.Amount.Mul(sdk.NewInt(int64(len(validatorWalletList))))) - /********************************************************** Incentive testnet part End *********************************************************************/ - - ctx.Logger().Info("resource_wallet1: address = " + resOwner1.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) - - ctx.Logger().Info("resource_wallet2: address = " + resOwner2.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) - - ctx.Logger().Info("resource_wallet3: address = " + resOwner3.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) - - ctx.Logger().Info("resource_wallet4: address = " + resOwner4.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) - - ctx.Logger().Info("resource_wallet5: address = " + resOwner5.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) - - ctx.Logger().Info("indexing_wallet1: address = " + idxOwner1.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) - - ctx.Logger().Info("indexing_wallet2: address = " + idxOwner2.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) - - ctx.Logger().Info("indexing_wallet3: address = " + idxOwner3.String()) - ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) - ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) - ctx.Logger().Info("---------------------------") - - /********************* record data before delivering tx *********************/ - feePoolAccAddr := supplyKeeper.GetModuleAddress(auth.FeeCollectorName) - lastFoundationAccBalance := bankKeeper.GetCoins(ctx, foundationAccAddr) - lastFeePool := bankKeeper.GetCoins(ctx, feePoolAccAddr) - lastUnissuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) - lastMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner2) - - /********************* deliver tx *********************/ - - idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwner1) - ownerAccNum := idxOwnerAcc1.GetAccountNumber() - ownerAccSeq := idxOwnerAcc1.GetSequence() - - SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{volumeReportMsg}, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) - - /********************* commit & check result *********************/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - //TODO: recovery when shift to main net - checkResult(t, ctx, k, registerKeeper, - volumeReportMsg.Epoch, - lastFoundationAccBalance, - lastUnissuedPrepay, - lastFeePool, - lastMatureTotalOfResNode1, - slashingAmtSetup, - ) // Main net - - //TODO: remove when shift to main net - //checkResultForIncentiveTestnet( - // t, ctx, k, - // volumeReportMsg.Epoch, - // lastFoundationAccBalance, - // lastUnissuedPrepay, - // lastFeePool, - // usedRewardFromMiningPool, - // slashingAmtSetup, - //) //Incentive test net - - i++ - } -} - -//for incentive test net -//func checkResultForIncentiveTestnet(t *testing.T, ctx sdk.Context, k Keeper, +// +//import ( +// "testing" +// +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stretchr/testify/require" +// +// abci "github.com/tendermint/tendermint/abci/types" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/cosmos/cosmos-sdk/x/mock" +// "github.com/cosmos/cosmos-sdk/x/staking" +// "github.com/cosmos/cosmos-sdk/x/supply" +// supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" +// "github.com/stratosnet/stratos-chain/x/pot/types" +// "github.com/stratosnet/stratos-chain/x/register" +//) +// +//const ( +// stopFlagOutOfTotalMiningReward = true +// stopFlagSpecificMinedReward = false +// stopFlagSpecificEpoch = true +//) +// +//var ( +// paramSpecificMinedReward = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(160000000000))) +// paramSpecificEpoch = sdk.NewInt(10) +//) +// +//// initialize data of volume report +//func setupMsgVolumeReport(newEpoch int64) types.MsgVolumeReport { +// volume1 := types.NewSingleWalletVolume(resOwner1, resourceNodeVolume1) +// volume2 := types.NewSingleWalletVolume(resOwner2, resourceNodeVolume2) +// volume3 := types.NewSingleWalletVolume(resOwner3, resourceNodeVolume3) +// +// nodesVolume := []types.SingleWalletVolume{volume1, volume2, volume3} +// reporter := idxNodeNetworkId1 +// epoch := sdk.NewInt(newEpoch) +// reportReference := "report for epoch " + epoch.String() +// reporterOwner := idxOwner1 +// +// pubKeys := make([][]byte, 1) +// for i := range pubKeys { +// pubKeys[i] = make([]byte, 1) +// } +// +// signature := types.NewBLSSignatureInfo(pubKeys, []byte("signature"), []byte("txData")) +// +// volumeReportMsg := types.NewMsgVolumeReport(nodesVolume, reporter, epoch, reportReference, reporterOwner, signature) +// +// return volumeReportMsg +//} +// +//func setupSlashingMsg() types.MsgSlashingResourceNode { +// reporters := make([]stratos.SdsAddress, 0) +// reporters = append(reporters, idxNodeNetworkId1) +// reportOwner := make([]sdk.AccAddress, 0) +// reportOwner = append(reportOwner, idxOwner1) +// +// slashingMsg := types.NewMsgSlashingResourceNode(reporters, reportOwner, resNodeNetworkId1, resOwner1, resNodeSlashingUOZAmt1, true) +// return slashingMsg +//} +// +//// Test case termination conditions +//// modify stop flag & variable could make the test case stop when reach a specific condition +//func isNeedStop(ctx sdk.Context, k Keeper, epoch sdk.Int, minedToken sdk.Coin) bool { +// +// if stopFlagOutOfTotalMiningReward && (minedToken.Amount.GT(foundationDeposit.AmountOf(k.BondDenom(ctx))) || +// minedToken.Amount.GT(foundationDeposit.AmountOf(k.RewardDenom(ctx)))) { +// return true +// } +// if stopFlagSpecificMinedReward && minedToken.Amount.GT(paramSpecificMinedReward.AmountOf(k.BondDenom(ctx))) { +// return true +// } +// if stopFlagSpecificEpoch && epoch.GT(paramSpecificEpoch) { +// return true +// } +// return false +//} +// +//func TestPotVolumeReportMsgs(t *testing.T) { +// /********************* initialize mock app *********************/ +// mApp, k, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper := getMockApp(t) +// accs := setupAccounts(mApp) +// mock.SetGenesis(mApp, accs) +// +// /********************* foundation account deposit *********************/ +// header := abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx := mApp.BaseApp.NewContext(true, header) +// foundationDepositMsg := NewMsgFoundationDeposit(foundationDeposit, foundationDepositorAccAddr) +// foundationDepositorAcc := mApp.AccountKeeper.GetAccount(ctx, foundationDepositorAccAddr) +// accNum := foundationDepositorAcc.GetAccountNumber() +// accSeq := foundationDepositorAcc.GetSequence() +// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{foundationDepositMsg}, []uint64{accNum}, []uint64{accSeq}, true, true, foundationDepositorPrivKey) +// foundationAccAddr := supplyKeeper.GetModuleAddress(types.FoundationAccount) +// mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) +// +// /********************* create validator with 50% commission *********************/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// commission := staking.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) +// description := staking.NewDescription("foo_moniker", "", "", "", "") +// createValidatorMsg := staking.NewMsgCreateValidator(valOpValAddr1, valConsPubk1, sdk.NewCoin("ustos", valInitialStake), description, commission, sdk.OneInt()) +// +// valOpAcc1 := mApp.AccountKeeper.GetAccount(ctx, valOpAccAddr1) +// accNum = valOpAcc1.GetAccountNumber() +// accSeq = valOpAcc1.GetSequence() +// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{createValidatorMsg}, []uint64{accNum}, []uint64{accSeq}, true, true, valOpPrivKey1) +// mock.CheckBalance(t, mApp, valOpAccAddr1, nil) +// +// /********************** commit **********************/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// mApp.BeginBlock(abci.RequestBeginBlock{Header: header}) +// stakingKeeper.ApplyAndReturnValidatorSetUpdates(mApp.BaseApp.NewContext(true, header)) +// validator := checkValidator(t, mApp, stakingKeeper, valOpValAddr1, true) +// +// require.Equal(t, valOpValAddr1, validator.OperatorAddress) +// require.Equal(t, sdk.Bonded, validator.Status) +// require.True(sdk.IntEq(t, valInitialStake, validator.BondedTokens())) +// +// /********************** loop sending volume report **********************/ +// var i int64 +// var slashingAmtSetup sdk.Int +// i = 0 +// slashingAmtSetup = sdk.ZeroInt() +// for { +// +// /********************* test slashing msg when i==2 *********************/ +// if i == 2 { +// ctx.Logger().Info("********************************* Deliver Slashing Tx START ********************************************") +// slashingMsg := setupSlashingMsg() +// /********************* deliver tx *********************/ +// +// idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwner1) +// ownerAccNum := idxOwnerAcc1.GetAccountNumber() +// ownerAccSeq := idxOwnerAcc1.GetSequence() +// +// SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{slashingMsg}, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) +// /********************* commit & check result *********************/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// slashingAmtSetup = registerKeeper.GetSlashing(ctx, resOwner1) +// +// _, slashingAmtCheck := k.GetTrafficReward(ctx, []types.SingleWalletVolume{{ +// WalletAddress: resOwner1, +// Volume: resNodeSlashingUOZAmt1, +// }}) +// println("slashingAmtSetup=" + slashingAmtSetup.String()) +// require.Equal(t, slashingAmtSetup, slashingAmtCheck.TruncateInt()) +// +// ctx.Logger().Info("********************************* Deliver Slashing Tx END ********************************************") +// } +// +// ctx.Logger().Info("*****************************************************************************") +// /********************* prepare tx data *********************/ +// volumeReportMsg := setupMsgVolumeReport(i + 1) +// +// lastTotalMinedToken := k.GetTotalMinedTokens(ctx) +// ctx.Logger().Info("last committed mined token = " + lastTotalMinedToken.String()) +// if isNeedStop(ctx, k, volumeReportMsg.Epoch, lastTotalMinedToken) { +// break +// } +// +// /********************* print info *********************/ +// ctx.Logger().Info("epoch " + volumeReportMsg.Epoch.String()) +// S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() +// Pt := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx).Amount.ToDec() +// Y := k.GetTotalConsumedUoz(volumeReportMsg.WalletVolumes).ToDec() +// Lt := k.RegisterKeeper.GetRemainingOzoneLimit(ctx).ToDec() +// R := S.Add(Pt).Mul(Y).Quo(Lt.Add(Y)) +// //ctx.Logger().Info("R = (S + Pt) * Y / (Lt + Y)") +// ctx.Logger().Info("S=" + S.String() + "\nPt=" + Pt.String() + "\nY=" + Y.String() + "\nLt=" + Lt.String() + "\nR=" + R.String() + "\n") +// +// ctx.Logger().Info("---------------------------") +// distributeGoal := types.InitDistributeGoal() +// _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, volumeReportMsg.WalletVolumes, distributeGoal) +// require.NoError(t, err) +// +// //TODO: recovery when shift to main net +// /********************************************************** Main net part Start *********************************************************************/ +// distributeGoal, err = k.CalcMiningRewardInTotal(ctx, distributeGoal) //for main net +// require.NoError(t, err) +// ctx.Logger().Info(distributeGoal.String()) +// +// ctx.Logger().Info("---------------------------") +// distributeGoalBalance := distributeGoal +// rewardDetailMap := make(map[string]types.Reward) +// rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNode(ctx, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap) +// /********************************************************** Main net part End *********************************************************************/ +// +// //TODO: remove when shift to main net +// /********************************************************** Incentive testnet part Start *********************************************************************/ +// //distributeGoal, idxNodeCnt, resNodeCnt, err := k.CalcMiningRewardInTotalForTestnet(ctx, distributeGoal) //for incentive test net +// //require.NoError(t, err) +// //ctx.Logger().Info(distributeGoal.String()) +// //ctx.Logger().Info("---------------------------") +// //distributeGoalBalance := distributeGoal +// //rewardDetailMap := make(map[string]types.Reward) +// // +// //rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNodeForTestnet(ctx, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap, resNodeCnt) +// //rewardDetailMap, distributeGoalBalance = k.CalcRewardForIndexingNodeForTestnet(ctx, distributeGoalBalance, rewardDetailMap, idxNodeCnt) +// // +// ////calc mining reward to distribute to validators +// //rewardFromMiningPool := distributeGoal.BlockChainRewardToValidatorFromMiningPool +// //usedRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) +// //validatorWalletList := make([]sdk.AccAddress, 0) +// //validators := k.StakingKeeper.GetAllValidators(ctx) +// //for _, validator := range validators { +// // if validator.IsBonded() && !validator.IsJailed() { +// // validatorWalletList = append(validatorWalletList, sdk.AccAddress(validator.GetOperator())) +// // } +// //} +// //rewardPerValidator := sdk.NewCoin(k.RewardDenom(ctx), rewardFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(int64(len(validatorWalletList)))).TruncateInt()) +// //usedRewardFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), rewardPerValidator.Amount.Mul(sdk.NewInt(int64(len(validatorWalletList))))) +// /********************************************************** Incentive testnet part End *********************************************************************/ +// +// ctx.Logger().Info("resource_wallet1: address = " + resOwner1.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) +// +// ctx.Logger().Info("resource_wallet2: address = " + resOwner2.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) +// +// ctx.Logger().Info("resource_wallet3: address = " + resOwner3.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) +// +// ctx.Logger().Info("resource_wallet4: address = " + resOwner4.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) +// +// ctx.Logger().Info("resource_wallet5: address = " + resOwner5.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) +// +// ctx.Logger().Info("indexing_wallet1: address = " + idxOwner1.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) +// +// ctx.Logger().Info("indexing_wallet2: address = " + idxOwner2.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) +// +// ctx.Logger().Info("indexing_wallet3: address = " + idxOwner3.String()) +// ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) +// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) +// ctx.Logger().Info("---------------------------") +// +// /********************* record data before delivering tx *********************/ +// feePoolAccAddr := supplyKeeper.GetModuleAddress(auth.FeeCollectorName) +// lastFoundationAccBalance := bankKeeper.GetCoins(ctx, foundationAccAddr) +// lastFeePool := bankKeeper.GetCoins(ctx, feePoolAccAddr) +// lastUnissuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) +// lastMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner2) +// +// /********************* deliver tx *********************/ +// +// idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwner1) +// ownerAccNum := idxOwnerAcc1.GetAccountNumber() +// ownerAccSeq := idxOwnerAcc1.GetSequence() +// +// SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{volumeReportMsg}, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) +// +// /********************* commit & check result *********************/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// //TODO: recovery when shift to main net +// checkResult(t, ctx, k, registerKeeper, +// volumeReportMsg.Epoch, +// lastFoundationAccBalance, +// lastUnissuedPrepay, +// lastFeePool, +// lastMatureTotalOfResNode1, +// slashingAmtSetup, +// ) // Main net +// +// //TODO: remove when shift to main net +// //checkResultForIncentiveTestnet( +// // t, ctx, k, +// // volumeReportMsg.Epoch, +// // lastFoundationAccBalance, +// // lastUnissuedPrepay, +// // lastFeePool, +// // usedRewardFromMiningPool, +// // slashingAmtSetup, +// //) //Incentive test net +// +// i++ +// } +//} +// +////for incentive test net +////func checkResultForIncentiveTestnet(t *testing.T, ctx sdk.Context, k Keeper, +//// currentEpoch sdk.Int, +//// lastFoundationAccBalance sdk.Coins, +//// lastUnissuedPrepay sdk.Coin, +//// lastFeePool sdk.Coins, +//// validatorDirectDeposited sdk.Coin, +//// slashingAmtSetup sdk.Int) { +//// +//// currentSlashing := k.RegisterKeeper.GetSlashing(ctx, resNodeAddr2) +//// println("currentSlashing=" + currentSlashing.String()) +//// +//// individualRewardTotal := sdk.Coins{} +//// newMatureEpoch := currentEpoch.Add(sdk.NewInt(k.MatureEpoch(ctx))) +//// rewardAddrList := k.GetRewardAddressPool(ctx) +//// for _, addr := range rewardAddrList { +//// individualReward, found := k.GetIndividualReward(ctx, addr, newMatureEpoch) +//// if found { +//// individualRewardTotal = individualRewardTotal.Add(individualReward.RewardFromTrafficPool...).Add(individualReward.RewardFromMiningPool...) +//// } +//// +//// ctx.Logger().Info("individualReward of [" + addr.String() + "] = " + individualReward.String()) +//// } +//// +//// feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(auth.FeeCollectorName) +//// foundationAccAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) +//// newFoundationAccBalance := k.BankKeeper.GetCoins(ctx, foundationAccAddr) +//// newUnissuedPrepay := sdk.NewCoins(k.RegisterKeeper.GetTotalUnissuedPrepay(ctx)) +//// +//// slashingChange := slashingAmtSetup.Sub(k.RegisterKeeper.GetSlashing(ctx, resOwner1)) +//// ctx.Logger().Info("resource node 1 slashing change = " + slashingChange.String()) +//// matureTotal := k.GetMatureTotalReward(ctx, resOwner1) +//// immatureTotal := k.GetImmatureTotalReward(ctx, resOwner1) +//// ctx.Logger().Info("resource node 1 matureTotal = " + matureTotal.String()) +//// ctx.Logger().Info("resource node 1 immatureTotal = " + immatureTotal.String()) +//// +//// rewardSrcChange := lastFoundationAccBalance. +//// Sub(newFoundationAccBalance). +//// Add(lastUnissuedPrepay). +//// Sub(newUnissuedPrepay) +//// +//// ctx.Logger().Info("rewardSrcChange = " + rewardSrcChange.String()) +//// +//// rewardSrcChangeSubSlashing := deductSlashingAmt(ctx, rewardSrcChange, slashingChange) +//// +//// newFeePool := k.BankKeeper.GetCoins(ctx, feePoolAccAddr) +//// ctx.Logger().Info("lastFeePool = " + lastFeePool.String()) +//// ctx.Logger().Info("newFeePool = " + newFeePool.String()) +//// +//// feePoolValChange := newFeePool.Sub(lastFeePool) +//// ctx.Logger().Info("reward send to validator fee pool= " + feePoolValChange.String()) +//// rewardDestChange := feePoolValChange.Add(individualRewardTotal...).Add(validatorDirectDeposited) +//// +//// rewardDestChange = k.RegisterKeeper.DeductSlashing(ctx, resOwner1, rewardDestChange) +//// +//// ctx.Logger().Info("rewardDestChange = " + rewardDestChange.String()) +//// require.Equal(t, rewardSrcChangeSubSlashing, rewardDestChange) +//// +////} +// +//// return : coins - slashing +//func deductSlashingAmt(ctx sdk.Context, coins sdk.Coins, slashing sdk.Int) sdk.Coins { +// ret := sdk.Coins{} +// for _, coin := range coins { +// if coin.Amount.GTE(slashing) { +// coin = coin.Sub(sdk.NewCoin(coin.Denom, slashing)) +// ret = ret.Add(coin) +// slashing = sdk.ZeroInt() +// } else { +// slashing = slashing.Sub(coin.Amount) +// coin = sdk.NewCoin(coin.Denom, sdk.ZeroInt()) +// ret = ret.Add(coin) +// } +// } +// return ret +//} +// +////for main net +//func checkResult(t *testing.T, ctx sdk.Context, k Keeper, registerKeeper register.Keeper, // currentEpoch sdk.Int, // lastFoundationAccBalance sdk.Coins, // lastUnissuedPrepay sdk.Coin, // lastFeePool sdk.Coins, -// validatorDirectDeposited sdk.Coin, +// lastMatureTotalOfResNode1 sdk.Coins, // slashingAmtSetup sdk.Int) { // -// currentSlashing := k.RegisterKeeper.GetSlashing(ctx, resNodeAddr2) -// println("currentSlashing=" + currentSlashing.String()) +// currentSlashing := registerKeeper.GetSlashing(ctx, resNodeAddr2) +// println("currentSlashing =" + currentSlashing.String()) // // individualRewardTotal := sdk.Coins{} // newMatureEpoch := currentEpoch.Add(sdk.NewInt(k.MatureEpoch(ctx))) -// rewardAddrList := k.GetRewardAddressPool(ctx) -// for _, addr := range rewardAddrList { -// individualReward, found := k.GetIndividualReward(ctx, addr, newMatureEpoch) -// if found { -// individualRewardTotal = individualRewardTotal.Add(individualReward.RewardFromTrafficPool...).Add(individualReward.RewardFromMiningPool...) -// } // -// ctx.Logger().Info("individualReward of [" + addr.String() + "] = " + individualReward.String()) -// } +// k.IteratorIndividualReward(ctx, newMatureEpoch, func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { +// individualRewardTotal = individualRewardTotal.Add(individualReward.RewardFromTrafficPool...).Add(individualReward.RewardFromMiningPool...) +// ctx.Logger().Info("individualReward of [" + walletAddress.String() + "] = " + individualReward.String()) +// return false +// }) // // feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(auth.FeeCollectorName) // foundationAccAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) // newFoundationAccBalance := k.BankKeeper.GetCoins(ctx, foundationAccAddr) -// newUnissuedPrepay := sdk.NewCoins(k.RegisterKeeper.GetTotalUnissuedPrepay(ctx)) +// newUnissuedPrepay := sdk.NewCoins(registerKeeper.GetTotalUnissuedPrepay(ctx)) // -// slashingChange := slashingAmtSetup.Sub(k.RegisterKeeper.GetSlashing(ctx, resOwner1)) +// slashingChange := slashingAmtSetup.Sub(registerKeeper.GetSlashing(ctx, resOwner1)) // ctx.Logger().Info("resource node 1 slashing change = " + slashingChange.String()) // matureTotal := k.GetMatureTotalReward(ctx, resOwner1) // immatureTotal := k.GetImmatureTotalReward(ctx, resOwner1) @@ -338,251 +413,177 @@ func TestPotVolumeReportMsgs(t *testing.T) { // Sub(newFoundationAccBalance). // Add(lastUnissuedPrepay). // Sub(newUnissuedPrepay) -// // ctx.Logger().Info("rewardSrcChange = " + rewardSrcChange.String()) // -// rewardSrcChangeSubSlashing := deductSlashingAmt(ctx, rewardSrcChange, slashingChange) -// +// // get fee pool changes // newFeePool := k.BankKeeper.GetCoins(ctx, feePoolAccAddr) -// ctx.Logger().Info("lastFeePool = " + lastFeePool.String()) -// ctx.Logger().Info("newFeePool = " + newFeePool.String()) +// ctx.Logger().Info("lastFeePool = " + lastFeePool.String()) +// ctx.Logger().Info("newFeePool = " + newFeePool.String()) // // feePoolValChange := newFeePool.Sub(lastFeePool) // ctx.Logger().Info("reward send to validator fee pool= " + feePoolValChange.String()) -// rewardDestChange := feePoolValChange.Add(individualRewardTotal...).Add(validatorDirectDeposited) // -// rewardDestChange = k.RegisterKeeper.DeductSlashing(ctx, resOwner1, rewardDestChange) +// rewardDestChange := feePoolValChange.Add(individualRewardTotal...) +// ctx.Logger().Info("rewardDestChange = " + rewardDestChange.String()) +// +// require.Equal(t, rewardSrcChange, rewardDestChange) +// +// ctx.Logger().Info("************************ slashing test***********************************") +// ctx.Logger().Info("slashing change = " + slashingChange.String()) +// +// upcomingMaturedIndividual := sdk.Coins{} +// individualReward, found := k.GetIndividualReward(ctx, resOwner1, currentEpoch) +// if found { +// tmp := individualReward.RewardFromTrafficPool.Add(individualReward.RewardFromMiningPool...) +// upcomingMaturedIndividual = deductSlashingAmt(ctx, tmp, slashingChange) +// } +// ctx.Logger().Info("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) +// +// // get mature total changes +// newMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner1) +// matureTotalOfResNode1Change, _ := newMatureTotalOfResNode1.SafeSub(lastMatureTotalOfResNode1) // -// ctx.Logger().Info("rewardDestChange = " + rewardDestChange.String()) -// require.Equal(t, rewardSrcChangeSubSlashing, rewardDestChange) +// if upcomingMaturedIndividual == nil { +// upcomingMaturedIndividual = sdk.Coins{} +// } +// if matureTotalOfResNode1Change == nil || matureTotalOfResNode1Change.IsAnyNegative() { +// matureTotalOfResNode1Change = sdk.Coins{} +// } // +// ctx.Logger().Info("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) +// require.Equal(t, matureTotalOfResNode1Change, upcomingMaturedIndividual) +//} +// +//func checkValidator(t *testing.T, mApp *mock.App, stakingKeeper staking.Keeper, +// addr sdk.ValAddress, expFound bool) staking.Validator { +// +// ctxCheck := mApp.BaseApp.NewContext(true, abci.Header{}) +// validator, found := stakingKeeper.GetValidator(ctxCheck, addr) +// +// require.Equal(t, expFound, found) +// return validator +//} +// +//func getMockApp(t *testing.T) (*mock.App, Keeper, staking.Keeper, bank.Keeper, supply.Keeper, register.Keeper) { +// mApp := mock.NewApp() +// +// RegisterCodec(mApp.Cdc) +// supply.RegisterCodec(mApp.Cdc) +// staking.RegisterCodec(mApp.Cdc) +// register.RegisterCodec(mApp.Cdc) +// +// keySupply := sdk.NewKVStoreKey(supply.StoreKey) +// keyStaking := sdk.NewKVStoreKey(staking.StoreKey) +// keyRegister := sdk.NewKVStoreKey(register.StoreKey) +// keyPot := sdk.NewKVStoreKey(StoreKey) +// +// feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) +// notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) +// bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) +// foundationAccount := supply.NewEmptyModuleAccount(types.FoundationAccount) +// +// blacklistedAddrs := make(map[string]bool) +// blacklistedAddrs[feeCollector.GetAddress().String()] = true +// blacklistedAddrs[notBondedPool.GetAddress().String()] = true +// blacklistedAddrs[bondPool.GetAddress().String()] = true +// blacklistedAddrs[foundationAccount.GetAddress().String()] = true +// +// bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) +// maccPerms := map[string][]string{ +// auth.FeeCollectorName: nil, +// staking.NotBondedPoolName: {supply.Burner, supply.Staking}, +// staking.BondedPoolName: {supply.Burner, supply.Staking}, +// types.FoundationAccount: nil, +// } +// supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) +// stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) +// registerKeeper := register.NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(register.DefaultParamSpace), mApp.AccountKeeper, bankKeeper) +// +// keeper := NewKeeper(mApp.Cdc, keyPot, mApp.ParamsKeeper.Subspace(DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, mApp.AccountKeeper, stakingKeeper, registerKeeper) +// +// mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) +// mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) +// mApp.SetEndBlocker(getEndBlocker(keeper)) +// mApp.SetInitChainer(getInitChainer(mApp, keeper, mApp.AccountKeeper, supplyKeeper, +// []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, registerKeeper)) +// +// err := mApp.CompleteSetup(keyStaking, keySupply, keyRegister, keyPot) +// require.NoError(t, err) +// +// return mApp, keeper, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper +//} +// +//// getInitChainer initializes the chainer of the mock app and sets the genesis +//// state. It returns an empty ResponseInitChain. +//func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, +// blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper) sdk.InitChainer { +// return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// mapp.InitChainer(ctx, req) +// +// resourceNodes := setupAllResourceNodes() +// indexingNodes := setupAllIndexingNodes() +// +// registerGenesis := register.NewGenesisState( +// register.DefaultParams(), +// resourceNodes, +// indexingNodes, +// initialUOzonePrice, +// sdk.ZeroInt(), +// make([]register.Slashing, 0), +// ) +// +// register.InitGenesis(ctx, registerKeeper, registerGenesis) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, "ustos"), nil, nil) +// +// totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) +// supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// +// validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) +// +// //preset +// keeper.RegisterKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrepay) +// +// //pot genesis data load +// InitGenesis(ctx, keeper, NewGenesisState( +// types.DefaultParams(), +// sdk.NewCoin(types.DefaultRewardDenom, sdk.ZeroInt()), +// 0, +// make([]types.ImmatureTotal, 0), +// make([]types.MatureTotal, 0), +// make([]types.Reward, 0), +// )) +// +// return abci.ResponseInitChain{ +// Validators: validators, +// } +// } +// +//} +// +//// getEndBlocker returns a staking endblocker. +//func getEndBlocker(keeper Keeper) sdk.EndBlocker { +// return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { +// validatorUpdates := keeper.StakingKeeper.BlockValidatorUpdates(ctx) +// +// return abci.ResponseEndBlock{ +// ValidatorUpdates: validatorUpdates, +// } +// } +// return nil //} - -// return : coins - slashing -func deductSlashingAmt(ctx sdk.Context, coins sdk.Coins, slashing sdk.Int) sdk.Coins { - ret := sdk.Coins{} - for _, coin := range coins { - if coin.Amount.GTE(slashing) { - coin = coin.Sub(sdk.NewCoin(coin.Denom, slashing)) - ret = ret.Add(coin) - slashing = sdk.ZeroInt() - } else { - slashing = slashing.Sub(coin.Amount) - coin = sdk.NewCoin(coin.Denom, sdk.ZeroInt()) - ret = ret.Add(coin) - } - } - return ret -} - -//for main net -func checkResult(t *testing.T, ctx sdk.Context, k Keeper, registerKeeper register.Keeper, - currentEpoch sdk.Int, - lastFoundationAccBalance sdk.Coins, - lastUnissuedPrepay sdk.Coin, - lastFeePool sdk.Coins, - lastMatureTotalOfResNode1 sdk.Coins, - slashingAmtSetup sdk.Int) { - - currentSlashing := registerKeeper.GetSlashing(ctx, resNodeAddr2) - println("currentSlashing =" + currentSlashing.String()) - - individualRewardTotal := sdk.Coins{} - newMatureEpoch := currentEpoch.Add(sdk.NewInt(k.MatureEpoch(ctx))) - - k.IteratorIndividualReward(ctx, newMatureEpoch, func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { - individualRewardTotal = individualRewardTotal.Add(individualReward.RewardFromTrafficPool...).Add(individualReward.RewardFromMiningPool...) - ctx.Logger().Info("individualReward of [" + walletAddress.String() + "] = " + individualReward.String()) - return false - }) - - feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(auth.FeeCollectorName) - foundationAccAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) - newFoundationAccBalance := k.BankKeeper.GetCoins(ctx, foundationAccAddr) - newUnissuedPrepay := sdk.NewCoins(registerKeeper.GetTotalUnissuedPrepay(ctx)) - - slashingChange := slashingAmtSetup.Sub(registerKeeper.GetSlashing(ctx, resOwner1)) - ctx.Logger().Info("resource node 1 slashing change = " + slashingChange.String()) - matureTotal := k.GetMatureTotalReward(ctx, resOwner1) - immatureTotal := k.GetImmatureTotalReward(ctx, resOwner1) - ctx.Logger().Info("resource node 1 matureTotal = " + matureTotal.String()) - ctx.Logger().Info("resource node 1 immatureTotal = " + immatureTotal.String()) - - rewardSrcChange := lastFoundationAccBalance. - Sub(newFoundationAccBalance). - Add(lastUnissuedPrepay). - Sub(newUnissuedPrepay) - ctx.Logger().Info("rewardSrcChange = " + rewardSrcChange.String()) - - // get fee pool changes - newFeePool := k.BankKeeper.GetCoins(ctx, feePoolAccAddr) - ctx.Logger().Info("lastFeePool = " + lastFeePool.String()) - ctx.Logger().Info("newFeePool = " + newFeePool.String()) - - feePoolValChange := newFeePool.Sub(lastFeePool) - ctx.Logger().Info("reward send to validator fee pool= " + feePoolValChange.String()) - - rewardDestChange := feePoolValChange.Add(individualRewardTotal...) - ctx.Logger().Info("rewardDestChange = " + rewardDestChange.String()) - - require.Equal(t, rewardSrcChange, rewardDestChange) - - ctx.Logger().Info("************************ slashing test***********************************") - ctx.Logger().Info("slashing change = " + slashingChange.String()) - - upcomingMaturedIndividual := sdk.Coins{} - individualReward, found := k.GetIndividualReward(ctx, resOwner1, currentEpoch) - if found { - tmp := individualReward.RewardFromTrafficPool.Add(individualReward.RewardFromMiningPool...) - upcomingMaturedIndividual = deductSlashingAmt(ctx, tmp, slashingChange) - } - ctx.Logger().Info("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) - - // get mature total changes - newMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner1) - matureTotalOfResNode1Change, _ := newMatureTotalOfResNode1.SafeSub(lastMatureTotalOfResNode1) - - if upcomingMaturedIndividual == nil { - upcomingMaturedIndividual = sdk.Coins{} - } - if matureTotalOfResNode1Change == nil || matureTotalOfResNode1Change.IsAnyNegative() { - matureTotalOfResNode1Change = sdk.Coins{} - } - - ctx.Logger().Info("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) - require.Equal(t, matureTotalOfResNode1Change, upcomingMaturedIndividual) -} - -func checkValidator(t *testing.T, mApp *mock.App, stakingKeeper staking.Keeper, - addr sdk.ValAddress, expFound bool) staking.Validator { - - ctxCheck := mApp.BaseApp.NewContext(true, abci.Header{}) - validator, found := stakingKeeper.GetValidator(ctxCheck, addr) - - require.Equal(t, expFound, found) - return validator -} - -func getMockApp(t *testing.T) (*mock.App, Keeper, staking.Keeper, bank.Keeper, supply.Keeper, register.Keeper) { - mApp := mock.NewApp() - - RegisterCodec(mApp.Cdc) - supply.RegisterCodec(mApp.Cdc) - staking.RegisterCodec(mApp.Cdc) - register.RegisterCodec(mApp.Cdc) - - keySupply := sdk.NewKVStoreKey(supply.StoreKey) - keyStaking := sdk.NewKVStoreKey(staking.StoreKey) - keyRegister := sdk.NewKVStoreKey(register.StoreKey) - keyPot := sdk.NewKVStoreKey(StoreKey) - - feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) - notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) - bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) - foundationAccount := supply.NewEmptyModuleAccount(types.FoundationAccount) - - blacklistedAddrs := make(map[string]bool) - blacklistedAddrs[feeCollector.GetAddress().String()] = true - blacklistedAddrs[notBondedPool.GetAddress().String()] = true - blacklistedAddrs[bondPool.GetAddress().String()] = true - blacklistedAddrs[foundationAccount.GetAddress().String()] = true - - bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) - maccPerms := map[string][]string{ - auth.FeeCollectorName: nil, - staking.NotBondedPoolName: {supply.Burner, supply.Staking}, - staking.BondedPoolName: {supply.Burner, supply.Staking}, - types.FoundationAccount: nil, - } - supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) - stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) - registerKeeper := register.NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(register.DefaultParamSpace), mApp.AccountKeeper, bankKeeper) - - keeper := NewKeeper(mApp.Cdc, keyPot, mApp.ParamsKeeper.Subspace(DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, mApp.AccountKeeper, stakingKeeper, registerKeeper) - - mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) - mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) - mApp.SetEndBlocker(getEndBlocker(keeper)) - mApp.SetInitChainer(getInitChainer(mApp, keeper, mApp.AccountKeeper, supplyKeeper, - []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, registerKeeper)) - - err := mApp.CompleteSetup(keyStaking, keySupply, keyRegister, keyPot) - require.NoError(t, err) - - return mApp, keeper, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper -} - -// getInitChainer initializes the chainer of the mock app and sets the genesis -// state. It returns an empty ResponseInitChain. -func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, - blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper) sdk.InitChainer { - return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - mapp.InitChainer(ctx, req) - - resourceNodes := setupAllResourceNodes() - indexingNodes := setupAllIndexingNodes() - - registerGenesis := register.NewGenesisState( - register.DefaultParams(), - resourceNodes, - indexingNodes, - initialUOzonePrice, - sdk.ZeroInt(), - make([]register.Slashing, 0), - ) - - register.InitGenesis(ctx, registerKeeper, registerGenesis) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, "ustos"), nil, nil) - - totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) - supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - - validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) - - //preset - keeper.RegisterKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrepay) - - //pot genesis data load - InitGenesis(ctx, keeper, NewGenesisState( - types.DefaultParams(), - sdk.NewCoin(types.DefaultRewardDenom, sdk.ZeroInt()), - 0, - make([]types.ImmatureTotal, 0), - make([]types.MatureTotal, 0), - make([]types.Reward, 0), - )) - - return abci.ResponseInitChain{ - Validators: validators, - } - } - -} - -// getEndBlocker returns a staking endblocker. -func getEndBlocker(keeper Keeper) sdk.EndBlocker { - return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - validatorUpdates := keeper.StakingKeeper.BlockValidatorUpdates(ctx) - - return abci.ResponseEndBlock{ - ValidatorUpdates: validatorUpdates, - } - } - return nil -} diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 9e711923..fe183124 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -5,7 +5,7 @@ import ( "github.com/stratosnet/stratos-chain/x/pot/types" ) -func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { +func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { distributeGoal := types.InitDistributeGoal() rewardDetailMap := make(map[string]types.Reward) //key: wallet address @@ -130,7 +130,7 @@ func (k Keeper) returnBalance(ctx sdk.Context, goal types.DistributeGoal, curren Add(goal.TrafficRewardToResourceNodeFromTrafficPool) // return balance to foundation account - foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) + foundationAccountAddr := k.AccountKeeper.GetModuleAddress(types.FoundationAccount) if foundationAccountAddr == nil { ctx.Logger().Error("foundation account address of distribution module does not exist.") return types.ErrUnknownAccountAddress @@ -307,7 +307,7 @@ func (k Keeper) distributeValidatorRewardToFeePool(ctx sdk.Context, distributeGo rewardFromTrafficPool := distributeGoal.BlockChainRewardToValidatorFromTrafficPool totalRewardSendToFeePool := sdk.NewCoins(rewardFromMiningPool).Add(rewardFromTrafficPool) - feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(k.feeCollectorName) + feePoolAccAddr := k.AccountKeeper.GetModuleAddress(k.feeCollectorName) if feePoolAccAddr == nil { ctx.Logger().Error("account address of distribution module does not exist.") diff --git a/x/pot/keeper/keeper.go b/x/pot/keeper/keeper.go index 8288c689..4dd00cae 100644 --- a/x/pot/keeper/keeper.go +++ b/x/pot/keeper/keeper.go @@ -15,7 +15,7 @@ import ( // Keeper of the pot store type Keeper struct { storeKey sdk.StoreKey - cdc *codec.Codec + cdc codec.Codec paramSpace paramstypes.Subspace feeCollectorName string // name of the FeeCollector ModuleAccount BankKeeper types.BankKeeper @@ -26,7 +26,7 @@ type Keeper struct { } // NewKeeper creates a pot keeper -func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace paramstypes.Subspace, feeCollectorName string, +func NewKeeper(cdc codec.Codec, key sdk.StoreKey, paramSpace paramstypes.Subspace, feeCollectorName string, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, stakingKeeper types.StakingKeeper, registerKeeper types.RegisterKeeper, ) Keeper { @@ -49,7 +49,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []types.SingleWalletVolume, reporter stratos.SdsAddress, +func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []*types.SingleWalletVolume, reporter stratos.SdsAddress, epoch sdk.Int, reportReference string, txHash string) (totalConsumedOzone sdk.Dec, err error) { //record volume report reportRecord := types.NewReportRecord(reporter, reportReference, txHash) diff --git a/x/pot/keeper/params.go b/x/pot/keeper/params.go index 34c7a95b..ce861ba3 100644 --- a/x/pot/keeper/params.go +++ b/x/pot/keeper/params.go @@ -40,7 +40,7 @@ func (k Keeper) MiningRewardParams(ctx sdk.Context) (res []types.MiningRewardPar func (k Keeper) GetMiningRewardParamByMinedToken(ctx sdk.Context, minedToken sdk.Coin) (types.MiningRewardParam, error) { miningRewardParams := k.MiningRewardParams(ctx) for _, param := range miningRewardParams { - if minedToken.IsGTE(param.TotalMinedValveStart) && minedToken.IsLT(param.TotalMinedValveEnd) { + if minedToken.IsGTE(*param.TotalMinedValveStart) && minedToken.IsLT(*param.TotalMinedValveEnd) { return param, nil } } diff --git a/x/pot/keeper/querier.go b/x/pot/keeper/querier.go index 6e93a215..bac9667d 100644 --- a/x/pot/keeper/querier.go +++ b/x/pot/keeper/querier.go @@ -62,7 +62,7 @@ func queryVolumeReport(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQ // queryPotRewardsByReportEpoch fetches total rewards and owner individual rewards from traffic and mining. func queryPotRewardsByReportEpoch(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var params types.QueryPotRewardsByReportEpochParams - err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) + err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return []byte{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -107,7 +107,7 @@ func (k Keeper) getPotRewardsByReportEpoch(ctx sdk.Context, params types.QueryPo func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var params types.QueryPotRewardsByWalletAddrParams - err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms) + err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } @@ -122,7 +122,7 @@ func queryPotRewardsByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Ke return bz, nil } -func queryPotSlashingByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { +func queryPotSlashingByWalletAddress(ctx sdk.Context, req abci.RequestQuery, k Keeper, _ *codec.LegacyAmino) ([]byte, error) { addr, err := sdk.AccAddressFromBech32(string(req.Data)) if err != nil { return []byte(sdk.ZeroInt().String()), types.ErrUnknownAccountAddress diff --git a/x/pot/keeper/slashing.go b/x/pot/keeper/slashing.go index 6b97531d..4f8dc57d 100644 --- a/x/pot/keeper/slashing.go +++ b/x/pot/keeper/slashing.go @@ -1,10 +1,12 @@ package keeper import ( + "strconv" + sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/pot/types" - regtypes "github.com/stratosnet/stratos-chain/x/register/types" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" ) /* @@ -16,11 +18,11 @@ import ( 3, unstaking resource node. */ func (k Keeper) SlashingResourceNode(ctx sdk.Context, p2pAddr stratos.SdsAddress, walletAddr sdk.AccAddress, - ozAmt sdk.Int, suspend bool) (amt sdk.Int, nodeType regtypes.NodeType, err error) { + ozAmt sdk.Int, suspend bool) (amt sdk.Int, nodeType registertypes.NodeType, err error) { node, ok := k.RegisterKeeper.GetResourceNode(ctx, p2pAddr) if !ok { - return sdk.ZeroInt(), regtypes.NodeType(0), regtypes.ErrNoResourceNodeFound + return sdk.ZeroInt(), registertypes.NodeType(0), registertypes.ErrNoResourceNodeFound } node.Suspend = suspend @@ -38,6 +40,10 @@ func (k Keeper) SlashingResourceNode(ctx sdk.Context, p2pAddr stratos.SdsAddress k.RegisterKeeper.SetResourceNode(ctx, node) k.RegisterKeeper.SetSlashing(ctx, walletAddr, newSlashing) + resourceNodeType, err := strconv.Atoi(node.NodeType) + if err != nil { + return sdk.ZeroInt(), registertypes.NodeType(0), registertypes.ErrNodeType + } - return slash.TruncateInt(), node.NodeType, nil + return slash.TruncateInt(), registertypes.NodeType(resourceNodeType), nil } diff --git a/x/pot/module.go b/x/pot/module.go index 0b7be714..80fe69bc 100644 --- a/x/pot/module.go +++ b/x/pot/module.go @@ -17,7 +17,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" - //"github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -39,12 +38,12 @@ type AppModuleBasic struct { var _ module.AppModuleBasic = AppModuleBasic{} -// Name returns the staking module's name. +// Name returns the pot module's name. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +// RegisterLegacyAminoCodec registers the pot module's types on the given LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) } @@ -65,7 +64,7 @@ func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { rest.RegisterRoutes(ctx, rtr) } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the pot module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) } @@ -95,9 +94,8 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // AppModule implements an application module for the pot module. type AppModule struct { AppModuleBasic - keeper keeper.Keeper - bankKeeper bankkeeper.Keeper - //supplyKeeper supply.Keeper + keeper keeper.Keeper + bankKeeper bankkeeper.Keeper accountKeeper types.AccountKeeper stakingKeeper stakingkeeper.Keeper registerKeeper registerkeeper.Keeper @@ -110,7 +108,6 @@ func NewAppModule(k keeper.Keeper, bankKeeper bankkeeper.Keeper, AppModuleBasic: AppModuleBasic{}, keeper: k, bankKeeper: bankKeeper, - //supplyKeeper: supplyKeeper, accountKeeper: accountKeeper, stakingKeeper: stakingKeeper, registerKeeper: registerKeeper, @@ -125,6 +122,12 @@ func (AppModule) Name() string { // RegisterInvariants registers the pot module invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} +// Route returns the message routing key for the pot module. +// Route returns the message routing key for the register module. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + // NewHandler returns an sdk.Handler for the pot module. func (am AppModule) NewHandler() sdk.Handler { return NewHandler(am.keeper) @@ -136,16 +139,16 @@ func (AppModule) QuerierRoute() string { } // NewQuerierHandler returns the pot module sdk.Querier. -func (am AppModule) NewQuerierHandler() sdk.Querier { - return keeper.NewQuerier(am.keeper) +func (am AppModule) NewQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return keeper.NewQuerier(am.keeper, legacyQuerierCdc) } // InitGenesis performs genesis initialization for the pot module. It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { var genesisState types.GenesisState - cdc.MustUnmarshalJSON(data, &genesisState) - InitGenesis(ctx, am.keeper, genesisState) + types.ModuleCdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, &genesisState) return []abci.ValidatorUpdate{} } @@ -185,12 +188,7 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return nil } -// LegacyQuerierHandler returns the staking module sdk.Querier. +// LegacyQuerierHandler returns the pot module sdk.Querier. func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return keeper.NewQuerier(am.keeper, legacyQuerierCdc) } - -// Route returns the message routing key for the register module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} diff --git a/x/pot/pot_test.go b/x/pot/pot_test.go index f990924b..07beceee 100644 --- a/x/pot/pot_test.go +++ b/x/pot/pot_test.go @@ -1,318 +1,319 @@ package pot -import ( - "os" - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/mock" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/register" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/secp256k1" -) - -const ( - chainID = "" - StratosBech32Prefix = "st" - - stos2ustos = 1000000000 -) - -var ( - AccountPubKeyPrefix = StratosBech32Prefix + "pub" - ValidatorAddressPrefix = StratosBech32Prefix + "valoper" - ValidatorPubKeyPrefix = StratosBech32Prefix + "valoperpub" - ConsNodeAddressPrefix = StratosBech32Prefix + "valcons" - ConsNodePubKeyPrefix = StratosBech32Prefix + "valconspub" - SdsNodeP2PKeyPrefix = StratosBech32Prefix + "sdsp2p" - - resNodeSlashingUOZAmt1 = sdk.NewInt(1000000000000000000) - - resourceNodeVolume1 = sdk.NewInt(500000) - resourceNodeVolume2 = sdk.NewInt(300000) - resourceNodeVolume3 = sdk.NewInt(200000) - - depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") - totalUnissuedPrepayVal, _ = sdk.NewIntFromString("1000000000000") - totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) - initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz - - foundationDepositorPrivKey = secp256k1.GenPrivKey() - foundationDepositorAccAddr = sdk.AccAddress(foundationDepositorPrivKey.PubKey().Address()) - foundationDeposit = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(40000000000000000)), sdk.NewCoin("utros", sdk.NewInt(40000000000000000))) - - resOwnerPrivKey1 = secp256k1.GenPrivKey() - resOwnerPrivKey2 = secp256k1.GenPrivKey() - resOwnerPrivKey3 = secp256k1.GenPrivKey() - resOwnerPrivKey4 = secp256k1.GenPrivKey() - resOwnerPrivKey5 = secp256k1.GenPrivKey() - idxOwnerPrivKey1 = secp256k1.GenPrivKey() - idxOwnerPrivKey2 = secp256k1.GenPrivKey() - idxOwnerPrivKey3 = secp256k1.GenPrivKey() - - resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) - resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) - resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) - resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) - resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) - idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) - idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) - idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) - - resNodePubKey1 = secp256k1.GenPrivKey().PubKey() - resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) - resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) - resNodeInitialStake1 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey2 = secp256k1.GenPrivKey().PubKey() - resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) - resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) - resNodeInitialStake2 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey3 = secp256k1.GenPrivKey().PubKey() - resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) - resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) - resNodeInitialStake3 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey4 = secp256k1.GenPrivKey().PubKey() - resNodeAddr4 = sdk.AccAddress(resNodePubKey4.Address()) - resNodeNetworkId4 = stratos.SdsAddress(resNodePubKey4.Address()) - resNodeInitialStake4 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey5 = secp256k1.GenPrivKey().PubKey() - resNodeAddr5 = sdk.AccAddress(resNodePubKey5.Address()) - resNodeNetworkId5 = stratos.SdsAddress(resNodePubKey5.Address()) - resNodeInitialStake5 = sdk.NewInt(3 * stos2ustos) - - idxNodePrivKey1 = secp256k1.GenPrivKey() - idxNodePubKey1 = idxNodePrivKey1.PubKey() - idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) - idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) - idxNodeInitialStake1 = sdk.NewInt(5 * stos2ustos) - - idxNodePubKey2 = secp256k1.GenPrivKey().PubKey() - idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) - idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) - idxNodeInitialStake2 = sdk.NewInt(5 * stos2ustos) - - idxNodePubKey3 = secp256k1.GenPrivKey().PubKey() - idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) - idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) - idxNodeInitialStake3 = sdk.NewInt(5 * stos2ustos) - - valOpPrivKey1 = secp256k1.GenPrivKey() - valOpPubKey1 = valOpPrivKey1.PubKey() - valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) - valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) - - valConsPrivKey1 = secp256k1.GenPrivKey() - valConsPubk1 = valConsPrivKey1.PubKey() - valInitialStake = sdk.NewInt(15 * stos2ustos) -) - -func TestMain(m *testing.M) { - config := stratos.GetConfig() - config.Seal() - exitVal := m.Run() - os.Exit(exitVal) -} - -func setupAccounts(mApp *mock.App) []authexported.Account { - - //************************** setup resource nodes owners' accounts ************************** - resOwnerAcc1 := &auth.BaseAccount{ - Address: resOwner1, - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake1.Add(depositForSendingTx))}, - } - resOwnerAcc2 := &auth.BaseAccount{ - Address: resOwner2, - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake2)}, - } - resOwnerAcc3 := &auth.BaseAccount{ - Address: resOwner3, - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake3)}, - } - resOwnerAcc4 := &auth.BaseAccount{ - Address: resOwner4, - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake4)}, - } - resOwnerAcc5 := &auth.BaseAccount{ - Address: resOwner5, - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake5)}, - } - - //************************** setup indexing nodes owners' accounts ************************** - idxOwnerAcc1 := &auth.BaseAccount{ - Address: idxOwner1, - Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake1)}, - } - idxOwnerAcc2 := &auth.BaseAccount{ - Address: idxOwner2, - Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake2)}, - } - idxOwnerAcc3 := &auth.BaseAccount{ - Address: idxOwner3, - Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake3)}, - } - - //************************** setup validator delegators' accounts ************************** - valOwnerAcc1 := &auth.BaseAccount{ - Address: valOpAccAddr1, - Coins: sdk.Coins{sdk.NewCoin("ustos", valInitialStake)}, - } - - //************************** setup indexing nodes' accounts ************************** - idxNodeAcc1 := &auth.BaseAccount{ - Address: idxNodeAddr1, - Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, - } - - foundationDepositorAcc := &auth.BaseAccount{ - Address: foundationDepositorAccAddr, - Coins: foundationDeposit, - } - - accs := []authexported.Account{ - resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, - idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, - valOwnerAcc1, - foundationDepositorAcc, - idxNodeAcc1, - } - - ctx1 := mApp.BaseApp.NewContext(true, abci.Header{}) - ctx1.Logger().Info("idxNodeAcc1 -> " + idxNodeAcc1.String()) - - return accs -} - -func setupAllResourceNodes() []register.ResourceNode { - - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - resourceNode1 := register.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, register.NewDescription("sds://resourceNode1", "", "", "", ""), 4, time) - resourceNode2 := register.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, register.NewDescription("sds://resourceNode2", "", "", "", ""), 4, time) - resourceNode3 := register.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, register.NewDescription("sds://resourceNode3", "", "", "", ""), 4, time) - resourceNode4 := register.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, register.NewDescription("sds://resourceNode4", "", "", "", ""), 4, time) - resourceNode5 := register.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, register.NewDescription("sds://resourceNode5", "", "", "", ""), 4, time) - - resourceNode1 = resourceNode1.AddToken(resNodeInitialStake1) - resourceNode2 = resourceNode2.AddToken(resNodeInitialStake2) - resourceNode3 = resourceNode3.AddToken(resNodeInitialStake3) - resourceNode4 = resourceNode4.AddToken(resNodeInitialStake4) - resourceNode5 = resourceNode5.AddToken(resNodeInitialStake5) - - resourceNode1.Status = sdk.Bonded - resourceNode2.Status = sdk.Bonded - resourceNode3.Status = sdk.Bonded - resourceNode4.Status = sdk.Bonded - resourceNode5.Status = sdk.Bonded - - var resourceNodes []register.ResourceNode - resourceNodes = append(resourceNodes, resourceNode1) - resourceNodes = append(resourceNodes, resourceNode2) - resourceNodes = append(resourceNodes, resourceNode3) - resourceNodes = append(resourceNodes, resourceNode4) - resourceNodes = append(resourceNodes, resourceNode5) - return resourceNodes -} - -func setupAllIndexingNodes() []register.IndexingNode { - var indexingNodes []register.IndexingNode - - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - indexingNode1 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwner1, register.NewDescription("sds://indexingNode1", "", "", "", ""), time) - indexingNode2 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwner2, register.NewDescription("sds://indexingNode2", "", "", "", ""), time) - indexingNode3 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr3), idxNodePubKey3, idxOwner3, register.NewDescription("sds://indexingNode3", "", "", "", ""), time) - - indexingNode1 = indexingNode1.AddToken(idxNodeInitialStake1) - indexingNode2 = indexingNode2.AddToken(idxNodeInitialStake2) - indexingNode3 = indexingNode3.AddToken(idxNodeInitialStake3) - - indexingNode1.Status = sdk.Bonded - indexingNode2.Status = sdk.Bonded - indexingNode3.Status = sdk.Bonded - - indexingNodes = append(indexingNodes, indexingNode1) - indexingNodes = append(indexingNodes, indexingNode2) - indexingNodes = append(indexingNodes, indexingNode3) - - return indexingNodes - -} - -// SignCheckDeliver checks a generated signed transaction and simulates a -// block commitment with the given transaction. A test assertion is made using -// the parameter 'expPass' against the result. A corresponding result is -// returned. -func SignCheckDeliver( - t *testing.T, cdc *codec.Codec, app *baseapp.BaseApp, header abci.Header, msgs []sdk.Msg, - accNums, seq []uint64, expSimPass, expPass bool, priv ...crypto.PrivKey, -) (sdk.GasInfo, *sdk.Result, error) { - - tx := GenTx(msgs, accNums, seq, priv...) - - txBytes, err := cdc.MarshalBinaryLengthPrefixed(tx) - require.Nil(t, err) - - // Must simulate now as CheckTx doesn't run Msgs anymore - _, res, err := app.Simulate(txBytes, tx) - - if expSimPass { - require.NoError(t, err) - require.NotNil(t, res) - } else { - require.Error(t, err) - require.Nil(t, res) - } - - // Simulate a sending a transaction and committing a block - app.BeginBlock(abci.RequestBeginBlock{Header: header}) - gInfo, res, err := app.Deliver(tx) - - if expPass { - require.NoError(t, err) - require.NotNil(t, res) - } else { - require.Error(t, err) - require.Nil(t, res) - } - - app.EndBlock(abci.RequestEndBlock{}) - app.Commit() - - return gInfo, res, err -} - -// GenTx generates a signed mock transaction. -func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx { - // Make the transaction free - fee := auth.StdFee{ - Amount: sdk.NewCoins(sdk.NewInt64Coin("foocoin", 0)), - Gas: 5000000, - } - - sigs := make([]auth.StdSignature, len(priv)) - memo := "testmemotestmemo" - - for i, p := range priv { - sig, err := p.Sign(auth.StdSignBytes(chainID, accnums[i], seq[i], fee, msgs, memo)) - if err != nil { - panic(err) - } - - sigs[i] = auth.StdSignature{ - PubKey: p.PubKey(), - Signature: sig, - } - } - - return auth.NewStdTx(msgs, fee, sigs, memo) -} +// +//import ( +// "os" +// "testing" +// "time" +// +// "github.com/cosmos/cosmos-sdk/baseapp" +// "github.com/cosmos/cosmos-sdk/codec" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" +// "github.com/cosmos/cosmos-sdk/x/mock" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/register" +// "github.com/stretchr/testify/require" +// abci "github.com/tendermint/tendermint/abci/types" +// "github.com/tendermint/tendermint/crypto" +// "github.com/tendermint/tendermint/crypto/secp256k1" +//) +// +//const ( +// chainID = "" +// StratosBech32Prefix = "st" +// +// stos2ustos = 1000000000 +//) +// +//var ( +// AccountPubKeyPrefix = StratosBech32Prefix + "pub" +// ValidatorAddressPrefix = StratosBech32Prefix + "valoper" +// ValidatorPubKeyPrefix = StratosBech32Prefix + "valoperpub" +// ConsNodeAddressPrefix = StratosBech32Prefix + "valcons" +// ConsNodePubKeyPrefix = StratosBech32Prefix + "valconspub" +// SdsNodeP2PKeyPrefix = StratosBech32Prefix + "sdsp2p" +// +// resNodeSlashingUOZAmt1 = sdk.NewInt(1000000000000000000) +// +// resourceNodeVolume1 = sdk.NewInt(500000) +// resourceNodeVolume2 = sdk.NewInt(300000) +// resourceNodeVolume3 = sdk.NewInt(200000) +// +// depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") +// totalUnissuedPrepayVal, _ = sdk.NewIntFromString("1000000000000") +// totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) +// initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz +// +// foundationDepositorPrivKey = secp256k1.GenPrivKey() +// foundationDepositorAccAddr = sdk.AccAddress(foundationDepositorPrivKey.PubKey().Address()) +// foundationDeposit = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(40000000000000000)), sdk.NewCoin("utros", sdk.NewInt(40000000000000000))) +// +// resOwnerPrivKey1 = secp256k1.GenPrivKey() +// resOwnerPrivKey2 = secp256k1.GenPrivKey() +// resOwnerPrivKey3 = secp256k1.GenPrivKey() +// resOwnerPrivKey4 = secp256k1.GenPrivKey() +// resOwnerPrivKey5 = secp256k1.GenPrivKey() +// idxOwnerPrivKey1 = secp256k1.GenPrivKey() +// idxOwnerPrivKey2 = secp256k1.GenPrivKey() +// idxOwnerPrivKey3 = secp256k1.GenPrivKey() +// +// resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) +// resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) +// resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) +// resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) +// resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) +// idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) +// idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) +// idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) +// +// resNodePubKey1 = secp256k1.GenPrivKey().PubKey() +// resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) +// resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) +// resNodeInitialStake1 = sdk.NewInt(3 * stos2ustos) +// +// resNodePubKey2 = secp256k1.GenPrivKey().PubKey() +// resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) +// resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) +// resNodeInitialStake2 = sdk.NewInt(3 * stos2ustos) +// +// resNodePubKey3 = secp256k1.GenPrivKey().PubKey() +// resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) +// resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) +// resNodeInitialStake3 = sdk.NewInt(3 * stos2ustos) +// +// resNodePubKey4 = secp256k1.GenPrivKey().PubKey() +// resNodeAddr4 = sdk.AccAddress(resNodePubKey4.Address()) +// resNodeNetworkId4 = stratos.SdsAddress(resNodePubKey4.Address()) +// resNodeInitialStake4 = sdk.NewInt(3 * stos2ustos) +// +// resNodePubKey5 = secp256k1.GenPrivKey().PubKey() +// resNodeAddr5 = sdk.AccAddress(resNodePubKey5.Address()) +// resNodeNetworkId5 = stratos.SdsAddress(resNodePubKey5.Address()) +// resNodeInitialStake5 = sdk.NewInt(3 * stos2ustos) +// +// idxNodePrivKey1 = secp256k1.GenPrivKey() +// idxNodePubKey1 = idxNodePrivKey1.PubKey() +// idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) +// idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) +// idxNodeInitialStake1 = sdk.NewInt(5 * stos2ustos) +// +// idxNodePubKey2 = secp256k1.GenPrivKey().PubKey() +// idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) +// idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) +// idxNodeInitialStake2 = sdk.NewInt(5 * stos2ustos) +// +// idxNodePubKey3 = secp256k1.GenPrivKey().PubKey() +// idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) +// idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) +// idxNodeInitialStake3 = sdk.NewInt(5 * stos2ustos) +// +// valOpPrivKey1 = secp256k1.GenPrivKey() +// valOpPubKey1 = valOpPrivKey1.PubKey() +// valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) +// valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) +// +// valConsPrivKey1 = secp256k1.GenPrivKey() +// valConsPubk1 = valConsPrivKey1.PubKey() +// valInitialStake = sdk.NewInt(15 * stos2ustos) +//) +// +//func TestMain(m *testing.M) { +// config := stratos.GetConfig() +// config.Seal() +// exitVal := m.Run() +// os.Exit(exitVal) +//} +// +//func setupAccounts(mApp *mock.App) []authexported.Account { +// +// //************************** setup resource nodes owners' accounts ************************** +// resOwnerAcc1 := &auth.BaseAccount{ +// Address: resOwner1, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake1.Add(depositForSendingTx))}, +// } +// resOwnerAcc2 := &auth.BaseAccount{ +// Address: resOwner2, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake2)}, +// } +// resOwnerAcc3 := &auth.BaseAccount{ +// Address: resOwner3, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake3)}, +// } +// resOwnerAcc4 := &auth.BaseAccount{ +// Address: resOwner4, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake4)}, +// } +// resOwnerAcc5 := &auth.BaseAccount{ +// Address: resOwner5, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake5)}, +// } +// +// //************************** setup indexing nodes owners' accounts ************************** +// idxOwnerAcc1 := &auth.BaseAccount{ +// Address: idxOwner1, +// Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake1)}, +// } +// idxOwnerAcc2 := &auth.BaseAccount{ +// Address: idxOwner2, +// Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake2)}, +// } +// idxOwnerAcc3 := &auth.BaseAccount{ +// Address: idxOwner3, +// Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake3)}, +// } +// +// //************************** setup validator delegators' accounts ************************** +// valOwnerAcc1 := &auth.BaseAccount{ +// Address: valOpAccAddr1, +// Coins: sdk.Coins{sdk.NewCoin("ustos", valInitialStake)}, +// } +// +// //************************** setup indexing nodes' accounts ************************** +// idxNodeAcc1 := &auth.BaseAccount{ +// Address: idxNodeAddr1, +// Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, +// } +// +// foundationDepositorAcc := &auth.BaseAccount{ +// Address: foundationDepositorAccAddr, +// Coins: foundationDeposit, +// } +// +// accs := []authexported.Account{ +// resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, +// idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, +// valOwnerAcc1, +// foundationDepositorAcc, +// idxNodeAcc1, +// } +// +// ctx1 := mApp.BaseApp.NewContext(true, abci.Header{}) +// ctx1.Logger().Info("idxNodeAcc1 -> " + idxNodeAcc1.String()) +// +// return accs +//} +// +//func setupAllResourceNodes() []register.ResourceNode { +// +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// resourceNode1 := register.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, register.NewDescription("sds://resourceNode1", "", "", "", ""), 4, time) +// resourceNode2 := register.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, register.NewDescription("sds://resourceNode2", "", "", "", ""), 4, time) +// resourceNode3 := register.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, register.NewDescription("sds://resourceNode3", "", "", "", ""), 4, time) +// resourceNode4 := register.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, register.NewDescription("sds://resourceNode4", "", "", "", ""), 4, time) +// resourceNode5 := register.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, register.NewDescription("sds://resourceNode5", "", "", "", ""), 4, time) +// +// resourceNode1 = resourceNode1.AddToken(resNodeInitialStake1) +// resourceNode2 = resourceNode2.AddToken(resNodeInitialStake2) +// resourceNode3 = resourceNode3.AddToken(resNodeInitialStake3) +// resourceNode4 = resourceNode4.AddToken(resNodeInitialStake4) +// resourceNode5 = resourceNode5.AddToken(resNodeInitialStake5) +// +// resourceNode1.Status = sdk.Bonded +// resourceNode2.Status = sdk.Bonded +// resourceNode3.Status = sdk.Bonded +// resourceNode4.Status = sdk.Bonded +// resourceNode5.Status = sdk.Bonded +// +// var resourceNodes []register.ResourceNode +// resourceNodes = append(resourceNodes, resourceNode1) +// resourceNodes = append(resourceNodes, resourceNode2) +// resourceNodes = append(resourceNodes, resourceNode3) +// resourceNodes = append(resourceNodes, resourceNode4) +// resourceNodes = append(resourceNodes, resourceNode5) +// return resourceNodes +//} +// +//func setupAllIndexingNodes() []register.IndexingNode { +// var indexingNodes []register.IndexingNode +// +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// indexingNode1 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwner1, register.NewDescription("sds://indexingNode1", "", "", "", ""), time) +// indexingNode2 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwner2, register.NewDescription("sds://indexingNode2", "", "", "", ""), time) +// indexingNode3 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr3), idxNodePubKey3, idxOwner3, register.NewDescription("sds://indexingNode3", "", "", "", ""), time) +// +// indexingNode1 = indexingNode1.AddToken(idxNodeInitialStake1) +// indexingNode2 = indexingNode2.AddToken(idxNodeInitialStake2) +// indexingNode3 = indexingNode3.AddToken(idxNodeInitialStake3) +// +// indexingNode1.Status = sdk.Bonded +// indexingNode2.Status = sdk.Bonded +// indexingNode3.Status = sdk.Bonded +// +// indexingNodes = append(indexingNodes, indexingNode1) +// indexingNodes = append(indexingNodes, indexingNode2) +// indexingNodes = append(indexingNodes, indexingNode3) +// +// return indexingNodes +// +//} +// +//// SignCheckDeliver checks a generated signed transaction and simulates a +//// block commitment with the given transaction. A test assertion is made using +//// the parameter 'expPass' against the result. A corresponding result is +//// returned. +//func SignCheckDeliver( +// t *testing.T, cdc *codec.Codec, app *baseapp.BaseApp, header abci.Header, msgs []sdk.Msg, +// accNums, seq []uint64, expSimPass, expPass bool, priv ...crypto.PrivKey, +//) (sdk.GasInfo, *sdk.Result, error) { +// +// tx := GenTx(msgs, accNums, seq, priv...) +// +// txBytes, err := cdc.MarshalBinaryLengthPrefixed(tx) +// require.Nil(t, err) +// +// // Must simulate now as CheckTx doesn't run Msgs anymore +// _, res, err := app.Simulate(txBytes, tx) +// +// if expSimPass { +// require.NoError(t, err) +// require.NotNil(t, res) +// } else { +// require.Error(t, err) +// require.Nil(t, res) +// } +// +// // Simulate a sending a transaction and committing a block +// app.BeginBlock(abci.RequestBeginBlock{Header: header}) +// gInfo, res, err := app.Deliver(tx) +// +// if expPass { +// require.NoError(t, err) +// require.NotNil(t, res) +// } else { +// require.Error(t, err) +// require.Nil(t, res) +// } +// +// app.EndBlock(abci.RequestEndBlock{}) +// app.Commit() +// +// return gInfo, res, err +//} +// +//// GenTx generates a signed mock transaction. +//func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx { +// // Make the transaction free +// fee := auth.StdFee{ +// Amount: sdk.NewCoins(sdk.NewInt64Coin("foocoin", 0)), +// Gas: 5000000, +// } +// +// sigs := make([]auth.StdSignature, len(priv)) +// memo := "testmemotestmemo" +// +// for i, p := range priv { +// sig, err := p.Sign(auth.StdSignBytes(chainID, accnums[i], seq[i], fee, msgs, memo)) +// if err != nil { +// panic(err) +// } +// +// sigs[i] = auth.StdSignature{ +// PubKey: p.PubKey(), +// Signature: sig, +// } +// } +// +// return auth.NewStdTx(msgs, fee, sigs, memo) +//} diff --git a/x/pot/types/codec.go b/x/pot/types/codec.go index c04bcc28..ee062375 100644 --- a/x/pot/types/codec.go +++ b/x/pot/types/codec.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" ) -// RegisterCodec registers concrete types on codec +// RegisterLegacyAminoCodec RegisterCodec registers concrete types on codec func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // this line is used by starport scaffolding # 1 cdc.RegisterConcrete(MsgVolumeReport{}, "pot/VolumeReportTx", nil) diff --git a/x/pot/types/genesis.go b/x/pot/types/genesis.go index d27f195d..9fc6a6b5 100644 --- a/x/pot/types/genesis.go +++ b/x/pot/types/genesis.go @@ -39,11 +39,6 @@ func ValidateGenesis(data GenesisState) error { return nil } -//type ImmatureTotal struct { -// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` -// Value sdk.Coins `json:"value" yaml:"value"` -//} -// func NewImmatureTotal(walletAddress sdk.AccAddress, value sdk.Coins) ImmatureTotal { return ImmatureTotal{ WalletAddress: walletAddress.String(), @@ -51,11 +46,6 @@ func NewImmatureTotal(walletAddress sdk.AccAddress, value sdk.Coins) ImmatureTot } } -//type MatureTotal struct { -// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` -// Value sdk.Coins `json:"value" yaml:"value"` -//} -// func NewMatureTotal(walletAddress sdk.AccAddress, value sdk.Coins) MatureTotal { return MatureTotal{ WalletAddress: walletAddress.String(), diff --git a/x/pot/types/params.go b/x/pot/types/params.go index af7e91ea..b1500a18 100644 --- a/x/pot/types/params.go +++ b/x/pot/types/params.go @@ -6,8 +6,7 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/params" - "github.com/cosmos/cosmos-sdk/x/params/subspace" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // DefaultParamSpace Default parameter namespace @@ -26,25 +25,16 @@ var ( KeyMiningRewardParams = []byte("MiningRewardParams") ) -var _ subspace.ParamSet = &Params{} +//var _ subspace.ParamSet = &Params{} -// -//// Params - used for initializing default parameter for pot at genesis -//type Params struct { -// BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination -// RewardDenom string `json:"reward_denom" yaml:"reward_denom"` -// MatureEpoch int64 `json:"mature_epoch" yaml:"mature_epoch"` -// MiningRewardParams []MiningRewardParam `json:"mining_reward_params" yaml:"mining_reward_params"` -//} -// -//// ParamKeyTable for pot module -func ParamKeyTable() params.KeyTable { - return params.NewKeyTable().RegisterParamSet(&Params{}) +// ParamKeyTable for pot module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } // // NewParams creates a new Params object -func NewParams(bondDenom string, rewardDenom string, matureEpoch int64, miningRewardParams []MiningRewardParam) Params { +func NewParams(bondDenom string, rewardDenom string, matureEpoch int64, miningRewardParams []*MiningRewardParam) Params { return Params{ BondDenom: bondDenom, RewardDenom: rewardDenom, @@ -55,7 +45,7 @@ func NewParams(bondDenom string, rewardDenom string, matureEpoch int64, miningRe // DefaultParams returns the default distribution parameters func DefaultParams() Params { - var miningRewardParams []MiningRewardParam + var miningRewardParams []*MiningRewardParam miningRewardParams = append(miningRewardParams, NewMiningRewardParam( sdk.NewCoin(DefaultRewardDenom, sdk.NewInt(0)), sdk.NewCoin(DefaultRewardDenom, sdk.NewInt(16819200000000000)), @@ -94,7 +84,7 @@ func DefaultParams() Params { return NewParams(DefaultBondDenom, DefaultRewardDenom, DefaultMatureEpoch, miningRewardParams) } -// String implements the stringer interface for Params +// HrpString implements the stringer interface for Params func (p Params) HrpString() string { return fmt.Sprintf(`Params: BondDenom: %s @@ -105,12 +95,12 @@ func (p Params) HrpString() string { } // ParamSetPairs - Implements params.ParamSet -func (p *Params) ParamSetPairs() params.ParamSetPairs { - return params.ParamSetPairs{ - params.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), - params.NewParamSetPair(KeyRewardDenom, &p.RewardDenom, validateRewardDenom), - params.NewParamSetPair(KeyMatureEpoch, &p.MatureEpoch, validateMatureEpoch), - params.NewParamSetPair(KeyMiningRewardParams, &p.MiningRewardParams, validateMiningRewardParams), +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), + paramtypes.NewParamSetPair(KeyRewardDenom, &p.RewardDenom, validateRewardDenom), + paramtypes.NewParamSetPair(KeyMatureEpoch, &p.MatureEpoch, validateMatureEpoch), + paramtypes.NewParamSetPair(KeyMiningRewardParams, &p.MiningRewardParams, validateMiningRewardParams), } } diff --git a/x/pot/types/types.go b/x/pot/types/types.go index f196316b..9fe9e0d7 100644 --- a/x/pot/types/types.go +++ b/x/pot/types/types.go @@ -5,11 +5,6 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -//type SingleWalletVolume struct { -// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` -// Volume sdk.Int `json:"volume" yaml:"volume"` //uoz -//} - // NewSingleWalletVolume creates a new Msg instance func NewSingleWalletVolume( walletAddress sdk.AccAddress, @@ -21,18 +16,9 @@ func NewSingleWalletVolume( } } -//type MiningRewardParam struct { -// TotalMinedValveStart sdk.Coin `json:"total_mined_valve_start" yaml:"total_mined_valve_start"` -// TotalMinedValveEnd sdk.Coin `json:"total_mined_valve_end" yaml:"total_mined_valve_end"` -// MiningReward sdk.Coin `json:"mining_reward" yaml:"mining_reward"` -// BlockChainPercentageInTenThousand sdk.Int `json:"block_chain_percentage_in_ten_thousand" yaml:"block_chain_percentage_in_ten_thousand"` -// ResourceNodePercentageInTenThousand sdk.Int `json:"resource_node_percentage_in_ten_thousand" yaml:"resource_node_percentage_in_ten_thousand"` -// MetaNodePercentageInTenThousand sdk.Int `json:"meta_node_percentage_in_ten_thousand" yaml:"meta_node_percentage_in_ten_thousand"` -//} -// func NewMiningRewardParam(totalMinedValveStart sdk.Coin, totalMinedValveEnd sdk.Coin, miningReward sdk.Coin, - resourceNodePercentageInTenThousand sdk.Int, metaNodePercentageInTenThousand sdk.Int, blockChainPercentageInTenThousand sdk.Int) MiningRewardParam { - return MiningRewardParam{ + resourceNodePercentageInTenThousand sdk.Int, metaNodePercentageInTenThousand sdk.Int, blockChainPercentageInTenThousand sdk.Int) *MiningRewardParam { + return &MiningRewardParam{ TotalMinedValveStart: &totalMinedValveStart, TotalMinedValveEnd: &totalMinedValveEnd, MiningReward: &miningReward, @@ -42,12 +28,6 @@ func NewMiningRewardParam(totalMinedValveStart sdk.Coin, totalMinedValveEnd sdk. } } -//type VolumeReportRecord struct { -// Reporter stratos.SdsAddress -// ReportReference string -// TxHash string -//} - func NewReportRecord(reporter stratos.SdsAddress, reportReference string, txHash string) VolumeReportRecord { return VolumeReportRecord{ Reporter: reporter.String(), @@ -56,12 +36,6 @@ func NewReportRecord(reporter stratos.SdsAddress, reportReference string, txHash } } -//type BLSSignatureInfo struct { -// PubKeys [][]byte `json:"pub_keys" yaml:"pub_keys"` -// Signature []byte `json:"signature" yaml:"signature"` -// TxData []byte `json:"tx_data" yaml:"tx_data"` -//} - func NewBLSSignatureInfo(pubKeys [][]byte, signature []byte, txData []byte) BLSSignatureInfo { return BLSSignatureInfo{ PubKeys: pubKeys, diff --git a/x/register/module.go b/x/register/module.go index 86715471..33340d10 100644 --- a/x/register/module.go +++ b/x/register/module.go @@ -30,19 +30,19 @@ var ( _ module.AppModuleBasic = AppModuleBasic{} ) -// AppModuleBasic defines the basic application module used by the staking module. +// AppModuleBasic defines the basic application module used by the register module. type AppModuleBasic struct { cdc codec.Codec } var _ module.AppModuleBasic = AppModuleBasic{} -// Name returns the staking module's name. +// Name returns the register module's name. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +// RegisterLegacyAminoCodec registers the register module's types on the given LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) } @@ -72,7 +72,7 @@ func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { rest.RegisterHandlers(ctx, rtr) } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the register module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) } @@ -155,12 +155,12 @@ func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.We return nil } -// LegacyQuerierHandler returns the staking module sdk.Querier. +// LegacyQuerierHandler returns the register module sdk.Querier. func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return keeper.NewQuerier(am.keeper, legacyQuerierCdc) } -// InitGenesis performs genesis initialization for the staking module. It returns +// InitGenesis performs genesis initialization for the register module. It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { var genesisState types.GenesisState @@ -171,7 +171,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. return []abci.ValidatorUpdate{} } -// ExportGenesis returns the exported genesis state as raw bytes for the staking +// ExportGenesis returns the exported genesis state as raw bytes for the register // module. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { gs := ExportGenesis(ctx, am.keeper) diff --git a/x/sds/module.go b/x/sds/module.go index d0ce9b52..289952b7 100644 --- a/x/sds/module.go +++ b/x/sds/module.go @@ -48,7 +48,7 @@ func (AppModuleBasic) Name() string { // types.RegisterCodec(cdc) //} -// RegisterLegacyAminoCodec registers the staking module's types on the given LegacyAmino codec. +// RegisterLegacyAminoCodec registers the sds module's types on the given LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) } @@ -85,7 +85,7 @@ func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { rest.RegisterHandlers(ctx, rtr) } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the sds module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) } @@ -183,7 +183,7 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 2 } -// LegacyQuerierHandler returns the staking module sdk.Querier. +// LegacyQuerierHandler returns the sds module sdk.Querier. func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return keeper.NewQuerier(am.keeper, legacyQuerierCdc) } From 1de3e3e5ff844ba3bd3e8eb709c2f380bf9a3b20 Mon Sep 17 00:00:00 2001 From: Xiong Date: Tue, 17 May 2022 12:39:30 -0400 Subject: [PATCH 056/113] bug fix --- app/app.go | 3 +- client/config.go | 1 - rpc/namespaces/ethereum/eth/api.go | 1 - rpc/namespaces/ethereum/txpool/api.go | 1 - types/account.go | 57 +++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index f1412cac..3dee5c0c 100644 --- a/app/app.go +++ b/app/app.go @@ -93,6 +93,7 @@ import ( "github.com/stratosnet/stratos-chain/app/ante" srvflags "github.com/stratosnet/stratos-chain/server/flags" + stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/evm" evmrest "github.com/stratosnet/stratos-chain/x/evm/client/rest" evmkeeper "github.com/stratosnet/stratos-chain/x/evm/keeper" @@ -280,7 +281,7 @@ func NewInitApp( app.capabilityKeeper.Seal() app.accountKeeper = authkeeper.NewAccountKeeper( - appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, + appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), stratos.ProtoAccount, maccPerms, ) app.bankKeeper = bankkeeper.NewBaseKeeper( appCodec, keys[banktypes.StoreKey], app.accountKeeper, app.GetSubspace(banktypes.ModuleName), app.BlockedAddrs(), diff --git a/client/config.go b/client/config.go index 540d32e0..5b30ee36 100644 --- a/client/config.go +++ b/client/config.go @@ -26,7 +26,6 @@ func InitConfig(cmd *cobra.Command) error { _, err = os.Stat(configFile) if err != nil && !os.IsNotExist(err) { // Immediately return if the error isn't related to the file not existing. - // See issue https://github.com/tharsis/ethermint/issues/539 return err } if err == nil { diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 853c213a..649f018a 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -608,7 +608,6 @@ func (e *PublicAPI) Resend(ctx context.Context, args evmtypes.TransactionArgs, g } for _, tx := range pending { - // FIXME does Resend api possible at all? https://github.com/tharsis/ethermint/issues/905 p, err := evmtypes.UnwrapEthereumMsg(tx, common.Hash{}) if err != nil { // not valid ethereum tx diff --git a/rpc/namespaces/ethereum/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go index 8517acdb..48e49dfb 100644 --- a/rpc/namespaces/ethereum/txpool/api.go +++ b/rpc/namespaces/ethereum/txpool/api.go @@ -9,7 +9,6 @@ import ( ) // PublicAPI offers and API for the transaction pool. It only operates on data that is non-confidential. -// NOTE: For more info about the current status of this endpoints see https://github.com/tharsis/ethermint/issues/124 type PublicAPI struct { logger log.Logger } diff --git a/types/account.go b/types/account.go index 38152f0c..85ea8df9 100644 --- a/types/account.go +++ b/types/account.go @@ -1,8 +1,28 @@ package types import ( + "bytes" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" +) + +var ( + _ authtypes.AccountI = (*EthAccount)(nil) + _ EthAccountI = (*EthAccount)(nil) + _ authtypes.GenesisAccount = (*EthAccount)(nil) + _ codectypes.UnpackInterfacesMessage = (*EthAccount)(nil) +) + +var emptyCodeHash = crypto.Keccak256(nil) + +const ( + // AccountTypeEOA defines the type for externally owned accounts (EOAs) + AccountTypeEOA = int8(iota + 1) + // AccountTypeContract defines the type for contract accounts + AccountTypeContract ) // EthAccountI represents the interface of an EVM compatible account @@ -17,3 +37,40 @@ type EthAccountI interface { // Type returns the type of Ethereum Account (EOA or Contract) Type() int8 } + +// ---------------------------------------------------------------------------- +// Main stratos account +// ---------------------------------------------------------------------------- + +// ProtoAccount defines the prototype function for BaseAccount used for an +// AccountKeeper. +func ProtoAccount() authtypes.AccountI { + return &EthAccount{ + BaseAccount: &authtypes.BaseAccount{}, + CodeHash: common.BytesToHash(emptyCodeHash).String(), + } +} + +// EthAddress returns the account address ethereum format. +func (acc EthAccount) EthAddress() common.Address { + return common.BytesToAddress(acc.GetAddress().Bytes()) +} + +// GetCodeHash returns the account code hash in byte format +func (acc EthAccount) GetCodeHash() common.Hash { + return common.HexToHash(acc.CodeHash) +} + +// SetCodeHash sets the account code hash to the EthAccount fields +func (acc *EthAccount) SetCodeHash(codeHash common.Hash) error { + acc.CodeHash = codeHash.Hex() + return nil +} + +// Type returns the type of Ethereum Account (EOA or Contract) +func (acc EthAccount) Type() int8 { + if bytes.Equal(emptyCodeHash, common.Hex2Bytes(acc.CodeHash)) { + return AccountTypeEOA + } + return AccountTypeContract +} From 84ccabf2d1420a1ff0edd0a890a7b0d4ba810330 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 17 May 2022 17:21:49 -0400 Subject: [PATCH 057/113] updated pot module --- app/app.go | 66 ++-- proto/stratos/pot/v1/query.proto | 80 +--- x/pot/client/cli/query.go | 2 +- x/pot/keeper/grpc_query.go | 10 +- x/pot/types/querier.go | 2 +- x/pot/types/query.pb.go | 88 ++--- x/register/app_test.go | 465 ++++++++++++------------ x/register/keeper/resource_node_test.go | 109 +++--- x/register/register_test.go | 309 ++++++++-------- x/sds/client/common/common.go | 8 +- x/sds/module.go | 11 +- 11 files changed, 543 insertions(+), 607 deletions(-) diff --git a/app/app.go b/app/app.go index 67efc6bb..750f94dc 100644 --- a/app/app.go +++ b/app/app.go @@ -11,7 +11,10 @@ import ( "github.com/spf13/cast" "github.com/stratosnet/stratos-chain/x/pot" "github.com/stratosnet/stratos-chain/x/register" + "github.com/stratosnet/stratos-chain/x/sds" + sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" + //"github.com/stratosnet/stratos-chain/x/sds" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" tmos "github.com/tendermint/tendermint/libs/os" @@ -103,9 +106,6 @@ import ( pottypes "github.com/stratosnet/stratos-chain/x/pot/types" registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" registertypes "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/stratosnet/stratos-chain/x/sds" - sdskeeper "github.com/stratosnet/stratos-chain/x/sds/keeper" - sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) const ( @@ -141,7 +141,7 @@ var ( vesting.AppModuleBasic{}, // stratos modules register.AppModuleBasic{}, - //pot.AppModuleBasic{}, + pot.AppModuleBasic{}, sds.AppModuleBasic{}, evm.AppModuleBasic{}, ) @@ -155,12 +155,22 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, //pot.FoundationAccount: nil, - registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account - pottypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account - pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account - pottypes.MiningRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account - pottypes.TrafficRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + registertypes.ResourceNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.TotalUnissuedPrepayName: nil, + + sdstypes.ModuleName: nil, + evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + //pottypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + //pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + //pottypes.MiningRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + //pottypes.TrafficRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, + pottypes.MiningRewardPool: nil, + pottypes.TrafficRewardPool: nil, } // module accounts that are allowed to receive tokens @@ -210,8 +220,8 @@ type NewApp struct { // stratos keepers registerKeeper registerkeeper.Keeper potKeeper potkeeper.Keeper - sdsKeeper sdskeeper.Keeper - evmKeeper *evmkeeper.Keeper + //sdsKeeper sdskeeper.Keeper + evmKeeper *evmkeeper.Keeper // the module manager mm *module.Manager @@ -256,7 +266,7 @@ func NewInitApp( // stratos keys registertypes.StoreKey, pottypes.StoreKey, - sdstypes.StoreKey, + //sdstypes.StoreKey, evmtypes.StoreKey, ) @@ -390,7 +400,7 @@ func NewInitApp( app.potKeeper = potkeeper.NewKeeper( appCodec, keys[pot.StoreKey], - app.GetSubspace(pot.ModuleName), + app.GetSubspace(pottypes.ModuleName), authtypes.FeeCollectorName, app.bankKeeper, //app.supplyKeeper, @@ -399,14 +409,14 @@ func NewInitApp( app.registerKeeper, ) - app.sdsKeeper = sdskeeper.NewKeeper( - appCodec, - keys[sdstypes.StoreKey], - app.GetSubspace(sdstypes.ModuleName), - app.bankKeeper, - app.registerKeeper, - app.potKeeper, - ) + //app.sdsKeeper = sdskeeper.NewKeeper( + // appCodec, + // keys[sdstypes.StoreKey], + // app.GetSubspace(sdstypes.ModuleName), + // app.bankKeeper, + // app.registerKeeper, + // app.potKeeper, + //) /**** Module Options ****/ @@ -439,7 +449,7 @@ func NewInitApp( evm.NewAppModule(app.evmKeeper, app.accountKeeper), register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), pot.NewAppModule(app.potKeeper, app.bankKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), - sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), + //sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -472,7 +482,7 @@ func NewInitApp( // stratos registertypes.ModuleName, pottypes.ModuleName, - sdstypes.ModuleName, + //sdstypes.ModuleName, ) // NOTE: fee market module must go last in order to retrieve the block gas used. @@ -482,7 +492,7 @@ func NewInitApp( stakingtypes.ModuleName, registertypes.ModuleName, pottypes.ModuleName, - sdstypes.ModuleName, + //sdstypes.ModuleName, evmtypes.ModuleName, // no-op modules ibchost.ModuleName, @@ -527,10 +537,10 @@ func NewInitApp( upgradetypes.ModuleName, vestingtypes.ModuleName, // Stratos modules - evmtypes.ModuleName, registertypes.ModuleName, pottypes.ModuleName, - sdstypes.ModuleName, + //sdstypes.ModuleName, + evmtypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module crisistypes.ModuleName, @@ -714,7 +724,7 @@ func initParamsKeeper( // stratos subspaces paramsKeeper.Subspace(registertypes.ModuleName) paramsKeeper.Subspace(pottypes.ModuleName) - paramsKeeper.Subspace(sdstypes.ModuleName) + //paramsKeeper.Subspace(sdstypes.ModuleName) paramsKeeper.Subspace(evmtypes.ModuleName) return paramsKeeper diff --git a/proto/stratos/pot/v1/query.proto b/proto/stratos/pot/v1/query.proto index 20c221ae..d79e0b15 100644 --- a/proto/stratos/pot/v1/query.proto +++ b/proto/stratos/pot/v1/query.proto @@ -20,21 +20,13 @@ service Query { // QueryVolumeReportRequest is request type for the Query/VolumeReport RPC method message QueryVolumeReportRequest { // epoch defines the epoch number to query for. - string epoch = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; + string epoch = 1; } message ReportInfo { - string epoch = 1; -// [ -// (gogoproto.jsontag) = "epoch", -// (gogoproto.moretags) = "yaml:\"epoch\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" -// ]; + string epoch = 1; string reference = 2; -// [ -// (gogoproto.jsontag) = "reference", -// (gogoproto.moretags) = "yaml:\"reference\"" -// ]; + } // QueryVolumeReportResponse is response type for the Query/ResourceNode RPC method @@ -46,71 +38,5 @@ message QueryVolumeReportResponse { -//// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method -//message QueryIndexingNodeRequest { -// // network_addr defines the node network address to query for. -// string network_addr = 1; -//} -// -//// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method -//message QueryIndexingNodeResponse { -// // node defines the the indexing info. -// IndexingNode node = 1; -//} -// -//// QueryStakeByNodeRequest is request type for the Query/StakeByNode RPC method -//message QueryStakeByNodeRequest { -// // acc_addr defines the node network address to query for. -// string acc_addr = 1; -// int64 query_type = 2; -// // pagination defines an optional pagination for the request. -//// cosmos.base.query.v1beta1.PageRequest pagination = 3; -//} -// -//// QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method -//message QueryStakeByNodeResponse { -// // staking_info defines the the staking_info info of the node. -// StakingInfo staking_info = 1; -// // pagination defines an optional pagination for the request. -//// cosmos.base.query.v1beta1.PageResponse pagination = 2; -//} -// -//// QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method -//message QueryStakeByOwnerRequest { -// // owner_addr defines the owner address to query for. -// string network_addr = 1; -// string moniker = 2; -// string owner_addr = 3; -// // pagination defines an optional pagination for the request. -// cosmos.base.query.v1beta1.PageRequest pagination = 4; -//} -// -//// QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method -//message QueryStakeByOwnerResponse { -// // staking_infos defines the the node staking info of this owner. -// repeated StakingInfo staking_infos = 1; -// // pagination defines an optional pagination for the request. -// cosmos.base.query.v1beta1.PageResponse pagination = 2; -//} -// -//// QueryTotalStakeRequest is request type for the Query/TotalStake RPC method -//message QueryTotalStakeRequest {} -// -//// QueryTotalStakeResponse is response type for the Query/TotalStake RPC method -//message QueryTotalStakeResponse { -// // total_stakes defines the total staking info. -// TotalStakesResponse total_stakes= 1; -//} -// -//// QueryParamsRequest is request type for the Query/Params RPC method. -//message QueryParamsRequest {} -// -//// QueryParamsResponse is response type for the Query/Params RPC method. -//message QueryParamsResponse { -// // params holds all the parameters of this module. -// Params params = 1; -//} - - diff --git a/x/pot/client/cli/query.go b/x/pot/client/cli/query.go index 43804f90..1070eaaf 100644 --- a/x/pot/client/cli/query.go +++ b/x/pot/client/cli/query.go @@ -54,7 +54,7 @@ func GetCmdQueryVolumeReport() *cobra.Command { } result, err := queryClient.VolumeReport(cmd.Context(), &types.QueryVolumeReportRequest{ - Epoch: &epoch, + Epoch: epoch.String(), }) if err != nil { return err diff --git a/x/pot/keeper/grpc_query.go b/x/pot/keeper/grpc_query.go index 6ae36560..6a4a4c23 100644 --- a/x/pot/keeper/grpc_query.go +++ b/x/pot/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "strconv" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/pot/types" @@ -21,11 +22,16 @@ func (q Querier) VolumeReport(c context.Context, req *types.QueryVolumeReportReq return &types.QueryVolumeReportResponse{}, status.Error(codes.InvalidArgument, "empty request") } - if req.Epoch.LTE(sdk.ZeroInt()) { + epochInt64, err := strconv.ParseInt(req.Epoch, 10, 64) + if err != nil { + return &types.QueryVolumeReportResponse{}, status.Error(codes.InvalidArgument, "invalid epoch") + } + + if sdk.NewInt(epochInt64).LTE(sdk.ZeroInt()) { return &types.QueryVolumeReportResponse{}, status.Error(codes.InvalidArgument, "epoch should be positive value") } - epoch, ok := sdk.NewIntFromString(req.Epoch.String()) + epoch, ok := sdk.NewIntFromString(req.Epoch) if !ok { return &types.QueryVolumeReportResponse{}, status.Error(codes.InvalidArgument, "invalid epoch") } diff --git a/x/pot/types/querier.go b/x/pot/types/querier.go index d73cbfe7..20c7faa1 100644 --- a/x/pot/types/querier.go +++ b/x/pot/types/querier.go @@ -69,7 +69,7 @@ func NewQueryPotRewardsByWalletAddrParams(page, limit int, walletAddr sdk.AccAdd func NewReportInfo(epoch sdk.Int, reference string) ReportInfo { return ReportInfo{ - Epoch: epoch, + Epoch: epoch.String(), Reference: reference, } } diff --git a/x/pot/types/query.pb.go b/x/pot/types/query.pb.go index 54c5f6c9..40469bf4 100644 --- a/x/pot/types/query.pb.go +++ b/x/pot/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -33,7 +32,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryVolumeReportRequest is request type for the Query/VolumeReport RPC method type QueryVolumeReportRequest struct { // epoch defines the epoch number to query for. - Epoch *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=epoch,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"epoch,omitempty"` + Epoch string `protobuf:"bytes,1,opt,name=epoch,proto3" json:"epoch,omitempty"` } func (m *QueryVolumeReportRequest) Reset() { *m = QueryVolumeReportRequest{} } @@ -69,13 +68,15 @@ func (m *QueryVolumeReportRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryVolumeReportRequest proto.InternalMessageInfo +func (m *QueryVolumeReportRequest) GetEpoch() string { + if m != nil { + return m.Epoch + } + return "" +} + type ReportInfo struct { - Epoch string `protobuf:"bytes,1,opt,name=epoch,proto3" json:"epoch,omitempty"` - // [ - // (gogoproto.jsontag) = "epoch", - // (gogoproto.moretags) = "yaml:\"epoch\"", - // (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" - // ]; + Epoch string `protobuf:"bytes,1,opt,name=epoch,proto3" json:"epoch,omitempty"` Reference string `protobuf:"bytes,2,opt,name=reference,proto3" json:"reference,omitempty"` } @@ -189,31 +190,29 @@ func init() { func init() { proto.RegisterFile("stratos/pot/v1/query.proto", fileDescriptor_c09bd09df76a68e0) } var fileDescriptor_c09bd09df76a68e0 = []byte{ - // 375 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x4b, 0xe3, 0x40, - 0x14, 0xc7, 0x9b, 0x2e, 0x2d, 0x74, 0x76, 0xd9, 0xc3, 0x50, 0x96, 0x6e, 0x28, 0xd9, 0x25, 0xa0, - 0x56, 0x21, 0x19, 0x5a, 0x6f, 0x9e, 0x4a, 0x6f, 0x3d, 0x9a, 0x83, 0x07, 0xf1, 0x92, 0xc6, 0xd7, - 0x24, 0xd8, 0xce, 0x9b, 0x66, 0x26, 0xc5, 0x22, 0x5e, 0xfc, 0x0b, 0x44, 0xaf, 0xfe, 0x41, 0x1e, - 0x0b, 0x5e, 0xc4, 0x83, 0x48, 0xeb, 0x1f, 0x22, 0x9d, 0x44, 0xfb, 0x03, 0x05, 0x4f, 0xf3, 0x66, - 0xbe, 0xdf, 0xf9, 0xbc, 0x37, 0xef, 0x0d, 0x31, 0xa5, 0x4a, 0x7c, 0x85, 0x92, 0x09, 0x54, 0x6c, - 0xdc, 0x64, 0xa3, 0x14, 0x92, 0x89, 0x2b, 0x12, 0x54, 0x48, 0x7f, 0xe7, 0x9a, 0x2b, 0x50, 0xb9, - 0xe3, 0xa6, 0x59, 0x0d, 0x31, 0x44, 0x2d, 0xb1, 0x45, 0x94, 0xb9, 0xcc, 0x7a, 0x88, 0x18, 0x0e, - 0x80, 0xf9, 0x22, 0x66, 0x3e, 0xe7, 0xa8, 0x7c, 0x15, 0x23, 0x97, 0x99, 0x6a, 0x9f, 0x90, 0xda, - 0xe1, 0x02, 0x79, 0x84, 0x83, 0x74, 0x08, 0x1e, 0x08, 0x4c, 0x94, 0x07, 0xa3, 0x14, 0xa4, 0xa2, - 0x6d, 0x52, 0x02, 0x81, 0x41, 0x54, 0x33, 0xfe, 0x1b, 0x8d, 0x4a, 0x67, 0xef, 0xe9, 0xf9, 0xdf, - 0x76, 0x18, 0xab, 0x28, 0xed, 0xb9, 0x01, 0x0e, 0x59, 0x80, 0x72, 0x88, 0x32, 0x5f, 0x1c, 0x79, - 0x7a, 0xc6, 0xd4, 0x44, 0x80, 0x74, 0xbb, 0x5c, 0x79, 0xd9, 0x45, 0xbb, 0x4d, 0x48, 0x86, 0xec, - 0xf2, 0x3e, 0xd2, 0xea, 0x1a, 0x2f, 0xf7, 0xd0, 0x3a, 0xa9, 0x24, 0xd0, 0x87, 0x04, 0x78, 0x00, - 0xb5, 0xa2, 0x56, 0x96, 0x07, 0x36, 0x92, 0xbf, 0x9f, 0xd4, 0x27, 0x05, 0x72, 0x09, 0xf4, 0x80, - 0x90, 0xe4, 0x03, 0xaf, 0xa9, 0x3f, 0x5b, 0xa6, 0xbb, 0xde, 0x15, 0x77, 0x59, 0x80, 0xb7, 0xe2, - 0xa6, 0x7f, 0x48, 0x39, 0x82, 0x38, 0x8c, 0x94, 0xce, 0xf9, 0xc3, 0xcb, 0x77, 0xad, 0x3b, 0x83, - 0x94, 0x74, 0x46, 0x7a, 0x63, 0x90, 0x5f, 0xab, 0x69, 0x69, 0x63, 0x13, 0xfd, 0x55, 0xe7, 0xcc, - 0xdd, 0x6f, 0x38, 0xb3, 0x37, 0xd8, 0xce, 0xd5, 0xc3, 0xeb, 0x6d, 0x71, 0x87, 0x6e, 0xb1, 0x8d, - 0x49, 0x8f, 0xb5, 0xdb, 0xc9, 0x4a, 0x66, 0x17, 0xba, 0x59, 0x97, 0x9d, 0xee, 0xfd, 0xcc, 0x32, - 0xa6, 0x33, 0xcb, 0x78, 0x99, 0x59, 0xc6, 0xf5, 0xdc, 0x2a, 0x4c, 0xe7, 0x56, 0xe1, 0x71, 0x6e, - 0x15, 0x8e, 0xd9, 0xca, 0x68, 0x72, 0x14, 0x07, 0xf5, 0x1e, 0x3a, 0x41, 0xe4, 0xc7, 0x9c, 0x9d, - 0x6b, 0xba, 0x9e, 0x53, 0xaf, 0xac, 0x7f, 0xc0, 0xfe, 0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5c, - 0x37, 0x55, 0x73, 0x63, 0x02, 0x00, 0x00, + // 338 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x4f, 0x4b, 0x02, 0x41, + 0x18, 0xc6, 0x1d, 0x43, 0xc1, 0x29, 0x3a, 0x0c, 0x12, 0xb6, 0xc8, 0x12, 0x0b, 0x91, 0x1d, 0xdc, + 0x49, 0xbb, 0x75, 0x8a, 0x6e, 0x1e, 0xdb, 0x43, 0x87, 0x6e, 0xeb, 0xf2, 0xba, 0xbb, 0xa0, 0xf3, + 0x8e, 0x33, 0xb3, 0x92, 0x44, 0x97, 0x3e, 0x41, 0xd4, 0xb5, 0x0f, 0xd4, 0x51, 0xe8, 0xd2, 0x31, + 0xb4, 0x0f, 0x12, 0xce, 0x6a, 0x9a, 0x18, 0x74, 0x9b, 0x77, 0x9e, 0x87, 0xdf, 0xf3, 0xfe, 0xa1, + 0x8e, 0x36, 0x2a, 0x34, 0xa8, 0xb9, 0x44, 0xc3, 0x47, 0x2d, 0x3e, 0xcc, 0x40, 0x8d, 0x7d, 0xa9, + 0xd0, 0x20, 0xdb, 0x5f, 0x68, 0xbe, 0x44, 0xe3, 0x8f, 0x5a, 0x4e, 0x35, 0xc6, 0x18, 0xad, 0xc4, + 0xe7, 0xaf, 0xdc, 0xe5, 0xd4, 0x63, 0xc4, 0xb8, 0x0f, 0x3c, 0x94, 0x29, 0x0f, 0x85, 0x40, 0x13, + 0x9a, 0x14, 0x85, 0xce, 0x55, 0xef, 0x8c, 0xd6, 0xae, 0xe7, 0xc8, 0x1b, 0xec, 0x67, 0x03, 0x08, + 0x40, 0xa2, 0x32, 0x01, 0x0c, 0x33, 0xd0, 0x86, 0x55, 0x69, 0x09, 0x24, 0x46, 0x49, 0x8d, 0x1c, + 0x91, 0x46, 0x25, 0xc8, 0x0b, 0xef, 0x92, 0xd2, 0xdc, 0xd6, 0x11, 0x3d, 0xdc, 0xee, 0x61, 0x75, + 0x5a, 0x51, 0xd0, 0x03, 0x05, 0x22, 0x82, 0x5a, 0xd1, 0x2a, 0xab, 0x0f, 0x0f, 0xe9, 0xe1, 0x96, + 0x4c, 0x2d, 0x51, 0x68, 0x60, 0x17, 0x94, 0xaa, 0x1f, 0xbc, 0xa5, 0xee, 0xb6, 0x1d, 0xff, 0xf7, + 0xa4, 0xfe, 0xaa, 0x81, 0x60, 0xcd, 0xcd, 0x0e, 0x68, 0x39, 0x81, 0x34, 0x4e, 0x8c, 0xcd, 0xdc, + 0x09, 0x16, 0x55, 0xfb, 0x95, 0xd0, 0x92, 0x4d, 0x64, 0xcf, 0x84, 0xee, 0xad, 0xc7, 0xb2, 0xc6, + 0x26, 0xfa, 0xaf, 0x6d, 0x38, 0xa7, 0xff, 0x70, 0xe6, 0x33, 0x78, 0xcd, 0xc7, 0xf7, 0xaf, 0x97, + 0xe2, 0x09, 0x3b, 0xe6, 0x1b, 0xd7, 0x1b, 0x59, 0x77, 0x33, 0x6f, 0x99, 0xdf, 0xdb, 0x65, 0x3d, + 0x5c, 0x75, 0xde, 0xa6, 0x2e, 0x99, 0x4c, 0x5d, 0xf2, 0x39, 0x75, 0xc9, 0xd3, 0xcc, 0x2d, 0x4c, + 0x66, 0x6e, 0xe1, 0x63, 0xe6, 0x16, 0x6e, 0x79, 0x9c, 0x9a, 0x24, 0xeb, 0xfa, 0x11, 0x0e, 0x96, + 0x28, 0x01, 0x66, 0xf9, 0x6c, 0x46, 0x49, 0x98, 0x0a, 0x7e, 0x67, 0xe9, 0x66, 0x2c, 0x41, 0x77, + 0xcb, 0xf6, 0xaa, 0xe7, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xb6, 0x78, 0x66, 0x37, 0x02, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -318,15 +317,10 @@ func (m *QueryVolumeReportRequest) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.Epoch != nil { - { - size := m.Epoch.Size() - i -= size - if _, err := m.Epoch.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if len(m.Epoch) > 0 { + i -= len(m.Epoch) + copy(dAtA[i:], m.Epoch) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Epoch))) i-- dAtA[i] = 0xa } @@ -427,8 +421,8 @@ func (m *QueryVolumeReportRequest) Size() (n int) { } var l int _ = l - if m.Epoch != nil { - l = m.Epoch.Size() + l = len(m.Epoch) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n @@ -532,11 +526,7 @@ func (m *QueryVolumeReportRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Int - m.Epoch = &v - if err := m.Epoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Epoch = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/register/app_test.go b/x/register/app_test.go index 20610499..1e32b2ff 100644 --- a/x/register/app_test.go +++ b/x/register/app_test.go @@ -1,234 +1,235 @@ package register -import ( - "os" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/mock" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/supply" - supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" - "github.com/stratosnet/stratos-chain/helpers" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" -) - -func TestMain(m *testing.M) { - config := stratos.GetConfig() - config.Seal() - exitVal := m.Run() - os.Exit(exitVal) -} - -func Test(t *testing.T) { - - /********************* initialize mock app *********************/ - //mApp, k, accountKeeper, bankKeeper, stakingKeeper, registerKeeper := getMockApp(t) - mApp, k, _, _ := getMockApp(t) - accounts := setupAccounts(mApp) - mock.SetGenesis(mApp, accounts) - - header := abci.Header{} - ctx := mApp.BaseApp.NewContext(true, header) - - //2 bonded resource node, 1 bonded indexing node, 1 unBonded indexing node initialized by genesis - resBondedToken := k.GetResourceNodeBondedToken(ctx) - require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake))) - resNotBondedToken := k.GetResourceNodeNotBondedToken(ctx) - require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) - idxBondedToken := k.GetIndexingNodeBondedToken(ctx) - require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) - idxNotBondedToken := k.GetIndexingNodeNotBondedToken(ctx) - require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) - - /********************* send register resource node msg *********************/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - registerResNodeMsg := types.NewMsgCreateResourceNode(resNodeNetworkId2, resNodePubKey2, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake), resOwnerAddr2, NewDescription("sds://resourceNode2", "", "", "", ""), 4) - resNodeOwnerAcc2 := mApp.AccountKeeper.GetAccount(ctx, resOwnerAddr2) - accNumOwner := resNodeOwnerAcc2.GetAccountNumber() - accSeqOwner := resNodeOwnerAcc2.GetSequence() - - resNodeAcc2 := mApp.AccountKeeper.GetAccount(ctx, resNodeAddr2) - accNumNode := resNodeAcc2.GetAccountNumber() - accSeqNode := resNodeAcc2.GetSequence() - - mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{registerResNodeMsg}, []uint64{accNumOwner, accNumNode}, []uint64{accSeqOwner, accSeqNode}, true, true, resOwnerPrivKey2) - - /*-------------------- commit & check result --------------------*/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - resBondedToken = k.GetResourceNodeBondedToken(ctx) - require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake).Add(resNodeInitStake))) - resNotBondedToken = k.GetResourceNodeNotBondedToken(ctx) - require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) - idxBondedToken = k.GetIndexingNodeBondedToken(ctx) - require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) - idxNotBondedToken = k.GetIndexingNodeNotBondedToken(ctx) - require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) - - /********************* send register indexing node msg *********************/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - registerIdxNodeMsg := types.NewMsgCreateIndexingNode(idxNodeNetworkId3, idxNodePubKey3, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake), idxOwnerAddr3, NewDescription("sds://indexingNode3", "", "", "", "")) - idxOwnerAcc3 := mApp.AccountKeeper.GetAccount(ctx, idxOwnerAddr3) - accNumOwner = idxOwnerAcc3.GetAccountNumber() - accSeqOwner = idxOwnerAcc3.GetSequence() - - idxNodeAcc3 := mApp.AccountKeeper.GetAccount(ctx, idxNodeAddr3) - accNumNode = idxNodeAcc3.GetAccountNumber() - accSeqNode = idxNodeAcc3.GetSequence() - - mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{registerIdxNodeMsg}, []uint64{accNumOwner, accNumNode}, []uint64{accSeqOwner, accSeqNode}, true, true, idxOwnerPrivKey3) - - /*-------------------- commit & check result, stake should be stored in the not bonded pool --------------------*/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - resBondedToken = k.GetResourceNodeBondedToken(ctx) - require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake).Add(resNodeInitStake))) - resNotBondedToken = k.GetResourceNodeNotBondedToken(ctx) - require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) - idxBondedToken = k.GetIndexingNodeBondedToken(ctx) - require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) - idxNotBondedToken = k.GetIndexingNodeNotBondedToken(ctx) - require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake.Add(idxNodeInitStake))) - - /********************* deliver tx to vote *********************/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - voteMsg := types.NewMsgIndexingNodeRegistrationVote(idxNodeNetworkId3, idxOwnerAddr3, types.Approve, idxNodeNetworkId1, idxOwnerAddr1) - idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwnerAddr1) - accNumOwner = idxOwnerAcc1.GetAccountNumber() - accSeqOwner = idxOwnerAcc1.GetSequence() - - mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{voteMsg}, []uint64{accNumOwner}, []uint64{accSeqOwner}, true, true, idxOwnerPrivKey1) - - /*-------------------- commit & check result, stake should be transferred to the bonded pool --------------------*/ - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - resBondedToken = k.GetResourceNodeBondedToken(ctx) - require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake).Add(resNodeInitStake))) - resNotBondedToken = k.GetResourceNodeNotBondedToken(ctx) - require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) - idxBondedToken = k.GetIndexingNodeBondedToken(ctx) - require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake.Add(idxNodeInitStake))) - idxNotBondedToken = k.GetIndexingNodeNotBondedToken(ctx) - require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) - -} - -func getMockApp(t *testing.T) (*mock.App, Keeper, bank.Keeper, supply.Keeper) { - mApp := mock.NewApp() - - RegisterCodec(mApp.Cdc) - bank.RegisterCodec(mApp.Cdc) - supply.RegisterCodec(mApp.Cdc) - staking.RegisterCodec(mApp.Cdc) - - keySupply := sdk.NewKVStoreKey(supply.StoreKey) - keyStaking := sdk.NewKVStoreKey(staking.StoreKey) - keyRegister := sdk.NewKVStoreKey(StoreKey) - - feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) - notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) - bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) - - blacklistedAddrs := make(map[string]bool) - blacklistedAddrs[feeCollector.GetAddress().String()] = true - blacklistedAddrs[notBondedPool.GetAddress().String()] = true - blacklistedAddrs[bondPool.GetAddress().String()] = true - - bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) - maccPerms := map[string][]string{ - auth.FeeCollectorName: {"fee_collector"}, - staking.NotBondedPoolName: {supply.Burner, supply.Staking}, - staking.BondedPoolName: {supply.Burner, supply.Staking}, - } - supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) - stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) - keeper := NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(DefaultParamSpace), mApp.AccountKeeper, bankKeeper) - - anteHandler := ante.NewAnteHandler(mApp.AccountKeeper, supplyKeeper, helpers.StSigVerificationGasConsumer) - mApp.SetAnteHandler(anteHandler) - - mApp.Router().AddRoute(bank.RouterKey, bank.NewHandler(bankKeeper)) - mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) - mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) - mApp.SetEndBlocker(getEndBlocker(keeper)) - mApp.SetInitChainer(getInitChainer(mApp, keeper, mApp.AccountKeeper, supplyKeeper, - []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, bankKeeper)) - - err := mApp.CompleteSetup(keyStaking, keySupply, keyRegister) - require.NoError(t, err) - - return mApp, keeper, bankKeeper, supplyKeeper -} - -// getInitChainer initializes the chainer of the mock app and sets the genesis -// state. It returns an empty ResponseInitChain. -func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, - blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, bankKeeper bank.Keeper) sdk.InitChainer { - return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - mapp.InitChainer(ctx, req) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, "ustos"), nil, nil) - totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) - supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) - - // set module accounts - for _, macc := range blacklistedAddrs { - supplyKeeper.SetModuleAccount(ctx, macc) - } - validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) - bankGenesis := bank.NewGenesisState(true) - bank.InitGenesis(ctx, bankKeeper, bankGenesis) - - resourceNodes := setupAllResourceNodes() - indexingNodes := setupAllIndexingNodes() - - registerGenesis := NewGenesisState( - DefaultParams(), - resourceNodes, - indexingNodes, - initialUOzonePrice, - sdk.ZeroInt(), - make([]Slashing, 0), - ) - - InitGenesis(ctx, keeper, registerGenesis) - - return abci.ResponseInitChain{ - Validators: validators, - } - } - -} - -// getEndBlocker returns a staking endblocker. -func getEndBlocker(keeper Keeper) sdk.EndBlocker { - //return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - // validatorUpdates := keeper.StakingKeeper.BlockValidatorUpdates(ctx) - // - // return abci.ResponseEndBlock{ - // ValidatorUpdates: validatorUpdates, - // } - //} - return nil -} +// +//import ( +// "os" +// "testing" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// "github.com/cosmos/cosmos-sdk/x/auth/ante" +// "github.com/cosmos/cosmos-sdk/x/bank" +// "github.com/cosmos/cosmos-sdk/x/mock" +// "github.com/cosmos/cosmos-sdk/x/staking" +// "github.com/cosmos/cosmos-sdk/x/supply" +// supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" +// "github.com/stratosnet/stratos-chain/helpers" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/register/types" +// "github.com/stretchr/testify/require" +// abci "github.com/tendermint/tendermint/abci/types" +//) +// +//func TestMain(m *testing.M) { +// config := stratos.GetConfig() +// config.Seal() +// exitVal := m.Run() +// os.Exit(exitVal) +//} +// +//func Test(t *testing.T) { +// +// /********************* initialize mock app *********************/ +// //mApp, k, accountKeeper, bankKeeper, stakingKeeper, registerKeeper := getMockApp(t) +// mApp, k, _, _ := getMockApp(t) +// accounts := setupAccounts(mApp) +// mock.SetGenesis(mApp, accounts) +// +// header := abci.Header{} +// ctx := mApp.BaseApp.NewContext(true, header) +// +// //2 bonded resource node, 1 bonded indexing node, 1 unBonded indexing node initialized by genesis +// resBondedToken := k.GetResourceNodeBondedToken(ctx) +// require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake))) +// resNotBondedToken := k.GetResourceNodeNotBondedToken(ctx) +// require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) +// idxBondedToken := k.GetIndexingNodeBondedToken(ctx) +// require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) +// idxNotBondedToken := k.GetIndexingNodeNotBondedToken(ctx) +// require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) +// +// /********************* send register resource node msg *********************/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// registerResNodeMsg := types.NewMsgCreateResourceNode(resNodeNetworkId2, resNodePubKey2, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake), resOwnerAddr2, NewDescription("sds://resourceNode2", "", "", "", ""), 4) +// resNodeOwnerAcc2 := mApp.AccountKeeper.GetAccount(ctx, resOwnerAddr2) +// accNumOwner := resNodeOwnerAcc2.GetAccountNumber() +// accSeqOwner := resNodeOwnerAcc2.GetSequence() +// +// resNodeAcc2 := mApp.AccountKeeper.GetAccount(ctx, resNodeAddr2) +// accNumNode := resNodeAcc2.GetAccountNumber() +// accSeqNode := resNodeAcc2.GetSequence() +// +// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{registerResNodeMsg}, []uint64{accNumOwner, accNumNode}, []uint64{accSeqOwner, accSeqNode}, true, true, resOwnerPrivKey2) +// +// /*-------------------- commit & check result --------------------*/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// resBondedToken = k.GetResourceNodeBondedToken(ctx) +// require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake).Add(resNodeInitStake))) +// resNotBondedToken = k.GetResourceNodeNotBondedToken(ctx) +// require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) +// idxBondedToken = k.GetIndexingNodeBondedToken(ctx) +// require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) +// idxNotBondedToken = k.GetIndexingNodeNotBondedToken(ctx) +// require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) +// +// /********************* send register indexing node msg *********************/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// registerIdxNodeMsg := types.NewMsgCreateIndexingNode(idxNodeNetworkId3, idxNodePubKey3, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake), idxOwnerAddr3, NewDescription("sds://indexingNode3", "", "", "", "")) +// idxOwnerAcc3 := mApp.AccountKeeper.GetAccount(ctx, idxOwnerAddr3) +// accNumOwner = idxOwnerAcc3.GetAccountNumber() +// accSeqOwner = idxOwnerAcc3.GetSequence() +// +// idxNodeAcc3 := mApp.AccountKeeper.GetAccount(ctx, idxNodeAddr3) +// accNumNode = idxNodeAcc3.GetAccountNumber() +// accSeqNode = idxNodeAcc3.GetSequence() +// +// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{registerIdxNodeMsg}, []uint64{accNumOwner, accNumNode}, []uint64{accSeqOwner, accSeqNode}, true, true, idxOwnerPrivKey3) +// +// /*-------------------- commit & check result, stake should be stored in the not bonded pool --------------------*/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// resBondedToken = k.GetResourceNodeBondedToken(ctx) +// require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake).Add(resNodeInitStake))) +// resNotBondedToken = k.GetResourceNodeNotBondedToken(ctx) +// require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) +// idxBondedToken = k.GetIndexingNodeBondedToken(ctx) +// require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) +// idxNotBondedToken = k.GetIndexingNodeNotBondedToken(ctx) +// require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake.Add(idxNodeInitStake))) +// +// /********************* deliver tx to vote *********************/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// voteMsg := types.NewMsgIndexingNodeRegistrationVote(idxNodeNetworkId3, idxOwnerAddr3, types.Approve, idxNodeNetworkId1, idxOwnerAddr1) +// idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwnerAddr1) +// accNumOwner = idxOwnerAcc1.GetAccountNumber() +// accSeqOwner = idxOwnerAcc1.GetSequence() +// +// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{voteMsg}, []uint64{accNumOwner}, []uint64{accSeqOwner}, true, true, idxOwnerPrivKey1) +// +// /*-------------------- commit & check result, stake should be transferred to the bonded pool --------------------*/ +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// resBondedToken = k.GetResourceNodeBondedToken(ctx) +// require.EqualValues(t, resBondedToken, sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake.Add(resNodeInitStake).Add(resNodeInitStake))) +// resNotBondedToken = k.GetResourceNodeNotBondedToken(ctx) +// require.EqualValues(t, resNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt())) +// idxBondedToken = k.GetIndexingNodeBondedToken(ctx) +// require.EqualValues(t, idxBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake.Add(idxNodeInitStake))) +// idxNotBondedToken = k.GetIndexingNodeNotBondedToken(ctx) +// require.EqualValues(t, idxNotBondedToken, sdk.NewCoin(k.BondDenom(ctx), idxNodeInitStake)) +// +//} +// +//func getMockApp(t *testing.T) (*mock.App, Keeper, bank.Keeper, supply.Keeper) { +// mApp := mock.NewApp() +// +// RegisterCodec(mApp.Cdc) +// bank.RegisterCodec(mApp.Cdc) +// supply.RegisterCodec(mApp.Cdc) +// staking.RegisterCodec(mApp.Cdc) +// +// keySupply := sdk.NewKVStoreKey(supply.StoreKey) +// keyStaking := sdk.NewKVStoreKey(staking.StoreKey) +// keyRegister := sdk.NewKVStoreKey(StoreKey) +// +// feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) +// notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) +// bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) +// +// blacklistedAddrs := make(map[string]bool) +// blacklistedAddrs[feeCollector.GetAddress().String()] = true +// blacklistedAddrs[notBondedPool.GetAddress().String()] = true +// blacklistedAddrs[bondPool.GetAddress().String()] = true +// +// bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) +// maccPerms := map[string][]string{ +// auth.FeeCollectorName: {"fee_collector"}, +// staking.NotBondedPoolName: {supply.Burner, supply.Staking}, +// staking.BondedPoolName: {supply.Burner, supply.Staking}, +// } +// supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) +// stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) +// keeper := NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(DefaultParamSpace), mApp.AccountKeeper, bankKeeper) +// +// anteHandler := ante.NewAnteHandler(mApp.AccountKeeper, supplyKeeper, helpers.StSigVerificationGasConsumer) +// mApp.SetAnteHandler(anteHandler) +// +// mApp.Router().AddRoute(bank.RouterKey, bank.NewHandler(bankKeeper)) +// mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) +// mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) +// mApp.SetEndBlocker(getEndBlocker(keeper)) +// mApp.SetInitChainer(getInitChainer(mApp, keeper, mApp.AccountKeeper, supplyKeeper, +// []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, bankKeeper)) +// +// err := mApp.CompleteSetup(keyStaking, keySupply, keyRegister) +// require.NoError(t, err) +// +// return mApp, keeper, bankKeeper, supplyKeeper +//} +// +//// getInitChainer initializes the chainer of the mock app and sets the genesis +//// state. It returns an empty ResponseInitChain. +//func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, +// blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, bankKeeper bank.Keeper) sdk.InitChainer { +// return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// mapp.InitChainer(ctx, req) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, "ustos"), nil, nil) +// totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) +// supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) +// +// // set module accounts +// for _, macc := range blacklistedAddrs { +// supplyKeeper.SetModuleAccount(ctx, macc) +// } +// validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) +// bankGenesis := bank.NewGenesisState(true) +// bank.InitGenesis(ctx, bankKeeper, bankGenesis) +// +// resourceNodes := setupAllResourceNodes() +// indexingNodes := setupAllIndexingNodes() +// +// registerGenesis := NewGenesisState( +// DefaultParams(), +// resourceNodes, +// indexingNodes, +// initialUOzonePrice, +// sdk.ZeroInt(), +// make([]Slashing, 0), +// ) +// +// InitGenesis(ctx, keeper, registerGenesis) +// +// return abci.ResponseInitChain{ +// Validators: validators, +// } +// } +// +//} +// +//// getEndBlocker returns a staking endblocker. +//func getEndBlocker(keeper Keeper) sdk.EndBlocker { +// //return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { +// // validatorUpdates := keeper.StakingKeeper.BlockValidatorUpdates(ctx) +// // +// // return abci.ResponseEndBlock{ +// // ValidatorUpdates: validatorUpdates, +// // } +// //} +// return nil +//} diff --git a/x/register/keeper/resource_node_test.go b/x/register/keeper/resource_node_test.go index 849a6d09..0a379a46 100644 --- a/x/register/keeper/resource_node_test.go +++ b/x/register/keeper/resource_node_test.go @@ -1,56 +1,57 @@ package keeper -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto/ed25519" - "log" - "testing" -) - -var ( - ppNodeOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - ppNodeOwnerNew = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - - ppNodePubKey1 = ed25519.GenPrivKey().PubKey() - ppNodeAddr1 = sdk.AccAddress(ppNodePubKey1.Address()) - ppInitialStake1 = sdk.NewInt(100000000) - - ppNodePubKey2 = ed25519.GenPrivKey().PubKey() - ppNodeAddr2 = sdk.AccAddress(ppNodePubKey2.Address()) - ppInitialStake2 = sdk.NewInt(100000000) - - ppNodePubKey3 = ed25519.GenPrivKey().PubKey() - ppNodeAddr3 = sdk.AccAddress(ppNodePubKey3.Address()) - ppInitialStake3 = sdk.NewInt(100000000) - - ppNodePubKey4 = ed25519.GenPrivKey().PubKey() - ppNodeAddr4 = sdk.AccAddress(ppNodePubKey4.Address()) - ppInitialStake4 = sdk.NewInt(100000000) - - ppNodePubKeyNew = ed25519.GenPrivKey().PubKey() - ppNodeAddrNew = sdk.AccAddress(ppNodePubKeyNew.Address()) - ppNodeStakeNew = sdk.NewInt(100000000) -) - -func TestOzoneLimitChange(t *testing.T) { - ctx, _, _, k, _ := CreateTestInput(t, false) - - initialStakeTotal := sdk.NewInt(43000) - k.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) - k.SetRemainingOzoneLimit(ctx, initialStakeTotal) - - resouceNodeTokens := make([]sdk.Int, 0) - numSeq := 100 - resourceNodeStake := sdk.NewInt(19000) - for i := 0; i < numSeq; i++ { - resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) - } - log.Printf("Before: remaining ozone limit is %v", k.GetRemainingOzoneLimit(ctx)) - for i, val := range resouceNodeTokens { - ozoneLimitChange := k.increaseOzoneLimitByAddStake(ctx, val) - log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, k.GetRemainingOzoneLimit(ctx)) - } -} +// +//import ( +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/tendermint/tendermint/crypto/ed25519" +// "log" +// "testing" +//) +// +//var ( +// ppNodeOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// ppNodeOwnerNew = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// +// ppNodePubKey1 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr1 = sdk.AccAddress(ppNodePubKey1.Address()) +// ppInitialStake1 = sdk.NewInt(100000000) +// +// ppNodePubKey2 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr2 = sdk.AccAddress(ppNodePubKey2.Address()) +// ppInitialStake2 = sdk.NewInt(100000000) +// +// ppNodePubKey3 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr3 = sdk.AccAddress(ppNodePubKey3.Address()) +// ppInitialStake3 = sdk.NewInt(100000000) +// +// ppNodePubKey4 = ed25519.GenPrivKey().PubKey() +// ppNodeAddr4 = sdk.AccAddress(ppNodePubKey4.Address()) +// ppInitialStake4 = sdk.NewInt(100000000) +// +// ppNodePubKeyNew = ed25519.GenPrivKey().PubKey() +// ppNodeAddrNew = sdk.AccAddress(ppNodePubKeyNew.Address()) +// ppNodeStakeNew = sdk.NewInt(100000000) +//) +// +//func TestOzoneLimitChange(t *testing.T) { +// ctx, _, _, k, _ := CreateTestInput(t, false) +// +// initialStakeTotal := sdk.NewInt(43000) +// k.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) +// k.SetRemainingOzoneLimit(ctx, initialStakeTotal) +// +// resouceNodeTokens := make([]sdk.Int, 0) +// numSeq := 100 +// resourceNodeStake := sdk.NewInt(19000) +// for i := 0; i < numSeq; i++ { +// resouceNodeTokens = append(resouceNodeTokens, resourceNodeStake) +// } +// log.Printf("Before: remaining ozone limit is %v", k.GetRemainingOzoneLimit(ctx)) +// for i, val := range resouceNodeTokens { +// ozoneLimitChange := k.increaseOzoneLimitByAddStake(ctx, val) +// log.Printf("Add resourceNode #%v(stake=%v), ozone limit increases by %v, remaining ozone limit is %v", i, resourceNodeStake, ozoneLimitChange, k.GetRemainingOzoneLimit(ctx)) +// } +//} diff --git a/x/register/register_test.go b/x/register/register_test.go index c0d3bd2e..4e0adbdf 100644 --- a/x/register/register_test.go +++ b/x/register/register_test.go @@ -1,156 +1,157 @@ package register -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" - "github.com/cosmos/cosmos-sdk/x/mock" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/secp256k1" -) - -var ( - resOwnerPrivKey1 = secp256k1.GenPrivKey() - resOwnerPrivKey2 = secp256k1.GenPrivKey() - //resOwnerPrivKey3 = ed25519.GenPrivKey() - resOwnerPrivKey3 = secp256k1.GenPrivKey() - idxOwnerPrivKey1 = secp256k1.GenPrivKey() - idxOwnerPrivKey2 = secp256k1.GenPrivKey() - idxOwnerPrivKey3 = secp256k1.GenPrivKey() - - resOwnerAddr1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) - resOwnerAddr2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) - resOwnerAddr3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) - idxOwnerAddr1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) - idxOwnerAddr2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) - idxOwnerAddr3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) - - resOwnerInitBalance = sdk.NewInt(1000000000000) - idxOwnerInitBalance = sdk.NewInt(1000000000000) - - resNodePrivKey1 = secp256k1.GenPrivKey() - resNodePrivKey2 = secp256k1.GenPrivKey() - resNodePrivKey3 = ed25519.GenPrivKey() - //resNodePrivKey3 = secp256k1.GenPrivKey() - idxNodePrivKey1 = secp256k1.GenPrivKey() - idxNodePrivKey2 = secp256k1.GenPrivKey() - idxNodePrivKey3 = secp256k1.GenPrivKey() - - resNodePubKey1 = resNodePrivKey1.PubKey() - resNodePubKey2 = resNodePrivKey2.PubKey() - resNodePubKey3 = resNodePrivKey3.PubKey() - idxNodePubKey1 = idxNodePrivKey1.PubKey() - idxNodePubKey2 = idxNodePrivKey2.PubKey() - idxNodePubKey3 = idxNodePrivKey3.PubKey() - - resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) - resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) - resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) - idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) - idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) - idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) - - resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) - resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) - resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) - idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) - idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) - idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) - - resNodeInitStake = sdk.NewInt(10000000000) - idxNodeInitStake = sdk.NewInt(10000000000) - initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz -) - -func setupAllResourceNodes() []ResourceNode { - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - resourceNode1 := NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwnerAddr1, NewDescription("sds://resourceNode1", "", "", "", ""), 4, time) - resourceNode1 = resourceNode1.AddToken(resNodeInitStake) - resourceNode1.Status = sdk.Bonded - - resourceNode3 := NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwnerAddr3, NewDescription("sds://resourceNode3", "", "", "", ""), 4, time) - resourceNode3 = resourceNode3.AddToken(resNodeInitStake) - resourceNode3.Status = sdk.Bonded - - var resourceNodes []ResourceNode - resourceNodes = append(resourceNodes, resourceNode1, resourceNode3) - return resourceNodes -} - -func setupAllIndexingNodes() []IndexingNode { - var indexingNodes []IndexingNode - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - indexingNode1 := NewIndexingNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwnerAddr1, NewDescription("sds://indexingNode1", "", "", "", ""), time) - indexingNode2 := NewIndexingNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwnerAddr2, NewDescription("sds://indexingNode2", "", "", "", ""), time) - - indexingNode1 = indexingNode1.AddToken(idxNodeInitStake) - indexingNode2 = indexingNode2.AddToken(idxNodeInitStake) - - indexingNode1.Status = sdk.Bonded - indexingNode2.Status = sdk.Unbonded - - indexingNodes = append(indexingNodes, indexingNode1) - indexingNodes = append(indexingNodes, indexingNode2) - - return indexingNodes - -} - -func setupAccounts(mApp *mock.App) []authexported.Account { - //************************** setup resource nodes owners' accounts ************************** - resOwnerAcc1 := &auth.BaseAccount{ - Address: resOwnerAddr1, - Coins: sdk.Coins{sdk.NewCoin("ustos", resOwnerInitBalance)}, - } - resOwnerAcc2 := &auth.BaseAccount{ - Address: resOwnerAddr2, - Coins: sdk.Coins{sdk.NewCoin("ustos", resOwnerInitBalance)}, - } - - resOwnerAcc3 := &auth.BaseAccount{ - Address: resOwnerAddr3, - Coins: sdk.Coins{sdk.NewCoin("ustos", resOwnerInitBalance)}, - } - - idxOwnerAcc1 := &auth.BaseAccount{ - Address: idxOwnerAddr1, - Coins: sdk.Coins{sdk.NewCoin("ustos", idxOwnerInitBalance)}, - } - idxOwnerAcc2 := &auth.BaseAccount{ - Address: idxOwnerAddr2, - Coins: sdk.Coins{sdk.NewCoin("ustos", idxOwnerInitBalance)}, - } - idxOwnerAcc3 := &auth.BaseAccount{ - Address: idxOwnerAddr3, - Coins: sdk.Coins{sdk.NewCoin("ustos", idxOwnerInitBalance)}, - } - - resNodeAcc2 := &auth.BaseAccount{ - Address: resNodeAddr2, - Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, - } - - resNodeAcc3 := &auth.BaseAccount{ - Address: resNodeAddr3, - Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, - } - - idxNodeAcc1 := &auth.BaseAccount{ - Address: idxNodeAddr1, - Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, - } - - idxNodeAcc3 := &auth.BaseAccount{ - Address: idxNodeAddr3, - Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, - } - - accs := []authexported.Account{ - resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, resNodeAcc2, resNodeAcc3, idxNodeAcc1, idxNodeAcc3, - } - - return accs -} +// +//import ( +// "time" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" +// "github.com/cosmos/cosmos-sdk/x/mock" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/tendermint/tendermint/crypto/ed25519" +// "github.com/tendermint/tendermint/crypto/secp256k1" +//) +// +//var ( +// resOwnerPrivKey1 = secp256k1.GenPrivKey() +// resOwnerPrivKey2 = secp256k1.GenPrivKey() +// //resOwnerPrivKey3 = ed25519.GenPrivKey() +// resOwnerPrivKey3 = secp256k1.GenPrivKey() +// idxOwnerPrivKey1 = secp256k1.GenPrivKey() +// idxOwnerPrivKey2 = secp256k1.GenPrivKey() +// idxOwnerPrivKey3 = secp256k1.GenPrivKey() +// +// resOwnerAddr1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) +// resOwnerAddr2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) +// resOwnerAddr3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) +// idxOwnerAddr1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) +// idxOwnerAddr2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) +// idxOwnerAddr3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) +// +// resOwnerInitBalance = sdk.NewInt(1000000000000) +// idxOwnerInitBalance = sdk.NewInt(1000000000000) +// +// resNodePrivKey1 = secp256k1.GenPrivKey() +// resNodePrivKey2 = secp256k1.GenPrivKey() +// resNodePrivKey3 = ed25519.GenPrivKey() +// //resNodePrivKey3 = secp256k1.GenPrivKey() +// idxNodePrivKey1 = secp256k1.GenPrivKey() +// idxNodePrivKey2 = secp256k1.GenPrivKey() +// idxNodePrivKey3 = secp256k1.GenPrivKey() +// +// resNodePubKey1 = resNodePrivKey1.PubKey() +// resNodePubKey2 = resNodePrivKey2.PubKey() +// resNodePubKey3 = resNodePrivKey3.PubKey() +// idxNodePubKey1 = idxNodePrivKey1.PubKey() +// idxNodePubKey2 = idxNodePrivKey2.PubKey() +// idxNodePubKey3 = idxNodePrivKey3.PubKey() +// +// resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) +// resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) +// resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) +// idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) +// idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) +// idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) +// +// resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) +// resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) +// resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) +// idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) +// idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) +// idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) +// +// resNodeInitStake = sdk.NewInt(10000000000) +// idxNodeInitStake = sdk.NewInt(10000000000) +// initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz +//) +// +//func setupAllResourceNodes() []ResourceNode { +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// resourceNode1 := NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwnerAddr1, NewDescription("sds://resourceNode1", "", "", "", ""), 4, time) +// resourceNode1 = resourceNode1.AddToken(resNodeInitStake) +// resourceNode1.Status = sdk.Bonded +// +// resourceNode3 := NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwnerAddr3, NewDescription("sds://resourceNode3", "", "", "", ""), 4, time) +// resourceNode3 = resourceNode3.AddToken(resNodeInitStake) +// resourceNode3.Status = sdk.Bonded +// +// var resourceNodes []ResourceNode +// resourceNodes = append(resourceNodes, resourceNode1, resourceNode3) +// return resourceNodes +//} +// +//func setupAllIndexingNodes() []IndexingNode { +// var indexingNodes []IndexingNode +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// indexingNode1 := NewIndexingNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwnerAddr1, NewDescription("sds://indexingNode1", "", "", "", ""), time) +// indexingNode2 := NewIndexingNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwnerAddr2, NewDescription("sds://indexingNode2", "", "", "", ""), time) +// +// indexingNode1 = indexingNode1.AddToken(idxNodeInitStake) +// indexingNode2 = indexingNode2.AddToken(idxNodeInitStake) +// +// indexingNode1.Status = sdk.Bonded +// indexingNode2.Status = sdk.Unbonded +// +// indexingNodes = append(indexingNodes, indexingNode1) +// indexingNodes = append(indexingNodes, indexingNode2) +// +// return indexingNodes +// +//} +// +//func setupAccounts(mApp *mock.App) []authexported.Account { +// //************************** setup resource nodes owners' accounts ************************** +// resOwnerAcc1 := &auth.BaseAccount{ +// Address: resOwnerAddr1, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resOwnerInitBalance)}, +// } +// resOwnerAcc2 := &auth.BaseAccount{ +// Address: resOwnerAddr2, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resOwnerInitBalance)}, +// } +// +// resOwnerAcc3 := &auth.BaseAccount{ +// Address: resOwnerAddr3, +// Coins: sdk.Coins{sdk.NewCoin("ustos", resOwnerInitBalance)}, +// } +// +// idxOwnerAcc1 := &auth.BaseAccount{ +// Address: idxOwnerAddr1, +// Coins: sdk.Coins{sdk.NewCoin("ustos", idxOwnerInitBalance)}, +// } +// idxOwnerAcc2 := &auth.BaseAccount{ +// Address: idxOwnerAddr2, +// Coins: sdk.Coins{sdk.NewCoin("ustos", idxOwnerInitBalance)}, +// } +// idxOwnerAcc3 := &auth.BaseAccount{ +// Address: idxOwnerAddr3, +// Coins: sdk.Coins{sdk.NewCoin("ustos", idxOwnerInitBalance)}, +// } +// +// resNodeAcc2 := &auth.BaseAccount{ +// Address: resNodeAddr2, +// Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, +// } +// +// resNodeAcc3 := &auth.BaseAccount{ +// Address: resNodeAddr3, +// Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, +// } +// +// idxNodeAcc1 := &auth.BaseAccount{ +// Address: idxNodeAddr1, +// Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, +// } +// +// idxNodeAcc3 := &auth.BaseAccount{ +// Address: idxNodeAddr3, +// Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, +// } +// +// accs := []authexported.Account{ +// resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, resNodeAcc2, resNodeAcc3, idxNodeAcc1, idxNodeAcc3, +// } +// +// return accs +//} diff --git a/x/sds/client/common/common.go b/x/sds/client/common/common.go index 083e724d..2967209d 100644 --- a/x/sds/client/common/common.go +++ b/x/sds/client/common/common.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" - sds "github.com/stratosnet/stratos-chain/x/sds/types" + sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) // QueryUploadedFile queries the hash of an uploaded file by sender @@ -34,18 +34,18 @@ func QuerySimulatePrepay(clientCtx client.Context, queryRoute string, amtToPrepa if err != nil { return nil, 0, fmt.Errorf("invalid amount, please specify a valid amount to simulate prepay %w", err) } - route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QuerySimulatePrepay) + route := fmt.Sprintf("custom/%s/%s", queryRoute, sdstypes.QuerySimulatePrepay) return clientCtx.QueryWithData(route, amtByteArray) } // QueryCurrUozPrice queries the current price for uoz func QueryCurrUozPrice(clientCtx client.Context, queryRoute string) ([]byte, int64, error) { - route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryCurrUozPrice) + route := fmt.Sprintf("custom/%s/%s", queryRoute, sdstypes.QueryCurrUozPrice) return clientCtx.QueryWithData(route, nil) } // QueryUozSupply QueryCurrUozPrice queries the current price for uoz func QueryUozSupply(clientCtx client.Context, queryRoute string) ([]byte, int64, error) { - route := fmt.Sprintf("custom/%s/%s", queryRoute, sds.QueryUozSupply) + route := fmt.Sprintf("custom/%s/%s", queryRoute, sdstypes.QueryUozSupply) return clientCtx.QueryWithData(route, nil) } diff --git a/x/sds/module.go b/x/sds/module.go index 289952b7..74aca40c 100644 --- a/x/sds/module.go +++ b/x/sds/module.go @@ -5,6 +5,7 @@ import ( "encoding/json" "github.com/cosmos/cosmos-sdk/client" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -43,11 +44,6 @@ func (AppModuleBasic) Name() string { return types.ModuleName } -//// RegisterCodec registers the sds module's types for the given codec. -//func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { -// types.RegisterCodec(cdc) -//} - // RegisterLegacyAminoCodec registers the sds module's types on the given LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) @@ -197,3 +193,8 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { m := keeper.NewMigrator(am.keeper) _ = cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) } + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} From f31b687bc7bc181881cef5dc1e856268fdc2bf12 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 17 May 2022 18:34:58 -0400 Subject: [PATCH 058/113] modified sds/query.proto --- app/app.go | 55 ++++++++++++------------ proto/stratos/sds/v1/query.proto | 2 +- x/sds/module.go | 26 +++--------- x/sds/types/query.pb.go | 73 ++++++++++++++++---------------- 4 files changed, 71 insertions(+), 85 deletions(-) diff --git a/app/app.go b/app/app.go index 391bef9e..08069af9 100644 --- a/app/app.go +++ b/app/app.go @@ -12,9 +12,7 @@ import ( "github.com/stratosnet/stratos-chain/x/pot" "github.com/stratosnet/stratos-chain/x/register" "github.com/stratosnet/stratos-chain/x/sds" - sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" - //"github.com/stratosnet/stratos-chain/x/sds" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" tmos "github.com/tendermint/tendermint/libs/os" @@ -107,6 +105,8 @@ import ( pottypes "github.com/stratosnet/stratos-chain/x/pot/types" registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" registertypes "github.com/stratosnet/stratos-chain/x/register/types" + sdskeeper "github.com/stratosnet/stratos-chain/x/sds/keeper" + sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) const ( @@ -156,12 +156,17 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, //pot.FoundationAccount: nil, - registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - registertypes.ResourceNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.TotalUnissuedPrepayName: nil, + registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + //upgrading module accounts + //registertypes.ResourceNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, + //registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, + //registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, + //registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, + //registertypes.TotalUnissuedPrepayName: nil, + + pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, + pottypes.MiningRewardPool: nil, + pottypes.TrafficRewardPool: nil, sdstypes.ModuleName: nil, evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account @@ -169,9 +174,7 @@ var ( //pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account //pottypes.MiningRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account //pottypes.TrafficRewardPool: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account - pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, - pottypes.MiningRewardPool: nil, - pottypes.TrafficRewardPool: nil, + } // module accounts that are allowed to receive tokens @@ -221,8 +224,8 @@ type NewApp struct { // stratos keepers registerKeeper registerkeeper.Keeper potKeeper potkeeper.Keeper - //sdsKeeper sdskeeper.Keeper - evmKeeper *evmkeeper.Keeper + sdsKeeper sdskeeper.Keeper + evmKeeper *evmkeeper.Keeper // the module manager mm *module.Manager @@ -267,7 +270,7 @@ func NewInitApp( // stratos keys registertypes.StoreKey, pottypes.StoreKey, - //sdstypes.StoreKey, + sdstypes.StoreKey, evmtypes.StoreKey, ) @@ -410,14 +413,14 @@ func NewInitApp( app.registerKeeper, ) - //app.sdsKeeper = sdskeeper.NewKeeper( - // appCodec, - // keys[sdstypes.StoreKey], - // app.GetSubspace(sdstypes.ModuleName), - // app.bankKeeper, - // app.registerKeeper, - // app.potKeeper, - //) + app.sdsKeeper = sdskeeper.NewKeeper( + appCodec, + keys[sdstypes.StoreKey], + app.GetSubspace(sdstypes.ModuleName), + app.bankKeeper, + app.registerKeeper, + app.potKeeper, + ) /**** Module Options ****/ @@ -450,7 +453,7 @@ func NewInitApp( evm.NewAppModule(app.evmKeeper, app.accountKeeper), register.NewAppModule(app.registerKeeper, app.accountKeeper, app.bankKeeper), pot.NewAppModule(app.potKeeper, app.bankKeeper, app.accountKeeper, app.stakingKeeper, app.registerKeeper), - //sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), + sds.NewAppModule(app.sdsKeeper, app.bankKeeper, app.registerKeeper, app.potKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -493,7 +496,7 @@ func NewInitApp( stakingtypes.ModuleName, registertypes.ModuleName, pottypes.ModuleName, - //sdstypes.ModuleName, + sdstypes.ModuleName, evmtypes.ModuleName, // no-op modules ibchost.ModuleName, @@ -540,7 +543,7 @@ func NewInitApp( // Stratos modules registertypes.ModuleName, pottypes.ModuleName, - //sdstypes.ModuleName, + sdstypes.ModuleName, evmtypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module @@ -725,7 +728,7 @@ func initParamsKeeper( // stratos subspaces paramsKeeper.Subspace(registertypes.ModuleName) paramsKeeper.Subspace(pottypes.ModuleName) - //paramsKeeper.Subspace(sdstypes.ModuleName) + paramsKeeper.Subspace(sdstypes.ModuleName) paramsKeeper.Subspace(evmtypes.ModuleName) return paramsKeeper diff --git a/proto/stratos/sds/v1/query.proto b/proto/stratos/sds/v1/query.proto index 92718685..6ead0c4c 100644 --- a/proto/stratos/sds/v1/query.proto +++ b/proto/stratos/sds/v1/query.proto @@ -7,7 +7,7 @@ import "google/api/annotations.proto"; import "stratos/sds/v1/sds.proto"; -option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; +option go_package = "github.com/stratosnet/stratos-chain/x/sds/types"; // Query defines the gRPC querier service. service Query { diff --git a/x/sds/module.go b/x/sds/module.go index 74aca40c..b0839f17 100644 --- a/x/sds/module.go +++ b/x/sds/module.go @@ -10,9 +10,8 @@ import ( "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - "github.com/stratosnet/stratos-chain/x/pot" - potKeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" - registerKeeper "github.com/stratosnet/stratos-chain/x/register/keeper" + potkeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" + registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" abci "github.com/tendermint/tendermint/abci/types" @@ -54,12 +53,6 @@ func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) types.RegisterInterfaces(registry) } -// DefaultGenesis returns default genesis state as raw bytes for the sds -// module. -//func (AppModuleBasic) DefaultGenesis() json.RawMessage { -// return types.ModuleCdc.MustMarshalJSON(types.DefaultGenesisState()) -//} - // DefaultGenesis returns default genesis state as raw bytes for the register // module. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { @@ -103,12 +96,12 @@ type AppModule struct { AppModuleBasic keeper keeper.Keeper coinKeeper bankKeeper.Keeper - registerKeeper registerKeeper.Keeper - potKeeper potKeeper.Keeper + registerKeeper registerkeeper.Keeper + potKeeper potkeeper.Keeper } // NewAppModule creates a new AppModule object -func NewAppModule(k keeper.Keeper, bankKeeper bankKeeper.Keeper, registerKeeper registerKeeper.Keeper, potKeeper pot.Keeper) AppModule { +func NewAppModule(k keeper.Keeper, bankKeeper bankKeeper.Keeper, registerKeeper registerkeeper.Keeper, potKeeper potkeeper.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: k, @@ -118,18 +111,9 @@ func NewAppModule(k keeper.Keeper, bankKeeper bankKeeper.Keeper, registerKeeper } } -// Name returns the sds module's name. -//func (AppModule) Name() string { -// return types.ModuleName -//} - // RegisterInvariants registers the sds module invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// Route returns the message routing key for the sds module. -//func (AppModule) Route() string { -// return types.RouterKey -//} func (am AppModule) Route() sdk.Route { return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) } diff --git a/x/sds/types/query.pb.go b/x/sds/types/query.pb.go index 69525626..88df212d 100644 --- a/x/sds/types/query.pb.go +++ b/x/sds/types/query.pb.go @@ -10,7 +10,6 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - types "github.com/stratosnet/stratos-chain/x/sds/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -79,7 +78,7 @@ func (m *QueryFileUploadRequest) GetFileHash() string { // QueryFileuploadResponse is response type for the Query/Fileupload RPC method type QueryFileUploadResponse struct { - FileInfo *types.FileInfo `protobuf:"bytes,1,opt,name=file_info,json=fileInfo,proto3" json:"file_info,omitempty"` + FileInfo *FileInfo `protobuf:"bytes,1,opt,name=file_info,json=fileInfo,proto3" json:"file_info,omitempty"` } func (m *QueryFileUploadResponse) Reset() { *m = QueryFileUploadResponse{} } @@ -115,7 +114,7 @@ func (m *QueryFileUploadResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryFileUploadResponse proto.InternalMessageInfo -func (m *QueryFileUploadResponse) GetFileInfo() *types.FileInfo { +func (m *QueryFileUploadResponse) GetFileInfo() *FileInfo { if m != nil { return m.FileInfo } @@ -245,7 +244,7 @@ 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 *types.Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } @@ -281,7 +280,7 @@ func (m *QueryParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo -func (m *QueryParamsResponse) GetParams() *types.Params { +func (m *QueryParamsResponse) GetParams() *Params { if m != nil { return m.Params } @@ -300,38 +299,38 @@ func init() { func init() { proto.RegisterFile("stratos/sds/v1/query.proto", fileDescriptor_5b213ac8f144321e) } var fileDescriptor_5b213ac8f144321e = []byte{ - // 490 bytes of a gzipped FileDescriptorProto + // 485 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x41, 0x6b, 0x13, 0x41, 0x14, 0xce, 0x2a, 0x46, 0x3b, 0x82, 0x87, 0xb1, 0xc4, 0xb0, 0xca, 0x2a, 0xa3, 0xb4, 0x5a, 0xe8, - 0x0e, 0xa9, 0xf6, 0x07, 0x58, 0x54, 0xec, 0x45, 0x6a, 0xc0, 0x8b, 0x1e, 0xca, 0x64, 0x77, 0xb2, - 0xbb, 0xb8, 0x99, 0xb7, 0x99, 0x37, 0x29, 0x86, 0x92, 0x8b, 0x47, 0x0f, 0x22, 0xf8, 0xa7, 0x3c, - 0x16, 0xbc, 0x88, 0x07, 0x91, 0xc4, 0x1f, 0x22, 0x3b, 0x3b, 0x5b, 0x92, 0x6d, 0xab, 0xa7, 0x1d, - 0xde, 0xfb, 0xbe, 0xf7, 0x7d, 0xf3, 0xbe, 0x59, 0xe2, 0xa3, 0xd1, 0xc2, 0x00, 0x72, 0x8c, 0x91, - 0x1f, 0xf5, 0xf8, 0x78, 0x22, 0xf5, 0x34, 0x2c, 0x34, 0x18, 0xa0, 0x37, 0x5c, 0x2f, 0xc4, 0x18, - 0xc3, 0xa3, 0x9e, 0xbf, 0x9e, 0x40, 0x02, 0xb6, 0xc5, 0xcb, 0x53, 0x85, 0xf2, 0xef, 0x24, 0x00, - 0x49, 0x2e, 0xb9, 0x28, 0x32, 0x2e, 0x94, 0x02, 0x23, 0x4c, 0x06, 0x0a, 0x5d, 0xb7, 0xdb, 0x98,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 0x0e, 0x0b, 0xac, + 0x7c, 0x97, 0x76, 0xce, 0xc9, 0x5b, 0xdc, 0x41, 0xff, 0xdb, 0x22, 0xf0, 0x4e, 0x17, 0x81, 0xf7, + 0x7b, 0x11, 0x78, 0x5f, 0x96, 0x41, 0xeb, 0x74, 0x19, 0xb4, 0x7e, 0x2c, 0x83, 0xd6, 0x5b, 0xbe, + 0xf2, 0x68, 0x1c, 0x57, 0x49, 0x5d, 0x1f, 0x77, 0xa3, 0x54, 0x64, 0x8a, 0x7f, 0xb0, 0xe3, 0xec, + 0x0b, 0x1a, 0xb6, 0xed, 0x4f, 0xf5, 0xf4, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x7d, 0xc3, + 0x69, 0xd0, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -912,7 +911,7 @@ func (m *QueryFileUploadResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.FileInfo == nil { - m.FileInfo = &types.FileInfo{} + m.FileInfo = &FileInfo{} } if err := m.FileInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1216,7 +1215,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Params == nil { - m.Params = &types.Params{} + m.Params = &Params{} } if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err From 4b57b02aa22f436647830e7a9853a8ef7d61ec4c Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 17 May 2022 18:40:58 -0400 Subject: [PATCH 059/113] modified app.go --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 08069af9..e551a7cd 100644 --- a/app/app.go +++ b/app/app.go @@ -486,7 +486,7 @@ func NewInitApp( // stratos registertypes.ModuleName, pottypes.ModuleName, - //sdstypes.ModuleName, + sdstypes.ModuleName, ) // NOTE: fee market module must go last in order to retrieve the block gas used. From 9fd9fd4b851d762757ff5554d40ec001c7258bd6 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 18 May 2022 17:05:27 -0400 Subject: [PATCH 060/113] fix genesis and related proto --- proto/stratos/pot/v1/pot.proto | 293 ------------------ proto/stratos/register/v1/register.proto | 23 +- x/register/keeper/keeper.go | 2 +- x/register/keeper/params.go | 2 +- x/register/types/genesis.go | 13 +- x/register/types/params.go | 10 +- x/register/types/register.pb.go | 365 +++++++++++------------ x/register/types/resource_node.go | 8 +- x/register/types/unbonding_node.go | 2 +- 9 files changed, 210 insertions(+), 508 deletions(-) diff --git a/proto/stratos/pot/v1/pot.proto b/proto/stratos/pot/v1/pot.proto index 786f0d8d..91e0f811 100644 --- a/proto/stratos/pot/v1/pot.proto +++ b/proto/stratos/pot/v1/pot.proto @@ -2,13 +2,7 @@ syntax = "proto3"; package stratos.pot.v1; import "gogoproto/gogo.proto"; -//import "google/protobuf/any.proto"; -//import "google/protobuf/timestamp.proto"; - -//import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; -//import "cosmos/staking/v1beta1/staking.proto"; - option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; @@ -132,290 +126,3 @@ message BLSSignatureInfo { -// -//message ResourceNode { -// string networkAddr = 1 [ -// (gogoproto.jsontag) = "network_address", -// (gogoproto.moretags) = "yaml:\"network_address\"" -// ]; -// google.protobuf.Any pubKey = 2 [ -// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", -// (gogoproto.jsontag) = "pubkey", -// (gogoproto.moretags) = "yaml:\"pubkey\"" -// ]; -// bool suspend = 3 [ -// (gogoproto.jsontag) = "suspend", -// (gogoproto.moretags) = "yaml:\"suspend\"" -// ]; -// cosmos.staking.v1beta1.BondStatus status = 4 [ -// (gogoproto.jsontag) = "status", -// (gogoproto.moretags) = "yaml:\"status\"" ]; -// string tokens = 5 [ -// (gogoproto.nullable) = false, -// (gogoproto.jsontag) = "tokens", -// (gogoproto.moretags) = "yaml:\"tokens\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" -// ]; -// string ownerAddress = 6 [ -// (gogoproto.jsontag) = "owner_address", -// (gogoproto.moretags) = "yaml:\"owner_address\"" -// ]; -// Description description = 7 [ -// (gogoproto.jsontag) = "description", -// (gogoproto.moretags) = "yaml:\"description\"" -// ]; -// google.protobuf.Timestamp creation_time = 8 [ -// (gogoproto.nullable) = false, -// (gogoproto.stdtime) = true, -// (gogoproto.jsontag) = "creation_time", -// (gogoproto.moretags) = "yaml:\"creation_time\"" -// ]; -// string nodeType = 9 [ -// (gogoproto.jsontag) = "node_type", -// (gogoproto.moretags) = "yaml:\"node_type\"" -// ]; -// -//} -// -//message IndexingNode { -// string networkAddr = 1 [ -// (gogoproto.jsontag) = "network_address", -// (gogoproto.moretags) = "yaml:\"network_address\"" -// ]; -// google.protobuf.Any pubKey = 2 [ -// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", -// (gogoproto.jsontag) = "pubkey", -// (gogoproto.moretags) = "yaml:\"pubkey\"" -// ]; -// bool suspend = 3 [ -// (gogoproto.jsontag) = "suspend", -// (gogoproto.moretags) = "yaml:\"suspend\"" -// ]; -// cosmos.staking.v1beta1.BondStatus status = 4 [ -// (gogoproto.jsontag) = "status", -// (gogoproto.moretags) = "yaml:\"status\"" ]; -// string tokens = 5 [ -// (gogoproto.nullable) = false, -// (gogoproto.jsontag) = "tokens", -// (gogoproto.moretags) = "yaml:\"tokens\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" -// ]; -// string ownerAddress = 6 [ -// (gogoproto.jsontag) = "owner_address", -// (gogoproto.moretags) = "yaml:\"owner_address\"" -// ]; -// Description description = 7 [ -// (gogoproto.jsontag) = "description", -// (gogoproto.moretags) = "yaml:\"description\"" -// ]; -// google.protobuf.Timestamp creation_time = 8 [ -// (gogoproto.nullable) = false, -// (gogoproto.stdtime) = true, -// (gogoproto.jsontag) = "creation_time", -// (gogoproto.moretags) = "yaml:\"creation_time\"" -// ]; -//} -// -//message IndexingNodeRegistrationVotePool { -// string nodeAddress = 1 [ -// (gogoproto.jsontag) = "network_address", -// (gogoproto.moretags) = "yaml:\"network_address\"" -// ]; -// repeated string approveList = 2 [ -// (gogoproto.jsontag) = "approve_list", -// (gogoproto.moretags) = "yaml:\"approve_list\"" -// ]; -// repeated string rejectList = 3 [ -// (gogoproto.jsontag) = "reject_list", -// (gogoproto.moretags) = "yaml:\"reject_list\"" -// ]; -// google.protobuf.Timestamp expireTime = 4 [ -// (gogoproto.stdtime) = true, -// (gogoproto.jsontag) = "expire_time", -// (gogoproto.moretags) = "yaml:\"expire_time\"" -// ]; -//} -// -//message Description { -// string moniker = 1 [ -// (gogoproto.jsontag) = "moniker", -// (gogoproto.moretags) = "yaml:\"moniker\"" -// ]; -// string identity = 2 [ -// (gogoproto.jsontag) = "identity", -// (gogoproto.moretags) = "yaml:\"identity\",omitempty" -// ]; -// string Website = 3 [ -// (gogoproto.jsontag) = "website", -// (gogoproto.moretags) = "yaml:\"website\",omitempty" -// ]; -// string SecurityContact = 4 [ -// (gogoproto.jsontag) = "security_contact", -// (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; -// string Details = 5 [ -// (gogoproto.jsontag) = "details", -// (gogoproto.moretags) = "yaml:\"details\",omitempty" ]; -//} -// -//message Slashing { -// string WalletAddress = 1 [ -// (gogoproto.jsontag) = "wallet_address", -// (gogoproto.moretags) = "yaml:\"wallet_address\"" -// ]; -// int64 Value = 2 [ -// (gogoproto.jsontag) = "value", -// (gogoproto.moretags) = "yaml:\"value\"" -// ]; -//} -// -//message ResourceNodes { -// repeated ResourceNode resourceNodes = 1; -//} -// -//message IndexingNodes { -// repeated IndexingNode indexingNodes = 1; -//} -// -//message TotalStakesResponse { -// cosmos.base.v1beta1.Coin resource_nodes_total_stake = 1; -// cosmos.base.v1beta1.Coin indexing_nodes_total_stake = 2; -// cosmos.base.v1beta1.Coin total_bonded_stake = 3; -// cosmos.base.v1beta1.Coin total_unbonded_stake = 4; -// cosmos.base.v1beta1.Coin total_unbonding_stake = 5; -//} -// -//message StakingInfo { -// string networkAddr = 1 [ -// (gogoproto.jsontag) = "network_address", -// (gogoproto.moretags) = "yaml:\"network_address\"" -// ]; -// google.protobuf.Any pubKey = 2 [ -// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", -// (gogoproto.jsontag) = "pubkey", -// (gogoproto.moretags) = "yaml:\"pubkey\"" -// ]; -// bool suspend = 3 [ -// (gogoproto.jsontag) = "suspend", -// (gogoproto.moretags) = "yaml:\"suspend\"" -// ]; -// cosmos.staking.v1beta1.BondStatus status = 4 [ -// (gogoproto.jsontag) = "status", -// (gogoproto.moretags) = "yaml:\"status\"" ]; -// string tokens = 5 [ -// (gogoproto.jsontag) = "tokens", -// (gogoproto.moretags) = "yaml:\"tokens\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" -// ]; -// string ownerAddress = 6 [ -// (gogoproto.jsontag) = "owner_address", -// (gogoproto.moretags) = "yaml:\"owner_address\"" -// ]; -// Description description = 7 [ -// (gogoproto.jsontag) = "description", -// (gogoproto.moretags) = "yaml:\"description\"" -// ]; -// google.protobuf.Timestamp creation_time = 8 [ -// (gogoproto.nullable) = false, -// (gogoproto.stdtime) = true, -// (gogoproto.jsontag) = "creation_time", -// (gogoproto.moretags) = "yaml:\"creation_time\"" -// ]; -// string nodeType = 9 [ -// (gogoproto.jsontag) = "node_type", -// (gogoproto.moretags) = "yaml:\"node_type\"" -// ]; -// cosmos.base.v1beta1.Coin bonded_stake = 10 [ -// (gogoproto.nullable) = true, -// (gogoproto.jsontag) = "bonded_stake", -// (gogoproto.moretags) = "yaml:\"bonded_stake\"" -// ]; -// cosmos.base.v1beta1.Coin un_bonding_stake = 11 [ -// (gogoproto.nullable) = true, -// (gogoproto.jsontag) = "un_bonding_stake", -// (gogoproto.moretags) = "yaml:\"un_bonding_stake\"" -// ]; -// cosmos.base.v1beta1.Coin un_bonded_stake = 12 [ -// (gogoproto.nullable) = true, -// (gogoproto.jsontag) = "un_bonded_stake", -// (gogoproto.moretags) = "yaml:\"un_bonded_stake\"" -// ]; -// -//} -// -//// UnbondingNode stores all of a single delegator's unbonding bonds -//// for a single unbonding node in a time-ordered list -//message UnbondingNode { -// string networkAddr = 1 [ -// (gogoproto.jsontag) = "network_addr", -// (gogoproto.moretags) = "yaml:\"network_addr\"" -// ]; -// bool is_indexing_node = 2 [ -// (gogoproto.jsontag) = "is_indexing_node", -// (gogoproto.moretags) = "yaml:\"is_indexing_node\"" -// ]; -// repeated UnbondingNodeEntry entries = 3 [ -// (gogoproto.jsontag) = "entries", -// (gogoproto.moretags) = "yaml:\"entries\"" -// ]; -// -//} -// -//message UnbondingNodeEntry { -// int64 creation_height = 1 [ -// (gogoproto.jsontag) = "creation_height", -// (gogoproto.moretags) = "yaml:\"creation_height\"" -// ]; -// google.protobuf.Timestamp completion_time = 2 [ -// (gogoproto.stdtime) = true, -// (gogoproto.jsontag) = "creation_time", -// (gogoproto.moretags) = "yaml:\"creation_time\"" -// ]; -// string initial_balance = 3 [ -// (gogoproto.jsontag) = "initial_balance", -// (gogoproto.moretags) = "yaml:\"initial_balance\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" -// ]; -// string balance = 4 [ -// (gogoproto.jsontag) = "balance", -// (gogoproto.moretags) = "yaml:\"balance\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" -// ]; -//} -// -//message Staking { -// option (gogoproto.equal) = false; -// option (gogoproto.goproto_getters) = false; -// option (gogoproto.goproto_stringer) = false; -// -// // network_address is the bech32-encoded address of the node. -// string network_address = 1 [ -// (gogoproto.jsontag) = "network_address", -// (gogoproto.moretags) = "yaml:\"network_address\"" -// ]; -// // owner_address is the bech32-encoded address of owner of the node. -// string owner_address = 2 [ -// (gogoproto.jsontag) = "owner_address", -// (gogoproto.moretags) = "yaml:\"owner_address\"" -// ]; -// // shares define the delegation shares received. -// string value = 3 [ -// (gogoproto.jsontag) = "value", -// (gogoproto.moretags) = "yaml:\"value\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", -// (gogoproto.nullable) = false -// ]; -//} - -//message QueryNodeStakingParams { -// string acc_addr = 1; -// int64 query_type = 2; -//} -// -//// QueryNodesParams Params for query 'custom/register/resource-nodes' -//message QueryNodesParams { -// string network_addr = 1; -// string moniker = 2; -// string owner_addr = 3; -//} - - diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index fb964e43..f85babcc 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -4,6 +4,7 @@ package stratos.register.v1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; @@ -18,11 +19,15 @@ message Params { (gogoproto.jsontag) = "bond_denom", (gogoproto.moretags) = "yaml:\"bond_denom\"" ]; - string unbonding_threashold_time = 2 [ + google.protobuf.Duration unbonding_threashold_time = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, (gogoproto.jsontag) = "unbonding_threashold_time", (gogoproto.moretags) = "yaml:\"unbonding_threashold_time\"" ]; - string unbonding_completion_time = 3 [ + google.protobuf.Duration unbonding_completion_time = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, (gogoproto.jsontag) = "unbonding_completion_time", (gogoproto.moretags) = "yaml:\"unbonding_completion_time\"" ]; @@ -129,6 +134,7 @@ message IndexingNodeRegistrationVotePool { (gogoproto.moretags) = "yaml:\"reject_list\"" ]; google.protobuf.Timestamp expireTime = 4 [ +// (gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.jsontag) = "expire_time", (gogoproto.moretags) = "yaml:\"expire_time\"" @@ -265,6 +271,7 @@ message UnbondingNodeEntry { (gogoproto.moretags) = "yaml:\"creation_height\"" ]; google.protobuf.Timestamp completion_time = 2 [ + (gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.jsontag) = "creation_time", (gogoproto.moretags) = "yaml:\"creation_time\"" @@ -305,16 +312,4 @@ message Staking { ]; } -//message QueryNodeStakingParams { -// string acc_addr = 1; -// int64 query_type = 2; -//} -// -//// QueryNodesParams Params for query 'custom/register/resource-nodes' -//message QueryNodesParams { -// string network_addr = 1; -// string moniker = 2; -// string owner_addr = 3; -//} - diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index bf92ec29..843afc9c 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -223,7 +223,7 @@ func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res // GetUnbondingNodes return a given amount of all the UnbondingIndexingNodes func (k Keeper) GetUnbondingNodes(ctx sdk.Context, networkAddr stratos.SdsAddress, - maxRetrieve uint16) (unbondingIndexingNodes []types.UnbondingNode) { + maxRetrieve uint32) (unbondingIndexingNodes []types.UnbondingNode) { unbondingIndexingNodes = make([]types.UnbondingNode, maxRetrieve) diff --git a/x/register/keeper/params.go b/x/register/keeper/params.go index 3bd430a2..85d58625 100644 --- a/x/register/keeper/params.go +++ b/x/register/keeper/params.go @@ -26,7 +26,7 @@ func (k Keeper) BondDenom(ctx sdk.Context) (res string) { // MaxEntries - Maximum number of simultaneous unbonding // delegations or redelegations (per pair/trio) -func (k Keeper) MaxEntries(ctx sdk.Context) (res uint16) { +func (k Keeper) MaxEntries(ctx sdk.Context) (res uint32) { k.paramSpace.Get(ctx, types.KeyMaxEntries, &res) return } diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 5542bed5..6e684316 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -52,11 +52,16 @@ func ValidateGenesis(data GenesisState) error { if err := data.GetParams().Validate(); err != nil { return err } - if err := data.GetResourceNodes().Validate(); err != nil { - return err + if resNodes := data.GetResourceNodes(); resNodes != nil { + if err := resNodes.Validate(); err != nil { + return err + } } - if err := data.GetIndexingNodes().Validate(); err != nil { - return err + + if indNodes := data.GetIndexingNodes(); indNodes != nil { + if err := indNodes.Validate(); err != nil { + return err + } } if (data.InitialUozPrice).LTE(sdk.ZeroDec()) { diff --git a/x/register/types/params.go b/x/register/types/params.go index ead582f8..0f425083 100644 --- a/x/register/types/params.go +++ b/x/register/types/params.go @@ -28,9 +28,9 @@ var ( KeyUnbondingCompletionTime = []byte("UnbondingCompletionTime") KeyMaxEntries = []byte("KeyMaxEntries") - DefaultUnbondingThreasholdTime = (180 * 24 * time.Hour).String() // threashold for unbonding - by default 180 days - DefaultUnbondingCompletionTime = (14 * 24 * time.Hour).String() // lead time to complete unbonding - by default 14 days - DefaultUozPrice = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz + DefaultUnbondingThreasholdTime = 180 * 24 * time.Hour // threashold for unbonding - by default 180 days + DefaultUnbondingCompletionTime = 14 * 24 * time.Hour // lead time to complete unbonding - by default 14 days + DefaultUozPrice = sdk.NewDecWithPrec(1000000, 9) // 0.001 ustos -> 1 uoz DefaultTotalUnissuedPrepay = sdk.NewInt(0) ) @@ -40,7 +40,7 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params object -func NewParams(bondDenom string, threashold, completion string, maxEntries uint32) Params { +func NewParams(bondDenom string, threashold, completion time.Duration, maxEntries uint32) Params { return Params{ BondDenom: bondDenom, UnbondingThreasholdTime: threashold, @@ -124,7 +124,7 @@ func validateUnbondingCompletionTime(i interface{}) error { } func validateMaxEntries(i interface{}) error { - v, ok := i.(uint16) + v, ok := i.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 7d2ffe72..194e7372 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -13,6 +13,7 @@ import ( proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/regen-network/cosmos-proto" + _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" @@ -34,10 +35,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the Register module parameters type Params struct { - BondDenom string `protobuf:"bytes,1,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom" yaml:"bond_denom"` - UnbondingThreasholdTime string `protobuf:"bytes,2,opt,name=unbonding_threashold_time,json=unbondingThreasholdTime,proto3" json:"unbonding_threashold_time" yaml:"unbonding_threashold_time"` - UnbondingCompletionTime string `protobuf:"bytes,3,opt,name=unbonding_completion_time,json=unbondingCompletionTime,proto3" json:"unbonding_completion_time" yaml:"unbonding_completion_time"` - MaxEntries uint32 `protobuf:"varint,4,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries" yaml:"max_entries",omitempty` + BondDenom string `protobuf:"bytes,1,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom" yaml:"bond_denom"` + UnbondingThreasholdTime time.Duration `protobuf:"bytes,2,opt,name=unbonding_threashold_time,json=unbondingThreasholdTime,proto3,stdduration" json:"unbonding_threashold_time" yaml:"unbonding_threashold_time"` + UnbondingCompletionTime time.Duration `protobuf:"bytes,3,opt,name=unbonding_completion_time,json=unbondingCompletionTime,proto3,stdduration" json:"unbonding_completion_time" yaml:"unbonding_completion_time"` + MaxEntries uint32 `protobuf:"varint,4,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries" yaml:"max_entries",omitempty` } func (m *Params) Reset() { *m = Params{} } @@ -80,18 +81,18 @@ func (m *Params) GetBondDenom() string { return "" } -func (m *Params) GetUnbondingThreasholdTime() string { +func (m *Params) GetUnbondingThreasholdTime() time.Duration { if m != nil { return m.UnbondingThreasholdTime } - return "" + return 0 } -func (m *Params) GetUnbondingCompletionTime() string { +func (m *Params) GetUnbondingCompletionTime() time.Duration { if m != nil { return m.UnbondingCompletionTime } - return "" + return 0 } func (m *Params) GetMaxEntries() uint32 { @@ -844,7 +845,7 @@ func (m *UnbondingNode) GetEntries() []*UnbondingNodeEntry { type UnbondingNodeEntry struct { CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height" yaml:"creation_height"` - CompletionTime *time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` InitialBalance *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"initial_balance" yaml:"initial_balance"` Balance *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance" yaml:"balance"` } @@ -889,11 +890,11 @@ func (m *UnbondingNodeEntry) GetCreationHeight() int64 { return 0 } -func (m *UnbondingNodeEntry) GetCompletionTime() *time.Time { +func (m *UnbondingNodeEntry) GetCompletionTime() time.Time { if m != nil { return m.CompletionTime } - return nil + return time.Time{} } type Staking struct { @@ -958,112 +959,113 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1678 bytes of a gzipped FileDescriptorProto + // 1692 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x23, 0x49, - 0x15, 0x8f, 0xed, 0x4d, 0x9c, 0x94, 0x3f, 0x12, 0x7a, 0xb2, 0x8c, 0x33, 0x40, 0x2a, 0x53, 0x7c, - 0x6c, 0xd0, 0x12, 0x5b, 0xc9, 0x20, 0x21, 0x56, 0xe2, 0x90, 0x9e, 0x44, 0x21, 0x5a, 0x76, 0x08, - 0x9d, 0x90, 0x00, 0xd2, 0xca, 0xb4, 0xbb, 0x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, 0x0f, 0xa9, 0x6b, 0x95, 0x01, 0x47, 0x80, 0x65, 0x33, 0x69, 0xba, - 0xcf, 0xea, 0x2c, 0xc3, 0xdb, 0xc6, 0x70, 0x5e, 0x33, 0xad, 0x0c, 0x39, 0x01, 0xf2, 0x6a, 0xda, - 0xac, 0xd9, 0x2f, 0xfa, 0x75, 0x11, 0xd4, 0xa6, 0xf5, 0x48, 0x7d, 0x41, 0x1d, 0xde, 0x56, 0x7e, - 0x54, 0xd3, 0x67, 0x57, 0x99, 0xd4, 0x99, 0x36, 0x9a, 0x2b, 0x3c, 0x3f, 0x06, 0x2b, 0x84, 0xb7, - 0x33, 0x37, 0x83, 0x2a, 0x41, 0x8b, 0xea, 0x6d, 0xe4, 0x86, 0x2c, 0xf5, 0x56, 0x5e, 0x82, 0xbc, - 0x3a, 0xe1, 0x99, 0xef, 0xbc, 0x9f, 0x82, 0x72, 0xf2, 0xda, 0x52, 0x52, 0x97, 0xe4, 0x3b, 0xb7, - 0x26, 0x4b, 0x66, 0x6b, 0xfb, 0x54, 0x44, 0x23, 0x5d, 0x99, 0xd2, 0x27, 0x19, 0x53, 0x99, 0x92, - 0xe7, 0x18, 0x2f, 0x11, 0xa1, 0x3f, 0x95, 0x80, 0x73, 0x53, 0xdd, 0x39, 0x05, 0xcb, 0xd3, 0x70, - 0x3f, 0xc7, 0xa4, 0x7b, 0x2e, 0x94, 0x8b, 0x4a, 0xba, 0x42, 0xe7, 0x44, 0xe9, 0x39, 0xe4, 0x04, - 0xc8, 0xab, 0x27, 0xc8, 0x77, 0x15, 0xe0, 0x44, 0x60, 0x39, 0xff, 0x6e, 0x55, 0x9c, 0x99, 0x98, - 0x5b, 0x77, 0x4b, 0xca, 0x7a, 0x90, 0x7d, 0xb6, 0xfa, 0x45, 0x01, 0x2c, 0x13, 0x4a, 0x04, 0x91, - 0x37, 0xac, 0xdf, 0xf3, 0x69, 0x90, 0xf4, 0x97, 0x67, 0x77, 0xaa, 0x96, 0x79, 0x92, 0x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x42, 0xac, 0xc4, 0x21, 0x3d, 0x89, 0x42, 0xb4, 0xec, 0x10, + 0x3a, 0x21, 0x01, 0xa4, 0x95, 0x69, 0x77, 0xd7, 0x3a, 0x45, 0xec, 0x2a, 0xab, 0xab, 0x9c, 0xc4, + 0x37, 0x8e, 0x9c, 0xd0, 0xde, 0xd8, 0x13, 0xca, 0x81, 0x13, 0x67, 0xfe, 0x88, 0xd1, 0x9e, 0xf6, + 0x88, 0x38, 0x34, 0x68, 0x06, 0x24, 0x64, 0x71, 0xf2, 0x09, 0x71, 0x42, 0xf5, 0xd1, 0xee, 0xea, + 0x4e, 0x76, 0xa2, 0x89, 0xe0, 0x00, 0xca, 0x29, 0xa9, 0xdf, 0xab, 0xf7, 0x7b, 0xaf, 0x5e, 0xbd, + 0xf7, 0xea, 0xb9, 0x01, 0xe2, 0x22, 0xf2, 0x05, 0xe3, 0xed, 0x08, 0xf7, 0x08, 0x17, 0x38, 0x6a, + 0x9f, 0x6f, 0xcd, 0xfe, 0x6f, 0x0d, 0x23, 0x26, 0x98, 0xf3, 0xc0, 0xec, 0x69, 0xcd, 0xf0, 0xf3, + 0xad, 0x47, 0xab, 0x3d, 0xd6, 0x63, 0x4a, 0xde, 0x96, 0xff, 0xe9, 0xad, 0x8f, 0xd6, 0x7a, 0x8c, + 0xf5, 0xfa, 0xb8, 0xad, 0x56, 0xdd, 0xd1, 0x47, 0x6d, 0x9f, 0x8e, 0x8d, 0x08, 0xe6, 0x45, 0x82, + 0x0c, 0x30, 0x17, 0xfe, 0x60, 0x68, 0x36, 0xac, 0xe7, 0x37, 0x84, 0xa3, 0xc8, 0x17, 0x84, 0xd1, + 0x84, 0x3b, 0x60, 0x7c, 0xc0, 0x78, 0x47, 0x1b, 0xd5, 0x8b, 0x44, 0x55, 0xaf, 0xda, 0x5d, 0x9f, + 0xe3, 0xf6, 0xf9, 0x56, 0x17, 0x0b, 0x7f, 0xab, 0x1d, 0x30, 0x92, 0xa8, 0x7e, 0xcd, 0xc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, 0x1d, + 0x00, 0x00, 0xff, 0xff, 0xb1, 0x80, 0xcd, 0x21, 0xbb, 0x17, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1091,20 +1093,22 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.UnbondingCompletionTime) > 0 { - i -= len(m.UnbondingCompletionTime) - copy(dAtA[i:], m.UnbondingCompletionTime) - i = encodeVarintRegister(dAtA, i, uint64(len(m.UnbondingCompletionTime))) - i-- - dAtA[i] = 0x1a + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingCompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingCompletionTime):]) + if err1 != nil { + return 0, err1 } - if len(m.UnbondingThreasholdTime) > 0 { - i -= len(m.UnbondingThreasholdTime) - copy(dAtA[i:], m.UnbondingThreasholdTime) - i = encodeVarintRegister(dAtA, i, uint64(len(m.UnbondingThreasholdTime))) - i-- - dAtA[i] = 0x12 + i -= n1 + i = encodeVarintRegister(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingThreasholdTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingThreasholdTime):]) + if err2 != nil { + return 0, err2 } + i -= n2 + i = encodeVarintRegister(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 if len(m.BondDenom) > 0 { i -= len(m.BondDenom) copy(dAtA[i:], m.BondDenom) @@ -1142,12 +1146,12 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x4a } - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) - if err1 != nil { - return 0, err1 + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) + if err3 != nil { + return 0, err3 } - i -= n1 - i = encodeVarintRegister(dAtA, i, uint64(n1)) + i -= n3 + i = encodeVarintRegister(dAtA, i, uint64(n3)) i-- dAtA[i] = 0x42 if m.Description != nil { @@ -1236,12 +1240,12 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) - if err4 != nil { - return 0, err4 + n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) + if err6 != nil { + return 0, err6 } - i -= n4 - i = encodeVarintRegister(dAtA, i, uint64(n4)) + i -= n6 + i = encodeVarintRegister(dAtA, i, uint64(n6)) i-- dAtA[i] = 0x42 if m.Description != nil { @@ -1331,12 +1335,12 @@ func (m *IndexingNodeRegistrationVotePool) MarshalToSizedBuffer(dAtA []byte) (in var l int _ = l if m.ExpireTime != nil { - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.ExpireTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpireTime):]) - if err7 != nil { - return 0, err7 + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.ExpireTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpireTime):]) + if err9 != nil { + return 0, err9 } - i -= n7 - i = encodeVarintRegister(dAtA, i, uint64(n7)) + i -= n9 + i = encodeVarintRegister(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x22 } @@ -1681,12 +1685,12 @@ func (m *StakingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x4a } - n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) - if err16 != nil { - return 0, err16 + n18, err18 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) + if err18 != nil { + return 0, err18 } - i -= n16 - i = encodeVarintRegister(dAtA, i, uint64(n16)) + i -= n18 + i = encodeVarintRegister(dAtA, i, uint64(n18)) i-- dAtA[i] = 0x42 if m.Description != nil { @@ -1855,16 +1859,14 @@ func (m *UnbondingNodeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if m.CompletionTime != nil { - n19, err19 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.CompletionTime):]) - if err19 != nil { - return 0, err19 - } - i -= n19 - i = encodeVarintRegister(dAtA, i, uint64(n19)) - i-- - dAtA[i] = 0x12 + n21, err21 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err21 != nil { + return 0, err21 } + i -= n21 + i = encodeVarintRegister(dAtA, i, uint64(n21)) + i-- + dAtA[i] = 0x12 if m.CreationHeight != 0 { i = encodeVarintRegister(dAtA, i, uint64(m.CreationHeight)) i-- @@ -1941,14 +1943,10 @@ func (m *Params) Size() (n int) { if l > 0 { n += 1 + l + sovRegister(uint64(l)) } - l = len(m.UnbondingThreasholdTime) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) - } - l = len(m.UnbondingCompletionTime) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) - } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingThreasholdTime) + n += 1 + l + sovRegister(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingCompletionTime) + n += 1 + l + sovRegister(uint64(l)) if m.MaxEntries != 0 { n += 1 + sovRegister(uint64(m.MaxEntries)) } @@ -2246,10 +2244,8 @@ func (m *UnbondingNodeEntry) Size() (n int) { if m.CreationHeight != 0 { n += 1 + sovRegister(uint64(m.CreationHeight)) } - if m.CompletionTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CompletionTime) - n += 1 + l + sovRegister(uint64(l)) - } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovRegister(uint64(l)) if m.InitialBalance != nil { l = m.InitialBalance.Size() n += 1 + l + sovRegister(uint64(l)) @@ -2351,7 +2347,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UnbondingThreasholdTime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2361,29 +2357,30 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.UnbondingThreasholdTime = string(dAtA[iNdEx:postIndex]) + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingThreasholdTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UnbondingCompletionTime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2393,23 +2390,24 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRegister } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRegister } if postIndex > l { return io.ErrUnexpectedEOF } - m.UnbondingCompletionTime = string(dAtA[iNdEx:postIndex]) + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingCompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: if wireType != 0 { @@ -4605,10 +4603,7 @@ func (m *UnbondingNodeEntry) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.CompletionTime == nil { - m.CompletionTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 55fe38da..ab92db12 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -236,24 +236,24 @@ func (v1 ResourceNode) Equal(v2 ResourceNode) bool { return bytes.Equal(bz1, bz2) } -func (s Staking) GetNetworkAddress() stratos.SdsAddress { +func (s *Staking) GetNetworkAddress() stratos.SdsAddress { networkAddr, err := stratos.SdsAddressFromBech32(s.NetworkAddress) if err != nil { panic(err) } return networkAddr } -func (s Staking) GetOwnerAddr() sdk.AccAddress { +func (s *Staking) GetOwnerAddr() sdk.AccAddress { addr, err := sdk.AccAddressFromBech32(s.OwnerAddress) if err != nil { panic(err) } return addr } -func (s Staking) GetShares() sdk.Dec { return s.Value } +func (s *Staking) GetShares() sdk.Dec { return s.Value } // String returns a human readable string representation of a node. -func (s Staking) String() string { +func (s *Staking) String() string { out, _ := yaml.Marshal(s) return string(out) } diff --git a/x/register/types/unbonding_node.go b/x/register/types/unbonding_node.go index b635359b..74e9b89a 100644 --- a/x/register/types/unbonding_node.go +++ b/x/register/types/unbonding_node.go @@ -34,7 +34,7 @@ func NewUnbondingNodeEntry(creationHeight int64, completionTime time.Time, return UnbondingNodeEntry{ CreationHeight: creationHeight, - CompletionTime: &completionTime, + CompletionTime: completionTime, InitialBalance: &balance, Balance: &balance, } From 2fc6b65f2527027554d562969edee666e95cab1e Mon Sep 17 00:00:00 2001 From: jialbai Date: Thu, 19 May 2022 17:32:21 -0400 Subject: [PATCH 061/113] - qb-1165: upgrade PoT's token life cycle --- app/app.go | 11 ++-- x/pot/keeper/distribute.go | 80 +++++++++++++++++++++--------- x/pot/types/distribute.go | 1 + x/pot/types/expected_keepers.go | 2 +- x/register/keeper/indexing_node.go | 2 +- x/register/keeper/resource_node.go | 2 +- x/register/keeper/slashing.go | 15 +++--- x/register/types/keys.go | 10 ++++ 8 files changed, 85 insertions(+), 38 deletions(-) diff --git a/app/app.go b/app/app.go index e551a7cd..db24ba69 100644 --- a/app/app.go +++ b/app/app.go @@ -158,15 +158,16 @@ var ( //pot.FoundationAccount: nil, registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, //upgrading module accounts - //registertypes.ResourceNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, - //registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, - //registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, - //registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, - //registertypes.TotalUnissuedPrepayName: nil, + registertypes.ResourceNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.TotalUnissuedPrepayName: nil, pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, pottypes.MiningRewardPool: nil, pottypes.TrafficRewardPool: nil, + //pottypes.TotalMinedTokens: {authtypes.Minter, authtypes.Burner}, sdstypes.ModuleName: nil, evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index fe183124..87dfb929 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -3,6 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/pot/types" + regtypes "github.com/stratosnet/stratos-chain/x/register/types" ) func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { @@ -36,13 +37,13 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single //4, calc reward from indexing node, store to rewardDetailMap by wallet address(owner address) rewardDetailMap, distributeGoalBalance = k.CalcRewardForIndexingNode(ctx, distributeGoalBalance, rewardDetailMap) - //5, deduct reward from provider account (the value of parameter of distributeGoal will not change) + //5, [TLC] deduct reward from provider account (the value of parameter of distributeGoal will not change) err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch) if err != nil { return totalConsumedOzone, err } - //6, distribute skate reward to fee pool for validators + //6, [TLC] distribute staking reward to fee pool for validators distributeGoalBalance, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoalBalance) if err != nil { return totalConsumedOzone, err @@ -57,7 +58,7 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single return totalConsumedOzone, err } - //9, return balance to traffic pool & mining pool + //9, [TLC] return balance to traffic pool & mining pool err = k.returnBalance(ctx, distributeGoalBalance, epoch) if err != nil { return totalConsumedOzone, err @@ -84,7 +85,7 @@ func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal type Add(goal.BlockChainRewardToResourceNodeFromTrafficPool). Add(goal.TrafficRewardToResourceNodeFromTrafficPool) - // deduct mining reward from foundation account + // [TLC][Foundation -> MiningRewardPool]: deduct mining reward from foundation account foundationAccountAddr := k.AccountKeeper.GetModuleAddress(types.FoundationAccount) if foundationAccountAddr == nil { ctx.Logger().Error("foundation account address of distribution module does not exist.") @@ -97,24 +98,36 @@ func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal type return types.ErrInsufficientFoundationAccBalance } amountToDeduct := sdk.NewCoins(totalRewardFromMiningPool) - err = k.BankKeeper.SendCoinsFromAccountToModule(ctx, foundationAccountAddr, types.ModuleName, amountToDeduct) + err = k.BankKeeper.SendCoinsFromAccountToModule(ctx, foundationAccountAddr, types.MiningRewardPool, amountToDeduct) if err != nil { return err } - // update mined token record by adding mining reward + // [Non-TLC] update mined token record by adding mining reward oldTotalMinedToken := k.GetTotalMinedTokens(ctx) newTotalMinedToken := oldTotalMinedToken.Add(totalRewardFromMiningPool) k.SetTotalMinedTokens(ctx, newTotalMinedToken) k.setMinedTokens(ctx, epoch, totalRewardFromMiningPool) - // deduct traffic reward from prepay pool - totalUnIssuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) - newTotalUnIssuedPrePay := totalUnIssuedPrepay.Sub(totalRewardFromTrafficPool) - if newTotalUnIssuedPrePay.IsNegative() { + // [TLC][TotalUnIssuedPrepay -> TrafficRewardPool]: deduct traffic reward from prepay pool + totalUnissuedPrepayAddr := k.AccountKeeper.GetModuleAddress(regtypes.TotalUnissuedPrepayName) + if totalUnissuedPrepayAddr == nil { + ctx.Logger().Error("TotalUnIssuedPrepay account address of register module does not exist.") + return types.ErrUnknownAccountAddress + } + + hasCoinInUnissuedPrepay := k.BankKeeper.HasBalance(ctx, totalUnissuedPrepayAddr, totalRewardFromTrafficPool) + if !hasCoinInUnissuedPrepay { + ctx.Logger().Info("Insufficient balance of TotalUnIssuedPrepay module account") return types.ErrInsufficientUnissuedPrePayBalance } - k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) + err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, regtypes.TotalUnissuedPrepayName, types.TrafficRewardPool, sdk.NewCoins(totalRewardFromTrafficPool)) + //totalUnIssuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) + //newTotalUnIssuedPrePay := totalUnIssuedPrepay.Sub(totalRewardFromTrafficPool) + //if newTotalUnIssuedPrePay.IsNegative() { + // return types.ErrInsufficientUnissuedPrePayBalance + //} + //k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) return nil } @@ -130,13 +143,14 @@ func (k Keeper) returnBalance(ctx sdk.Context, goal types.DistributeGoal, curren Add(goal.TrafficRewardToResourceNodeFromTrafficPool) // return balance to foundation account - foundationAccountAddr := k.AccountKeeper.GetModuleAddress(types.FoundationAccount) - if foundationAccountAddr == nil { - ctx.Logger().Error("foundation account address of distribution module does not exist.") - return types.ErrUnknownAccountAddress - } + //foundationAccountAddr := k.AccountKeeper.GetModuleAddress(types.FoundationAccount) + //if foundationAccountAddr == nil { + // ctx.Logger().Error("foundation account address of distribution module does not exist.") + // return types.ErrUnknownAccountAddress + //} + // [TLC] [MiningRewardPool -> FoundationAccount] amountToAdd := sdk.NewCoins(balanceOfMiningPool) - err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, foundationAccountAddr, amountToAdd) + err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.MiningRewardPool, types.FoundationAccount, amountToAdd) if err != nil { return err } @@ -150,9 +164,14 @@ func (k Keeper) returnBalance(ctx sdk.Context, goal types.DistributeGoal, curren k.setMinedTokens(ctx, currentEpoch, newMinedToken) // return balance to prepay pool - totalUnIssuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) - newTotalUnIssuedPrePay := totalUnIssuedPrepay.Add(balanceOfTrafficPool) - k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) + // [TLC][TrafficRewardPool -> TotalUnIssuedPrepay] + err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.TrafficRewardPool, regtypes.TotalUnissuedPrepayName, sdk.NewCoins(balanceOfTrafficPool)) + if err != nil { + return err + } + //totalUnIssuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) + //newTotalUnIssuedPrePay := totalUnIssuedPrepay.Add(balanceOfTrafficPool) + //k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) return nil } @@ -272,6 +291,8 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int matureStartEpoch := k.GetLastReportedEpoch(ctx).Int64() + 1 matureEndEpoch := currentEpoch.Int64() + totalDeducted := sdk.Coins{} + for i := matureStartEpoch; i <= matureEndEpoch; i++ { k.IteratorIndividualReward(ctx, sdk.NewInt(i), func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { oldMatureTotal := k.GetMatureTotalReward(ctx, walletAddress) @@ -279,9 +300,11 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int immatureToMature := individualReward.RewardFromMiningPool.Add(individualReward.RewardFromTrafficPool...) //deduct slashing amount from mature total pool - oldMatureTotalSubSlashing := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, oldMatureTotal) + oldMatureTotalSubSlashing, deductedFromMature := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, oldMatureTotal) //deduct slashing amount from upcoming mature reward, don't need to deduct slashing from immatureTotal & individual - immatureToMatureSubSlashing := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, immatureToMature) + immatureToMatureSubSlashing, deductedFromImmatureToMature := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, immatureToMature) + deductedSubtotal := deductedFromMature.Add(deductedFromImmatureToMature...) + totalDeducted = totalDeducted.Add(deductedSubtotal...) matureTotal := oldMatureTotalSubSlashing.Add(immatureToMatureSubSlashing...) immatureTotal := oldImmatureTotal.Sub(immatureToMature) @@ -291,6 +314,8 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int return false }) } + + // TODO deduct totalDeducted from miningRewardPool/trafficRewardPool } // reward will mature 14 days since distribution. Each epoch interval is about 10 minutes. @@ -305,7 +330,7 @@ func (k Keeper) getMatureEpochByCurrentEpoch(ctx sdk.Context, currentEpoch sdk.I func (k Keeper) distributeValidatorRewardToFeePool(ctx sdk.Context, distributeGoal types.DistributeGoal) (types.DistributeGoal, error) { rewardFromMiningPool := distributeGoal.BlockChainRewardToValidatorFromMiningPool rewardFromTrafficPool := distributeGoal.BlockChainRewardToValidatorFromTrafficPool - totalRewardSendToFeePool := sdk.NewCoins(rewardFromMiningPool).Add(rewardFromTrafficPool) + //totalRewardSendToFeePool := sdk.NewCoins(rewardFromMiningPool).Add(rewardFromTrafficPool) feePoolAccAddr := k.AccountKeeper.GetModuleAddress(k.feeCollectorName) @@ -314,7 +339,14 @@ func (k Keeper) distributeValidatorRewardToFeePool(ctx sdk.Context, distributeGo return distributeGoal, types.ErrUnknownAccountAddress } - err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, feePoolAccAddr, totalRewardSendToFeePool) + // separately sending totalRerewardFromMiningPool and rewardFromTrafficPool instead of sending totalRewardSendToFeePool to feeCollector module acc + // [TLC] [MiningRewardPool -> feeCollectorPool] + err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.MiningRewardPool, feePoolAccAddr, sdk.NewCoins(rewardFromMiningPool)) + if err != nil { + return distributeGoal, err + } + // [TLC] [TrafficRewardPool -> feeCollectorPool] + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.TrafficRewardPool, feePoolAccAddr, sdk.NewCoins(rewardFromTrafficPool)) if err != nil { return distributeGoal, err } diff --git a/x/pot/types/distribute.go b/x/pot/types/distribute.go index b28f9239..9b599d28 100644 --- a/x/pot/types/distribute.go +++ b/x/pot/types/distribute.go @@ -10,6 +10,7 @@ const ( FoundationAccount = "foundation_account" MiningRewardPool = "mining_reward_pool" TrafficRewardPool = "traffic_reward_pool" + //TotalMinedTokens = "total_mined_tokens" ) type DistributeGoal struct { diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 6e7e46f1..1f5a6fa4 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -60,7 +60,7 @@ type RegisterKeeper interface { GetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress) (res sdk.Int) SetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, slashing sdk.Int) - DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins + DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) (remaining, deducted sdk.Coins) GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int) SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 0c9a84fe..28251909 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -209,7 +209,7 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first - coins = k.DeductSlashing(ctx, ownerAddr, coins) + coins, _ = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 09170750..36ff7bb4 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -196,7 +196,7 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first - coins = k.DeductSlashing(ctx, ownerAddr, coins) + coins, _ = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { diff --git a/x/register/keeper/slashing.go b/x/register/keeper/slashing.go index 47f022f8..9eea04a3 100644 --- a/x/register/keeper/slashing.go +++ b/x/register/keeper/slashing.go @@ -6,26 +6,29 @@ import ( ) // DeductSlashing deduct slashing amount from coins, return the coins that after deduction -func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins { +func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) (remaining, deducted sdk.Coins) { slashing := k.GetSlashing(ctx, walletAddress) + remaining = sdk.Coins{} + deducted = sdk.Coins{} if slashing.LTE(sdk.ZeroInt()) || coins.Empty() || coins.IsZero() { - return coins + return coins, deducted } - ret := sdk.Coins{} for _, coin := range coins { if coin.Amount.GTE(slashing) { coin = coin.Sub(sdk.NewCoin(coin.Denom, slashing)) - ret = ret.Add(coin) + remaining = remaining.Add(coin) + deducted = deducted.Add(sdk.NewCoin(coin.Denom, slashing)) slashing = sdk.ZeroInt() } else { slashing = slashing.Sub(coin.Amount) + deducted = deducted.Add(coin) coin = sdk.NewCoin(coin.Denom, sdk.ZeroInt()) - ret = ret.Add(coin) + remaining = remaining.Add(coin) } } k.SetSlashing(ctx, walletAddress, slashing) - return ret + return remaining, deducted } func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, slashing sdk.Int) (stop bool)) { diff --git a/x/register/types/keys.go b/x/register/types/keys.go index 65908469..a6e39301 100644 --- a/x/register/types/keys.go +++ b/x/register/types/keys.go @@ -21,6 +21,16 @@ const ( RouterKey = ModuleName // QuerierRoute to be used for querier msgs QuerierRoute = ModuleName + // ResourceNodeBondedPoolName stores the total balance of bonded resource nodes + ResourceNodeBondedPoolName = "resource_node_bonded_pool" + // ResourceNodeNotBondedPoolName stores the total balance of not bonded resource nodes + ResourceNodeNotBondedPoolName = "resource_node_not_bonded_pool" + // IndexingNodeBondedPoolName stores the total balance of bonded indexing nodes + IndexingNodeBondedPoolName = "indexing_node_bonded_pool" + // IndexingNodeNotBondedPoolName stores the total balance of not bonded indexing nodes + IndexingNodeNotBondedPoolName = "indexing_node_not_bonded_pool" + // TotalUnIssuedPrepay stores the balance of total unissued prepay + TotalUnissuedPrepayName = "total_unissued_prepay" ) var ( From 3fcd7962ea83b17efe358b8183470e8fdfd6778b Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 20 May 2022 15:04:47 -0400 Subject: [PATCH 062/113] - qb-1165: add TotalReward module acc to utilize withdraw tx (token life cycle) --- x/pot/keeper/distribute.go | 32 ++++++++++++++++++++ x/pot/keeper/withdraw.go | 3 +- x/pot/types/distribute.go | 2 +- x/register/alias.go | 62 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 x/register/alias.go diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 87dfb929..693b7877 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -70,6 +70,12 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single //11, save reported epoch k.SetLastReportedEpoch(ctx, epoch) + //12, [TLC] transfer balance of miningReward&trafficReward pools to totalReward pool, utilized for future Withdraw Tx + err = k.TransferMiningTrafficRewardsToTotalRewards(ctx) + if err != nil { + return totalConsumedOzone, err + } + return totalConsumedOzone, nil } @@ -577,3 +583,29 @@ func (k Keeper) IteratorMatureTotal(ctx sdk.Context, handler func(walletAddress } } } + +func (k Keeper) TransferMiningTrafficRewardsToTotalRewards(ctx sdk.Context) error { + miningRewardAccountAddr := k.AccountKeeper.GetModuleAddress(types.MiningRewardPool) + if miningRewardAccountAddr == nil { + ctx.Logger().Error("mining reward account address of distribution module does not exist.") + return types.ErrUnknownAccountAddress + } + miningRewardPoolBalances := k.BankKeeper.GetAllBalances(ctx, miningRewardAccountAddr) + + trafficRewardAccountAddr := k.AccountKeeper.GetModuleAddress(types.TrafficRewardPool) + if trafficRewardAccountAddr == nil { + ctx.Logger().Error("traffic reward account address of distribution module does not exist.") + return types.ErrUnknownAccountAddress + } + trafficRewardPoolBalances := k.BankKeeper.GetAllBalances(ctx, trafficRewardAccountAddr) + + err := k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.MiningRewardPool, types.TotalRewardPool, miningRewardPoolBalances) + if err != nil { + return err + } + err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.TrafficRewardPool, types.TotalRewardPool, trafficRewardPoolBalances) + if err != nil { + return err + } + return nil +} diff --git a/x/pot/keeper/withdraw.go b/x/pot/keeper/withdraw.go index 3dffd5aa..3459ec53 100644 --- a/x/pot/keeper/withdraw.go +++ b/x/pot/keeper/withdraw.go @@ -10,8 +10,7 @@ func (k Keeper) Withdraw(ctx sdk.Context, amount sdk.Coins, walletAddress sdk.Ac if !matureReward.IsAllGTE(amount) { return types.ErrInsufficientMatureTotal } - //TODO doublecheck logic - err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.FoundationAccount, targetAddress, amount) + err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.TotalRewardPool, targetAddress, amount) if err != nil { return err } diff --git a/x/pot/types/distribute.go b/x/pot/types/distribute.go index 9b599d28..ccd9a0ec 100644 --- a/x/pot/types/distribute.go +++ b/x/pot/types/distribute.go @@ -10,7 +10,7 @@ const ( FoundationAccount = "foundation_account" MiningRewardPool = "mining_reward_pool" TrafficRewardPool = "traffic_reward_pool" - //TotalMinedTokens = "total_mined_tokens" + TotalRewardPool = "total_reward_pool" ) type DistributeGoal struct { diff --git a/x/register/alias.go b/x/register/alias.go new file mode 100644 index 00000000..5ea7a6ba --- /dev/null +++ b/x/register/alias.go @@ -0,0 +1,62 @@ +package register + +import ( + "github.com/stratosnet/stratos-chain/x/register/keeper" + "github.com/stratosnet/stratos-chain/x/register/types" +) + +const ( + DefaultParamSpace = types.DefaultParamSpace + ModuleName = types.ModuleName + StoreKey = types.StoreKey + RouterKey = types.RouterKey + NodeTypeComputation = types.COMPUTATION + NodeTypeDataBase = types.DATABASE + NodeTypeStorage = types.STORAGE +) + +var ( + NewKeeper = keeper.NewKeeper + RegisterCodec = types.RegisterLegacyAminoCodec + + ErrInvalid = types.ErrInvalid + ErrInvalidNetworkAddr = types.ErrInvalidNetworkAddr + ErrEmptyOwnerAddr = types.ErrEmptyOwnerAddr + ErrValueNegative = types.ErrValueNegative + ErrEmptyDescription = types.ErrEmptyDescription + ErrEmptyResourceNodeAddr = types.ErrEmptyResourceNodeAddr + ErrEmptyIndexingNodeAddr = types.ErrEmptyIndexingNodeAddr + ErrBadDenom = types.ErrBadDenom + ErrResourceNodePubKeyExists = types.ErrResourceNodePubKeyExists + ErrIndexingNodePubKeyExists = types.ErrIndexingNodePubKeyExists + ErrNoResourceNodeFound = types.ErrNoResourceNodeFound + ErrNoIndexingNodeFound = types.ErrNoIndexingNodeFound + ErrInvalidOwnerAddr = types.ErrInvalidOwnerAddr + ErrInvalidApproverAddr = types.ErrInvalidVoterAddr + ErrInvalidApproverStatus = types.ErrInvalidVoterStatus + + DefaultParams = types.DefaultParams + DefaultGenesisState = types.DefaultGenesisState + NewGenesisState = types.NewGenesisState + NewResourceNode = types.NewResourceNode + NewIndexingNode = types.NewIndexingNode + NewDescription = types.NewDescription + NewMsgCreateResourceNode = types.NewMsgCreateResourceNode + NewMsgCreateIndexingNode = types.NewMsgCreateIndexingNode + + GetGenesisStateFromAppState = types.GetGenesisStateFromAppState + + NewMultiRegisterHooks = types.NewMultiRegisterHooks +) + +type ( + Keeper = keeper.Keeper + ResourceNode = types.ResourceNode + IndexingNode = types.IndexingNode + Description = types.Description + GenesisIndexingNode = types.GenesisIndexingNode + Slashing = types.Slashing + MsgCreateResourceNode = types.MsgCreateResourceNode + MsgCreateIndexingNode = types.MsgCreateIndexingNode + VoteOpinion = types.VoteOpinion +) From aa79005040d05cbc446536f93d737e4d2a639b11 Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 20 May 2022 15:31:48 -0400 Subject: [PATCH 063/113] - qb-1165: add TotalReward module acc to utilize withdraw tx (token life cycle) --- x/pot/keeper/distribute.go | 10 ++-------- x/pot/types/expected_keepers.go | 2 +- x/register/keeper/slashing.go | 15 ++++++--------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 693b7877..4df611aa 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -297,8 +297,6 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int matureStartEpoch := k.GetLastReportedEpoch(ctx).Int64() + 1 matureEndEpoch := currentEpoch.Int64() - totalDeducted := sdk.Coins{} - for i := matureStartEpoch; i <= matureEndEpoch; i++ { k.IteratorIndividualReward(ctx, sdk.NewInt(i), func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { oldMatureTotal := k.GetMatureTotalReward(ctx, walletAddress) @@ -306,11 +304,9 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int immatureToMature := individualReward.RewardFromMiningPool.Add(individualReward.RewardFromTrafficPool...) //deduct slashing amount from mature total pool - oldMatureTotalSubSlashing, deductedFromMature := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, oldMatureTotal) + oldMatureTotalSubSlashing := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, oldMatureTotal) //deduct slashing amount from upcoming mature reward, don't need to deduct slashing from immatureTotal & individual - immatureToMatureSubSlashing, deductedFromImmatureToMature := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, immatureToMature) - deductedSubtotal := deductedFromMature.Add(deductedFromImmatureToMature...) - totalDeducted = totalDeducted.Add(deductedSubtotal...) + immatureToMatureSubSlashing := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, immatureToMature) matureTotal := oldMatureTotalSubSlashing.Add(immatureToMatureSubSlashing...) immatureTotal := oldImmatureTotal.Sub(immatureToMature) @@ -320,8 +316,6 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int return false }) } - - // TODO deduct totalDeducted from miningRewardPool/trafficRewardPool } // reward will mature 14 days since distribution. Each epoch interval is about 10 minutes. diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 1f5a6fa4..6e7e46f1 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -60,7 +60,7 @@ type RegisterKeeper interface { GetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress) (res sdk.Int) SetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, slashing sdk.Int) - DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) (remaining, deducted sdk.Coins) + DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int) SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int) diff --git a/x/register/keeper/slashing.go b/x/register/keeper/slashing.go index 9eea04a3..47f022f8 100644 --- a/x/register/keeper/slashing.go +++ b/x/register/keeper/slashing.go @@ -6,29 +6,26 @@ import ( ) // DeductSlashing deduct slashing amount from coins, return the coins that after deduction -func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) (remaining, deducted sdk.Coins) { +func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins { slashing := k.GetSlashing(ctx, walletAddress) - remaining = sdk.Coins{} - deducted = sdk.Coins{} if slashing.LTE(sdk.ZeroInt()) || coins.Empty() || coins.IsZero() { - return coins, deducted + return coins } + ret := sdk.Coins{} for _, coin := range coins { if coin.Amount.GTE(slashing) { coin = coin.Sub(sdk.NewCoin(coin.Denom, slashing)) - remaining = remaining.Add(coin) - deducted = deducted.Add(sdk.NewCoin(coin.Denom, slashing)) + ret = ret.Add(coin) slashing = sdk.ZeroInt() } else { slashing = slashing.Sub(coin.Amount) - deducted = deducted.Add(coin) coin = sdk.NewCoin(coin.Denom, sdk.ZeroInt()) - remaining = remaining.Add(coin) + ret = ret.Add(coin) } } k.SetSlashing(ctx, walletAddress, slashing) - return remaining, deducted + return ret } func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, slashing sdk.Int) (stop bool)) { From cac734ca694104a4f8d163b16a89e69427eed668 Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 20 May 2022 15:55:07 -0400 Subject: [PATCH 064/113] - qb-1165: add TotalReward module acc to utilize withdraw tx (token life cycle) --- x/register/keeper/indexing_node.go | 2 +- x/register/keeper/resource_node.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 28251909..0c9a84fe 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -209,7 +209,7 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first - coins, _ = k.DeductSlashing(ctx, ownerAddr, coins) + coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 36ff7bb4..09170750 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -196,7 +196,7 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first - coins, _ = k.DeductSlashing(ctx, ownerAddr, coins) + coins = k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) if err != nil { From 8be9506b4a6d4a529bd22d6520dd4516ad167c79 Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 20 May 2022 19:01:52 -0400 Subject: [PATCH 065/113] - qb-1165: add TotalSlashed module acc for Slashing (token life cycle) --- app/app.go | 1 + x/pot/keeper/distribute.go | 27 ++++-- x/pot/types/expected_keepers.go | 2 +- x/register/keeper/resource_node.go | 128 ++++++++++++++++++++--------- x/register/keeper/slashing.go | 15 ++-- x/register/types/keys.go | 2 + 6 files changed, 123 insertions(+), 52 deletions(-) diff --git a/app/app.go b/app/app.go index db24ba69..00f0fa18 100644 --- a/app/app.go +++ b/app/app.go @@ -163,6 +163,7 @@ var ( registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, registertypes.TotalUnissuedPrepayName: nil, + registertypes.TotalSlashedPoolName: {authtypes.Minter, authtypes.Burner}, pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, pottypes.MiningRewardPool: nil, diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 4df611aa..9aee42d5 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -65,13 +65,13 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single } //10, mature rewards for all nodes - k.rewardMatureAndSubSlashing(ctx, epoch) + totalSlashed := k.rewardMatureAndSubSlashing(ctx, epoch) //11, save reported epoch k.SetLastReportedEpoch(ctx, epoch) - //12, [TLC] transfer balance of miningReward&trafficReward pools to totalReward pool, utilized for future Withdraw Tx - err = k.TransferMiningTrafficRewardsToTotalRewards(ctx) + //12, [TLC] transfer balance of miningReward&trafficReward pools to totalReward&totalSlashed pool, utilized for future Withdraw Tx + err = k.TransferMiningTrafficRewardsToTotalRewards(ctx, totalSlashed) if err != nil { return totalConsumedOzone, err } @@ -292,11 +292,13 @@ func (k Keeper) addNewIndividualAndUpdateImmatureTotal(ctx sdk.Context, account k.SetImmatureTotalReward(ctx, account, newImmatureTotal) } -func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int) { +func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int) (totalSlashed sdk.Coins) { matureStartEpoch := k.GetLastReportedEpoch(ctx).Int64() + 1 matureEndEpoch := currentEpoch.Int64() + totalSlashed = sdk.Coins{} + for i := matureStartEpoch; i <= matureEndEpoch; i++ { k.IteratorIndividualReward(ctx, sdk.NewInt(i), func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { oldMatureTotal := k.GetMatureTotalReward(ctx, walletAddress) @@ -304,9 +306,12 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int immatureToMature := individualReward.RewardFromMiningPool.Add(individualReward.RewardFromTrafficPool...) //deduct slashing amount from mature total pool - oldMatureTotalSubSlashing := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, oldMatureTotal) + oldMatureTotalSubSlashing, deductedFromMature := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, oldMatureTotal) //deduct slashing amount from upcoming mature reward, don't need to deduct slashing from immatureTotal & individual - immatureToMatureSubSlashing := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, immatureToMature) + immatureToMatureSubSlashing, deductedFromImmatureToMature := k.RegisterKeeper.DeductSlashing(ctx, walletAddress, immatureToMature) + + deductedSubtotal := deductedFromMature.Add(deductedFromImmatureToMature...) + totalSlashed = totalSlashed.Add(deductedSubtotal...) matureTotal := oldMatureTotalSubSlashing.Add(immatureToMatureSubSlashing...) immatureTotal := oldImmatureTotal.Sub(immatureToMature) @@ -316,6 +321,7 @@ func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int return false }) } + return totalSlashed } // reward will mature 14 days since distribution. Each epoch interval is about 10 minutes. @@ -578,7 +584,7 @@ func (k Keeper) IteratorMatureTotal(ctx sdk.Context, handler func(walletAddress } } -func (k Keeper) TransferMiningTrafficRewardsToTotalRewards(ctx sdk.Context) error { +func (k Keeper) TransferMiningTrafficRewardsToTotalRewards(ctx sdk.Context, totalSlashed sdk.Coins) error { miningRewardAccountAddr := k.AccountKeeper.GetModuleAddress(types.MiningRewardPool) if miningRewardAccountAddr == nil { ctx.Logger().Error("mining reward account address of distribution module does not exist.") @@ -601,5 +607,12 @@ func (k Keeper) TransferMiningTrafficRewardsToTotalRewards(ctx sdk.Context) erro if err != nil { return err } + + // transfer totalSlashed TODO whether to burn the slashed tokens in TotalSlashedPoolName + err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.TotalRewardPool, regtypes.TotalSlashedPoolName, totalSlashed) + if err != nil { + return err + } + return nil } diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 6e7e46f1..1f5a6fa4 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -60,7 +60,7 @@ type RegisterKeeper interface { GetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress) (res sdk.Int) SetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, slashing sdk.Int) - DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins + DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) (remaining, deducted sdk.Coins) GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int) SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int) diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 09170750..fc39f3f5 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -104,24 +104,31 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc if !hasCoin { return sdk.ZeroInt(), types.ErrInsufficientBalance } - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddr, types.ModuleName, coins) - if err != nil { - return sdk.ZeroInt(), err - } + + targetModuleAccName := "" switch resourceNode.GetStatus() { case stakingtypes.Unbonded: - notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) - notBondedTokenInPool = notBondedTokenInPool.Add(tokenToAdd) - k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) + targetModuleAccName = types.ResourceNodeNotBondedPoolName + //notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) + //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToAdd) + //k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) case stakingtypes.Bonded: - bondedTokenInPool := k.GetResourceNodeBondedToken(ctx) - bondedTokenInPool = bondedTokenInPool.Add(tokenToAdd) - k.SetResourceNodeBondedToken(ctx, bondedTokenInPool) + targetModuleAccName = types.ResourceNodeBondedPoolName + //bondedTokenInPool := k.GetResourceNodeBondedToken(ctx) + //bondedTokenInPool = bondedTokenInPool.Add(tokenToAdd) + //k.SetResourceNodeBondedToken(ctx, bondedTokenInPool) case stakingtypes.Unbonding: return sdk.ZeroInt(), types.ErrUnbondingNode } + if len(targetModuleAccName) > 0 { + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddr, targetModuleAccName, coins) + if err != nil { + return sdk.ZeroInt(), err + } + } + resourceNode = resourceNode.AddToken(tokenToAdd.Amount) //resourceNode.Suspend = false @@ -130,17 +137,32 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc if resourceNode.Status == stakingtypes.Unbonded { resourceNode.Status = stakingtypes.Bonded - tokenToBond := sdk.NewCoin(k.BondDenom(ctx), resourceNode.Tokens) - notBondedToken := k.GetResourceNodeNotBondedToken(ctx) - bondedToken := k.GetResourceNodeBondedToken(ctx) + tokenToTrasfer := sdk.NewCoin(k.BondDenom(ctx), resourceNode.Tokens) + nBondedResourceAccountAddr := k.accountKeeper.GetModuleAddress(types.ResourceNodeNotBondedPoolName) + if nBondedResourceAccountAddr == nil { + ctx.Logger().Error("not bonded account address for resource nodes does not exist.") + return sdk.ZeroInt(), types.ErrUnknownAccountAddress + } + + hasCoin := k.bankKeeper.HasBalance(ctx, nBondedResourceAccountAddr, tokenToTrasfer) + if !hasCoin { + return sdk.ZeroInt(), types.ErrInsufficientBalance + } - if notBondedToken.IsLT(tokenToBond) { - return sdk.ZeroInt(), types.ErrInsufficientBalanceOfNotBondedPool + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ResourceNodeNotBondedPoolName, types.ResourceNodeBondedPoolName, sdk.NewCoins(tokenToTrasfer)) + if err != nil { + return sdk.ZeroInt(), types.ErrInsufficientBalance } - notBondedToken = notBondedToken.Sub(tokenToBond) - bondedToken = bondedToken.Add(tokenToBond) - k.SetResourceNodeNotBondedToken(ctx, notBondedToken) - k.SetResourceNodeBondedToken(ctx, bondedToken) + //notBondedToken := k.GetResourceNodeNotBondedToken(ctx) + //bondedToken := k.GetResourceNodeBondedToken(ctx) + // + //if notBondedToken.IsLT(tokenToBond) { + // return sdk.ZeroInt(), types.ErrInsufficientBalanceOfNotBondedPool + //} + //notBondedToken = notBondedToken.Sub(tokenToBond) + //bondedToken = bondedToken.Add(tokenToBond) + //k.SetResourceNodeNotBondedToken(ctx, notBondedToken) + //k.SetResourceNodeBondedToken(ctx, bondedToken) } k.SetResourceNode(ctx, resourceNode) @@ -150,18 +172,34 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc } func (k Keeper) RemoveTokenFromPoolWhileUnbondingResourceNode(ctx sdk.Context, resourceNode types.ResourceNode, tokenToSub sdk.Coin) error { - // get pools - bondedTokenInPool := k.GetResourceNodeBondedToken(ctx) - notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) - if bondedTokenInPool.IsLT(tokenToSub) { - return types.ErrInsufficientBalanceOfBondedPool - } - // remove token from BondedPool - bondedTokenInPool = bondedTokenInPool.Sub(tokenToSub) - k.SetResourceNodeBondedToken(ctx, bondedTokenInPool) - // add token into NotBondedPool - notBondedTokenInPool = notBondedTokenInPool.Add(tokenToSub) - k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) + bondedResourceAccountAddr := k.accountKeeper.GetModuleAddress(types.ResourceNodeBondedPoolName) + if bondedResourceAccountAddr == nil { + ctx.Logger().Error("bonded pool account address for resource nodes does not exist.") + return types.ErrUnknownAccountAddress + } + + hasCoin := k.bankKeeper.HasBalance(ctx, bondedResourceAccountAddr, tokenToSub) + if !hasCoin { + return types.ErrInsufficientBalance + } + + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ResourceNodeBondedPoolName, types.ResourceNodeNotBondedPoolName, sdk.NewCoins(tokenToSub)) + if err != nil { + return types.ErrInsufficientBalance + } + + //// get pools + //bondedTokenInPool := k.GetResourceNodeBondedToken(ctx) + //notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) + //if bondedTokenInPool.IsLT(tokenToSub) { + // return types.ErrInsufficientBalanceOfBondedPool + //} + //// remove token from BondedPool + //bondedTokenInPool = bondedTokenInPool.Sub(tokenToSub) + //k.SetResourceNodeBondedToken(ctx, bondedTokenInPool) + //// add token into NotBondedPool + //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToSub) + //k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) return nil } @@ -188,17 +226,31 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re } // deduct tokens from NotBondedPool - notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) - if notBondedTokenInPool.IsLT(tokenToSub) { - return types.ErrInsufficientBalanceOfNotBondedPool + nBondedResourceAccountAddr := k.accountKeeper.GetModuleAddress(types.ResourceNodeNotBondedPoolName) + if nBondedResourceAccountAddr == nil { + ctx.Logger().Error("not bonded account address for resource nodes does not exist.") + return types.ErrUnknownAccountAddress } - notBondedTokenInPool = notBondedTokenInPool.Sub(tokenToSub) - k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) + + hasCoin := k.bankKeeper.HasBalance(ctx, nBondedResourceAccountAddr, tokenToSub) + if !hasCoin { + return types.ErrInsufficientBalance + } + //notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) + //if notBondedTokenInPool.IsLT(tokenToSub) { + // return types.ErrInsufficientBalanceOfNotBondedPool + //} + //notBondedTokenInPool = notBondedTokenInPool.Sub(tokenToSub) + //k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first - coins = k.DeductSlashing(ctx, ownerAddr, coins) + coins, slashed := k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ResourceNodeNotBondedPoolName, ownerAddr, coins) + if err != nil { + return err + } + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ResourceNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) if err != nil { return err } diff --git a/x/register/keeper/slashing.go b/x/register/keeper/slashing.go index 47f022f8..9eea04a3 100644 --- a/x/register/keeper/slashing.go +++ b/x/register/keeper/slashing.go @@ -6,26 +6,29 @@ import ( ) // DeductSlashing deduct slashing amount from coins, return the coins that after deduction -func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins { +func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) (remaining, deducted sdk.Coins) { slashing := k.GetSlashing(ctx, walletAddress) + remaining = sdk.Coins{} + deducted = sdk.Coins{} if slashing.LTE(sdk.ZeroInt()) || coins.Empty() || coins.IsZero() { - return coins + return coins, deducted } - ret := sdk.Coins{} for _, coin := range coins { if coin.Amount.GTE(slashing) { coin = coin.Sub(sdk.NewCoin(coin.Denom, slashing)) - ret = ret.Add(coin) + remaining = remaining.Add(coin) + deducted = deducted.Add(sdk.NewCoin(coin.Denom, slashing)) slashing = sdk.ZeroInt() } else { slashing = slashing.Sub(coin.Amount) + deducted = deducted.Add(coin) coin = sdk.NewCoin(coin.Denom, sdk.ZeroInt()) - ret = ret.Add(coin) + remaining = remaining.Add(coin) } } k.SetSlashing(ctx, walletAddress, slashing) - return ret + return remaining, deducted } func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, slashing sdk.Int) (stop bool)) { diff --git a/x/register/types/keys.go b/x/register/types/keys.go index a6e39301..d0f37fef 100644 --- a/x/register/types/keys.go +++ b/x/register/types/keys.go @@ -31,6 +31,8 @@ const ( IndexingNodeNotBondedPoolName = "indexing_node_not_bonded_pool" // TotalUnIssuedPrepay stores the balance of total unissued prepay TotalUnissuedPrepayName = "total_unissued_prepay" + // TotalUnIssuedPrepay stores the balance of total unissued prepay + TotalSlashedPoolName = "total_slashed_pool" ) var ( From 22bf294b82490e146089301292f24cd11bab6c64 Mon Sep 17 00:00:00 2001 From: jialbai Date: Tue, 24 May 2022 11:53:25 -0400 Subject: [PATCH 066/113] - qb-1165: add token life cycle logic in register module --- x/register/keeper/indexing_node.go | 124 +++++++++++++++++++++-------- x/register/keeper/resource_node.go | 4 +- 2 files changed, 93 insertions(+), 35 deletions(-) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 0c9a84fe..a046f7c8 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -142,21 +142,31 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin return sdk.ZeroInt(), err } - indexingNode = indexingNode.AddToken(tokenToAdd.Amount) + targetModuleAccName := "" switch indexingNode.GetStatus() { case stakingtypes.Unbonded: - notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) - notBondedTokenInPool = notBondedTokenInPool.Add(tokenToAdd) - k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) + targetModuleAccName = types.IndexingNodeNotBondedPoolName + //notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) + //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToAdd) + //k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) case stakingtypes.Bonded: - bondedTokenInPool := k.GetIndexingNodeBondedToken(ctx) - bondedTokenInPool = bondedTokenInPool.Add(tokenToAdd) - k.SetIndexingNodeBondedToken(ctx, bondedTokenInPool) + targetModuleAccName = types.IndexingNodeBondedPoolName + //bondedTokenInPool := k.GetIndexingNodeBondedToken(ctx) + //bondedTokenInPool = bondedTokenInPool.Add(tokenToAdd) + //k.SetIndexingNodeBondedToken(ctx, bondedTokenInPool) case stakingtypes.Unbonding: return sdk.ZeroInt(), types.ErrUnbondingNode } + if len(targetModuleAccName) > 0 { + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddr, targetModuleAccName, coins) + if err != nil { + return sdk.ZeroInt(), err + } + } + + indexingNode = indexingNode.AddToken(tokenToAdd.Amount) k.SetIndexingNode(ctx, indexingNode) ozoneLimitChange = k.increaseOzoneLimitByAddStake(ctx, tokenToAdd.Amount) @@ -164,18 +174,34 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin } func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - // get pools - bondedTokenInPool := k.GetIndexingNodeBondedToken(ctx) - notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) - if bondedTokenInPool.IsLT(tokenToSub) { - return types.ErrInsufficientBalanceOfBondedPool - } - // remove token from BondedPool - bondedTokenInPool = bondedTokenInPool.Sub(tokenToSub) - k.SetIndexingNodeBondedToken(ctx, bondedTokenInPool) - // add token into NotBondedPool - notBondedTokenInPool = notBondedTokenInPool.Add(tokenToSub) - k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) + bondedIndexingAccountAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeBondedPoolName) + if bondedIndexingAccountAddr == nil { + ctx.Logger().Error("bonded pool account address for indexing nodes does not exist.") + return types.ErrUnknownAccountAddress + } + + hasCoin := k.bankKeeper.HasBalance(ctx, bondedIndexingAccountAddr, tokenToSub) + if !hasCoin { + return types.ErrInsufficientBalance + } + + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.IndexingNodeBondedPoolName, types.IndexingNodeNotBondedPoolName, sdk.NewCoins(tokenToSub)) + if err != nil { + return types.ErrInsufficientBalance + } + + //// get pools + //bondedTokenInPool := k.GetIndexingNodeBondedToken(ctx) + //notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) + //if bondedTokenInPool.IsLT(tokenToSub) { + // return types.ErrInsufficientBalanceOfBondedPool + //} + //// remove token from BondedPool + //bondedTokenInPool = bondedTokenInPool.Sub(tokenToSub) + //k.SetIndexingNodeBondedToken(ctx, bondedTokenInPool) + //// add token into NotBondedPool + //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToSub) + //k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) return nil } @@ -201,17 +227,31 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In } // deduct tokens from NotBondedPool - notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) - if notBondedTokenInPool.IsLT(tokenToSub) { + nBondedIndexingAccountAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) + if nBondedIndexingAccountAddr == nil { + ctx.Logger().Error("not bonded account address for indexing nodes does not exist.") + return types.ErrUnknownAccountAddress + } + + hasCoin := k.bankKeeper.HasBalance(ctx, nBondedIndexingAccountAddr, tokenToSub) + if !hasCoin { return types.ErrInsufficientBalanceOfNotBondedPool } - notBondedTokenInPool = notBondedTokenInPool.Sub(tokenToSub) - k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) + //notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) + //if notBondedTokenInPool.IsLT(tokenToSub) { + // return types.ErrInsufficientBalanceOfNotBondedPool + //} + //notBondedTokenInPool = notBondedTokenInPool.Sub(tokenToSub) + //k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) - // deduct slashing amount first - coins = k.DeductSlashing(ctx, ownerAddr, coins) + // deduct slashing amount first, slashed amt goes into TotalSlashedPool + coins, slashed := k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddr, coins) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.IndexingNodeNotBondedPoolName, ownerAddr, coins) + if err != nil { + return err + } + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.IndexingNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) if err != nil { return err } @@ -328,16 +368,34 @@ func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr // move stake from not bonded pool to bonded pool tokenToBond := sdk.NewCoin(k.BondDenom(ctx), node.Tokens) - notBondedToken := k.GetIndexingNodeNotBondedToken(ctx) - bondedToken := k.GetIndexingNodeBondedToken(ctx) - if notBondedToken.IsLT(tokenToBond) { + // sub coins from not bonded pool + nBondedIndexingAccountAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) + if nBondedIndexingAccountAddr == nil { + ctx.Logger().Error("not bonded account address for indexing nodes does not exist.") + return node.Status, types.ErrUnknownAccountAddress + } + + hasCoin := k.bankKeeper.HasBalance(ctx, nBondedIndexingAccountAddr, tokenToBond) + if !hasCoin { return node.Status, types.ErrInsufficientBalance } - notBondedToken = notBondedToken.Sub(tokenToBond) - bondedToken = bondedToken.Add(tokenToBond) - k.SetIndexingNodeNotBondedToken(ctx, notBondedToken) - k.SetIndexingNodeBondedToken(ctx, bondedToken) + + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.IndexingNodeNotBondedPoolName, types.IndexingNodeBondedPoolName, sdk.NewCoins(tokenToBond)) + if err != nil { + return node.Status, err + } + + //notBondedToken := k.GetIndexingNodeNotBondedToken(ctx) + //bondedToken := k.GetIndexingNodeBondedToken(ctx) + // + //if notBondedToken.IsLT(tokenToBond) { + // return node.Status, types.ErrInsufficientBalance + //} + //notBondedToken = notBondedToken.Sub(tokenToBond) + //bondedToken = bondedToken.Add(tokenToBond) + //k.SetIndexingNodeNotBondedToken(ctx, notBondedToken) + //k.SetIndexingNodeBondedToken(ctx, bondedToken) } return node.Status, nil diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index fc39f3f5..cb858fc6 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -234,7 +234,7 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re hasCoin := k.bankKeeper.HasBalance(ctx, nBondedResourceAccountAddr, tokenToSub) if !hasCoin { - return types.ErrInsufficientBalance + return types.ErrInsufficientBalanceOfNotBondedPool } //notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) //if notBondedTokenInPool.IsLT(tokenToSub) { @@ -243,7 +243,7 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re //notBondedTokenInPool = notBondedTokenInPool.Sub(tokenToSub) //k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) - // deduct slashing amount first + // deduct slashing amount first, slashed amt goes into TotalSlashedPool coins, slashed := k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ResourceNodeNotBondedPoolName, ownerAddr, coins) From 922d13b49766016eaf33c937d2148c2073ddebe0 Mon Sep 17 00:00:00 2001 From: Xiong Date: Tue, 24 May 2022 13:02:02 -0400 Subject: [PATCH 067/113] bug fix --- cmd/stchaind/gen_idx_nodes.go | 329 +++++++++++++++++----------------- cmd/stchaind/root.go | 2 +- 2 files changed, 170 insertions(+), 161 deletions(-) diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index ad43d8ee..9bac6c89 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -1,162 +1,171 @@ package main -//import ( -// "encoding/json" -// "fmt" -// "io/ioutil" -// "os" -// "path/filepath" -// -// "github.com/cosmos/cosmos-sdk/client/flags" -// "github.com/cosmos/cosmos-sdk/codec" -// "github.com/cosmos/cosmos-sdk/server" -// "github.com/cosmos/cosmos-sdk/types/errors" -// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" -// "github.com/cosmos/cosmos-sdk/x/genutil" -// "github.com/spf13/cobra" -// "github.com/spf13/viper" -// "github.com/stratosnet/stratos-chain/x/register" -// "github.com/tendermint/tendermint/libs/cli" -// tmtypes "github.com/tendermint/tendermint/types" -//) -// -//const ( -// defaultDemon = "ustos" -// flagGenIdxNodeDir = "gen-idx-node-dir" -//) -// -//// GenesisAccountsIterator defines the expected iterating genesis accounts object -//type GenesisAccountsIterator interface { -// IterateGenesisAccounts( -// cdc *codec.Codec, -// appGenesis map[string]json.RawMessage, -// iterateFn func(authexported.Account) (stop bool), -// ) -//} -// -//func getIndexingNodeInfoFromFile(cdc *codec.Codec, genIdxNodesDir string, genDoc tmtypes.GenesisDoc, genAccIterator GenesisAccountsIterator, -//) (appGenIdxNodes []register.IndexingNode, err error) { -// var fos []os.FileInfo -// fos, err = ioutil.ReadDir(genIdxNodesDir) -// if err != nil { -// return appGenIdxNodes, err -// } -// -// var appState map[string]json.RawMessage -// if err := cdc.UnmarshalJSON(genDoc.AppState, &appState); err != nil { -// return appGenIdxNodes, err -// } -// -// addrMap := make(map[string]authexported.Account) -// genAccIterator.IterateGenesisAccounts(cdc, appState, -// func(acc authexported.Account) (stop bool) { -// addrMap[acc.GetAddress().String()] = acc -// return false -// }, -// ) -// -// for _, fo := range fos { -// filename := filepath.Join(genIdxNodesDir, fo.Name()) -// if !fo.IsDir() && (filepath.Ext(filename) != ".json") { -// continue -// } -// -// // get the node info -// var jsonRawIdxNode []byte -// if jsonRawIdxNode, err = ioutil.ReadFile(filename); err != nil { -// return appGenIdxNodes, err -// } -// -// var genIdxNode register.GenesisIndexingNode -// if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { -// return appGenIdxNodes, err -// } -// -// indexingNode := genIdxNode.ToIndexingNode() -// appGenIdxNodes = append(appGenIdxNodes, indexingNode) -// -// ownerAddrStr := indexingNode.GetOwnerAddr().String() -// ownerAccount, ownerOk := addrMap[ownerAddrStr] -// if !ownerOk { -// return appGenIdxNodes, fmt.Errorf( -// "account %v not in genesis.json: %+v", ownerAccount, addrMap) -// } -// -// if ownerAccount.GetCoins().AmountOf(defaultDemon).LT(indexingNode.GetTokens()) { -// return appGenIdxNodes, fmt.Errorf( -// "insufficient fund for delegation %v: %v < %v", -// ownerAccount.GetAddress(), ownerAccount.GetCoins().AmountOf(defaultDemon), indexingNode.GetTokens(), -// ) -// } -// fmt.Println("Add indexing node: " + indexingNode.NetworkAddr.String() + " success.") -// } -// -// return appGenIdxNodes, nil -//} -// -//// AddGenesisIndexingNodeCmd returns add-genesis-indexing-node cobra Command. -//func AddGenesisIndexingNodeCmd( -// ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, genAccIterator GenesisAccountsIterator, -//) *cobra.Command { -// -// cmd := &cobra.Command{ -// Use: "add-genesis-indexing-node", -// Short: "Add a genesis indexing node to genesis.json", -// Long: `Add a genesis indexing node to genesis.json. If a node name is given, -//the address will be looked up in the local Keybase. -//`, -// Args: cobra.ExactArgs(0), -// RunE: func(cmd *cobra.Command, args []string) error { -// config := ctx.Config -// config.SetRoot(viper.GetString(cli.HomeFlag)) -// -// genDoc, err := tmtypes.GenesisDocFromFile(config.GenesisFile()) -// if err != nil { -// return errors.Wrap(err, "failed to read genesis doc from file") -// } -// -// genIdxNodesDir := viper.GetString(flagGenIdxNodeDir) -// if genIdxNodesDir == "" { -// genIdxNodesDir = filepath.Join(config.RootDir, "config", "genidxnodes") -// } -// -// appIdxNodes, err := getIndexingNodeInfoFromFile(cdc, genIdxNodesDir, *genDoc, genAccIterator) -// if err != nil { -// return fmt.Errorf("failed to get indexing node from file: %w", err) -// } -// -// genFile := config.GenesisFile() -// appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) -// if err != nil { -// return fmt.Errorf("failed to unmarshal genesis state: %w", err) -// } -// -// registerGenState := register.GetGenesisStateFromAppState(cdc, appState) -// -// for _, appIdxNode := range appIdxNodes { -// registerGenState.IndexingNodes = append(registerGenState.IndexingNodes, appIdxNode) -// } -// -// registerGenStateBz, err := cdc.MarshalJSON(registerGenState) -// if err != nil { -// return fmt.Errorf("failed to marshal register genesis state: %w", err) -// } -// -// appState[register.ModuleName] = registerGenStateBz -// -// appStateJSON, err := cdc.MarshalJSON(appState) -// if err != nil { -// return fmt.Errorf("failed to marshal application genesis state: %w", err) -// } -// -// genDoc.AppState = appStateJSON -// return genutil.ExportGenesisFile(genDoc, genFile) -// }, -// } -// -// cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") -// cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") -// cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") -// cmd.Flags().String(flagGenIdxNodeDir, "", "directory of genesis indexing nodes info") -// return cmd -//} +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/x/bank/exported" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/tendermint/tendermint/libs/cli" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" +) + +const ( + defaultDemon = "ustos" + flagGenIdxNodeDir = "gen-idx-node-dir" +) + +// AddGenesisIndexingNodeCmd returns add-genesis-indexing-node cobra Command. +func AddGenesisIndexingNodeCmd( + genBalancesIterator genutiltypes.GenesisBalancesIterator, + defaultNodeHome string, +) *cobra.Command { + + cmd := &cobra.Command{ + Use: "add-genesis-indexing-node", + Short: "Add a genesis indexing node to genesis.json", + Long: `Add a genesis indexing node to genesis.json. If a node name is given, +the address will be looked up in the local Keybase. +`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + config.SetRoot(clientCtx.HomeDir) + + genIdxNodesDir := viper.GetString(flagGenIdxNodeDir) + if genIdxNodesDir == "" { + genIdxNodesDir = filepath.Join(config.RootDir, "config", "genidxnodes") + } + + genDoc, err := tmtypes.GenesisDocFromFile(config.GenesisFile()) + if err != nil { + return errors.Wrap(err, "failed to read genesis doc from file") + } + + appIdxNodes, err := getIndexingNodeInfoFromFile(clientCtx.Codec, genIdxNodesDir, *genDoc, genBalancesIterator) + if err != nil { + return fmt.Errorf("failed to get indexing node from file: %w", err) + } + + genFile := config.GenesisFile() + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + if err != nil { + return fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + registerGenState := registertypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) + + for _, appIdxNode := range appIdxNodes { + registerGenState.IndexingNodes.IndexingNodes = append(registerGenState.IndexingNodes.IndexingNodes, &appIdxNode) + } + + registerGenStateBz, err := clientCtx.Codec.MarshalJSON(®isterGenState) + if err != nil { + return fmt.Errorf("failed to marshal register genesis state: %w", err) + } + + appState[registertypes.ModuleName] = registerGenStateBz + + appStateJSON, err := json.Marshal(appState) + if err != nil { + return fmt.Errorf("failed to marshal application genesis state: %w", err) + } + + genDoc.AppState = appStateJSON + return genutil.ExportGenesisFile(genDoc, genFile) + }, + } + + cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") + cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") + cmd.Flags().String(flagGenIdxNodeDir, "", "directory of genesis indexing nodes info") + return cmd +} + +func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc tmtypes.GenesisDoc, genBalanceIterator genutiltypes.GenesisBalancesIterator, +) (appGenIdxNodes []registertypes.IndexingNode, err error) { + var fos []os.FileInfo + fos, err = ioutil.ReadDir(genIdxNodesDir) + if err != nil { + return appGenIdxNodes, err + } + + var appState map[string]json.RawMessage + + if err := cdc.UnmarshalInterfaceJSON(genDoc.AppState, &appState); err != nil { + println("aaaaaaaaaaaaaaaaaaaaaaa") + return appGenIdxNodes, err + } + + balanceMap := make(map[string]exported.GenesisBalance) + //addrMap := make(map[string]authtypes.AccountI) + //genAccIterator.IterateGenesisAccounts(cdc, appState, + // func(acc authtypes.AccountI) (stop bool) { + // addrMap[acc.GetAddress().String()] = acc + // return false + // }, + //) + + genBalanceIterator.IterateGenesisBalances(cdc, appState, + func(balance exported.GenesisBalance) (stop bool) { + balanceMap[balance.GetAddress().String()] = balance + return false + }, + ) + + for _, fo := range fos { + filename := filepath.Join(genIdxNodesDir, fo.Name()) + if !fo.IsDir() && (filepath.Ext(filename) != ".json") { + continue + } + + // get the node info + var jsonRawIdxNode []byte + if jsonRawIdxNode, err = ioutil.ReadFile(filename); err != nil { + return appGenIdxNodes, err + } + + var genIdxNode registertypes.GenesisIndexingNode + if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { + return appGenIdxNodes, err + } + + indexingNode := genIdxNode.ToIndexingNode() + appGenIdxNodes = append(appGenIdxNodes, indexingNode) + + ownerAddrStr := indexingNode.GetOwnerAddress() + ownerBalance, ok := balanceMap[ownerAddrStr] + if !ok { + return appGenIdxNodes, fmt.Errorf( + "account %v not in genesis.json: %+v", ownerAddrStr, balanceMap) + } + + if ownerBalance.GetCoins().AmountOf(defaultDemon).LT(indexingNode.Tokens) { + return appGenIdxNodes, fmt.Errorf( + "insufficient fund for delegation %v: %v < %v", + ownerBalance.GetAddress(), ownerBalance.GetCoins().AmountOf(defaultDemon), indexingNode.Tokens, + ) + } + + fmt.Println("Add indexing node: " + indexingNode.GetNetworkAddr() + " success.") + } + + return appGenIdxNodes, nil +} diff --git a/cmd/stchaind/root.go b/cmd/stchaind/root.go index b7643b11..871660bb 100644 --- a/cmd/stchaind/root.go +++ b/cmd/stchaind/root.go @@ -105,8 +105,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.ValidateGenesisCmd(app.ModuleBasics), AddGenesisAccountCmd(app.DefaultNodeHome), + AddGenesisIndexingNodeCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), //TODO: fix these cmds - //AddGenesisIndexingNodeCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome, banktypes.GenesisBalancesIterator{}), //LoadTestCommands(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome), tmcli.NewCompletionCmd(rootCmd, true), //testnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}), From 2818636384f61bea7edb3e00a74fe9a3e004efa5 Mon Sep 17 00:00:00 2001 From: jialbai Date: Tue, 24 May 2022 15:24:05 -0400 Subject: [PATCH 068/113] - qb-1165: add token life cycle logic in sds module --- app/app.go | 2 +- x/pot/keeper/incentive_testnet_distribute.go | 11 +++- x/pot/types/expected_keepers.go | 3 +- x/register/genesis.go | 2 +- x/register/keeper/keeper.go | 62 ++++++++++++++++---- x/register/types/errors.go | 2 + x/sds/keeper/keeper.go | 28 +++++---- 7 files changed, 82 insertions(+), 28 deletions(-) diff --git a/app/app.go b/app/app.go index 00f0fa18..9cc75a70 100644 --- a/app/app.go +++ b/app/app.go @@ -162,7 +162,7 @@ var ( registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.TotalUnissuedPrepayName: nil, + registertypes.TotalUnissuedPrepayName: {authtypes.Minter}, registertypes.TotalSlashedPoolName: {authtypes.Minter, authtypes.Burner}, pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, diff --git a/x/pot/keeper/incentive_testnet_distribute.go b/x/pot/keeper/incentive_testnet_distribute.go index f2aec944..e4f176dd 100644 --- a/x/pot/keeper/incentive_testnet_distribute.go +++ b/x/pot/keeper/incentive_testnet_distribute.go @@ -371,9 +371,14 @@ func (k Keeper) returnBalanceForTestnet(ctx sdk.Context, goal types.DistributeGo k.setMinedTokens(ctx, epoch, newMinedToken) // return balance to prepay pool - totalUnIssuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) - newTotalUnIssuedPrePay := totalUnIssuedPrepay.Add(balanceOfTrafficPool) - k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) + // [TLC][TrafficRewardPool -> TotalUnIssuedPrepay] + err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.TrafficRewardPool, regtypes.TotalUnissuedPrepayName, sdk.NewCoins(balanceOfTrafficPool)) + if err != nil { + return err + } + //totalUnIssuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) + //newTotalUnIssuedPrePay := totalUnIssuedPrepay.Add(balanceOfTrafficPool) + //k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) return nil } diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 1f5a6fa4..76751014 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -65,7 +65,8 @@ type RegisterKeeper interface { GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int) SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk.Coin) - SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) + SendCoinsFromAccount2TotalUnissuedPrepayPool(ctx sdk.Context, fromWallet sdk.AccAddress, coinToSend sdk.Coin) error + //SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) diff --git a/x/register/genesis.go b/x/register/genesis.go index d7569516..25570532 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -48,7 +48,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetInitialUOzonePrice(ctx, initialUOzonePrice) initOzoneLimit := initialStakeTotal.Add(totalUnissuedPrepay).ToDec().Quo(initialUOzonePrice).TruncateInt() keeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) - keeper.SetTotalUnissuedPrepay(ctx, sdk.Coin{ + keeper.MintTotalUnissuedPrepayPool(ctx, sdk.Coin{ Denom: data.Params.BondDenom, Amount: totalUnissuedPrepay, }) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 843afc9c..b64a128b 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -12,6 +12,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" + regtypes "github.com/stratosnet/stratos-chain/x/register/types" "github.com/tendermint/tendermint/libs/log" ) @@ -79,20 +80,61 @@ func (k Keeper) GetInitialUOzonePrice(ctx sdk.Context) (price sdk.Dec) { return } -func (k Keeper) SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) { - store := ctx.KVStore(k.storeKey) - b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) - store.Set(types.TotalUnissuedPrepayKey, b) +// SetTotalUnissuedPrepay is deprecated after starting to use TotalUnissuedPrepay module acc +//func (k Keeper) SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) { +// store := ctx.KVStore(k.storeKey) +// b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) +// store.Set(types.TotalUnissuedPrepayKey, b) +//} +func (k Keeper) MintTotalUnissuedPrepayPool(ctx sdk.Context, initialCoins sdk.Coin) error { + totalUnissuedPrepayAcc := k.accountKeeper.GetModuleAddress(types.TotalUnissuedPrepayName) + if totalUnissuedPrepayAcc == nil { + return types.ErrUnknownAccountAddress + } + hasCoin := k.bankKeeper.GetBalance(ctx, totalUnissuedPrepayAcc, k.BondDenom(ctx)) + // can only mint when balance is 0 TODO To be tested + if hasCoin.Amount.GT(sdk.ZeroInt()) { + return types.ErrInitialBalanceNotZero + } + return k.bankKeeper.MintCoins(ctx, types.TotalUnissuedPrepayName, sdk.NewCoins(initialCoins)) + //store := ctx.KVStore(k.storeKey) + //b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) + //store.Set(types.TotalUnissuedPrepayKey, b) +} + +func (k Keeper) SendCoinsFromAccount2TotalUnissuedPrepayPool(ctx sdk.Context, fromWallet sdk.AccAddress, coinToSend sdk.Coin) error { + fromAcc := k.accountKeeper.GetAccount(ctx, fromWallet) + if fromAcc == nil { + return types.ErrUnknownAccountAddress + } + hasCoin := k.bankKeeper.HasBalance(ctx, fromWallet, coinToSend) + if !hasCoin { + return types.ErrInsufficientBalance + } + return k.bankKeeper.SendCoinsFromAccountToModule(ctx, fromWallet, types.TotalUnissuedPrepayName, sdk.NewCoins(coinToSend)) + + //store := ctx.KVStore(k.storeKey) + //b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) + //store.Set(types.TotalUnissuedPrepayKey, b) } func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk.Coin) { - store := ctx.KVStore(k.storeKey) - b := store.Get(types.TotalUnissuedPrepayKey) - if b == nil { - return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + totalUnissuedPrepayAccAddr := k.accountKeeper.GetModuleAddress(regtypes.TotalUnissuedPrepayName) + if totalUnissuedPrepayAccAddr == nil { + ctx.Logger().Error("account address for total unissued prepay does not exist.") + return sdk.Coin{ + Denom: types.DefaultBondDenom, + Amount: sdk.ZeroInt(), + } } - types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &totalUnissuedPrepay) - return + return k.bankKeeper.GetBalance(ctx, totalUnissuedPrepayAccAddr, types.DefaultBondDenom) + //store := ctx.KVStore(k.storeKey) + //b := store.Get(types.TotalUnissuedPrepayKey) + //if b == nil { + // return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + //} + //types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &totalUnissuedPrepay) + //return } func (k Keeper) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) { diff --git a/x/register/types/errors.go b/x/register/types/errors.go index a9da1107..2a0ae07a 100644 --- a/x/register/types/errors.go +++ b/x/register/types/errors.go @@ -51,6 +51,7 @@ const ( codeErrUnknownAccountAddress codeErrUnknownPubKey codeErrNoNodeFound + codeErrInitialBalanceNotZero ) var ( @@ -100,4 +101,5 @@ var ( ErrUnknownAccountAddress = sdkerrors.Register(ModuleName, codeErrUnknownAccountAddress, "account address does not exist") ErrUnknownPubKey = sdkerrors.Register(ModuleName, codeErrUnknownPubKey, "unknown pubKey ") ErrNoNodeFound = sdkerrors.Register(ModuleName, codeErrNoNodeFound, "node does not exist ") + ErrInitialBalanceNotZero = sdkerrors.Register(ModuleName, codeErrInitialBalanceNotZero, "initial balance isn't zero ") ) diff --git a/x/sds/keeper/keeper.go b/x/sds/keeper/keeper.go index 1f5571dc..cd623964 100644 --- a/x/sds/keeper/keeper.go +++ b/x/sds/keeper/keeper.go @@ -79,7 +79,7 @@ func (k Keeper) SetFileHash(ctx sdk.Context, fileHash []byte, fileInfo types.Fil // The remaining total Ozone limit [Lt] is the upper bound of the total Ozone that users can purchase from the Stratos blockchain. // [X] is the total amount of STOS token prepaid by user at time t // the total amount of Ozone the user gets = Lt * X / (S + Pt + X) -func (k Keeper) purchaseUoz(ctx sdk.Context, amount sdk.Int) sdk.Int { +func (k Keeper) purchaseUozAndSubCoins(ctx sdk.Context, from sdk.AccAddress, amount sdk.Int) sdk.Int { S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx) Pt := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx).Amount Lt := k.RegisterKeeper.GetRemainingOzoneLimit(ctx) @@ -91,9 +91,13 @@ func (k Keeper) purchaseUoz(ctx sdk.Context, amount sdk.Int) sdk.Int { Add(amount)).ToDec()). TruncateInt() - // update total unissued prepay - newTotalUnissuedPrepay := Pt.Add(amount) - k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, sdk.NewCoin(k.BondDenom(ctx), newTotalUnissuedPrepay)) + // send coins to total unissued prepay pool + err := k.RegisterKeeper.SendCoinsFromAccount2TotalUnissuedPrepayPool(ctx, from, sdk.NewCoin(k.BondDenom(ctx), amount)) + if err != nil { + return sdk.ZeroInt() + } + //newTotalUnissuedPrepay := Pt.Add(amount) + //k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, sdk.NewCoin(k.BondDenom(ctx), newTotalUnissuedPrepay)) // update remaining uoz limit newRemainingOzoneLimit := Lt.Sub(purchased) @@ -128,24 +132,24 @@ func (k Keeper) Prepay(ctx sdk.Context, sender sdk.AccAddress, coins sdk.Coins) } } + prepay := coins.AmountOf(k.BondDenom(ctx)) + purchased := k.purchaseUozAndSubCoins(ctx, sender, prepay) + err := k.doPrepay(ctx, sender, coins) if err != nil { return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "Failed prepay from acc %s", hex.EncodeToString(types.PrepayBalanceKey(sender))) } - // sub coins from sender's wallet - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, coins) - if err != nil { - return sdk.ZeroInt(), err - } + //// sub coins from sender's wallet + //err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, regtypes.TotalUnissuedPrepayName, coins) + //if err != nil { + // return sdk.ZeroInt(), err + //} // //_, err = k.bankKeeper.SubtractCoins(ctx, sender, coins) //if err != nil { // return sdk.ZeroInt(), err //} - prepay := coins.AmountOf(k.BondDenom(ctx)) - purchased := k.purchaseUoz(ctx, prepay) - return purchased, nil } From 507abbaf2c6c5066a92ef2b919ed05cbdcfd8dfb Mon Sep 17 00:00:00 2001 From: jialbai Date: Tue, 24 May 2022 16:03:14 -0400 Subject: [PATCH 069/113] - qb-1165: update token life cycle logic of register module (mint) --- app/app.go | 8 +-- x/pot/types/expected_keepers.go | 4 +- x/register/genesis.go | 26 ++++++--- x/register/keeper/indexing_node.go | 70 +++++++++++++++++------- x/register/keeper/keeper.go | 2 +- x/register/keeper/resource_node.go | 85 +++++++++++++++++++++++------- 6 files changed, 142 insertions(+), 53 deletions(-) diff --git a/app/app.go b/app/app.go index 9cc75a70..d867903c 100644 --- a/app/app.go +++ b/app/app.go @@ -158,10 +158,10 @@ var ( //pot.FoundationAccount: nil, registertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, //upgrading module accounts - registertypes.ResourceNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.IndexingNodeBondedPoolName: {authtypes.Minter, authtypes.Burner}, - registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter, authtypes.Burner}, + registertypes.ResourceNodeBondedPoolName: {authtypes.Minter}, + registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter}, + registertypes.IndexingNodeBondedPoolName: {authtypes.Minter}, + registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter}, registertypes.TotalUnissuedPrepayName: {authtypes.Minter}, registertypes.TotalSlashedPoolName: {authtypes.Minter, authtypes.Burner}, diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 76751014..373827f6 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -69,9 +69,9 @@ type RegisterKeeper interface { //SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) - SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) + MintResourceNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error GetIndexingNodeBondedToken(ctx sdk.Context) (token sdk.Coin) - SetIndexingNodeBondedToken(ctx sdk.Context, token sdk.Coin) + MintIndexingNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) diff --git a/x/register/genesis.go b/x/register/genesis.go index 25570532..fdc47fb6 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -24,9 +24,14 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } keeper.SetResourceNode(ctx, *resourceNode) } - keeper.SetResourceNodeBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeBondedToken)) - keeper.SetResourceNodeNotBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeNotBondedToken)) - + err := keeper.MintResourceNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeBondedToken)) + if err != nil { + panic(err) + } + err = keeper.MintResourceNodeNotBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeNotBondedToken)) + if err != nil { + panic(err) + } idxNodeBondedToken := sdk.ZeroInt() idxNodeNotBondedToken := sdk.ZeroInt() for _, indexingNode := range data.IndexingNodes.GetIndexingNodes() { @@ -38,8 +43,14 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } keeper.SetIndexingNode(ctx, *indexingNode) } - keeper.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeBondedToken)) - keeper.SetIndexingNodeNotBondedToken(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeNotBondedToken)) + err = keeper.MintIndexingNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeBondedToken)) + if err != nil { + panic(err) + } + err = keeper.MintIndexingNodeNotBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeNotBondedToken)) + if err != nil { + panic(err) + } totalUnissuedPrepay := data.TotalUnissuedPrepay initialUOzonePrice := sdk.ZeroDec() @@ -48,10 +59,13 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetInitialUOzonePrice(ctx, initialUOzonePrice) initOzoneLimit := initialStakeTotal.Add(totalUnissuedPrepay).ToDec().Quo(initialUOzonePrice).TruncateInt() keeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) - keeper.MintTotalUnissuedPrepayPool(ctx, sdk.Coin{ + err = keeper.MintTotalUnissuedPrepayPool(ctx, sdk.Coin{ Denom: data.Params.BondDenom, Amount: totalUnissuedPrepay, }) + if err != nil { + panic(err) + } for _, slashing := range data.Slashing { walletAddress, err := sdk.AccAddressFromBech32(slashing.GetWalletAddress()) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index a046f7c8..246c45f6 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -472,34 +472,64 @@ func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.Sds } } -func (k Keeper) SetIndexingNodeBondedToken(ctx sdk.Context, token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalLengthPrefixed(&token) - store.Set(types.IndexingNodeBondedTokenKey, bz) +func (k Keeper) MintIndexingNodeBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { + indexingNodeBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.IndexingNodeBondedPoolName) + if indexingNodeBondedPoolAcc == nil { + return types.ErrUnknownAccountAddress + } + hasCoin := k.bankKeeper.GetBalance(ctx, indexingNodeBondedPoolAcc, k.BondDenom(ctx)) + // can only mint when balance is 0 TODO To be tested + if hasCoin.Amount.GT(sdk.ZeroInt()) { + return types.ErrInitialBalanceNotZero + } + return k.bankKeeper.MintCoins(ctx, types.IndexingNodeBondedPoolName, sdk.NewCoins(initialCoins)) } +//func (k Keeper) SetIndexingNodeBondedToken(ctx sdk.Context, token sdk.Coin) { +// store := ctx.KVStore(k.storeKey) +// bz := k.cdc.MustMarshalLengthPrefixed(&token) +// store.Set(types.IndexingNodeBondedTokenKey, bz) +//} + func (k Keeper) GetIndexingNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.IndexingNodeBondedTokenKey) - if bz == nil { - return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + indexingNodeBondedAccAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeBondedPoolName) + if indexingNodeBondedAccAddr == nil { + ctx.Logger().Error("account address for indexing node bonded pool does not exist.") + return sdk.Coin{ + Denom: types.DefaultBondDenom, + Amount: sdk.ZeroInt(), + } } - k.cdc.MustUnmarshalLengthPrefixed(bz, &token) - return token + return k.bankKeeper.GetBalance(ctx, indexingNodeBondedAccAddr, k.BondDenom(ctx)) } -func (k Keeper) SetIndexingNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalLengthPrefixed(&token) - store.Set(types.IndexingNodeNotBondedTokenKey, bz) +func (k Keeper) MintIndexingNodeNotBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { + indexingNodeNotBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) + if indexingNodeNotBondedPoolAcc == nil { + return types.ErrUnknownAccountAddress + } + hasCoin := k.bankKeeper.GetBalance(ctx, indexingNodeNotBondedPoolAcc, k.BondDenom(ctx)) + // can only mint when balance is 0 TODO To be tested + if hasCoin.Amount.GT(sdk.ZeroInt()) { + return types.ErrInitialBalanceNotZero + } + return k.bankKeeper.MintCoins(ctx, types.IndexingNodeNotBondedPoolName, sdk.NewCoins(initialCoins)) } +//func (k Keeper) SetIndexingNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { +// store := ctx.KVStore(k.storeKey) +// bz := k.cdc.MustMarshalLengthPrefixed(&token) +// store.Set(types.IndexingNodeNotBondedTokenKey, bz) +//} + func (k Keeper) GetIndexingNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.IndexingNodeNotBondedTokenKey) - if bz == nil { - return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + indexingNodeNotBondedAccAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) + if indexingNodeNotBondedAccAddr == nil { + ctx.Logger().Error("account address for indexing node Not bonded pool does not exist.") + return sdk.Coin{ + Denom: types.DefaultBondDenom, + Amount: sdk.ZeroInt(), + } } - k.cdc.MustUnmarshalLengthPrefixed(bz, &token) - return token + return k.bankKeeper.GetBalance(ctx, indexingNodeNotBondedAccAddr, k.BondDenom(ctx)) } diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index b64a128b..14918d2f 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -127,7 +127,7 @@ func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk Amount: sdk.ZeroInt(), } } - return k.bankKeeper.GetBalance(ctx, totalUnissuedPrepayAccAddr, types.DefaultBondDenom) + return k.bankKeeper.GetBalance(ctx, totalUnissuedPrepayAccAddr, k.BondDenom(ctx)) //store := ctx.KVStore(k.storeKey) //b := store.Get(types.TotalUnissuedPrepayKey) //if b == nil { diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index cb858fc6..6048dfb5 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -353,34 +353,79 @@ func (k Keeper) UpdateResourceNodeStake(ctx sdk.Context, networkAddr stratos.Sds } } -func (k Keeper) SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalLengthPrefixed(&token) - store.Set(types.ResourceNodeBondedTokenKey, bz) +func (k Keeper) MintResourceNodeBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { + resourceNodeBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.ResourceNodeBondedPoolName) + if resourceNodeBondedPoolAcc == nil { + return types.ErrUnknownAccountAddress + } + hasCoin := k.bankKeeper.GetBalance(ctx, resourceNodeBondedPoolAcc, k.BondDenom(ctx)) + // can only mint when balance is 0 TODO To be tested + if hasCoin.Amount.GT(sdk.ZeroInt()) { + return types.ErrInitialBalanceNotZero + } + return k.bankKeeper.MintCoins(ctx, types.ResourceNodeBondedPoolName, sdk.NewCoins(initialCoins)) } +//func (k Keeper) SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) { +// store := ctx.KVStore(k.storeKey) +// bz := k.cdc.MustMarshalLengthPrefixed(&token) +// store.Set(types.ResourceNodeBondedTokenKey, bz) +//} + func (k Keeper) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ResourceNodeBondedTokenKey) - if bz == nil { - return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + resourceNodeBondedAccAddr := k.accountKeeper.GetModuleAddress(types.ResourceNodeBondedPoolName) + if resourceNodeBondedAccAddr == nil { + ctx.Logger().Error("account address for resource node bonded pool does not exist.") + return sdk.Coin{ + Denom: types.DefaultBondDenom, + Amount: sdk.ZeroInt(), + } } - k.cdc.MustUnmarshalLengthPrefixed(bz, &token) - return token + return k.bankKeeper.GetBalance(ctx, resourceNodeBondedAccAddr, k.BondDenom(ctx)) + //store := ctx.KVStore(k.storeKey) + //bz := store.Get(types.ResourceNodeBondedTokenKey) + //if bz == nil { + // return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + //} + //k.cdc.MustUnmarshalLengthPrefixed(bz, &token) + //return token } -func (k Keeper) SetResourceNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalLengthPrefixed(&token) - store.Set(types.ResourceNodeNotBondedTokenKey, bz) +func (k Keeper) MintResourceNodeNotBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { + resourceNodeNotBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.ResourceNodeNotBondedPoolName) + if resourceNodeNotBondedPoolAcc == nil { + return types.ErrUnknownAccountAddress + } + hasCoin := k.bankKeeper.GetBalance(ctx, resourceNodeNotBondedPoolAcc, k.BondDenom(ctx)) + // can only mint when balance is 0 TODO To be tested + if hasCoin.Amount.GT(sdk.ZeroInt()) { + return types.ErrInitialBalanceNotZero + } + return k.bankKeeper.MintCoins(ctx, types.ResourceNodeNotBondedPoolName, sdk.NewCoins(initialCoins)) } +//func (k Keeper) SetResourceNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { +// store := ctx.KVStore(k.storeKey) +// bz := k.cdc.MustMarshalLengthPrefixed(&token) +// store.Set(types.ResourceNodeNotBondedTokenKey, bz) +//} + func (k Keeper) GetResourceNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ResourceNodeNotBondedTokenKey) - if bz == nil { - return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + resourceNodeNotBondedAccAddr := k.accountKeeper.GetModuleAddress(types.ResourceNodeNotBondedPoolName) + if resourceNodeNotBondedAccAddr == nil { + ctx.Logger().Error("account address for resource node Not bonded pool does not exist.") + return sdk.Coin{ + Denom: types.DefaultBondDenom, + Amount: sdk.ZeroInt(), + } } - k.cdc.MustUnmarshalLengthPrefixed(bz, &token) - return token + return k.bankKeeper.GetBalance(ctx, resourceNodeNotBondedAccAddr, k.BondDenom(ctx)) + + //store := ctx.KVStore(k.storeKey) + //bz := store.Get(types.ResourceNodeNotBondedTokenKey) + //if bz == nil { + // return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + //} + //k.cdc.MustUnmarshalLengthPrefixed(bz, &token) + //return token } From 69b29569ed1514bd0b077cb6248d36f2547a5969 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 24 May 2022 16:15:19 -0400 Subject: [PATCH 070/113] fixed flags, tx and query in client dir --- cmd/stchaind/genaccounts.go | 2 +- proto/stratos/register/v1/register.proto | 16 +- x/pot/client/cli/flags.go | 118 ++++++-- x/pot/client/cli/query.go | 5 +- x/pot/client/cli/tx.go | 133 +++++--- x/register/allow_ed25519_gas_test.go | 143 ++++----- x/register/client/cli/flags.go | 127 +++++--- x/register/client/cli/query.go | 21 +- x/register/client/cli/tx.go | 368 +++++++++++++++++------ x/register/types/register.pb.go | 222 +++++++------- x/sds/client/cli/flags.go | 22 ++ x/sds/client/cli/query.go | 17 +- x/sds/client/cli/tx.go | 54 +++- 13 files changed, 844 insertions(+), 404 deletions(-) diff --git a/cmd/stchaind/genaccounts.go b/cmd/stchaind/genaccounts.go index eb06d087..8d07f701 100644 --- a/cmd/stchaind/genaccounts.go +++ b/cmd/stchaind/genaccounts.go @@ -27,7 +27,7 @@ import ( ) const ( - //flagClientHome = "home-client" + flagClientHome = "home-client" flagVestingStart = "vesting-start-time" flagVestingEnd = "vesting-end-time" flagVestingAmt = "vesting-amount" diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index f85babcc..df78636b 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -150,24 +150,24 @@ message Description { (gogoproto.jsontag) = "identity", (gogoproto.moretags) = "yaml:\"identity\",omitempty" ]; - string Website = 3 [ + string website = 3 [ (gogoproto.jsontag) = "website", (gogoproto.moretags) = "yaml:\"website\",omitempty" ]; - string SecurityContact = 4 [ + string securityContact = 4 [ (gogoproto.jsontag) = "security_contact", (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; - string Details = 5 [ + string details = 5 [ (gogoproto.jsontag) = "details", (gogoproto.moretags) = "yaml:\"details\",omitempty" ]; } message Slashing { - string WalletAddress = 1 [ + string walletAddress = 1 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; - int64 Value = 2 [ + int64 value = 2 [ (gogoproto.jsontag) = "value", (gogoproto.moretags) = "yaml:\"value\"" ]; @@ -229,17 +229,17 @@ message StakingInfo { (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; - cosmos.base.v1beta1.Coin bonded_stake = 10 [ + cosmos.base.v1beta1.Coin bonded_stake = 10 [ (gogoproto.nullable) = true, (gogoproto.jsontag) = "bonded_stake", (gogoproto.moretags) = "yaml:\"bonded_stake\"" ]; - cosmos.base.v1beta1.Coin un_bonding_stake = 11 [ + cosmos.base.v1beta1.Coin un_bonding_stake = 11 [ (gogoproto.nullable) = true, (gogoproto.jsontag) = "un_bonding_stake", (gogoproto.moretags) = "yaml:\"un_bonding_stake\"" ]; - cosmos.base.v1beta1.Coin un_bonded_stake = 12 [ + cosmos.base.v1beta1.Coin un_bonded_stake = 12 [ (gogoproto.nullable) = true, (gogoproto.jsontag) = "un_bonded_stake", (gogoproto.moretags) = "yaml:\"un_bonded_stake\"" diff --git a/x/pot/client/cli/flags.go b/x/pot/client/cli/flags.go index 98478fd6..fbbbedd2 100644 --- a/x/pot/client/cli/flags.go +++ b/x/pot/client/cli/flags.go @@ -20,32 +20,102 @@ const ( ) var ( - FsReporterAddr = flag.NewFlagSet("", flag.ContinueOnError) - FsEpoch = flag.NewFlagSet("", flag.ContinueOnError) - FsReportReference = flag.NewFlagSet("", flag.ContinueOnError) - FsWalletVolumes = flag.NewFlagSet("", flag.ContinueOnError) - FsAmount = flag.NewFlagSet("", flag.ContinueOnError) - FsWalletAddress = flag.NewFlagSet("", flag.ContinueOnError) - FsTargetAddress = flag.NewFlagSet("", flag.ContinueOnError) - FsReporters = flag.NewFlagSet("", flag.ContinueOnError) - FsReportOwner = flag.NewFlagSet("", flag.ContinueOnError) - FsNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) - FsSlashing = flag.NewFlagSet("", flag.ContinueOnError) - FsSuspend = flag.NewFlagSet("", flag.ContinueOnError) +//FsReporterAddr = flag.NewFlagSet("", flag.ContinueOnError) +//FsEpoch = flag.NewFlagSet("", flag.ContinueOnError) +//FsReportReference = flag.NewFlagSet("", flag.ContinueOnError) +//FsWalletVolumes = flag.NewFlagSet("", flag.ContinueOnError) +//FsAmount = flag.NewFlagSet("", flag.ContinueOnError) +//FsWalletAddress = flag.NewFlagSet("", flag.ContinueOnError) +//FsTargetAddress = flag.NewFlagSet("", flag.ContinueOnError) +//FsReporters = flag.NewFlagSet("", flag.ContinueOnError) +//FsReportOwner = flag.NewFlagSet("", flag.ContinueOnError) +//FsNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) +//FsSlashing = flag.NewFlagSet("", flag.ContinueOnError) +//FsSuspend = flag.NewFlagSet("", flag.ContinueOnError) ) func init() { - FsReporterAddr.String(FlagReporterAddr, "", "the node address of reporter") - FsEpoch.String(FlagEpoch, "", "the epoch when this PoT message reported.") - FsReportReference.String(FlagReportReference, "", " the hash used as a reference to this PoT report") - FsWalletVolumes.String(FlagWalletVolumes, "", "a string of KEY-VALUE pairs. The KEY is 'wallet-volumes' and the VALUE is the proof of traffic of this wallet`") - FsAmount.String(FlagAmount, "", "Amount of coins to withdraw") - FsWalletAddress.String(FlagWalletAddress, "", "The address of the wallet to withdraw") - FsTargetAddress.String(FlagTargetAddress, "", "The target account where the money is deposited after withdraw") - FsReporters.String(FlagReporters, "", "the node address list of reporters") - FsReportOwner.String(FlagReporterOwner, "", "the node address list of reporters") - FsNetworkAddress.String(FlagNetworkAddress, "", "the node address of resource node to slashing") - FsSlashing.String(FlagSlashing, "", "the amount of slashing") - FsSuspend.String(FlagSuspend, "", "if the resource node is suspend") + //FsReporterAddr.String(FlagReporterAddr, "", "the node address of reporter") + //FsEpoch.String(FlagEpoch, "", "the epoch when this PoT message reported.") + //FsReportReference.String(FlagReportReference, "", " the hash used as a reference to this PoT report") + //FsWalletVolumes.String(FlagWalletVolumes, "", "a string of KEY-VALUE pairs. The KEY is 'wallet-volumes' and the VALUE is the proof of traffic of this wallet`") + //FsAmount.String(FlagAmount, "", "Amount of coins to withdraw") + //FsWalletAddress.String(FlagWalletAddress, "", "The address of the wallet to withdraw") + //FsTargetAddress.String(FlagTargetAddress, "", "The target account where the money is deposited after withdraw") + //FsReporters.String(FlagReporters, "", "the node address list of reporters") + //FsReportOwner.String(FlagReporterOwner, "", "the node address list of reporters") + //FsNetworkAddress.String(FlagNetworkAddress, "", "the node address of resource node to slashing") + //FsSlashing.String(FlagSlashing, "", "the amount of slashing") + //FsSuspend.Bool(FlagSuspend, false, "if the resource node is suspend") } + +// FlagSetAmount Returns the FlagSet for amount related operations. +func flagSetAmount() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagAmount, "", "Amount of coins to withdraw") + return fs +} + +// flagSetReportVolumes Returns the FlagSet for report volumes. +func flagSetReportVolumes() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagWalletVolumes, "", "a string of KEY-VALUE pairs. The KEY is 'wallet-volumes' and the VALUE is the proof of traffic of this wallet`") + fs.String(FlagReporterAddr, "", "the node address of reporter") + fs.String(FlagEpoch, "", "the epoch when this PoT message reported.") + fs.String(FlagReportReference, "", " the hash used as a reference to this PoT report") + + return fs +} + +// flagSetEpoch Returns the FlagSet for epoch. +func flagSetEpoch() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagEpoch, "", "the epoch when this PoT message reported.") + + return fs +} + +// flagSetReportersAndOwners Returns the FlagSet for reporters and their owners. +func flagSetReportersAndOwners() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagReporters, "", "the node address list of reporters") + fs.String(FlagReporterOwner, "", "the owner address list of reporter") + + return fs +} + +// flagSetWalletAddress Returns the FlagSet for wallet address. +func flagSetWalletAddress() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagWalletAddress, "", "The wallet address to withdraw from") + return fs +} + +// flagSetTargetAddress Returns the FlagSet for target wallet address. +func flagSetTargetAddress() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagTargetAddress, "", "The target wallet address to deposit into after withdrawing") + return fs +} + +// FlagSetNetworkAddress Returns the FlagSet for network address of resource node +func flagSetNetworkAddress() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagNetworkAddress, "", "The address of the PP node") + return fs +} + +// flagSetFsSlashing Returns the FlagSet for slashing amount. +func flagSetSlashing() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagSlashing, "", "the amount of slashing") + return fs +} + +// flagSetSuspend Returns the FlagSet for suspend state of resource node. +func flagSetSuspend() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.Bool(FlagSuspend, false, "if the resource node is suspend") + return fs +} diff --git a/x/pot/client/cli/query.go b/x/pot/client/cli/query.go index 1070eaaf..9dba11f2 100644 --- a/x/pot/client/cli/query.go +++ b/x/pot/client/cli/query.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -63,9 +64,11 @@ func GetCmdQueryVolumeReport() *cobra.Command { return clientCtx.PrintProto(result) }, } - cmd.Flags().AddFlagSet(FsEpoch) + cmd.Flags().AddFlagSet(flagSetEpoch()) _ = cmd.MarkFlagRequired(FlagEpoch) + flags.AddQueryFlagsToCmd(cmd) + return cmd } diff --git a/x/pot/client/cli/tx.go b/x/pot/client/cli/tx.go index 6ac56caa..a131eada 100644 --- a/x/pot/client/cli/tx.go +++ b/x/pot/client/cli/tx.go @@ -11,7 +11,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" flag "github.com/spf13/pflag" - "github.com/spf13/viper" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/pot/types" ) @@ -62,8 +61,12 @@ func WithdrawCmd() *cobra.Command { }, } - cmd.Flags().AddFlagSet(FsAmount) - cmd.Flags().AddFlagSet(FsTargetAddress) + //cmd.Flags().AddFlagSet(FsAmount) + //cmd.Flags().AddFlagSet(FsTargetAddress) + cmd.Flags().AddFlagSet(flagSetAmount()) + cmd.Flags().AddFlagSet(flagSetTargetAddress()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagAmount) _ = cmd.MarkFlagRequired(flags.FlagFrom) @@ -73,7 +76,10 @@ func WithdrawCmd() *cobra.Command { // makes a new WithdrawMsg. func buildWithdrawMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgWithdraw, error) { - amountStr, _ := fs.GetString(FlagAmount) + amountStr, err := fs.GetString(FlagAmount) + if err != nil { + return txf, nil, err + } amount, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return txf, nil, err @@ -82,16 +88,27 @@ func buildWithdrawMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet walletAddress := clientCtx.GetFromAddress() var targetAddress sdk.AccAddress - if viper.IsSet(FlagTargetAddress) { - targetAddressStr := viper.GetString(FlagTargetAddress) + flagTargetAddress := fs.Lookup(FlagTargetAddress) + if flagTargetAddress == nil { + targetAddress = walletAddress + } else { + targetAddressStr, _ := fs.GetString(FlagTargetAddress) targetAddress, err = sdk.AccAddressFromBech32(targetAddressStr) if err != nil { return txf, nil, err } - } else { - targetAddress = walletAddress } + //if viper.IsSet(FlagTargetAddress) { + // targetAddressStr := viper.GetString(FlagTargetAddress) + // targetAddress, err = sdk.AccAddressFromBech32(targetAddressStr) + // if err != nil { + // return txf, nil, err + // } + //} else { + // targetAddress = walletAddress + //} + msg := types.NewMsgWithdraw(amount, walletAddress, targetAddress) return txf, msg, nil @@ -128,10 +145,13 @@ func VolumeReportCmd() *cobra.Command { //return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) }, } - cmd.Flags().AddFlagSet(FsReporterAddr) - cmd.Flags().AddFlagSet(FsEpoch) - cmd.Flags().AddFlagSet(FsReportReference) - cmd.Flags().AddFlagSet(FsWalletVolumes) + //cmd.Flags().AddFlagSet(FsReporterAddr) + //cmd.Flags().AddFlagSet(FsEpoch) + //cmd.Flags().AddFlagSet(FsReportReference) + //cmd.Flags().AddFlagSet(FsWalletVolumes) + cmd.Flags().AddFlagSet(flagSetReportVolumes()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagReporterAddr) _ = cmd.MarkFlagRequired(FlagEpoch) @@ -143,20 +163,32 @@ func VolumeReportCmd() *cobra.Command { } func createVolumeReportMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgVolumeReport, error) { - reporterStr, _ := fs.GetString(FlagReporterAddr) + reporterStr, err := fs.GetString(FlagReporterAddr) + if err != nil { + return txf, nil, err + } reporter, err := stratos.SdsAddressFromBech32(reporterStr) if err != nil { return txf, nil, err } - reportReference := viper.GetString(FlagReportReference) - value, err := strconv.ParseInt(viper.GetString(FlagEpoch), 10, 64) + reportReference, err := fs.GetString(FlagReportReference) + if err != nil { + return txf, nil, err + } + flagEpochStr, _ := fs.GetString(FlagEpoch) + value, err := strconv.ParseInt(flagEpochStr, 10, 64) if err != nil { return txf, nil, err } epoch := sdk.NewInt(value) - var walletVolumesStr = make([]singleWalletVolumeStr, 0) - err = json.Unmarshal([]byte(viper.GetString(FlagWalletVolumes)), &walletVolumesStr) + + flagWalletVolumes, err := fs.GetString(FlagWalletVolumes) + if err != nil { + return txf, nil, err + } + walletVolumesStr := make([]singleWalletVolumeStr, 0) + err = json.Unmarshal([]byte(flagWalletVolumes), &walletVolumesStr) if err != nil { return txf, nil, err } @@ -209,7 +241,9 @@ func FoundationDepositCmd() *cobra.Command { return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } - cmd.Flags().AddFlagSet(FsAmount) + cmd.Flags().AddFlagSet(flagSetAmount()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagAmount) _ = cmd.MarkFlagRequired(flags.FlagFrom) @@ -218,7 +252,10 @@ func FoundationDepositCmd() *cobra.Command { } func buildFoundationDepositMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgFoundationDeposit, error) { - amountStr, _ := fs.GetString(FlagAmount) + amountStr, err := fs.GetString(FlagAmount) + if err != nil { + return txf, nil, err + } amount, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { return txf, nil, err @@ -249,12 +286,20 @@ func SlashingResourceNodeCmd() *cobra.Command { return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } - cmd.Flags().AddFlagSet(FsReporters) - cmd.Flags().AddFlagSet(FsReportOwner) - cmd.Flags().AddFlagSet(FsNetworkAddress) - cmd.Flags().AddFlagSet(FsWalletAddress) - cmd.Flags().AddFlagSet(FsSlashing) - cmd.Flags().AddFlagSet(FsSuspend) + //cmd.Flags().AddFlagSet(FsReporters) + //cmd.Flags().AddFlagSet(FsReportOwner) + //cmd.Flags().AddFlagSet(FsNetworkAddress) + //cmd.Flags().AddFlagSet(FsWalletAddress) + //cmd.Flags().AddFlagSet(FsSlashing) + //cmd.Flags().AddFlagSet(FsSuspend) + + cmd.Flags().AddFlagSet(flagSetReportersAndOwners()) + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + cmd.Flags().AddFlagSet(flagSetWalletAddress()) + cmd.Flags().AddFlagSet(flagSetSlashing()) + cmd.Flags().AddFlagSet(flagSetSuspend()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagReporters) _ = cmd.MarkFlagRequired(FlagReporterOwner) @@ -269,10 +314,15 @@ func SlashingResourceNodeCmd() *cobra.Command { func buildSlashingResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgSlashingResourceNode, error) { var reportersStr = make([]string, 0) - err := json.Unmarshal([]byte(viper.GetString(FlagReporters)), &reportersStr) + flagReportersStr, err := fs.GetString(FlagReporters) if err != nil { return txf, nil, err } + err = json.Unmarshal([]byte(flagReportersStr), &reportersStr) + if err != nil { + return txf, nil, err + } + var reporters = make([]stratos.SdsAddress, 0) for _, val := range reportersStr { reporterAddr, err := stratos.SdsAddressFromBech32(val) @@ -283,10 +333,15 @@ func buildSlashingResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs * } var reporterOwnerStr = make([]string, 0) - err = json.Unmarshal([]byte(viper.GetString(FlagReporterOwner)), &reporterOwnerStr) + flagReporterOwnerStr, err := fs.GetString(FlagReporterOwner) + if err != nil { + return txf, nil, err + } + err = json.Unmarshal([]byte(flagReporterOwnerStr), &reporterOwnerStr) if err != nil { return txf, nil, err } + var reporterOwner = make([]sdk.AccAddress, 0) for _, val := range reporterOwnerStr { reporterOwnerAddr, err := sdk.AccAddressFromBech32(val) @@ -296,26 +351,36 @@ func buildSlashingResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs * reporterOwner = append(reporterOwner, reporterOwnerAddr) } - networkAddressStr := viper.GetString(FlagNetworkAddress) - networkAddress, err := stratos.SdsAddressFromBech32(networkAddressStr) + flagNetworkAddressStr, err := fs.GetString(FlagNetworkAddress) + if err != nil { + return txf, nil, err + } + networkAddress, err := stratos.SdsAddressFromBech32(flagNetworkAddressStr) if err != nil { return txf, nil, err } - walletAddressStr := viper.GetString(FlagWalletAddress) - walletAddress, err := sdk.AccAddressFromBech32(walletAddressStr) + flagWalletAddressStr, err := fs.GetString(FlagWalletAddress) + if err != nil { + return txf, nil, err + } + walletAddress, err := sdk.AccAddressFromBech32(flagWalletAddressStr) if err != nil { return txf, nil, err } - slashingVal, err := strconv.ParseInt(viper.GetString(FlagSlashing), 10, 64) + flagSlashingStr, err := fs.GetString(FlagSlashing) + if err != nil { + return txf, nil, err + } + slashingVal, err := strconv.ParseInt(flagSlashingStr, 10, 64) if err != nil { return txf, nil, err } slashing := sdk.NewInt(slashingVal) - suspendVal := viper.GetString(FlagSuspend) - suspend, err := strconv.ParseBool(suspendVal) + suspend, err := fs.GetBool(FlagSuspend) + //suspend, err := strconv.ParseBool(flagSuspendVal) if err != nil { return txf, nil, err } diff --git a/x/register/allow_ed25519_gas_test.go b/x/register/allow_ed25519_gas_test.go index a0d5fcc2..66798d3e 100644 --- a/x/register/allow_ed25519_gas_test.go +++ b/x/register/allow_ed25519_gas_test.go @@ -1,73 +1,74 @@ package register -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/mock" - "github.com/stratosnet/stratos-chain/x/register/types" - abci "github.com/tendermint/tendermint/abci/types" -) - -func TestRegister(t *testing.T) { - - /********************* initialize mock app *********************/ - //SetConfig() - //mApp, k, accountKeeper, bankKeeper, stakingKeeper, registerKeeper := getMockApp(t) - mApp, k, _, _ := getMockApp(t) - accounts := setupAccounts(mApp) - mock.SetGenesis(mApp, accounts) - - header := abci.Header{} - ctx := mApp.BaseApp.NewContext(true, header) - - /********************* sign twice and send register resource node msg *********************/ - - header = abci.Header{Height: mApp.LastBlockHeight() + 1} - ctx = mApp.BaseApp.NewContext(true, header) - - registerResNodeMsg := types.NewMsgCreateResourceNode( - resNodeNetworkId3, - resNodePubKey3, - sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake), - resOwnerAddr3, - NewDescription("sds://resourceNode3", "", "", "", ""), - types.STORAGE, - ) - t.Log("registerResNodeMsg: ", registerResNodeMsg) - - resOwnerAcc3 := mApp.AccountKeeper.GetAccount(ctx, resOwnerAddr3) - accNumOwner := resOwnerAcc3.GetAccountNumber() - t.Log("accNumOwner: ", accNumOwner) - accSeqOwner := resOwnerAcc3.GetSequence() - t.Log("accSeqOwner: ", accSeqOwner) - t.Log("resOwnerPrivKey3: ", resOwnerPrivKey3) - t.Log("resNodePrivKey3: ", resNodePrivKey3) - t.Log("resOwnerPubKey3: ", resOwnerPrivKey3.PubKey()) - t.Log("resNodePubKey3: ", resNodePubKey3) - - accNumNode := resOwnerAcc3.GetAccountNumber() - t.Log("accNumNode: ", accNumNode) - accSeqNode := resOwnerAcc3.GetSequence() - t.Log("accSeqNode: ", accSeqNode) - - gasInfo, result, e := mock.SignCheckDeliver( - t, - mApp.Cdc, - mApp.BaseApp, - header, - []sdk.Msg{registerResNodeMsg}, - []uint64{accNumOwner, accNumNode}, - []uint64{accSeqOwner, accSeqNode}, - true, - true, - resOwnerPrivKey3, - ) - - if e != nil { - return - } - - t.Log("gasInfo: ", gasInfo) - t.Log("Result: ", result) -} +// +//import ( +// "testing" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/mock" +// "github.com/stratosnet/stratos-chain/x/register/types" +// abci "github.com/tendermint/tendermint/abci/types" +//) +// +//func TestRegister(t *testing.T) { +// +// /********************* initialize mock app *********************/ +// //SetConfig() +// //mApp, k, accountKeeper, bankKeeper, stakingKeeper, registerKeeper := getMockApp(t) +// mApp, k, _, _ := getMockApp(t) +// accounts := setupAccounts(mApp) +// mock.SetGenesis(mApp, accounts) +// +// header := abci.Header{} +// ctx := mApp.BaseApp.NewContext(true, header) +// +// /********************* sign twice and send register resource node msg *********************/ +// +// header = abci.Header{Height: mApp.LastBlockHeight() + 1} +// ctx = mApp.BaseApp.NewContext(true, header) +// +// registerResNodeMsg := types.NewMsgCreateResourceNode( +// resNodeNetworkId3, +// resNodePubKey3, +// sdk.NewCoin(k.BondDenom(ctx), resNodeInitStake), +// resOwnerAddr3, +// NewDescription("sds://resourceNode3", "", "", "", ""), +// types.STORAGE, +// ) +// t.Log("registerResNodeMsg: ", registerResNodeMsg) +// +// resOwnerAcc3 := mApp.AccountKeeper.GetAccount(ctx, resOwnerAddr3) +// accNumOwner := resOwnerAcc3.GetAccountNumber() +// t.Log("accNumOwner: ", accNumOwner) +// accSeqOwner := resOwnerAcc3.GetSequence() +// t.Log("accSeqOwner: ", accSeqOwner) +// t.Log("resOwnerPrivKey3: ", resOwnerPrivKey3) +// t.Log("resNodePrivKey3: ", resNodePrivKey3) +// t.Log("resOwnerPubKey3: ", resOwnerPrivKey3.PubKey()) +// t.Log("resNodePubKey3: ", resNodePubKey3) +// +// accNumNode := resOwnerAcc3.GetAccountNumber() +// t.Log("accNumNode: ", accNumNode) +// accSeqNode := resOwnerAcc3.GetSequence() +// t.Log("accSeqNode: ", accSeqNode) +// +// gasInfo, result, e := mock.SignCheckDeliver( +// t, +// mApp.Cdc, +// mApp.BaseApp, +// header, +// []sdk.Msg{registerResNodeMsg}, +// []uint64{accNumOwner, accNumNode}, +// []uint64{accSeqOwner, accSeqNode}, +// true, +// true, +// resOwnerPrivKey3, +// ) +// +// if e != nil { +// return +// } +// +// t.Log("gasInfo: ", gasInfo) +// t.Log("Result: ", result) +//} diff --git a/x/register/client/cli/flags.go b/x/register/client/cli/flags.go index 3fed811e..2aee8bfb 100644 --- a/x/register/client/cli/flags.go +++ b/x/register/client/cli/flags.go @@ -25,40 +25,97 @@ const ( ) // common flagsets to add to various functions -var ( - FsPk = flag.NewFlagSet("", flag.ContinueOnError) - FsAmount = flag.NewFlagSet("", flag.ContinueOnError) - FsStakeDelta = flag.NewFlagSet("", flag.ContinueOnError) - FsIncrStake = flag.NewFlagSet("", flag.ContinueOnError) - //FsNetworkAddr = flag.NewFlagSet("", flag.ContinueOnError) - FsNodeType = flag.NewFlagSet("", flag.ContinueOnError) - FsDescription = flag.NewFlagSet("", flag.ContinueOnError) - FsNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) - FsCandidateNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) - FsCandidateOwnerAddress = flag.NewFlagSet("", flag.ContinueOnError) - FsOpinion = flag.NewFlagSet("", flag.ContinueOnError) - FsVoterNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) -) +//var ( +//FsPk = flag.NewFlagSet("", flag.ContinueOnError) +//FsAmount = flag.NewFlagSet("", flag.ContinueOnError) +//FsStakeDelta = flag.NewFlagSet("", flag.ContinueOnError) +//FsIncrStake = flag.NewFlagSet("", flag.ContinueOnError) +//FsNetworkAddr = flag.NewFlagSet("", flag.ContinueOnError) +//FsNodeType = flag.NewFlagSet("", flag.ContinueOnError) +//FsDescription = flag.NewFlagSet("", flag.ContinueOnError) +//FsNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) +//FsCandidateNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) +//FsCandidateOwnerAddress = flag.NewFlagSet("", flag.ContinueOnError) +//FsOpinion = flag.NewFlagSet("", flag.ContinueOnError) +//FsVoterNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) +//) + +//func init() { +//FsPk.String(FlagPubKey, "", "The Bech32 encoded PubKey of the node") +//FsAmount.String(FlagAmount, "", "Amount of coins to bond") +//FsStakeDelta.String(FlagStakeDelta, "", "Stake change of coins to be made (always positive like 100000ustos)") +//FsIncrStake.String(FlagIncrStake, "", "Boolean indicator of increase/decrease of stake delta, true for increase and false for decrease") +//FsNodeType.Int(FlagNodeType, 0, "The value of node_type is determined by the three node "+ +// "types (storage=4/database=2/computation=1) and their arbitrary combinations.") + +//FsDescription.String(FlagMoniker, "", "The node's name") +//FsDescription.String(FlagIdentity, "", "The optional identity signature (ex. UPort or Keybase)") +//FsDescription.String(FlagWebsite, "", "The node's (optional) website") +//FsDescription.String(FlagSecurityContact, "", "The node's (optional) security contact email") +//FsDescription.String(FlagDetails, "", "The node's (optional) details") + +//FsNetworkAddress.String(FlagNetworkAddress, "The address of the PP node", "") +//FsCandidateNetworkAddress.String(FlagCandidateNetworkAddress, "The network address of the candidate PP node", "") +//FsCandidateOwnerAddress.String(FlagCandidateOwnerAddress, "The owner address of the candidate PP node", "") +//FsOpinion.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Indexing node.") +//FsVoterNetworkAddress.String(FlagVoterNetworkAddress, "The address of the PP node that made the vote.", "") +//} + +func flagSetDescriptionCreate() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + + fs.String(FlagMoniker, "", "The node's name") + fs.String(FlagIdentity, "", "The (optional) identity signature (ex. UPort or Keybase)") + fs.String(FlagWebsite, "", "The node's (optional) website") + fs.String(FlagSecurityContact, "", "The node's (optional) security contact email") + fs.String(FlagDetails, "", "The node's (optional) details") + + return fs +} + +// FlagSetAmount Returns the FlagSet for amount related operations. +func flagSetAmount() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagAmount, "", "Amount of coins to bond") + return fs +} + +// FlagSetPublicKey Returns the flagset for Public Key related operations. +func flagSetPublicKey() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagPubKey, "", "The resource node's Protobuf JSON encoded public key") + return fs +} + +// FlagSetNetworkAddress Returns the flagset for network address of resource node +func flagSetNetworkAddress() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagNetworkAddress, "", "The address of the PP node") + return fs +} + +// FlagSetNodeType Returns the flagset for node type of resource node +func flagSetNodeType() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.Int(FlagNodeType, 0, "The value of node_type is determined by the three node types (storage=4/database=2/computation=1) and their arbitrary combinations.") + return fs +} + +func flagSetStakeUpdate() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + + fs.String(FlagStakeDelta, "", "Stake change of coins to be made (always positive like 100000ustos)") + fs.String(FlagIncrStake, "", "Boolean indicator of increase/decrease of stake delta, true for increase and false for decrease") + + return fs +} + +func flagSetVoting() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) -func init() { - FsPk.String(FlagPubKey, "", "The Bech32 encoded PubKey of the node") - FsAmount.String(FlagAmount, "", "Amount of coins to bond") - FsStakeDelta.String(FlagStakeDelta, "", "Stake change of coins to be made (always positive like 100000ustos)") - FsIncrStake.String(FlagIncrStake, "", "Boolean indicator of increase/decrease of stake delta, true for increase and false for decrease") - //FsNetworkAddr.String(FlagNetworkAddress, "", "The network address of the node") - //FsNetworkAddr.String(FlagNetworkAddr, "", "The network address of the node") - FsNodeType.Int(FlagNodeType, 0, "The value of node_type is determined by the three node "+ - "types (storage=4/database=2/computation=1) and their arbitrary combinations.") - - FsDescription.String(FlagMoniker, "", "The node's name") - FsDescription.String(FlagIdentity, "", "The optional identity signature (ex. UPort or Keybase)") - FsDescription.String(FlagWebsite, "", "The node's (optional) website") - FsDescription.String(FlagSecurityContact, "", "The node's (optional) security contact email") - FsDescription.String(FlagDetails, "", "The node's (optional) details") - - FsNetworkAddress.String(FlagNetworkAddress, "The address of the PP node", "") - FsCandidateNetworkAddress.String(FlagCandidateNetworkAddress, "The network address of the candidate PP node", "") - FsCandidateOwnerAddress.String(FlagCandidateOwnerAddress, "The owner address of the candidate PP node", "") - FsOpinion.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Indexing node.") - FsVoterNetworkAddress.String(FlagVoterNetworkAddress, "The address of the PP node that made the vote.", "") + fs.String(FlagCandidateNetworkAddress, "The network address of the candidate PP node", "") + fs.String(FlagCandidateOwnerAddress, "The owner address of the candidate PP node", "") + fs.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Indexing node.") + fs.String(FlagVoterNetworkAddress, "The address of the PP node that made the vote.", "") + return fs } diff --git a/x/register/client/cli/query.go b/x/register/client/cli/query.go index 08e7eebd..893ef3a5 100644 --- a/x/register/client/cli/query.go +++ b/x/register/client/cli/query.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" @@ -40,7 +41,7 @@ func GetCmdQueryResourceNode() *cobra.Command { Long: strings.TrimSpace( fmt.Sprintf(`Query details about an individual resource node by its network address. Example: -$ %s query register get-resource-node --network-address=%sstsds1np4d8re98lpgrcdqcas8yt85gl3rvj268leg6v +$ %s query register get-resource-node --network-address=stsds1np4d8re98lpgrcdqcas8yt85gl3rvj268leg6v `, version.AppName, ), @@ -65,10 +66,15 @@ $ %s query register get-resource-node --network-address=%sstsds1np4d8re98lpgrcdq return err } - return clientCtx.PrintProto(result) + return clientCtx.PrintProto(result.GetNode()) }, } - cmd.Flags().String(FlagNetworkAddress, "", "(optional) The network address of the node") + + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + //cmd.Flags().String(FlagNetworkAddress, "", "The network address of node") + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + + flags.AddQueryFlagsToCmd(cmd) return cmd } @@ -80,7 +86,7 @@ func GetCmdQueryIndexingNode() *cobra.Command { Long: strings.TrimSpace( fmt.Sprintf(`Query details about an individual indexing node by its network address. Example: -$ %s query register get-indexing-node --network-address=%sstsds1faej5w4q6hgnt0ft598dlm408g4p747y4krwca +$ %s query register get-indexing-node --network-address=stsds1faej5w4q6hgnt0ft598dlm408g4p747y4krwca `, version.AppName, ), @@ -109,7 +115,12 @@ $ %s query register get-indexing-node --network-address=%sstsds1faej5w4q6hgnt0ft return clientCtx.PrintProto(result) }, } - cmd.Flags().String(FlagNetworkAddress, "", "(optional) The network address of the node") + + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + + flags.AddQueryFlagsToCmd(cmd) + //cmd.Flags().String(FlagNetworkAddress, "", "(optional) The network address of the node") return cmd } diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index ea504de3..39f7e09a 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -6,10 +6,10 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" flag "github.com/spf13/pflag" - "github.com/spf13/viper" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" ) @@ -62,17 +62,20 @@ func CreateResourceNodeCmd() *cobra.Command { }, } - cmd.Flags().AddFlagSet(FsPk) - cmd.Flags().AddFlagSet(FsAmount) - cmd.Flags().AddFlagSet(FsNetworkAddress) - cmd.Flags().AddFlagSet(FsNodeType) - cmd.Flags().AddFlagSet(FsDescription) + cmd.Flags().AddFlagSet(flagSetPublicKey()) + cmd.Flags().AddFlagSet(flagSetAmount()) + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + cmd.Flags().AddFlagSet(flagSetNodeType()) + cmd.Flags().AddFlagSet(flagSetDescriptionCreate()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) _ = cmd.MarkFlagRequired(FlagAmount) _ = cmd.MarkFlagRequired(FlagPubKey) _ = cmd.MarkFlagRequired(FlagNetworkAddress) _ = cmd.MarkFlagRequired(FlagNodeType) + _ = cmd.MarkFlagRequired(FlagMoniker) return cmd } @@ -97,10 +100,12 @@ func CreateIndexingNodeCmd() *cobra.Command { return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } - cmd.Flags().AddFlagSet(FsPk) - cmd.Flags().AddFlagSet(FsAmount) - cmd.Flags().AddFlagSet(FsNetworkAddress) - cmd.Flags().AddFlagSet(FsDescription) + cmd.Flags().AddFlagSet(flagSetPublicKey()) + cmd.Flags().AddFlagSet(flagSetAmount()) + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + cmd.Flags().AddFlagSet(flagSetDescriptionCreate()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) _ = cmd.MarkFlagRequired(FlagAmount) @@ -124,7 +129,11 @@ func RemoveResourceNodeCmd() *cobra.Command { if err != nil { return err } - ownerAddr := clientCtx.GetFromAddress() + //ownerAddr := clientCtx.GetFromAddress() + ownerAddr, err := sdk.AccAddressFromBech32(args[1]) + if err != nil { + return err + } msg := types.NewMsgRemoveResourceNode(resourceNodeAddr, ownerAddr) @@ -145,17 +154,24 @@ func RemoveIndexingNodeCmd() *cobra.Command { return err } - resourceNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) + indexingNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) + if err != nil { + return err + } + //ownerAddr := clientCtx.GetFromAddress() + ownerAddr, err := sdk.AccAddressFromBech32(args[1]) if err != nil { return err } - ownerAddr := clientCtx.GetFromAddress() - msg := types.NewMsgRemoveIndexingNode(resourceNodeAddr, ownerAddr) + msg := types.NewMsgRemoveIndexingNode(indexingNodeAddr, ownerAddr) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } + + flags.AddTxFlagsToCmd(cmd) + return cmd } @@ -180,15 +196,15 @@ func UpdateResourceNodeCmd() *cobra.Command { }, } - cmd.Flags().AddFlagSet(FsNetworkAddress) - cmd.Flags().AddFlagSet(FsDescription) - cmd.Flags().AddFlagSet(FsNodeType) - cmd.Flags().AddFlagSet(FsNetworkAddress) + cmd.Flags().AddFlagSet(flagSetNodeType()) + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + cmd.Flags().AddFlagSet(flagSetDescriptionCreate()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagNetworkAddress) _ = cmd.MarkFlagRequired(FlagMoniker) _ = cmd.MarkFlagRequired(FlagNodeType) - _ = cmd.MarkFlagRequired(FlagNetworkAddress) _ = cmd.MarkFlagRequired(flags.FlagFrom) return cmd @@ -215,9 +231,10 @@ func UpdateIndexingNodeCmd() *cobra.Command { }, } - cmd.Flags().AddFlagSet(FsNetworkAddress) - cmd.Flags().AddFlagSet(FsDescription) - cmd.Flags().AddFlagSet(FsNetworkAddress) + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + cmd.Flags().AddFlagSet(flagSetDescriptionCreate()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagNetworkAddress) _ = cmd.MarkFlagRequired(FlagMoniker) @@ -249,9 +266,10 @@ func UpdateResourceNodeStakeCmd() *cobra.Command { }, } - cmd.Flags().AddFlagSet(FsIncrStake) - cmd.Flags().AddFlagSet(FsStakeDelta) - cmd.Flags().AddFlagSet(FsNetworkAddress) + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + cmd.Flags().AddFlagSet(flagSetStakeUpdate()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) _ = cmd.MarkFlagRequired(FlagStakeDelta) @@ -282,9 +300,10 @@ func UpdateIndexingNodeStakeCmd() *cobra.Command { }, } - cmd.Flags().AddFlagSet(FsIncrStake) - cmd.Flags().AddFlagSet(FsStakeDelta) - cmd.Flags().AddFlagSet(FsNetworkAddress) + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + cmd.Flags().AddFlagSet(flagSetStakeUpdate()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) _ = cmd.MarkFlagRequired(FlagStakeDelta) @@ -316,10 +335,9 @@ func IndexingNodeRegistrationVoteCmd() *cobra.Command { }, } - cmd.Flags().AddFlagSet(FsCandidateNetworkAddress) - cmd.Flags().AddFlagSet(FsCandidateOwnerAddress) - cmd.Flags().AddFlagSet(FsOpinion) - cmd.Flags().AddFlagSet(FsVoterNetworkAddress) + cmd.Flags().AddFlagSet(flagSetVoting()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) _ = cmd.MarkFlagRequired(FlagCandidateNetworkAddress) @@ -331,40 +349,74 @@ func IndexingNodeRegistrationVoteCmd() *cobra.Command { // makes a new CreateResourceNodeMsg. func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateResourceNode, error) { - fAmount, _ := fs.GetString(FlagAmount) - amount, err := sdk.ParseCoinNormalized(fAmount) + flagAmountStr, err := fs.GetString(FlagAmount) + if err != nil { + return txf, nil, err + } + amount, err := sdk.ParseCoinNormalized(flagAmountStr) if err != nil { return txf, nil, err } - networkAddrstr := viper.GetString(FlagNetworkAddress) - networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) + flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) + if err != nil { + return txf, nil, err + } + networkAddr, err := stratos.SdsAddressFromBech32(flagNetworkAddrStr) if err != nil { return txf, nil, err } + ownerAddr := clientCtx.GetFromAddress() - pkStr := viper.GetString(FlagPubKey) - nodeTypeRef := viper.GetInt(FlagNodeType) + + pkStr, err := fs.GetString(FlagPubKey) + if err != nil { + return txf, nil, err + } + + var pk cryptotypes.PubKey + if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(pkStr), &pk); err != nil { + return txf, nil, err + } + //pkStr := viper.GetString(FlagPubKey) + + nodeTypeRef, err := fs.GetInt(FlagNodeType) + if err != nil { + return txf, nil, err + } pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) if er != nil { return txf, nil, err } - desc := types.NewDescription( - viper.GetString(FlagMoniker), - viper.GetString(FlagIdentity), - viper.GetString(FlagWebsite), - viper.GetString(FlagSecurityContact), - viper.GetString(FlagDetails), + moniker, _ := fs.GetString(FlagMoniker) + identity, _ := fs.GetString(FlagIdentity) + website, _ := fs.GetString(FlagWebsite) + security, _ := fs.GetString(FlagSecurityContact) + details, _ := fs.GetString(FlagDetails) + description := types.NewDescription( + moniker, + identity, + website, + security, + details, ) + //desc := types.NewDescription( + // viper.GetString(FlagMoniker), + // viper.GetString(FlagIdentity), + // viper.GetString(FlagWebsite), + // viper.GetString(FlagSecurityContact), + // viper.GetString(FlagDetails), + //) + // validate nodeTypeRef newNodeType := types.NodeType(nodeTypeRef) if t := newNodeType.Type(); t == "UNKNOWN" { return txf, nil, types.ErrNodeType } - msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, &desc, &newNodeType) + msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, &description, &newNodeType) if er != nil { return txf, nil, err } @@ -373,33 +425,63 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs // makes a new MsgCreateIndexingNode. func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateResourceNode, error) { - fAmount, _ := fs.GetString(FlagAmount) - amount, err := sdk.ParseCoinNormalized(fAmount) + flagAmountStr, err := fs.GetString(FlagAmount) + if err != nil { + return txf, nil, err + } + amount, err := sdk.ParseCoinNormalized(flagAmountStr) if err != nil { return txf, nil, err } - networkAddrstr := viper.GetString(FlagNetworkAddress) - networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) + flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) if err != nil { return txf, nil, err } + networkAddr, err := stratos.SdsAddressFromBech32(flagNetworkAddrStr) + if err != nil { + return txf, nil, err + } + ownerAddr := clientCtx.GetFromAddress() - pkStr := viper.GetString(FlagPubKey) + pkStr, err := fs.GetString(FlagPubKey) + if err != nil { + return txf, nil, err + } pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) if er != nil { return txf, nil, err } - desc := types.NewDescription( - viper.GetString(FlagMoniker), - viper.GetString(FlagIdentity), - viper.GetString(FlagWebsite), - viper.GetString(FlagSecurityContact), - viper.GetString(FlagDetails), + moniker, _ := fs.GetString(FlagMoniker) + identity, _ := fs.GetString(FlagIdentity) + website, _ := fs.GetString(FlagWebsite) + security, _ := fs.GetString(FlagSecurityContact) + details, _ := fs.GetString(FlagDetails) + description := types.NewDescription( + moniker, + identity, + website, + security, + details, ) - msg, er := types.NewMsgCreateIndexingNode(networkAddr, pubKey, amount, ownerAddr, &desc) + + //pkStr := viper.GetString(FlagPubKey) + + //pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) + //if er != nil { + // return txf, nil, err + //} + // + //desc := types.NewDescription( + // viper.GetString(FlagMoniker), + // viper.GetString(FlagIdentity), + // viper.GetString(FlagWebsite), + // viper.GetString(FlagSecurityContact), + // viper.GetString(FlagDetails), + //) + msg, er := types.NewMsgCreateIndexingNode(networkAddr, pubKey, amount, ownerAddr, &description) if er != nil { return txf, nil, err } @@ -407,67 +489,126 @@ func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs } // makes a new MsgUpdateResourceNode. -func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateResourceNode, error) { - networkAddrstr := viper.GetString(FlagNetworkAddress) - networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) +func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateResourceNode, error) { + //networkAddrstr := viper.GetString(FlagNetworkAddress) + //networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) + //if err != nil { + // return txf, nil, err + //} + + flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) + if err != nil { + return txf, nil, err + } + networkAddr, err := stratos.SdsAddressFromBech32(flagNetworkAddrStr) if err != nil { return txf, nil, err } + ownerAddr := clientCtx.GetFromAddress() - nodeTypeRef := viper.GetInt(FlagNodeType) - - desc := types.NewDescription( - viper.GetString(FlagMoniker), - viper.GetString(FlagIdentity), - viper.GetString(FlagWebsite), - viper.GetString(FlagSecurityContact), - viper.GetString(FlagDetails), + + moniker, _ := fs.GetString(FlagMoniker) + identity, _ := fs.GetString(FlagIdentity) + website, _ := fs.GetString(FlagWebsite) + security, _ := fs.GetString(FlagSecurityContact) + details, _ := fs.GetString(FlagDetails) + description := types.NewDescription( + moniker, + identity, + website, + security, + details, ) + nodeTypeRef, err := fs.GetInt(FlagNodeType) + if err != nil { + return txf, nil, err + } + + //nodeTypeRef := viper.GetInt(FlagNodeType) + + //desc := types.NewDescription( + // viper.GetString(FlagMoniker), + // viper.GetString(FlagIdentity), + // viper.GetString(FlagWebsite), + // viper.GetString(FlagSecurityContact), + // viper.GetString(FlagDetails), + //) + newNodeType := types.NodeType(nodeTypeRef) if t := newNodeType.Type(); t == "UNKNOWN" { return txf, nil, types.ErrNodeType } - msg := types.NewMsgUpdateResourceNode(desc, newNodeType, networkAddr, ownerAddr) + msg := types.NewMsgUpdateResourceNode(description, newNodeType, networkAddr, ownerAddr) return txf, msg, nil } // makes a new MsgUpdateIndexingNode. -func newBuildUpdateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNode, error) { - desc := types.NewDescription( - viper.GetString(FlagMoniker), - viper.GetString(FlagIdentity), - viper.GetString(FlagWebsite), - viper.GetString(FlagSecurityContact), - viper.GetString(FlagDetails), - ) - - networkAddrstr := viper.GetString(FlagNetworkAddress) - networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) +func newBuildUpdateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNode, error) { + //desc := types.NewDescription( + // viper.GetString(FlagMoniker), + // viper.GetString(FlagIdentity), + // viper.GetString(FlagWebsite), + // viper.GetString(FlagSecurityContact), + // viper.GetString(FlagDetails), + //) + // + //networkAddrstr := viper.GetString(FlagNetworkAddress) + //networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) + //if err != nil { + // return txf, nil, err + //} + //ownerAddr := clientCtx.GetFromAddress() + + flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) + if err != nil { + return txf, nil, err + } + networkAddr, err := stratos.SdsAddressFromBech32(flagNetworkAddrStr) if err != nil { return txf, nil, err } + ownerAddr := clientCtx.GetFromAddress() - msg := types.NewMsgUpdateIndexingNode(desc, networkAddr, ownerAddr) + moniker, _ := fs.GetString(FlagMoniker) + identity, _ := fs.GetString(FlagIdentity) + website, _ := fs.GetString(FlagWebsite) + security, _ := fs.GetString(FlagSecurityContact) + details, _ := fs.GetString(FlagDetails) + description := types.NewDescription( + moniker, + identity, + website, + security, + details, + ) + + msg := types.NewMsgUpdateIndexingNode(description, networkAddr, ownerAddr) return txf, msg, nil } // newBuildUpdateResourceNodeStakeMsg makes a new UpdateResourceNodeStakeMsg. -func newBuildUpdateResourceNodeStakeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateResourceNodeStake, error) { - stakeDeltaStr := viper.GetString(FlagStakeDelta) +func newBuildUpdateResourceNodeStakeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateResourceNodeStake, error) { + stakeDeltaStr, err := fs.GetString(FlagStakeDelta) + if err != nil { + return txf, nil, err + } stakeDelta, err := sdk.ParseCoinNormalized(stakeDeltaStr) if err != nil { return txf, nil, err } - incrStakeStr := viper.GetString(FlagIncrStake) + incrStakeStr, err := fs.GetString(FlagIncrStake) + if err != nil { + return txf, nil, err + } incrStake, err := strconv.ParseBool(incrStakeStr) if err != nil { return txf, nil, err } - networkAddrStr := viper.GetString(FlagNetworkAddress) + networkAddrStr, _ := fs.GetString(FlagNetworkAddress) networkAddr, err := stratos.SdsAddressFromBech32(networkAddrStr) if err != nil { return txf, nil, err @@ -480,20 +621,44 @@ func newBuildUpdateResourceNodeStakeMsg(clientCtx client.Context, txf tx.Factory } // newBuildUpdateIndexingNodeStakeMsg makes a new UpdateIndexingNodeStakeMsg. -func newBuildUpdateIndexingNodeStakeMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNodeStake, error) { - stakeDeltaStr := viper.GetString(FlagStakeDelta) +func newBuildUpdateIndexingNodeStakeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNodeStake, error) { + //stakeDeltaStr := viper.GetString(FlagStakeDelta) + //stakeDelta, err := sdk.ParseCoinNormalized(stakeDeltaStr) + //if err != nil { + // return txf, nil, err + //} + // + //incrStakeStr := viper.GetString(FlagIncrStake) + //incrStake, err := strconv.ParseBool(incrStakeStr) + //if err != nil { + // return txf, nil, err + //} + // + //networkAddrStr := viper.GetString(FlagNetworkAddress) + //networkAddr, err := stratos.SdsAddressFromBech32(networkAddrStr) + //if err != nil { + // return txf, nil, err + //} + + stakeDeltaStr, err := fs.GetString(FlagStakeDelta) + if err != nil { + return txf, nil, err + } stakeDelta, err := sdk.ParseCoinNormalized(stakeDeltaStr) if err != nil { return txf, nil, err } - incrStakeStr := viper.GetString(FlagIncrStake) + incrStakeStr, err := fs.GetString(FlagIncrStake) + if err != nil { + return txf, nil, err + } incrStake, err := strconv.ParseBool(incrStakeStr) if err != nil { return txf, nil, err } - networkAddrStr := viper.GetString(FlagNetworkAddress) + networkAddrStr, _ := fs.GetString(FlagNetworkAddress) networkAddr, err := stratos.SdsAddressFromBech32(networkAddrStr) if err != nil { return txf, nil, err @@ -505,24 +670,39 @@ func newBuildUpdateIndexingNodeStakeMsg(clientCtx client.Context, txf tx.Factory return txf, msg, nil } -func newBuildIndexingNodeRegistrationVoteMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgIndexingNodeRegistrationVote, error) { - candidateNetworkAddrStr := viper.GetString(FlagCandidateNetworkAddress) +func newBuildIndexingNodeRegistrationVoteMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgIndexingNodeRegistrationVote, error) { + candidateNetworkAddrStr, err := fs.GetString(FlagCandidateNetworkAddress) + if err != nil { + return txf, nil, err + } candidateNetworkAddr, err := stratos.SdsAddressFromBech32(candidateNetworkAddrStr) if err != nil { return txf, nil, err } - candidateOwnerAddrStr := viper.GetString(FlagCandidateOwnerAddress) + + candidateOwnerAddrStr, err := fs.GetString(FlagCandidateOwnerAddress) + if err != nil { + return txf, nil, err + } candidateOwnerAddr, err := sdk.AccAddressFromBech32(candidateOwnerAddrStr) if err != nil { return txf, nil, err } - opinionVal := viper.GetBool(FlagOpinion) + + opinionVal, err := fs.GetBool(FlagOpinion) + if err != nil { + return txf, nil, err + } //opinion := types.VoteOpinionFromBool(opinionVal) - voterNetworkAddrStr := viper.GetString(FlagVoterNetworkAddress) + voterNetworkAddrStr, err := fs.GetString(FlagVoterNetworkAddress) + if err != nil { + return txf, nil, err + } voterNetworkAddr, err := stratos.SdsAddressFromBech32(voterNetworkAddrStr) if err != nil { return txf, nil, err } + voterOwnerAddr := clientCtx.GetFromAddress() msg := types.NewMsgIndexingNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, opinionVal, voterNetworkAddr, voterOwnerAddr) diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 194e7372..39e1f588 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -367,9 +367,9 @@ func (m *IndexingNodeRegistrationVotePool) GetExpireTime() *time.Time { type Description struct { Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker" yaml:"moniker"` Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity" yaml:"identity",omitempty` - Website string `protobuf:"bytes,3,opt,name=Website,proto3" json:"website" yaml:"website",omitempty` - SecurityContact string `protobuf:"bytes,4,opt,name=SecurityContact,proto3" json:"security_contact" yaml:"security_contact",omitempty` - Details string `protobuf:"bytes,5,opt,name=Details,proto3" json:"details" yaml:"details",omitempty` + Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website" yaml:"website",omitempty` + SecurityContact string `protobuf:"bytes,4,opt,name=securityContact,proto3" json:"security_contact" yaml:"security_contact",omitempty` + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details" yaml:"details",omitempty` } func (m *Description) Reset() { *m = Description{} } @@ -441,8 +441,8 @@ func (m *Description) GetDetails() string { } type Slashing struct { - WalletAddress string `protobuf:"bytes,1,opt,name=WalletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"value" yaml:"value"` + WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value" yaml:"value"` } func (m *Slashing) Reset() { *m = Slashing{} } @@ -959,113 +959,113 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1692 bytes of a gzipped FileDescriptorProto + // 1682 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x23, 0x49, - 0x15, 0x8f, 0xed, 0x4d, 0x9c, 0x94, 0x3f, 0x12, 0x7a, 0xb2, 0x8c, 0x33, 0x40, 0xca, 0x53, 0x7c, - 0x6c, 0xd0, 0x12, 0x5b, 0x99, 0x41, 0x42, 0xac, 0xc4, 0x21, 0x3d, 0x89, 0x42, 0xb4, 0xec, 0x10, - 0x3a, 0x21, 0x01, 0xa4, 0x95, 0x69, 0x77, 0xd7, 0x3a, 0x45, 0xec, 0x2a, 0xab, 0xab, 0x9c, 0xc4, - 0x37, 0x8e, 0x9c, 0xd0, 0xde, 0xd8, 0x13, 0xca,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0xf5, 0x55, 0xee, 0xb3, 0x10, 0x27, 0x11, 0xbd, 0x63, 0xee, 0xa7, 0x0c, 0xce, 0x3e, 0xa8, - 0xf8, 0xc3, 0x61, 0xc4, 0xce, 0xf1, 0x0f, 0x08, 0x17, 0x8d, 0x62, 0xb3, 0xb4, 0xb1, 0xe4, 0xbe, - 0x33, 0x89, 0x61, 0xd5, 0xc0, 0x9d, 0x3e, 0xe1, 0x62, 0x1a, 0xc3, 0x07, 0x9a, 0xcd, 0x46, 0x91, - 0x67, 0xeb, 0x3a, 0xbb, 0x00, 0x44, 0xf8, 0x17, 0x38, 0x10, 0x8a, 0xa9, 0xa4, 0x98, 0x54, 0xf0, - 0x35, 0x9a, 0x10, 0x99, 0xe0, 0x5b, 0x20, 0xf2, 0x2c, 0x45, 0x07, 0x03, 0x80, 0x2f, 0x87, 0x24, - 0xc2, 0x32, 0x2a, 0x2a, 0xeb, 0x5f, 0x1f, 0x78, 0x99, 0x4f, 0x15, 0xad, 0x91, 0x84, 0xdc, 0x98, - 0xb0, 0x40, 0x1d, 0x70, 0x8b, 0x18, 0xfd, 0xb3, 0x08, 0x2a, 0x56, 0x9a, 0xc8, 0x0a, 0x1d, 0x30, - 0x4a, 0xce, 0x70, 0xd2, 0x51, 0x54, 0x85, 0x1a, 0x28, 0xad, 0x50, 0x03, 0x20, 0x2f, 0x11, 0x39, - 0xbb, 0x60, 0x91, 0x84, 0x98, 0x0a, 0x22, 0x74, 0xff, 0xd0, 0x19, 0x3e, 0xc3, 0xa6, 0x31, 0x5c, - 0xd3, 0xaa, 0x09, 0x62, 0xcf, 0x03, 0xb3, 0x6d, 0xce, 0x36, 0x28, 0x9f, 0xe0, 0x2e, 0x27, 0x42, - 0xcf, 0x3b, 0xfa, 0x12, 0xca, 0x17, 0x1a, 0x9a, 0xc6, 0xb0, 0xa1, 0x49, 0x0c, 0x60, 0x73, 0x24, - 0x7a, 0x4e, 0x00, 0x96, 0x0f, 0x71, 0x30, 0x8a, 0x88, 0x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17, + 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/sds/client/cli/flags.go b/x/sds/client/cli/flags.go index 9b36050f..eabba15a 100644 --- a/x/sds/client/cli/flags.go +++ b/x/sds/client/cli/flags.go @@ -1,7 +1,29 @@ package cli +import ( + flag "github.com/spf13/pflag" +) + const ( FlagFileHash = "file-hash" FlagReporter = "reporter" FlagUploader = "uploader" ) + +func flagSetFileHash() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagFileHash, "", "The hash of uploaded file") + return fs +} + +func flagSetReporter() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagReporter, "", "The reporter address of file") + return fs +} + +func flagSetUploader() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.String(FlagUploader, "", "The uploader address of file") + return fs +} diff --git a/x/sds/client/cli/query.go b/x/sds/client/cli/query.go index 9f1ca999..93c30991 100644 --- a/x/sds/client/cli/query.go +++ b/x/sds/client/cli/query.go @@ -5,10 +5,11 @@ import ( "strings" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" - "github.com/spf13/viper" + stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/sds/types" ) @@ -54,7 +55,7 @@ $ %s query sds upload c03661732294feb49caf6dc16c7cbb2534986d73 } queryClient := types.NewQueryClient(clientCtx) - queryFileHash := viper.GetString(FlagFileHash) + queryFileHash := strings.TrimSpace(args[0][:]) if len(queryFileHash) == 0 { return sdkerrors.Wrap(types.ErrEmptyFileHash, "Missing file hash") } @@ -77,7 +78,9 @@ $ %s query sds upload c03661732294feb49caf6dc16c7cbb2534986d73 return clientCtx.PrintProto(result) }, } - cmd.Flags().String(FlagFileHash, "", "the file hash") + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "upload") return cmd } @@ -103,10 +106,14 @@ $ %s query sds prepay st1yx3kkx9jnqeck59j744nc5qgtv4lt4dc45jcwz } queryClient := types.NewQueryClient(clientCtx) - queryAccAddr := viper.GetString(args[0]) + queryAccAddr := strings.TrimSpace(args[0][:]) if len(queryAccAddr) == 0 { return sdkerrors.Wrap(types.ErrEmptySenderAddr, "Missing sender address") } + _, err = stratos.SdsAddressFromBech32(queryAccAddr) + if err != nil { + return err + } result, err := queryClient.Prepay(cmd.Context(), &types.QueryPrepayRequest{ AcctAddr: queryAccAddr, @@ -118,6 +125,6 @@ $ %s query sds prepay st1yx3kkx9jnqeck59j744nc5qgtv4lt4dc45jcwz return clientCtx.PrintProto(result) }, } - cmd.Flags().String(FlagFileHash, "", "the file hash") + flags.AddQueryFlagsToCmd(cmd) return cmd } diff --git a/x/sds/client/cli/tx.go b/x/sds/client/cli/tx.go index a80d7d6a..1063c4fc 100644 --- a/x/sds/client/cli/tx.go +++ b/x/sds/client/cli/tx.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/spf13/viper" stratos "github.com/stratosnet/stratos-chain/types" "github.com/cosmos/cosmos-sdk/client" @@ -38,7 +37,7 @@ func FileUploadTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: "upload [flags]", Short: "Create and sign a file upload tx", - Args: cobra.RangeArgs(0, 3), + //Args: cobra.RangeArgs(0, 3), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -57,9 +56,14 @@ func FileUploadTxCmd() *cobra.Command { } //cmd = flags.PostCommands(cmd)[0] //cmd.Flags().String(flags.FlagFrom, "", "from address") - cmd.Flags().String(FlagFileHash, "", "Hash of uploaded file") - cmd.Flags().String(FlagReporter, "", "Reporter of file") - cmd.Flags().String(FlagUploader, "", "Uploader of file") + //cmd.Flags().String(FlagFileHash, "", "Hash of uploaded file") + //cmd.Flags().String(FlagReporter, "", "Reporter of file") + //cmd.Flags().String(FlagUploader, "", "Uploader of file") + cmd.Flags().AddFlagSet(flagSetFileHash()) + cmd.Flags().AddFlagSet(flagSetReporter()) + cmd.Flags().AddFlagSet(flagSetUploader()) + + flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) _ = cmd.MarkFlagRequired(FlagFileHash) @@ -76,11 +80,18 @@ func PrepayTxCmd() *cobra.Command { Short: "Create and sign a prepay tx", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) + cliCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } + fromAddr, fromName, _, err := client.GetFromFields(cliCtx.Keyring, args[0], cliCtx.GenerateOnly) + if err != nil { + return err + } + + clientCtx := cliCtx.WithFrom(args[0]).WithFromAddress(fromAddr).WithFromName(fromName) + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) txf, msg, err := newBuildPrepayMsg(clientCtx, txf, cmd.Flags()) @@ -106,34 +117,47 @@ func PrepayTxCmd() *cobra.Command { //return utils.GenerateOrBroadcastMsgs(cliCtx, txBldr, []sdk.Msg{msg}) }, } - + flags.AddTxFlagsToCmd(cmd) //cmd = flags.PostCommands(cmd)[0] return cmd } // makes a new newBuildFileuploadMsg -func newBuildFileuploadMsg(clientCtx client.Context, txf tx.Factory, _ *flag.FlagSet) (tx.Factory, *types.MsgFileUpload, error) { - fileHash := viper.GetString(FlagFileHash) - _, err := hex.DecodeString(fileHash) +func newBuildFileuploadMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgFileUpload, error) { + fileHash, err := fs.GetString(FlagFileHash) + if err != nil { + return txf, nil, err + } + _, err = hex.DecodeString(fileHash) if err != nil { return txf, nil, err } - _, err = stratos.SdsAddressFromBech32(viper.GetString(FlagReporter)) + flagReporterStr, err := fs.GetString(FlagReporter) + if err != nil { + return txf, nil, err + } + _, err = stratos.SdsAddressFromBech32(flagReporterStr) if err != nil { return txf, nil, err } - _, err = sdk.AccAddressFromBech32(viper.GetString(FlagUploader)) + flagUploaderStr, err := fs.GetString(FlagUploader) + if err != nil { + return txf, nil, err + } + _, err = sdk.AccAddressFromBech32(flagUploaderStr) if err != nil { return txf, nil, err } - msg := types.NewMsgUpload(fileHash, + msg := types.NewMsgUpload( + fileHash, clientCtx.GetFromAddress().String(), - viper.GetString(FlagReporter), - viper.GetString(FlagUploader)) + flagReporterStr, + flagUploaderStr, + ) return txf, msg, nil } From 09cd2c54476a83a48019f094ec3eaae9c3c72314 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 24 May 2022 17:54:16 -0400 Subject: [PATCH 071/113] unified proto field format --- proto/stratos/pot/v1/genesis.proto | 10 +- proto/stratos/pot/v1/pot.proto | 30 +- proto/stratos/pot/v1/query.proto | 2 +- proto/stratos/pot/v1/tx.proto | 22 +- proto/stratos/register/v1/genesis.proto | 16 +- proto/stratos/register/v1/register.proto | 48 +-- proto/stratos/register/v1/tx.proto | 24 +- proto/stratos/sds/v1/genesis.proto | 2 +- proto/stratos/sds/v1/sds.proto | 4 +- proto/stratos/sds/v1/tx.proto | 2 +- x/pot/types/genesis.pb.go | 68 ++-- x/pot/types/msg.go | 8 +- x/pot/types/pot.pb.go | 166 ++++---- x/pot/types/query.pb.go | 48 +-- x/pot/types/tx.pb.go | 165 ++++---- x/register/keeper/grpc_query.go | 8 +- x/register/keeper/indexing_node.go | 8 +- x/register/keeper/indexing_node_test.go | 495 ++++++++++++----------- x/register/keeper/keeper.go | 8 +- x/register/keeper/msg_server.go | 8 +- x/register/keeper/node_state_change.go | 4 +- x/register/keeper/querier.go | 16 +- x/register/keeper/resource_node.go | 4 +- x/register/types/genesis.go | 18 +- x/register/types/genesis.pb.go | 164 ++++---- x/register/types/indexing_node.go | 32 +- x/register/types/msg.go | 30 +- x/register/types/querier.go | 8 +- x/register/types/register.pb.go | 453 +++++++++++---------- x/register/types/registration.go | 2 +- x/register/types/resource_node.go | 54 +-- x/register/types/tx.pb.go | 267 ++++++------ x/sds/types/genesis.pb.go | 24 +- x/sds/types/sds.pb.go | 52 +-- x/sds/types/tx.pb.go | 73 ++-- 35 files changed, 1174 insertions(+), 1169 deletions(-) diff --git a/proto/stratos/pot/v1/genesis.proto b/proto/stratos/pot/v1/genesis.proto index b9f00b35..cfa786fa 100644 --- a/proto/stratos/pot/v1/genesis.proto +++ b/proto/stratos/pot/v1/genesis.proto @@ -17,11 +17,11 @@ option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; // GenesisState defines the register module's genesis state. message GenesisState { pot.v1.Params params = 1 [ (gogoproto.moretags) = "yaml:\"params\"" ]; - cosmos.base.v1beta1.Coin totalMinedToken = 2 [ (gogoproto.moretags) = "yaml:\"total_mined_token\"" ]; - int64 lastReportedEpoch = 3 [ (gogoproto.moretags) = "yaml:\"last_reported_epoch\"" ]; - repeated pot.v1.ImmatureTotal immatureTotalInfo = 4 [ (gogoproto.moretags) = "yaml:\"immature_total_info\""]; - repeated pot.v1.MatureTotal matureTotalInfo = 5 [ (gogoproto.moretags) = "yaml:\"mature_total_info\""]; - repeated pot.v1.Reward IndividualRewardInfo = 6 [ (gogoproto.moretags) = "yaml:\"individual_reward_info\""]; + cosmos.base.v1beta1.Coin total_mined_token = 2 [ (gogoproto.moretags) = "yaml:\"total_mined_token\"" ]; + int64 last_reported_epoch = 3 [ (gogoproto.moretags) = "yaml:\"last_reported_epoch\"" ]; + repeated pot.v1.ImmatureTotal immature_total_info = 4 [ (gogoproto.moretags) = "yaml:\"immature_total_info\""]; + repeated pot.v1.MatureTotal mature_total_info = 5 [ (gogoproto.moretags) = "yaml:\"mature_total_info\""]; + repeated pot.v1.Reward individual_reward_info = 6 [ (gogoproto.moretags) = "yaml:\"individual_reward_info\""]; } //message GenesisIndexingNode { diff --git a/proto/stratos/pot/v1/pot.proto b/proto/stratos/pot/v1/pot.proto index 91e0f811..d229d86f 100644 --- a/proto/stratos/pot/v1/pot.proto +++ b/proto/stratos/pot/v1/pot.proto @@ -27,20 +27,20 @@ message Params { } message MiningRewardParam { - cosmos.base.v1beta1.Coin totalMinedValveStart = 1 [ (gogoproto.moretags) = "yaml:\"total_mined_valve_start\"" ]; - cosmos.base.v1beta1.Coin totalMinedValveEnd = 2 [ (gogoproto.moretags) = "yaml:\"total_mined_valve_end\"" ]; - cosmos.base.v1beta1.Coin miningReward = 3 [ (gogoproto.moretags) = "yaml:\"mining_reward\"" ]; - string blockChainPercentageInTenThousand = 4 [ + cosmos.base.v1beta1.Coin total_mined_valve_start = 1 [ (gogoproto.moretags) = "yaml:\"total_mined_valve_start\"" ]; + cosmos.base.v1beta1.Coin total_mined_valve_end = 2 [ (gogoproto.moretags) = "yaml:\"total_mined_valve_end\"" ]; + cosmos.base.v1beta1.Coin mining_reward = 3 [ (gogoproto.moretags) = "yaml:\"mining_reward\"" ]; + string block_chain_percentage_in_ten_thousand = 4 [ (gogoproto.jsontag) = "block_chain_percentage_in_ten_thousand", (gogoproto.moretags) = "yaml:\"block_chain_percentage_in_ten_thousand\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string resourceNodePercentageInTenThousand = 5 [ + string resource_node_percentage_in_ten_thousand = 5 [ (gogoproto.jsontag) = "resource_node_percentage_in_ten_thousand", (gogoproto.moretags) = "yaml:\"resource_node_percentage_in_ten_thousand\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string metaNodePercentageInTenThousand = 6 [ + string meta_node_percentage_in_ten_thousand = 6 [ (gogoproto.jsontag) = "meta_node_percentage_in_ten_thousand", (gogoproto.moretags) = "yaml:\"meta_node_percentage_in_ten_thousand\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" @@ -48,7 +48,7 @@ message MiningRewardParam { } message ImmatureTotal { - string walletAddress = 1 [ + string wallet_address = 1 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; @@ -56,7 +56,7 @@ message ImmatureTotal { } message MatureTotal { - string walletAddress = 1 [ + string wallet_address = 1 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; @@ -64,17 +64,17 @@ message MatureTotal { } message Reward { - string walletAddress = 1 [ + string wallet_address = 1 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; - repeated cosmos.base.v1beta1.Coin rewardFromMiningPool = 2 [ + repeated cosmos.base.v1beta1.Coin reward_from_mining_pool = 2 [ (gogoproto.nullable) = false, (gogoproto.jsontag) = "reward_from_mining_pool", (gogoproto.moretags) = "yaml:\"reward_from_mining_pool\"", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - repeated cosmos.base.v1beta1.Coin rewardFromTrafficPool = 3 [ + repeated cosmos.base.v1beta1.Coin reward_from_traffic_pool = 3 [ (gogoproto.nullable) = false, (gogoproto.jsontag) = "reward_from_traffic_pool", (gogoproto.moretags) = "yaml:\"reward_from_traffic_pool\"", @@ -83,7 +83,7 @@ message Reward { } message SingleWalletVolume { - string walletAddress = 1 [ + string wallet_address = 1 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; @@ -99,18 +99,18 @@ message VolumeReportRecord { (gogoproto.jsontag) = "reporter", (gogoproto.moretags) = "yaml:\"reporter\"" ]; - string reportReference = 2 [ + string report_reference = 2 [ (gogoproto.jsontag) = "report_reference", (gogoproto.moretags) = "yaml:\"report_reference\"" ]; - string txHash = 3 [ + string tx_hash = 3 [ (gogoproto.jsontag) = "tx_hash", (gogoproto.moretags) = "yaml:\"tx_hash\"" ]; } message BLSSignatureInfo { - repeated bytes pubKeys = 1 [ + repeated bytes pub_keys = 1 [ (gogoproto.jsontag) = "pub_keys", (gogoproto.moretags) = "yaml:\"pub_keys\"" ]; diff --git a/proto/stratos/pot/v1/query.proto b/proto/stratos/pot/v1/query.proto index d79e0b15..03613a29 100644 --- a/proto/stratos/pot/v1/query.proto +++ b/proto/stratos/pot/v1/query.proto @@ -32,7 +32,7 @@ message ReportInfo { // QueryVolumeReportResponse is response type for the Query/ResourceNode RPC method message QueryVolumeReportResponse { // node defines the the volumeReport info. - ReportInfo reportInfo = 1; + ReportInfo report_info = 1; int64 height = 2; } diff --git a/proto/stratos/pot/v1/tx.proto b/proto/stratos/pot/v1/tx.proto index 05cbbf59..85ecde9b 100644 --- a/proto/stratos/pot/v1/tx.proto +++ b/proto/stratos/pot/v1/tx.proto @@ -30,7 +30,7 @@ service Msg { // MsgVolumeReport encapsulates an VolumeReport transaction as an SDK message. message MsgVolumeReport { - repeated SingleWalletVolume walletVolumes = 1 [ + repeated SingleWalletVolume wallet_volumes = 1 [ (gogoproto.jsontag) = "wallet_volumes", (gogoproto.moretags) = "yaml:\"wallet_volumes\"" ]; @@ -43,15 +43,15 @@ message MsgVolumeReport { (gogoproto.moretags) = "yaml:\"epoch\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string reportReference = 4 [ + string report_reference = 4 [ (gogoproto.jsontag) = "report_reference", (gogoproto.moretags) = "yaml:\"report_reference\"" ]; - string reporterOwner = 5 [ + string reporter_owner = 5 [ (gogoproto.jsontag) = "reporter_owner", (gogoproto.moretags) = "yaml:\"reporter_owner\"" ]; - BLSSignatureInfo bLSSignature = 6 [ + BLSSignatureInfo bls_signature = 6 [ (gogoproto.jsontag) = "bls_signature", (gogoproto.moretags) = "yaml:\"bls_signature\"" ]; @@ -61,17 +61,17 @@ message MsgVolumeReportResponse {} // MsgWithdraw encapsulates an withdraw transaction as an SDK message. message MsgWithdraw { - repeated cosmos.base.v1beta1.Coin Amount = 1 [ + repeated cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false, (gogoproto.jsontag) = "amount", (gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - string walletAddress = 2 [ + string wallet_address = 2 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; - string targetAddress = 3 [ + string target_address = 3 [ (gogoproto.jsontag) = "target_address", (gogoproto.moretags) = "yaml:\"target_address\"" ]; @@ -81,7 +81,7 @@ message MsgWithdrawResponse {} // MsgFoundationDeposit - encapsulates an FoundationDeposit transaction as an SDK message message MsgFoundationDeposit { - repeated cosmos.base.v1beta1.Coin Amount = 1 [ + repeated cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false, (gogoproto.jsontag) = "amount", (gogoproto.moretags) = "yaml:\"amount\"", @@ -102,15 +102,15 @@ message MsgSlashingResourceNode { (gogoproto.jsontag) = "reporters", (gogoproto.moretags) = "yaml:\"reporters\"" ]; - repeated string reporterOwner = 2 [ + repeated string reporter_owner = 2 [ (gogoproto.jsontag) = "reporter_owner", (gogoproto.moretags) = "yaml:\"reporter_owner\"" ]; - string networkAddress = 3 [ + string network_address = 3 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - string walletAddress = 4 [ + string wallet_address = 4 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto index 12858c06..403bf1e0 100644 --- a/proto/stratos/register/v1/genesis.proto +++ b/proto/stratos/register/v1/genesis.proto @@ -16,14 +16,14 @@ option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; // GenesisState defines the register module's genesis state. message GenesisState { register.v1.Params params = 1 [ (gogoproto.moretags) = "yaml:\"params\"" ]; - register.v1.ResourceNodes resourceNodes = 2 [ (gogoproto.moretags) = "yaml:\"resource_nodes\"" ]; - register.v1.IndexingNodes indexingNodes = 3 [ (gogoproto.moretags) = "yaml:\"indexing_nodes\"" ]; - string initialUozPrice = 4 [ + register.v1.ResourceNodes resource_nodes = 2 [ (gogoproto.moretags) = "yaml:\"resource_nodes\"" ]; + register.v1.IndexingNodes indexing_nodes = 3 [ (gogoproto.moretags) = "yaml:\"indexing_nodes\"" ]; + string initial_uoz_price = 4 [ (gogoproto.moretags) = "yaml:\"initial_uoz_price\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; //initial price of uoz - string totalUnissuedPrepay = 5 [ + string total_unissued_prepay = 5 [ (gogoproto.moretags) = "yaml:\"total_unissued_prepay\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false @@ -32,18 +32,18 @@ message GenesisState { } message GenesisIndexingNode { - string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the indexing node - google.protobuf.Any pubKey = 2 [ + string network_address = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the indexing node + google.protobuf.Any pubkey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"pubkey\"" ]; // the consensus public key of the indexing node; bech encoded in JSON bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; // has the indexing node been suspended from bonded status? cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\""]; // indexing node status (Unspecified/Bonded/Unbonding/Unbonded) - string token = 5 [ + string tokens = 5 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"token\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; // delegated tokens - string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the indexing node + string owner_address = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the indexing node register.v1.Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; // description terms for the indexing node } diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index df78636b..99b8c361 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -38,11 +38,11 @@ message Params { } message ResourceNode { - string networkAddr = 1 [ + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ + google.protobuf.Any pubkey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.jsontag) = "pubkey", (gogoproto.moretags) = "yaml:\"pubkey\"" @@ -60,7 +60,7 @@ message ResourceNode { (gogoproto.moretags) = "yaml:\"tokens\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string ownerAddress = 6 [ + string owner_address = 6 [ (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; @@ -74,7 +74,7 @@ message ResourceNode { (gogoproto.jsontag) = "creation_time", (gogoproto.moretags) = "yaml:\"creation_time\"" ]; - string nodeType = 9 [ + string node_type = 9 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -82,11 +82,11 @@ message ResourceNode { } message IndexingNode { - string networkAddr = 1 [ + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ + google.protobuf.Any pubkey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.jsontag) = "pubkey", (gogoproto.moretags) = "yaml:\"pubkey\"" @@ -104,7 +104,7 @@ message IndexingNode { (gogoproto.moretags) = "yaml:\"tokens\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string ownerAddress = 6 [ + string owner_address = 6 [ (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; @@ -121,20 +121,20 @@ message IndexingNode { } message IndexingNodeRegistrationVotePool { - string nodeAddress = 1 [ + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - repeated string approveList = 2 [ + repeated string approve_list = 2 [ (gogoproto.jsontag) = "approve_list", (gogoproto.moretags) = "yaml:\"approve_list\"" ]; - repeated string rejectList = 3 [ + repeated string reject_list = 3 [ (gogoproto.jsontag) = "reject_list", (gogoproto.moretags) = "yaml:\"reject_list\"" ]; - google.protobuf.Timestamp expireTime = 4 [ -// (gogoproto.nullable) = false, + google.protobuf.Timestamp expire_time = 4 [ + (gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.jsontag) = "expire_time", (gogoproto.moretags) = "yaml:\"expire_time\"" @@ -154,7 +154,7 @@ message Description { (gogoproto.jsontag) = "website", (gogoproto.moretags) = "yaml:\"website\",omitempty" ]; - string securityContact = 4 [ + string security_contact = 4 [ (gogoproto.jsontag) = "security_contact", (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; string details = 5 [ @@ -163,7 +163,7 @@ message Description { } message Slashing { - string walletAddress = 1 [ + string wallet_address = 1 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; @@ -174,11 +174,11 @@ message Slashing { } message ResourceNodes { - repeated ResourceNode resourceNodes = 1; + repeated ResourceNode resource_nodes = 1; } message IndexingNodes { - repeated IndexingNode indexingNodes = 1; + repeated IndexingNode indexing_nodes = 1; } message TotalStakesResponse { @@ -190,11 +190,11 @@ message TotalStakesResponse { } message StakingInfo { - string networkAddr = 1 [ + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ + google.protobuf.Any pubkey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.jsontag) = "pubkey", (gogoproto.moretags) = "yaml:\"pubkey\"" @@ -211,7 +211,7 @@ message StakingInfo { (gogoproto.moretags) = "yaml:\"tokens\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; - string ownerAddress = 6 [ + string owner_address = 6 [ (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; @@ -225,7 +225,7 @@ message StakingInfo { (gogoproto.jsontag) = "creation_time", (gogoproto.moretags) = "yaml:\"creation_time\"" ]; - string nodeType = 9 [ + string node_type = 9 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -250,7 +250,7 @@ message StakingInfo { // UnbondingNode stores all of a single delegator's unbonding bonds // for a single unbonding node in a time-ordered list message UnbondingNode { - string networkAddr = 1 [ + string network_addr = 1 [ (gogoproto.jsontag) = "network_addr", (gogoproto.moretags) = "yaml:\"network_addr\"" ]; @@ -289,9 +289,9 @@ message UnbondingNodeEntry { } message Staking { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; +// option (gogoproto.equal) = false; +// option (gogoproto.goproto_getters) = false; +// option (gogoproto.goproto_stringer) = false; // network_address is the bech32-encoded address of the node. string network_address = 1 [ diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto index d254d9ca..bf898fd8 100644 --- a/proto/stratos/register/v1/tx.proto +++ b/proto/stratos/register/v1/tx.proto @@ -48,11 +48,11 @@ service Msg { // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. message MsgCreateResourceNode { - string networkAddr = 1 [ + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ + google.protobuf.Any pubkey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.jsontag) = "pubkey", (gogoproto.moretags) = "yaml:\"pubkey\"" @@ -62,7 +62,7 @@ message MsgCreateResourceNode { (gogoproto.jsontag) = "value", (gogoproto.moretags) = "yaml:\"value\"" ]; - string ownerAddress = 4 [ + string owner_address = 4 [ (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; @@ -70,7 +70,7 @@ message MsgCreateResourceNode { (gogoproto.jsontag) = "description", (gogoproto.moretags) = "yaml:\"description\"" ]; - string nodeType = 6 [ + string node_type = 6 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -81,11 +81,11 @@ message MsgCreateResourceNodeResponse {} // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. message MsgCreateIndexingNode { - string networkAddr = 1 [ + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" ]; - google.protobuf.Any pubKey = 2 [ + google.protobuf.Any pubkey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.jsontag) = "pubkey", (gogoproto.moretags) = "yaml:\"pubkey\"" @@ -95,7 +95,7 @@ message MsgCreateIndexingNode { (gogoproto.jsontag) = "value", (gogoproto.moretags) = "yaml:\"value\"" ]; - string ownerAddress = 4 [ + string owner_address = 4 [ (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; @@ -161,7 +161,7 @@ message MsgUpdateResourceNode { (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - string nodeType = 4 [ + string node_type = 4 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -206,11 +206,11 @@ message MsgUpdateResourceNodeStake { (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - bool incrStake = 3 [ + bool incr_stake = 3 [ (gogoproto.jsontag) = "incr_stake", (gogoproto.moretags) = "yaml:\"incr_stake\"" ]; - cosmos.base.v1beta1.Coin StakeDelta = 4 [ + cosmos.base.v1beta1.Coin stake_delta = 4 [ (gogoproto.jsontag) = "stake_delta", (gogoproto.moretags) = "yaml:\"stake_delta\"" ]; @@ -233,11 +233,11 @@ message MsgUpdateIndexingNodeStake { (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - bool incrStake = 3 [ + bool incr_stake = 3 [ (gogoproto.jsontag) = "incr_stake", (gogoproto.moretags) = "yaml:\"incr_stake\"" ]; - cosmos.base.v1beta1.Coin StakeDelta = 4 [ + cosmos.base.v1beta1.Coin stake_delta = 4 [ (gogoproto.jsontag) = "stake_delta", (gogoproto.moretags) = "yaml:\"stake_delta\"" ]; diff --git a/proto/stratos/sds/v1/genesis.proto b/proto/stratos/sds/v1/genesis.proto index 85ce423a..c8de77a7 100644 --- a/proto/stratos/sds/v1/genesis.proto +++ b/proto/stratos/sds/v1/genesis.proto @@ -13,7 +13,7 @@ message GenesisState { (gogoproto.jsontag) = "params", (gogoproto.moretags) = "yaml:\"params\"" ]; - repeated FileUpload fileUploads = 2 [ + repeated FileUpload file_uploads = 2 [ (gogoproto.jsontag) = "file_uploads", (gogoproto.moretags) = "yaml:\"file_uploads\"" ]; diff --git a/proto/stratos/sds/v1/sds.proto b/proto/stratos/sds/v1/sds.proto index e8c22634..a1d3971b 100644 --- a/proto/stratos/sds/v1/sds.proto +++ b/proto/stratos/sds/v1/sds.proto @@ -14,11 +14,11 @@ message Params { } message FileUpload { - string fileHash = 1 [ + string file_hash = 1 [ (gogoproto.jsontag) = "file_hash", (gogoproto.moretags) = "yaml:\"file_hash\"" ]; - FileInfo fileInfo = 2 [ + FileInfo file_info = 2 [ (gogoproto.jsontag) = "file_info", (gogoproto.moretags) = "yaml:\"file_info\"" ]; } diff --git a/proto/stratos/sds/v1/tx.proto b/proto/stratos/sds/v1/tx.proto index 2a1fdd9c..442b08f5 100644 --- a/proto/stratos/sds/v1/tx.proto +++ b/proto/stratos/sds/v1/tx.proto @@ -22,7 +22,7 @@ service Msg { message MsgFileUpload { - string fileHash = 1 [ + string file_hash = 1 [ (gogoproto.jsontag) = "file_hash", (gogoproto.moretags) = "yaml:\"file_hash\"" ]; diff --git a/x/pot/types/genesis.pb.go b/x/pot/types/genesis.pb.go index 1251c8f0..aba2d487 100644 --- a/x/pot/types/genesis.pb.go +++ b/x/pot/types/genesis.pb.go @@ -27,11 +27,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the register module's genesis state. type GenesisState struct { Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` - TotalMinedToken *types.Coin `protobuf:"bytes,2,opt,name=totalMinedToken,proto3" json:"totalMinedToken,omitempty" yaml:"total_mined_token"` - LastReportedEpoch int64 `protobuf:"varint,3,opt,name=lastReportedEpoch,proto3" json:"lastReportedEpoch,omitempty" yaml:"last_reported_epoch"` - ImmatureTotalInfo []*ImmatureTotal `protobuf:"bytes,4,rep,name=immatureTotalInfo,proto3" json:"immatureTotalInfo,omitempty" yaml:"immature_total_info"` - MatureTotalInfo []*MatureTotal `protobuf:"bytes,5,rep,name=matureTotalInfo,proto3" json:"matureTotalInfo,omitempty" yaml:"mature_total_info"` - IndividualRewardInfo []*Reward `protobuf:"bytes,6,rep,name=IndividualRewardInfo,proto3" json:"IndividualRewardInfo,omitempty" yaml:"individual_reward_info"` + TotalMinedToken *types.Coin `protobuf:"bytes,2,opt,name=total_mined_token,json=totalMinedToken,proto3" json:"total_mined_token,omitempty" yaml:"total_mined_token"` + LastReportedEpoch int64 `protobuf:"varint,3,opt,name=last_reported_epoch,json=lastReportedEpoch,proto3" json:"last_reported_epoch,omitempty" yaml:"last_reported_epoch"` + ImmatureTotalInfo []*ImmatureTotal `protobuf:"bytes,4,rep,name=immature_total_info,json=immatureTotalInfo,proto3" json:"immature_total_info,omitempty" yaml:"immature_total_info"` + MatureTotalInfo []*MatureTotal `protobuf:"bytes,5,rep,name=mature_total_info,json=matureTotalInfo,proto3" json:"mature_total_info,omitempty" yaml:"mature_total_info"` + IndividualRewardInfo []*Reward `protobuf:"bytes,6,rep,name=individual_reward_info,json=individualRewardInfo,proto3" json:"individual_reward_info,omitempty" yaml:"individual_reward_info"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -116,35 +116,35 @@ func init() { func init() { proto.RegisterFile("stratos/pot/v1/genesis.proto", fileDescriptor_abdde08c2564316a) } var fileDescriptor_abdde08c2564316a = []byte{ - // 441 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xbf, 0x6e, 0xd3, 0x40, - 0x1c, 0xc7, 0x63, 0x52, 0x32, 0xb8, 0x40, 0x15, 0xab, 0x42, 0x26, 0xb4, 0x4e, 0xf0, 0x94, 0x85, - 0x3b, 0xa5, 0x6c, 0x6c, 0x18, 0x21, 0x14, 0x89, 0x4a, 0xc8, 0x74, 0x62, 0xb1, 0x2e, 0xf6, 0x35, - 0x39, 0x35, 0xbe, 0x9f, 0xe5, 0xfb, 0x25, 0xd0, 0xb7, 0xe0, 0x9d, 0x58, 0x18, 0x3b, 0x32, 0x45, - 0x28, 0x79, 0x83, 0x3c, 0x01, 0xba, 0x3f, 0x45, 0xc6, 0xe9, 0x76, 0xd2, 0xf7, 0xcf, 0xe7, 0x7b, - 0xf6, 0xf9, 0x67, 0x0a, 0x6b, 0x86, 0xa0, 0x68, 0x05, 0x48, 0xd7, 0x13, 0x3a, 0xe7, 0x92, 0x2b, - 0xa1, 0x48, 0x55, 0x03, 0x42, 0xf0, 0xcc, 0xa9, 0xa4, 0x02, 0x24, 0xeb, 0xc9, 0xe0, 0x74, 0x0e, - 0x73, 0x30, 0x12, 0xd5, 0x27, 0xeb, 0x1a, 0x44, 0x39, 0xa8, 0x12, 0x14, 0x9d, 0x31, 0xc5, 0xe9, - 0x7a, 0x32, 0xe3, 0xc8, 0x26, 0x34, 0x07, 0x21, 0x9d, 0x1e, 0xb6, 0x18, 0xba, 0xcc, 0x28, 0xf1, - 0xcf, 0x23, 0xff, 0xc9, 0x47, 0x4b, 0xfc, 0x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 0x0c, 0x4a, 0xff, 0x74, - 0x2a, 0x0b, 0xb1, 0x16, 0xc5, 0x8a, 0x2d, 0x53, 0xfe, 0x8d, 0xd5, 0x85, 0x21, 0xf5, 0x0c, 0xe9, - 0xe0, 0x9f, 0x5a, 0x47, 0xf2, 0x6a, 0xbf, 0x19, 0x9e, 0xbb, 0xdb, 0xfc, 0x4b, 0x67, 0xb5, 0x11, - 0x1d, 0xe9, 0xc1, 0xda, 0x64, 0xfa, 0x6b, 0x1b, 0x79, 0x77, 0xdb, 0xc8, 0xfb, 0xb3, 0x8d, 0xbc, - 0x1f, 0xbb, 0xa8, 0x73, 0xb7, 0x8b, 0x3a, 0xbf, 0x77, 0x51, 0xe7, 0x2b, 0x9d, 0x0b, 0x5c, 0xac, - 0x66, 0x24, 0x87, 0x92, 0x3a, 0xa8, 0xe4, 0x78, 0x7f, 0x7c, 0x9d, 0x2f, 0x98, 0x90, 0xf4, 0xbb, - 0x79, 0x97, 0x78, 0x5b, 0x71, 0x35, 0xeb, 0x99, 0x77, 0xf9, 0xe6, 0x6f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x24, 0x31, 0x13, 0xf6, 0x17, 0x03, 0x00, 0x00, + // 447 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xcd, 0x6e, 0xd3, 0x40, + 0x14, 0x85, 0x63, 0x52, 0xb2, 0x70, 0x81, 0xca, 0x6e, 0x55, 0x99, 0xd0, 0x3a, 0xc1, 0xab, 0x6c, + 0x98, 0x51, 0xca, 0x8e, 0x1d, 0x46, 0x08, 0x65, 0x51, 0x84, 0x4c, 0x57, 0x6c, 0xac, 0x89, 0x3d, + 0x4d, 0x46, 0xc4, 0x73, 0x2d, 0xcf, 0x4d, 0xa0, 0x6f, 0xc1, 0x63, 0xb1, 0x41, 0xea, 0x92, 0x55, + 0x84, 0x92, 0x37, 0xc8, 0x13, 0xa0, 0xf9, 0x41, 0xa4, 0x49, 0x76, 0xa3, 0x73, 0xce, 0x3d, 0xdf, + 0xf5, 0x78, 0xfc, 0x0b, 0x85, 0x0d, 0x43, 0x50, 0xb4, 0x06, 0xa4, 0x8b, 0x21, 0x9d, 0x70, 0xc9, + 0x95, 0x50, 0xa4, 0x6e, 0x00, 0x21, 0x7c, 0xe6, 0x5c, 0x52, 0x03, 0x92, 0xc5, 0xb0, 0x7b, 0x36, + 0x81, 0x09, 0x18, 0x8b, 0xea, 0x93, 0x4d, 0x75, 0xe3, 0x02, 0x54, 0x05, 0x8a, 0x8e, 0x99, 0xe2, + 0x74, 0x31, 0x1c, 0x73, 0x64, 0x43, 0x5a, 0x80, 0x90, 0xce, 0x8f, 0x76, 0x18, 0xba, 0xcc, 0x38, + 0xc9, 0xaf, 0x23, 0xff, 0xc9, 0x07, 0x4b, 0xfc, 0x8c, 0x0c, 0x79, 0xf8, 0xd6, 0xef, 0xd4, 0xac, + 0x61, 0x95, 0x8a, 0xbc, 0xbe, 0x37, 0x38, 0xbe, 0x3a, 0x27, 0x0f, 0x37, 0x20, 0x9f, 0x8c, 0x9b, + 0x06, 0x9b, 0x65, 0xef, 0xe9, 0x1d, 0xab, 0x66, 0x6f, 0x12, 0x9b, 0x4f, 0x32, 0x37, 0x18, 0x16, + 0x7e, 0x80, 0x80, 0x6c, 0x96, 0x57, 0x42, 0xf2, 0x32, 0x47, 0xf8, 0xca, 0x65, 0xf4, 0xc8, 0xb4, + 0x3d, 0x27, 0x76, 0x53, 0xa2, 0x37, 0x25, 0x6e, 0x53, 0xf2, 0x0e, 0x84, 0x4c, 0x2f, 0x36, 0xcb, + 0x5e, 0x64, 0x0b, 0xf7, 0xa6, 0x93, 0xec, 0xc4, 0x68, 0xd7, 0x5a, 0xba, 0xd1, 0x4a, 0xf8, 0xd1, + 0x3f, 0x9d, 0x31, 0x85, 0x79, 0xc3, 0x6b, 0x68, 0x90, 0x97, 0x39, 0xaf, 0xa1, 0x98, 0x46,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f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x3b, 0x1f, 0xdb, 0x21, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/pot/types/msg.go b/x/pot/types/msg.go index 7a6f608d..8be71954 100644 --- a/x/pot/types/msg.go +++ b/x/pot/types/msg.go @@ -43,7 +43,7 @@ func NewMsgVolumeReport( Epoch: &epoch, ReportReference: reportReference, ReporterOwner: reporterOwner.String(), - BLSSignature: &blsSignature, + BlsSignature: &blsSignature, } } @@ -115,13 +115,13 @@ func (msg MsgVolumeReport) ValidateBasic() error { } } - if len(msg.BLSSignature.Signature) == 0 { + if len(msg.BlsSignature.Signature) == 0 { return ErrBLSSignatureInvalid } - if len(msg.BLSSignature.TxData) == 0 { + if len(msg.BlsSignature.TxData) == 0 { return ErrBLSTxDataInvalid } - for _, pubKey := range msg.BLSSignature.PubKeys { + for _, pubKey := range msg.BlsSignature.PubKeys { if len(pubKey) == 0 { return ErrBLSPubkeysInvalid } diff --git a/x/pot/types/pot.pb.go b/x/pot/types/pot.pb.go index 2c719a3f..3d734f2c 100644 --- a/x/pot/types/pot.pb.go +++ b/x/pot/types/pot.pb.go @@ -95,12 +95,12 @@ func (m *Params) GetMiningRewardParams() []*MiningRewardParam { } type MiningRewardParam struct { - TotalMinedValveStart *types.Coin `protobuf:"bytes,1,opt,name=totalMinedValveStart,proto3" json:"totalMinedValveStart,omitempty" yaml:"total_mined_valve_start"` - TotalMinedValveEnd *types.Coin `protobuf:"bytes,2,opt,name=totalMinedValveEnd,proto3" json:"totalMinedValveEnd,omitempty" yaml:"total_mined_valve_end"` - MiningReward *types.Coin `protobuf:"bytes,3,opt,name=miningReward,proto3" json:"miningReward,omitempty" yaml:"mining_reward"` - BlockChainPercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=blockChainPercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"block_chain_percentage_in_ten_thousand" yaml:"block_chain_percentage_in_ten_thousand"` - ResourceNodePercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=resourceNodePercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"resource_node_percentage_in_ten_thousand" yaml:"resource_node_percentage_in_ten_thousand"` - MetaNodePercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=metaNodePercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"meta_node_percentage_in_ten_thousand" yaml:"meta_node_percentage_in_ten_thousand"` + TotalMinedValveStart *types.Coin `protobuf:"bytes,1,opt,name=total_mined_valve_start,json=totalMinedValveStart,proto3" json:"total_mined_valve_start,omitempty" yaml:"total_mined_valve_start"` + TotalMinedValveEnd *types.Coin `protobuf:"bytes,2,opt,name=total_mined_valve_end,json=totalMinedValveEnd,proto3" json:"total_mined_valve_end,omitempty" yaml:"total_mined_valve_end"` + MiningReward *types.Coin `protobuf:"bytes,3,opt,name=mining_reward,json=miningReward,proto3" json:"mining_reward,omitempty" yaml:"mining_reward"` + BlockChainPercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=block_chain_percentage_in_ten_thousand,json=blockChainPercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"block_chain_percentage_in_ten_thousand" yaml:"block_chain_percentage_in_ten_thousand"` + ResourceNodePercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=resource_node_percentage_in_ten_thousand,json=resourceNodePercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"resource_node_percentage_in_ten_thousand" yaml:"resource_node_percentage_in_ten_thousand"` + MetaNodePercentageInTenThousand *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=meta_node_percentage_in_ten_thousand,json=metaNodePercentageInTenThousand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"meta_node_percentage_in_ten_thousand" yaml:"meta_node_percentage_in_ten_thousand"` } func (m *MiningRewardParam) Reset() { *m = MiningRewardParam{} } @@ -158,7 +158,7 @@ func (m *MiningRewardParam) GetMiningReward() *types.Coin { } type ImmatureTotal struct { - WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` Value github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=value,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"value"` } @@ -210,7 +210,7 @@ func (m *ImmatureTotal) GetValue() github_com_cosmos_cosmos_sdk_types.Coins { } type MatureTotal struct { - WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` Value github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=value,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"value"` } @@ -262,9 +262,9 @@ func (m *MatureTotal) GetValue() github_com_cosmos_cosmos_sdk_types.Coins { } type Reward struct { - WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` - RewardFromMiningPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=rewardFromMiningPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_from_mining_pool" yaml:"reward_from_mining_pool"` - RewardFromTrafficPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=rewardFromTrafficPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_from_traffic_pool" yaml:"reward_from_traffic_pool"` + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + RewardFromMiningPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=reward_from_mining_pool,json=rewardFromMiningPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_from_mining_pool" yaml:"reward_from_mining_pool"` + RewardFromTrafficPool github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=reward_from_traffic_pool,json=rewardFromTrafficPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_from_traffic_pool" yaml:"reward_from_traffic_pool"` } func (m *Reward) Reset() { *m = Reward{} } @@ -322,7 +322,7 @@ func (m *Reward) GetRewardFromTrafficPool() github_com_cosmos_cosmos_sdk_types.C } type SingleWalletVolume struct { - WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` Volume *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=volume,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"volume" yaml:"volume"` } @@ -368,8 +368,8 @@ func (m *SingleWalletVolume) GetWalletAddress() string { type VolumeReportRecord struct { Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` - ReportReference string `protobuf:"bytes,2,opt,name=reportReference,proto3" json:"report_reference" yaml:"report_reference"` - TxHash string `protobuf:"bytes,3,opt,name=txHash,proto3" json:"tx_hash" yaml:"tx_hash"` + ReportReference string `protobuf:"bytes,2,opt,name=report_reference,json=reportReference,proto3" json:"report_reference" yaml:"report_reference"` + TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash" yaml:"tx_hash"` } func (m *VolumeReportRecord) Reset() { *m = VolumeReportRecord{} } @@ -427,7 +427,7 @@ func (m *VolumeReportRecord) GetTxHash() string { } type BLSSignatureInfo struct { - PubKeys [][]byte `protobuf:"bytes,1,rep,name=pubKeys,proto3" json:"pub_keys" yaml:"pub_keys"` + PubKeys [][]byte `protobuf:"bytes,1,rep,name=pub_keys,json=pubKeys,proto3" json:"pub_keys" yaml:"pub_keys"` Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature" yaml:"signature"` TxData []byte `protobuf:"bytes,3,opt,name=txData,proto3" json:"tx_data" yaml:"tx_data"` } @@ -500,74 +500,74 @@ func init() { func init() { proto.RegisterFile("stratos/pot/v1/pot.proto", fileDescriptor_a05930b44d981057) } var fileDescriptor_a05930b44d981057 = []byte{ - // 1064 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcf, 0x6f, 0x1c, 0xb5, - 0x17, 0xcf, 0x74, 0xdb, 0xcd, 0x37, 0xce, 0x8f, 0xa6, 0xfe, 0xa6, 0xea, 0x52, 0x60, 0x9d, 0xb8, - 0xa8, 0xac, 0x54, 0x65, 0x87, 0x14, 0x21, 0x04, 0x1c, 0x10, 0xdb, 0x06, 0x11, 0x20, 0x28, 0x4c, - 0xa2, 0x56, 0x20, 0xa1, 0x91, 0x77, 0xc6, 0xd9, 0x8c, 0x32, 0x63, 0x2f, 0x1e, 0xef, 0x36, 0x39, - 0x72, 0xe0, 0x80, 0xc4, 0x81, 0xbf, 0x83, 0xbf, 0x81, 0x03, 0x12, 0x02, 0xf5, 0xc0, 0xa1, 0x48, - 0x1c, 0x10, 0x02, 0x83, 0x92, 0xdb, 0x1e, 0x87, 0x7f, 0x00, 0x8d, 0xed, 0xd9, 0x1f, 0xe9, 0x26, - 0xd9, 0x1c, 0x7a, 0xe0, 0xb4, 0xe3, 0xcf, 0x7b, 0xfe, 0xf8, 0x7d, 0xde, 0xb3, 0xdf, 0x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0x7d, 0x34, 0x99, 0xf5, 0x4d, 0xed, 0xeb, 0x69, 0x57, 0x9d, 0x9e, - 0xc6, 0xeb, 0x3d, 0x85, 0xc6, 0x52, 0x64, 0x0a, 0x3d, 0x6f, 0xcf, 0x1f, 0x63, 0xc5, 0x1e, 0x4c, - 0x4e, 0x72, 0xa5, 0xf8, 0x97, 0x69, 0x70, 0xed, 0xa9, 0x23, 0xe0, 0xe7, 0x60, 0x49, 0x72, 0x49, - 0xe2, 0xcd, 0x88, 0xd1, 0xf0, 0x01, 0x89, 0xbb, 0x74, 0x5b, 0x12, 0x21, 0x75, 0x29, 0x66, 0xef, - 0x3e, 0x57, 0x37, 0xa5, 0xac, 0xe7, 0xa5, 0xac, 0xdb, 0x52, 0xd6, 0xef, 0xf1, 0x88, 0x35, 0x70, - 0xa6, 0x50, 0xd5, 0xc4, 0xa0, 0x09, 0xfc, 0x24, 0x67, 0xf0, 0xbb, 0x39, 0x85, 0x9f, 0xe6, 0x1c, - 0xd8, 0x1b, 0x4b, 0x0d, 0xf7, 0x01, 0x3c, 0x81, 0xaf, 0xb3, 0x50, 0x57, 0xed, 0xcc, 0x03, 0x97, - 0x33, 0x85, 0x5e, 0x38, 0xed, 0x40, 0xca, 0x42, 0xec, 0x8d, 0xa1, 0x85, 0x0f, 0xc1, 0xdc, 0x70, - 0x2e, 0x74, 0x41, 0xcf, 0x3c, 0xa6, 0x92, 0x29, 0xb4, 0x34, 0x26, 0xb7, 0xd8, 0x1b, 0x21, 0x82, - 0xbf, 0x3a, 0x60, 0xa5, 0x19, 0xf3, 0x60, 0xff, 0xde, 0x1e, 0x89, 0xd8, 0x16, 0x15, 0x01, 0x65, - 0x92, 0xb4, 0xe8, 0x06, 0xdb, 0xa1, 0x6c, 0x67, 0x8f, 0x77, 0x52, 0xc2, 0xc2, 0xca, 0x65, 0x7d, - 0x17, 0xbf, 0x74, 0x7e, 0x57, 0xe8, 0x76, 0x2b, 0x92, 0x7b, 0x9d, 0x66, 0x3d, 0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0xee, 0xd0, 0x95, 0xb0, 0xc3, 0x24, 0xa3, 0xb2, 0xf8, 0x5c, 0xd5, 0x03, 0x81, 0x7b, 0xa0, - 0xc7, 0x78, 0x7d, 0x3f, 0x9a, 0x65, 0x3d, 0x80, 0xbf, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x0c, 0xe2, 0xbf, 0x58, 0xe2, 0x0b, 0x00, 0x00, + // 1071 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0x1c, 0x35, + 0x14, 0xcf, 0x64, 0xdb, 0x4d, 0xe3, 0xfc, 0x69, 0x6a, 0x12, 0x65, 0x29, 0xb0, 0x4e, 0x5c, 0x54, + 0x56, 0xaa, 0xb2, 0x43, 0x8a, 0x00, 0xa9, 0x1c, 0x10, 0xdb, 0x06, 0x11, 0x20, 0x28, 0x72, 0xa2, + 0x82, 0x2a, 0xa1, 0x91, 0x77, 0xc6, 0xd9, 0x8c, 0x32, 0x63, 0xaf, 0x66, 0xbc, 0xdb, 0xe4, 0xc8, + 0x81, 0x03, 0x12, 0x07, 0x3e, 0x07, 0x5f, 0x82, 0x03, 0xa8, 0xf4, 0x58, 0x6e, 0xc0, 0xc1, 0x40, + 0x02, 0x42, 0xda, 0xe3, 0xf0, 0x05, 0xd0, 0xd8, 0xde, 0x3f, 0xf9, 0xb3, 0xc9, 0xe6, 0xd0, 0x43, + 0x4f, 0x6b, 0xff, 0xde, 0xf3, 0xef, 0xf9, 0xf7, 0xde, 0xf8, 0xed, 0x03, 0xa5, 0x54, 0x26, 0x54, + 0x8a, 0xd4, 0x6d, 0x0a, 0xe9, 0xb6, 0x57, 0xf3, 0x9f, 0x6a, 0x33, 0x11, 0x52, 0xc0, 0x59, 0x6b, + 0xa9, 0xe6, 0x50, 0x7b, 0xf5, 0xe6, 0x7c, 0x43, 0x34, 0x84, 0x36, 0xb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0xf1, + 0x3c, 0x14, 0xfc, 0xe0, 0x80, 0x45, 0xdb, 0xff, 0x77, 0x12, 0x11, 0x7b, 0xb6, 0x5f, 0x35, 0x85, + 0x88, 0x2e, 0x16, 0x15, 0xe7, 0xa2, 0x3a, 0x0a, 0x0d, 0x63, 0xe8, 0xb7, 0xf8, 0x21, 0x0e, 0xf8, + 0x52, 0x19, 0x99, 0x37, 0x2c, 0x1f, 0x26, 0x22, 0x36, 0xff, 0x45, 0x9b, 0x42, 0x44, 0xf0, 0x47, + 0x07, 0x94, 0x06, 0xe9, 0x65, 0x42, 0x77, 0x76, 0x42, 0xdf, 0x48, 0x28, 0x5c, 0x24, 0x41, 0x58, + 0x09, 0x43, 0x29, 0x32, 0x85, 0xd0, 0x69, 0x0d, 0x83, 0x1e, 0x97, 0x13, 0xb1, 0xd0, 0x17, 0xb1, + 0x6d, 0x48, 0x72, 0x15, 0xf8, 0x67, 0x07, 0xc0, 0xad, 0x90, 0x37, 0x22, 0xf6, 0xb9, 0xae, 0xcf, + 0x43, 0x11, 0xb5, 0x62, 0xf6, 0x5c, 0x4a, 0xfe, 0x25, 0x28, 0xb6, 0x35, 0xbb, 0x1d, 0x76, 0xd6, + 0x2e, 0xd5, 0x95, 0xec, 0xd9, 0x4c, 0xa1, 0x19, 0x13, 0xcd, 0xec, 0x31, 0xb1, 0x06, 0xfc, 0x8f, + 0x03, 0xa0, 0xb9, 0x3d, 0x61, 0x4d, 0x91, 0x48, 0xc2, 0x7c, 0x91, 0x04, 0xf0, 0x3d, 0x70, 0x2d, + 0xd1, 0x7b, 0x96, 0x58, 0x0d, 0xa8, 0xa3, 0x50, 0x0f, 0xcb, 0x14, 0xba, 0xde, 0x4d, 0xb3, 0x41, + 0x30, 0xe9, 0x19, 0xe1, 0x23, 0x30, 0x67, 0xd6, 0x5e, 0xc2, 0x76, 0x58, 0xc2, 0xb8, 0xdf, 0xbd, + 0xbc, 0xdb, 0x51, 0xe8, 0x94, 0x2d, 0x53, 0x68, 0x71, 0x90, 0xac, 0x6f, 0xc1, 0xe4, 0x7a, 0x62, + 0x6f, 0x65, 0x11, 0xf8, 0x0e, 0x98, 0x90, 0xfb, 0xde, 0x2e, 0x4d, 0xcd, 0xc0, 0x36, 0x59, 0x7b, + 0xad, 0xa3, 0x50, 0x17, 0xca, 0x14, 0x9a, 0xb5, 0x03, 0x83, 0x01, 0x30, 0x29, 0xca, 0xfd, 0x8f, + 0xf2, 0xc5, 0x13, 0x07, 0xcc, 0xd5, 0x3e, 0xdd, 0xda, 0x0a, 0x1b, 0x5c, 0x77, 0x99, 0x75, 0xbe, + 0x23, 0xe0, 0x3d, 0x70, 0xad, 0xd9, 0xaa, 0x7b, 0x7b, 0xec, 0x20, 0xaf, 0x54, 0xa1, 0x32, 0x6d, + 0x54, 0x76, 0xb1, 0xbe, 0xca, 0x2e, 0x82, 0xc9, 0x44, 0xb3, 0x55, 0xff, 0x84, 0x1d, 0xa4, 0xf0, + 0x7d, 0x30, 0x99, 0x76, 0xc9, 0xb4, 0xba, 0xe9, 0xda, 0x72, 0x47, 0xa1, 0x3e, 0x98, 0x29, 0x34, + 0x67, 0x4e, 0xf7, 0x20, 0x4c, 0xfa, 0x66, 0xf8, 0x36, 0x28, 0xca, 0xfd, 0x07, 0x54, 0x52, 0x2d, + 0x64, 0xba, 0x27, 0x24, 0xa0, 0x92, 0x1e, 0x13, 0x92, 0x03, 0x5a, 0x48, 0xee, 0x5c, 0x5b, 0x7f, + 0x7a, 0x58, 0x76, 0x9e, 0x1d, 0x96, 0x9d, 0x3f, 0x0f, 0xcb, 0xce, 0x77, 0x47, 0xe5, 0xb1, 0x67, + 0x47, 0xe5, 0xb1, 0x5f, 0x8f, 0xca, 0x63, 0x8f, 0xdc, 0x81, 0xaf, 0xc2, 0xce, 0x9b, 0x9c, 0xc9, + 0xee, 0x72, 0x45, 0xcf, 0x09, 0xee, 0xbe, 0x9e, 0xf4, 0xf5, 0x27, 0x52, 0x2f, 0xea, 0x19, 0xfd, + 0xad, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xa0, 0xbe, 0x63, 0x04, 0x05, 0x0c, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/pot/types/query.pb.go b/x/pot/types/query.pb.go index 40469bf4..88460967 100644 --- a/x/pot/types/query.pb.go +++ b/x/pot/types/query.pb.go @@ -130,7 +130,7 @@ func (m *ReportInfo) GetReference() string { // QueryVolumeReportResponse is response type for the Query/ResourceNode RPC method type QueryVolumeReportResponse struct { // node defines the the volumeReport info. - ReportInfo *ReportInfo `protobuf:"bytes,1,opt,name=reportInfo,proto3" json:"reportInfo,omitempty"` + ReportInfo *ReportInfo `protobuf:"bytes,1,opt,name=report_info,json=reportInfo,proto3" json:"report_info,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` } @@ -190,29 +190,29 @@ func init() { func init() { proto.RegisterFile("stratos/pot/v1/query.proto", fileDescriptor_c09bd09df76a68e0) } var fileDescriptor_c09bd09df76a68e0 = []byte{ - // 338 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x4f, 0x4b, 0x02, 0x41, - 0x18, 0xc6, 0x1d, 0x43, 0xc1, 0x29, 0x3a, 0x0c, 0x12, 0xb6, 0xc8, 0x12, 0x0b, 0x91, 0x1d, 0xdc, - 0x49, 0xbb, 0x75, 0x8a, 0x6e, 0x1e, 0xdb, 0x43, 0x87, 0x6e, 0xeb, 0xf2, 0xba, 0xbb, 0xa0, 0xf3, - 0x8e, 0x33, 0xb3, 0x92, 0x44, 0x97, 0x3e, 0x41, 0xd4, 0xb5, 0x0f, 0xd4, 0x51, 0xe8, 0xd2, 0x31, - 0xb4, 0x0f, 0x12, 0xce, 0x6a, 0x9a, 0x18, 0x74, 0x9b, 0x77, 0x9e, 0x87, 0xdf, 0xf3, 0xfe, 0xa1, - 0x8e, 0x36, 0x2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, 0x6f, 0x99, 0xdf, 0xdb, 0x65, 0x3d, - 0x5c, 0x75, 0xde, 0xa6, 0x2e, 0x99, 0x4c, 0x5d, 0xf2, 0x39, 0x75, 0xc9, 0xd3, 0xcc, 0x2d, 0x4c, - 0x66, 0x6e, 0xe1, 0x63, 0xe6, 0x16, 0x6e, 0x79, 0x9c, 0x9a, 0x24, 0xeb, 0xfa, 0x11, 0x0e, 0x96, - 0x28, 0x01, 0x66, 0xf9, 0x6c, 0x46, 0x49, 0x98, 0x0a, 0x7e, 0x67, 0xe9, 0x66, 0x2c, 0x41, 0x77, - 0xcb, 0xf6, 0xaa, 0xe7, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xb6, 0x78, 0x66, 0x37, 0x02, - 0x00, 0x00, + // 342 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xb1, 0x4a, 0x03, 0x41, + 0x10, 0xcd, 0x46, 0x12, 0xc8, 0x46, 0x2c, 0x96, 0x20, 0xf1, 0x08, 0x87, 0x1c, 0x88, 0xb1, 0xc8, + 0xad, 0x89, 0xa5, 0x8d, 0xd8, 0xa5, 0xf4, 0x0a, 0x0b, 0x1b, 0xb9, 0x1c, 0x93, 0xbb, 0x83, 0x64, + 0x67, 0xb3, 0xbb, 0x17, 0x0c, 0x62, 0xe3, 0x17, 0x88, 0xb6, 0x7e, 0x90, 0x65, 0xc0, 0xc6, 0x52, + 0x12, 0x3f, 0x44, 0xb2, 0x97, 0x10, 0x0d, 0x11, 0xec, 0x66, 0xe6, 0x3d, 0xde, 0x7b, 0x33, 0x43, + 0x1d, 0x6d, 0x54, 0x68, 0x50, 0x73, 0x89, 0x86, 0x8f, 0xdb, 0x7c, 0x94, 0x81, 0x9a, 0xf8, 0x52, + 0xa1, 0x41, 0xb6, 0xb7, 0xc4, 0x7c, 0x89, 0xc6, 0x1f, 0xb7, 0x9d, 0x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0xcd, 0xdd, 0xc2, 0x74, 0xee, 0x16, 0x3e, 0xe6, 0x6e, 0xe1, 0x86, 0xc7, 0xa9, 0x49, 0xb2, + 0x9e, 0x1f, 0xe1, 0x70, 0x25, 0x25, 0xc0, 0xac, 0xca, 0x56, 0x94, 0x84, 0xa9, 0xe0, 0x77, 0x56, + 0xdd, 0x4c, 0x24, 0xe8, 0x5e, 0xd9, 0xbe, 0xf5, 0xec, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x17, 0x9d, + 0x01, 0xa7, 0x38, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/pot/types/tx.pb.go b/x/pot/types/tx.pb.go index 5b28bfc2..d3f3548a 100644 --- a/x/pot/types/tx.pb.go +++ b/x/pot/types/tx.pb.go @@ -33,12 +33,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgVolumeReport encapsulates an VolumeReport transaction as an SDK message. type MsgVolumeReport struct { - WalletVolumes []*SingleWalletVolume `protobuf:"bytes,1,rep,name=walletVolumes,proto3" json:"wallet_volumes" yaml:"wallet_volumes"` + WalletVolumes []*SingleWalletVolume `protobuf:"bytes,1,rep,name=wallet_volumes,json=walletVolumes,proto3" json:"wallet_volumes" yaml:"wallet_volumes"` Reporter string `protobuf:"bytes,2,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` Epoch *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=epoch,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"epoch" yaml:"epoch"` - ReportReference string `protobuf:"bytes,4,opt,name=reportReference,proto3" json:"report_reference" yaml:"report_reference"` - ReporterOwner string `protobuf:"bytes,5,opt,name=reporterOwner,proto3" json:"reporter_owner" yaml:"reporter_owner"` - BLSSignature *BLSSignatureInfo `protobuf:"bytes,6,opt,name=bLSSignature,proto3" json:"bls_signature" yaml:"bls_signature"` + ReportReference string `protobuf:"bytes,4,opt,name=report_reference,json=reportReference,proto3" json:"report_reference" yaml:"report_reference"` + ReporterOwner string `protobuf:"bytes,5,opt,name=reporter_owner,json=reporterOwner,proto3" json:"reporter_owner" yaml:"reporter_owner"` + BlsSignature *BLSSignatureInfo `protobuf:"bytes,6,opt,name=bls_signature,json=blsSignature,proto3" json:"bls_signature" yaml:"bls_signature"` } func (m *MsgVolumeReport) Reset() { *m = MsgVolumeReport{} } @@ -102,9 +102,9 @@ func (m *MsgVolumeReport) GetReporterOwner() string { return "" } -func (m *MsgVolumeReport) GetBLSSignature() *BLSSignatureInfo { +func (m *MsgVolumeReport) GetBlsSignature() *BLSSignatureInfo { if m != nil { - return m.BLSSignature + return m.BlsSignature } return nil } @@ -148,9 +148,9 @@ var xxx_messageInfo_MsgVolumeReportResponse proto.InternalMessageInfo // MsgWithdraw encapsulates an withdraw transaction as an SDK message. type MsgWithdraw struct { - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=Amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` - WalletAddress string `protobuf:"bytes,2,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` - TargetAddress string `protobuf:"bytes,3,opt,name=targetAddress,proto3" json:"target_address" yaml:"target_address"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` + WalletAddress string `protobuf:"bytes,2,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + TargetAddress string `protobuf:"bytes,3,opt,name=target_address,json=targetAddress,proto3" json:"target_address" yaml:"target_address"` } func (m *MsgWithdraw) Reset() { *m = MsgWithdraw{} } @@ -246,7 +246,7 @@ var xxx_messageInfo_MsgWithdrawResponse proto.InternalMessageInfo // MsgFoundationDeposit - encapsulates an FoundationDeposit transaction as an SDK message type MsgFoundationDeposit struct { - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=Amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from" yaml:"from"` } @@ -337,9 +337,9 @@ var xxx_messageInfo_MsgFoundationDepositResponse proto.InternalMessageInfo // MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message type MsgSlashingResourceNode struct { Reporters []string `protobuf:"bytes,1,rep,name=reporters,proto3" json:"reporters" yaml:"reporters"` - ReporterOwner []string `protobuf:"bytes,2,rep,name=reporterOwner,proto3" json:"reporter_owner" yaml:"reporter_owner"` - NetworkAddress string `protobuf:"bytes,3,opt,name=networkAddress,proto3" json:"network_address" yaml:"network_address"` - WalletAddress string `protobuf:"bytes,4,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + ReporterOwner []string `protobuf:"bytes,2,rep,name=reporter_owner,json=reporterOwner,proto3" json:"reporter_owner" yaml:"reporter_owner"` + NetworkAddress string `protobuf:"bytes,3,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + WalletAddress string `protobuf:"bytes,4,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` Slashing *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=slashing,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"slashing" yaml:"slashing"` Suspend bool `protobuf:"varint,6,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` } @@ -463,68 +463,69 @@ func init() { func init() { proto.RegisterFile("stratos/pot/v1/tx.proto", fileDescriptor_103c258cace119ca) } var fileDescriptor_103c258cace119ca = []byte{ - // 974 bytes of a gzipped FileDescriptorProto + // 977 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x6f, 0xe3, 0x44, - 0x14, 0xae, 0x9b, 0x6c, 0x69, 0xa7, 0xdb, 0x76, 0x31, 0x2d, 0xcd, 0x86, 0x6d, 0x26, 0x3b, 0x2c, - 0x4b, 0x60, 0xa9, 0xad, 0x96, 0x03, 0x12, 0x1c, 0xd0, 0x66, 0x11, 0xa2, 0x82, 0x82, 0x70, 0x05, - 0xab, 0xe5, 0x12, 0x39, 0xf1, 0xd4, 0xb1, 0xd6, 0x99, 0xb1, 0x3c, 0x93, 0x64, 0xf7, 0xc2, 0x81, - 0x13, 0x47, 0x24, 0xae, 0xfc, 0x01, 0xb8, 0xf2, 0x03, 0x38, 0x70, 0xd9, 0xe3, 0x4a, 0x70, 0x40, - 0x1c, 0x06, 0xd4, 0x72, 0xf2, 0xd1, 0x17, 0xae, 0x28, 0x33, 0x63, 0x27, 0x76, 0x02, 0x14, 0xf5, - 0xc0, 0xa9, 0xf1, 0xfb, 0xde, 0xfb, 0xbe, 0xe7, 0x37, 0xdf, 0x3c, 0x17, 0xec, 0x32, 0x1e, 0xbb, - 0x9c, 0x32, 0x3b, 0xa2, 0xdc, 0x1e, 0x1d, 0xd8, 0xfc, 0x91, 0x15, 0xc5, 0x94, 0x53, 0x73, 0x53, - 0x03, 0x56, 0x44, 0xb9, 0x35, 0x3a, 0xa8, 0x6f, 0xfb, 0xd4, 0xa7, 0x12, 0xb2, 0x27, 0xbf, 0x54, - 0x56, 0xfd, 0x86, 0x4f, 0xa9, 0x1f, 0x62, 0xdb, 0x8d, 0x02, 0xdb, 0x25, 0x84, 0x72, 0x97, 0x07, - 0x94, 0x30, 0x8d, 0xd6, 0x4a, 0xe4, 0x13, 0x2a, 0x85, 0x34, 0x7a, 0x94, 0x0d, 0x28, 0xb3, 0xbb, - 0x2e, 0xc3, 0xf6, 0xe8, 0xa0, 0x8b, 0xb9, 0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+ 0xa6, 0x6e, 0x21, 0x54, 0x6e, 0xea, 0x34, 0x4f, 0xe9, 0x79, 0xba, 0xfe, 0xf7, 0x06, 0xd8, 0xcb, + 0xdb, 0x5b, 0x7a, 0xa1, 0x97, 0xbd, 0x89, 0x65, 0x81, 0x4d, 0xfb, 0x92, 0x81, 0x79, 0x9f, 0x96, + 0xec, 0xb3, 0x83, 0x6e, 0x97, 0xfb, 0xcc, 0x4c, 0xda, 0x8b, 0x75, 0x5a, 0x8f, 0x50, 0x0f, 0x77, + 0x8f, 0x9e, 0x9e, 0xb5, 0x8c, 0x67, 0x67, 0x2d, 0xe3, 0xf7, 0xb3, 0x96, 0xf1, 0xcd, 0x79, 0x6b, + 0xe5, 0xd9, 0x79, 0x6b, 0xe5, 0x97, 0xf3, 0xd6, 0xca, 0x03, 0x7b, 0xe1, 0x76, 0x68, 0x2d, 0x82, + 0x79, 0xf6, 0x73, 0x7f, 0x30, 0x74, 0x03, 0x62, 0x3f, 0x92, 0xf2, 0xf2, 0xaa, 0xf4, 0xd7, 0xe4, + 0xbf, 0x57, 0x6f, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x42, 0xbb, 0xef, 0xf7, 0x09, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -735,9 +736,9 @@ func (m *MsgVolumeReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.BLSSignature != nil { + if m.BlsSignature != nil { { - size, err := m.BLSSignature.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BlsSignature.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1100,8 +1101,8 @@ func (m *MsgVolumeReport) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.BLSSignature != nil { - l = m.BLSSignature.Size() + if m.BlsSignature != nil { + l = m.BlsSignature.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -1424,7 +1425,7 @@ func (m *MsgVolumeReport) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BLSSignature", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlsSignature", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1451,10 +1452,10 @@ func (m *MsgVolumeReport) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.BLSSignature == nil { - m.BLSSignature = &BLSSignatureInfo{} + if m.BlsSignature == nil { + m.BlsSignature = &BLSSignatureInfo{} } - if err := m.BLSSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.BlsSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index bc4b1981..a4a3c77a 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -93,7 +93,7 @@ func (q Querier) StakeByNode(c context.Context, req *types.QueryStakeByNodeReque indexingNode, found := q.GetIndexingNode(ctx, accAddr) if found { // Adding indexing node staking info - networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := q.getNodeStakes( ctx, indexingNode.GetStatus(), @@ -122,7 +122,7 @@ func (q Querier) StakeByNode(c context.Context, req *types.QueryStakeByNodeReque resourceNode, found := q.GetResourceNode(ctx, accAddr) if found { // Adding resource node staking info - networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := q.getNodeStakes( ctx, resourceNode.GetStatus(), @@ -183,7 +183,7 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq indNodes := q.GetIndexingNodesFiltered(ctx, params) for _, n := range indNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( ctx, n.GetStatus(), @@ -205,7 +205,7 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq } for _, n := range resNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( ctx, n.GetStatus(), diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 246c45f6..1a68b33c 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -67,7 +67,7 @@ func (k Keeper) GetIndexingNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) func (k Keeper) SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalIndexingNode(k.cdc, indexingNode) - networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) store.Set(types.GetIndexingNodeKey(networkAddr), bz) } @@ -207,7 +207,7 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, i // SubtractIndexingNodeStake Update the tokens of an existing indexing node func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) if err != nil { return types.ErrInvalidNetworkAddr } @@ -296,7 +296,7 @@ func (k Keeper) GetIndexingNodeList(ctx sdk.Context, networkAddr stratos.SdsAddr for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) - networkAddrNode, err := stratos.SdsAddressFromBech32(node.GetNetworkAddr()) + networkAddrNode, err := stratos.SdsAddressFromBech32(node.GetNetworkAddress()) if err != nil { continue } @@ -412,7 +412,7 @@ func (k Keeper) GetIndexingNodeRegistrationVotePool(ctx sdk.Context, nodeAddr st } func (k Keeper) SetIndexingNodeRegistrationVotePool(ctx sdk.Context, votePool types.IndexingNodeRegistrationVotePool) { - nodeAddr := votePool.NodeAddress + nodeAddr := votePool.GetNetworkAddress() store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshalLengthPrefixed(&votePool) node, _ := stratos.SdsAddressFromBech32(nodeAddr) diff --git a/x/register/keeper/indexing_node_test.go b/x/register/keeper/indexing_node_test.go index e445a835..5d060d6e 100644 --- a/x/register/keeper/indexing_node_test.go +++ b/x/register/keeper/indexing_node_test.go @@ -1,249 +1,250 @@ package keeper -import ( - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/register/types" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/ed25519" -) - -var ( - spNodeOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - spNodeOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - spNodeOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - spNodeOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - spNodeOwnerNew = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - - spNodePubKey1 = ed25519.GenPrivKey().PubKey() - spNodeAddr1 = stratos.SdsAddress(spNodePubKey1.Address()) - initialStake1 = sdk.NewInt(100000000) - - spNodePubKey2 = ed25519.GenPrivKey().PubKey() - spNodeAddr2 = stratos.SdsAddress(spNodePubKey2.Address()) - initialStake2 = sdk.NewInt(100000000) - - spNodePubKey3 = ed25519.GenPrivKey().PubKey() - spNodeAddr3 = stratos.SdsAddress(spNodePubKey3.Address()) - initialStake3 = sdk.NewInt(100000000) - - spNodePubKey4 = ed25519.GenPrivKey().PubKey() - spNodeAddr4 = stratos.SdsAddress(spNodePubKey4.Address()) - initialStake4 = sdk.NewInt(100000000) - - spNodePubKeyNew = ed25519.GenPrivKey().PubKey() - spNodeAddrNew = stratos.SdsAddress(spNodePubKeyNew.Address()) - spNodeStakeNew = sdk.NewInt(100000000) -) - -func TestExpiredVote(t *testing.T) { - - ctx, accountKeeper, bankKeeper, k, _ := CreateTestInput(t, false) - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - //genesis init Sp nodes. - genesisSpNode1 := types.NewIndexingNode(spNodeAddr1, spNodePubKey1, spNodeOwner1, types.NewDescription(spNodeAddr1.String(), "", "", "", ""), time) - genesisSpNode2 := types.NewIndexingNode(spNodeAddr2, spNodePubKey2, spNodeOwner2, types.NewDescription(spNodeAddr2.String(), "", "", "", ""), time) - genesisSpNode3 := types.NewIndexingNode(spNodeAddr3, spNodePubKey3, spNodeOwner3, types.NewDescription(spNodeAddr3.String(), "", "", "", ""), time) - genesisSpNode4 := types.NewIndexingNode(spNodeAddr4, spNodePubKey4, spNodeOwner4, types.NewDescription(spNodeAddr4.String(), "", "", "", ""), time) - genesisSpNode1.Tokens = genesisSpNode1.Tokens.Add(initialStake1) - genesisSpNode2.Tokens = genesisSpNode2.Tokens.Add(initialStake2) - genesisSpNode3.Tokens = genesisSpNode3.Tokens.Add(initialStake3) - genesisSpNode4.Tokens = genesisSpNode3.Tokens.Add(initialStake4) - genesisSpNode1.Status = sdk.Bonded - genesisSpNode2.Status = sdk.Bonded - genesisSpNode3.Status = sdk.Bonded - genesisSpNode4.Status = sdk.Bonded - - k.SetIndexingNode(ctx, genesisSpNode1) - k.SetIndexingNode(ctx, genesisSpNode2) - k.SetIndexingNode(ctx, genesisSpNode3) - k.SetIndexingNode(ctx, genesisSpNode4) - k.SetLastIndexingNodeStake(ctx, spNodeAddr1, initialStake1) - k.SetLastIndexingNodeStake(ctx, spNodeAddr2, initialStake2) - k.SetLastIndexingNodeStake(ctx, spNodeAddr3, initialStake3) - k.SetLastIndexingNodeStake(ctx, spNodeAddr4, initialStake4) - k.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4))) - k.SetInitialGenesisStakeTotal(ctx, initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4)) - - //Register new SP node after genesis initialized - createAccount(t, ctx, accountKeeper, bankKeeper, spNodeOwnerNew, sdk.NewCoins(sdk.NewCoin("ustos", spNodeStakeNew))) - _, err := k.RegisterIndexingNode(ctx, spNodeAddrNew, spNodePubKeyNew, spNodeOwnerNew, - types.NewDescription("sds://newIndexingNode", "", "", "", ""), sdk.NewCoin("ustos", spNodeStakeNew)) - require.NoError(t, err) - - //set expireTime of voting to 7 days before - votePool, found := k.GetIndexingNodeRegistrationVotePool(ctx, spNodeAddrNew) - require.True(t, found) - require.NotNil(t, votePool) - votePool.ExpireTime = votePool.ExpireTime.AddDate(0, 0, -7) - k.SetIndexingNodeRegistrationVotePool(ctx, votePool) - - //After registration, the status of new SP node is UNBONDED - _, found = k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Error(t, types.ErrVoteExpired) -} - -func TestDuplicateVote(t *testing.T) { - - ctx, accountKeeper, bankKeeper, k, _ := CreateTestInput(t, false) - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - //genesis init Sp nodes. - genesisSpNode1 := types.NewIndexingNode(spNodeAddr1, spNodePubKey1, spNodeOwner1, types.NewDescription(spNodeAddr1.String(), "", "", "", ""), time) - genesisSpNode2 := types.NewIndexingNode(spNodeAddr2, spNodePubKey2, spNodeOwner2, types.NewDescription(spNodeAddr2.String(), "", "", "", ""), time) - genesisSpNode3 := types.NewIndexingNode(spNodeAddr3, spNodePubKey3, spNodeOwner3, types.NewDescription(spNodeAddr3.String(), "", "", "", ""), time) - genesisSpNode4 := types.NewIndexingNode(spNodeAddr4, spNodePubKey4, spNodeOwner4, types.NewDescription(spNodeAddr4.String(), "", "", "", ""), time) - genesisSpNode1.Tokens = genesisSpNode1.Tokens.Add(initialStake1) - genesisSpNode2.Tokens = genesisSpNode2.Tokens.Add(initialStake2) - genesisSpNode3.Tokens = genesisSpNode3.Tokens.Add(initialStake3) - genesisSpNode4.Tokens = genesisSpNode3.Tokens.Add(initialStake4) - genesisSpNode1.Status = sdk.Bonded - genesisSpNode2.Status = sdk.Bonded - genesisSpNode3.Status = sdk.Bonded - genesisSpNode4.Status = sdk.Bonded - - k.SetIndexingNode(ctx, genesisSpNode1) - k.SetIndexingNode(ctx, genesisSpNode2) - k.SetIndexingNode(ctx, genesisSpNode3) - k.SetIndexingNode(ctx, genesisSpNode4) - k.SetLastIndexingNodeStake(ctx, spNodeAddr1, initialStake1) - k.SetLastIndexingNodeStake(ctx, spNodeAddr2, initialStake2) - k.SetLastIndexingNodeStake(ctx, spNodeAddr3, initialStake3) - k.SetLastIndexingNodeStake(ctx, spNodeAddr4, initialStake4) - k.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4))) - k.SetInitialGenesisStakeTotal(ctx, initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4)) - - //Register new SP node after genesis initialized - createAccount(t, ctx, accountKeeper, bankKeeper, spNodeOwnerNew, sdk.NewCoins(sdk.NewCoin("ustos", spNodeStakeNew))) - _, err := k.RegisterIndexingNode(ctx, spNodeAddrNew, spNodePubKeyNew, spNodeOwnerNew, - types.NewDescription("sds://newIndexingNode", "", "", "", ""), sdk.NewCoin("ustos", spNodeStakeNew)) - require.NoError(t, err) - - //After registration, the status of new SP node is UNBONDED - newNode, found := k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Equal(t, newNode.Status, sdk.Unbonded) - - //Exist SP Node1 vote to approve, the status of new SP node is UNBONDED - err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr1, spNodeOwner1)) - require.NoError(t, err) - newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Equal(t, newNode.Status, sdk.Unbonded) - - //Exist SP Node1 vote to approve, the status of new SP node is UNBONDED - err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr1, spNodeOwner1)) - require.Error(t, types.ErrDuplicateVoting) -} - -func TestSpRegistrationApproval(t *testing.T) { - - ctx, accountKeeper, bankKeeper, k, _ := CreateTestInput(t, false) - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - //genesis init Sp nodes. - genesisSpNode1 := types.NewIndexingNode(spNodeAddr1, spNodePubKey1, spNodeOwner1, types.NewDescription(spNodeAddr1.String(), "", "", "", ""), time) - genesisSpNode2 := types.NewIndexingNode(spNodeAddr2, spNodePubKey2, spNodeOwner2, types.NewDescription(spNodeAddr2.String(), "", "", "", ""), time) - genesisSpNode3 := types.NewIndexingNode(spNodeAddr3, spNodePubKey3, spNodeOwner3, types.NewDescription(spNodeAddr3.String(), "", "", "", ""), time) - genesisSpNode4 := types.NewIndexingNode(spNodeAddr4, spNodePubKey4, spNodeOwner4, types.NewDescription(spNodeAddr4.String(), "", "", "", ""), time) - genesisSpNode1.Tokens = genesisSpNode1.Tokens.Add(initialStake1) - genesisSpNode2.Tokens = genesisSpNode2.Tokens.Add(initialStake2) - genesisSpNode3.Tokens = genesisSpNode3.Tokens.Add(initialStake3) - genesisSpNode4.Tokens = genesisSpNode3.Tokens.Add(initialStake4) - genesisSpNode1.Status = sdk.Bonded - genesisSpNode2.Status = sdk.Bonded - genesisSpNode3.Status = sdk.Bonded - genesisSpNode4.Status = sdk.Bonded - - k.SetIndexingNode(ctx, genesisSpNode1) - k.SetIndexingNode(ctx, genesisSpNode2) - k.SetIndexingNode(ctx, genesisSpNode3) - k.SetIndexingNode(ctx, genesisSpNode4) - k.SetLastIndexingNodeStake(ctx, spNodeAddr1, initialStake1) - k.SetLastIndexingNodeStake(ctx, spNodeAddr2, initialStake2) - k.SetLastIndexingNodeStake(ctx, spNodeAddr3, initialStake3) - k.SetLastIndexingNodeStake(ctx, spNodeAddr4, initialStake4) - k.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4))) - k.SetInitialGenesisStakeTotal(ctx, initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4)) - - //Register new SP node after genesis initialized - createAccount(t, ctx, accountKeeper, bankKeeper, spNodeOwnerNew, sdk.NewCoins(sdk.NewCoin("ustos", spNodeStakeNew))) - //_, err := k.bankKeeper.AddCoins(ctx, spNodeAddr4, sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), sdk.NewInt(10000000000000)))) - //require.NoError(t, err) - - _, err := k.RegisterIndexingNode(ctx, spNodeAddrNew, spNodePubKeyNew, spNodeOwnerNew, - types.NewDescription("sds://newIndexingNode", "", "", "", ""), sdk.NewCoin("ustos", spNodeStakeNew)) - require.NoError(t, err) - - //After registration, the status of new SP node is UNBONDED - newNode, found := k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Equal(t, newNode.Status, sdk.Unbonded) - - //Exist SP Node1 vote to approve, the status of new SP node is UNBONDED - err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr1, spNodeOwner1)) - require.NoError(t, err) - newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Equal(t, newNode.Status, sdk.Unbonded) - - //Exist SP Node2 vote to approve, the status of new SP node is UNBONDED - err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr2, spNodeOwner2)) - require.NoError(t, err) - newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Equal(t, newNode.Status, sdk.Unbonded) - - //Exist SP Node3 vote to approve, the status of new SP node changes to BONDED - err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr3, spNodeOwner3)) - require.NoError(t, err) - newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Equal(t, newNode.Status, sdk.Bonded) - - //Exist SP Node4 vote to approve, the status of new SP node is BONDED - err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr4, spNodeOwner4)) - require.NoError(t, err) - newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) - require.True(t, found) - require.Equal(t, newNode.Status, sdk.Bonded) -} - -func handlerSimulate(ctx sdk.Context, k Keeper, msg types.MsgIndexingNodeRegistrationVote) error { - nodeToApprove, found := k.GetIndexingNode(ctx, msg.CandidateNetworkAddress) - if !found { - return types.ErrNoIndexingNodeFound - } - if !nodeToApprove.GetOwnerAddr().Equals(msg.CandidateOwnerAddress) { - return types.ErrInvalidOwnerAddr - } - - approver, found := k.GetIndexingNode(ctx, msg.VoterNetworkAddress) - if !found { - return types.ErrInvalidVoterAddr - } - if !approver.Status.Equal(sdk.Bonded) || approver.IsSuspended() { - return types.ErrInvalidVoterStatus - } - - _, err := k.HandleVoteForIndexingNodeRegistration(ctx, msg.CandidateNetworkAddress, msg.CandidateOwnerAddress, msg.Opinion, msg.VoterNetworkAddress) - if err != nil { - return err - } - - return nil -} - -func createAccount(t *testing.T, ctx sdk.Context, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, acc sdk.AccAddress, coins sdk.Coins) { - account := accountKeeper.GetAccount(ctx, acc) - if account == nil { - account = accountKeeper.NewAccountWithAddress(ctx, acc) - //fmt.Printf("create account: " + account.String() + "\n") - } - coins, err := bankKeeper.AddCoins(ctx, acc, coins) - require.NoError(t, err) -} +// +//import ( +// "testing" +// "time" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/x/auth" +// "github.com/cosmos/cosmos-sdk/x/bank" +// stratos "github.com/stratosnet/stratos-chain/types" +// "github.com/stratosnet/stratos-chain/x/register/types" +// "github.com/stretchr/testify/require" +// "github.com/tendermint/tendermint/crypto/ed25519" +//) +// +//var ( +// spNodeOwner1 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// spNodeOwner2 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// spNodeOwner3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// spNodeOwner4 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// spNodeOwnerNew = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) +// +// spNodePubKey1 = ed25519.GenPrivKey().PubKey() +// spNodeAddr1 = stratos.SdsAddress(spNodePubKey1.Address()) +// initialStake1 = sdk.NewInt(100000000) +// +// spNodePubKey2 = ed25519.GenPrivKey().PubKey() +// spNodeAddr2 = stratos.SdsAddress(spNodePubKey2.Address()) +// initialStake2 = sdk.NewInt(100000000) +// +// spNodePubKey3 = ed25519.GenPrivKey().PubKey() +// spNodeAddr3 = stratos.SdsAddress(spNodePubKey3.Address()) +// initialStake3 = sdk.NewInt(100000000) +// +// spNodePubKey4 = ed25519.GenPrivKey().PubKey() +// spNodeAddr4 = stratos.SdsAddress(spNodePubKey4.Address()) +// initialStake4 = sdk.NewInt(100000000) +// +// spNodePubKeyNew = ed25519.GenPrivKey().PubKey() +// spNodeAddrNew = stratos.SdsAddress(spNodePubKeyNew.Address()) +// spNodeStakeNew = sdk.NewInt(100000000) +//) +// +//func TestExpiredVote(t *testing.T) { +// +// ctx, accountKeeper, bankKeeper, k, _ := CreateTestInput(t, false) +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// //genesis init Sp nodes. +// genesisSpNode1 := types.NewIndexingNode(spNodeAddr1, spNodePubKey1, spNodeOwner1, types.NewDescription(spNodeAddr1.String(), "", "", "", ""), time) +// genesisSpNode2 := types.NewIndexingNode(spNodeAddr2, spNodePubKey2, spNodeOwner2, types.NewDescription(spNodeAddr2.String(), "", "", "", ""), time) +// genesisSpNode3 := types.NewIndexingNode(spNodeAddr3, spNodePubKey3, spNodeOwner3, types.NewDescription(spNodeAddr3.String(), "", "", "", ""), time) +// genesisSpNode4 := types.NewIndexingNode(spNodeAddr4, spNodePubKey4, spNodeOwner4, types.NewDescription(spNodeAddr4.String(), "", "", "", ""), time) +// genesisSpNode1.Tokens = genesisSpNode1.Tokens.Add(initialStake1) +// genesisSpNode2.Tokens = genesisSpNode2.Tokens.Add(initialStake2) +// genesisSpNode3.Tokens = genesisSpNode3.Tokens.Add(initialStake3) +// genesisSpNode4.Tokens = genesisSpNode3.Tokens.Add(initialStake4) +// genesisSpNode1.Status = sdk.Bonded +// genesisSpNode2.Status = sdk.Bonded +// genesisSpNode3.Status = sdk.Bonded +// genesisSpNode4.Status = sdk.Bonded +// +// k.SetIndexingNode(ctx, genesisSpNode1) +// k.SetIndexingNode(ctx, genesisSpNode2) +// k.SetIndexingNode(ctx, genesisSpNode3) +// k.SetIndexingNode(ctx, genesisSpNode4) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr1, initialStake1) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr2, initialStake2) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr3, initialStake3) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr4, initialStake4) +// k.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4))) +// k.SetInitialGenesisStakeTotal(ctx, initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4)) +// +// //Register new SP node after genesis initialized +// createAccount(t, ctx, accountKeeper, bankKeeper, spNodeOwnerNew, sdk.NewCoins(sdk.NewCoin("ustos", spNodeStakeNew))) +// _, err := k.RegisterIndexingNode(ctx, spNodeAddrNew, spNodePubKeyNew, spNodeOwnerNew, +// types.NewDescription("sds://newIndexingNode", "", "", "", ""), sdk.NewCoin("ustos", spNodeStakeNew)) +// require.NoError(t, err) +// +// //set expireTime of voting to 7 days before +// votePool, found := k.GetIndexingNodeRegistrationVotePool(ctx, spNodeAddrNew) +// require.True(t, found) +// require.NotNil(t, votePool) +// votePool.ExpireTime = votePool.ExpireTime.AddDate(0, 0, -7) +// k.SetIndexingNodeRegistrationVotePool(ctx, votePool) +// +// //After registration, the status of new SP node is UNBONDED +// _, found = k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Error(t, types.ErrVoteExpired) +//} +// +//func TestDuplicateVote(t *testing.T) { +// +// ctx, accountKeeper, bankKeeper, k, _ := CreateTestInput(t, false) +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// //genesis init Sp nodes. +// genesisSpNode1 := types.NewIndexingNode(spNodeAddr1, spNodePubKey1, spNodeOwner1, types.NewDescription(spNodeAddr1.String(), "", "", "", ""), time) +// genesisSpNode2 := types.NewIndexingNode(spNodeAddr2, spNodePubKey2, spNodeOwner2, types.NewDescription(spNodeAddr2.String(), "", "", "", ""), time) +// genesisSpNode3 := types.NewIndexingNode(spNodeAddr3, spNodePubKey3, spNodeOwner3, types.NewDescription(spNodeAddr3.String(), "", "", "", ""), time) +// genesisSpNode4 := types.NewIndexingNode(spNodeAddr4, spNodePubKey4, spNodeOwner4, types.NewDescription(spNodeAddr4.String(), "", "", "", ""), time) +// genesisSpNode1.Tokens = genesisSpNode1.Tokens.Add(initialStake1) +// genesisSpNode2.Tokens = genesisSpNode2.Tokens.Add(initialStake2) +// genesisSpNode3.Tokens = genesisSpNode3.Tokens.Add(initialStake3) +// genesisSpNode4.Tokens = genesisSpNode3.Tokens.Add(initialStake4) +// genesisSpNode1.Status = sdk.Bonded +// genesisSpNode2.Status = sdk.Bonded +// genesisSpNode3.Status = sdk.Bonded +// genesisSpNode4.Status = sdk.Bonded +// +// k.SetIndexingNode(ctx, genesisSpNode1) +// k.SetIndexingNode(ctx, genesisSpNode2) +// k.SetIndexingNode(ctx, genesisSpNode3) +// k.SetIndexingNode(ctx, genesisSpNode4) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr1, initialStake1) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr2, initialStake2) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr3, initialStake3) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr4, initialStake4) +// k.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4))) +// k.SetInitialGenesisStakeTotal(ctx, initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4)) +// +// //Register new SP node after genesis initialized +// createAccount(t, ctx, accountKeeper, bankKeeper, spNodeOwnerNew, sdk.NewCoins(sdk.NewCoin("ustos", spNodeStakeNew))) +// _, err := k.RegisterIndexingNode(ctx, spNodeAddrNew, spNodePubKeyNew, spNodeOwnerNew, +// types.NewDescription("sds://newIndexingNode", "", "", "", ""), sdk.NewCoin("ustos", spNodeStakeNew)) +// require.NoError(t, err) +// +// //After registration, the status of new SP node is UNBONDED +// newNode, found := k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Equal(t, newNode.Status, sdk.Unbonded) +// +// //Exist SP Node1 vote to approve, the status of new SP node is UNBONDED +// err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr1, spNodeOwner1)) +// require.NoError(t, err) +// newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Equal(t, newNode.Status, sdk.Unbonded) +// +// //Exist SP Node1 vote to approve, the status of new SP node is UNBONDED +// err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr1, spNodeOwner1)) +// require.Error(t, types.ErrDuplicateVoting) +//} +// +//func TestSpRegistrationApproval(t *testing.T) { +// +// ctx, accountKeeper, bankKeeper, k, _ := CreateTestInput(t, false) +// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") +// //genesis init Sp nodes. +// genesisSpNode1 := types.NewIndexingNode(spNodeAddr1, spNodePubKey1, spNodeOwner1, types.NewDescription(spNodeAddr1.String(), "", "", "", ""), time) +// genesisSpNode2 := types.NewIndexingNode(spNodeAddr2, spNodePubKey2, spNodeOwner2, types.NewDescription(spNodeAddr2.String(), "", "", "", ""), time) +// genesisSpNode3 := types.NewIndexingNode(spNodeAddr3, spNodePubKey3, spNodeOwner3, types.NewDescription(spNodeAddr3.String(), "", "", "", ""), time) +// genesisSpNode4 := types.NewIndexingNode(spNodeAddr4, spNodePubKey4, spNodeOwner4, types.NewDescription(spNodeAddr4.String(), "", "", "", ""), time) +// genesisSpNode1.Tokens = genesisSpNode1.Tokens.Add(initialStake1) +// genesisSpNode2.Tokens = genesisSpNode2.Tokens.Add(initialStake2) +// genesisSpNode3.Tokens = genesisSpNode3.Tokens.Add(initialStake3) +// genesisSpNode4.Tokens = genesisSpNode3.Tokens.Add(initialStake4) +// genesisSpNode1.Status = sdk.Bonded +// genesisSpNode2.Status = sdk.Bonded +// genesisSpNode3.Status = sdk.Bonded +// genesisSpNode4.Status = sdk.Bonded +// +// k.SetIndexingNode(ctx, genesisSpNode1) +// k.SetIndexingNode(ctx, genesisSpNode2) +// k.SetIndexingNode(ctx, genesisSpNode3) +// k.SetIndexingNode(ctx, genesisSpNode4) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr1, initialStake1) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr2, initialStake2) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr3, initialStake3) +// k.SetLastIndexingNodeStake(ctx, spNodeAddr4, initialStake4) +// k.SetIndexingNodeBondedToken(ctx, sdk.NewCoin(k.BondDenom(ctx), initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4))) +// k.SetInitialGenesisStakeTotal(ctx, initialStake1.Add(initialStake2).Add(initialStake3).Add(initialStake4)) +// +// //Register new SP node after genesis initialized +// createAccount(t, ctx, accountKeeper, bankKeeper, spNodeOwnerNew, sdk.NewCoins(sdk.NewCoin("ustos", spNodeStakeNew))) +// //_, err := k.bankKeeper.AddCoins(ctx, spNodeAddr4, sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), sdk.NewInt(10000000000000)))) +// //require.NoError(t, err) +// +// _, err := k.RegisterIndexingNode(ctx, spNodeAddrNew, spNodePubKeyNew, spNodeOwnerNew, +// types.NewDescription("sds://newIndexingNode", "", "", "", ""), sdk.NewCoin("ustos", spNodeStakeNew)) +// require.NoError(t, err) +// +// //After registration, the status of new SP node is UNBONDED +// newNode, found := k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Equal(t, newNode.Status, sdk.Unbonded) +// +// //Exist SP Node1 vote to approve, the status of new SP node is UNBONDED +// err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr1, spNodeOwner1)) +// require.NoError(t, err) +// newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Equal(t, newNode.Status, sdk.Unbonded) +// +// //Exist SP Node2 vote to approve, the status of new SP node is UNBONDED +// err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr2, spNodeOwner2)) +// require.NoError(t, err) +// newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Equal(t, newNode.Status, sdk.Unbonded) +// +// //Exist SP Node3 vote to approve, the status of new SP node changes to BONDED +// err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr3, spNodeOwner3)) +// require.NoError(t, err) +// newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Equal(t, newNode.Status, sdk.Bonded) +// +// //Exist SP Node4 vote to approve, the status of new SP node is BONDED +// err = handlerSimulate(ctx, k, types.NewMsgIndexingNodeRegistrationVote(spNodeAddrNew, spNodeOwnerNew, types.Approve, spNodeAddr4, spNodeOwner4)) +// require.NoError(t, err) +// newNode, found = k.GetIndexingNode(ctx, spNodeAddrNew) +// require.True(t, found) +// require.Equal(t, newNode.Status, sdk.Bonded) +//} +// +//func handlerSimulate(ctx sdk.Context, k Keeper, msg types.MsgIndexingNodeRegistrationVote) error { +// nodeToApprove, found := k.GetIndexingNode(ctx, msg.CandidateNetworkAddress) +// if !found { +// return types.ErrNoIndexingNodeFound +// } +// if !nodeToApprove.GetOwnerAddr().Equals(msg.CandidateOwnerAddress) { +// return types.ErrInvalidOwnerAddr +// } +// +// approver, found := k.GetIndexingNode(ctx, msg.VoterNetworkAddress) +// if !found { +// return types.ErrInvalidVoterAddr +// } +// if !approver.Status.Equal(sdk.Bonded) || approver.IsSuspended() { +// return types.ErrInvalidVoterStatus +// } +// +// _, err := k.HandleVoteForIndexingNodeRegistration(ctx, msg.CandidateNetworkAddress, msg.CandidateOwnerAddress, msg.Opinion, msg.VoterNetworkAddress) +// if err != nil { +// return err +// } +// +// return nil +//} +// +//func createAccount(t *testing.T, ctx sdk.Context, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, acc sdk.AccAddress, coins sdk.Coins) { +// account := accountKeeper.GetAccount(ctx, acc) +// if account == nil { +// account = accountKeeper.NewAccountWithAddress(ctx, acc) +// //fmt.Printf("create account: " + account.String() + "\n") +// } +// coins, err := bankKeeper.AddCoins(ctx, acc, coins) +// require.NoError(t, err) +//} diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 14918d2f..1910dd87 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -228,7 +228,7 @@ func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { iterator := keeper.GetResourceNetworksIterator(ctx) for ; iterator.Valid(); iterator.Next() { resourceNode := types.MustUnmarshalResourceNode(k.cdc, iterator.Value()) - networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) if err != nil { continue } @@ -237,7 +237,7 @@ func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { iter := keeper.GetIndexingNetworksIterator(ctx) for ; iter.Valid(); iter.Next() { indexingNode := types.MustUnmarshalResourceNode(k.cdc, iter.Value()) - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) if err != nil { continue } @@ -505,7 +505,7 @@ func (k Keeper) UnbondResourceNode( ctx.Logger().Info("Params of register module: " + params.String()) // transfer the node tokens to the not bonded pool - networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) if err != nil { return sdk.ZeroInt(), time.Now(), errors.New("invalid network address") } @@ -554,7 +554,7 @@ func (k Keeper) UnbondIndexingNode( ctx sdk.Context, indexingNode types.IndexingNode, amt sdk.Int, ) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error) { - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) if err != nil { return sdk.ZeroInt(), time.Now(), errors.New("invalid network address") } diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 96c530a8..2539b216 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -29,12 +29,12 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types ctx := sdk.UnwrapSDKContext(goCtx) // check to see if the pubkey or sender has been registered before - pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.PubKey.String()) + pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.Pubkey.String()) if err != nil { return nil, err } - networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddr) + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { return &types.MsgCreateResourceNodeResponse{}, err } @@ -81,12 +81,12 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types.MsgCreateIndexingNode) (*types.MsgCreateIndexingNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // check to see if the pubkey or sender has been registered before - pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.PubKey.String()) + pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.Pubkey.String()) if err != nil { return nil, err } - networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddr) + networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { return &types.MsgCreateIndexingNodeResponse{}, err } diff --git a/x/register/keeper/node_state_change.go b/x/register/keeper/node_state_change.go index b43ee7d1..fdf2bec8 100644 --- a/x/register/keeper/node_state_change.go +++ b/x/register/keeper/node_state_change.go @@ -89,7 +89,7 @@ func (k Keeper) beginUnbondingResourceNode(ctx sdk.Context, resourceNode *types. return &types.ResourceNode{} } - networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) if err != nil { return &types.ResourceNode{} } @@ -106,7 +106,7 @@ func (k Keeper) beginUnbondingIndexingNode(ctx sdk.Context, indexingNode *types. if err != nil { return &types.IndexingNode{} } - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) if err != nil { return &types.IndexingNode{} } diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index bcd6664e..0f4640c2 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -170,7 +170,7 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, indexingNode, found := k.GetIndexingNode(ctx, params.AccAddr) if found { // Adding indexing node staking info - networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, indexingNode.GetStatus(), @@ -200,7 +200,7 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, resourceNode, found := k.GetResourceNode(ctx, params.AccAddr) if found { // Adding resource node staking info - networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, resourceNode.GetStatus(), @@ -244,7 +244,7 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, indNodes := k.GetIndexingNodesFiltered(ctx, params) for _, n := range indNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, n.GetStatus(), @@ -266,7 +266,7 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, } for _, n := range resNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, n.GetStatus(), @@ -346,7 +346,7 @@ func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNode for _, n := range nodes.GetIndexingNodes() { // match NetworkAddr (if supplied) - nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) if er != nil { continue } @@ -364,7 +364,7 @@ func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNode } // match OwnerAddr (if supplied) - nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddr()) + nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddress()) if er != nil { continue } @@ -381,7 +381,7 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode for _, n := range nodes.GetResourceNodes() { // match NetworkAddr (if supplied) - nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddr()) + nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) if er != nil { continue } @@ -399,7 +399,7 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode } // match OwnerAddr (if supplied) - nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddr()) + nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddress()) if er != nil { continue } diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 6048dfb5..ba95c8e8 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -65,7 +65,7 @@ func (k Keeper) GetResourceNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) func (k Keeper) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalResourceNode(k.cdc, resourceNode) - networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + networkAddr, _ := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) store.Set(types.GetResourceNodeKey(networkAddr), bz) } @@ -205,7 +205,7 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingResourceNode(ctx sdk.Context, r // SubtractResourceNodeStake Update the tokens of an existing resource node func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.ResourceNode, tokenToSub sdk.Coin) error { - networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddr()) + networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) if err != nil { return types.ErrInvalidNetworkAddr } diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 6e684316..ea559010 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -75,7 +75,7 @@ func ValidateGenesis(data GenesisState) error { } func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { - _, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, v.PubKey.String()) + _, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, v.Pubkey.String()) if err != nil { panic(err) } @@ -85,19 +85,19 @@ func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { panic(err) } - netAddr, err := stratos.SdsAddressFromBech32(v.NetworkAddr) + netAddr, err := stratos.SdsAddressFromBech32(v.NetworkAddress) if err != nil { panic(err) } return IndexingNode{ - NetworkAddr: netAddr.String(), - PubKey: v.GetPubKey(), - Suspend: v.GetSuspend(), - Status: v.GetStatus(), - Tokens: v.Token, - OwnerAddress: ownerAddress.String(), - Description: v.GetDescription(), + NetworkAddress: netAddr.String(), + Pubkey: v.GetPubkey(), + Suspend: v.GetSuspend(), + Status: v.GetStatus(), + Tokens: v.Tokens, + OwnerAddress: ownerAddress.String(), + Description: v.GetDescription(), } } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go index 112c0d57..87d74099 100644 --- a/x/register/types/genesis.pb.go +++ b/x/register/types/genesis.pb.go @@ -30,10 +30,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the register module's genesis state. type GenesisState struct { Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` - ResourceNodes *ResourceNodes `protobuf:"bytes,2,opt,name=resourceNodes,proto3" json:"resourceNodes,omitempty" yaml:"resource_nodes"` - IndexingNodes *IndexingNodes `protobuf:"bytes,3,opt,name=indexingNodes,proto3" json:"indexingNodes,omitempty" yaml:"indexing_nodes"` - InitialUozPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=initialUozPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initialUozPrice" yaml:"initial_uoz_price"` - TotalUnissuedPrepay github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=totalUnissuedPrepay,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"totalUnissuedPrepay" yaml:"total_unissued_prepay"` + ResourceNodes *ResourceNodes `protobuf:"bytes,2,opt,name=resource_nodes,json=resourceNodes,proto3" json:"resource_nodes,omitempty" yaml:"resource_nodes"` + IndexingNodes *IndexingNodes `protobuf:"bytes,3,opt,name=indexing_nodes,json=indexingNodes,proto3" json:"indexing_nodes,omitempty" yaml:"indexing_nodes"` + InitialUozPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=initial_uoz_price,json=initialUozPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initial_uoz_price" yaml:"initial_uoz_price"` + TotalUnissuedPrepay github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=total_unissued_prepay,json=totalUnissuedPrepay,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_unissued_prepay" yaml:"total_unissued_prepay"` Slashing []*Slashing `protobuf:"bytes,6,rep,name=slashing,proto3" json:"slashing,omitempty" yaml:"slashing_info"` } @@ -99,13 +99,13 @@ func (m *GenesisState) GetSlashing() []*Slashing { } type GenesisIndexingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` - Token github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=token,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token" yaml:"token"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` + Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"token"` + OwnerAddress string `protobuf:"bytes,6,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` } func (m *GenesisIndexingNode) Reset() { *m = GenesisIndexingNode{} } @@ -141,16 +141,16 @@ func (m *GenesisIndexingNode) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisIndexingNode proto.InternalMessageInfo -func (m *GenesisIndexingNode) GetNetworkAddr() string { +func (m *GenesisIndexingNode) GetNetworkAddress() string { if m != nil { - return m.NetworkAddr + return m.NetworkAddress } return "" } -func (m *GenesisIndexingNode) GetPubKey() *types.Any { +func (m *GenesisIndexingNode) GetPubkey() *types.Any { if m != nil { - return m.PubKey + return m.Pubkey } return nil } @@ -191,53 +191,53 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } var fileDescriptor_5bdab54ebea9e48e = []byte{ - // 725 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4f, 0x4f, 0xdb, 0x3c, - 0x1c, 0xc7, 0xdb, 0x07, 0x28, 0x90, 0x02, 0x8f, 0x9e, 0xd0, 0x67, 0x0a, 0x6c, 0x6b, 0x3a, 0x6b, - 0x9a, 0x98, 0x04, 0x89, 0xca, 0x76, 0x9a, 0xd0, 0x24, 0x22, 0xb4, 0x89, 0x4d, 0x43, 0x55, 0x3a, - 0x34, 0x69, 0x97, 0xc8, 0x4d, 0x4c, 0xb0, 0xda, 0xda, 0x91, 0xed, 0x00, 0xe1, 0xb4, 0x97, 0xb0, - 0xf7, 0xb0, 0xb7, 0xb0, 0x17, 0x81, 0x76, 0xe2, 0x38, 0xed, 0x10, 0x4d, 0x70, 0xdf, 0xa1, 0xaf, - 0x60, 0xaa, 0xed, 0xd0, 0x30, 0x55, 0x93, 0x38, 0xd5, 0xee, 0xef, 0xeb, 0xcf, 0xd7, 0xfe, 0xf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6b, 0xd2, 0x82, 0xa5, 0xe3, 0x60, 0x93, 0x0e, 0xb1, 0x40, 0xc3, - 0x44, 0x64, 0x7e, 0x19, 0xeb, 0x1d, 0x5c, 0x5c, 0x35, 0xab, 0x97, 0x57, 0xcd, 0xea, 0xcf, 0xab, - 0x66, 0xf5, 0xf3, 0x75, 0xb3, 0x72, 0x79, 0xdd, 0xac, 0x7c, 0xbf, 0x6e, 0x56, 0x3e, 0x3e, 0x2f, - 0x3d, 0x5e, 0x9b, 0x12, 0x24, 0x8a, 0xe5, 0x56, 0x78, 0x0c, 0x31, 0x71, 0xcf, 0x26, 0x9f, 0x3c, - 0x99, 0x8e, 0x5e, 0x4d, 0xf6, 0xc1, 0xb3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xd8, 0x26, - 0x1f, 0xbd, 0x05, 0x00, 0x00, + // 730 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdf, 0x4e, 0xdb, 0x3a, + 0x1c, 0xc7, 0xdb, 0x03, 0xa7, 0x80, 0xa1, 0x45, 0x84, 0x72, 0x14, 0x38, 0xe7, 0x34, 0x3d, 0xd6, + 0xd1, 0xc4, 0x24, 0x48, 0x54, 0xb6, 0xab, 0x49, 0x9b, 0x44, 0x86, 0x36, 0xb1, 0x69, 0xa8, 0x4a, + 0xc5, 0x26, 0xed, 0xa6, 0x4a, 0x13, 0x13, 0xac, 0xb6, 0x76, 0x64, 0x3b, 0x85, 0x70, 0xb9, 0x27, + 0xd8, 0x8b, 0xec, 0x6e, 0x0f, 0x81, 0x76, 0xc5, 0xe5, 0xb4, 0x8b, 0x68, 0x82, 0x37, 0xa8, 0xf6, + 0x00, 0x53, 0x6d, 0x07, 0x02, 0xab, 0x26, 0x71, 0xd5, 0xf8, 0xe7, 0x8f, 0xbf, 0x5f, 0xfb, 0xf7, + 0xa7, 0xe0, 0x3f, 0x2e, 0x98, 0x2f, 0x28, 0x77, 0x18, 0x8a, 0x30, 0x17, 0x88, 0x39, 0xa3, 0x96, + 0x13, 0x21, 0x82, 0x38, 0xe6, 0x76, 0xcc, 0xa8, 0xa0, 0xc6, 0xaa, 0x46, 0xec, 0x1c, 0xb1, 0x47, + 0xad, 0x8d, 0xf5, 0x88, 0xd2, 0x68, 0x80, 0x1c, 0x89, 0xf4, 0x92, 0x23, 0xc7, 0x27, 0xa9, 0xe2, + 0x37, 0xea, 0x11, 0x8d, 0xa8, 0xfc, 0x74, 0x26, 0x5f, 0x3a, 0xba, 0x1e, 0x50, 0x3e, 0xa4, 0xbc, + 0xab, 0x36, 0xd4, 0x42, 0x6f, 0xfd, 0xaf, 0x56, 0x0e, 0x17, 0x7e, 0x1f, 0x93, 0xc8, 0x19, 0xb5, + 0x7a, 0x48, 0xf8, 0xad, 0x7c, 0xad, 0x29, 0x38, 0xed, 0xa6, 0xd7, 0x57, 0x92, 0x0c, 0xfc, 0x31, + 0x0b, 0x96, 0x5e, 0xaa, 0xcb, 0x77, 0x84, 0x2f, 0x90, 0xf1, 0x02, 0x54, 0x62, 0x9f, 0xf9, 0x43, + 0x6e, 0x96, 0x9b, 0xe5, 0xcd, 0xc5, 0x9d, 0xbf, 0xed, 0x29, 0x8f, 0xb1, 0xdb, 0x12, 0x71, 0x57, + 0xc6, 0x99, 0x55, 0x4d, 0xfd, 0xe1, 0xe0, 0x09, 0x54, 0x87, 0xa0, 0xa7, 0x4f, 0x1b, 0x21, 0xa8, + 0x31, 0xc4, 0x69, 0xc2, 0x02, 0xd4, 0x25, 0x34, 0x44, 0xdc, 0xfc, 0x43, 0xea, 0xc1, 0xa9, 0x7a, + 0x9e, 0x46, 0x0f, 0x26, 0xa4, 0xbb, 0x3e, 0xce, 0xac, 0x35, 0x25, 0x7b, 0x5b, 0x03, 0x7a, 0x55, + 0x56, 0x24, 0x27, 0x2e, 0x98, 0x84, 0xe8, 0x14, 0x93, 0x48, 0xbb, 0xcc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x37, 0xcd, 0x58, 0x38, 0x0e, 0xb7, + 0xe8, 0x10, 0x0b, 0x34, 0x8c, 0x45, 0xea, 0x15, 0x65, 0xdd, 0x83, 0xf3, 0xcb, 0x46, 0xf9, 0xe2, + 0xb2, 0x51, 0xfe, 0x7e, 0xd9, 0x28, 0x7f, 0xbc, 0x6a, 0x94, 0x2e, 0xae, 0x1a, 0xa5, 0xaf, 0x57, + 0x8d, 0xd2, 0xfb, 0xc7, 0x85, 0xe7, 0x6b, 0x53, 0x82, 0x44, 0xfe, 0xb9, 0x1d, 0x1c, 0xfb, 0x98, + 0x38, 0xa7, 0x37, 0x7f, 0x81, 0x32, 0x21, 0xbd, 0x8a, 0x6c, 0x85, 0x47, 0x3f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0x6a, 0xaa, 0xf2, 0xbe, 0xcd, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -373,9 +373,9 @@ func (m *GenesisIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x32 } { - size := m.Token.Size() + size := m.Tokens.Size() i -= size - if _, err := m.Token.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintGenesis(dAtA, i, uint64(size)) @@ -397,9 +397,9 @@ func (m *GenesisIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.PubKey != nil { + if m.Pubkey != nil { { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -409,10 +409,10 @@ func (m *GenesisIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.NetworkAddr) > 0 { - i -= len(m.NetworkAddr) - copy(dAtA[i:], m.NetworkAddr) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.NetworkAddr))) + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.NetworkAddress))) i-- dAtA[i] = 0xa } @@ -467,12 +467,12 @@ func (m *GenesisIndexingNode) Size() (n int) { } var l int _ = l - l = len(m.NetworkAddr) + l = len(m.NetworkAddress) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - if m.PubKey != nil { - l = m.PubKey.Size() + if m.Pubkey != nil { + l = m.Pubkey.Size() n += 1 + l + sovGenesis(uint64(l)) } if m.Suspend { @@ -481,7 +481,7 @@ func (m *GenesisIndexingNode) Size() (n int) { if m.Status != 0 { n += 1 + sovGenesis(uint64(m.Status)) } - l = m.Token.Size() + l = m.Tokens.Size() n += 1 + l + sovGenesis(uint64(l)) l = len(m.OwnerAddress) if l > 0 { @@ -791,7 +791,7 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -819,11 +819,11 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -850,10 +850,10 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} + if m.Pubkey == nil { + m.Pubkey = &types.Any{} } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -898,7 +898,7 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { } case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -926,7 +926,7 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index d26930a1..5eee6541 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -61,20 +61,20 @@ func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, return IndexingNode{}, err } return IndexingNode{ - NetworkAddr: networkAddr.String(), - PubKey: pkAny, - Suspend: true, - Status: stakingtypes.Unbonded, - Tokens: sdk.ZeroInt(), - OwnerAddress: ownerAddr.String(), - Description: description, - CreationTime: creationTime, + NetworkAddress: networkAddr.String(), + Pubkey: pkAny, + Suspend: true, + Status: stakingtypes.Unbonded, + Tokens: sdk.ZeroInt(), + OwnerAddress: ownerAddr.String(), + Description: description, + CreationTime: creationTime, }, nil } // ConvertToString returns a human-readable string representation of an indexing node. func (v IndexingNode) ConvertToString() string { - pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) + pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) if err != nil { return ErrUnknownPubKey.Error() } @@ -91,7 +91,7 @@ func (v IndexingNode) ConvertToString() string { Owner Address: %s Description: %s CreationTime: %s - }`, v.GetNetworkAddr(), pubKey, v.GetSuspend(), v.GetStatus(), + }`, v.GetNetworkAddress(), pubKey, v.GetSuspend(), v.GetStatus(), v.Tokens, v.GetOwnerAddress(), v.GetDescription(), v.GetCreationTime()) } @@ -114,7 +114,7 @@ func (v IndexingNode) SubToken(amount sdk.Int) IndexingNode { } func (v IndexingNode) Validate() error { - netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddr()) + netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddress()) if err != nil { return err } @@ -122,7 +122,7 @@ func (v IndexingNode) Validate() error { if netAddr.Empty() { return ErrEmptyNodeNetworkAddress } - pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) + pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) if err != nil { return err } @@ -230,10 +230,10 @@ func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []strat rejectSlice = append(rejectSlice, reject.String()) } return IndexingNodeRegistrationVotePool{ - NodeAddress: nodeAddress.String(), - ApproveList: approveSlice, - RejectList: rejectSlice, - ExpireTime: &expireTime, + NetworkAddress: nodeAddress.String(), + ApproveList: approveSlice, + RejectList: rejectSlice, + ExpireTime: expireTime, } } diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 3f38bfb9..89268bbc 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -48,12 +48,12 @@ func NewMsgCreateResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes } } return &MsgCreateResourceNode{ - NetworkAddr: networkAddr.String(), - PubKey: pkAny, - Value: value, - OwnerAddress: ownerAddr.String(), - Description: description, - NodeType: nodeType.Type(), + NetworkAddress: networkAddr.String(), + Pubkey: pkAny, + Value: value, + OwnerAddress: ownerAddr.String(), + Description: description, + NodeType: nodeType.Type(), }, nil } @@ -63,7 +63,7 @@ func (msg MsgCreateResourceNode) Type() string { return TypeMsgCreateResourceNod // ValidateBasic validity check for the CreateResourceNode func (msg MsgCreateResourceNode) ValidateBasic() error { - netAddr, err := stratos.SdsAddressFromBech32(msg.GetNetworkAddr()) + netAddr, err := stratos.SdsAddressFromBech32(msg.GetNetworkAddress()) if err != nil { return err } @@ -71,7 +71,7 @@ func (msg MsgCreateResourceNode) ValidateBasic() error { return ErrEmptyNodeNetworkAddress } - pkAny, err := codectypes.NewAnyWithValue(msg.GetPubKey()) + pkAny, err := codectypes.NewAnyWithValue(msg.GetPubkey()) if err != nil { return err } @@ -138,11 +138,11 @@ func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes } } return &MsgCreateResourceNode{ - NetworkAddr: networkAddr.String(), - PubKey: pkAny, - Value: value, - OwnerAddress: ownerAddr.String(), - Description: description, + NetworkAddress: networkAddr.String(), + Pubkey: pkAny, + Value: value, + OwnerAddress: ownerAddr.String(), + Description: description, }, nil } @@ -151,7 +151,7 @@ func (msg MsgCreateIndexingNode) Route() string { return RouterKey } func (msg MsgCreateIndexingNode) Type() string { return TypeCreateIndexingNodeTx } func (msg MsgCreateIndexingNode) ValidateBasic() error { - netAddr, err := stratos.SdsAddressFromBech32(msg.GetNetworkAddr()) + netAddr, err := stratos.SdsAddressFromBech32(msg.GetNetworkAddress()) if err != nil { return err } @@ -159,7 +159,7 @@ func (msg MsgCreateIndexingNode) ValidateBasic() error { return ErrEmptyNodeNetworkAddress } - pkAny, err := codectypes.NewAnyWithValue(msg.GetPubKey()) + pkAny, err := codectypes.NewAnyWithValue(msg.GetPubkey()) if err != nil { return err } diff --git a/x/register/types/querier.go b/x/register/types/querier.go index 8927e1df..b49a9769 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -75,8 +75,8 @@ func NewStakingInfoByResourceNodeAddr( unBondingValue := sdk.NewCoin(defaultDenom, unBondingStake) return StakingInfo{ - NetworkAddr: resourceNode.GetNetworkAddr(), - PubKey: resourceNode.GetPubKey(), + NetworkAddress: resourceNode.GetNetworkAddress(), + Pubkey: resourceNode.GetPubkey(), Suspend: resourceNode.GetSuspend(), Status: resourceNode.GetStatus(), Tokens: &resourceNode.Tokens, @@ -101,8 +101,8 @@ func NewStakingInfoByIndexingNodeAddr( unBondedValue := sdk.NewCoin(defaultDenom, unBondedStake) unBondingValue := sdk.NewCoin(defaultDenom, unBondingStake) return StakingInfo{ - NetworkAddr: indexingNode.GetNetworkAddr(), - PubKey: indexingNode.GetPubKey(), + NetworkAddress: indexingNode.GetNetworkAddress(), + Pubkey: indexingNode.GetPubkey(), Suspend: indexingNode.Suspend, Status: indexingNode.Status, Tokens: &indexingNode.Tokens, diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 39e1f588..e8d893b1 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -103,15 +103,15 @@ func (m *Params) GetMaxEntries() uint32 { } type ResourceNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` - Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` - CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` - NodeType string `protobuf:"bytes,9,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` + CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NodeType string `protobuf:"bytes,9,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *ResourceNode) Reset() { *m = ResourceNode{} } @@ -147,16 +147,16 @@ func (m *ResourceNode) XXX_DiscardUnknown() { var xxx_messageInfo_ResourceNode proto.InternalMessageInfo -func (m *ResourceNode) GetNetworkAddr() string { +func (m *ResourceNode) GetNetworkAddress() string { if m != nil { - return m.NetworkAddr + return m.NetworkAddress } return "" } -func (m *ResourceNode) GetPubKey() *types.Any { +func (m *ResourceNode) GetPubkey() *types.Any { if m != nil { - return m.PubKey + return m.Pubkey } return nil } @@ -204,14 +204,14 @@ func (m *ResourceNode) GetNodeType() string { } type IndexingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` - Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` - CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` + CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } func (m *IndexingNode) Reset() { *m = IndexingNode{} } @@ -247,16 +247,16 @@ func (m *IndexingNode) XXX_DiscardUnknown() { var xxx_messageInfo_IndexingNode proto.InternalMessageInfo -func (m *IndexingNode) GetNetworkAddr() string { +func (m *IndexingNode) GetNetworkAddress() string { if m != nil { - return m.NetworkAddr + return m.NetworkAddress } return "" } -func (m *IndexingNode) GetPubKey() *types.Any { +func (m *IndexingNode) GetPubkey() *types.Any { if m != nil { - return m.PubKey + return m.Pubkey } return nil } @@ -297,10 +297,10 @@ func (m *IndexingNode) GetCreationTime() time.Time { } type IndexingNodeRegistrationVotePool struct { - NodeAddress string `protobuf:"bytes,1,opt,name=nodeAddress,proto3" json:"network_address" yaml:"network_address"` - ApproveList []string `protobuf:"bytes,2,rep,name=approveList,proto3" json:"approve_list" yaml:"approve_list"` - RejectList []string `protobuf:"bytes,3,rep,name=rejectList,proto3" json:"reject_list" yaml:"reject_list"` - ExpireTime *time.Time `protobuf:"bytes,4,opt,name=expireTime,proto3,stdtime" json:"expire_time" yaml:"expire_time"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + ApproveList []string `protobuf:"bytes,2,rep,name=approve_list,json=approveList,proto3" json:"approve_list" yaml:"approve_list"` + RejectList []string `protobuf:"bytes,3,rep,name=reject_list,json=rejectList,proto3" json:"reject_list" yaml:"reject_list"` + ExpireTime time.Time `protobuf:"bytes,4,opt,name=expire_time,json=expireTime,proto3,stdtime" json:"expire_time" yaml:"expire_time"` } func (m *IndexingNodeRegistrationVotePool) Reset() { *m = IndexingNodeRegistrationVotePool{} } @@ -336,9 +336,9 @@ func (m *IndexingNodeRegistrationVotePool) XXX_DiscardUnknown() { var xxx_messageInfo_IndexingNodeRegistrationVotePool proto.InternalMessageInfo -func (m *IndexingNodeRegistrationVotePool) GetNodeAddress() string { +func (m *IndexingNodeRegistrationVotePool) GetNetworkAddress() string { if m != nil { - return m.NodeAddress + return m.NetworkAddress } return "" } @@ -357,18 +357,18 @@ func (m *IndexingNodeRegistrationVotePool) GetRejectList() []string { return nil } -func (m *IndexingNodeRegistrationVotePool) GetExpireTime() *time.Time { +func (m *IndexingNodeRegistrationVotePool) GetExpireTime() time.Time { if m != nil { return m.ExpireTime } - return nil + return time.Time{} } type Description struct { Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker" yaml:"moniker"` Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity" yaml:"identity",omitempty` Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website" yaml:"website",omitempty` - SecurityContact string `protobuf:"bytes,4,opt,name=securityContact,proto3" json:"security_contact" yaml:"security_contact",omitempty` + SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact" yaml:"security_contact",omitempty` Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details" yaml:"details",omitempty` } @@ -441,7 +441,7 @@ func (m *Description) GetDetails() string { } type Slashing struct { - WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value" yaml:"value"` } @@ -493,7 +493,7 @@ func (m *Slashing) GetValue() int64 { } type ResourceNodes struct { - ResourceNodes []*ResourceNode `protobuf:"bytes,1,rep,name=resourceNodes,proto3" json:"resourceNodes,omitempty"` + ResourceNodes []*ResourceNode `protobuf:"bytes,1,rep,name=resource_nodes,json=resourceNodes,proto3" json:"resource_nodes,omitempty"` } func (m *ResourceNodes) Reset() { *m = ResourceNodes{} } @@ -537,7 +537,7 @@ func (m *ResourceNodes) GetResourceNodes() []*ResourceNode { } type IndexingNodes struct { - IndexingNodes []*IndexingNode `protobuf:"bytes,1,rep,name=indexingNodes,proto3" json:"indexingNodes,omitempty"` + IndexingNodes []*IndexingNode `protobuf:"bytes,1,rep,name=indexing_nodes,json=indexingNodes,proto3" json:"indexing_nodes,omitempty"` } func (m *IndexingNodes) Reset() { *m = IndexingNodes{} } @@ -657,15 +657,15 @@ func (m *TotalStakesResponse) GetTotalUnbondingStake() *types2.Coin { } type StakingInfo struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` Tokens *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + OwnerAddress string `protobuf:"bytes,6,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` - NodeType string `protobuf:"bytes,9,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` + NodeType string `protobuf:"bytes,9,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` BondedStake *types2.Coin `protobuf:"bytes,10,opt,name=bonded_stake,json=bondedStake,proto3" json:"bonded_stake" yaml:"bonded_stake"` UnBondingStake *types2.Coin `protobuf:"bytes,11,opt,name=un_bonding_stake,json=unBondingStake,proto3" json:"un_bonding_stake" yaml:"un_bonding_stake"` UnBondedStake *types2.Coin `protobuf:"bytes,12,opt,name=un_bonded_stake,json=unBondedStake,proto3" json:"un_bonded_stake" yaml:"un_bonded_stake"` @@ -704,16 +704,16 @@ func (m *StakingInfo) XXX_DiscardUnknown() { var xxx_messageInfo_StakingInfo proto.InternalMessageInfo -func (m *StakingInfo) GetNetworkAddr() string { +func (m *StakingInfo) GetNetworkAddress() string { if m != nil { - return m.NetworkAddr + return m.NetworkAddress } return "" } -func (m *StakingInfo) GetPubKey() *types.Any { +func (m *StakingInfo) GetPubkey() *types.Any { if m != nil { - return m.PubKey + return m.Pubkey } return nil } @@ -784,7 +784,7 @@ func (m *StakingInfo) GetUnBondedStake() *types2.Coin { // UnbondingNode stores all of a single delegator's unbonding bonds // for a single unbonding node in a time-ordered list type UnbondingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_addr" yaml:"network_addr"` + NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr" yaml:"network_addr"` IsIndexingNode bool `protobuf:"varint,2,opt,name=is_indexing_node,json=isIndexingNode,proto3" json:"is_indexing_node" yaml:"is_indexing_node"` Entries []*UnbondingNodeEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries" yaml:"entries"` } @@ -906,8 +906,9 @@ type Staking struct { Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"value" yaml:"value"` } -func (m *Staking) Reset() { *m = Staking{} } -func (*Staking) ProtoMessage() {} +func (m *Staking) Reset() { *m = Staking{} } +func (m *Staking) String() string { return proto.CompactTextString(m) } +func (*Staking) ProtoMessage() {} func (*Staking) Descriptor() ([]byte, []int) { return fileDescriptor_fef1e3aeec8499d6, []int{12} } @@ -938,6 +939,20 @@ func (m *Staking) XXX_DiscardUnknown() { var xxx_messageInfo_Staking proto.InternalMessageInfo +func (m *Staking) GetNetworkAddress() string { + if m != nil { + return m.NetworkAddress + } + return "" +} + +func (m *Staking) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "stratos.register.v1.Params") proto.RegisterType((*ResourceNode)(nil), "stratos.register.v1.ResourceNode") @@ -959,113 +974,110 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1682 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0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x56, 0x2e, 0x1e, 0x80, 0xea, 0x30, 0x3c, 0xef, - 0x62, 0x2a, 0x12, 0x82, 0x79, 0xf3, 0x8d, 0x56, 0x69, 0xa7, 0xee, 0x77, 0xa6, 0x29, 0x74, 0xe1, - 0x59, 0x0a, 0xbf, 0xac, 0xcd, 0x38, 0x20, 0xfa, 0x16, 0x1b, 0x12, 0x81, 0x87, 0x23, 0x31, 0x09, - 0xc0, 0x30, 0x3c, 0xdf, 0x33, 0xf0, 0xef, 0x96, 0x41, 0x2d, 0xc0, 0x9c, 0x8d, 0x93, 0x08, 0x3f, - 0x63, 0x31, 0xf6, 0x7e, 0x08, 0xaa, 0x14, 0x8b, 0x33, 0x96, 0x9c, 0x3c, 0x8a, 0xe3, 0xc4, 0xdc, - 0xf6, 0xfd, 0x69, 0x0a, 0xd7, 0x0d, 0xdc, 0x0d, 0xe3, 0x38, 0xc1, 0x5c, 0x9a, 0xf9, 0xa2, 0x36, - 0x53, 0x10, 0xa0, 0xc0, 0x65, 0xf0, 0x42, 0xb0, 0x3c, 0x1a, 0xf7, 0xde, 0xc5, 0x13, 0x73, 0xcb, - 0x9b, 0x97, 0x42, 0xf8, 0x88, 0x4e, 0xfc, 0x87, 0xd3, 0x14, 0xca, 0x7d, 0x27, 0x78, 0x32, 0x4b, - 0x61, 0x5d, 0x13, 0xeb, 0x35, 0xfa, 0xe4, 0x0f, 0xf7, 0x37, 0x4d, 0x86, 0x47, 0xc9, 0x64, 0x24, - 0x58, 0xfb, 0x40, 0x11, 0x06, 0x86, 0xd8, 0xfb, 0x0e, 0x58, 0xe1, 0x63, 0x3e, 0xc2, 0x34, 0x56, - 0xd7, 0xb4, 0xea, 0x7f, 0x65, 0x9a, 0x42, 0x0b, 0xcd, 0x52, 0xd8, 0xd0, 0x74, 0x06, 0x40, 0x81, - 0x15, 0x79, 0xef, 0x83, 0x65, 0x2e, 0x42, 0x31, 0xd6, 0xa1, 0x6c, 0x3c, 0x40, 0x6d, 0x63, 0xc7, - 0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0x21, 0xa1, 0x9d, 0xf3, 0xec, 0xd3, 0xbc, 0xf2, 0xa0, 0xb7, - 0xac, 0xb2, 0xf5, 0xe1, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x14, 0x26, 0xcc, 0x7e, 0xbb, 0x17, - 0x00, 0x00, + // 1648 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1c, 0x49, + 0x15, 0xf7, 0xcc, 0xc4, 0x5f, 0x35, 0x1f, 0x36, 0x6d, 0x2f, 0x19, 0x1b, 0x70, 0x39, 0xc5, 0xc7, + 0x1a, 0x2d, 0x9e, 0x91, 0x13, 0x24, 0x04, 0x07, 0xa4, 0x74, 0x6c, 0xb2, 0xde, 0x85, 0xc8, 0x6a, + 0x9b, 0x5d, 0x05, 0x29, 0x1a, 0x7a, 0xba, 0x2b, 0xe3, 0x8a, 0x67, 0xaa, 0x46, 0x5d, 0x35, 0xb6, + 0xe7, 0x86, 0xc4, 0x1f, 0x40, 0x8e, 0x39, 0x72, 0x46, 0xe2, 0xc6, 0x1f, 0x11, 0xe5, 0x94, 0x23, + 0xe2, 0xd0, 0xa0, 0x84, 0xd3, 0x48, 0x5c, 0xfa, 0x06, 0x27, 0x54, 0x1f, 0x3d, 0x5d, 0xdd, 0x76, + 0x34, 0x04, 0xc8, 0x01, 0xe4, 0xd3, 0x74, 0xfd, 0x5e, 0xbd, 0xdf, 0x7b, 0x55, 0xaf, 0xde, 0xab, + 0x37, 0x05, 0x10, 0x17, 0x91, 0x2f, 0x18, 0x6f, 0x47, 0xb8, 0x47, 0xb8, 0xc0, 0x51, 0xfb, 0x7c, + 0x6f, 0xfa, 0xdd, 0x1a, 0x46, 0x4c, 0x30, 0x67, 0xcd, 0xcc, 0x69, 0x4d, 0xf1, 0xf3, 0xbd, 0xcd, + 0xf5, 0x1e, 0xeb, 0x31, 0x25, 0x6f, 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c, + 0xb5, 0xcc, 0x8e, 0x05, 0xea, 0xed, 0x07, 0x1a, 0x51, 0x9b, 0xff, 0xf7, 0x32, 0xa8, 0x5a, 0x87, + 0x46, 0x26, 0xec, 0x80, 0x51, 0x72, 0x86, 0x23, 0xb3, 0xbf, 0x2a, 0x61, 0x0d, 0x94, 0x25, 0xac, + 0x01, 0x90, 0x97, 0x8a, 0x9c, 0x03, 0xb0, 0x44, 0x42, 0x4c, 0x05, 0x11, 0xba, 0x9c, 0xe8, 0xf3, + 0x3e, 0xc5, 0x92, 0x18, 0x6e, 0x68, 0xd5, 0x14, 0xb1, 0xdb, 0x85, 0xe9, 0x34, 0xe7, 0x3e, 0x58, + 0xbc, 0xc0, 0x5d, 0x4e, 0x84, 0x6e, 0x87, 0x74, 0x28, 0x52, 0x28, 0x89, 0x61, 0x53, 0x93, 0x18, + 0xc0, 0xe6, 0x48, 0x27, 0x39, 0x21, 0x58, 0xe5, 0x38, 0x18, 0x45, 0x44, 0x8c, 0x3b, 0x01, 0xa3, + 0xc2, 0x0f, 0x84, 0xda, 0xc3, 0x65, 0xf7, 0x87, 0x93, 0x18, 0x5e, 0x91, 0x25, 0x31, 0xbc, 0x63, + 0x4a, 0x45, 0x41, 0x62, 0xb3, 0xaf, 0xa4, 0xc2, 0x07, 0x5a, 0x26, 0x1d, 0x0d, 0xb1, 0xf0, 0x49, + 0x3f, 0x2d, 0x24, 0xca, 0x51, 0x03, 0x65, 0x8e, 0x1a, 0x20, 0xe7, 0x68, 0x8a, 0xfd, 0xa6, 0x04, + 0x96, 0x8e, 0xfb, 0x3e, 0x3f, 0x25, 0xb4, 0xe7, 0x78, 0xa0, 0x71, 0xe1, 0xf7, 0xfb, 0x58, 0x14, + 0xce, 0xf7, 0x27, 0x93, 0x18, 0x16, 0x24, 0x49, 0x0c, 0x3f, 0x32, 0xdb, 0x90, 0xc3, 0x91, 0x57, + 0xd7, 0x40, 0x7a, 0xb8, 0xdb, 0x60, 0xfe, 0xdc, 0xef, 0x8f, 0x74, 0xf3, 0x5b, 0x71, 0x37, 0x26, + 0x31, 0xd4, 0x40, 0x12, 0xc3, 0x9a, 0x66, 0x50, 0x43, 0xe4, 0x69, 0x18, 0x3d, 0x06, 0x75, 0xbb, + 0x53, 0xe3, 0xce, 0xa7, 0xa0, 0x11, 0x19, 0xa0, 0x23, 0x2f, 0x28, 0xe9, 0x55, 0x65, 0xa7, 0x7a, + 0xf7, 0xce, 0xb5, 0xd5, 0xc7, 0xd6, 0xf5, 0xea, 0x91, 0xcd, 0x24, 0xa9, 0xed, 0x24, 0x57, 0xd4, + 0xc4, 0x00, 0xff, 0x02, 0x75, 0xae, 0x40, 0xd4, 0x89, 0xcd, 0x84, 0x7e, 0x57, 0x01, 0x6b, 0x27, + 0x4c, 0xf8, 0xfd, 0x63, 0xe1, 0x9f, 0x61, 0xee, 0x61, 0x3e, 0x64, 0x94, 0xcb, 0x7b, 0x73, 0x33, + 0xef, 0x7c, 0x47, 0xc8, 0x59, 0x1d, 0x79, 0x85, 0x60, 0xb5, 0xbd, 0xb2, 0xdb, 0x36, 0xf7, 0x8a, + 0xfc, 0x2b, 0x33, 0xbd, 0x54, 0x1e, 0x30, 0x42, 0xbd, 0xdb, 0xb9, 0x05, 0x64, 0x06, 0x24, 0x6f, + 0xde, 0xf3, 0x1c, 0x6f, 0x79, 0x26, 0x6f, 0xce, 0x7b, 0x8b, 0xf7, 0x21, 0x70, 0x34, 0x91, 0xec, + 0xcc, 0x71, 0x68, 0xf8, 0x2a, 0xb3, 0xf8, 0x56, 0x95, 0x92, 0xab, 0x74, 0x34, 0xd1, 0xe7, 0x60, + 0x5d, 0x13, 0xe9, 0x26, 0x7f, 0x4a, 0x75, 0x6b, 0x16, 0x95, 0xb6, 0xff, 0x73, 0xa3, 0xa5, 0xc9, + 0x7e, 0x06, 0x3e, 0xb2, 0xc9, 0xe4, 0xa2, 0x35, 0xdb, 0xfc, 0x2c, 0xb6, 0x35, 0x8b, 0x8d, 0xd0, + 0x9e,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82, 0x49, 0x2a, 0x8a, 0x45, + 0xfa, 0xb9, 0x1b, 0x9c, 0xfa, 0x84, 0xb6, 0x2f, 0xb3, 0x97, 0x7b, 0x65, 0xb3, 0xbb, 0xa0, 0xce, + 0xe7, 0xbd, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x86, 0xf6, 0xec, 0x5d, 0xda, 0x17, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1198,9 +1210,9 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.PubKey != nil { + if m.Pubkey != nil { { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1210,10 +1222,10 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.NetworkAddr) > 0 { - i -= len(m.NetworkAddr) - copy(dAtA[i:], m.NetworkAddr) - i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddr))) + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddress))) i-- dAtA[i] = 0xa } @@ -1292,9 +1304,9 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.PubKey != nil { + if m.Pubkey != nil { { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1304,10 +1316,10 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.NetworkAddr) > 0 { - i -= len(m.NetworkAddr) - copy(dAtA[i:], m.NetworkAddr) - i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddr))) + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddress))) i-- dAtA[i] = 0xa } @@ -1334,16 +1346,14 @@ func (m *IndexingNodeRegistrationVotePool) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l - if m.ExpireTime != nil { - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.ExpireTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpireTime):]) - if err9 != nil { - return 0, err9 - } - i -= n9 - i = encodeVarintRegister(dAtA, i, uint64(n9)) - i-- - dAtA[i] = 0x22 + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpireTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireTime):]) + if err9 != nil { + return 0, err9 } + i -= n9 + i = encodeVarintRegister(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x22 if len(m.RejectList) > 0 { for iNdEx := len(m.RejectList) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.RejectList[iNdEx]) @@ -1362,10 +1372,10 @@ func (m *IndexingNodeRegistrationVotePool) MarshalToSizedBuffer(dAtA []byte) (in dAtA[i] = 0x12 } } - if len(m.NodeAddress) > 0 { - i -= len(m.NodeAddress) - copy(dAtA[i:], m.NodeAddress) - i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeAddress))) + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddress))) i-- dAtA[i] = 0xa } @@ -1739,9 +1749,9 @@ func (m *StakingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.PubKey != nil { + if m.Pubkey != nil { { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1751,10 +1761,10 @@ func (m *StakingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.NetworkAddr) > 0 { - i -= len(m.NetworkAddr) - copy(dAtA[i:], m.NetworkAddr) - i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddr))) + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintRegister(dAtA, i, uint64(len(m.NetworkAddress))) i-- dAtA[i] = 0xa } @@ -1959,12 +1969,12 @@ func (m *ResourceNode) Size() (n int) { } var l int _ = l - l = len(m.NetworkAddr) + l = len(m.NetworkAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) } - if m.PubKey != nil { - l = m.PubKey.Size() + if m.Pubkey != nil { + l = m.Pubkey.Size() n += 1 + l + sovRegister(uint64(l)) } if m.Suspend { @@ -1998,12 +2008,12 @@ func (m *IndexingNode) Size() (n int) { } var l int _ = l - l = len(m.NetworkAddr) + l = len(m.NetworkAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) } - if m.PubKey != nil { - l = m.PubKey.Size() + if m.Pubkey != nil { + l = m.Pubkey.Size() n += 1 + l + sovRegister(uint64(l)) } if m.Suspend { @@ -2033,7 +2043,7 @@ func (m *IndexingNodeRegistrationVotePool) Size() (n int) { } var l int _ = l - l = len(m.NodeAddress) + l = len(m.NetworkAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) } @@ -2049,10 +2059,8 @@ func (m *IndexingNodeRegistrationVotePool) Size() (n int) { n += 1 + l + sovRegister(uint64(l)) } } - if m.ExpireTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpireTime) - n += 1 + l + sovRegister(uint64(l)) - } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireTime) + n += 1 + l + sovRegister(uint64(l)) return n } @@ -2166,12 +2174,12 @@ func (m *StakingInfo) Size() (n int) { } var l int _ = l - l = len(m.NetworkAddr) + l = len(m.NetworkAddress) if l > 0 { n += 1 + l + sovRegister(uint64(l)) } - if m.PubKey != nil { - l = m.PubKey.Size() + if m.Pubkey != nil { + l = m.Pubkey.Size() n += 1 + l + sovRegister(uint64(l)) } if m.Suspend { @@ -2480,7 +2488,7 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2508,11 +2516,11 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2539,10 +2547,10 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} + if m.Pubkey == nil { + m.Pubkey = &types.Any{} } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2804,7 +2812,7 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2832,11 +2840,11 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2863,10 +2871,10 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} + if m.Pubkey == nil { + m.Pubkey = &types.Any{} } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3096,7 +3104,7 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3124,7 +3132,7 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NodeAddress = string(dAtA[iNdEx:postIndex]) + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -3219,10 +3227,7 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ExpireTime == nil { - m.ExpireTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.ExpireTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpireTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3987,7 +3992,7 @@ func (m *StakingInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4015,11 +4020,11 @@ func (m *StakingInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4046,10 +4051,10 @@ func (m *StakingInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} + if m.Pubkey == nil { + m.Pubkey = &types.Any{} } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/types/registration.go b/x/register/types/registration.go index 45c68203..7ce45d52 100644 --- a/x/register/types/registration.go +++ b/x/register/types/registration.go @@ -6,7 +6,7 @@ import ( // nolint const ( - // TODO: Why can't we just have one string description which can be JSON by convention + // TODO: Why can't we just have one string description which can be JSON by convention MaxMonikerLength = 70 MaxIdentityLength = 3000 MaxWebsiteLength = 140 diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index ab92db12..e4534b08 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -7,15 +7,13 @@ import ( "strings" "time" - "github.com/stratosnet/stratos-chain/x/evm/types" - "gopkg.in/yaml.v2" - "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" + "github.com/stratosnet/stratos-chain/x/evm/types" ) type NodeType uint8 @@ -92,21 +90,21 @@ func NewResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, return ResourceNode{}, err } return ResourceNode{ - NetworkAddr: networkAddr.String(), - PubKey: pkAny, - Suspend: true, - Status: stakingtypes.Unbonded, - Tokens: sdk.ZeroInt(), - OwnerAddress: ownerAddr.String(), - Description: description, - NodeType: nodeType.Type(), - CreationTime: creationTime, + NetworkAddress: networkAddr.String(), + Pubkey: pkAny, + Suspend: true, + Status: stakingtypes.Unbonded, + Tokens: sdk.ZeroInt(), + OwnerAddress: ownerAddr.String(), + Description: description, + NodeType: nodeType.Type(), + CreationTime: creationTime, }, nil } // ConvertToString returns a human-readable string representation of a resource node. func (v ResourceNode) ConvertToString() string { - pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) + pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) if err != nil { return ErrUnknownPubKey.Error() } @@ -124,7 +122,7 @@ func (v ResourceNode) ConvertToString() string { NodeType: %s Description: %s CreationTime: %s - }`, v.GetNetworkAddr(), pubKey, v.GetSuspend(), v.GetStatus(), v.Tokens, + }`, v.GetNetworkAddress(), pubKey, v.GetSuspend(), v.GetStatus(), v.Tokens, v.GetOwnerAddress(), v.NodeType, v.GetDescription(), v.GetCreationTime()) } @@ -147,7 +145,7 @@ func (v ResourceNode) SubToken(amount sdk.Int) ResourceNode { } func (v ResourceNode) Validate() error { - netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddr()) + netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddress()) if err != nil { return err } @@ -155,7 +153,7 @@ func (v ResourceNode) Validate() error { if netAddr.Empty() { return ErrEmptyNodeNetworkAddress } - pkAny, err := codectypes.NewAnyWithValue(v.GetPubKey()) + pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) if err != nil { return err } @@ -236,13 +234,15 @@ func (v1 ResourceNode) Equal(v2 ResourceNode) bool { return bytes.Equal(bz1, bz2) } -func (s *Staking) GetNetworkAddress() stratos.SdsAddress { - networkAddr, err := stratos.SdsAddressFromBech32(s.NetworkAddress) - if err != nil { - panic(err) - } - return networkAddr -} +// GetOwnerAddr +//func (s *Staking) GetNetworkAddress() stratos.SdsAddress { +// networkAddr, err := stratos.SdsAddressFromBech32(s.NetworkAddress) +// if err != nil { +// panic(err) +// } +// return networkAddr +//} + func (s *Staking) GetOwnerAddr() sdk.AccAddress { addr, err := sdk.AccAddressFromBech32(s.OwnerAddress) if err != nil { @@ -253,10 +253,10 @@ func (s *Staking) GetOwnerAddr() sdk.AccAddress { func (s *Staking) GetShares() sdk.Dec { return s.Value } // String returns a human readable string representation of a node. -func (s *Staking) String() string { - out, _ := yaml.Marshal(s) - return string(out) -} +//func (s *Staking) String() string { +// out, _ := yaml.Marshal(s) +// return string(out) +//} // Stakings is a collection of Staking type Stakings []Staking diff --git a/x/register/types/tx.pb.go b/x/register/types/tx.pb.go index 2ca4a24c..5dff01d8 100644 --- a/x/register/types/tx.pb.go +++ b/x/register/types/tx.pb.go @@ -34,12 +34,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. type MsgCreateResourceNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` - Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` - OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` - NodeType string `protobuf:"bytes,6,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` + Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` + OwnerAddress string `protobuf:"bytes,4,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` + NodeType string `protobuf:"bytes,6,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *MsgCreateResourceNode) Reset() { *m = MsgCreateResourceNode{} } @@ -75,16 +75,16 @@ func (m *MsgCreateResourceNode) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateResourceNode proto.InternalMessageInfo -func (m *MsgCreateResourceNode) GetNetworkAddr() string { +func (m *MsgCreateResourceNode) GetNetworkAddress() string { if m != nil { - return m.NetworkAddr + return m.NetworkAddress } return "" } -func (m *MsgCreateResourceNode) GetPubKey() *types.Any { +func (m *MsgCreateResourceNode) GetPubkey() *types.Any { if m != nil { - return m.PubKey + return m.Pubkey } return nil } @@ -156,11 +156,11 @@ var xxx_messageInfo_MsgCreateResourceNodeResponse proto.InternalMessageInfo // MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. type MsgCreateIndexingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` - Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` - OwnerAddress string `protobuf:"bytes,4,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` + NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` + Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` + Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` + OwnerAddress string `protobuf:"bytes,4,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` } func (m *MsgCreateIndexingNode) Reset() { *m = MsgCreateIndexingNode{} } @@ -196,16 +196,16 @@ func (m *MsgCreateIndexingNode) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateIndexingNode proto.InternalMessageInfo -func (m *MsgCreateIndexingNode) GetNetworkAddr() string { +func (m *MsgCreateIndexingNode) GetNetworkAddress() string { if m != nil { - return m.NetworkAddr + return m.NetworkAddress } return "" } -func (m *MsgCreateIndexingNode) GetPubKey() *types.Any { +func (m *MsgCreateIndexingNode) GetPubkey() *types.Any { if m != nil { - return m.PubKey + return m.Pubkey } return nil } @@ -425,7 +425,7 @@ type MsgUpdateResourceNode struct { Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description" yaml:"description"` NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - NodeType string `protobuf:"bytes,4,opt,name=nodeType,proto3" json:"node_type" yaml:"node_type"` + NodeType string `protobuf:"bytes,4,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *MsgUpdateResourceNode) Reset() { *m = MsgUpdateResourceNode{} } @@ -579,8 +579,8 @@ var xxx_messageInfo_MsgUpdateIndexingNodeResponse proto.InternalMessageInfo type MsgUpdateResourceNodeStake struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incr_stake" yaml:"incr_stake"` - StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"stake_delta" yaml:"stake_delta"` + IncrStake bool `protobuf:"varint,3,opt,name=incr_stake,json=incrStake,proto3" json:"incr_stake" yaml:"incr_stake"` + StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=stake_delta,json=stakeDelta,proto3" json:"stake_delta" yaml:"stake_delta"` } func (m *MsgUpdateResourceNodeStake) Reset() { *m = MsgUpdateResourceNodeStake{} } @@ -657,8 +657,8 @@ var xxx_messageInfo_MsgUpdateResourceNodeStakeResponse proto.InternalMessageInfo type MsgUpdateIndexingNodeStake struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - IncrStake bool `protobuf:"varint,3,opt,name=incrStake,proto3" json:"incr_stake" yaml:"incr_stake"` - StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=StakeDelta,proto3" json:"stake_delta" yaml:"stake_delta"` + IncrStake bool `protobuf:"varint,3,opt,name=incr_stake,json=incrStake,proto3" json:"incr_stake" yaml:"incr_stake"` + StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=stake_delta,json=stakeDelta,proto3" json:"stake_delta" yaml:"stake_delta"` } func (m *MsgUpdateIndexingNodeStake) Reset() { *m = MsgUpdateIndexingNodeStake{} } @@ -836,86 +836,85 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/tx.proto", fileDescriptor_75d4b90d7a185a31) } var fileDescriptor_75d4b90d7a185a31 = []byte{ - // 1250 bytes of a gzipped FileDescriptorProto - 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x82, 0xe7, 0x83, 0x3c, 0x6a, 0x3b, 0x89, 0xe0, 0xe7, 0x80, 0x1c, 0x11, 0x3c, 0x03, 0xb2, - 0x64, 0x7c, 0x9e, 0x40, 0xf0, 0x7c, 0x90, 0x33, 0x06, 0xcc, 0x5c, 0x04, 0x4f, 0x43, 0x96, 0x10, - 0x7c, 0x74, 0x02, 0xd2, 0xf3, 0x63, 0xc9, 0x45, 0xf0, 0xf1, 0xd7, 0x7d, 0x2e, 0x82, 0xa7, 0x5f, - 0xb6, 0x9c, 0xe0, 0xbf, 0x28, 0xe0, 0x5a, 0x12, 0x47, 0xe6, 0xb4, 0xb0, 0x33, 0x0e, 0x5b, 0x96, - 0x57, 0xe9, 0xd6, 0x79, 0xbc, 0x92, 0xb0, 0x6e, 0xb1, 0xb0, 0xde, 0x46, 0x3b, 0xd2, 0xb0, 0xd2, - 0xf1, 0xb8, 0xc2, 0x26, 0xb5, 0xf0, 0x9e, 0xab, 0x1e, 0x3c, 0x39, 0x29, 0x2b, 0x4f, 0x4f, 0xca, - 0xca, 0x6f, 0x27, 0x65, 0xe5, 0xab, 0xd3, 0xf2, 0xd4, 0xd3, 0xd3, 0xf2, 0xd4, 0xcf, 0xa7, 0xe5, - 0xa9, 0x4f, 0x76, 0x9a, 0xb6, 0xff, 0xa0, 0x53, 0xd7, 0x1a, 0xa4, 0x15, 0xef, 0xec, 0x60, 0x3f, - 0xfe, 0xb9, 0xd5, 0x78, 0x60, 0xda, 0x8e, 0x7e, 0x3c, 0x38, 0x2c, 0x7c, 0x10, 0x7a, 0xf5, 0x59, - 0xf6, 0x67, 0xd7, 0x8d, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x13, 0x51, 0x52, 0xd0, 0x91, 0x16, - 0x00, 0x00, + // 1236 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0xe3, 0xc4, + 0x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bc, 0x3a, 0x41, 0x31, 0x81, 0xba, 0x76, 0xbe, 0x5b, 0x04, 0xd3, 0x07, 0x56, 0xb7, 0x72, + 0x5f, 0x02, 0x2f, 0xbe, 0xab, 0x19, 0x9d, 0x63, 0x2c, 0xfe, 0xaa, 0x7d, 0x4d, 0x78, 0xcd, 0x09, + 0x63, 0xab, 0x3b, 0xc5, 0x63, 0x43, 0x95, 0xd7, 0xbf, 0xf8, 0xf1, 0xf7, 0xaf, 0x4b, 0xaf, 0xa3, + 0x2d, 0x45, 0xf4, 0x71, 0xde, 0x66, 0x89, 0xcd, 0xd8, 0xd8, 0x1b, 0x87, 0x2c, 0x98, 0xb3, 0x33, + 0x21, 0xa7, 0x63, 0xb3, 0x21, 0xe7, 0x4c, 0xb8, 0xf9, 0x90, 0x4d, 0x96, 0x98, 0x07, 0x59, 0x30, + 0xf9, 0x65, 0x42, 0x4e, 0xc7, 0x66, 0x43, 0xce, 0x99, 0x6d, 0xf2, 0x21, 0x0f, 0x58, 0x62, 0x02, + 0xf2, 0xf7, 0x12, 0xd8, 0xcc, 0x81, 0xcc, 0x8f, 0x4d, 0xa5, 0x38, 0x16, 0x96, 0x50, 0xdd, 0x3b, + 0x67, 0x42, 0x58, 0xc1, 0x1e, 0xab, 0xa0, 0x8e, 0x94, 0xc2, 0x15, 0xf0, 0x53, 0x5e, 0x24, 0xf0, + 0xd8, 0x70, 0x37, 0x41, 0xe0, 0xd1, 0xd8, 0x49, 0x02, 0x17, 0x8e, 0x3f, 0x85, 0x04, 0x1e, 0xfb, + 0x6c, 0x11, 0x09, 0xbc, 0x18, 0xe4, 0x74, 0xec, 0x24, 0x81, 0x3f, 0x06, 0x64, 0x5f, 0xe0, 0x39, + 0x90, 0x05, 0x23, 0xf4, 0x04, 0x81, 0x17, 0x83, 0x9c, 0x33, 0x64, 0x16, 0x12, 0x78, 0x1c, 0xb2, + 0x40, 0xe0, 0xe9, 0x19, 0x48, 0x29, 0x8e, 0xa5, 0x90, 0xc0, 0xb3, 0xaf, 0xfb, 0x42, 0x02, 0x8f, + 0x7f, 0xde, 0x72, 0x81, 0xff, 0x2c, 0x81, 0xab, 0x61, 0x1d, 0xb9, 0xd3, 0xc2, 0x6e, 0x16, 0xb6, + 0xbc, 0xac, 0xea, 0xcd, 0xc7, 0xc9, 0x0a, 0xcb, 0xba, 0xc9, 0xca, 0x7a, 0x13, 0xed, 0x0a, 0xcb, + 0x8a, 0xd7, 0x63, 0x46, 0x1e, 0xd2, 0xf4, 0xee, 0xb9, 0xc6, 0xe1, 0xc3, 0xd3, 0x9a, 0xf4, 0xe8, + 0xb4, 0x26, 0xfd, 0x76, 0x5a, 0x93, 0xbe, 0x3a, 0xab, 0x4d, 0x3d, 0x3a, 0xab, 0x4d, 0xfd, 0x74, + 0x56, 0x9b, 0xfa, 0x74, 0xb7, 0xab, 0xdb, 0x77, 0x07, 0x2d, 0xb9, 0x4d, 0x7a, 0xc1, 0x93, 0x0d, + 0x6c, 0x07, 0x3f, 0xb7, 0xdb, 0x77, 0x35, 0xdd, 0x50, 0x4e, 0xc6, 0x9b, 0x79, 0x1f, 0x85, 0x56, + 0x6b, 0x96, 0xfd, 0xe5, 0x75, 0xfd, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xd5, 0xd8, 0x48, + 0xa7, 0x16, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1344,9 +1343,9 @@ func (m *MsgCreateResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x1a - if m.PubKey != nil { + if m.Pubkey != nil { { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1356,10 +1355,10 @@ func (m *MsgCreateResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.NetworkAddr) > 0 { - i -= len(m.NetworkAddr) - copy(dAtA[i:], m.NetworkAddr) - i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddr))) + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddress))) i-- dAtA[i] = 0xa } @@ -1438,9 +1437,9 @@ func (m *MsgCreateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x1a - if m.PubKey != nil { + if m.Pubkey != nil { { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1450,10 +1449,10 @@ func (m *MsgCreateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.NetworkAddr) > 0 { - i -= len(m.NetworkAddr) - copy(dAtA[i:], m.NetworkAddr) - i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddr))) + if len(m.NetworkAddress) > 0 { + i -= len(m.NetworkAddress) + copy(dAtA[i:], m.NetworkAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NetworkAddress))) i-- dAtA[i] = 0xa } @@ -2015,12 +2014,12 @@ func (m *MsgCreateResourceNode) Size() (n int) { } var l int _ = l - l = len(m.NetworkAddr) + l = len(m.NetworkAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.PubKey != nil { - l = m.PubKey.Size() + if m.Pubkey != nil { + l = m.Pubkey.Size() n += 1 + l + sovTx(uint64(l)) } l = m.Value.Size() @@ -2055,12 +2054,12 @@ func (m *MsgCreateIndexingNode) Size() (n int) { } var l int _ = l - l = len(m.NetworkAddr) + l = len(m.NetworkAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.PubKey != nil { - l = m.PubKey.Size() + if m.Pubkey != nil { + l = m.Pubkey.Size() n += 1 + l + sovTx(uint64(l)) } l = m.Value.Size() @@ -2337,7 +2336,7 @@ func (m *MsgCreateResourceNode) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2365,11 +2364,11 @@ func (m *MsgCreateResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2396,10 +2395,10 @@ func (m *MsgCreateResourceNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} + if m.Pubkey == nil { + m.Pubkey = &types.Any{} } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2638,7 +2637,7 @@ func (m *MsgCreateIndexingNode) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2666,11 +2665,11 @@ func (m *MsgCreateIndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkAddr = string(dAtA[iNdEx:postIndex]) + m.NetworkAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2697,10 +2696,10 @@ func (m *MsgCreateIndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &types.Any{} + if m.Pubkey == nil { + m.Pubkey = &types.Any{} } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/sds/types/genesis.pb.go b/x/sds/types/genesis.pb.go index d7d4b17b..c84d92d2 100644 --- a/x/sds/types/genesis.pb.go +++ b/x/sds/types/genesis.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the register module's genesis state. type GenesisState struct { Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - FileUploads []*FileUpload `protobuf:"bytes,2,rep,name=fileUploads,proto3" json:"file_uploads" yaml:"file_uploads"` + FileUploads []*FileUpload `protobuf:"bytes,2,rep,name=file_uploads,json=fileUploads,proto3" json:"file_uploads" yaml:"file_uploads"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -83,24 +83,24 @@ func init() { func init() { proto.RegisterFile("stratos/sds/v1/genesis.proto", fileDescriptor_a3396301dd7676d6) } var fileDescriptor_a3396301dd7676d6 = []byte{ - // 268 bytes of a gzipped FileDescriptorProto + // 271 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x2e, 0x29, 0x4a, 0x2c, 0xc9, 0x2f, 0xd6, 0x2f, 0x4e, 0x29, 0xd6, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0x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 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x88, 0xde, 0x54, 0x77, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/sds/types/sds.pb.go b/x/sds/types/sds.pb.go index 1942ce23..87aaeb94 100644 --- a/x/sds/types/sds.pb.go +++ b/x/sds/types/sds.pb.go @@ -70,8 +70,8 @@ func (m *Params) GetBondDenom() string { } type FileUpload struct { - FileHash string `protobuf:"bytes,1,opt,name=fileHash,proto3" json:"file_hash" yaml:"file_hash"` - FileInfo *FileInfo `protobuf:"bytes,2,opt,name=fileInfo,proto3" json:"file_info" yaml:"file_info"` + FileHash string `protobuf:"bytes,1,opt,name=file_hash,json=fileHash,proto3" json:"file_hash" yaml:"file_hash"` + FileInfo *FileInfo `protobuf:"bytes,2,opt,name=file_info,json=fileInfo,proto3" json:"file_info" yaml:"file_info"` } func (m *FileUpload) Reset() { *m = FileUpload{} } @@ -183,30 +183,30 @@ func init() { func init() { proto.RegisterFile("stratos/sds/v1/sds.proto", fileDescriptor_a89f3959b8649eb2) } var fileDescriptor_a89f3959b8649eb2 = []byte{ - // 360 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x51, 0x41, 0x4b, 0xf3, 0x40, - 0x10, 0xed, 0x7e, 0x1f, 0x94, 0x66, 0x05, 0xd1, 0xe0, 0x21, 0xf4, 0x90, 0xd4, 0x08, 0x52, 0x84, - 0x26, 0x54, 0x6f, 0x82, 0x97, 0x20, 0xc5, 0x82, 0x07, 0x09, 0x88, 0xe0, 0xa5, 0x6c, 0x9b, 0x6d, - 0x12, 0x4c, 0x32, 0x21, 0xbb, 0x2d, 0xf6, 0x0f, 0x78, 0xf6, 0x47, 0xf8, 0x63, 0x3c, 0xf6, 0x28, - 0x1e, 0x82, 0xb4, 0xb7, 0x1e, 0xfb, 0x0b, 0x64, 0x37, 0xdb, 0x5a, 0x3d, 0xed, 0xcc, 0x7b, 0xf3, - 0x1e, 0x6f, 0x76, 0xb0, 0xc1, 0x78, 0x41, 0x38, 0x30, 0x97, 0x05, 0xcc, 0x9d, 0x76, 0xc5, 0xe3, - 0xe4, 0x05, 0x70, 0xd0, 0xf7, 0x15, 0xe3, 0x08, 0x68, 0xda, 0x6d, 0x1e, 0x85, 0x10, 0x82, 0xa4, - 0x5c, 0x51, 0x55, 0x53, 0xf6, 0x2d, 0xae, 0xdf, 0x91, 0x82, 0xa4, 0x4c, 0xf7, 0x30, 0x1e, 0x42, - 0x16, 0x0c, 0x02, 0x9a, 0x41, 0x6a, 0xa0, 0x16, 0x6a, 0x6b, 0xde, 0xc9, 0xaa, 0xb4, 0x76, 0xd0, - 0x75, 0x69, 0x1d, 0xce, 0x48, 0x9a, 0x5c, 0xda, 0x3f, 0x98, 0xed, 0x6b, 0xa2, 0xb9, 0x96, 0xf5, - 0x1b, 0xc2, 0xb8, 0x17, 0x27, 0xf4, 0x3e, 0x4f, 0x80, 0x04, 0xfa, 0x15, 0x6e, 0x8c, 0xe3, 0x84, - 0xde, 0x10, 0x16, 0x29, 0xc3, 0xe3, 0x55, 0x69, 0x69, 0x02, 0x1b, 0x44, 0x84, 0x45, 0xeb, 0xd2, - 0x3a, 0xa8, 0xfc, 0xb6, 0x90, 0xed, 0x6f, 0x25, 0xfa, 0x43, 0x25, 0xef, 0x67, 0x63, 0x30, 0xfe, - 0xb5, 0x50, 0x7b, 0xef, 0xdc, 0x70, 0x7e, 0x2f, 0xe5, 0xf4, 0x14, 0xbf, 0x63, 0x1c, 0x67, 0x63, - 0xf8, 0x63, 0x2c, 0x20, 0x65, 0x2c, 0x86, 0xed, 0x17, 0x84, 0x1b, 0x1b, 0xa5, 0xee, 0xe1, 0x7a, - 0x44, 0xe3, 0x30, 0xe2, 0x2a, 0xe2, 0xd9, 0x67, 0x69, 0x9d, 0x86, 0x31, 0x8f, 0x26, 0x43, 0x67, - 0x04, 0xa9, 0x3b, 0x02, 0x96, 0x02, 0x53, 0x4f, 0x87, 0x05, 0x4f, 0x2e, 0x9f, 0xe5, 0x94, 0x39, - 0xfd, 0x8c, 0xfb, 0x4a, 0xa9, 0x37, 0x71, 0xa3, 0xa0, 0x39, 0x14, 0x9c, 0x16, 0x32, 0xa9, 0xe6, - 0x6f, 0x7b, 0xc1, 0x4d, 0xe4, 0x77, 0xd0, 0xc2, 0xf8, 0x5f, 0x71, 0x9b, 0xde, 0xeb, 0xbf, 0x2f, - 0x4c, 0x34, 0x5f, 0x98, 0xe8, 0x6b, 0x61, 0xa2, 0xd7, 0xa5, 0x59, 0x9b, 0x2f, 0xcd, 0xda, 0xc7, - 0xd2, 0xac, 0x3d, 0xba, 0x3b, 0x09, 0xd4, 0xce, 0x19, 0xe5, 0x9b, 0xb2, 0x33, 0x8a, 0x48, 0x9c, - 0xb9, 0xcf, 0xf2, 0xea, 0x32, 0xce, 0xb0, 0x2e, 0xef, 0x79, 0xf1, 0x1d, 0x00, 0x00, 0xff, 0xff, - 0x73, 0x0f, 0xd2, 0x63, 0x11, 0x02, 0x00, 0x00, + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x51, 0x4d, 0x4b, 0xeb, 0x40, + 0x14, 0xed, 0xbc, 0x07, 0xa5, 0x99, 0x07, 0x8f, 0xf7, 0x82, 0x8b, 0xd0, 0x45, 0x52, 0x23, 0x48, + 0x11, 0x9a, 0x50, 0xdd, 0xb9, 0x70, 0x11, 0x44, 0x2c, 0xb8, 0x90, 0x80, 0x20, 0x6e, 0xca, 0xb4, + 0x99, 0x26, 0xc1, 0x24, 0x37, 0xcc, 0x4c, 0x8b, 0xfd, 0x03, 0xae, 0xfd, 0x15, 0xfe, 0x16, 0x97, + 0x5d, 0x8a, 0x8b, 0x20, 0xed, 0xae, 0xcb, 0xfe, 0x02, 0x99, 0xe9, 0xf4, 0x43, 0x57,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, 0x42, 0xee, 0x0f, 0x81, 0xe7, 0xc0, 0xf5, 0xd3, 0xe1, 0xd1, 0xa3, 0x2f, + 0xa6, 0x25, 0xe5, 0x5e, 0xaf, 0x10, 0xa1, 0x9e, 0x34, 0x9b, 0xb8, 0xc1, 0x68, 0x09, 0x4c, 0x50, + 0xa6, 0x92, 0x1a, 0xe1, 0xb6, 0x96, 0xda, 0x58, 0xfd, 0x10, 0xca, 0xac, 0xdf, 0x6b, 0x6d, 0x53, + 0x07, 0xbd, 0xb7, 0xb9, 0x8d, 0x66, 0x73, 0x1b, 0x7d, 0xce, 0x6d, 0xf4, 0xb2, 0xb0, 0x6b, 0xb3, + 0x85, 0x5d, 0x7b, 0x5f, 0xd8, 0xb5, 0x07, 0x7f, 0x2f, 0x81, 0xde, 0xb9, 0xa0, 0x62, 0x03, 0x3b, + 0xc3, 0x84, 0xa4, 0x85, 0xff, 0xa4, 0xee, 0xae, 0xe2, 0x0c, 0xea, 0xea, 0xa2, 0x67, 0x5f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x8e, 0xcc, 0x78, 0xb5, 0x13, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/sds/types/tx.pb.go b/x/sds/types/tx.pb.go index dfe41463..bce93bc9 100644 --- a/x/sds/types/tx.pb.go +++ b/x/sds/types/tx.pb.go @@ -32,7 +32,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgFileUpload struct { - FileHash string `protobuf:"bytes,1,opt,name=fileHash,proto3" json:"file_hash" yaml:"file_hash"` + FileHash string `protobuf:"bytes,1,opt,name=file_hash,json=fileHash,proto3" json:"file_hash" yaml:"file_hash"` From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from" yaml:"from"` Reporter string `protobuf:"bytes,3,opt,name=reporter,proto3" json:"reporter" yaml:"reporter"` Uploader string `protobuf:"bytes,4,opt,name=uploader,proto3" json:"uploader" yaml:"uploader"` @@ -233,42 +233,41 @@ func init() { func init() { proto.RegisterFile("stratos/sds/v1/tx.proto", fileDescriptor_a5a216e2f9435b27) } var fileDescriptor_a5a216e2f9435b27 = []byte{ - // 545 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x41, 0x6f, 0xd3, 0x3c, - 0x18, 0x6e, 0xda, 0x7d, 0xd3, 0xea, 0x7d, 0x63, 0x90, 0x01, 0xcd, 0x3a, 0x16, 0x6f, 0x46, 0x48, - 0x95, 0xd0, 0x62, 0x75, 0xbb, 0x81, 0xb8, 0x14, 0x09, 0x6d, 0x87, 0x4a, 0x28, 0x12, 0x17, 0x2e, - 0xc8, 0x6d, 0xbd, 0x34, 0x22, 0x8d, 0xa3, 0xbc, 0x5e, 0xb5, 0x72, 0x42, 0xfc, 0x02, 0x24, 0xfe, - 0x05, 0xbf, 0x81, 0x1f, 0xb0, 0xe3, 0x24, 0x2e, 0x9c, 0x0c, 0x6a, 0x39, 0xf5, 0x58, 0x89, 0x03, - 0x37, 0x14, 0x3b, 0xc9, 0xe8, 0x04, 0x9c, 0x62, 0x3f, 0x8f, 0x9f, 0xe7, 0xb5, 0x9f, 0xf7, 0x0d, - 0x6a, 0x80, 0x4c, 0x99, 0x14, 0x40, 0x61, 0x00, 0x74, 0xdc, 0xa6, 0xf2, 0xdc, 0x4b, 0x52, 0x21, - 0x85, 0x7d, 0x23, 0x27, 0x3c, 0x18, 0x80, 0x37, 0x6e, 0x37, 0x6f, 0x07, 0x22, 0x10, 0x9a, 0xa2, - 0xd9, 0xca, 0x9c, 0x6a, 0xde, 0x0b, 0x84, 0x08, 0x22, 0x4e, 0x59, 0x12, 0x52, 0x16, 0xc7, 0x42, - 0x32, 0x19, 0x8a, 0x18, 0x72, 0xd6, 0xed, 0x0b, 0x18, 0x09, 0xa0, 0x3d, 0x06, 0x9c, 0x8e, 0xdb, - 0x3d, 0x2e, 0x59, 0x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, - 0x5f, 0xe6, 0xe8, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0xb5, 0xea, 0x41, 0xb1, 0x03, 0x00, - 0x00, + // 544 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x41, 0x6f, 0xd3, 0x30, + 0x18, 0x6d, 0xda, 0x31, 0xad, 0x1e, 0x63, 0x90, 0x01, 0xcd, 0x3a, 0x16, 0x6f, 0x46, 0x48, 0x95, + 0xd0, 0x62, 0x75, 0xbb, 0x81, 0xc4, 0xa1, 0x48, 0x68, 0x3b, 0x54, 0x42, 0x91, 0xb8, 0x70, 0x41, + 0x6e, 0xeb, 0xa5, 0x11, 0x69, 0x1c, 0xe5, 0xf3, 0xaa, 0x95, 0x13, 0xe2, 0x17, 0x20, 0xf1, 0x2f, + 0xf8, 0x0d, 0xfc, 0x80, 0x1d, 0x27, 0x71, 0xe1, 0x64, 0x50, 0xcb, 0xa9, 0xc7, 0x1e, 0x90, 0xb8, + 0xa1, 0xd8, 0x69, 0x4a, 0x27, 0xd8, 0x29, 0xf6, 0x7b, 0x7e, 0xef, 0xb3, 0xdf, 0xf7, 0x05, 0xd5, + 0x40, 0xa6, 0x4c, 0x0a, 0xa0, 0xd0, 0x03, 0x3a, 0x6c, 0x52, 0x79, 0xee, 0x25, 0xa9, 0x90, 0xc2, + 0xbe, 0x95, 0x13, 0x1e, 0xf4, 0xc0, 0x1b, 0x36, 0xeb, 0x77, 0x03, 0x11, 0x08, 0x4d, 0xd1, 0x6c, + 0x65, 0x4e, 0xd5, 0x1f, 0x04, 0x42, 0x04, 0x11, 0xa7, 0x2c, 0x09, 0x29, 0x8b, 0x63, 0x21, 0x99, + 0x0c, 0x45, 0x0c, 0x39, 0xeb, 0x76, 0x05, 0x0c, 0x04, 0xd0, 0x0e, 0x03, 0x4e, 0x87, 0xcd, 0x0e, + 0x97, 0xac, 0x49, 0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, 0xac, 0xea, 0x7f, + 0xe6, 0xe8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x52, 0x47, 0x08, 0xfe, 0xb2, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From b676d5cc4ab77085b9c93ca75e95eeb03ab652b1 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 24 May 2022 19:18:01 -0400 Subject: [PATCH 072/113] change BLSSignature --- proto/stratos/pot/v1/tx.proto | 2 +- x/pot/types/msg.go | 8 +- x/pot/types/tx.pb.go | 148 +++++++++++++++++----------------- 3 files changed, 79 insertions(+), 79 deletions(-) diff --git a/proto/stratos/pot/v1/tx.proto b/proto/stratos/pot/v1/tx.proto index 85ecde9b..0ae12220 100644 --- a/proto/stratos/pot/v1/tx.proto +++ b/proto/stratos/pot/v1/tx.proto @@ -51,7 +51,7 @@ message MsgVolumeReport { (gogoproto.jsontag) = "reporter_owner", (gogoproto.moretags) = "yaml:\"reporter_owner\"" ]; - BLSSignatureInfo bls_signature = 6 [ + BLSSignatureInfo BLS_signature = 6 [ (gogoproto.jsontag) = "bls_signature", (gogoproto.moretags) = "yaml:\"bls_signature\"" ]; diff --git a/x/pot/types/msg.go b/x/pot/types/msg.go index 8be71954..7a6f608d 100644 --- a/x/pot/types/msg.go +++ b/x/pot/types/msg.go @@ -43,7 +43,7 @@ func NewMsgVolumeReport( Epoch: &epoch, ReportReference: reportReference, ReporterOwner: reporterOwner.String(), - BlsSignature: &blsSignature, + BLSSignature: &blsSignature, } } @@ -115,13 +115,13 @@ func (msg MsgVolumeReport) ValidateBasic() error { } } - if len(msg.BlsSignature.Signature) == 0 { + if len(msg.BLSSignature.Signature) == 0 { return ErrBLSSignatureInvalid } - if len(msg.BlsSignature.TxData) == 0 { + if len(msg.BLSSignature.TxData) == 0 { return ErrBLSTxDataInvalid } - for _, pubKey := range msg.BlsSignature.PubKeys { + for _, pubKey := range msg.BLSSignature.PubKeys { if len(pubKey) == 0 { return ErrBLSPubkeysInvalid } diff --git a/x/pot/types/tx.pb.go b/x/pot/types/tx.pb.go index d3f3548a..c4aaeb4d 100644 --- a/x/pot/types/tx.pb.go +++ b/x/pot/types/tx.pb.go @@ -38,7 +38,7 @@ type MsgVolumeReport struct { Epoch *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=epoch,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"epoch" yaml:"epoch"` ReportReference string `protobuf:"bytes,4,opt,name=report_reference,json=reportReference,proto3" json:"report_reference" yaml:"report_reference"` ReporterOwner string `protobuf:"bytes,5,opt,name=reporter_owner,json=reporterOwner,proto3" json:"reporter_owner" yaml:"reporter_owner"` - BlsSignature *BLSSignatureInfo `protobuf:"bytes,6,opt,name=bls_signature,json=blsSignature,proto3" json:"bls_signature" yaml:"bls_signature"` + BLSSignature *BLSSignatureInfo `protobuf:"bytes,6,opt,name=BLS_signature,json=BLSSignature,proto3" json:"bls_signature" yaml:"bls_signature"` } func (m *MsgVolumeReport) Reset() { *m = MsgVolumeReport{} } @@ -102,9 +102,9 @@ func (m *MsgVolumeReport) GetReporterOwner() string { return "" } -func (m *MsgVolumeReport) GetBlsSignature() *BLSSignatureInfo { +func (m *MsgVolumeReport) GetBLSSignature() *BLSSignatureInfo { if m != nil { - return m.BlsSignature + return m.BLSSignature } return nil } @@ -463,69 +463,69 @@ func init() { func init() { proto.RegisterFile("stratos/pot/v1/tx.proto", fileDescriptor_103c258cace119ca) } var fileDescriptor_103c258cace119ca = []byte{ - // 977 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x6f, 0xe3, 0x44, - 0x14, 0xae, 0x9b, 0x6c, 0x69, 0xa7, 0x9b, 0x74, 0x31, 0x2d, 0xcd, 0x86, 0x6d, 0x26, 0x3b, 0x2c, - 0x4b, 0x60, 0xa9, 0xad, 0x96, 0x03, 0x12, 0x1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03, 0x62, 0x3f, 0x92, 0xf2, 0xf2, 0xaa, 0xf4, 0xd7, 0xe4, - 0xbf, 0x57, 0x6f, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x42, 0xbb, 0xef, 0xf7, 0x09, 0x00, - 0x00, + // 979 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xc6, 0x6e, 0x48, 0x26, 0xb5, 0x53, 0x96, 0x84, 0xb8, 0xa6, 0xf1, 0xb8, 0x43, 0x29, + 0x86, 0x92, 0x5d, 0x25, 0x1c, 0x90, 0xe0, 0x80, 0x70, 0x11, 0x22, 0xa2, 0x01, 0x69, 0x2d, 0xb5, + 0xa2, 0x17, 0x6b, 0xed, 0x9d, 0xac, 0x57, 0x5d, 0xcf, 0xac, 0x76, 0xc6, 0x76, 0x7b, 0xe1, 0xc0, + 0x89, 0x23, 0x12, 0x57, 0xfe, 0x00, 0xdc, 0xf9, 0x05, 0xbd, 0xf4, 0x58, 0x09, 0x0e, 0x88, 0xc3, + 0x80, 0x12, 0x4e, 0x7b, 0xdc, 0x23, 0x27, 0xe4, 0x99, 0xd9, 0xb5, 0xbd, 0x31, 0x10, 0x94, 0x43, + 0x4f, 0xf1, 0x7c, 0xdf, 0x7b, 0xdf, 0x7b, 0xfb, 0xf6, 0x9b, 0xb7, 0x01, 0xbb, 0x8c, 0xc7, 0x2e, + 0xa7, 0xcc, 0x8e, 0x28, 0xb7, 0xc7, 0x07, 0x36, 0x7f, 0x6c, 0x45, 0x31, 0xe5, 0xd4, 0xac, 0x6a, + 0xc2, 0x8a, 0x28, 0xb7, 0xc6, 0x07, 0xf5, 0x6d, 0x9f, 0xfa, 0x54, 0x52, 0xf6, 0xf4, 0x97, 0x8a, + 0xaa, 0xdf, 0xf0, 0x29, 0xf5, 0x43, 0x6c, 0xbb, 0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 0xf3, 0x21, 0xb8, 0xa6, 0xca, 0x74, 0x63, 0x7c, 0x82, 0x63, 0x4c, 0xfa, 0xb8, 0x56, 0x96, 0x55, + 0xec, 0x44, 0xc0, 0x73, 0x5c, 0x2a, 0xe0, 0xee, 0x7c, 0x9f, 0x33, 0x06, 0x39, 0x5b, 0x0a, 0x72, + 0x32, 0xc4, 0x74, 0x40, 0x35, 0x7b, 0x84, 0x2e, 0x9d, 0x10, 0x1c, 0xd7, 0xae, 0x48, 0x65, 0x39, + 0xc7, 0x45, 0x66, 0x36, 0xc7, 0x45, 0x1c, 0x39, 0x95, 0x0c, 0xf8, 0x62, 0x7a, 0x36, 0x23, 0x50, + 0x69, 0xdf, 0xeb, 0x74, 0x59, 0xe0, 0x13, 0x97, 0x8f, 0x62, 0x5c, 0x5b, 0x6b, 0x1a, 0xad, 0xcd, + 0xc3, 0x66, 0xf1, 0xf5, 0xb5, 0xef, 0x75, 0x3a, 0x59, 0xcc, 0x11, 0x39, 0xa1, 0xed, 0xb7, 0x12, + 0x01, 0x2b, 0xbd, 0x90, 0xcd, 0x52, 0x53, 0x01, 0xb7, 0x55, 0xcd, 0x05, 0x18, 0x39, 0x57, 0xe7, + 0x93, 0xd1, 0x75, 0xb0, 0x5b, 0x30, 0x91, 0x83, 0x59, 0x44, 0x09, 0xc3, 0xe8, 0xa7, 0x55, 0xb0, + 0x79, 0xcc, 0xfc, 0x07, 0x01, 0x1f, 0x78, 0xb1, 0x3b, 0x31, 0xbf, 0x02, 0x6b, 0xee, 0x90, 0x8e, + 0x08, 0xd7, 0xa6, 0xba, 0x6e, 0xa9, 0x77, 0x62, 0x4d, 0x1d, 0x6a, 0x69, 0x87, 0x5a, 0x77, 0x69, + 0x40, 0xda, 0x9f, 0x3d, 0x13, 0x70, 0x25, 0x11, 0x50, 0x27, 0xa4, 0x02, 0x56, 0x54, 0x2f, 0xea, + 0x8c, 0x7e, 0xfc, 0x1d, 0xb6, 0x2e, 0xf0, 0x8a, 0xa7, 0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a1, 0x97, 0xbd, 0x89, 0x65, 0x81, 0x75, 0xfb, 0x82, 0x81, 0x79, + 0x9f, 0x96, 0xec, 0xb3, 0x85, 0x6e, 0x17, 0xfb, 0xcc, 0x4c, 0xda, 0x8d, 0x75, 0x5a, 0x97, 0x50, + 0x0f, 0xb7, 0x8f, 0x9e, 0x9d, 0x36, 0x8c, 0xe7, 0xa7, 0x0d, 0xe3, 0x8f, 0xd3, 0x86, 0xf1, 0xed, + 0x59, 0x63, 0xe5, 0xf9, 0x59, 0x63, 0xe5, 0xd7, 0xb3, 0xc6, 0xca, 0x43, 0x7b, 0xee, 0x76, 0x68, + 0x2d, 0x82, 0x79, 0xf6, 0x73, 0xbf, 0x3f, 0x70, 0x03, 0x62, 0x3f, 0x96, 0xf2, 0xf2, 0xaa, 0xf4, + 0xd6, 0xe4, 0xbf, 0x57, 0xef, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x0f, 0x4a, 0x2d, 0xf7, + 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -736,9 +736,9 @@ func (m *MsgVolumeReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.BlsSignature != nil { + if m.BLSSignature != nil { { - size, err := m.BlsSignature.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BLSSignature.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1101,8 +1101,8 @@ func (m *MsgVolumeReport) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.BlsSignature != nil { - l = m.BlsSignature.Size() + if m.BLSSignature != nil { + l = m.BLSSignature.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -1425,7 +1425,7 @@ func (m *MsgVolumeReport) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlsSignature", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BLSSignature", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1452,10 +1452,10 @@ func (m *MsgVolumeReport) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.BlsSignature == nil { - m.BlsSignature = &BLSSignatureInfo{} + if m.BLSSignature == nil { + m.BLSSignature = &BLSSignatureInfo{} } - if err := m.BlsSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.BLSSignature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From e739ccfa537df788af577d92fb272770eabe3adc Mon Sep 17 00:00:00 2001 From: Xiong Date: Wed, 25 May 2022 09:24:26 -0400 Subject: [PATCH 073/113] update --- cmd/stchaind/gen_idx_nodes.go | 12 +- proto/stratos/register/v1/genesis.proto | 33 +++- proto/stratos/register/v1/register.proto | 10 +- types/address.go | 98 ++++------ types/bech32/legacybech32/pk.go | 137 +++++++------- x/register/client/cli/tx.go | 4 +- x/register/client/rest/tx.go | 4 +- x/register/keeper/msg_server.go | 4 +- x/register/types/genesis.go | 4 +- x/register/types/genesis.pb.go | 120 +++++++------ x/register/types/indexing_node.go | 2 +- x/register/types/register.pb.go | 220 +++++++++++------------ x/register/types/resource_node.go | 2 +- 13 files changed, 318 insertions(+), 332 deletions(-) diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index 9bac6c89..bfa322c5 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -109,19 +109,11 @@ func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc var appState map[string]json.RawMessage - if err := cdc.UnmarshalInterfaceJSON(genDoc.AppState, &appState); err != nil { - println("aaaaaaaaaaaaaaaaaaaaaaa") + if err := json.Unmarshal(genDoc.AppState, &appState); err != nil { return appGenIdxNodes, err } balanceMap := make(map[string]exported.GenesisBalance) - //addrMap := make(map[string]authtypes.AccountI) - //genAccIterator.IterateGenesisAccounts(cdc, appState, - // func(acc authtypes.AccountI) (stop bool) { - // addrMap[acc.GetAddress().String()] = acc - // return false - // }, - //) genBalanceIterator.IterateGenesisBalances(cdc, appState, func(balance exported.GenesisBalance) (stop bool) { @@ -143,7 +135,7 @@ func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc } var genIdxNode registertypes.GenesisIndexingNode - if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { + if err = json.Unmarshal(jsonRawIdxNode, &genIdxNode); err != nil { return appGenIdxNodes, err } diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto index 12858c06..cabc3bfd 100644 --- a/proto/stratos/register/v1/genesis.proto +++ b/proto/stratos/register/v1/genesis.proto @@ -32,18 +32,35 @@ message GenesisState { } message GenesisIndexingNode { - string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the indexing node + string networkAddr = 1 [ + (gogoproto.jsontag) = "network_address", + (gogoproto.moretags) = "yaml:\"network_address\"" + ]; // network address of the indexing node google.protobuf.Any pubKey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey", (gogoproto.moretags) = "yaml:\"pubkey\"" ]; // the consensus public key of the indexing node; bech encoded in JSON - bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; // has the indexing node been suspended from bonded status? - cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\""]; // indexing node status (Unspecified/Bonded/Unbonding/Unbonded) - string token = 5 [ + bool suspend = 3 [ + (gogoproto.jsontag) = "suspend", + (gogoproto.moretags) = "yaml:\"suspend\"" + ]; // has the indexing node been suspended from bonded status? + cosmos.staking.v1beta1.BondStatus status = 4 [ + (gogoproto.jsontag) = "status", + (gogoproto.moretags) = "yaml:\"status\"" + ]; // indexing node status (Unspecified/Bonded/Unbonding/Unbonded) + string tokens = 5 [ (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"token\"", + (gogoproto.jsontag) = "tokens", + (gogoproto.moretags) = "yaml:\"tokens\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" - ]; // delegated tokens - string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the indexing node - register.v1.Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; // description terms for the indexing node + ]; + string ownerAddress = 6 [ + (gogoproto.jsontag) = "owner_address", + (gogoproto.moretags) = "yaml:\"owner_address\"" + ]; // owner address of the indexing node + register.v1.Description description = 7 [ + (gogoproto.jsontag) = "description", + (gogoproto.moretags) = "yaml:\"description\",omitempty" + ]; // description terms for the indexing node } diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index fb964e43..3458b8ae 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -144,24 +144,24 @@ message Description { (gogoproto.jsontag) = "identity", (gogoproto.moretags) = "yaml:\"identity\",omitempty" ]; - string Website = 3 [ + string website = 3 [ (gogoproto.jsontag) = "website", (gogoproto.moretags) = "yaml:\"website\",omitempty" ]; - string SecurityContact = 4 [ + string securityContact = 4 [ (gogoproto.jsontag) = "security_contact", (gogoproto.moretags) = "yaml:\"security_contact\",omitempty" ]; - string Details = 5 [ + string details = 5 [ (gogoproto.jsontag) = "details", (gogoproto.moretags) = "yaml:\"details\",omitempty" ]; } message Slashing { - string WalletAddress = 1 [ + string walletAddress = 1 [ (gogoproto.jsontag) = "wallet_address", (gogoproto.moretags) = "yaml:\"wallet_address\"" ]; - int64 Value = 2 [ + int64 value = 2 [ (gogoproto.jsontag) = "value", (gogoproto.moretags) = "yaml:\"value\"" ]; diff --git a/types/address.go b/types/address.go index 3c0a38bd..dd46983d 100644 --- a/types/address.go +++ b/types/address.go @@ -8,29 +8,21 @@ import ( "fmt" "strings" + "github.com/cosmos/cosmos-sdk/codec/legacy" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" - - "github.com/cosmos/cosmos-sdk/codec/legacy" ) -// Bech32PubKeyType defines a string type alias for a Bech32 public key type. -type Bech32PubKeyType string - +// Bech32 conversion constants const ( StratosBech32Prefix = "st" // PrefixSds is the prefix for sds keys PrefixSds = "sds" - Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" - Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" - Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" - Bech32PubKeyTypeSdsP2PPub Bech32PubKeyType = "sdsp2p" - // AccountAddressPrefix defines the Bech32 prefix of an account's address (st) AccountAddressPrefix = StratosBech32Prefix // AccountPubKeyPrefix defines the Bech32 prefix of an account's public key (stpub) @@ -49,24 +41,14 @@ const ( SdsNodeP2PAddressPrefix = StratosBech32Prefix + PrefixSds ) -// GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with -// a given key type. -func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (cryptotypes.PubKey, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetConfig().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetConfig().GetBech32ValidatorPubPrefix() +var _ sdk.Address = SdsAddress{} +var _ yaml.Marshaler = SdsAddress{} - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetConfig().GetBech32ConsensusPubPrefix() +type SdsAddress []byte - case Bech32PubKeyTypeSdsP2PPub: - bech32Prefix = GetConfig().GetBech32SdsNodeP2PPubPrefix() - } +// SdsPubKeyFromBech32 returns a SdsPublicKey from a Bech32 string. +func SdsPubKeyFromBech32(pubkeyStr string) (cryptotypes.PubKey, error) { + bech32Prefix := GetConfig().GetBech32SdsNodeP2PPubPrefix() bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) if err != nil { @@ -81,20 +63,13 @@ func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (cryptotypes.Pu return pk, nil } -var _ sdk.Address = SdsAddress{} -var _ yaml.Marshaler = SdsAddress{} - -type SdsAddress []byte - -var _ sdk.Address = SdsAddress{} - // SdsAddressFromHex creates an SdsAddress from a hex string. func SdsAddressFromHex(address string) (addr SdsAddress, err error) { bz, err := addressBytesFromHexString(address) - return bz, err + return SdsAddress(bz), err } -// SdsAddressFromBech32 creates an SdsAddress from a Bech32 string. +// AccAddressFromBech32 creates an SdsAddress from a Bech32 string. func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { if len(strings.TrimSpace(address)) == 0 { return SdsAddress{}, errors.New("empty address string is not allowed") @@ -115,46 +90,45 @@ func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { return SdsAddress(bz), nil } -// Equals Returns boolean for whether two SdsAddress are Equal -func (a SdsAddress) Equals(addr sdk.Address) bool { - if a.Empty() && addr.Empty() { +// Returns boolean for whether two SdsAddress are Equal +func (aa SdsAddress) Equals(aa2 sdk.Address) bool { + if aa.Empty() && aa2.Empty() { return true } - return bytes.Equal(a.Bytes(), addr.Bytes()) + return bytes.Equal(aa.Bytes(), aa2.Bytes()) } -func (a SdsAddress) Empty() bool { - if a == nil || len(a) == 0 { - return true - } - - aa2 := SdsAddress{} - return bytes.Equal(a.Bytes(), aa2.Bytes()) -} - -func (a SdsAddress) Marshal() ([]byte, error) { - return a, nil +// Returns boolean for whether a SdsAddress is empty +func (aa SdsAddress) Empty() bool { + return aa == nil || len(aa) == 0 } -func (a SdsAddress) MarshalJSON() ([]byte, error) { - return json.Marshal(a.String()) +// Marshal returns the raw address bytes. It is needed for protobuf +// compatibility. +func (aa SdsAddress) Marshal() ([]byte, error) { + return aa, nil } // Unmarshal sets the address to the given data. It is needed for protobuf // compatibility. -func (a *SdsAddress) Unmarshal(data []byte) error { - *a = data +func (aa *SdsAddress) Unmarshal(data []byte) error { + *aa = data return nil } +// MarshalJSON marshals to JSON using Bech32. +func (aa SdsAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(aa.String()) +} + // MarshalYAML marshals to YAML using Bech32. -func (a SdsAddress) MarshalYAML() (interface{}, error) { - return a.String(), nil +func (aa SdsAddress) MarshalYAML() (interface{}, error) { + return aa.String(), nil } // UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (a *SdsAddress) UnmarshalJSON(data []byte) error { +func (aa *SdsAddress) UnmarshalJSON(data []byte) error { var s string err := json.Unmarshal(data, &s) @@ -162,7 +136,7 @@ func (a *SdsAddress) UnmarshalJSON(data []byte) error { return err } if s == "" { - *a = SdsAddress{} + *aa = SdsAddress{} return nil } @@ -171,19 +145,19 @@ func (a *SdsAddress) UnmarshalJSON(data []byte) error { return err } - *a = aa2 + *aa = aa2 return nil } // UnmarshalYAML unmarshals from JSON assuming Bech32 encoding. -func (a *SdsAddress) UnmarshalYAML(data []byte) error { +func (aa *SdsAddress) UnmarshalYAML(data []byte) error { var s string err := yaml.Unmarshal(data, &s) if err != nil { return err } if s == "" { - *a = SdsAddress{} + *aa = SdsAddress{} return nil } @@ -192,7 +166,7 @@ func (a *SdsAddress) UnmarshalYAML(data []byte) error { return err } - *a = aa2 + *aa = aa2 return nil } diff --git a/types/bech32/legacybech32/pk.go b/types/bech32/legacybech32/pk.go index 39bd0d9f..ed383029 100644 --- a/types/bech32/legacybech32/pk.go +++ b/types/bech32/legacybech32/pk.go @@ -2,71 +2,72 @@ // release. package legacybech32 -import ( - "github.com/cosmos/cosmos-sdk/codec/legacy" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/bech32" - - "github.com/stratosnet/stratos-chain/types" -) - -// TODO: when removing this package remove: -// + sdk:config.GetBech32AccountPubPrefix (and other related functions) -// + Bech32PrefixAccAddr and other related constants - -// Deprecated: Bech32PubKeyType defines a string type alias for a Bech32 public key type. -type Bech32PubKeyType string - -// Bech32 conversion constants -const ( - Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" - Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" - Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" - Bech32PubKeyTypeSdsP2PPub Bech32PubKeyType = "sdsp2p" -) - -// Deprecated: MarshalPubKey returns a Bech32 encoded string containing the appropriate -// prefix based on the key type provided for a given PublicKey. -func MarshalPubKey(pkt Bech32PubKeyType, pubkey cryptotypes.PubKey) (string, error) { - bech32Prefix := getPrefix(pkt) - return bech32.ConvertAndEncode(bech32Prefix, legacy.Cdc.MustMarshal(pubkey)) -} - -// Deprecated: MustMarshalPubKey calls MarshalPubKey and panics on error. -func MustMarshalPubKey(pkt Bech32PubKeyType, pubkey cryptotypes.PubKey) string { - res, err := MarshalPubKey(pkt, pubkey) - if err != nil { - panic(err) - } - - return res -} - -func getPrefix(pkt Bech32PubKeyType) string { - cfg := types.GetConfig() - switch pkt { - case Bech32PubKeyTypeAccPub: - return cfg.GetBech32AccountPubPrefix() - case Bech32PubKeyTypeValPub: - return cfg.GetBech32ValidatorPubPrefix() - case Bech32PubKeyTypeConsPub: - return cfg.GetBech32ConsensusPubPrefix() - case Bech32PubKeyTypeSdsP2PPub: - return cfg.GetBech32SdsNodeP2PPubPrefix() - } - - return "" -} - -// Deprecated: UnmarshalPubKey returns a PublicKey from a bech32-encoded PublicKey with -// a given key type. -func UnmarshalPubKey(pkt Bech32PubKeyType, pubkeyStr string) (cryptotypes.PubKey, error) { - bech32Prefix := getPrefix(pkt) - - bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) - if err != nil { - return nil, err - } - return legacy.PubKeyFromBytes(bz) -} +// +//import ( +// "github.com/cosmos/cosmos-sdk/codec/legacy" +// cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/types/bech32" +// +// "github.com/stratosnet/stratos-chain/types" +//) +// +//// TODO: when removing this package remove: +//// + sdk:config.GetBech32AccountPubPrefix (and other related functions) +//// + Bech32PrefixAccAddr and other related constants +// +//// Deprecated: Bech32PubKeyType defines a string type alias for a Bech32 public key type. +//type Bech32PubKeyType string +// +//// Bech32 conversion constants +//const ( +// Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" +// Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" +// Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" +// Bech32PubKeyTypeSdsP2PPub Bech32PubKeyType = "sdsp2p" +//) +// +//// Deprecated: MarshalPubKey returns a Bech32 encoded string containing the appropriate +//// prefix based on the key type provided for a given PublicKey. +//func MarshalPubKey(pkt Bech32PubKeyType, pubkey cryptotypes.PubKey) (string, error) { +// bech32Prefix := getPrefix(pkt) +// return bech32.ConvertAndEncode(bech32Prefix, legacy.Cdc.MustMarshal(pubkey)) +//} +// +//// Deprecated: MustMarshalPubKey calls MarshalPubKey and panics on error. +//func MustMarshalPubKey(pkt Bech32PubKeyType, pubkey cryptotypes.PubKey) string { +// res, err := MarshalPubKey(pkt, pubkey) +// if err != nil { +// panic(err) +// } +// +// return res +//} +// +//func getPrefix(pkt Bech32PubKeyType) string { +// cfg := types.GetConfig() +// switch pkt { +// case Bech32PubKeyTypeAccPub: +// return cfg.GetBech32AccountPubPrefix() +// case Bech32PubKeyTypeValPub: +// return cfg.GetBech32ValidatorPubPrefix() +// case Bech32PubKeyTypeConsPub: +// return cfg.GetBech32ConsensusPubPrefix() +// case Bech32PubKeyTypeSdsP2PPub: +// return cfg.GetBech32SdsNodeP2PPubPrefix() +// } +// +// return "" +//} +// +//// Deprecated: UnmarshalPubKey returns a PublicKey from a bech32-encoded PublicKey with +//// a given key type. +//func UnmarshalPubKey(pkt Bech32PubKeyType, pubkeyStr string) (cryptotypes.PubKey, error) { +// bech32Prefix := getPrefix(pkt) +// +// bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) +// if err != nil { +// return nil, err +// } +// return legacy.PubKeyFromBytes(bz) +//} diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index ea504de3..37ebae7b 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -346,7 +346,7 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs pkStr := viper.GetString(FlagPubKey) nodeTypeRef := viper.GetInt(FlagNodeType) - pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) + pubKey, er := stratos.SdsPubKeyFromBech32(pkStr) if er != nil { return txf, nil, err } @@ -387,7 +387,7 @@ func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs ownerAddr := clientCtx.GetFromAddress() pkStr := viper.GetString(FlagPubKey) - pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) + pubKey, er := stratos.SdsPubKeyFromBech32(pkStr) if er != nil { return txf, nil, err } diff --git a/x/register/client/rest/tx.go b/x/register/client/rest/tx.go index 4f0c3594..c02d16f5 100644 --- a/x/register/client/rest/tx.go +++ b/x/register/client/rest/tx.go @@ -131,7 +131,7 @@ func postCreateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, req.PubKey) + pubKey, err := stratos.SdsPubKeyFromBech32(req.PubKey) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -177,7 +177,7 @@ func postCreateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, req.PubKey) + pubKey, err := stratos.SdsPubKeyFromBech32(req.PubKey) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 96c530a8..4a06a977 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -29,7 +29,7 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types ctx := sdk.UnwrapSDKContext(goCtx) // check to see if the pubkey or sender has been registered before - pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.PubKey.String()) + pk, err := stratos.SdsPubKeyFromBech32(msg.PubKey.String()) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types.MsgCreateIndexingNode) (*types.MsgCreateIndexingNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // check to see if the pubkey or sender has been registered before - pk, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, msg.PubKey.String()) + pk, err := stratos.SdsPubKeyFromBech32(msg.PubKey.String()) if err != nil { return nil, err } diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 5542bed5..844bcbfe 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -70,7 +70,7 @@ func ValidateGenesis(data GenesisState) error { } func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { - _, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, v.PubKey.String()) + _, err := stratos.SdsPubKeyFromBech32(v.PubKey.String()) if err != nil { panic(err) } @@ -90,7 +90,7 @@ func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { PubKey: v.GetPubKey(), Suspend: v.GetSuspend(), Status: v.GetStatus(), - Tokens: v.Token, + Tokens: v.Tokens, OwnerAddress: ownerAddress.String(), Description: v.GetDescription(), } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go index 112c0d57..7623461f 100644 --- a/x/register/types/genesis.pb.go +++ b/x/register/types/genesis.pb.go @@ -99,13 +99,13 @@ func (m *GenesisState) GetSlashing() []*Slashing { } type GenesisIndexingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"networkAddr,omitempty" yaml:"network_address"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty" yaml:"pubkey"` - Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` - Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty" yaml:"status"` - Token github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=token,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token" yaml:"token"` - OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"ownerAddress,omitempty" yaml:"owner_address"` - Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` + NetworkAddr string `protobuf:"bytes,1,opt,name=networkAddr,proto3" json:"network_address" yaml:"network_address"` + PubKey *types.Any `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubkey" yaml:"pubkey"` + Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` + Status types1.BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status" yaml:"status"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens" yaml:"tokens"` + OwnerAddress string `protobuf:"bytes,6,opt,name=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` + Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description",omitempty` } func (m *GenesisIndexingNode) Reset() { *m = GenesisIndexingNode{} } @@ -191,53 +191,55 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } var fileDescriptor_5bdab54ebea9e48e = []byte{ - // 725 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4f, 0x4f, 0xdb, 0x3c, - 0x1c, 0xc7, 0xdb, 0x07, 0x28, 0x90, 0x02, 0x8f, 0x9e, 0xd0, 0x67, 0x0a, 0x6c, 0x6b, 0x3a, 0x6b, - 0x9a, 0x98, 0x04, 0x89, 0xca, 0x76, 0x9a, 0xd0, 0x24, 0x22, 0xb4, 0x89, 0x4d, 0x43, 0x55, 0x3a, - 0x34, 0x69, 0x97, 0xc8, 0x4d, 0x4c, 0xb0, 0xda, 0xda, 0x91, 0xed, 0x00, 0xe1, 0xb4, 0x97, 0xb0, - 0xf7, 0xb0, 0xb7, 0xb0, 0x17, 0x81, 0x76, 0xe2, 0x38, 0xed, 0x10, 0x4d, 0x70, 0xdf, 0xa1, 0xaf, - 0x60, 0xaa, 0xed, 0xd0, 0x30, 0x55, 0x93, 0x38, 0xd5, 0xee, 0xef, 0xeb, 0xcf, 0xd7, 0xfe, 0xfd, - 0x89, 0xf1, 0x88, 0x0b, 0x06, 0x05, 0xe5, 0x2e, 0x43, 0x31, 0xe6, 0x02, 0x31, 0xf7, 0xa4, 0xed, - 0xc6, 0x88, 0x20, 0x8e, 0xb9, 0x93, 0x30, 0x2a, 0xa8, 0xb9, 0xaa, 0x25, 0x4e, 0x21, 0x71, 0x4e, - 0xda, 0xeb, 0x6b, 0x31, 0xa5, 0xf1, 0x00, 0xb9, 0x52, 0xd2, 0x4b, 0x8f, 0x5c, 0x48, 0x32, 0xa5, - 0x5f, 0x6f, 0xc4, 0x34, 0xa6, 0x72, 0xe9, 0x8e, 0x57, 0xfa, 0xdf, 0xb5, 0x90, 0xf2, 0x21, 0xe5, - 0x81, 0x0a, 0xa8, 0x8d, 0x0e, 0x3d, 0x56, 0x3b, 0x97, 0x0b, 0xd8, 0xc7, 0x24, 0x76, 0x4f, 0xda, - 0x3d,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, - 0x6f, 0x54, 0x01, 0xe0, 0x17, 0x12, 0xf3, 0x9d, 0x51, 0xe3, 0x02, 0x8a, 0x94, 0xcb, 0x0e, 0x59, - 0xd9, 0x06, 0x8e, 0x86, 0x17, 0x83, 0xa9, 0x07, 0xd5, 0xf1, 0x28, 0x89, 0xba, 0x52, 0x59, 0x9e, - 0x21, 0x75, 0x16, 0xf8, 0x1a, 0x62, 0xbe, 0x37, 0xe6, 0x04, 0xed, 0x23, 0xa2, 0x8b, 0xfe, 0xf2, - 0xce, 0x45, 0x5f, 0x2a, 0x8a, 0xde, 0x47, 0x04, 0xf8, 0x0a, 0x66, 0xee, 0x18, 0x4b, 0xf4, 0x94, - 0x20, 0xb6, 0xab, 0x32, 0x69, 0xd5, 0x24, 0xbc, 0x54, 0x3b, 0x19, 0x9d, 0x24, 0xfa, 0x96, 0xda, - 0x8c, 0x8c, 0x7a, 0x84, 0x78, 0xc8, 0x70, 0x22, 0x30, 0x25, 0xd6, 0xbc, 0x4c, 0x77, 0x6b, 0x6a, - 0x5f, 0xec, 0x4d, 0x74, 0x5e, 0x6b, 0xd2, 0x82, 0xa5, 0xe3, 0x60, 0x93, 0x0e, 0xb1, 0x40, 0xc3, - 0x44, 0x64, 0x7e, 0x19, 0xeb, 0x1d, 0x5c, 0x5c, 0x35, 0xab, 0x97, 0x57, 0xcd, 0xea, 0xcf, 0xab, - 0x66, 0xf5, 0xf3, 0x75, 0xb3, 0x72, 0x79, 0xdd, 0xac, 0x7c, 0xbf, 0x6e, 0x56, 0x3e, 0x3e, 0x2f, - 0x3d, 0x5e, 0x9b, 0x12, 0x24, 0x8a, 0xe5, 0x56, 0x78, 0x0c, 0x31, 0x71, 0xcf, 0x26, 0x9f, 0x3c, - 0x99, 0x8e, 0x5e, 0x4d, 0xf6, 0xc1, 0xb3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xd8, 0x26, - 0x1f, 0xbd, 0x05, 0x00, 0x00, + // 760 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6b, 0xe3, 0x46, + 0x14, 0xb7, 0x9b, 0xc4, 0x49, 0xe4, 0xfc, 0xa1, 0x8a, 0x5b, 0x94, 0xa4, 0xb1, 0xdc, 0xa1, 0x94, + 0x14, 0x6a, 0x09, 0x27, 0x85, 0x42, 0x6f, 0x11, 0xa1, 0x25, 0x5d, 0x36, 0x6b, 0x64, 0xc2, 0xc2, + 0x5e, 0xc4, 0x58, 0x9a, 0x28, 0x83, 0xed, 0x19, 0xa1, 0x19, 0x25, 0x51, 0x4e, 0xcb, 0x7e, 0x82, + 0xfd, 0x30, 0xfb, 0x21, 0xc2, 0x9e, 0x72, 0x5c, 0xf6, 0x20, 0x96, 0xe4, 0xe6, 0xc3, 0x1e, 0xfc, + 0x09, 0x16, 0xcd, 0x8c, 0x62, 0x39, 0x98, 0x85, 0x9c, 0x3c, 0xef, 0xbd, 0xdf, 0xfb, 0xfd, 0x9e, + 0x66, 0x7e, 0xcf, 0xda, 0xaf, 0x8c, 0xc7, 0x90, 0x53, 0x66, 0xc7, 0x28, 0xc4, 0x8c, 0xa3, 0xd8, + 0xbe, 0xec, 0xd8, 0x21, 0x22, 0x88, 0x61, 0x66, 0x45, 0x31, 0xe5, 0x54, 0xdf, 0x52, 0x10, 0xab, + 0x80, 0x58, 0x97, 0x9d, 0x9d, 0xed, 0x90, 0xd2, 0x70, 0x88, 0x6c, 0x01, 0xe9, 0x27, 0xe7, 0x36, + 0x24, 0xa9, 0xc4, 0xef, 0x34, 0x42, 0x1a, 0x52, 0x71, 0xb4, 0xf3, 0x93, 0xca, 0x6e, 0xfb, 0x94, + 0x8d, 0x28, 0xf3, 0x64, 0x41, 0x06, 0xaa, 0xf4, 0x9b, 0x8c, 0x6c, 0xc6, 0xe1, 0x00, 0x93, 0xd0, + 0xbe, 0xec, 0xf4, 0x11, 0x87, 0x9d, 0x22, 0x56, 0x28, 0x30, 0x6f, 0xd2, 0xc7, 0x91, 0x04, 0x06, + 0x7c, 0x5d, 0xd4, 0xd6, 0xfe, 0x93, 0xc3, 0xf7, 0x38, 0xe4, 0x48, 0xff, 0x57, 0xab, 0x45, 0x30, + 0x86, 0x23, 0x66, 0x54, 0x5b, 0xd5, 0xfd, 0xfa, 0xc1, 0xae, 0x35, 0xe7, 0x63, 0xac, 0xae, 0x80, + 0x38, 0x3f, 0x4e, 0x32, 0x73, 0x3d, 0x85, 0xa3, 0xe1, 0x3f, 0x40, 0x36, 0x01, 0x57, 0x75, 0xeb, + 0xbe, 0xb6, 0x1e, 0x23, 0x46, 0x93, 0xd8, 0x47, 0xa7, 0x34, 0x40, 0xcc, 0xf8, 0x41, 0xd0, 0x81, + 0xb9, 0x74, 0x6e, 0x19, 0xe9, 0x6c, 0x4f, 0x32, 0xf3, 0x27, 0xc9, 0x5a, 0x50, 0x78, 0x24, 0xaf, + 0x00, 0x77, 0x96, 0x33, 0x17, 0xc1, 0x24, 0x40, 0xd7, 0x98, 0x84, 0x52, 0x64, 0xe1, 0x3b, 0x22, + 0x27, 0x65, 0x64, 0x59, 0xa4, 0xa0, 0x78, 0x14, 0x99, 0xe1, 0xd4, 0xb9, 0xb6, 0x89, 0x09, 0xe6, + 0x18, 0x0e, 0xcf, 0xe8, 0x4d, 0x37, 0xc6, 0x3e, 0x32, 0x16, 0x5b, 0xd5, 0xfd, 0x55, 0xe7, 0xff, + 0xdb, 0xcc, 0xac, 0x7c, 0xce, 0xcc, 0xdf, 0x43, 0xcc, 0x2f, 0x92, 0xbe, 0xe5, 0xd3, 0x91, 0x7a, + 0x26, 0xf5, 0xd3, 0x66, 0xc1, 0xc0, 0xe6, 0x69, 0x84, 0x98, 0x75, 0x8c, 0xfc, 0x49, 0x66, 0x1a, + 0x85, 0xa0, 0xa0, 0xf3, 0x12, 0x7a, 0xe3, 0x45, 0x39, 0x21, 0x70, 0x9f, 0x4a, 0xe8, 0x6f, 0xab, + 0xda, 0x16, 0xa7, 0x1c, 0x0e, 0xcf, 0x08, 0x66, 0x2c, 0x41, 0x41, 0x37, 0x46, 0x11, 0x4c, 0x8d, + 0x25, 0x21, 0x7d, 0xfa, 0x0c, 0xe9, 0x13, 0xc2, 0x27, 0x99, 0xf9, 0x8b, 0x94, 0x16, 0x94, 0x5e, + 0xa2, 0x38, 0xbd, 0x48, 0x90, 0x02, 0x77, 0x9e, 0x94, 0xde, 0xd3, 0x56, 0xd8, 0x10, 0xb2, 0x0b, + 0x4c, 0x42, 0xa3, 0xd6, 0x5a, 0xd8, 0xaf, 0x1f, 0xec, 0xcd, 0xbd, 0xd8, 0x9e, 0x02, 0x39, 0xc6, + 0x24, 0x33, 0x1b, 0x52, 0xa7, 0x68, 0xf4, 0x30, 0x39, 0xa7, 0xc0, 0x7d, 0x24, 0x02, 0xef, 0x96, + 0xb4, 0x2d, 0x65, 0xb8, 0xf2, 0x83, 0xe8, 0xaf, 0xb4, 0x3a, 0x41, 0xfc, 0x8a, 0xc6, 0x83, 0xa3, + 0x20, 0x88, 0x85, 0xf9, 0x56, 0x9d, 0xf6, 0x38, 0x33, 0x37, 0x55, 0xda, 0x83, 0x41, 0x10, 0x23, + 0xc6, 0x26, 0x99, 0xf9, 0xb3, 0xd4, 0x78, 0x52, 0x00, 0x6e, 0x99, 0x41, 0x87, 0x5a, 0x2d, 0x4a, + 0xfa, 0x2f, 0x50, 0xaa, 0x9c, 0xd7, 0xb0, 0xe4, 0x02, 0x5a, 0xc5, 0x02, 0x5a, 0x47, 0x24, 0x75, + 0x0e, 0xc7, 0x99, 0x99, 0xe3, 0x06, 0x28, 0x2d, 0x79, 0x59, 0xc4, 0xe0, 0xe3, 0x87, 0x76, 0x43, + 0xad, 0x9d, 0x1f, 0xa7, 0x11, 0xa7, 0x56, 0x57, 0x10, 0xba, 0x8a, 0x58, 0xff, 0x5b, 0x5b, 0x66, + 0x09, 0x8b, 0x10, 0x09, 0x84, 0xf1, 0x56, 0x9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xd8, 0xd7, + 0xd3, 0x7f, 0x54, 0x71, 0x75, 0xfd, 0x9a, 0xf0, 0xd4, 0xe1, 0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xf8, 0xce, 0xdb, 0x9a, 0x1c, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -373,9 +375,9 @@ func (m *GenesisIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x32 } { - size := m.Token.Size() + size := m.Tokens.Size() i -= size - if _, err := m.Token.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintGenesis(dAtA, i, uint64(size)) @@ -481,7 +483,7 @@ func (m *GenesisIndexingNode) Size() (n int) { if m.Status != 0 { n += 1 + sovGenesis(uint64(m.Status)) } - l = m.Token.Size() + l = m.Tokens.Size() n += 1 + l + sovGenesis(uint64(l)) l = len(m.OwnerAddress) if l > 0 { @@ -898,7 +900,7 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { } case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -926,7 +928,7 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index d26930a1..eb6a572e 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -78,7 +78,7 @@ func (v IndexingNode) ConvertToString() string { if err != nil { return ErrUnknownPubKey.Error() } - pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeAccPub, pkAny.String()) + pubKey, err := stratos.SdsPubKeyFromBech32(pkAny.String()) if err != nil { return ErrUnknownPubKey.Error() } diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 7d2ffe72..9823360a 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -366,9 +366,9 @@ func (m *IndexingNodeRegistrationVotePool) GetExpireTime() *time.Time { type Description struct { Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker" yaml:"moniker"` Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity" yaml:"identity",omitempty` - Website string `protobuf:"bytes,3,opt,name=Website,proto3" json:"website" yaml:"website",omitempty` - SecurityContact string `protobuf:"bytes,4,opt,name=SecurityContact,proto3" json:"security_contact" yaml:"security_contact",omitempty` - Details string `protobuf:"bytes,5,opt,name=Details,proto3" json:"details" yaml:"details",omitempty` + Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website" yaml:"website",omitempty` + SecurityContact string `protobuf:"bytes,4,opt,name=securityContact,proto3" json:"security_contact" yaml:"security_contact",omitempty` + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details" yaml:"details",omitempty` } func (m *Description) Reset() { *m = Description{} } @@ -440,8 +440,8 @@ func (m *Description) GetDetails() string { } type Slashing struct { - WalletAddress string `protobuf:"bytes,1,opt,name=WalletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` - Value int64 `protobuf:"varint,2,opt,name=Value,proto3" json:"value" yaml:"value"` + WalletAddress string `protobuf:"bytes,1,opt,name=walletAddress,proto3" json:"wallet_address" yaml:"wallet_address"` + Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value" yaml:"value"` } func (m *Slashing) Reset() { *m = Slashing{} } @@ -958,112 +958,112 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1678 bytes of a gzipped FileDescriptorProto + // 1667 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,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 0x05, 0x33, 0xf2, 0xcc, 0x7d, 0xf7, 0x45, 0x0c, 0x0b, 0xb2, - 0x4f, 0xb1, 0xd5, 0xd2, 0x3e, 0xc5, 0x46, 0x91, 0x57, 0xb1, 0x73, 0xfb, 0x1a, 0xac, 0x0c, 0x69, - 0x3b, 0x9b, 0xd6, 0x95, 0x59, 0xe6, 0x9e, 0x18, 0x73, 0x37, 0x54, 0x27, 0x31, 0x7c, 0x98, 0xbc, - 0x2a, 0x64, 0x25, 0xc8, 0xab, 0x0f, 0xa9, 0x6b, 0x95, 0x01, 0x47, 0x80, 0x65, 0x33, 0x69, 0xba, - 0xcf, 0xea, 0x2c, 0xc3, 0xdb, 0xc6, 0x70, 0x5e, 0x33, 0xad, 0x0c, 0x39, 0x01, 0xf2, 0x6a, 0xda, - 0xac, 0xd9, 0x2f, 0xfa, 0x75, 0x11, 0xd4, 0xa6, 0xf5, 0x48, 0x7d, 0x41, 0x1d, 0xde, 0x56, 0x7e, - 0x54, 0xd3, 0x67, 0x57, 0x99, 0xd4, 0x99, 0x36, 0x9a, 0x2b, 0x3c, 0x3f, 0x06, 0x2b, 0x84, 0xb7, - 0x33, 0x37, 0x83, 0x2a, 0x41, 0x8b, 0xea, 0x6d, 0xe4, 0x86, 0x2c, 0xf5, 0x56, 0x5e, 0x82, 0xbc, - 0x3a, 0xe1, 0x99, 0xef, 0xbc, 0x9f, 0x82, 0x72, 0xf2, 0xda, 0x52, 0x52, 0x97, 0xe4, 0x3b, 0xb7, - 0x26, 0x4b, 0x66, 0x6b, 0xfb, 0x54, 0x44, 0x23, 0x5d, 0x99, 0xd2, 0x27, 0x19, 0x53, 0x99, 0x92, - 0xe7, 0x18, 0x2f, 0x11, 0xa1, 0x3f, 0x95, 0x80, 0x73, 0x53, 0xdd, 0x39, 0x05, 0xcb, 0xd3, 0x70, - 0x3f, 0xc7, 0xa4, 0x7b, 0x2e, 0x94, 0x8b, 0x4a, 0xba, 0x42, 0xe7, 0x44, 0xe9, 0x39, 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+ 0x2f, 0x8a, 0x85, 0xfd, 0x77, 0x3b, 0x3a, 0x0d, 0x09, 0x6d, 0x5f, 0x66, 0x9f, 0xcb, 0xd5, 0x0e, + 0xba, 0x8b, 0x2a, 0x53, 0x1f, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x74, 0x33, 0x77, 0xe5, 0x4f, + 0x17, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 55fe38da..233c96de 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -110,7 +110,7 @@ func (v ResourceNode) ConvertToString() string { if err != nil { return ErrUnknownPubKey.Error() } - pubKey, err := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeAccPub, pkAny.String()) + pubKey, err := stratos.SdsPubKeyFromBech32(pkAny.String()) if err != nil { return ErrUnknownPubKey.Error() } From 549f9c29eb7c9af264e1e26b06434965b91b9aeb Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 25 May 2022 09:58:53 -0400 Subject: [PATCH 074/113] - qb-1165: update token life cycle logic of register module --- app/app.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/app.go b/app/app.go index d867903c..e8bba705 100644 --- a/app/app.go +++ b/app/app.go @@ -168,6 +168,7 @@ var ( pottypes.FoundationAccount: {authtypes.Minter, authtypes.Burner}, pottypes.MiningRewardPool: nil, pottypes.TrafficRewardPool: nil, + pottypes.TotalRewardPool: nil, //pottypes.TotalMinedTokens: {authtypes.Minter, authtypes.Burner}, sdstypes.ModuleName: nil, From 7613f553e7cfe426cb0acd2a819ea969e55b6e1a Mon Sep 17 00:00:00 2001 From: Xiong Date: Thu, 26 May 2022 15:38:28 -0400 Subject: [PATCH 075/113] update --- x/register/types/genesis.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index a49897f6..e5c0eaa3 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -30,6 +30,8 @@ func NewGenesisState(params *Params, func DefaultGenesisState() *GenesisState { return &GenesisState{ Params: DefaultParams(), + ResourceNodes: &ResourceNodes{}, + IndexingNodes: &IndexingNodes{}, InitialUozPrice: DefaultUozPrice, TotalUnissuedPrepay: DefaultTotalUnissuedPrepay, Slashing: make([]*Slashing, 0), From 9be86f70ac64b4c60d5105cbb156f7d1a04c4f05 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 27 May 2022 13:34:29 -0400 Subject: [PATCH 076/113] fixed add-genesis-indexing-node --- cmd/stchaind/gen_idx_nodes.go | 18 +++++++++++ cmd/stchaind/root.go | 2 ++ types/address.go | 35 +++++++++++++++++++- x/register/types/genesis.go | 53 ++++++++++++++++++++++++++++++- x/register/types/indexing_node.go | 39 +++++++++++++++++++---- x/register/types/resource_node.go | 6 ++++ 6 files changed, 144 insertions(+), 9 deletions(-) diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index b8145e02..f0208579 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -42,6 +42,7 @@ the address will be looked up in the local Keybase. `, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { + fmt.Printf("aaaaaaaaaaaaaa: %s", "appState\r\n") clientCtx := client.GetClientContextFromCmd(cmd) serverCtx := server.GetServerContextFromCmd(cmd) @@ -59,6 +60,8 @@ the address will be looked up in the local Keybase. return errors.Wrap(err, "failed to read genesis doc from file") } + fmt.Printf("bbbbbbbbbbbbb\r\n") + appIdxNodes, err := getIndexingNodeInfoFromFile(clientCtx.Codec, genIdxNodesDir, *genDoc, genBalancesIterator) if err != nil { return fmt.Errorf("failed to get indexing node from file: %w", err) @@ -70,11 +73,15 @@ the address will be looked up in the local Keybase. return fmt.Errorf("failed to unmarshal genesis state: %w", err) } + fmt.Printf("dddddddddddddddd: %s\r\n", appState) + registerGenState := registertypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) + fmt.Printf("********************: %v\r\n", registerGenState) if registerGenState.GetIndexingNodes() == nil { registerGenState.IndexingNodes = ®istertypes.IndexingNodes{} } for _, appIdxNode := range appIdxNodes { + fmt.Printf("eeeeeeeeeeeeee: %v\r\n", appIdxNode) registerGenState.IndexingNodes.IndexingNodes = append(registerGenState.IndexingNodes.IndexingNodes, &appIdxNode) } @@ -134,6 +141,7 @@ func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc if jsonRawIdxNode, err = ioutil.ReadFile(filename); err != nil { return appGenIdxNodes, err } + fmt.Printf("jsonRawIdxNodexxx: %s\r\n", jsonRawIdxNode) var genIdxNode registertypes.GenesisIndexingNode if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { @@ -142,21 +150,31 @@ func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc indexingNode := genIdxNode.ToIndexingNode() appGenIdxNodes = append(appGenIdxNodes, indexingNode) + fmt.Printf("kkkkkkkkkkkkkkkkkkkkkk\r\n") ownerAddrStr := indexingNode.GetOwnerAddress() ownerBalance, ok := balanceMap[ownerAddrStr] if !ok { return appGenIdxNodes, fmt.Errorf( "account %v not in genesis.json: %+v", ownerAddrStr, balanceMap) } + fmt.Printf("mmmmmmmmmmmmmmmmmmmmmmmmmm\r\n") if ownerBalance.GetCoins().AmountOf(defaultDemon).LT(indexingNode.Tokens) { return appGenIdxNodes, fmt.Errorf( "insufficient fund for delegation %v: %v < %v", ownerBalance.GetAddress(), ownerBalance.GetCoins().AmountOf(defaultDemon), indexingNode.Tokens, ) } + fmt.Printf("ssssssssssssssssssss: %v\r\n", appGenIdxNodes) fmt.Println("Add indexing node: " + indexingNode.GetNetworkAddress() + " success.") } + // print each indexing node + for _, appIdxNode := range appGenIdxNodes { + fmt.Printf("###############: %v\r\n", appIdxNode) + } + + fmt.Printf("4444444444444444\r\n") + return appGenIdxNodes, nil } diff --git a/cmd/stchaind/root.go b/cmd/stchaind/root.go index 871660bb..c8198790 100644 --- a/cmd/stchaind/root.go +++ b/cmd/stchaind/root.go @@ -90,6 +90,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { cfg := stratos.GetConfig() cfg.Seal() + //ccfg:= simapp.MakeTestEncodingConfig() + initRootCmd(rootCmd, encodingConfig) return rootCmd, encodingConfig diff --git a/types/address.go b/types/address.go index 4a3f838e..49e3c8fe 100644 --- a/types/address.go +++ b/types/address.go @@ -49,7 +49,9 @@ type SdsAddress []byte // SdsPubKeyFromBech32 returns a SdsPublicKey from a Bech32 string. func SdsPubKeyFromBech32(pubkeyStr string) (cryptotypes.PubKey, error) { bech32Prefix := GetConfig().GetBech32SdsNodeP2PPubPrefix() + fmt.Printf("ccccccccccc: %s\r\n", bech32Prefix) bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) + fmt.Printf("ddddddddddd: %s\r\n", bz) if err != nil { return nil, err } @@ -68,7 +70,7 @@ func SdsAddressFromHex(address string) (addr SdsAddress, err error) { return SdsAddress(bz), err } -// AccAddressFromBech32 creates an SdsAddress from a Bech32 string. +// SdsAddressFromBech32 creates an SdsAddress from a Bech32 string. func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { if len(strings.TrimSpace(address)) == 0 { return SdsAddress{}, errors.New("empty address string is not allowed") @@ -209,3 +211,34 @@ func addressBytesFromHexString(address string) ([]byte, error) { return hex.DecodeString(address) } + +// SdsAddressToBech32 creates an SdsAddress to a Bech32 string. +func SdsAddressToBech32(address SdsAddress) (addr string, err error) { + //if len(strings.TrimSpace(address)) == 0 { + // return SdsAddress{}, errors.New("empty address string is not allowed") + //} + + err = sdk.VerifyAddressFormat(address.Bytes()) + if err != nil { + return "", err + } + + bech32PrefixSdsAddr := GetConfig().GetBech32SdsNodeP2PAddrPrefix() + + addr, err = sdk.Bech32ifyAddressBytes(bech32PrefixSdsAddr, address) + if err != nil { + return "", err + } + + return +} + +// SdsPubkeyToBech32 creates an SdsPubkey to a Bech32 string. +func SdsPubkeyToBech32(pubkey cryptotypes.PubKey) (addr string, err error) { + bech32PrefixSdsPub := GetConfig().GetBech32SdsNodeP2PPubPrefix() + addr, err = bech32.ConvertAndEncode(bech32PrefixSdsPub, pubkey.Bytes()) + if err != nil { + return "", err + } + return +} diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index e5c0eaa3..ddbf143a 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -2,8 +2,11 @@ package types import ( "encoding/json" + "fmt" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" ) @@ -72,19 +75,46 @@ func ValidateGenesis(data GenesisState) error { } func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { + + //fmt.Printf("v.GetPubkey().Value: %v, \r\n", v.GetPubkey().Value) + //pubkey, ok := v.GetPubkey().GetCachedValue().(cryptotypes.PubKey) + // + //if !ok { + // fmt.Printf("pubkey: %v, \r\n", pubkey) + //} + + //stStr, err := stratos.SdsPubKeyFromBech32("stsdspub1zcjduepqzgqd566qdnj4kna050jz505vamjhglxcpdepqctkregdt6snxm6spxdk2l") + stPubkey, err := stratos.SdsPubKeyFromBech32("stsdspub1zcjduepqzgqd566qdnj4kna050jz505vamjhglxcpdepqctkregdt6snxm6spxdk2l") + //fmt.Printf("stPubkey: %v\r\n", stPubkey.Bytes()) + + //stStr, err := stratos.SdsPubkeyToBech32(pubkey) + any, err := codectypes.NewAnyWithValue(stPubkey) + fmt.Printf("any: %v, \r\n", any.Value) + if err != nil { + panic(err) + } + + //fmt.Printf("stStr: %s\r\n", stStr) + //fmt.Printf("pubkey.String(): %v\r\n", pubkey.Bytes()) + //if err != nil { + // panic(err) + //} + ownerAddress, err := sdk.AccAddressFromBech32(v.OwnerAddress) if err != nil { panic(err) } + fmt.Printf("GetNetworkAddress: %s\r\n", v.GetNetworkAddress()) netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddress()) + fmt.Printf("netAddr: %s\r\n", netAddr) if err != nil { panic(err) } return IndexingNode{ NetworkAddress: netAddr.String(), - Pubkey: v.GetPubkey(), + Pubkey: any, Suspend: v.GetSuspend(), Status: v.GetStatus(), Tokens: v.Tokens, @@ -99,3 +129,24 @@ func NewSlashing(walletAddress sdk.AccAddress, value sdk.Int) *Slashing { Value: value.Int64(), } } + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (g GenesisState) UnpackInterfaces(c codectypes.AnyUnpacker) error { + for i := range g.IndexingNodes.IndexingNodes { + if err := g.IndexingNodes.IndexingNodes[i].UnpackInterfaces(c); err != nil { + return err + } + } + for i := range g.ResourceNodes.ResourceNodes { + if err := g.ResourceNodes.ResourceNodes[i].UnpackInterfaces(c); err != nil { + return err + } + } + return nil +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (g GenesisIndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(g.Pubkey, &pk) +} diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index 69e9d213..0448362b 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -122,14 +122,33 @@ func (v IndexingNode) Validate() error { if netAddr.Empty() { return ErrEmptyNodeNetworkAddress } - pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) - if err != nil { - return err - } - sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) - if err != nil { - return err + //pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) + //if err != nil { + // return err + //} + pkAny := v.GetPubkey() + fmt.Printf("pkAny: %v, \r\n", pkAny) + + //var pkI cryptotypes.PubKey + //err = codec.LegacyAmino.UnpackAny(pkAny, &pkI) + //fmt.Printf("pkI: %v, \r\n", pkI) + //fmt.Printf("err: %v, \r\n", err.Error()) + pubkey, ok := pkAny.GetCachedValue().(cryptotypes.PubKey) + if !ok { + fmt.Printf("pubkey: %v, \r\n", pubkey) } + + //pubkey.Address() + //var aa cryptotypes.PubKey + //if err := ptypes.UnmarshalAny(pkAny, &aa); err != nil { + //} + //sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) + sdsAddr := stratos.SdsAddress(pubkey.Address()) + //if err != nil { + // return err + //} + + fmt.Printf("v.GetPubkey(): %v\r\n pkAny: %v\r\n pubkey: %v\r\nnetAddr: %v\r\nsdsAddr: %v\r\n", v.GetPubkey(), pkAny, pubkey, netAddr, sdsAddr) if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } @@ -262,3 +281,9 @@ func (v1 IndexingNode) Equal(v2 IndexingNode) bool { bz2 := ModuleCdc.MustMarshalLengthPrefixed(&v2) return bytes.Equal(bz1, bz2) } + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (v IndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(v.Pubkey, &pk) +} diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 583d3e90..48183eaf 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -274,3 +274,9 @@ func UnmarshalStaking(cdc codec.BinaryCodec, value []byte) (staking Staking, err err = cdc.Unmarshal(value, &staking) return staking, err } + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (v ResourceNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(v.Pubkey, &pk) +} From 9f237db84a2aa3f5eb439ea292b2dbd54e877f01 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 30 May 2022 12:35:00 -0400 Subject: [PATCH 077/113] completed genesis related issues, starting module testing --- cmd/stchaind/gen_idx_nodes.go | 27 ++++++------------- types/address.go | 37 ++----------------------- x/register/types/genesis.go | 45 ++++--------------------------- x/register/types/indexing_node.go | 20 +------------- 4 files changed, 16 insertions(+), 113 deletions(-) diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index f0208579..c38fe40a 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -42,7 +42,6 @@ the address will be looked up in the local Keybase. `, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { - fmt.Printf("aaaaaaaaaaaaaa: %s", "appState\r\n") clientCtx := client.GetClientContextFromCmd(cmd) serverCtx := server.GetServerContextFromCmd(cmd) @@ -60,8 +59,6 @@ the address will be looked up in the local Keybase. return errors.Wrap(err, "failed to read genesis doc from file") } - fmt.Printf("bbbbbbbbbbbbb\r\n") - appIdxNodes, err := getIndexingNodeInfoFromFile(clientCtx.Codec, genIdxNodesDir, *genDoc, genBalancesIterator) if err != nil { return fmt.Errorf("failed to get indexing node from file: %w", err) @@ -73,15 +70,12 @@ the address will be looked up in the local Keybase. return fmt.Errorf("failed to unmarshal genesis state: %w", err) } - fmt.Printf("dddddddddddddddd: %s\r\n", appState) - registerGenState := registertypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - fmt.Printf("********************: %v\r\n", registerGenState) if registerGenState.GetIndexingNodes() == nil { registerGenState.IndexingNodes = ®istertypes.IndexingNodes{} } + for _, appIdxNode := range appIdxNodes { - fmt.Printf("eeeeeeeeeeeeee: %v\r\n", appIdxNode) registerGenState.IndexingNodes.IndexingNodes = append(registerGenState.IndexingNodes.IndexingNodes, &appIdxNode) } @@ -141,40 +135,35 @@ func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc if jsonRawIdxNode, err = ioutil.ReadFile(filename); err != nil { return appGenIdxNodes, err } - fmt.Printf("jsonRawIdxNodexxx: %s\r\n", jsonRawIdxNode) var genIdxNode registertypes.GenesisIndexingNode if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { return appGenIdxNodes, err } - indexingNode := genIdxNode.ToIndexingNode() + indexingNode, err := genIdxNode.ToIndexingNode() + if err != nil { + return appGenIdxNodes, err + } + appGenIdxNodes = append(appGenIdxNodes, indexingNode) - fmt.Printf("kkkkkkkkkkkkkkkkkkkkkk\r\n") + ownerAddrStr := indexingNode.GetOwnerAddress() ownerBalance, ok := balanceMap[ownerAddrStr] if !ok { return appGenIdxNodes, fmt.Errorf( "account %v not in genesis.json: %+v", ownerAddrStr, balanceMap) } - fmt.Printf("mmmmmmmmmmmmmmmmmmmmmmmmmm\r\n") + if ownerBalance.GetCoins().AmountOf(defaultDemon).LT(indexingNode.Tokens) { return appGenIdxNodes, fmt.Errorf( "insufficient fund for delegation %v: %v < %v", ownerBalance.GetAddress(), ownerBalance.GetCoins().AmountOf(defaultDemon), indexingNode.Tokens, ) } - fmt.Printf("ssssssssssssssssssss: %v\r\n", appGenIdxNodes) fmt.Println("Add indexing node: " + indexingNode.GetNetworkAddress() + " success.") } - // print each indexing node - for _, appIdxNode := range appGenIdxNodes { - fmt.Printf("###############: %v\r\n", appIdxNode) - } - - fmt.Printf("4444444444444444\r\n") - return appGenIdxNodes, nil } diff --git a/types/address.go b/types/address.go index 49e3c8fe..5b1ec6e6 100644 --- a/types/address.go +++ b/types/address.go @@ -49,9 +49,7 @@ type SdsAddress []byte // SdsPubKeyFromBech32 returns a SdsPublicKey from a Bech32 string. func SdsPubKeyFromBech32(pubkeyStr string) (cryptotypes.PubKey, error) { bech32Prefix := GetConfig().GetBech32SdsNodeP2PPubPrefix() - fmt.Printf("ccccccccccc: %s\r\n", bech32Prefix) bz, err := sdk.GetFromBech32(pubkeyStr, bech32Prefix) - fmt.Printf("ddddddddddd: %s\r\n", bz) if err != nil { return nil, err } @@ -91,7 +89,7 @@ func SdsAddressFromBech32(address string) (addr SdsAddress, err error) { return SdsAddress(bz), nil } -// Returns boolean for whether two SdsAddress are Equal +// Equals Returns boolean for whether two SdsAddress are Equal func (aa SdsAddress) Equals(aa2 sdk.Address) bool { if aa.Empty() && aa2.Empty() { return true @@ -100,7 +98,7 @@ func (aa SdsAddress) Equals(aa2 sdk.Address) bool { return bytes.Equal(aa.Bytes(), aa2.Bytes()) } -// Returns boolean for whether a SdsAddress is empty +// Empty Returns boolean for whether a SdsAddress is empty func (aa SdsAddress) Empty() bool { return aa == nil || len(aa) == 0 } @@ -211,34 +209,3 @@ func addressBytesFromHexString(address string) ([]byte, error) { return hex.DecodeString(address) } - -// SdsAddressToBech32 creates an SdsAddress to a Bech32 string. -func SdsAddressToBech32(address SdsAddress) (addr string, err error) { - //if len(strings.TrimSpace(address)) == 0 { - // return SdsAddress{}, errors.New("empty address string is not allowed") - //} - - err = sdk.VerifyAddressFormat(address.Bytes()) - if err != nil { - return "", err - } - - bech32PrefixSdsAddr := GetConfig().GetBech32SdsNodeP2PAddrPrefix() - - addr, err = sdk.Bech32ifyAddressBytes(bech32PrefixSdsAddr, address) - if err != nil { - return "", err - } - - return -} - -// SdsPubkeyToBech32 creates an SdsPubkey to a Bech32 string. -func SdsPubkeyToBech32(pubkey cryptotypes.PubKey) (addr string, err error) { - bech32PrefixSdsPub := GetConfig().GetBech32SdsNodeP2PPubPrefix() - addr, err = bech32.ConvertAndEncode(bech32PrefixSdsPub, pubkey.Bytes()) - if err != nil { - return "", err - } - return -} diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index ddbf143a..ce784b90 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -2,11 +2,9 @@ package types import ( "encoding/json" - "fmt" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" ) @@ -74,53 +72,26 @@ func ValidateGenesis(data GenesisState) error { return nil } -func (v GenesisIndexingNode) ToIndexingNode() IndexingNode { - - //fmt.Printf("v.GetPubkey().Value: %v, \r\n", v.GetPubkey().Value) - //pubkey, ok := v.GetPubkey().GetCachedValue().(cryptotypes.PubKey) - // - //if !ok { - // fmt.Printf("pubkey: %v, \r\n", pubkey) - //} - - //stStr, err := stratos.SdsPubKeyFromBech32("stsdspub1zcjduepqzgqd566qdnj4kna050jz505vamjhglxcpdepqctkregdt6snxm6spxdk2l") - stPubkey, err := stratos.SdsPubKeyFromBech32("stsdspub1zcjduepqzgqd566qdnj4kna050jz505vamjhglxcpdepqctkregdt6snxm6spxdk2l") - //fmt.Printf("stPubkey: %v\r\n", stPubkey.Bytes()) - - //stStr, err := stratos.SdsPubkeyToBech32(pubkey) - any, err := codectypes.NewAnyWithValue(stPubkey) - fmt.Printf("any: %v, \r\n", any.Value) - if err != nil { - panic(err) - } - - //fmt.Printf("stStr: %s\r\n", stStr) - //fmt.Printf("pubkey.String(): %v\r\n", pubkey.Bytes()) - //if err != nil { - // panic(err) - //} - +func (v GenesisIndexingNode) ToIndexingNode() (IndexingNode, error) { ownerAddress, err := sdk.AccAddressFromBech32(v.OwnerAddress) if err != nil { - panic(err) + return IndexingNode{}, ErrInvalidOwnerAddr } - fmt.Printf("GetNetworkAddress: %s\r\n", v.GetNetworkAddress()) netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddress()) - fmt.Printf("netAddr: %s\r\n", netAddr) if err != nil { - panic(err) + return IndexingNode{}, ErrInvalidNetworkAddr } return IndexingNode{ NetworkAddress: netAddr.String(), - Pubkey: any, + Pubkey: v.GetPubkey(), Suspend: v.GetSuspend(), Status: v.GetStatus(), Tokens: v.Tokens, OwnerAddress: ownerAddress.String(), Description: v.GetDescription(), - } + }, nil } func NewSlashing(walletAddress sdk.AccAddress, value sdk.Int) *Slashing { @@ -144,9 +115,3 @@ func (g GenesisState) UnpackInterfaces(c codectypes.AnyUnpacker) error { } return nil } - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (g GenesisIndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - var pk cryptotypes.PubKey - return unpacker.UnpackAny(g.Pubkey, &pk) -} diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index 0448362b..ff9facc6 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -122,33 +122,15 @@ func (v IndexingNode) Validate() error { if netAddr.Empty() { return ErrEmptyNodeNetworkAddress } - //pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) - //if err != nil { - // return err - //} pkAny := v.GetPubkey() - fmt.Printf("pkAny: %v, \r\n", pkAny) - //var pkI cryptotypes.PubKey - //err = codec.LegacyAmino.UnpackAny(pkAny, &pkI) - //fmt.Printf("pkI: %v, \r\n", pkI) - //fmt.Printf("err: %v, \r\n", err.Error()) pubkey, ok := pkAny.GetCachedValue().(cryptotypes.PubKey) if !ok { - fmt.Printf("pubkey: %v, \r\n", pubkey) + return ErrUnknownPubKey } - //pubkey.Address() - //var aa cryptotypes.PubKey - //if err := ptypes.UnmarshalAny(pkAny, &aa); err != nil { - //} - //sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) sdsAddr := stratos.SdsAddress(pubkey.Address()) - //if err != nil { - // return err - //} - fmt.Printf("v.GetPubkey(): %v\r\n pkAny: %v\r\n pubkey: %v\r\nnetAddr: %v\r\nsdsAddr: %v\r\n", v.GetPubkey(), pkAny, pubkey, netAddr, sdsAddr) if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } From 6b13cea0341e6efc04872c7d62cb9bee6a12fdd0 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 30 May 2022 14:26:03 -0400 Subject: [PATCH 078/113] completed genesis related issues, starting module testing --- cmd/stchaind/gen_idx_nodes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index c38fe40a..0fb1896b 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -75,8 +75,8 @@ the address will be looked up in the local Keybase. registerGenState.IndexingNodes = ®istertypes.IndexingNodes{} } - for _, appIdxNode := range appIdxNodes { - registerGenState.IndexingNodes.IndexingNodes = append(registerGenState.IndexingNodes.IndexingNodes, &appIdxNode) + for i, _ := range appIdxNodes { + registerGenState.IndexingNodes.IndexingNodes = append(registerGenState.IndexingNodes.IndexingNodes, &appIdxNodes[i]) } registerGenStateBz, err := clientCtx.Codec.MarshalJSON(®isterGenState) From 226147c128b0e5d89d2d32cacf04a600a2147110 Mon Sep 17 00:00:00 2001 From: Xiong Date: Mon, 30 May 2022 17:14:47 -0400 Subject: [PATCH 079/113] remove alias --- app/app.go | 8 +++--- x/pot/alias.go | 26 ------------------- x/pot/genesis.go | 5 ++-- x/register/alias.go | 62 --------------------------------------------- x/sds/alias.go | 23 ----------------- x/sds/genesis.go | 2 +- 6 files changed, 8 insertions(+), 118 deletions(-) delete mode 100644 x/pot/alias.go delete mode 100644 x/register/alias.go delete mode 100644 x/sds/alias.go diff --git a/app/app.go b/app/app.go index e8bba705..63c4f191 100644 --- a/app/app.go +++ b/app/app.go @@ -9,9 +9,6 @@ import ( "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" - "github.com/stratosnet/stratos-chain/x/pot" - "github.com/stratosnet/stratos-chain/x/register" - "github.com/stratosnet/stratos-chain/x/sds" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" @@ -101,10 +98,13 @@ import ( evmrest "github.com/stratosnet/stratos-chain/x/evm/client/rest" evmkeeper "github.com/stratosnet/stratos-chain/x/evm/keeper" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" + "github.com/stratosnet/stratos-chain/x/pot" potkeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" pottypes "github.com/stratosnet/stratos-chain/x/pot/types" + "github.com/stratosnet/stratos-chain/x/register" registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" registertypes "github.com/stratosnet/stratos-chain/x/register/types" + "github.com/stratosnet/stratos-chain/x/sds" sdskeeper "github.com/stratosnet/stratos-chain/x/sds/keeper" sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" ) @@ -406,7 +406,7 @@ func NewInitApp( app.potKeeper = potkeeper.NewKeeper( appCodec, - keys[pot.StoreKey], + keys[pottypes.StoreKey], app.GetSubspace(pottypes.ModuleName), authtypes.FeeCollectorName, app.bankKeeper, diff --git a/x/pot/alias.go b/x/pot/alias.go deleted file mode 100644 index cde42207..00000000 --- a/x/pot/alias.go +++ /dev/null @@ -1,26 +0,0 @@ -package pot - -import ( - "github.com/stratosnet/stratos-chain/x/pot/keeper" - "github.com/stratosnet/stratos-chain/x/pot/types" -) - -const ( - DefaultParamSpace = types.DefaultParamSpace - ModuleName = types.ModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey - FoundationAccount = types.FoundationAccount -) - -var ( - NewKeeper = keeper.NewKeeper - RegisterCodec = types.RegisterLegacyAminoCodec - ParamKeyTable = types.ParamKeyTable - NewGenesisState = types.NewGenesisState - NewMsgFoundationDeposit = types.NewMsgFoundationDeposit -) - -type ( - Keeper = keeper.Keeper -) diff --git a/x/pot/genesis.go b/x/pot/genesis.go index 3db0add6..556b6a19 100644 --- a/x/pot/genesis.go +++ b/x/pot/genesis.go @@ -2,12 +2,13 @@ package pot import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stratosnet/stratos-chain/x/pot/keeper" "github.com/stratosnet/stratos-chain/x/pot/types" ) // InitGenesis initialize default parameters // and the keeper's address to pubkey map -func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) { +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) { keeper.SetParams(ctx, *data.Params) //keeper.SetTotalMinedTokens(ctx, *data.TotalMinedToken) keeper.SetTotalMinedTokens(ctx, sdk.NewCoin(keeper.BondDenom(ctx), sdk.NewInt(0))) @@ -42,7 +43,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) { // ExportGenesis writes the current store values // to a genesis file, which can be imported again // with InitGenesis -func ExportGenesis(ctx sdk.Context, keeper Keeper) (data types.GenesisState) { +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data types.GenesisState) { params := keeper.GetParams(ctx) totalMinedToken := keeper.GetTotalMinedTokens(ctx) lastReportedEpoch := keeper.GetLastReportedEpoch(ctx) diff --git a/x/register/alias.go b/x/register/alias.go deleted file mode 100644 index 5ea7a6ba..00000000 --- a/x/register/alias.go +++ /dev/null @@ -1,62 +0,0 @@ -package register - -import ( - "github.com/stratosnet/stratos-chain/x/register/keeper" - "github.com/stratosnet/stratos-chain/x/register/types" -) - -const ( - DefaultParamSpace = types.DefaultParamSpace - ModuleName = types.ModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey - NodeTypeComputation = types.COMPUTATION - NodeTypeDataBase = types.DATABASE - NodeTypeStorage = types.STORAGE -) - -var ( - NewKeeper = keeper.NewKeeper - RegisterCodec = types.RegisterLegacyAminoCodec - - ErrInvalid = types.ErrInvalid - ErrInvalidNetworkAddr = types.ErrInvalidNetworkAddr - ErrEmptyOwnerAddr = types.ErrEmptyOwnerAddr - ErrValueNegative = types.ErrValueNegative - ErrEmptyDescription = types.ErrEmptyDescription - ErrEmptyResourceNodeAddr = types.ErrEmptyResourceNodeAddr - ErrEmptyIndexingNodeAddr = types.ErrEmptyIndexingNodeAddr - ErrBadDenom = types.ErrBadDenom - ErrResourceNodePubKeyExists = types.ErrResourceNodePubKeyExists - ErrIndexingNodePubKeyExists = types.ErrIndexingNodePubKeyExists - ErrNoResourceNodeFound = types.ErrNoResourceNodeFound - ErrNoIndexingNodeFound = types.ErrNoIndexingNodeFound - ErrInvalidOwnerAddr = types.ErrInvalidOwnerAddr - ErrInvalidApproverAddr = types.ErrInvalidVoterAddr - ErrInvalidApproverStatus = types.ErrInvalidVoterStatus - - DefaultParams = types.DefaultParams - DefaultGenesisState = types.DefaultGenesisState - NewGenesisState = types.NewGenesisState - NewResourceNode = types.NewResourceNode - NewIndexingNode = types.NewIndexingNode - NewDescription = types.NewDescription - NewMsgCreateResourceNode = types.NewMsgCreateResourceNode - NewMsgCreateIndexingNode = types.NewMsgCreateIndexingNode - - GetGenesisStateFromAppState = types.GetGenesisStateFromAppState - - NewMultiRegisterHooks = types.NewMultiRegisterHooks -) - -type ( - Keeper = keeper.Keeper - ResourceNode = types.ResourceNode - IndexingNode = types.IndexingNode - Description = types.Description - GenesisIndexingNode = types.GenesisIndexingNode - Slashing = types.Slashing - MsgCreateResourceNode = types.MsgCreateResourceNode - MsgCreateIndexingNode = types.MsgCreateIndexingNode - VoteOpinion = types.VoteOpinion -) diff --git a/x/sds/alias.go b/x/sds/alias.go deleted file mode 100644 index ad8fd1f8..00000000 --- a/x/sds/alias.go +++ /dev/null @@ -1,23 +0,0 @@ -package sds - -import ( - "github.com/stratosnet/stratos-chain/x/sds/keeper" - "github.com/stratosnet/stratos-chain/x/sds/types" -) - -const ( - DefaultParamSpace = types.DefaultParamSpace - ModuleName = types.ModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey -) - -var ( - NewKeeper = keeper.NewKeeper - RegisterCodec = types.RegisterLegacyAminoCodec - NewGenesisState = types.NewGenesisState -) - -type ( - Keeper = keeper.Keeper -) diff --git a/x/sds/genesis.go b/x/sds/genesis.go index fb9af84d..efd0b708 100644 --- a/x/sds/genesis.go +++ b/x/sds/genesis.go @@ -20,7 +20,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState // ExportGenesis writes the current store values // to a genesis file, which can be imported again // with InitGenesis -func ExportGenesis(ctx sdk.Context, keeper Keeper) (data types.GenesisState) { +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data types.GenesisState) { params := keeper.GetParams(ctx) var fileUpload []*types.FileUpload From 543f683d370126cd682913d0206d0b02b95450bb Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 30 May 2022 17:42:16 -0400 Subject: [PATCH 080/113] - qb-1165: fix on create-resource-node --- x/register/client/cli/tx.go | 20 ++++++++++++-------- x/register/client/rest/tx.go | 4 ++-- x/register/types/msg.go | 14 ++++---------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index 0dbf4721..1123f776 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" flag "github.com/spf13/pflag" @@ -374,10 +373,15 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, nil, err } - var pk cryptotypes.PubKey - if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(pkStr), &pk); err != nil { + pubKey, err := stratos.SdsPubKeyFromBech32(pkStr) + if err != nil { return txf, nil, err } + + //var pk cryptotypes.PubKey + //if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(pkStr), &pk); err != nil { + // return txf, nil, err + //} //pkStr := viper.GetString(FlagPubKey) nodeTypeRef, err := fs.GetInt(FlagNodeType) @@ -385,10 +389,10 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, nil, err } - pubKey, er := stratos.SdsPubKeyFromBech32(pkStr) - if er != nil { - return txf, nil, err - } + //pubKey, er := stratos.SdsPubKeyFromBech32(pkStr) + //if er != nil { + // return txf, nil, err + //} moniker, _ := fs.GetString(FlagMoniker) identity, _ := fs.GetString(FlagIdentity) @@ -416,7 +420,7 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs if t := newNodeType.Type(); t == "UNKNOWN" { return txf, nil, types.ErrNodeType } - msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, &description, &newNodeType) + msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, &description, strconv.Itoa(nodeTypeRef)) if er != nil { return txf, nil, err } diff --git a/x/register/client/rest/tx.go b/x/register/client/rest/tx.go index c02d16f5..8f2fd085 100644 --- a/x/register/client/rest/tx.go +++ b/x/register/client/rest/tx.go @@ -152,9 +152,9 @@ func postCreateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - nodeType := types.NodeType(nodeTypeRef) + //nodeType := types.NodeType(nodeTypeRef) msg, err := types.NewMsgCreateResourceNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description, - &nodeType) + string(nodeTypeRef)) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 89268bbc..0c180833 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -38,7 +38,7 @@ const ( // NewMsgCreateResourceNode NewMsg creates a new Msg instance func NewMsgCreateResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer - value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, nodeType *NodeType, + value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, nodeType string, ) (*MsgCreateResourceNode, error) { var pkAny *codectypes.Any if pubKey != nil { @@ -53,7 +53,7 @@ func NewMsgCreateResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes Value: value, OwnerAddress: ownerAddr.String(), Description: description, - NodeType: nodeType.Type(), + NodeType: nodeType, }, nil } @@ -71,14 +71,8 @@ func (msg MsgCreateResourceNode) ValidateBasic() error { return ErrEmptyNodeNetworkAddress } - pkAny, err := codectypes.NewAnyWithValue(msg.GetPubkey()) - if err != nil { - return err - } - sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) - if err != nil { - return err - } + pkAny := msg.GetPubkey().GetCachedValue().(cryptotypes.PubKey) + sdsAddr := sdk.AccAddress(pkAny.Address()) if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } From c8f2be64dcf79782591e81d694b354baeab4f4dc Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 30 May 2022 18:56:31 -0400 Subject: [PATCH 081/113] - qb-1165: fix on create-resource-node (add UnpackInterfaces impl) --- x/register/keeper/msg_server.go | 8 ++++---- x/register/types/msg.go | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 24bb3c01..6e6c8997 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -7,6 +7,7 @@ import ( "strconv" "time" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" @@ -29,10 +30,9 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types ctx := sdk.UnwrapSDKContext(goCtx) // check to see if the pubkey or sender has been registered before - pk, err := stratos.SdsPubKeyFromBech32(msg.Pubkey.String()) - if err != nil { - return nil, err - } + pkAny := msg.GetPubkey() + cachedPubkey := pkAny.GetCachedValue() + pk := cachedPubkey.(cryptotypes.PubKey) networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 0c180833..cf394fe4 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -70,8 +70,9 @@ func (msg MsgCreateResourceNode) ValidateBasic() error { if netAddr.Empty() { return ErrEmptyNodeNetworkAddress } - - pkAny := msg.GetPubkey().GetCachedValue().(cryptotypes.PubKey) + pk := msg.GetPubkey() + cachedPubkey := pk.GetCachedValue() + pkAny := cachedPubkey.(cryptotypes.PubKey) sdsAddr := sdk.AccAddress(pkAny.Address()) if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr @@ -120,6 +121,12 @@ func (msg MsgCreateResourceNode) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{addr.Bytes()} } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (msg MsgCreateResourceNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(msg.Pubkey, &pk) +} + // NewMsgCreateIndexingNode NewMsg creates a new Msg instance func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, @@ -201,6 +208,12 @@ func (msg MsgCreateIndexingNode) GetSigners() []sdk.AccAddress { } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (msg MsgCreateIndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(msg.Pubkey, &pk) +} + // NewMsgRemoveResourceNode creates a new MsgRemoveResourceNode instance. func NewMsgRemoveResourceNode(resourceNodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) *MsgRemoveResourceNode { return &MsgRemoveResourceNode{ From d8e2c727f5bfb2eb73b8e483589d0067f205a5be Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 1 Jun 2022 11:18:41 -0400 Subject: [PATCH 082/113] - qb-1165: fix resource-node marshalling issue --- x/register/types/resource_node.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 48183eaf..3f945dd7 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -210,7 +210,9 @@ func (v ResourceNode) IsUnBonding() bool { // MustMarshalResourceNode returns the resourceNode bytes. Panics if fails func MustMarshalResourceNode(cdc codec.BinaryCodec, resourceNode ResourceNode) []byte { - return cdc.MustMarshalLengthPrefixed(&resourceNode) + marshaled := cdc.MustMarshal(&resourceNode) + return marshaled + //return cdc.MustMarshal(&resourceNode) } // MustUnmarshalResourceNode unmarshal a resourceNode from a store value. Panics if fails From 0e6239933bca5348ba9c3d737167997c36f7cec4 Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 1 Jun 2022 11:19:54 -0400 Subject: [PATCH 083/113] - qb-1165: fix resource-node marshalling issue --- x/register/types/resource_node.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 3f945dd7..e8865d2e 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -210,9 +210,7 @@ func (v ResourceNode) IsUnBonding() bool { // MustMarshalResourceNode returns the resourceNode bytes. Panics if fails func MustMarshalResourceNode(cdc codec.BinaryCodec, resourceNode ResourceNode) []byte { - marshaled := cdc.MustMarshal(&resourceNode) - return marshaled - //return cdc.MustMarshal(&resourceNode) + return cdc.MustMarshal(&resourceNode) } // MustUnmarshalResourceNode unmarshal a resourceNode from a store value. Panics if fails From 028fb96318d9132a373420b354bada4dc5282ac0 Mon Sep 17 00:00:00 2001 From: Xiong Date: Wed, 1 Jun 2022 17:38:03 -0400 Subject: [PATCH 084/113] optimize iterations --- x/pot/keeper/distribute.go | 133 +++---- x/pot/keeper/incentive_testnet_distribute.go | 384 ------------------- x/pot/keeper/keeper.go | 19 +- x/pot/keeper/slashing.go | 6 +- x/pot/types/expected_keepers.go | 4 +- x/register/keeper/resource_node.go | 2 +- x/register/types/keys.go | 37 +- 7 files changed, 96 insertions(+), 489 deletions(-) delete mode 100644 x/pot/keeper/incentive_testnet_distribute.go diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 9aee42d5..1a6145c9 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -6,20 +6,21 @@ import ( regtypes "github.com/stratosnet/stratos-chain/x/register/types" ) -func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { +func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedUoz sdk.Dec, err error) { distributeGoal := types.InitDistributeGoal() rewardDetailMap := make(map[string]types.Reward) //key: wallet address //1, calc traffic reward in total - totalConsumedOzone, distributeGoal, err = k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) + totalConsumedUoz = k.GetTotalConsumedUoz(trafficList).ToDec() + distributeGoal, err = k.CalcTrafficRewardInTotal(ctx, distributeGoal, totalConsumedUoz) if err != nil { - return totalConsumedOzone, err + return totalConsumedUoz, err } //2, calc mining reward in total distributeGoal, err = k.CalcMiningRewardInTotal(ctx, distributeGoal) if err != nil && err != types.ErrOutOfIssuance { - return totalConsumedOzone, err + return totalConsumedUoz, err } /** @@ -32,7 +33,7 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single distributeGoalBalance := distributeGoal //3, calc reward for resource node, store to rewardDetailMap by wallet address(owner address) - rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNode(ctx, trafficList, distributeGoalBalance, rewardDetailMap) + rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNode(ctx, totalConsumedUoz, trafficList, distributeGoalBalance, rewardDetailMap) //4, calc reward from indexing node, store to rewardDetailMap by wallet address(owner address) rewardDetailMap, distributeGoalBalance = k.CalcRewardForIndexingNode(ctx, distributeGoalBalance, rewardDetailMap) @@ -40,13 +41,13 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single //5, [TLC] deduct reward from provider account (the value of parameter of distributeGoal will not change) err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch) if err != nil { - return totalConsumedOzone, err + return totalConsumedUoz, err } //6, [TLC] distribute staking reward to fee pool for validators distributeGoalBalance, err = k.distributeValidatorRewardToFeePool(ctx, distributeGoalBalance) if err != nil { - return totalConsumedOzone, err + return totalConsumedUoz, err } //7, IMPORTANT: sort map and convert to slice to keep the order @@ -55,13 +56,13 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single //8, distribute all rewards to resource nodes & indexing nodes err = k.distributeRewardToSdsNodes(ctx, rewardDetailList, epoch) if err != nil { - return totalConsumedOzone, err + return totalConsumedUoz, err } //9, [TLC] return balance to traffic pool & mining pool err = k.returnBalance(ctx, distributeGoalBalance, epoch) if err != nil { - return totalConsumedOzone, err + return totalConsumedUoz, err } //10, mature rewards for all nodes @@ -73,10 +74,10 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single //12, [TLC] transfer balance of miningReward&trafficReward pools to totalReward&totalSlashed pool, utilized for future Withdraw Tx err = k.TransferMiningTrafficRewardsToTotalRewards(ctx, totalSlashed) if err != nil { - return totalConsumedOzone, err + return totalConsumedUoz, err } - return totalConsumedOzone, nil + return totalConsumedUoz, nil } func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal types.DistributeGoal, epoch sdk.Int) (err error) { @@ -138,15 +139,15 @@ func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal type return nil } -func (k Keeper) returnBalance(ctx sdk.Context, goal types.DistributeGoal, currentEpoch sdk.Int) (err error) { - balanceOfMiningPool := goal.BlockChainRewardToIndexingNodeFromMiningPool. - Add(goal.MetaNodeRewardToIndexingNodeFromMiningPool). - Add(goal.BlockChainRewardToResourceNodeFromMiningPool). - Add(goal.TrafficRewardToResourceNodeFromMiningPool) - balanceOfTrafficPool := goal.BlockChainRewardToIndexingNodeFromTrafficPool. - Add(goal.MetaNodeRewardToIndexingNodeFromTrafficPool). - Add(goal.BlockChainRewardToResourceNodeFromTrafficPool). - Add(goal.TrafficRewardToResourceNodeFromTrafficPool) +func (k Keeper) returnBalance(ctx sdk.Context, balance types.DistributeGoal, currentEpoch sdk.Int) (err error) { + balanceOfMiningPool := balance.BlockChainRewardToIndexingNodeFromMiningPool. + Add(balance.MetaNodeRewardToIndexingNodeFromMiningPool). + Add(balance.BlockChainRewardToResourceNodeFromMiningPool). + Add(balance.TrafficRewardToResourceNodeFromMiningPool) + balanceOfTrafficPool := balance.BlockChainRewardToIndexingNodeFromTrafficPool. + Add(balance.MetaNodeRewardToIndexingNodeFromTrafficPool). + Add(balance.BlockChainRewardToResourceNodeFromTrafficPool). + Add(balance.TrafficRewardToResourceNodeFromTrafficPool) // return balance to foundation account //foundationAccountAddr := k.AccountKeeper.GetModuleAddress(types.FoundationAccount) @@ -183,14 +184,14 @@ func (k Keeper) returnBalance(ctx sdk.Context, goal types.DistributeGoal, curren } func (k Keeper) CalcTrafficRewardInTotal( - ctx sdk.Context, trafficList []*types.SingleWalletVolume, distributeGoal types.DistributeGoal, -) (sdk.Dec, types.DistributeGoal, error) { + ctx sdk.Context, distributeGoal types.DistributeGoal, totalConsumedUoz sdk.Dec, +) (types.DistributeGoal, error) { - totalConsumedOzone, totalTrafficReward := k.GetTrafficReward(ctx, trafficList) + totalTrafficReward := k.GetTrafficReward(ctx, totalConsumedUoz) totalMinedTokens := k.GetTotalMinedTokens(ctx) miningParam, err := k.GetMiningRewardParamByMinedToken(ctx, totalMinedTokens) if err != nil && err != types.ErrOutOfIssuance { - return sdk.Dec{}, distributeGoal, err + return distributeGoal, err } stakeReward := totalTrafficReward. Mul(miningParam.BlockChainPercentageInTenThousand.ToDec()). @@ -209,7 +210,7 @@ func (k Keeper) CalcTrafficRewardInTotal( distributeGoal = distributeGoal.AddTrafficRewardToResourceNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), trafficReward)) distributeGoal = distributeGoal.AddMetaNodeRewardToIndexingNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), indexingReward)) - return totalConsumedOzone, distributeGoal, nil + return distributeGoal, nil } // [S] is initial genesis deposit by all resource nodes and meta nodes at t=0 @@ -218,7 +219,7 @@ func (k Keeper) CalcTrafficRewardInTotal( // The remaining total Ozone limit [lt] is the upper bound of total Ozone that users can purchase from Stratos blockchain. // the total generated traffic rewards as [R] // R = (S + Pt) * Y / (Lt + Y) -func (k Keeper) GetTrafficReward(ctx sdk.Context, trafficList []*types.SingleWalletVolume) (totalConsumedOzone, result sdk.Dec) { +func (k Keeper) GetTrafficReward(ctx sdk.Context, totalConsumedUoz sdk.Dec) (result sdk.Dec) { S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() if S.Equal(sdk.ZeroDec()) { ctx.Logger().Info("initial genesis deposit by all resource nodes and meta nodes is 0") @@ -227,7 +228,7 @@ func (k Keeper) GetTrafficReward(ctx sdk.Context, trafficList []*types.SingleWal if Pt.Equal(sdk.ZeroDec()) { ctx.Logger().Info("total remaining prepay not issued is 0") } - Y := k.GetTotalConsumedUoz(trafficList).ToDec() + Y := totalConsumedUoz if Y.Equal(sdk.ZeroDec()) { ctx.Logger().Info("total consumed uoz is 0") } @@ -239,7 +240,7 @@ func (k Keeper) GetTrafficReward(ctx sdk.Context, trafficList []*types.SingleWal if R.Equal(sdk.ZeroDec()) { ctx.Logger().Info("traffic reward to distribute is 0") } - return Y, R + return R } // allocate mining reward from foundation account @@ -363,8 +364,8 @@ func (k Keeper) distributeValidatorRewardToFeePool(ctx sdk.Context, distributeGo return distributeGoal, nil } -func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types.SingleWalletVolume, - distributeGoal types.DistributeGoal, rewardDetailMap map[string]types.Reward, +func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, totalConsumedUoz sdk.Dec, trafficList []*types.SingleWalletVolume, + distributeGoalBalance types.DistributeGoal, rewardDetailMap map[string]types.Reward, ) (map[string]types.Reward, types.DistributeGoal) { totalUsedFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) @@ -372,8 +373,12 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types. // 1, calc stake reward totalStakeOfResourceNodes := k.RegisterKeeper.GetResourceNodeBondedToken(ctx).Amount - resourceNodeList := k.RegisterKeeper.GetAllResourceNodes(ctx) - for _, node := range resourceNodeList.ResourceNodes { + + resourceNodeIterator := k.RegisterKeeper.GetResourceNodeIterator(ctx) + defer resourceNodeIterator.Close() + for ; resourceNodeIterator.Valid(); resourceNodeIterator.Next() { + node := regtypes.MustUnmarshalResourceNode(k.cdc, resourceNodeIterator.Value()) + walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) if err != nil { continue @@ -384,9 +389,9 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types. } shareOfToken := tokens.ToDec().Quo(totalStakeOfResourceNodes.ToDec()) stakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), - distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) + distributeGoalBalance.BlockChainRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) stakeRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), - distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) + distributeGoalBalance.BlockChainRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) totalUsedFromMiningPool = totalUsedFromMiningPool.Add(stakeRewardFromMiningPool) totalUsedFromTrafficPool = totalUsedFromTrafficPool.Add(stakeRewardFromTrafficPool) @@ -400,19 +405,17 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types. newReward = newReward.AddRewardFromMiningPool(stakeRewardFromMiningPool) newReward = newReward.AddRewardFromTrafficPool(stakeRewardFromTrafficPool) rewardDetailMap[walletAddr.String()] = newReward - } - // deduct used reward from distributeGoal - distributeGoal.BlockChainRewardToResourceNodeFromMiningPool = - distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Sub(totalUsedFromMiningPool) - distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool = - distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool.Sub(totalUsedFromTrafficPool) + + // deduct used reward from distributeGoalBalance + distributeGoalBalance.BlockChainRewardToResourceNodeFromMiningPool = + distributeGoalBalance.BlockChainRewardToResourceNodeFromMiningPool.Sub(totalUsedFromMiningPool) + distributeGoalBalance.BlockChainRewardToResourceNodeFromTrafficPool = + distributeGoalBalance.BlockChainRewardToResourceNodeFromTrafficPool.Sub(totalUsedFromTrafficPool) totalUsedFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) totalUsedFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - // calc total traffic - totalConsumedOzone := k.GetTotalConsumedUoz(trafficList) // 2, calc traffic reward for _, walletTraffic := range trafficList { walletAddr, err := sdk.AccAddressFromBech32(walletTraffic.WalletAddress) @@ -422,11 +425,11 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types. //walletAddr := walletTraffic.WalletAddress trafficVolume := walletTraffic.Volume - shareOfTraffic := trafficVolume.ToDec().Quo(totalConsumedOzone.ToDec()) + shareOfTraffic := trafficVolume.ToDec().Quo(totalConsumedUoz) trafficRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), - distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(shareOfTraffic).TruncateInt()) + distributeGoalBalance.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(shareOfTraffic).TruncateInt()) trafficRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), - distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(shareOfTraffic).TruncateInt()) + distributeGoalBalance.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(shareOfTraffic).TruncateInt()) totalUsedFromMiningPool = totalUsedFromMiningPool.Add(trafficRewardFromMiningPool) totalUsedFromTrafficPool = totalUsedFromTrafficPool.Add(trafficRewardFromTrafficPool) @@ -442,15 +445,15 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types. rewardDetailMap[walletAddr.String()] = newReward } // deduct used reward from distributeGoal - distributeGoal.TrafficRewardToResourceNodeFromMiningPool = - distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Sub(totalUsedFromMiningPool) - distributeGoal.TrafficRewardToResourceNodeFromTrafficPool = - distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Sub(totalUsedFromTrafficPool) + distributeGoalBalance.TrafficRewardToResourceNodeFromMiningPool = + distributeGoalBalance.TrafficRewardToResourceNodeFromMiningPool.Sub(totalUsedFromMiningPool) + distributeGoalBalance.TrafficRewardToResourceNodeFromTrafficPool = + distributeGoalBalance.TrafficRewardToResourceNodeFromTrafficPool.Sub(totalUsedFromTrafficPool) - return rewardDetailMap, distributeGoal + return rewardDetailMap, distributeGoalBalance } -func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoal types.DistributeGoal, rewardDetailMap map[string]types.Reward, +func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoalBalance types.DistributeGoal, rewardDetailMap map[string]types.Reward, ) (map[string]types.Reward, types.DistributeGoal) { totalUsedStakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) @@ -474,18 +477,18 @@ func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoal types. // 1, calc stake reward shareOfToken := tokens.ToDec().Quo(totalStakeOfIndexingNodes.ToDec()) stakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), - distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) + distributeGoalBalance.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) stakeRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), - distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) + distributeGoalBalance.BlockChainRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) totalUsedStakeRewardFromMiningPool = totalUsedStakeRewardFromMiningPool.Add(stakeRewardFromMiningPool) totalUsedStakeRewardFromTrafficPool = totalUsedStakeRewardFromTrafficPool.Add(stakeRewardFromTrafficPool) // 2, calc indexing reward indexingRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), - distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(indexingNodeCnt.ToDec()).TruncateInt()) + distributeGoalBalance.MetaNodeRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(indexingNodeCnt.ToDec()).TruncateInt()) indexingRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), - distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(indexingNodeCnt.ToDec()).TruncateInt()) + distributeGoalBalance.MetaNodeRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(indexingNodeCnt.ToDec()).TruncateInt()) totalUsedIndexingRewardFromMiningPool = totalUsedIndexingRewardFromMiningPool.Add(indexingRewardFromMiningPool) totalUsedIndexingRewardFromTrafficPool = totalUsedIndexingRewardFromTrafficPool.Add(indexingRewardFromTrafficPool) @@ -501,16 +504,16 @@ func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoal types. rewardDetailMap[walletAddr.String()] = newReward } // deduct used reward from distributeGoal - distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool = - distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Sub(totalUsedStakeRewardFromMiningPool) - distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool = - distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool.Sub(totalUsedStakeRewardFromTrafficPool) - distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool = - distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool.Sub(totalUsedIndexingRewardFromMiningPool) - distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool = - distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool.Sub(totalUsedIndexingRewardFromTrafficPool) - - return rewardDetailMap, distributeGoal + distributeGoalBalance.BlockChainRewardToIndexingNodeFromMiningPool = + distributeGoalBalance.BlockChainRewardToIndexingNodeFromMiningPool.Sub(totalUsedStakeRewardFromMiningPool) + distributeGoalBalance.BlockChainRewardToIndexingNodeFromTrafficPool = + distributeGoalBalance.BlockChainRewardToIndexingNodeFromTrafficPool.Sub(totalUsedStakeRewardFromTrafficPool) + distributeGoalBalance.MetaNodeRewardToIndexingNodeFromMiningPool = + distributeGoalBalance.MetaNodeRewardToIndexingNodeFromMiningPool.Sub(totalUsedIndexingRewardFromMiningPool) + distributeGoalBalance.MetaNodeRewardToIndexingNodeFromTrafficPool = + distributeGoalBalance.MetaNodeRewardToIndexingNodeFromTrafficPool.Sub(totalUsedIndexingRewardFromTrafficPool) + + return rewardDetailMap, distributeGoalBalance } func (k Keeper) GetTotalConsumedUoz(trafficList []*types.SingleWalletVolume) sdk.Int { diff --git a/x/pot/keeper/incentive_testnet_distribute.go b/x/pot/keeper/incentive_testnet_distribute.go deleted file mode 100644 index e4f176dd..00000000 --- a/x/pot/keeper/incentive_testnet_distribute.go +++ /dev/null @@ -1,384 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stratosnet/stratos-chain/x/pot/types" - regtypes "github.com/stratosnet/stratos-chain/x/register/types" -) - -func (k Keeper) DistributePotRewardForTestnet(ctx sdk.Context, trafficList []*types.SingleWalletVolume, epoch sdk.Int) (totalConsumedOzone sdk.Dec, err error) { - distributeGoal := types.InitDistributeGoal() - rewardDetailMap := make(map[string]types.Reward) //key: wallet address - - //1, calc traffic reward in total - totalConsumedOzone, distributeGoal, err = k.CalcTrafficRewardInTotal(ctx, trafficList, distributeGoal) - if err != nil { - return totalConsumedOzone, err - } - - //2, calc mining reward in total, - //*************** For incentive testnet, the mining reward to blockchain (stakeReward) are evenly distributed to all the nodes ***************** - distributeGoal, idxNodes, resNodes, err := k.CalcMiningRewardInTotalForTestnet(ctx, distributeGoal) - if err != nil && err != types.ErrOutOfIssuance { - return totalConsumedOzone, err - } - - /** - distributeGoalBalance is used for keeping the balance to return to the reward provider's account - - After calculation by step 3,4, - distributeGoalBalance retains FULL rewards that will be distributed to validators - & the REMAINING rewards that will be returned to the reward provider’s account - */ - distributeGoalBalance := distributeGoal - - //3, calc reward for resource node, store to rewardDetailMap by wallet address(owner address) - rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNodeForTestnet(ctx, trafficList, distributeGoalBalance, rewardDetailMap, resNodes) - - //4, calc reward from indexing node, store to rewardDetailMap by wallet address(owner address) - rewardDetailMap, distributeGoalBalance = k.CalcRewardForIndexingNodeForTestnet(ctx, distributeGoalBalance, rewardDetailMap, idxNodes) - - //5, deduct reward from provider account (the value of parameter of distributeGoal will not change) - err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch) - if err != nil { - return totalConsumedOzone, err - } - - //6, distribute skate reward to fee pool for validators - distributeGoalBalance, err = k.distributeValidatorRewardForTestnet(ctx, distributeGoalBalance) - if err != nil { - return totalConsumedOzone, err - } - - //7, IMPORTANT: sort map and convert to slice to keep the order - rewardDetailList := sortDetailMapToSlice(rewardDetailMap) - - //8, distribute all rewards to resource nodes & indexing nodes - err = k.distributeRewardToSdsNodes(ctx, rewardDetailList, epoch) - if err != nil { - return totalConsumedOzone, err - } - - //9, return balance to traffic pool & mining pool - err = k.returnBalanceForTestnet(ctx, distributeGoalBalance, epoch) - if err != nil { - return totalConsumedOzone, err - } - - return totalConsumedOzone, nil -} - -// allocate mining reward from foundation account -func (k Keeper) CalcMiningRewardInTotalForTestnet(ctx sdk.Context, distributeGoal types.DistributeGoal) ( - types.DistributeGoal, []regtypes.IndexingNode, []regtypes.ResourceNode, error) { - totalMinedTokens := k.GetTotalMinedTokens(ctx) - miningParam, err := k.GetMiningRewardParamByMinedToken(ctx, totalMinedTokens) - - totalMiningReward := miningParam.MiningReward - if err != nil { - return distributeGoal, nil, nil, err - } - stakeReward := totalMiningReward.Amount.ToDec(). - Mul(miningParam.BlockChainPercentageInTenThousand.ToDec()). - Quo(sdk.NewDec(10000)).TruncateInt() - trafficReward := totalMiningReward.Amount.ToDec(). - Mul(miningParam.ResourceNodePercentageInTenThousand.ToDec()). - Quo(sdk.NewDec(10000)).TruncateInt() - indexingReward := totalMiningReward.Amount.ToDec(). - Mul(miningParam.MetaNodePercentageInTenThousand.ToDec()). - Quo(sdk.NewDec(10000)).TruncateInt() - - stakeRewardToValidators, stakeRewardToResourceNodes, stakeRewardToIndexingNodes, idxNodes, resNodes := k.splitRewardEvenly(ctx, stakeReward) - distributeGoal = distributeGoal.AddBlockChainRewardToValidatorFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardToValidators)) - distributeGoal = distributeGoal.AddBlockChainRewardToResourceNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardToResourceNodes)) - distributeGoal = distributeGoal.AddBlockChainRewardToIndexingNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardToIndexingNodes)) - distributeGoal = distributeGoal.AddTrafficRewardToResourceNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), trafficReward)) - distributeGoal = distributeGoal.AddMetaNodeRewardToIndexingNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), indexingReward)) - return distributeGoal, idxNodes, resNodes, nil -} - -func (k Keeper) splitRewardEvenly(ctx sdk.Context, totalReward sdk.Int, -) (validatorReward sdk.Int, resourceNodeReward sdk.Int, indexingNodeReward sdk.Int, - indNodes []regtypes.IndexingNode, resNodes []regtypes.ResourceNode) { - validatorCnt := sdk.ZeroDec() - indexingNodeCnt := sdk.ZeroDec() - resourceNodeCnt := sdk.ZeroDec() - indNodes = make([]regtypes.IndexingNode, 0) - resNodes = make([]regtypes.ResourceNode, 0) - validatorList := k.StakingKeeper.GetAllValidators(ctx) - for _, validator := range validatorList { - if validator.IsBonded() && !validator.IsJailed() { - validatorCnt = validatorCnt.Add(sdk.OneDec()) - } - } - - indexingNodeList := k.RegisterKeeper.GetAllIndexingNodes(ctx) - for _, indexingNode := range indexingNodeList.IndexingNodes { - if indexingNode.IsBonded() && !indexingNode.Suspend { - indexingNodeCnt = indexingNodeCnt.Add(sdk.OneDec()) - indNodes = append(indNodes, *indexingNode) - } - } - - resourceNodeList := k.RegisterKeeper.GetAllResourceNodes(ctx) - for _, resourceNode := range resourceNodeList.ResourceNodes { - if resourceNode.IsBonded() && !resourceNode.Suspend { - resourceNodeCnt = resourceNodeCnt.Add(sdk.OneDec()) - resNodes = append(resNodes, *resourceNode) - } - } - - totalNodes := validatorCnt.Add(indexingNodeCnt).Add(resourceNodeCnt) - - validatorReward = totalReward.ToDec().Mul(validatorCnt).Quo(totalNodes).TruncateInt() - indexingNodeReward = totalReward.ToDec().Mul(indexingNodeCnt).Quo(totalNodes).TruncateInt() - resourceNodeReward = totalReward.ToDec().Mul(resourceNodeCnt).Quo(totalNodes).TruncateInt() - return -} - -func (k Keeper) CalcRewardForResourceNodeForTestnet(ctx sdk.Context, trafficList []*types.SingleWalletVolume, - distributeGoal types.DistributeGoal, rewardDetailMap map[string]types.Reward, resourceNodes []regtypes.ResourceNode, -) (map[string]types.Reward, types.DistributeGoal) { - - totalUsedFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - totalUsedFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - - // 1, calc stake reward - totalStakeOfResourceNodes := k.RegisterKeeper.GetResourceNodeBondedToken(ctx).Amount - resourceNodeCnt := sdk.NewDec(int64(len(resourceNodes))) - for _, node := range resourceNodes { - walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) - if err != nil { - continue - } - tokens, ok := sdk.NewIntFromString(node.Tokens.String()) - if !ok { - continue - } - shareOfToken := tokens.ToDec().Quo(totalStakeOfResourceNodes.ToDec()) - stakeRewardFromMiningPool := distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Amount.ToDec().Quo(resourceNodeCnt).TruncateInt() - stakeRewardFromTrafficPool := distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt() - - totalUsedFromMiningPool = totalUsedFromMiningPool.Add(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardFromMiningPool)) - totalUsedFromTrafficPool = totalUsedFromTrafficPool.Add(sdk.NewCoin(k.BondDenom(ctx), stakeRewardFromTrafficPool)) - - if _, ok := rewardDetailMap[walletAddr.String()]; !ok { - reward := types.NewDefaultReward(walletAddr) - rewardDetailMap[walletAddr.String()] = reward - } - - newReward := rewardDetailMap[walletAddr.String()] - newReward = newReward.AddRewardFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardFromMiningPool)) - newReward = newReward.AddRewardFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), stakeRewardFromTrafficPool)) - rewardDetailMap[walletAddr.String()] = newReward - - } - // deduct used reward from distributeGoal - distributeGoal.BlockChainRewardToResourceNodeFromMiningPool = - distributeGoal.BlockChainRewardToResourceNodeFromMiningPool.Sub(totalUsedFromMiningPool) - distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool = - distributeGoal.BlockChainRewardToResourceNodeFromTrafficPool.Sub(totalUsedFromTrafficPool) - - totalUsedFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - totalUsedFromTrafficPool = sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - - // calc total traffic - totalConsumedOzone := k.GetTotalConsumedUoz(trafficList) - // 2, calc traffic reward - for _, walletTraffic := range trafficList { - walletAddr, err := sdk.AccAddressFromBech32(walletTraffic.WalletAddress) - if err != nil { - continue - } - //walletAddr := walletTraffic.WalletAddress - trafficVolume := walletTraffic.Volume - - shareOfTraffic := trafficVolume.ToDec().Quo(totalConsumedOzone.ToDec()) - trafficRewardFromMiningPool := - sdk.NewCoin(k.RewardDenom(ctx), distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Amount.ToDec().Mul(shareOfTraffic).TruncateInt()) - trafficRewardFromTrafficPool := - sdk.NewCoin(k.BondDenom(ctx), distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Amount.ToDec().Mul(shareOfTraffic).TruncateInt()) - - totalUsedFromMiningPool = totalUsedFromMiningPool.Add(trafficRewardFromMiningPool) - totalUsedFromTrafficPool = totalUsedFromTrafficPool.Add(trafficRewardFromTrafficPool) - - if _, ok := rewardDetailMap[walletAddr.String()]; !ok { - reward := types.NewDefaultReward(walletAddr) - rewardDetailMap[walletAddr.String()] = reward - } - - newReward := rewardDetailMap[walletAddr.String()] - newReward = newReward.AddRewardFromMiningPool(trafficRewardFromMiningPool) - newReward = newReward.AddRewardFromTrafficPool(trafficRewardFromTrafficPool) - rewardDetailMap[walletAddr.String()] = newReward - } - // deduct used reward from distributeGoal - distributeGoal.TrafficRewardToResourceNodeFromMiningPool = - distributeGoal.TrafficRewardToResourceNodeFromMiningPool.Sub(totalUsedFromMiningPool) - distributeGoal.TrafficRewardToResourceNodeFromTrafficPool = - distributeGoal.TrafficRewardToResourceNodeFromTrafficPool.Sub(totalUsedFromTrafficPool) - - return rewardDetailMap, distributeGoal -} - -func (k Keeper) CalcRewardForIndexingNodeForTestnet(ctx sdk.Context, distributeGoal types.DistributeGoal, - rewardDetailMap map[string]types.Reward, indexNodes []regtypes.IndexingNode, -) (map[string]types.Reward, types.DistributeGoal) { - - totalUsedStakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - totalUsedStakeRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - totalUsedIndexingRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - totalUsedIndexingRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - - totalStakeOfIndexingNodes := k.RegisterKeeper.GetIndexingNodeBondedToken(ctx).Amount - indexingNodeCnt := sdk.NewDec(int64(len(indexNodes))) - for _, node := range indexNodes { - walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) - if err != nil { - continue - } - tokens, ok := sdk.NewIntFromString(node.Tokens.String()) - if !ok { - continue - } - // 1, calc stake reward - shareOfToken := tokens.ToDec().Quo(totalStakeOfIndexingNodes.ToDec()) - stakeRewardFromMiningPool := - sdk.NewCoin(k.RewardDenom(ctx), distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(indexingNodeCnt).TruncateInt()) - stakeRewardFromTrafficPool := - sdk.NewCoin(k.BondDenom(ctx), distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) - - totalUsedStakeRewardFromMiningPool = totalUsedStakeRewardFromMiningPool.Add(stakeRewardFromMiningPool) - totalUsedStakeRewardFromTrafficPool = totalUsedStakeRewardFromTrafficPool.Add(stakeRewardFromTrafficPool) - - // 2, calc indexing reward - indexingRewardFromMiningPool := - sdk.NewCoin(k.RewardDenom(ctx), distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(indexingNodeCnt).TruncateInt()) - indexingRewardFromTrafficPool := - sdk.NewCoin(k.BondDenom(ctx), distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(indexingNodeCnt).TruncateInt()) - - totalUsedIndexingRewardFromMiningPool = totalUsedIndexingRewardFromMiningPool.Add(indexingRewardFromMiningPool) - totalUsedIndexingRewardFromTrafficPool = totalUsedIndexingRewardFromTrafficPool.Add(indexingRewardFromTrafficPool) - - if _, ok := rewardDetailMap[walletAddr.String()]; !ok { - reward := types.NewDefaultReward(walletAddr) - rewardDetailMap[walletAddr.String()] = reward - } - - newReward := rewardDetailMap[walletAddr.String()] - newReward = newReward.AddRewardFromMiningPool(stakeRewardFromMiningPool.Add(indexingRewardFromMiningPool)) - newReward = newReward.AddRewardFromTrafficPool(stakeRewardFromTrafficPool.Add(indexingRewardFromTrafficPool)) - rewardDetailMap[walletAddr.String()] = newReward - } - // deduct used reward from distributeGoal - distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool = - distributeGoal.BlockChainRewardToIndexingNodeFromMiningPool.Sub(totalUsedStakeRewardFromMiningPool) - distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool = - distributeGoal.BlockChainRewardToIndexingNodeFromTrafficPool.Sub(totalUsedStakeRewardFromTrafficPool) - distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool = - distributeGoal.MetaNodeRewardToIndexingNodeFromMiningPool.Sub(totalUsedIndexingRewardFromMiningPool) - distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool = - distributeGoal.MetaNodeRewardToIndexingNodeFromTrafficPool.Sub(totalUsedIndexingRewardFromTrafficPool) - - return rewardDetailMap, distributeGoal -} - -// move reward to fee pool for validator traffic reward distribution -func (k Keeper) distributeValidatorRewardForTestnet(ctx sdk.Context, distributeGoal types.DistributeGoal) (types.DistributeGoal, error) { - rewardFromMiningPool := distributeGoal.BlockChainRewardToValidatorFromMiningPool - rewardFromTrafficPool := distributeGoal.BlockChainRewardToValidatorFromTrafficPool - usedRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - - // distribute reward from mining pool to wallet directly - validatorWalletList := make([]sdk.AccAddress, 0) - validators := k.StakingKeeper.GetAllValidators(ctx) - for _, validator := range validators { - if validator.IsBonded() && !validator.IsJailed() { - validatorWalletList = append(validatorWalletList, sdk.AccAddress(validator.GetOperator())) - } - } - //TODO doublecheck logic: replace pools with module accounts? - rewardPerValidator := sdk.NewCoin(k.RewardDenom(ctx), rewardFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(int64(len(validatorWalletList)))).TruncateInt()) - for _, validatorWallet := range validatorWalletList { - err := k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.MiningRewardPool, validatorWallet, sdk.NewCoins(rewardPerValidator)) - if err != nil { - return distributeGoal, err - } - usedRewardFromMiningPool = usedRewardFromMiningPool.Add(rewardPerValidator) - } - - // distribute rewards from traffic pool to fee_pool - //TODO doublecheck logic - err := k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.TrafficRewardPool, authtypes.FeeCollectorName, sdk.NewCoins(rewardFromTrafficPool)) - if err != nil { - return distributeGoal, err - } - - //feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(k.feeCollectorName) - // - //if feePoolAccAddr == nil { - // ctx.Logger().Error("account address of distribution module does not exist.") - // return distributeGoal, types.ErrUnknownAccountAddress - //} - // - //_, err := k.BankKeeper.AddCoins(ctx, feePoolAccAddr, sdk.NewCoins(rewardFromTrafficPool)) - //if err != nil { - // return distributeGoal, err - //} - - distributeGoal.BlockChainRewardToValidatorFromMiningPool = rewardFromMiningPool.Sub(usedRewardFromMiningPool) - distributeGoal.BlockChainRewardToValidatorFromTrafficPool = sdk.Coin{} - - return distributeGoal, nil -} - -func (k Keeper) returnBalanceForTestnet(ctx sdk.Context, goal types.DistributeGoal, epoch sdk.Int) (err error) { - balanceOfMiningPool := goal.BlockChainRewardToIndexingNodeFromMiningPool. - Add(goal.MetaNodeRewardToIndexingNodeFromMiningPool). - Add(goal.BlockChainRewardToResourceNodeFromMiningPool). - Add(goal.TrafficRewardToResourceNodeFromMiningPool). - Add(goal.BlockChainRewardToValidatorFromMiningPool) - balanceOfTrafficPool := goal.BlockChainRewardToIndexingNodeFromTrafficPool. - Add(goal.MetaNodeRewardToIndexingNodeFromTrafficPool). - Add(goal.BlockChainRewardToResourceNodeFromTrafficPool). - Add(goal.TrafficRewardToResourceNodeFromTrafficPool) - - // return balance to foundation account - amountToAdd := sdk.NewCoins(balanceOfMiningPool) - //TODO doublecheck logic - err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.MiningRewardPool, types.FoundationAccount, amountToAdd) - if err != nil { - return err - } - //foundationAccountAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) - //if foundationAccountAddr == nil { - // ctx.Logger().Error("foundation account address of distribution module does not exist.") - // return types.ErrUnknownAccountAddress - //} - //amountToAdd := sdk.NewCoins(balanceOfMiningPool) - //_, err = k.BankKeeper.AddCoins(ctx, foundationAccountAddr, amountToAdd) - //if err != nil { - // return err - //} - - //return balance to minedToken record - oldTotalMinedToken := k.GetTotalMinedTokens(ctx) - newTotalMinedToken := oldTotalMinedToken.Sub(balanceOfMiningPool) - oldMinedToken := k.GetMinedTokens(ctx, epoch) - newMinedToken := oldMinedToken.Sub(balanceOfMiningPool) - k.SetTotalMinedTokens(ctx, newTotalMinedToken) - k.setMinedTokens(ctx, epoch, newMinedToken) - - // return balance to prepay pool - // [TLC][TrafficRewardPool -> TotalUnIssuedPrepay] - err = k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.TrafficRewardPool, regtypes.TotalUnissuedPrepayName, sdk.NewCoins(balanceOfTrafficPool)) - if err != nil { - return err - } - //totalUnIssuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) - //newTotalUnIssuedPrePay := totalUnIssuedPrepay.Add(balanceOfTrafficPool) - //k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) - - return nil -} diff --git a/x/pot/keeper/keeper.go b/x/pot/keeper/keeper.go index 4dd00cae..625e2560 100644 --- a/x/pot/keeper/keeper.go +++ b/x/pot/keeper/keeper.go @@ -19,10 +19,9 @@ type Keeper struct { paramSpace paramstypes.Subspace feeCollectorName string // name of the FeeCollector ModuleAccount BankKeeper types.BankKeeper - //SupplyKeeper supply.Keeper - AccountKeeper types.AccountKeeper - StakingKeeper types.StakingKeeper - RegisterKeeper types.RegisterKeeper + AccountKeeper types.AccountKeeper + StakingKeeper types.StakingKeeper + RegisterKeeper types.RegisterKeeper } // NewKeeper creates a pot keeper @@ -36,10 +35,9 @@ func NewKeeper(cdc codec.Codec, key sdk.StoreKey, paramSpace paramstypes.Subspac paramSpace: paramSpace.WithKeyTable(types.ParamKeyTable()), feeCollectorName: feeCollectorName, BankKeeper: bankKeeper, - //SupplyKeeper: supplyKeeper, - AccountKeeper: accountKeeper, - StakingKeeper: stakingKeeper, - RegisterKeeper: registerKeeper, + AccountKeeper: accountKeeper, + StakingKeeper: stakingKeeper, + RegisterKeeper: registerKeeper, } return keeper } @@ -55,10 +53,7 @@ func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []*types.SingleWalle reportRecord := types.NewReportRecord(reporter, reportReference, txHash) k.SetVolumeReport(ctx, epoch, reportRecord) //distribute POT reward - //TODO: recovery when shift to main net - totalConsumedOzone, err = k.DistributePotReward(ctx, walletVolumes, epoch) // Main net - //TODO: remove when shift to main net - //totalConsumedOzone, err = k.DistributePotRewardForTestnet(ctx, walletVolumes, epoch) // Incentive test net + totalConsumedOzone, err = k.DistributePotReward(ctx, walletVolumes, epoch) return totalConsumedOzone, err } diff --git a/x/pot/keeper/slashing.go b/x/pot/keeper/slashing.go index 4f8dc57d..a8e464ae 100644 --- a/x/pot/keeper/slashing.go +++ b/x/pot/keeper/slashing.go @@ -28,10 +28,12 @@ func (k Keeper) SlashingResourceNode(ctx sdk.Context, p2pAddr stratos.SdsAddress node.Suspend = suspend //slashing amt is equivalent to reward traffic calculation - _, slash := k.GetTrafficReward(ctx, []*types.SingleWalletVolume{{ + trafficList := []*types.SingleWalletVolume{{ WalletAddress: node.OwnerAddress, Volume: &ozAmt, - }}) + }} + totalConsumedUoz := k.GetTotalConsumedUoz(trafficList).ToDec() + slash := k.GetTrafficReward(ctx, totalConsumedUoz) oldSlashing := k.RegisterKeeper.GetSlashing(ctx, walletAddr) diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 373827f6..c7fa30ce 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -5,6 +5,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" //authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" @@ -76,8 +77,9 @@ type RegisterKeeper interface { GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) - GetAllResourceNodes(ctx sdk.Context) (resourceNodes *types.ResourceNodes) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes *types.IndexingNodes) + + GetResourceNodeIterator(ctx sdk.Context) sdk.Iterator } type StakingKeeper interface { diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index ba95c8e8..e7fff9bc 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -82,7 +82,7 @@ func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes *types.Resou return } -func (k Keeper) getResourceNodeIterator(ctx sdk.Context) sdk.Iterator { +func (k Keeper) GetResourceNodeIterator(ctx sdk.Context) sdk.Iterator { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) return iterator diff --git a/x/register/types/keys.go b/x/register/types/keys.go index d0f37fef..857aa0f8 100644 --- a/x/register/types/keys.go +++ b/x/register/types/keys.go @@ -8,11 +8,8 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -// Bech32PubKeyType defines a string type alias for a Bech32 public key type. -type Bech32PubKeyType string - const ( - Bech32PubKeyTypesdsPub Bech32PubKeyType = "sdspub" + // ModuleName is the name of the module ModuleName = "register" // StoreKey to be used when creating the KVStore @@ -29,31 +26,23 @@ const ( IndexingNodeBondedPoolName = "indexing_node_bonded_pool" // IndexingNodeNotBondedPoolName stores the total balance of not bonded indexing nodes IndexingNodeNotBondedPoolName = "indexing_node_not_bonded_pool" - // TotalUnIssuedPrepay stores the balance of total unissued prepay + // TotalUnissuedPrepayName stores the balance of total unissued prepay TotalUnissuedPrepayName = "total_unissued_prepay" - // TotalUnIssuedPrepay stores the balance of total unissued prepay + // TotalSlashedPoolName stores the balance of total unissued prepay TotalSlashedPoolName = "total_slashed_pool" ) var ( - ResourceNodeNotBondedTokenKey = []byte{0x01} - ResourceNodeBondedTokenKey = []byte{0x02} - IndexingNodeNotBondedTokenKey = []byte{0x03} - IndexingNodeBondedTokenKey = []byte{0x04} - UpperBoundOfTotalOzoneKey = []byte{0x05} - TotalUnissuedPrepayKey = []byte{0x06} - SlashingPrefix = []byte{0x07} - - InitialGenesisStakeTotalKey = []byte{0x13} // key of initial genesis deposit by all resource nodes and meta nodes at t=0 - InitialUOzonePriceKey = []byte{0x14} // key of initial uoz price at t=0 - - ResourceNodeKey = []byte{0x21} // prefix for each key to a resource node - IndexingNodeKey = []byte{0x22} // prefix for each key to a indexing node - IndexingNodeRegistrationVotesKey = []byte{0x23} // prefix for each key to the vote for Indexing node registration - - UBDNodeKey = []byte{0x31} // prefix for each key to an unbonding node - - UBDNodeQueueKey = []byte{0x41} // prefix for the timestamps in unbonding node queue + ResourceNodeKey = []byte{0x01} // prefix for each key to a resource node + IndexingNodeKey = []byte{0x02} // prefix for each key to a indexing node + IndexingNodeRegistrationVotesKey = []byte{0x03} // prefix for each key to the vote for Indexing node registration + UpperBoundOfTotalOzoneKey = []byte{0x04} + SlashingPrefix = []byte{0x05} + InitialGenesisStakeTotalKey = []byte{0x06} // key of initial genesis deposit by all resource nodes and meta nodes at t=0 + InitialUOzonePriceKey = []byte{0x07} // key of initial uoz price at t=0 + + UBDNodeKey = []byte{0x11} // prefix for each key to an unbonding node + UBDNodeQueueKey = []byte{0x12} // prefix for the timestamps in unbonding node queue ) // GetResourceNodeKey gets the key for the resourceNode with address From efa51f2c8ec8425f29a8a1d7a02b277b24ec83d0 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 1 Jun 2022 18:11:44 -0400 Subject: [PATCH 085/113] completed create-resource-node and create-indexing-nodetx tesing --- proto/stratos/register/v1/register.proto | 9 + proto/stratos/register/v1/tx.proto | 14 +- x/register/client/cli/tx.go | 212 ++++++------- x/register/client/rest/tx.go | 2 +- x/register/keeper/keeper.go | 2 +- x/register/keeper/msg_server.go | 11 +- x/register/keeper/resource_node.go | 4 +- x/register/types/genesis.go | 18 +- x/register/types/indexing_node.go | 57 +--- x/register/types/msg.go | 39 ++- x/register/types/register.pb.go | 339 ++++++++++++++------- x/register/types/resource_node.go | 48 --- x/register/types/tx.pb.go | 372 +++++++++++------------ 13 files changed, 589 insertions(+), 538 deletions(-) diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index 99b8c361..3642dacd 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -38,6 +38,9 @@ message Params { } message ResourceNode { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" @@ -82,6 +85,9 @@ message ResourceNode { } message IndexingNode { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" @@ -142,6 +148,9 @@ message IndexingNodeRegistrationVotePool { } message Description { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + string moniker = 1 [ (gogoproto.jsontag) = "moniker", (gogoproto.moretags) = "yaml:\"moniker\"" diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto index bf898fd8..ef9520fb 100644 --- a/proto/stratos/register/v1/tx.proto +++ b/proto/stratos/register/v1/tx.proto @@ -46,7 +46,7 @@ service Msg { } -// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +// MsgCreateResourceNode encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. message MsgCreateResourceNode { string network_address = 1 [ (gogoproto.jsontag) = "network_address", @@ -76,10 +76,10 @@ message MsgCreateResourceNode { ]; } -// MsgCreateResourceNodeTxResponse defines the CreateResourceNodeTx response type +// MsgCreateResourceNodeResponse defines the CreateResourceNodeTx response type message MsgCreateResourceNodeResponse {} -// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +// MsgCreateIndexingNode encapsulates an MsgCreateIndexingNodeTx transaction as an SDK message. message MsgCreateIndexingNode { string network_address = 1 [ (gogoproto.jsontag) = "network_address", @@ -105,6 +105,10 @@ message MsgCreateIndexingNode { ]; } + +// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type +message MsgCreateIndexingNodeResponse {} + // MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message message MsgRemoveResourceNode { option (gogoproto.goproto_getters) = false; @@ -122,10 +126,6 @@ message MsgRemoveResourceNode { // MsgRemoveResourceNodeResponse defines the Msg/RemoveResourceNode response type. message MsgRemoveResourceNodeResponse {} -// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type -message MsgCreateIndexingNodeResponse {} - - // MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message message MsgRemoveIndexingNode { option (gogoproto.goproto_getters) = false; diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index 1123f776..eb912e9c 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -109,14 +109,16 @@ func CreateIndexingNodeCmd() *cobra.Command { _ = cmd.MarkFlagRequired(flags.FlagFrom) _ = cmd.MarkFlagRequired(FlagAmount) _ = cmd.MarkFlagRequired(FlagPubKey) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + _ = cmd.MarkFlagRequired(FlagMoniker) return cmd } func RemoveResourceNodeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "remove-resource-node [resource_node_address] [owner_address]", - Args: cobra.ExactArgs(2), + Use: "remove-resource-node [flag]", + //Args: cobra.ExactArgs(1), Short: "remove resource node", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -124,53 +126,82 @@ func RemoveResourceNodeCmd() *cobra.Command { return err } - resourceNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) - if err != nil { - return err - } - //ownerAddr := clientCtx.GetFromAddress() - ownerAddr, err := sdk.AccAddressFromBech32(args[1]) + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildRemoveResourceNodeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - - msg := types.NewMsgRemoveResourceNode(resourceNodeAddr, ownerAddr) - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + return cmd } func RemoveIndexingNodeCmd() *cobra.Command { + //cmd := &cobra.Command{ + // Use: "remove-indexing-node [indexing_node_address]", + // Args: cobra.ExactArgs(2), + // Short: "remove indexing node", + // RunE: func(cmd *cobra.Command, args []string) error { + // clientCtx, err := client.GetClientTxContext(cmd) + // if err != nil { + // return err + // } + // + // indexingNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) + // if err != nil { + // return err + // } + // ownerAddr := clientCtx.GetFromAddress() + // //ownerAddr, err := sdk.AccAddressFromBech32(args[1]) + // //if err != nil { + // // return err + // //} + // + // msg := types.NewMsgRemoveIndexingNode(indexingNodeAddr, ownerAddr) + // + // return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + // }, + //} + //_ = cmd.MarkFlagRequired(flags.FlagFrom) + // + //flags.AddTxFlagsToCmd(cmd) + // + //return cmd cmd := &cobra.Command{ - Use: "remove-indexing-node [indexing_node_address] [owner_address]", - Args: cobra.ExactArgs(2), - Short: "remove indexing node", + Use: "remove-indexing-node [flag]", + //Args: cobra.ExactArgs(1), + Short: "remove indeixng node", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - indexingNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) - if err != nil { - return err - } - //ownerAddr := clientCtx.GetFromAddress() - ownerAddr, err := sdk.AccAddressFromBech32(args[1]) + txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). + WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := newBuildRemoveIndexingNodeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } - - msg := types.NewMsgRemoveIndexingNode(indexingNodeAddr, ownerAddr) - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } + cmd.Flags().AddFlagSet(flagSetNetworkAddress()) flags.AddTxFlagsToCmd(cmd) + _ = cmd.MarkFlagRequired(flags.FlagFrom) + _ = cmd.MarkFlagRequired(FlagNetworkAddress) + return cmd } @@ -202,8 +233,8 @@ func UpdateResourceNodeCmd() *cobra.Command { flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagNetworkAddress) - _ = cmd.MarkFlagRequired(FlagMoniker) - _ = cmd.MarkFlagRequired(FlagNodeType) + //_ = cmd.MarkFlagRequired(FlagMoniker) + //_ = cmd.MarkFlagRequired(FlagNodeType) _ = cmd.MarkFlagRequired(flags.FlagFrom) return cmd @@ -236,7 +267,7 @@ func UpdateIndexingNodeCmd() *cobra.Command { flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(FlagNetworkAddress) - _ = cmd.MarkFlagRequired(FlagMoniker) + //_ = cmd.MarkFlagRequired(FlagMoniker) _ = cmd.MarkFlagRequired(FlagNetworkAddress) _ = cmd.MarkFlagRequired(flags.FlagFrom) @@ -378,22 +409,11 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, nil, err } - //var pk cryptotypes.PubKey - //if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(pkStr), &pk); err != nil { - // return txf, nil, err - //} - //pkStr := viper.GetString(FlagPubKey) - nodeTypeRef, err := fs.GetInt(FlagNodeType) if err != nil { return txf, nil, err } - //pubKey, er := stratos.SdsPubKeyFromBech32(pkStr) - //if er != nil { - // return txf, nil, err - //} - moniker, _ := fs.GetString(FlagMoniker) identity, _ := fs.GetString(FlagIdentity) website, _ := fs.GetString(FlagWebsite) @@ -407,14 +427,6 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs details, ) - //desc := types.NewDescription( - // viper.GetString(FlagMoniker), - // viper.GetString(FlagIdentity), - // viper.GetString(FlagWebsite), - // viper.GetString(FlagSecurityContact), - // viper.GetString(FlagDetails), - //) - // validate nodeTypeRef newNodeType := types.NodeType(nodeTypeRef) if t := newNodeType.Type(); t == "UNKNOWN" { @@ -428,7 +440,7 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs } // makes a new MsgCreateIndexingNode. -func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateResourceNode, error) { +func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateIndexingNode, error) { flagAmountStr, err := fs.GetString(FlagAmount) if err != nil { return txf, nil, err @@ -470,21 +482,6 @@ func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs security, details, ) - - //pkStr := viper.GetString(FlagPubKey) - - //pubKey, er := stratos.GetPubKeyFromBech32(stratos.Bech32PubKeyTypeSdsP2PPub, pkStr) - //if er != nil { - // return txf, nil, err - //} - // - //desc := types.NewDescription( - // viper.GetString(FlagMoniker), - // viper.GetString(FlagIdentity), - // viper.GetString(FlagWebsite), - // viper.GetString(FlagSecurityContact), - // viper.GetString(FlagDetails), - //) msg, er := types.NewMsgCreateIndexingNode(networkAddr, pubKey, amount, ownerAddr, &description) if er != nil { return txf, nil, err @@ -494,12 +491,6 @@ func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs // makes a new MsgUpdateResourceNode. func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateResourceNode, error) { - //networkAddrstr := viper.GetString(FlagNetworkAddress) - //networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) - //if err != nil { - // return txf, nil, err - //} - flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) if err != nil { return txf, nil, err @@ -526,44 +517,19 @@ func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs nodeTypeRef, err := fs.GetInt(FlagNodeType) if err != nil { - return txf, nil, err + return txf, nil, types.ErrInvalidNodeType } - //nodeTypeRef := viper.GetInt(FlagNodeType) - - //desc := types.NewDescription( - // viper.GetString(FlagMoniker), - // viper.GetString(FlagIdentity), - // viper.GetString(FlagWebsite), - // viper.GetString(FlagSecurityContact), - // viper.GetString(FlagDetails), - //) - - newNodeType := types.NodeType(nodeTypeRef) - if t := newNodeType.Type(); t == "UNKNOWN" { - return txf, nil, types.ErrNodeType + if nodeTypeRef > 7 || nodeTypeRef < 0 { + return txf, nil, types.ErrInvalidNodeType } - msg := types.NewMsgUpdateResourceNode(description, newNodeType, networkAddr, ownerAddr) + nodeTypeStr := strconv.Itoa(nodeTypeRef) + msg := types.NewMsgUpdateResourceNode(description, nodeTypeStr, networkAddr, ownerAddr) return txf, msg, nil } // makes a new MsgUpdateIndexingNode. func newBuildUpdateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNode, error) { - //desc := types.NewDescription( - // viper.GetString(FlagMoniker), - // viper.GetString(FlagIdentity), - // viper.GetString(FlagWebsite), - // viper.GetString(FlagSecurityContact), - // viper.GetString(FlagDetails), - //) - // - //networkAddrstr := viper.GetString(FlagNetworkAddress) - //networkAddr, err := stratos.SdsAddressFromBech32(networkAddrstr) - //if err != nil { - // return txf, nil, err - //} - //ownerAddr := clientCtx.GetFromAddress() - flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) if err != nil { return txf, nil, err @@ -626,24 +592,6 @@ func newBuildUpdateResourceNodeStakeMsg(clientCtx client.Context, txf tx.Factory // newBuildUpdateIndexingNodeStakeMsg makes a new UpdateIndexingNodeStakeMsg. func newBuildUpdateIndexingNodeStakeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNodeStake, error) { - //stakeDeltaStr := viper.GetString(FlagStakeDelta) - //stakeDelta, err := sdk.ParseCoinNormalized(stakeDeltaStr) - //if err != nil { - // return txf, nil, err - //} - // - //incrStakeStr := viper.GetString(FlagIncrStake) - //incrStake, err := strconv.ParseBool(incrStakeStr) - //if err != nil { - // return txf, nil, err - //} - // - //networkAddrStr := viper.GetString(FlagNetworkAddress) - //networkAddr, err := stratos.SdsAddressFromBech32(networkAddrStr) - //if err != nil { - // return txf, nil, err - //} - stakeDeltaStr, err := fs.GetString(FlagStakeDelta) if err != nil { return txf, nil, err @@ -712,3 +660,37 @@ func newBuildIndexingNodeRegistrationVoteMsg(clientCtx client.Context, txf tx.Fa msg := types.NewMsgIndexingNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, opinionVal, voterNetworkAddr, voterOwnerAddr) return txf, msg, nil } + +func newBuildRemoveResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgRemoveResourceNode, error) { + flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) + if err != nil { + return txf, nil, err + } + networkAddr, err := stratos.SdsAddressFromBech32(flagNetworkAddrStr) + if err != nil { + return txf, nil, err + } + + ownerAddr := clientCtx.GetFromAddress() + + msg := types.NewMsgRemoveResourceNode(networkAddr, ownerAddr) + + return txf, msg, nil +} + +func newBuildRemoveIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgRemoveIndexingNode, error) { + flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) + if err != nil { + return txf, nil, err + } + networkAddr, err := stratos.SdsAddressFromBech32(flagNetworkAddrStr) + if err != nil { + return txf, nil, err + } + + ownerAddr := clientCtx.GetFromAddress() + + msg := types.NewMsgRemoveIndexingNode(networkAddr, ownerAddr) + + return txf, msg, nil +} diff --git a/x/register/client/rest/tx.go b/x/register/client/rest/tx.go index 8f2fd085..4108ba48 100644 --- a/x/register/client/rest/tx.go +++ b/x/register/client/rest/tx.go @@ -309,7 +309,7 @@ func postUpdateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } msg := types.NewMsgUpdateResourceNode(req.Description, - types.NodeType(nodeTypeRef), networkAddr, ownerAddr) + string(types.NodeType(nodeTypeRef)), networkAddr, ownerAddr) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 1910dd87..dd8af73e 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -236,7 +236,7 @@ func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { } iter := keeper.GetIndexingNetworksIterator(ctx) for ; iter.Valid(); iter.Next() { - indexingNode := types.MustUnmarshalResourceNode(k.cdc, iter.Value()) + indexingNode := types.MustUnmarshalIndexingNode(k.cdc, iter.Value()) networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) if err != nil { continue diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 6e6c8997..10d38113 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -80,11 +80,11 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types.MsgCreateIndexingNode) (*types.MsgCreateIndexingNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + // check to see if the pubkey or sender has been registered before - pk, err := stratos.SdsPubKeyFromBech32(msg.Pubkey.String()) - if err != nil { - return nil, err - } + pkAny := msg.GetPubkey() + cachedPubkey := pkAny.GetCachedValue() + pk := cachedPubkey.(cryptotypes.PubKey) networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { @@ -274,7 +274,8 @@ func (k msgServer) HandleMsgUpdateResourceNode(goCtx context.Context, msg *types if err != nil { return &types.MsgUpdateResourceNodeResponse{}, err } - nodeType, err := strconv.ParseUint(msg.NodeType, 10, 8) + //nodeType, err := strconv.ParseUint(msg.NodeType, 10, 64) + nodeType, err := strconv.Atoi(msg.NodeType) if err != nil { return &types.MsgUpdateResourceNodeResponse{}, err } diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index e7fff9bc..5746da93 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -312,7 +312,9 @@ func (k Keeper) UpdateResourceNode(ctx sdk.Context, description types.Descriptio } node.Description = &description - node.NodeType = nodeType.String() + if nodeType != 0 { + node.NodeType = nodeType.String() + } k.SetResourceNode(ctx, node) diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index ce784b90..b0a19e62 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" ) @@ -108,10 +109,17 @@ func (g GenesisState) UnpackInterfaces(c codectypes.AnyUnpacker) error { return err } } - for i := range g.ResourceNodes.ResourceNodes { - if err := g.ResourceNodes.ResourceNodes[i].UnpackInterfaces(c); err != nil { - return err - } - } + //for i := range g.ResourceNodes.ResourceNodes { + // if err := g.ResourceNodes.ResourceNodes[i].UnpackInterfaces(c); err != nil { + // return err + // } + + //} return nil } + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (v GenesisIndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(v.Pubkey, &pk) +} diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index ff9facc6..74549ce3 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "fmt" "time" @@ -13,38 +12,6 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -// IndexingNodes is a collection of indexing node -//type IndexingNodes []IndexingNode - -//func (v IndexingNodes) String() (out string) { -// for _, node := range v { -// out += node.String() + "\n" -// } -// return strings.TrimSpace(out) -//} - -//Sort IndexingNodes sorts IndexingNode array in ascending owner address order -//func (v IndexingNodes) Sort() { -// sort.Sort(v.GetIndexingNodes()) -//} - -//// Len Implements sort interface -//func (v IndexingNodes) Len() int { -// return len(v.GetIndexingNodes()) -//} -// -//// Less Implements sort interface -//func (v IndexingNodes) Less(i, j int) bool { -// return v.GetIndexingNodes()[i].Tokens < (v.GetIndexingNodes()[j].Tokens) -//} -// -//// Swap Implements sort interface -//func (v IndexingNodes) Swap(i, j int) { -// it := v.GetIndexingNodes()[i] -// v.GetIndexingNodes()[i] = v.GetIndexingNodes()[j] -// v.GetIndexingNodes()[j] = it -//} - func (v IndexingNodes) Validate() error { for _, node := range v.GetIndexingNodes() { if err := node.Validate(); err != nil { @@ -122,14 +89,14 @@ func (v IndexingNode) Validate() error { if netAddr.Empty() { return ErrEmptyNodeNetworkAddress } - pkAny := v.GetPubkey() - - pubkey, ok := pkAny.GetCachedValue().(cryptotypes.PubKey) - if !ok { - return ErrUnknownPubKey + pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) + if err != nil { + return err + } + sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) + if err != nil { + return err } - - sdsAddr := stratos.SdsAddress(pubkey.Address()) if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr @@ -258,11 +225,11 @@ func UnmarshalIndexingNodeRegistrationVotePool(cdc codec.Codec, value []byte) (v return votePool, err } -func (v1 IndexingNode) Equal(v2 IndexingNode) bool { - bz1 := ModuleCdc.MustMarshalLengthPrefixed(&v1) - bz2 := ModuleCdc.MustMarshalLengthPrefixed(&v2) - return bytes.Equal(bz1, bz2) -} +//func (v1 IndexingNode) Equal(v2 IndexingNode) bool { +// bz1 := ModuleCdc.MustMarshalLengthPrefixed(&v1) +// bz2 := ModuleCdc.MustMarshalLengthPrefixed(&v2) +// return bytes.Equal(bz1, bz2) +//} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (v IndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { diff --git a/x/register/types/msg.go b/x/register/types/msg.go index cf394fe4..24fb1e33 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -46,7 +46,10 @@ func NewMsgCreateResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes if pkAny, err = codectypes.NewAnyWithValue(pubKey); err != nil { return nil, err } + } else { + return nil, ErrEmptyPubKey } + return &MsgCreateResourceNode{ NetworkAddress: networkAddr.String(), Pubkey: pkAny, @@ -70,9 +73,7 @@ func (msg MsgCreateResourceNode) ValidateBasic() error { if netAddr.Empty() { return ErrEmptyNodeNetworkAddress } - pk := msg.GetPubkey() - cachedPubkey := pk.GetCachedValue() - pkAny := cachedPubkey.(cryptotypes.PubKey) + pkAny := msg.GetPubkey().GetCachedValue().(cryptotypes.PubKey) sdsAddr := sdk.AccAddress(pkAny.Address()) if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr @@ -127,18 +128,21 @@ func (msg MsgCreateResourceNode) UnpackInterfaces(unpacker codectypes.AnyUnpacke return unpacker.UnpackAny(msg.Pubkey, &pk) } -// NewMsgCreateIndexingNode NewMsg creates a new Msg instance +// NewMsgCreateIndexingNode creates a new Msg instance func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, -) (*MsgCreateResourceNode, error) { +) (*MsgCreateIndexingNode, error) { var pkAny *codectypes.Any if pubKey != nil { var err error if pkAny, err = codectypes.NewAnyWithValue(pubKey); err != nil { return nil, err } + } else { + return nil, ErrEmptyPubKey } - return &MsgCreateResourceNode{ + + return &MsgCreateIndexingNode{ NetworkAddress: networkAddr.String(), Pubkey: pkAny, Value: value, @@ -160,14 +164,8 @@ func (msg MsgCreateIndexingNode) ValidateBasic() error { return ErrEmptyNodeNetworkAddress } - pkAny, err := codectypes.NewAnyWithValue(msg.GetPubkey()) - if err != nil { - return err - } - sdsAddr, err := stratos.SdsAddressFromBech32(pkAny.String()) - if err != nil { - return err - } + pkAny := msg.GetPubkey().GetCachedValue().(cryptotypes.PubKey) + sdsAddr := sdk.AccAddress(pkAny.Address()) if !netAddr.Equals(sdsAddr) { return ErrInvalidNetworkAddr } @@ -190,6 +188,7 @@ func (msg MsgCreateIndexingNode) ValidateBasic() error { if *msg.GetDescription() == (Description{}) { return ErrEmptyDescription } + return nil } @@ -312,12 +311,12 @@ func (msg MsgRemoveIndexingNode) ValidateBasic() error { return nil } -func NewMsgUpdateResourceNode(description Description, nodeType NodeType, +func NewMsgUpdateResourceNode(description Description, nodeType string, networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress) *MsgUpdateResourceNode { return &MsgUpdateResourceNode{ Description: description, - NodeType: nodeType.Type(), + NodeType: nodeType, NetworkAddress: networkAddress.String(), OwnerAddress: ownerAddress.String(), } @@ -362,15 +361,15 @@ func (msg MsgUpdateResourceNode) ValidateBasic() error { return ErrEmptyOwnerAddr } - if msg.Description.Moniker == "" { - return ErrEmptyMoniker - } + //if msg.Description.Moniker == "" { + // return ErrEmptyMoniker + //} nodeTypeNum, err := strconv.Atoi(msg.NodeType) if err != nil { return ErrInvalidNodeType } - if nodeTypeNum > 7 || nodeTypeNum < 1 { + if nodeTypeNum > 7 || nodeTypeNum < 0 { return ErrInvalidNodeType } return nil diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index e8d893b1..e11ed822 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -974,112 +974,243 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1648 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1c, 0x49, - 0x15, 0xf7, 0xcc, 0xc4, 0x5f, 0x35, 0x1f, 0x36, 0x6d, 0x2f, 0x19, 0x1b, 0x70, 0x39, 0xc5, 0xc7, - 0x1a, 0x2d, 0x9e, 0x91, 0x13, 0x24, 0x04, 0x07, 0xa4, 0x74, 0x6c, 0xb2, 0xde, 0x85, 0xc8, 0x6a, - 0x9b, 0x5d, 0x05, 0x29, 0x1a, 0x7a, 0xba, 0x2b, 0xe3, 0x8a, 0x67, 0xaa, 0x46, 0x5d, 0x35, 0xb6, - 0xe7, 0x86, 0xc4, 0x1f, 0x40, 0x8e, 0x39, 0x72, 0x46, 0xe2, 0xc6, 0x1f, 0x11, 0xe5, 0x94, 0x23, - 0xe2, 0xd0, 0xa0, 0x84, 0xd3, 0x48, 0x5c, 0xfa, 0x06, 0x27, 0x54, 0x1f, 0x3d, 0x5d, 0xdd, 0x76, - 0x34, 0x04, 0xc8, 0x01, 0xe4, 0xd3, 0x74, 0xfd, 0x5e, 0xbd, 0xdf, 0x7b, 0x55, 0xaf, 0xde, 0xab, - 0x37, 0x05, 0x10, 0x17, 0x91, 0x2f, 0x18, 0x6f, 0x47, 0xb8, 0x47, 0xb8, 0xc0, 0x51, 0xfb, 0x7c, - 0x6f, 0xfa, 0xdd, 0x1a, 0x46, 0x4c, 0x30,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0x79, - 0x06, 0xaa, 0xf8, 0x72, 0x48, 0x22, 0xac, 0x43, 0x70, 0x6b, 0x66, 0x08, 0x76, 0x4d, 0x08, 0x6c, - 0xb5, 0xcc, 0x8e, 0x05, 0xea, 0xed, 0x07, 0x1a, 0x51, 0x9b, 0xff, 0xf7, 0x32, 0xa8, 0x5a, 0x87, - 0x46, 0x26, 0xec, 0x80, 0x51, 0x72, 0x86, 0x23, 0xb3, 0xbf, 0x2a, 0x61, 0x0d, 0x94, 0x25, 0xac, - 0x01, 0x90, 0x97, 0x8a, 0x9c, 0x03, 0xb0, 0x44, 0x42, 0x4c, 0x05, 0x11, 0xba, 0x9c, 0xe8, 0xf3, - 0x3e, 0xc5, 0x92, 0x18, 0x6e, 0x68, 0xd5, 0x14, 0xb1, 0xdb, 0x85, 0xe9, 0x34, 0xe7, 0x3e, 0x58, - 0xbc, 0xc0, 0x5d, 0x4e, 0x84, 0x6e, 0x87, 0x74, 0x28, 0x52, 0x28, 0x89, 0x61, 0x53, 0x93, 0x18, - 0xc0, 0xe6, 0x48, 0x27, 0x39, 0x21, 0x58, 0xe5, 0x38, 0x18, 0x45, 0x44, 0x8c, 0x3b, 0x01, 0xa3, - 0xc2, 0x0f, 0x84, 0xda, 0xc3, 0x65, 0xf7, 0x87, 0x93, 0x18, 0x5e, 0x91, 0x25, 0x31, 0xbc, 0x63, - 0x4a, 0x45, 0x41, 0x62, 0xb3, 0xaf, 0xa4, 0xc2, 0x07, 0x5a, 0x26, 0x1d, 0x0d, 0xb1, 0xf0, 0x49, - 0x3f, 0x2d, 0x24, 0xca, 0x51, 0x03, 0x65, 0x8e, 0x1a, 0x20, 0xe7, 0x68, 0x8a, 0xfd, 0xa6, 0x04, - 0x96, 0x8e, 0xfb, 0x3e, 0x3f, 0x25, 0xb4, 0xe7, 0x78, 0xa0, 0x71, 0xe1, 0xf7, 0xfb, 0x58, 0x14, - 0xce, 0xf7, 0x27, 0x93, 0x18, 0x16, 0x24, 0x49, 0x0c, 0x3f, 0x32, 0xdb, 0x90, 0xc3, 0x91, 0x57, - 0xd7, 0x40, 0x7a, 0xb8, 0xdb, 0x60, 0xfe, 0xdc, 0xef, 0x8f, 0x74, 0xf3, 0x5b, 0x71, 0x37, 0x26, - 0x31, 0xd4, 0x40, 0x12, 0xc3, 0x9a, 0x66, 0x50, 0x43, 0xe4, 0x69, 0x18, 0x3d, 0x06, 0x75, 0xbb, - 0x53, 0xe3, 0xce, 0xa7, 0xa0, 0x11, 0x19, 0xa0, 0x23, 0x2f, 0x28, 0xe9, 0x55, 0x65, 0xa7, 0x7a, - 0xf7, 0xce, 0xb5, 0xd5, 0xc7, 0xd6, 0xf5, 0xea, 0x91, 0xcd, 0x24, 0xa9, 0xed, 0x24, 0x57, 0xd4, - 0xc4, 0x00, 0xff, 0x02, 0x75, 0xae, 0x40, 0xd4, 0x89, 0xcd, 0x84, 0x7e, 0x57, 0x01, 0x6b, 0x27, - 0x4c, 0xf8, 0xfd, 0x63, 0xe1, 0x9f, 0x61, 0xee, 0x61, 0x3e, 0x64, 0x94, 0xcb, 0x7b, 0x73, 0x33, - 0xef, 0x7c, 0x47, 0xc8, 0x59, 0x1d, 0x79, 0x85, 0x60, 0xb5, 0xbd, 0xb2, 0xdb, 0x36, 0xf7, 0x8a, - 0xfc, 0x2b, 0x33, 0xbd, 0x54, 0x1e, 0x30, 0x42, 0xbd, 0xdb, 0xb9, 0x05, 0x64, 0x06, 0x24, 0x6f, - 0xde, 0xf3, 0x1c, 0x6f, 0x79, 0x26, 0x6f, 0xce, 0x7b, 0x8b, 0xf7, 0x21, 0x70, 0x34, 0x91, 0xec, - 0xcc, 0x71, 0x68, 0xf8, 0x2a, 0xb3, 0xf8, 0x56, 0x95, 0x92, 0xab, 0x74, 0x34, 0xd1, 0xe7, 0x60, - 0x5d, 0x13, 0xe9, 0x26, 0x7f, 0x4a, 0x75, 0x6b, 0x16, 0x95, 0xb6, 0xff, 0x73, 0xa3, 0xa5, 0xc9, - 0x7e, 0x06, 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d, 0x9a, 0x7b, 0xfd, - 0x76, 0x6b, 0xee, 0x8f, 0x6f, 0xb7, 0xe6, 0x7e, 0xf1, 0x7d, 0xcb, 0x82, 0x49, 0x2a, 0x8a, 0x45, - 0xfa, 0xb9, 0x1b, 0x9c, 0xfa, 0x84, 0xb6, 0x2f, 0xb3, 0x97, 0x7b, 0x65, 0xb3, 0xbb, 0xa0, 0xce, - 0xe7, 0xbd, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x86, 0xf6, 0xec, 0x5d, 0xda, 0x17, 0x00, 0x00, + // 1665 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1b, 0xb9, + 0x15, 0xb7, 0xa4, 0xf8, 0x8b, 0xfa, 0xb0, 0x3b, 0xf6, 0x36, 0xb2, 0xdb, 0x9a, 0x0e, 0xfb, 0xb1, + 0x2e, 0xb6, 0x96, 0xe0, 0xa4, 0x40, 0xd1, 0x3d, 0x14, 0xc8, 0xc4, 0x6e, 0xd6, 0xbb, 0x6d, 0x60, + 0x8c, 0xdd, 0x5d, 0x6c, 0x81, 0x85, 0x3a, 0x9a, 0xe1, 0xca, 0x5c, 0x4b, 0xa4, 0x30, 0xa4, 0x6c, + 0xeb, 0x56, 0x20, 0x7f, 0x40, 0x73, 0xcc, 0x31, 0xe7, 0x9e, 0x0b, 0xf4, 0x5f, 0x08, 0x72, 0xca, + 0xb1, 0xe8, 0x61, 0x5a, 0x24, 0x3d, 0x14, 0x3a, 0xce, 0xa5, 0x40, 0x4f, 0x05, 0x3f, 0x46, 0xc3, + 0x19, 0x3b, 0x50, 0xd3, 0x36, 0x87, 0x2e, 0x7c, 0x92, 0xf8, 0x7b, 0x7c, 0xbf, 0xf7, 0xc8, 0xc7, + 0xf7, 0xf8, 0x86, 0x00, 0x71, 0x11, 0xf9, 0x82, 0xf1, 0x76, 0x84, 0x7b, 0x84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0x7e, 0x57, + 0x02, 0x4b, 0xc7, 0x7d, 0x9f, 0x9f, 0x12, 0xda, 0x73, 0x3c, 0xd0, 0xb8, 0xf0, 0xfb, 0x7d, 0x2c, + 0x0a, 0x27, 0xfd, 0x83, 0x49, 0x0c, 0x0b, 0x92, 0x24, 0x86, 0xef, 0x99, 0x0d, 0xc9, 0xe1, 0xc8, + 0xab, 0x6b, 0x20, 0x3d, 0xe6, 0x6d, 0x30, 0x7f, 0xee, 0xf7, 0x47, 0xba, 0x35, 0xae, 0xb8, 0x1b, + 0x93, 0x18, 0x6a, 0x20, 0x89, 0x61, 0x4d, 0x33, 0xa8, 0x21, 0xf2, 0x34, 0x8c, 0x3e, 0x07, 0x75, + 0xbb, 0x8f, 0xe3, 0xce, 0x47, 0xa0, 0x11, 0x19, 0xa0, 0x23, 0xaf, 0x2f, 0xe9, 0x55, 0x65, 0xa7, + 0x7a, 0xf7, 0xce, 0xb5, 0x15, 0xc9, 0xd6, 0xf5, 0xea, 0x91, 0xcd, 0x24, 0xa9, 0xed, 0x74, 0x57, + 0xd4, 0xc4, 0x00, 0xff, 0x06, 0x75, 0xae, 0x54, 0xd4, 0x89, 0xcd, 0x84, 0x7e, 0x5f, 0x01, 0x6b, + 0x27, 0x4c, 0xf8, 0xfd, 0x63, 0xe1, 0x9f, 0x61, 0xee, 0x61, 0x3e, 0x64, 0x94, 0xcb, 0xbb, 0x74, + 0x33, 0xef, 0x7c, 0x47, 0xc8, 0x59, 0x1d, 0x79, 0xad, 0x60, 0xb5, 0xbd, 0xb2, 0x17, 0x37, 0x77, + 0x8d, 0xfc, 0xd0, 0x99, 0x5e, 0x34, 0x0f, 0x18, 0xa1, 0xde, 0xed, 0xdc, 0x02, 0x32, 0x03, 0x92, + 0x37, 0xef, 0x79, 0x8e, 0xb7, 0x3c, 0x93, 0x37, 0xe7, 0xbd, 0xc5, 0xfb, 0x10, 0x38, 0x9a, 0x48, + 0xf6, 0xed, 0x38, 0x34, 0x7c, 0x95, 0x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b, 0x7c, 0xb4, 0xef, 0xe3, 0x60, 0x56, 0x8f, 0xeb, 0x3e, 0x7a, 0xfe, + 0x6a, 0xab, 0xf4, 0xf2, 0xd5, 0x56, 0xe9, 0xaf, 0xaf, 0xb6, 0x4a, 0x4f, 0x5e, 0x6f, 0xcd, 0xbd, + 0x7c, 0xbd, 0x35, 0xf7, 0xa7, 0xd7, 0x5b, 0x73, 0xbf, 0xfe, 0xb1, 0x65, 0xc1, 0x24, 0x15, 0xc5, + 0x22, 0xfd, 0xbb, 0x1b, 0x9c, 0xfa, 0x84, 0xb6, 0x2f, 0xb3, 0x77, 0x7d, 0x65, 0xb3, 0xbb, 0xa0, + 0xce, 0xe7, 0xbd, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xb5, 0xc0, 0x8c, 0x38, 0xf8, 0x17, 0x00, + 0x00, +} + +func (this *ResourceNode) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ResourceNode) + if !ok { + that2, ok := that.(ResourceNode) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.NetworkAddress != that1.NetworkAddress { + return false + } + if !this.Pubkey.Equal(that1.Pubkey) { + return false + } + if this.Suspend != that1.Suspend { + return false + } + if this.Status != that1.Status { + return false + } + if !this.Tokens.Equal(that1.Tokens) { + return false + } + if this.OwnerAddress != that1.OwnerAddress { + return false + } + if !this.Description.Equal(that1.Description) { + return false + } + if !this.CreationTime.Equal(that1.CreationTime) { + return false + } + if this.NodeType != that1.NodeType { + return false + } + return true } +func (this *IndexingNode) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + that1, ok := that.(*IndexingNode) + if !ok { + that2, ok := that.(IndexingNode) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.NetworkAddress != that1.NetworkAddress { + return false + } + if !this.Pubkey.Equal(that1.Pubkey) { + return false + } + if this.Suspend != that1.Suspend { + return false + } + if this.Status != that1.Status { + return false + } + if !this.Tokens.Equal(that1.Tokens) { + return false + } + if this.OwnerAddress != that1.OwnerAddress { + return false + } + if !this.Description.Equal(that1.Description) { + return false + } + if !this.CreationTime.Equal(that1.CreationTime) { + return false + } + return true +} +func (this *Description) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Description) + if !ok { + that2, ok := that.(Description) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Moniker != that1.Moniker { + return false + } + if this.Identity != that1.Identity { + return false + } + if this.Website != that1.Website { + return false + } + if this.SecurityContact != that1.SecurityContact { + return false + } + if this.Details != that1.Details { + return false + } + return true +} func (m *Params) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index e8865d2e..d28da2ed 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "fmt" "strconv" "strings" @@ -13,7 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/evm/types" ) type NodeType uint8 @@ -48,31 +46,6 @@ func (n NodeType) String() string { return n.Type() } -// ResourceNodes is a collection of resource node -//type ResourceNodes []ResourceNode - -//func (v ResourceNodes) String() (out string) { -// for _, node := range v { -// out += node.String() + "\n" -// } -// return strings.TrimSpace(out) -//} - -// Sort ResourceNodes sorts ResourceNode array in ascending owner address order -//func (v ResourceNodes) Sort() { -// sort.Sort(v) -//} -// -//// Len implements sort interface -//func (v ResourceNodes) Len() int { -// return len(v.ResourceNodes) -//} -// -//// Less implements sort interface -//func (v ResourceNodes) Less(i, j int) bool { -// return v.GetResourceNodes()[i].Tokens < v.GetResourceNodes()[j].Tokens -//} - func (v ResourceNodes) Validate() error { for _, node := range v.GetResourceNodes() { if err := node.Validate(); err != nil { @@ -228,21 +201,6 @@ func UnmarshalResourceNode(cdc codec.BinaryCodec, value []byte) (v ResourceNode, return v, err } -func (v1 ResourceNode) Equal(v2 ResourceNode) bool { - bz1 := types.ModuleCdc.MustMarshalLengthPrefixed(&v1) - bz2 := types.ModuleCdc.MustMarshalLengthPrefixed(&v2) - return bytes.Equal(bz1, bz2) -} - -// GetOwnerAddr -//func (s *Staking) GetNetworkAddress() stratos.SdsAddress { -// networkAddr, err := stratos.SdsAddressFromBech32(s.NetworkAddress) -// if err != nil { -// panic(err) -// } -// return networkAddr -//} - func (s *Staking) GetOwnerAddr() sdk.AccAddress { addr, err := sdk.AccAddressFromBech32(s.OwnerAddress) if err != nil { @@ -252,12 +210,6 @@ func (s *Staking) GetOwnerAddr() sdk.AccAddress { } func (s *Staking) GetShares() sdk.Dec { return s.Value } -// String returns a human readable string representation of a node. -//func (s *Staking) String() string { -// out, _ := yaml.Marshal(s) -// return string(out) -//} - // Stakings is a collection of Staking type Stakings []Staking diff --git a/x/register/types/tx.pb.go b/x/register/types/tx.pb.go index 5dff01d8..3a334362 100644 --- a/x/register/types/tx.pb.go +++ b/x/register/types/tx.pb.go @@ -32,7 +32,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +// MsgCreateResourceNode encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. type MsgCreateResourceNode struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` @@ -117,7 +117,7 @@ func (m *MsgCreateResourceNode) GetNodeType() string { return "" } -// MsgCreateResourceNodeTxResponse defines the CreateResourceNodeTx response type +// MsgCreateResourceNodeResponse defines the CreateResourceNodeTx response type type MsgCreateResourceNodeResponse struct { } @@ -154,7 +154,7 @@ func (m *MsgCreateResourceNodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateResourceNodeResponse proto.InternalMessageInfo -// MsgCreateResourceNodeTx encapsulates an MsgCreateResourceNodeTx transaction as an SDK message. +// MsgCreateIndexingNode encapsulates an MsgCreateIndexingNodeTx transaction as an SDK message. type MsgCreateIndexingNode struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` @@ -231,6 +231,43 @@ func (m *MsgCreateIndexingNode) GetDescription() *Description { return nil } +// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type +type MsgCreateIndexingNodeResponse struct { +} + +func (m *MsgCreateIndexingNodeResponse) Reset() { *m = MsgCreateIndexingNodeResponse{} } +func (m *MsgCreateIndexingNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateIndexingNodeResponse) ProtoMessage() {} +func (*MsgCreateIndexingNodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75d4b90d7a185a31, []int{3} +} +func (m *MsgCreateIndexingNodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateIndexingNodeResponse.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 *MsgCreateIndexingNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateIndexingNodeResponse.Merge(m, src) +} +func (m *MsgCreateIndexingNodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateIndexingNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateIndexingNodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateIndexingNodeResponse proto.InternalMessageInfo + // MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message type MsgRemoveResourceNode struct { ResourceNodeAddress string `protobuf:"bytes,1,opt,name=resource_node_address,json=resourceNodeAddress,proto3" json:"resource_node_address" yaml:"resource_node_address"` @@ -241,7 +278,7 @@ func (m *MsgRemoveResourceNode) Reset() { *m = MsgRemoveResourceNode{} } func (m *MsgRemoveResourceNode) String() string { return proto.CompactTextString(m) } func (*MsgRemoveResourceNode) ProtoMessage() {} func (*MsgRemoveResourceNode) Descriptor() ([]byte, []int) { - return fileDescriptor_75d4b90d7a185a31, []int{3} + return fileDescriptor_75d4b90d7a185a31, []int{4} } func (m *MsgRemoveResourceNode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -278,7 +315,7 @@ func (m *MsgRemoveResourceNodeResponse) Reset() { *m = MsgRemoveResource func (m *MsgRemoveResourceNodeResponse) String() string { return proto.CompactTextString(m) } func (*MsgRemoveResourceNodeResponse) ProtoMessage() {} func (*MsgRemoveResourceNodeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_75d4b90d7a185a31, []int{4} + return fileDescriptor_75d4b90d7a185a31, []int{5} } func (m *MsgRemoveResourceNodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -307,43 +344,6 @@ func (m *MsgRemoveResourceNodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveResourceNodeResponse proto.InternalMessageInfo -// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type -type MsgCreateIndexingNodeResponse struct { -} - -func (m *MsgCreateIndexingNodeResponse) Reset() { *m = MsgCreateIndexingNodeResponse{} } -func (m *MsgCreateIndexingNodeResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateIndexingNodeResponse) ProtoMessage() {} -func (*MsgCreateIndexingNodeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_75d4b90d7a185a31, []int{5} -} -func (m *MsgCreateIndexingNodeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateIndexingNodeResponse.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 *MsgCreateIndexingNodeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateIndexingNodeResponse.Merge(m, src) -} -func (m *MsgCreateIndexingNodeResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateIndexingNodeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateIndexingNodeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateIndexingNodeResponse proto.InternalMessageInfo - // MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message type MsgRemoveIndexingNode struct { IndexingNodeAddress string `protobuf:"bytes,1,opt,name=indexing_node_address,json=indexingNodeAddress,proto3" json:"indexing_node_address" yaml:"indexing_node_address"` @@ -816,9 +816,9 @@ func init() { proto.RegisterType((*MsgCreateResourceNode)(nil), "stratos.register.v1.MsgCreateResourceNode") proto.RegisterType((*MsgCreateResourceNodeResponse)(nil), "stratos.register.v1.MsgCreateResourceNodeResponse") proto.RegisterType((*MsgCreateIndexingNode)(nil), "stratos.register.v1.MsgCreateIndexingNode") + proto.RegisterType((*MsgCreateIndexingNodeResponse)(nil), "stratos.register.v1.MsgCreateIndexingNodeResponse") proto.RegisterType((*MsgRemoveResourceNode)(nil), "stratos.register.v1.MsgRemoveResourceNode") proto.RegisterType((*MsgRemoveResourceNodeResponse)(nil), "stratos.register.v1.MsgRemoveResourceNodeResponse") - proto.RegisterType((*MsgCreateIndexingNodeResponse)(nil), "stratos.register.v1.MsgCreateIndexingNodeResponse") proto.RegisterType((*MsgRemoveIndexingNode)(nil), "stratos.register.v1.MsgRemoveIndexingNode") proto.RegisterType((*MsgRemoveIndexingNodeResponse)(nil), "stratos.register.v1.MsgRemoveIndexingNodeResponse") proto.RegisterType((*MsgUpdateResourceNode)(nil), "stratos.register.v1.MsgUpdateResourceNode") @@ -836,14 +836,14 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/tx.proto", fileDescriptor_75d4b90d7a185a31) } var fileDescriptor_75d4b90d7a185a31 = []byte{ - // 1236 bytes of a gzipped FileDescriptorProto + // 1233 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0xe3, 0xc4, 0x1b, 0xae, 0xd3, 0xb4, 0xbf, 0x76, 0xba, 0xdd, 0x1f, 0x9b, 0xb6, 0xd0, 0x86, 0x36, 0x53, 0x06, 0x56, 0x6c, 0x41, 0xb5, 0x95, 0x6e, 0xa1, 0x62, 0xb5, 0x20, 0x35, 0xbb, 0x07, 0x10, 0x6a, 0x41, 0x06, 0xf6, 0xc0, 0x25, 0x72, 0x92, 0x21, 0x6b, 0xb5, 0xf1, 0x44, 0xb6, 0x93, 0x6d, 0x0e, 0x5c, 0x38, 0x71, 0x44, 0xe2, 0x8c, 0x84, 0xc4, 0x3f, 0xb0, 0x87, 0xfd, 0x17, 0x90, 0x56, 0x9c, 0x56, 0xe2, 0x02, 0x12, 0x8c, 0x50, 0xcb, 0x01, 0xf9, 0x86, 0x05, 0x77, 0xe4, 0x19, 0xdb, 0xf1, 0xc7, - 0xd8, 0x71, 0xf7, 0x83, 0x03, 0xea, 0x2d, 0xf3, 0x7e, 0x78, 0x9e, 0xf7, 0x79, 0x1f, 0xcf, 0xbc, + 0xd8, 0x71, 0xf7, 0x83, 0x03, 0xea, 0x2d, 0xf3, 0x7e, 0x78, 0x9e, 0xf7, 0x7d, 0x1e, 0xcf, 0xbc, 0x0e, 0x58, 0xb7, 0x6c, 0x53, 0xb3, 0x89, 0xa5, 0x98, 0xb8, 0xab, 0x5b, 0x36, 0x36, 0x95, 0x61, 0x5d, 0xb1, 0x4f, 0xe4, 0xbe, 0x49, 0x6c, 0x52, 0x59, 0xf2, 0xbd, 0x72, 0xe0, 0x95, 0x87, 0xf5, 0xea, 0x72, 0x97, 0x74, 0x09, 0xf3, 0x2b, 0xde, 0x2f, 0x1e, 0x5a, 0x5d, 0xeb, 0x12, 0xd2, 0x3d, @@ -856,65 +856,65 @@ var fileDescriptor_75d4b90d7a185a31 = []byte{ 0x96, 0xb5, 0x2a, 0x6d, 0x4a, 0xd7, 0xe6, 0x1b, 0xdb, 0x0e, 0x85, 0x49, 0x97, 0x4b, 0xe1, 0xf3, 0x23, 0xad, 0x77, 0x7c, 0x03, 0x25, 0x1c, 0x48, 0xbd, 0xec, 0x5b, 0xf6, 0xb9, 0xa1, 0xa2, 0x81, 0xd9, 0xfe, 0xa0, 0x75, 0x84, 0x47, 0xab, 0xa5, 0x4d, 0xe9, 0xda, 0xc2, 0xce, 0xb2, 0xcc, 0xeb, - 0x97, 0x03, 0x6a, 0xe4, 0x7d, 0x63, 0xd4, 0xb8, 0xee, 0x50, 0xe8, 0xc7, 0xb9, 0x14, 0x2e, 0xf2, - 0x67, 0xf3, 0x35, 0xfa, 0xe1, 0xc1, 0xf6, 0xb2, 0x4f, 0x44, 0xdb, 0x1c, 0xf5, 0x6d, 0x22, 0x7f, - 0x38, 0x68, 0xbd, 0x8f, 0x47, 0xaa, 0x9f, 0x50, 0x39, 0x04, 0x33, 0x43, 0xed, 0x78, 0x80, 0x57, - 0xa7, 0xd9, 0x0e, 0x6b, 0xb2, 0x1f, 0xed, 0x91, 0x20, 0xfb, 0x24, 0xc8, 0xb7, 0x88, 0x6e, 0x34, - 0x36, 0x1e, 0x52, 0x38, 0xe5, 0x50, 0xc8, 0xe3, 0x5d, 0x0a, 0x2f, 0xf1, 0x9d, 0xd8, 0x12, 0xa9, - 0xdc, 0x5c, 0x39, 0x04, 0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, 0x04, 0xd3, 0x07, 0x56, 0xb7, 0x72, - 0x5f, 0x02, 0x2f, 0xbe, 0xab, 0x19, 0x9d, 0x63, 0x2c, 0xfe, 0xaa, 0x7d, 0x4d, 0x78, 0xcd, 0x09, - 0x63, 0xab, 0x3b, 0xc5, 0x63, 0x43, 0x95, 0xd7, 0xbf, 0xf8, 0xf1, 0xf7, 0xaf, 0x4b, 0xaf, 0xa3, - 0x2d, 0x45, 0xf4, 0x71, 0xde, 0x66, 0x89, 0xcd, 0xd8, 0xd8, 0x1b, 0x87, 0x2c, 0x98, 0xb3, 0x33, - 0x21, 0xa7, 0x63, 0xb3, 0x21, 0xe7, 0x4c, 0xb8, 0xf9, 0x90, 0x4d, 0x96, 0x98, 0x07, 0x59, 0x30, - 0xf9, 0x65, 0x42, 0x4e, 0xc7, 0x66, 0x43, 0xce, 0x99, 0x6d, 0xf2, 0x21, 0x0f, 0x58, 0x62, 0x02, - 0xf2, 0xf7, 0x12, 0xd8, 0xcc, 0x81, 0xcc, 0x8f, 0x4d, 0xa5, 0x38, 0x16, 0x96, 0x50, 0xdd, 0x3b, - 0x67, 0x42, 0x58, 0xc1, 0x1e, 0xab, 0xa0, 0x8e, 0x94, 0xc2, 0x15, 0xf0, 0x53, 0x5e, 0x24, 0xf0, - 0xd8, 0x70, 0x37, 0x41, 0xe0, 0xd1, 0xd8, 0x49, 0x02, 0x17, 0x8e, 0x3f, 0x85, 0x04, 0x1e, 0xfb, - 0x6c, 0x11, 0x09, 0xbc, 0x18, 0xe4, 0x74, 0xec, 0x24, 0x81, 0x3f, 0x06, 0x64, 0x5f, 0xe0, 0x39, - 0x90, 0x05, 0x23, 0xf4, 0x04, 0x81, 0x17, 0x83, 0x9c, 0x33, 0x64, 0x16, 0x12, 0x78, 0x1c, 0xb2, - 0x40, 0xe0, 0xe9, 0x19, 0x48, 0x29, 0x8e, 0xa5, 0x90, 0xc0, 0xb3, 0xaf, 0xfb, 0x42, 0x02, 0x8f, - 0x7f, 0xde, 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, 0x21, 0x85, 0x53, 0x0e, 0x85, 0x3c, 0xde, 0xa5, 0xf0, 0x12, 0xdf, 0x89, 0x2d, 0x91, + 0xca, 0xcd, 0x95, 0x43, 0xb0, 0x48, 0xee, 0x19, 0xd8, 0x0c, 0x1b, 0x51, 0x66, 0x8d, 0xd8, 0x72, + 0x28, 0x8c, 0x3b, 0x5c, 0x0a, 0x97, 0xf9, 0x03, 0x62, 0x66, 0xa4, 0x5e, 0x62, 0xeb, 0xa0, 0x05, + 0x3a, 0x58, 0xe8, 0x60, 0xab, 0x6d, 0xea, 0x7d, 0x8f, 0xe9, 0xd5, 0x19, 0x86, 0x72, 0x53, 0x16, + 0xa8, 0x49, 0xbe, 0x3d, 0x8e, 0x6b, 0x5c, 0x75, 0x28, 0x8c, 0x26, 0xba, 0x14, 0x56, 0xf8, 0x6e, + 0x11, 0x23, 0x52, 0xa3, 0x21, 0x95, 0x77, 0xc0, 0xbc, 0x41, 0x3a, 0xb8, 0x69, 0x8f, 0xfa, 0x78, + 0x75, 0x96, 0xc1, 0x7e, 0xc9, 0xa1, 0x70, 0x6c, 0x74, 0x29, 0x7c, 0xce, 0x67, 0x2e, 0x30, 0x21, + 0x75, 0xce, 0xfb, 0xfd, 0xb1, 0xf7, 0x13, 0x82, 0x0d, 0xa1, 0x3c, 0x54, 0x6c, 0xf5, 0x89, 0x61, + 0x61, 0xf4, 0xeb, 0x74, 0x44, 0x40, 0xef, 0x19, 0x1d, 0x7c, 0xa2, 0x1b, 0xdd, 0x0b, 0x01, 0xfd, + 0x57, 0x04, 0x14, 0x13, 0x40, 0x94, 0xde, 0x50, 0x00, 0xbf, 0x48, 0x4c, 0x00, 0x2a, 0xee, 0x91, + 0x61, 0xfc, 0x04, 0xe9, 0x81, 0x15, 0xd3, 0x5f, 0x37, 0x99, 0xb8, 0xe2, 0x32, 0x78, 0xcb, 0xa1, + 0x50, 0x1c, 0xe0, 0x52, 0xb8, 0xce, 0x71, 0x09, 0xdd, 0x48, 0x5d, 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, + 0x33, 0x90, 0x52, 0x1c, 0x4b, 0x21, 0x81, 0x67, 0x5f, 0xf7, 0x85, 0x04, 0x1e, 0xff, 0xbc, 0xe5, + 0x02, 0xff, 0x59, 0x02, 0x57, 0xc3, 0x3a, 0x72, 0xa7, 0x85, 0xdd, 0x2c, 0x6c, 0x79, 0x59, 0xd5, + 0x9b, 0x8f, 0x93, 0x15, 0x96, 0x75, 0x93, 0x95, 0xf5, 0x26, 0xda, 0x15, 0x96, 0x15, 0xaf, 0xc7, + 0x8c, 0x3c, 0xa4, 0xe9, 0xdd, 0x73, 0x8d, 0xc3, 0x87, 0xa7, 0x35, 0xe9, 0xd1, 0x69, 0x4d, 0xfa, + 0xed, 0xb4, 0x26, 0x7d, 0x75, 0x56, 0x9b, 0x7a, 0x74, 0x56, 0x9b, 0xfa, 0xe9, 0xac, 0x36, 0xf5, + 0xe9, 0x6e, 0x57, 0xb7, 0xef, 0x0e, 0x5a, 0x72, 0x9b, 0xf4, 0x82, 0x27, 0x1b, 0xd8, 0x0e, 0x7e, + 0x6e, 0xb7, 0xef, 0x6a, 0xba, 0xa1, 0x9c, 0x8c, 0x37, 0xf3, 0x3e, 0x0a, 0xad, 0xd6, 0x2c, 0xfb, + 0xcb, 0xeb, 0xfa, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x2f, 0x84, 0x5c, 0xa7, 0x16, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1459,7 +1459,7 @@ func (m *MsgCreateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgRemoveResourceNode) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateIndexingNodeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1469,34 +1469,20 @@ func (m *MsgRemoveResourceNode) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRemoveResourceNode) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRemoveResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.OwnerAddress) > 0 { - i -= len(m.OwnerAddress) - copy(dAtA[i:], m.OwnerAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.ResourceNodeAddress) > 0 { - i -= len(m.ResourceNodeAddress) - copy(dAtA[i:], m.ResourceNodeAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ResourceNodeAddress))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } -func (m *MsgRemoveResourceNodeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRemoveResourceNode) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1506,20 +1492,34 @@ func (m *MsgRemoveResourceNodeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRemoveResourceNodeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRemoveResourceNode) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRemoveResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRemoveResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.ResourceNodeAddress) > 0 { + i -= len(m.ResourceNodeAddress) + copy(dAtA[i:], m.ResourceNodeAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ResourceNodeAddress))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *MsgCreateIndexingNodeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRemoveResourceNodeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1529,12 +1529,12 @@ func (m *MsgCreateIndexingNodeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRemoveResourceNodeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRemoveResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2075,6 +2075,15 @@ func (m *MsgCreateIndexingNode) Size() (n int) { return n } +func (m *MsgCreateIndexingNodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgRemoveResourceNode) Size() (n int) { if m == nil { return 0 @@ -2101,15 +2110,6 @@ func (m *MsgRemoveResourceNodeResponse) Size() (n int) { return n } -func (m *MsgCreateIndexingNodeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgRemoveIndexingNode) Size() (n int) { if m == nil { return 0 @@ -2825,6 +2825,56 @@ func (m *MsgCreateIndexingNode) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCreateIndexingNodeResponse) 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: MsgCreateIndexingNodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateIndexingNodeResponse: 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 *MsgRemoveResourceNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2989,56 +3039,6 @@ func (m *MsgRemoveResourceNodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateIndexingNodeResponse) 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: MsgCreateIndexingNodeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateIndexingNodeResponse: 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 *MsgRemoveIndexingNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 13075180ce90901197627f67ff413e2480183e92 Mon Sep 17 00:00:00 2001 From: jialbai Date: Wed, 1 Jun 2022 19:56:00 -0400 Subject: [PATCH 086/113] - qb-1165: refactor genesisState struct of register module --- cmd/stchaind/gen_idx_nodes.go | 4 +- proto/stratos/register/v1/genesis.proto | 15 +- proto/stratos/register/v1/register.proto | 14 +- x/pot/keeper/distribute.go | 6 +- x/pot/keeper/incentive_testnet_distribute.go | 8 +- x/pot/types/expected_keepers.go | 4 +- x/register/genesis.go | 8 +- x/register/keeper/grpc_query.go | 4 +- x/register/keeper/indexing_node.go | 4 +- x/register/keeper/querier.go | 28 +- x/register/keeper/resource_node.go | 4 +- x/register/types/genesis.go | 16 +- x/register/types/genesis.pb.go | 171 +++--- x/register/types/indexing_node.go | 68 +-- x/register/types/register.pb.go | 578 ++++--------------- x/register/types/resource_node.go | 36 +- 16 files changed, 299 insertions(+), 669 deletions(-) diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index 0fb1896b..eaddc221 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -72,11 +72,11 @@ the address will be looked up in the local Keybase. registerGenState := registertypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) if registerGenState.GetIndexingNodes() == nil { - registerGenState.IndexingNodes = ®istertypes.IndexingNodes{} + registerGenState.IndexingNodes = registertypes.IndexingNodes{} } for i, _ := range appIdxNodes { - registerGenState.IndexingNodes.IndexingNodes = append(registerGenState.IndexingNodes.IndexingNodes, &appIdxNodes[i]) + registerGenState.IndexingNodes = append(registerGenState.IndexingNodes, appIdxNodes[i]) } registerGenStateBz, err := clientCtx.Codec.MarshalJSON(®isterGenState) diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto index 403bf1e0..74d38057 100644 --- a/proto/stratos/register/v1/genesis.proto +++ b/proto/stratos/register/v1/genesis.proto @@ -16,8 +16,19 @@ option go_package = "github.com/stratosnet/stratos-chain/x/register/types"; // GenesisState defines the register module's genesis state. message GenesisState { register.v1.Params params = 1 [ (gogoproto.moretags) = "yaml:\"params\"" ]; - register.v1.ResourceNodes resource_nodes = 2 [ (gogoproto.moretags) = "yaml:\"resource_nodes\"" ]; - register.v1.IndexingNodes indexing_nodes = 3 [ (gogoproto.moretags) = "yaml:\"indexing_nodes\"" ]; + + repeated register.v1.ResourceNode resource_nodes = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "ResourceNodes", +// (gogoproto.castrepeated) = "github.com/stratosnet/stratos-chain/x/register/types.ResourceNodes", + (gogoproto.moretags) = "yaml:\"resource_nodes\"" + ]; + repeated register.v1.IndexingNode indexing_nodes = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "IndexingNodes", +// (gogoproto.castrepeated) = "github.com/stratosnet/stratos-chain/x/register/types.IndexingNodes", + (gogoproto.moretags) = "yaml:\"indexing_nodes\"" + ]; string initial_uoz_price = 4 [ (gogoproto.moretags) = "yaml:\"initial_uoz_price\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index 99b8c361..4c9d7080 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -173,13 +173,13 @@ message Slashing { ]; } -message ResourceNodes { - repeated ResourceNode resource_nodes = 1; -} - -message IndexingNodes { - repeated IndexingNode indexing_nodes = 1; -} +//message ResourceNodes { +// repeated ResourceNode resource_nodes = 1; +//} +// +//message IndexingNodes { +// repeated IndexingNode indexing_nodes = 1; +//} message TotalStakesResponse { cosmos.base.v1beta1.Coin resource_nodes_total_stake = 1; diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 9aee42d5..6ae3d25c 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -373,7 +373,7 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, trafficList []*types. // 1, calc stake reward totalStakeOfResourceNodes := k.RegisterKeeper.GetResourceNodeBondedToken(ctx).Amount resourceNodeList := k.RegisterKeeper.GetAllResourceNodes(ctx) - for _, node := range resourceNodeList.ResourceNodes { + for _, node := range resourceNodeList { walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) if err != nil { continue @@ -460,8 +460,8 @@ func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoal types. totalStakeOfIndexingNodes := k.RegisterKeeper.GetIndexingNodeBondedToken(ctx).Amount indexingNodeList := k.RegisterKeeper.GetAllIndexingNodes(ctx) - indexingNodeCnt := sdk.NewInt(int64(len(indexingNodeList.IndexingNodes))) - for _, node := range indexingNodeList.IndexingNodes { + indexingNodeCnt := sdk.NewInt(int64(len(indexingNodeList))) + for _, node := range indexingNodeList { walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) if err != nil { continue diff --git a/x/pot/keeper/incentive_testnet_distribute.go b/x/pot/keeper/incentive_testnet_distribute.go index e4f176dd..99092759 100644 --- a/x/pot/keeper/incentive_testnet_distribute.go +++ b/x/pot/keeper/incentive_testnet_distribute.go @@ -114,18 +114,18 @@ func (k Keeper) splitRewardEvenly(ctx sdk.Context, totalReward sdk.Int, } indexingNodeList := k.RegisterKeeper.GetAllIndexingNodes(ctx) - for _, indexingNode := range indexingNodeList.IndexingNodes { + for _, indexingNode := range indexingNodeList { if indexingNode.IsBonded() && !indexingNode.Suspend { indexingNodeCnt = indexingNodeCnt.Add(sdk.OneDec()) - indNodes = append(indNodes, *indexingNode) + indNodes = append(indNodes, indexingNode) } } resourceNodeList := k.RegisterKeeper.GetAllResourceNodes(ctx) - for _, resourceNode := range resourceNodeList.ResourceNodes { + for _, resourceNode := range resourceNodeList { if resourceNode.IsBonded() && !resourceNode.Suspend { resourceNodeCnt = resourceNodeCnt.Add(sdk.OneDec()) - resNodes = append(resNodes, *resourceNode) + resNodes = append(resNodes, resourceNode) } } diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 373827f6..105e13be 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -76,8 +76,8 @@ type RegisterKeeper interface { GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) - GetAllResourceNodes(ctx sdk.Context) (resourceNodes *types.ResourceNodes) - GetAllIndexingNodes(ctx sdk.Context) (indexingNodes *types.IndexingNodes) + GetAllResourceNodes(ctx sdk.Context) (resourceNodes types.ResourceNodes) + GetAllIndexingNodes(ctx sdk.Context) (indexingNodes types.IndexingNodes) } type StakingKeeper interface { diff --git a/x/register/genesis.go b/x/register/genesis.go index fdc47fb6..bc998b30 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -15,14 +15,14 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState initialStakeTotal := sdk.ZeroInt() resNodeBondedToken := sdk.ZeroInt() resNodeNotBondedToken := sdk.ZeroInt() - for _, resourceNode := range data.GetResourceNodes().GetResourceNodes() { + for _, resourceNode := range data.GetResourceNodes() { if resourceNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(resourceNode.Tokens) resNodeBondedToken = resNodeBondedToken.Add(resourceNode.Tokens) } else if resourceNode.GetStatus() == stakingtypes.Unbonded { resNodeNotBondedToken = resNodeNotBondedToken.Add(resourceNode.Tokens) } - keeper.SetResourceNode(ctx, *resourceNode) + keeper.SetResourceNode(ctx, resourceNode) } err := keeper.MintResourceNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeBondedToken)) if err != nil { @@ -34,14 +34,14 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } idxNodeBondedToken := sdk.ZeroInt() idxNodeNotBondedToken := sdk.ZeroInt() - for _, indexingNode := range data.IndexingNodes.GetIndexingNodes() { + for _, indexingNode := range data.GetIndexingNodes() { if indexingNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(indexingNode.Tokens) idxNodeBondedToken = idxNodeBondedToken.Add(indexingNode.Tokens) } else if indexingNode.GetStatus() == stakingtypes.Unbonded { idxNodeNotBondedToken = idxNodeNotBondedToken.Add(indexingNode.Tokens) } - keeper.SetIndexingNode(ctx, *indexingNode) + keeper.SetIndexingNode(ctx, indexingNode) } err = keeper.MintIndexingNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeBondedToken)) if err != nil { diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index a4a3c77a..bb7bd6e2 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -247,13 +247,13 @@ func (q Querier) StakeTotal(c context.Context, _ *types.QueryTotalStakeRequest) resourceNodeList := q.GetAllResourceNodes(ctx) totalStakeOfResourceNodes := sdk.ZeroInt() - for _, node := range resourceNodeList.GetResourceNodes() { + for _, node := range resourceNodeList { totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) } indexingNodeList := q.GetAllIndexingNodes(ctx) totalStakeOfIndexingNodes := sdk.ZeroInt() - for _, node := range indexingNodeList.GetIndexingNodes() { + for _, node := range indexingNodeList { totalStakeOfIndexingNodes = totalStakeOfIndexingNodes.Add(node.Tokens) } diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 1a68b33c..26ac1cab 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -72,14 +72,14 @@ func (k Keeper) SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode } // GetAllIndexingNodes get the set of all indexing nodes with no limits, used during genesis dump -func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes *types.IndexingNodes) { +func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes types.IndexingNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) - indexingNodes.IndexingNodes = append(indexingNodes.IndexingNodes, &node) + indexingNodes = append(indexingNodes, node) } return indexingNodes } diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 0f4640c2..11ad6853 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -63,7 +63,7 @@ func getRegisterParams(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQ func getResourceNodeByNetworkAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var ( params types.QueryNodesParams - nodes []*types.ResourceNode + nodes []types.ResourceNode ) err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) @@ -78,8 +78,8 @@ func getResourceNodeByNetworkAddr(ctx sdk.Context, req abci.RequestQuery, k Keep if !found { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoResourceNodeFound.Error()) } - nodes = append(nodes, &node) - res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.ResourceNodes{ResourceNodes: nodes}) + nodes = append(nodes, node) + res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.NewResourceNodes(nodes...)) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -90,7 +90,7 @@ func getIndexingNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keepe var ( params types.QueryNodesParams - nodes []*types.IndexingNode + nodes []types.IndexingNode ) err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { @@ -104,8 +104,8 @@ func getIndexingNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keepe if !found { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoIndexingNodeFound.Error()) } - nodes = append(nodes, &node) - res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.IndexingNodes{IndexingNodes: nodes}) + nodes = append(nodes, node) + res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.NewIndexingNodes(nodes...)) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -122,13 +122,13 @@ func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legac resourceNodeList := k.GetAllResourceNodes(ctx) totalStakeOfResourceNodes := sdk.ZeroInt() - for _, node := range resourceNodeList.GetResourceNodes() { + for _, node := range resourceNodeList { totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) } indexingNodeList := k.GetAllIndexingNodes(ctx) totalStakeOfIndexingNodes := sdk.ZeroInt() - for _, node := range indexingNodeList.GetIndexingNodes() { + for _, node := range indexingNodeList { totalStakeOfIndexingNodes = totalStakeOfIndexingNodes.Add(node.Tokens) } @@ -342,9 +342,9 @@ func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatu func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.IndexingNode { nodes := k.GetAllIndexingNodes(ctx) - filteredNodes := make([]types.IndexingNode, 0, len(nodes.GetIndexingNodes())) + filteredNodes := make([]types.IndexingNode, 0, len(nodes)) - for _, n := range nodes.GetIndexingNodes() { + for _, n := range nodes { // match NetworkAddr (if supplied) nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) if er != nil { @@ -369,7 +369,7 @@ func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNode continue } if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, *n) + filteredNodes = append(filteredNodes, n) } } return filteredNodes @@ -377,9 +377,9 @@ func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNode func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.ResourceNode { nodes := k.GetAllResourceNodes(ctx) - filteredNodes := make([]types.ResourceNode, 0, len(nodes.GetResourceNodes())) + filteredNodes := make([]types.ResourceNode, 0, len(nodes)) - for _, n := range nodes.GetResourceNodes() { + for _, n := range nodes { // match NetworkAddr (if supplied) nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) if er != nil { @@ -404,7 +404,7 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode continue } if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, *n) + filteredNodes = append(filteredNodes, n) } } return filteredNodes diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index ba95c8e8..5ca5e834 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -70,14 +70,14 @@ func (k Keeper) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode } // GetAllResourceNodes get the set of all resource nodes with no limits, used during genesis dump -func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes *types.ResourceNodes) { +func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes types.ResourceNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { node := types.MustUnmarshalResourceNode(k.cdc, iterator.Value()) - resourceNodes.ResourceNodes = append(resourceNodes.ResourceNodes, &node) + resourceNodes = append(resourceNodes, node) } return } diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index ce784b90..3328384e 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -11,8 +11,8 @@ import ( // NewGenesisState creates a new GenesisState object func NewGenesisState(params *Params, - resourceNodes *ResourceNodes, - indexingNodes *IndexingNodes, + resourceNodes ResourceNodes, + indexingNodes IndexingNodes, initialUOzonePrice sdk.Dec, totalUnissuedPrepay sdk.Int, slashingInfo []*Slashing, @@ -31,8 +31,8 @@ func NewGenesisState(params *Params, func DefaultGenesisState() *GenesisState { return &GenesisState{ Params: DefaultParams(), - ResourceNodes: &ResourceNodes{}, - IndexingNodes: &IndexingNodes{}, + ResourceNodes: ResourceNodes{}, + IndexingNodes: IndexingNodes{}, InitialUozPrice: DefaultUozPrice, TotalUnissuedPrepay: DefaultTotalUnissuedPrepay, Slashing: make([]*Slashing, 0), @@ -103,13 +103,13 @@ func NewSlashing(walletAddress sdk.AccAddress, value sdk.Int) *Slashing { // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (g GenesisState) UnpackInterfaces(c codectypes.AnyUnpacker) error { - for i := range g.IndexingNodes.IndexingNodes { - if err := g.IndexingNodes.IndexingNodes[i].UnpackInterfaces(c); err != nil { + for i := range g.IndexingNodes { + if err := g.IndexingNodes[i].UnpackInterfaces(c); err != nil { return err } } - for i := range g.ResourceNodes.ResourceNodes { - if err := g.ResourceNodes.ResourceNodes[i].UnpackInterfaces(c); err != nil { + for i := range g.ResourceNodes { + if err := g.ResourceNodes[i].UnpackInterfaces(c); err != nil { return err } } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go index 87d74099..5d7886bc 100644 --- a/x/register/types/genesis.pb.go +++ b/x/register/types/genesis.pb.go @@ -30,8 +30,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the register module's genesis state. type GenesisState struct { Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` - ResourceNodes *ResourceNodes `protobuf:"bytes,2,opt,name=resource_nodes,json=resourceNodes,proto3" json:"resource_nodes,omitempty" yaml:"resource_nodes"` - IndexingNodes *IndexingNodes `protobuf:"bytes,3,opt,name=indexing_nodes,json=indexingNodes,proto3" json:"indexing_nodes,omitempty" yaml:"indexing_nodes"` + ResourceNodes ResourceNodes `protobuf:"bytes,2,rep,name=resource_nodes,json=resourceNodes,proto3,castrepeated=ResourceNodes" json:"resource_nodes" yaml:"resource_nodes"` + IndexingNodes IndexingNodes `protobuf:"bytes,3,rep,name=indexing_nodes,json=indexingNodes,proto3,castrepeated=IndexingNodes" json:"indexing_nodes" yaml:"indexing_nodes"` InitialUozPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=initial_uoz_price,json=initialUozPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initial_uoz_price" yaml:"initial_uoz_price"` TotalUnissuedPrepay github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=total_unissued_prepay,json=totalUnissuedPrepay,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_unissued_prepay" yaml:"total_unissued_prepay"` Slashing []*Slashing `protobuf:"bytes,6,rep,name=slashing,proto3" json:"slashing,omitempty" yaml:"slashing_info"` @@ -77,14 +77,14 @@ func (m *GenesisState) GetParams() *Params { return nil } -func (m *GenesisState) GetResourceNodes() *ResourceNodes { +func (m *GenesisState) GetResourceNodes() ResourceNodes { if m != nil { return m.ResourceNodes } return nil } -func (m *GenesisState) GetIndexingNodes() *IndexingNodes { +func (m *GenesisState) GetIndexingNodes() IndexingNodes { if m != nil { return m.IndexingNodes } @@ -191,53 +191,54 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } var fileDescriptor_5bdab54ebea9e48e = []byte{ - // 730 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdf, 0x4e, 0xdb, 0x3a, - 0x1c, 0xc7, 0xdb, 0x03, 0xa7, 0x80, 0xa1, 0x45, 0x84, 0x72, 0x14, 0x38, 0xe7, 0x34, 0x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 0x9d, 0xbf, 0xed, 0x29, 0x8f, 0xb1, 0xdb, 0x12, 0x71, 0x57, - 0xc6, 0x99, 0x55, 0x4d, 0xfd, 0xe1, 0xe0, 0x09, 0x54, 0x87, 0xa0, 0xa7, 0x4f, 0x1b, 0x21, 0xa8, - 0x31, 0xc4, 0x69, 0xc2, 0x02, 0xd4, 0x25, 0x34, 0x44, 0xdc, 0xfc, 0x43, 0xea, 0xc1, 0xa9, 0x7a, - 0x9e, 0x46, 0x0f, 0x26, 0xa4, 0xbb, 0x3e, 0xce, 0xac, 0x35, 0x25, 0x7b, 0x5b, 0x03, 0x7a, 0x55, - 0x56, 0x24, 0x27, 0x2e, 0x98, 0x84, 0xe8, 0x14, 0x93, 0x48, 0xbb, 0xcc, 0xfc, 0xc6, 0x65, 0x5f, - 0xa3, 0xbf, 0xb8, 0xdc, 0xd6, 0x80, 0x5e, 0x15, 0x17, 0x49, 0x63, 0x04, 0x56, 0x30, 0xc1, 0x02, - 0xfb, 0x83, 0x6e, 0x42, 0xcf, 0xba, 0x31, 0xc3, 0x01, 0x32, 0x67, 0x9b, 0xe5, 0xcd, 0x05, 0xf7, - 0xd5, 0x79, 0x66, 0x95, 0xbe, 0x65, 0xd6, 0x83, 0x08, 0x8b, 0xe3, 0xa4, 0x67, 0x07, 0x74, 0xa8, - 0x4b, 0xa5, 0x7f, 0xb6, 0x79, 0xd8, 0x77, 0x44, 0x1a, 0x23, 0x6e, 0xef, 0xa1, 0x60, 0x9c, 0x59, - 0x66, 0x6e, 0x79, 0x47, 0x10, 0x7a, 0xcb, 0x3a, 0x76, 0x48, 0xcf, 0xda, 0x93, 0x88, 0xf1, 0xa1, - 0x0c, 0xd6, 0x04, 0x15, 0x13, 0x8a, 0x60, 0xce, 0x13, 0x14, 0x76, 0x63, 0x86, 0x62, 0x3f, 0x35, - 0xff, 0x94, 0xe6, 0x07, 0xf7, 0x30, 0xdf, 0x27, 0x62, 0x9c, 0x59, 0xff, 0x28, 0xf3, 0xa9, 0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0x52, 0x67, 0xa1, 0xa7, 0x45, 0x8c, 0xb7, 0xa0, 0x22, 0x68, 0x1f, 0x11, - 0xae, 0x8b, 0xff, 0xec, 0xde, 0xc5, 0x5f, 0xca, 0x8b, 0xdf, 0x47, 0x04, 0x7a, 0x5a, 0xcd, 0x78, - 0x0a, 0xaa, 0xf4, 0x84, 0x20, 0x76, 0x9d, 0xf0, 0x8a, 0x94, 0x2f, 0x54, 0xf1, 0xd6, 0x36, 0xf4, - 0x96, 0xe4, 0x3a, 0x4f, 0x76, 0x08, 0x16, 0x43, 0xc4, 0x03, 0x86, 0x63, 0x81, 0x29, 0x31, 0xe7, - 0x64, 0xc6, 0x9b, 0x53, 0x3b, 0x64, 0xef, 0x86, 0x73, 0x9b, 0x37, 0xcd, 0x58, 0x38, 0x0e, 0xb7, - 0xe8, 0x10, 0x0b, 0x34, 0x8c, 0x45, 0xea, 0x15, 0x65, 0xdd, 0x83, 0xf3, 0xcb, 0x46, 0xf9, 0xe2, - 0xb2, 0x51, 0xfe, 0x7e, 0xd9, 0x28, 0x7f, 0xbc, 0x6a, 0x94, 0x2e, 0xae, 0x1a, 0xa5, 0xaf, 0x57, - 0x8d, 0xd2, 0xfb, 0xc7, 0x85, 0xe7, 0x6b, 0x53, 0x82, 0x44, 0xfe, 0xb9, 0x1d, 0x1c, 0xfb, 0x98, - 0x38, 0xa7, 0x37, 0x7f, 0x81, 0x32, 0x21, 0xbd, 0x8a, 0x6c, 0x85, 0x47, 0x3f, 0x03, 0x00, 0x00, - 0xff, 0xff, 0x6a, 0xaa, 0xf2, 0xbe, 0xcd, 0x05, 0x00, 0x00, + // 750 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x4e, 0xdb, 0x48, + 0x14, 0x8e, 0xf9, 0x09, 0x60, 0x48, 0x10, 0x26, 0xac, 0x0c, 0xbb, 0x1b, 0x87, 0xd1, 0x6a, 0x95, + 0x95, 0xc0, 0x56, 0xd8, 0xbd, 0x5a, 0x69, 0x57, 0xc2, 0x45, 0xad, 0x68, 0x55, 0x14, 0x39, 0xa2, + 0x95, 0x7a, 0x13, 0x39, 0xf6, 0x60, 0x46, 0x49, 0x66, 0xac, 0x99, 0x71, 0xc0, 0x5c, 0xf6, 0x09, + 0xfa, 0x00, 0x7d, 0x82, 0x4a, 0xbd, 0xeb, 0x43, 0xa0, 0x5e, 0x71, 0x59, 0xf5, 0xc2, 0xad, 0xe0, + 0x0d, 0xf2, 0x04, 0x55, 0x66, 0xc6, 0x60, 0x50, 0x54, 0x89, 0x2b, 0xcf, 0x39, 0xf3, 0x9d, 0xef, + 0x3b, 0x73, 0x7e, 0xac, 0x6f, 0x33, 0x4e, 0x7d, 0x4e, 0x98, 0x43, 0x61, 0x84, 0x18, 0x87, 0xd4, + 0x19, 0xb5, 0x9c, 0x08, 0x62, 0xc8, 0x10, 0xb3, 0x63, 0x4a, 0x38, 0x31, 0xd6, 0x15, 0xc4, 0xce, + 0x21, 0xf6, 0xa8, 0xb5, 0xb5, 0x19, 0x11, 0x12, 0x0d, 0xa0, 0x23, 0x20, 0xbd, 0xe4, 0xc4, 0xf1, + 0x71, 0x2a, 0xf1, 0x5b, 0xb5, 0x88, 0x44, 0x44, 0x1c, 0x9d, 0xc9, 0x49, 0x79, 0x37, 0x03, 0xc2, + 0x86, 0x84, 0x75, 0xe5, 0x85, 0x34, 0xd4, 0xd5, 0x1f, 0xd2, 0x72, 0x18, 0xf7, 0xfb, 0x08, 0x47, + 0xce, 0xa8, 0xd5, 0x83, 0xdc, 0x6f, 0xe5, 0xb6, 0x42, 0x81, 0x69, 0x99, 0xde, 0xa6, 0x24, 0x30, + 0xe0, 0xfd, 0xbc, 0xbe, 0xf2, 0x4c, 0x26, 0xdf, 0xe1, 0x3e, 0x87, 0xc6, 0x53, 0xbd, 0x1c, 0xfb, + 0xd4, 0x1f, 0x32, 0x53, 0x6b, 0x68, 0xc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 0xcf, 0x13, 0x26, 0x46, 0xa5, 0xba, 0x07, 0x6c, 0x45, 0x9e, 0x6f, 0xb3, 0xda, 0x6e, + 0xdb, 0x25, 0x38, 0xec, 0x08, 0x64, 0x71, 0xf1, 0x64, 0x2c, 0xf0, 0x14, 0x89, 0xf1, 0x4a, 0x2f, + 0x73, 0xd2, 0x87, 0x98, 0xa9, 0xe6, 0xff, 0xff, 0xe8, 0xe6, 0xaf, 0xe4, 0xcd, 0xef, 0x43, 0x0c, + 0x3c, 0xc5, 0x66, 0xfc, 0xa7, 0x57, 0xc8, 0x19, 0x86, 0xf4, 0xb6, 0xe0, 0x65, 0x41, 0x5f, 0xe8, + 0xe2, 0xbd, 0x6b, 0xe0, 0xad, 0x08, 0x3b, 0x2f, 0x76, 0xa8, 0x2f, 0x87, 0x90, 0x05, 0x14, 0xc5, + 0x1c, 0x11, 0x6c, 0x2e, 0x88, 0x8a, 0x37, 0xa6, 0x4e, 0xc8, 0xc1, 0x1d, 0xce, 0x6d, 0xdc, 0x0d, + 0x63, 0x21, 0x1c, 0xec, 0x90, 0x21, 0xe2, 0x70, 0x18, 0xf3, 0xd4, 0x2b, 0xd2, 0xba, 0x47, 0x97, + 0xd7, 0x75, 0xed, 0xea, 0xba, 0xae, 0x7d, 0xbf, 0xae, 0x6b, 0xef, 0x6e, 0xea, 0xa5, 0xab, 0x9b, + 0x7a, 0xe9, 0xcb, 0x4d, 0xbd, 0xf4, 0xe6, 0x9f, 0xc2, 0xf3, 0x95, 0x28, 0x86, 0x3c, 0x3f, 0xee, + 0x06, 0xa7, 0x3e, 0xc2, 0xce, 0xf9, 0xdd, 0xaf, 0x52, 0x14, 0xa4, 0x57, 0x16, 0xa3, 0xf0, 0xf7, + 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x72, 0x89, 0x37, 0xe3, 0xf5, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -294,29 +295,33 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x22 - if m.IndexingNodes != nil { - { - size, err := m.IndexingNodes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.IndexingNodes) > 0 { + for iNdEx := len(m.IndexingNodes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.IndexingNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0x1a } - if m.ResourceNodes != nil { - { - size, err := m.ResourceNodes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.ResourceNodes) > 0 { + for iNdEx := len(m.ResourceNodes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 } if m.Params != nil { { @@ -440,13 +445,17 @@ func (m *GenesisState) Size() (n int) { l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) } - if m.ResourceNodes != nil { - l = m.ResourceNodes.Size() - n += 1 + l + sovGenesis(uint64(l)) + if len(m.ResourceNodes) > 0 { + for _, e := range m.ResourceNodes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } } - if m.IndexingNodes != nil { - l = m.IndexingNodes.Size() - n += 1 + l + sovGenesis(uint64(l)) + if len(m.IndexingNodes) > 0 { + for _, e := range m.IndexingNodes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } } l = m.InitialUozPrice.Size() n += 1 + l + sovGenesis(uint64(l)) @@ -594,10 +603,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ResourceNodes == nil { - m.ResourceNodes = &ResourceNodes{} - } - if err := m.ResourceNodes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ResourceNodes = append(m.ResourceNodes, ResourceNode{}) + if err := m.ResourceNodes[len(m.ResourceNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -630,10 +637,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.IndexingNodes == nil { - m.IndexingNodes = &IndexingNodes{} - } - if err := m.IndexingNodes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.IndexingNodes = append(m.IndexingNodes, IndexingNode{}) + if err := m.IndexingNodes[len(m.IndexingNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/register/types/indexing_node.go b/x/register/types/indexing_node.go index ff9facc6..ece9a5f6 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/indexing_node.go @@ -3,6 +3,7 @@ package types import ( "bytes" "fmt" + "strings" "time" "github.com/cosmos/cosmos-sdk/codec" @@ -13,47 +14,6 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -// IndexingNodes is a collection of indexing node -//type IndexingNodes []IndexingNode - -//func (v IndexingNodes) String() (out string) { -// for _, node := range v { -// out += node.String() + "\n" -// } -// return strings.TrimSpace(out) -//} - -//Sort IndexingNodes sorts IndexingNode array in ascending owner address order -//func (v IndexingNodes) Sort() { -// sort.Sort(v.GetIndexingNodes()) -//} - -//// Len Implements sort interface -//func (v IndexingNodes) Len() int { -// return len(v.GetIndexingNodes()) -//} -// -//// Less Implements sort interface -//func (v IndexingNodes) Less(i, j int) bool { -// return v.GetIndexingNodes()[i].Tokens < (v.GetIndexingNodes()[j].Tokens) -//} -// -//// Swap Implements sort interface -//func (v IndexingNodes) Swap(i, j int) { -// it := v.GetIndexingNodes()[i] -// v.GetIndexingNodes()[i] = v.GetIndexingNodes()[j] -// v.GetIndexingNodes()[j] = it -//} - -func (v IndexingNodes) Validate() error { - for _, node := range v.GetIndexingNodes() { - if err := node.Validate(); err != nil { - return err - } - } - return nil -} - // NewIndexingNode - initialize a new indexing node func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description *Description, creationTime time.Time) (IndexingNode, error) { pkAny, err := codectypes.NewAnyWithValue(pubKey) @@ -190,6 +150,32 @@ func UnmarshalIndexingNode(cdc codec.Codec, value []byte) (indexingNode Indexing return indexingNode, err } +//IndexingNodes is a collection of indexing node +type IndexingNodes []IndexingNode + +func NewIndexingNodes(indexingNodes ...IndexingNode) IndexingNodes { + if len(indexingNodes) == 0 { + return IndexingNodes{} + } + return indexingNodes +} + +func (v IndexingNodes) String() (out string) { + for _, node := range v { + out += node.String() + "\n" + } + return strings.TrimSpace(out) +} + +func (v IndexingNodes) Validate() error { + for _, node := range v { + if err := node.Validate(); err != nil { + return err + } + } + return nil +} + type VoteOpinion bool const ( diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index e8d893b1..9f62e30a 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -492,94 +492,6 @@ func (m *Slashing) GetValue() int64 { return 0 } -type ResourceNodes struct { - ResourceNodes []*ResourceNode `protobuf:"bytes,1,rep,name=resource_nodes,json=resourceNodes,proto3" json:"resource_nodes,omitempty"` -} - -func (m *ResourceNodes) Reset() { *m = ResourceNodes{} } -func (m *ResourceNodes) String() string { return proto.CompactTextString(m) } -func (*ResourceNodes) ProtoMessage() {} -func (*ResourceNodes) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{6} -} -func (m *ResourceNodes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ResourceNodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ResourceNodes.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 *ResourceNodes) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResourceNodes.Merge(m, src) -} -func (m *ResourceNodes) XXX_Size() int { - return m.Size() -} -func (m *ResourceNodes) XXX_DiscardUnknown() { - xxx_messageInfo_ResourceNodes.DiscardUnknown(m) -} - -var xxx_messageInfo_ResourceNodes proto.InternalMessageInfo - -func (m *ResourceNodes) GetResourceNodes() []*ResourceNode { - if m != nil { - return m.ResourceNodes - } - return nil -} - -type IndexingNodes struct { - IndexingNodes []*IndexingNode `protobuf:"bytes,1,rep,name=indexing_nodes,json=indexingNodes,proto3" json:"indexing_nodes,omitempty"` -} - -func (m *IndexingNodes) Reset() { *m = IndexingNodes{} } -func (m *IndexingNodes) String() string { return proto.CompactTextString(m) } -func (*IndexingNodes) ProtoMessage() {} -func (*IndexingNodes) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{7} -} -func (m *IndexingNodes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IndexingNodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IndexingNodes.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 *IndexingNodes) XXX_Merge(src proto.Message) { - xxx_messageInfo_IndexingNodes.Merge(m, src) -} -func (m *IndexingNodes) XXX_Size() int { - return m.Size() -} -func (m *IndexingNodes) XXX_DiscardUnknown() { - xxx_messageInfo_IndexingNodes.DiscardUnknown(m) -} - -var xxx_messageInfo_IndexingNodes proto.InternalMessageInfo - -func (m *IndexingNodes) GetIndexingNodes() []*IndexingNode { - if m != nil { - return m.IndexingNodes - } - return nil -} - type TotalStakesResponse struct { ResourceNodesTotalStake *types2.Coin `protobuf:"bytes,1,opt,name=resource_nodes_total_stake,json=resourceNodesTotalStake,proto3" json:"resource_nodes_total_stake,omitempty"` IndexingNodesTotalStake *types2.Coin `protobuf:"bytes,2,opt,name=indexing_nodes_total_stake,json=indexingNodesTotalStake,proto3" json:"indexing_nodes_total_stake,omitempty"` @@ -592,7 +504,7 @@ func (m *TotalStakesResponse) Reset() { *m = TotalStakesResponse{} } func (m *TotalStakesResponse) String() string { return proto.CompactTextString(m) } func (*TotalStakesResponse) ProtoMessage() {} func (*TotalStakesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{8} + return fileDescriptor_fef1e3aeec8499d6, []int{6} } func (m *TotalStakesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -675,7 +587,7 @@ func (m *StakingInfo) Reset() { *m = StakingInfo{} } func (m *StakingInfo) String() string { return proto.CompactTextString(m) } func (*StakingInfo) ProtoMessage() {} func (*StakingInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{9} + return fileDescriptor_fef1e3aeec8499d6, []int{7} } func (m *StakingInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -793,7 +705,7 @@ func (m *UnbondingNode) Reset() { *m = UnbondingNode{} } func (m *UnbondingNode) String() string { return proto.CompactTextString(m) } func (*UnbondingNode) ProtoMessage() {} func (*UnbondingNode) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{10} + return fileDescriptor_fef1e3aeec8499d6, []int{8} } func (m *UnbondingNode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -854,7 +766,7 @@ func (m *UnbondingNodeEntry) Reset() { *m = UnbondingNodeEntry{} } func (m *UnbondingNodeEntry) String() string { return proto.CompactTextString(m) } func (*UnbondingNodeEntry) ProtoMessage() {} func (*UnbondingNodeEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{11} + return fileDescriptor_fef1e3aeec8499d6, []int{9} } func (m *UnbondingNodeEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -910,7 +822,7 @@ func (m *Staking) Reset() { *m = Staking{} } func (m *Staking) String() string { return proto.CompactTextString(m) } func (*Staking) ProtoMessage() {} func (*Staking) Descriptor() ([]byte, []int) { - return fileDescriptor_fef1e3aeec8499d6, []int{12} + return fileDescriptor_fef1e3aeec8499d6, []int{10} } func (m *Staking) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -960,8 +872,6 @@ func init() { proto.RegisterType((*IndexingNodeRegistrationVotePool)(nil), "stratos.register.v1.IndexingNodeRegistrationVotePool") proto.RegisterType((*Description)(nil), "stratos.register.v1.Description") proto.RegisterType((*Slashing)(nil), "stratos.register.v1.Slashing") - proto.RegisterType((*ResourceNodes)(nil), "stratos.register.v1.ResourceNodes") - proto.RegisterType((*IndexingNodes)(nil), "stratos.register.v1.IndexingNodes") proto.RegisterType((*TotalStakesResponse)(nil), "stratos.register.v1.TotalStakesResponse") proto.RegisterType((*StakingInfo)(nil), "stratos.register.v1.StakingInfo") proto.RegisterType((*UnbondingNode)(nil), "stratos.register.v1.UnbondingNode") @@ -974,110 +884,108 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1648 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1c, 0x49, - 0x15, 0xf7, 0xcc, 0xc4, 0x5f, 0x35, 0x1f, 0x36, 0x6d, 0x2f, 0x19, 0x1b, 0x70, 0x39, 0xc5, 0xc7, - 0x1a, 0x2d, 0x9e, 0x91, 0x13, 0x24, 0x04, 0x07, 0xa4, 0x74, 0x6c, 0xb2, 0xde, 0x85, 0xc8, 0x6a, - 0x9b, 0x5d, 0x05, 0x29, 0x1a, 0x7a, 0xba, 0x2b, 0xe3, 0x8a, 0x67, 0xaa, 0x46, 0x5d, 0x35, 0xb6, - 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c, 0x2f, 0x98, 0xc0, 0x47, 0x8c, 0xf5, 0x3f, - 0x58, 0x0e, 0x7c, 0x06, 0x6a, 0xfe, 0x70, 0x18, 0xb1, 0x73, 0xdc, 0xe9, 0x13, 0x2e, 0x9a, 0xe5, - 0xed, 0xca, 0xce, 0xb2, 0xfb, 0xf1, 0x24, 0x86, 0x39, 0x3c, 0x89, 0xe1, 0x9a, 0x66, 0xb4, 0x51, - 0xe4, 0x55, 0xcd, 0xf0, 0xa7, 0x84, 0x0b, 0xe7, 0x27, 0xa0, 0x1a, 0xe1, 0x67, 0x38, 0x10, 0x9a, - 0xaa, 0xa2, 0xa8, 0x54, 0x14, 0x2c, 0x38, 0x8b, 0x82, 0x05, 0x22, 0x0f, 0xe8, 0x91, 0xe2, 0x79, - 0x06, 0xaa, 0xf8, 0x72, 0x48, 0x22, 0xac, 0x43, 0x70, 0x6b, 0x66, 0x08, 0x76, 0x4d, 0x08, 0x6c, - 0xb5, 0xcc, 0x8e, 0x05, 0xea, 0xed, 0x07, 0x1a, 0x51, 0x9b, 0xff, 0xf7, 0x32, 0xa8, 0x5a, 0x87, - 0x46, 0x26, 0xec, 0x80, 0x51, 0x72, 0x86, 0x23, 0xb3, 0xbf, 0x2a, 0x61, 0x0d, 0x94, 0x25, 0xac, - 0x01, 0x90, 0x97, 0x8a, 0x9c, 0x03, 0xb0, 0x44, 0x42, 0x4c, 0x05, 0x11, 0xba, 0x9c, 0xe8, 0xf3, - 0x3e, 0xc5, 0x92, 0x18, 0x6e, 0x68, 0xd5, 0x14, 0xb1, 0xdb, 0x85, 0xe9, 0x34, 0xe7, 0x3e, 0x58, - 0xbc, 0xc0, 0x5d, 0x4e, 0x84, 0x6e, 0x87, 0x74, 0x28, 0x52, 0x28, 0x89, 0x61, 0x53, 0x93, 0x18, - 0xc0, 0xe6, 0x48, 0x27, 0x39, 0x21, 0x58, 0xe5, 0x38, 0x18, 0x45, 0x44, 0x8c, 0x3b, 0x01, 0xa3, - 0xc2, 0x0f, 0x84, 0xda, 0xc3, 0x65, 0xf7, 0x87, 0x93, 0x18, 0x5e, 0x91, 0x25, 0x31, 0xbc, 0x63, - 0x4a, 0x45, 0x41, 0x62, 0xb3, 0xaf, 0xa4, 0xc2, 0x07, 0x5a, 0x26, 0x1d, 0x0d, 0xb1, 0xf0, 0x49, - 0x3f, 0x2d, 0x24, 0xca, 0x51, 0x03, 0x65, 0x8e, 0x1a, 0x20, 0xe7, 0x68, 0x8a, 0xfd, 0xa6, 0x04, - 0x96, 0x8e, 0xfb, 0x3e, 0x3f, 0x25, 0xb4, 0xe7, 0x78, 0xa0, 0x71, 0xe1, 0xf7, 0xfb, 0x58, 0x14, - 0xce, 0xf7, 0x27, 0x93, 0x18, 0x16, 0x24, 0x49, 0x0c, 0x3f, 0x32, 0xdb, 0x90, 0xc3, 0x91, 0x57, - 0xd7, 0x40, 0x7a, 0xb8, 0xdb, 0x60, 0xfe, 0xdc, 0xef, 0x8f, 0x74, 0xf3, 0x5b, 0x71, 0x37, 0x26, - 0x31, 0xd4, 0x40, 0x12, 0xc3, 0x9a, 0x66, 0x50, 0x43, 0xe4, 0x69, 0x18, 0x3d, 0x06, 0x75, 0xbb, - 0x53, 0xe3, 0xce, 0xa7, 0xa0, 0x11, 0x19, 0xa0, 0x23, 0x2f, 0x28, 0xe9, 0x55, 0x65, 0xa7, 0x7a, - 0xf7, 0xce, 0xb5, 0xd5, 0xc7, 0xd6, 0xf5, 0xea, 0x91, 0xcd, 0x24, 0xa9, 0xed, 0x24, 0x57, 0xd4, - 0xc4, 0x00, 0xff, 0x02, 0x75, 0xae, 0x40, 0xd4, 0x89, 0xcd, 0x84, 0x7e, 0x57, 0x01, 0x6b, 0x27, - 0x4c, 0xf8, 0xfd, 0x63, 0xe1, 0x9f, 0x61, 0xee, 0x61, 0x3e, 0x64, 0x94, 0xcb, 0x7b, 0x73, 0x33, - 0xef, 0x7c, 0x47, 0xc8, 0x59, 0x1d, 0x79, 0x85, 0x60, 0xb5, 0xbd,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1c, 0x1f, 0x2c, 0xa6, 0x96, 0x75, 0x7f, 0xfa, 0xf0, - 0xbd, 0x2c, 0x2f, 0x66, 0x16, 0x4d, 0x30, 0xa7, 0x96, 0x52, 0x11, 0x7a, 0x5e, 0x06, 0x8b, 0xe6, - 0xb6, 0xfd, 0x60, 0x37, 0xed, 0x95, 0x5b, 0xa1, 0xfc, 0x9f, 0xdd, 0x0a, 0x4f, 0xd2, 0xae, 0x55, - 0x87, 0xe3, 0xe1, 0x7b, 0xfc, 0x41, 0xdf, 0xc7, 0xc1, 0xac, 0x1e, 0xd7, 0x7d, 0xf4, 0xf2, 0xcd, - 0x56, 0xe9, 0xf5, 0x9b, 0xad, 0xd2, 0x5f, 0xde, 0x6c, 0x95, 0x9e, 0xbf, 0xdd, 0x9a, 0x7b, 0xfd, - 0x76, 0x6b, 0xee, 0x8f, 0x6f, 0xb7, 0xe6, 0x7e, 0xf1, 0x7d, 0xcb, 0x82, 0x49, 0x2a, 0x8a, 0x45, - 0xfa, 0xb9, 0x1b, 0x9c, 0xfa, 0x84, 0xb6, 0x2f, 0xb3, 0x97, 0x7b, 0x65, 0xb3, 0xbb, 0xa0, 0xce, - 0xe7, 0xbd, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x86, 0xf6, 0xec, 0x5d, 0xda, 0x17, 0x00, 0x00, + // 1610 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1b, 0xb9, + 0x15, 0xb7, 0xa4, 0xf8, 0x8b, 0x92, 0x65, 0x77, 0xec, 0x34, 0xb2, 0xdb, 0x9a, 0x0e, 0xfb, 0x11, + 0x17, 0xa9, 0x25, 0x38, 0x29, 0x50, 0xb4, 0x87, 0x02, 0x99, 0xd8, 0x4d, 0x9d, 0xb4, 0x81, 0x31, + 0x76, 0x13, 0xb4, 0x40, 0xa0, 0x8e, 0x66, 0x18, 0x99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, 0xbb, 0x69, 0xcf, + 0xdd, 0x0a, 0xc5, 0x6f, 0x77, 0x2b, 0x3c, 0x49, 0xfa, 0x3f, 0x13, 0x8e, 0x7b, 0xef, 0xf1, 0x57, + 0x77, 0x07, 0x07, 0x93, 0xba, 0x45, 0xf7, 0xe1, 0xcb, 0x37, 0xeb, 0x85, 0xd7, 0x6f, 0xd6, 0x0b, + 0x9f, 0xbd, 0x59, 0x2f, 0x3c, 0x7f, 0xbb, 0x3e, 0xf5, 0xfa, 0xed, 0xfa, 0xd4, 0xc7, 0x6f, 0xd7, + 0xa7, 0xfe, 0xf1, 0xdb, 0x8c, 0x07, 0x9b, 0x54, 0x14, 0x8b, 0xe4, 0x73, 0x2b, 0x38, 0xf2, 0x09, + 0x6d, 0x9c, 0xa5, 0x6f, 0xe0, 0xda, 0x67, 0x6b, 0x46, 0x9f, 0xcf, 0xdb, 0x5f, 0x07, 0x00, 0x00, + 0xff, 0xff, 0x0e, 0x13, 0x8d, 0x95, 0x24, 0x17, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1475,80 +1383,6 @@ func (m *Slashing) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ResourceNodes) 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 *ResourceNodes) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResourceNodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ResourceNodes) > 0 { - for iNdEx := len(m.ResourceNodes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ResourceNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRegister(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *IndexingNodes) 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 *IndexingNodes) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IndexingNodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.IndexingNodes) > 0 { - for iNdEx := len(m.IndexingNodes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IndexingNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRegister(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *TotalStakesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2109,36 +1943,6 @@ func (m *Slashing) Size() (n int) { return n } -func (m *ResourceNodes) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ResourceNodes) > 0 { - for _, e := range m.ResourceNodes { - l = e.Size() - n += 1 + l + sovRegister(uint64(l)) - } - } - return n -} - -func (m *IndexingNodes) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.IndexingNodes) > 0 { - for _, e := range m.IndexingNodes { - l = e.Size() - n += 1 + l + sovRegister(uint64(l)) - } - } - return n -} - func (m *TotalStakesResponse) Size() (n int) { if m == nil { return 0 @@ -3563,174 +3367,6 @@ func (m *Slashing) Unmarshal(dAtA []byte) error { } return nil } -func (m *ResourceNodes) 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 ErrIntOverflowRegister - } - 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: ResourceNodes: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceNodes: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceNodes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegister - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRegister - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRegister - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ResourceNodes = append(m.ResourceNodes, &ResourceNode{}) - if err := m.ResourceNodes[len(m.ResourceNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRegister(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRegister - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IndexingNodes) 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 ErrIntOverflowRegister - } - 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: IndexingNodes: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IndexingNodes: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegister - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRegister - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRegister - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IndexingNodes = append(m.IndexingNodes, &IndexingNode{}) - if err := m.IndexingNodes[len(m.IndexingNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRegister(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRegister - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *TotalStakesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index e8865d2e..378c77ec 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -49,32 +49,24 @@ func (n NodeType) String() string { } // ResourceNodes is a collection of resource node -//type ResourceNodes []ResourceNode +type ResourceNodes []ResourceNode -//func (v ResourceNodes) String() (out string) { -// for _, node := range v { -// out += node.String() + "\n" -// } -// return strings.TrimSpace(out) -//} +func NewResourceNodes(resourceNodes ...ResourceNode) ResourceNodes { + if len(resourceNodes) == 0 { + return ResourceNodes{} + } + return resourceNodes +} -// Sort ResourceNodes sorts ResourceNode array in ascending owner address order -//func (v ResourceNodes) Sort() { -// sort.Sort(v) -//} -// -//// Len implements sort interface -//func (v ResourceNodes) Len() int { -// return len(v.ResourceNodes) -//} -// -//// Less implements sort interface -//func (v ResourceNodes) Less(i, j int) bool { -// return v.GetResourceNodes()[i].Tokens < v.GetResourceNodes()[j].Tokens -//} +func (v ResourceNodes) String() (out string) { + for _, node := range v { + out += node.String() + "\n" + } + return strings.TrimSpace(out) +} func (v ResourceNodes) Validate() error { - for _, node := range v.GetResourceNodes() { + for _, node := range v { if err := node.Validate(); err != nil { return err } From 9d66cbff0029a2ee6a12b1e560b5e94b5a8507f9 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Thu, 2 Jun 2022 09:35:22 -0400 Subject: [PATCH 087/113] fixed indexing vote tx cmd --- x/register/client/cli/tx.go | 2 +- x/register/keeper/msg_server.go | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index eb912e9c..a435392f 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -345,7 +345,7 @@ func UpdateIndexingNodeStakeCmd() *cobra.Command { // IndexingNodeRegistrationVoteCmd Indexing node registration need to be approved by 2/3 of existing indexing nodes func IndexingNodeRegistrationVoteCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "indexing_node_reg_vote", + Use: "indexing_node_reg_vote [flags]", Short: "vote for the registration of a new indexing node", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index 10d38113..fbf4de4a 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -214,13 +214,10 @@ func (k msgServer) HandleMsgIndexingNodeRegistrationVote(goCtx context.Context, if !found { return nil, types.ErrNoIndexingNodeFound } - ownerAddress, err := stratos.SdsAddressFromBech32(nodeToApprove.OwnerAddress) - if err != nil { - return &types.MsgIndexingNodeRegistrationVoteResponse{}, err - } - if !ownerAddress.Equals(candidateNetworkAddress) { + if nodeToApprove.OwnerAddress != msg.CandidateOwnerAddress { return nil, types.ErrInvalidOwnerAddr } + voterNetworkAddress, err := stratos.SdsAddressFromBech32(msg.VoterNetworkAddress) if err != nil { return &types.MsgIndexingNodeRegistrationVoteResponse{}, err From 991d4ff353700884a4146d00112725e9825a5925 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Thu, 2 Jun 2022 12:33:26 -0400 Subject: [PATCH 088/113] changed indexing to meta --- app/app.go | 4 +- cmd/stchaind/gen_idx_nodes.go | 40 +- cmd/stchaind/root.go | 2 +- proto/stratos/pot/v1/genesis.proto | 21 - proto/stratos/pot/v1/query.proto | 3 - proto/stratos/pot/v1/tx.proto | 2 +- proto/stratos/register/v1/genesis.proto | 22 +- proto/stratos/register/v1/query.proto | 18 +- proto/stratos/register/v1/register.proto | 16 +- proto/stratos/register/v1/tx.proto | 72 +- x/pot/keeper/distribute.go | 100 +-- x/pot/keeper/keeper.go | 2 +- x/pot/keeper/slashing.go | 2 +- x/pot/types/distribute.go | 70 +- x/pot/types/expected_keepers.go | 10 +- x/pot/types/msg.go | 29 - x/register/client/cli/flags.go | 4 +- x/register/client/cli/query.go | 40 +- x/register/client/cli/tx.go | 90 +- x/register/client/rest/query.go | 4 +- x/register/client/rest/tx.go | 66 +- x/register/exported/exported.go | 4 +- x/register/genesis.go | 22 +- x/register/handler.go | 20 +- x/register/keeper/grpc_query.go | 54 +- x/register/keeper/hooks.go | 20 +- x/register/keeper/indexing_node.go | 314 +++---- x/register/keeper/keeper.go | 90 +- x/register/keeper/msg_server.go | 84 +- x/register/keeper/node_state_change.go | 64 +- x/register/keeper/querier.go | 70 +- x/register/types/codec.go | 18 +- x/register/types/errors.go | 12 +- x/register/types/events.go | 28 +- x/register/types/expected_keepers.go | 18 +- x/register/types/genesis.go | 20 +- x/register/types/genesis.pb.go | 174 ++-- x/register/types/hooks.go | 20 +- x/register/types/keys.go | 34 +- .../types/{indexing_node.go => meta_node.go} | 99 ++- x/register/types/msg.go | 120 +-- x/register/types/querier.go | 30 +- x/register/types/query.pb.go | 360 +++----- x/register/types/query.pb.gw.go | 46 +- x/register/types/register.pb.go | 486 +++++++---- x/register/types/registration.go | 2 +- x/register/types/resource_node.go | 12 +- x/register/types/tx.pb.go | 788 +++++++++--------- x/register/types/tx.pb.gw.go | 170 ++-- x/register/types/unbonding_node.go | 8 +- x/sds/client/rest/rest_test.go | 72 +- x/sds/keeper/msg_server.go | 2 +- 52 files changed, 1906 insertions(+), 1972 deletions(-) rename x/register/types/{indexing_node.go => meta_node.go} (60%) diff --git a/app/app.go b/app/app.go index 63c4f191..268e858e 100644 --- a/app/app.go +++ b/app/app.go @@ -160,8 +160,8 @@ var ( //upgrading module accounts registertypes.ResourceNodeBondedPoolName: {authtypes.Minter}, registertypes.ResourceNodeNotBondedPoolName: {authtypes.Minter}, - registertypes.IndexingNodeBondedPoolName: {authtypes.Minter}, - registertypes.IndexingNodeNotBondedPoolName: {authtypes.Minter}, + registertypes.MetaNodeBondedPoolName: {authtypes.Minter}, + registertypes.MetaNodeNotBondedPoolName: {authtypes.Minter}, registertypes.TotalUnissuedPrepayName: {authtypes.Minter}, registertypes.TotalSlashedPoolName: {authtypes.Minter, authtypes.Burner}, diff --git a/cmd/stchaind/gen_idx_nodes.go b/cmd/stchaind/gen_idx_nodes.go index eaddc221..6e6ad29f 100644 --- a/cmd/stchaind/gen_idx_nodes.go +++ b/cmd/stchaind/gen_idx_nodes.go @@ -28,16 +28,16 @@ const ( flagGenIdxNodeDir = "gen-idx-node-dir" ) -// AddGenesisIndexingNodeCmd returns add-genesis-indexing-node cobra Command. -func AddGenesisIndexingNodeCmd( +// AddGenesisMetaNodeCmd returns add-genesis-meta-node cobra Command. +func AddGenesisMetaNodeCmd( genBalancesIterator genutiltypes.GenesisBalancesIterator, defaultNodeHome string, ) *cobra.Command { cmd := &cobra.Command{ - Use: "add-genesis-indexing-node", - Short: "Add a genesis indexing node to genesis.json", - Long: `Add a genesis indexing node to genesis.json. If a node name is given, + Use: "add-genesis-meta-node", + Short: "Add a genesis meta node to genesis.json", + Long: `Add a genesis meta node to genesis.json. If a node name is given, the address will be looked up in the local Keybase. `, Args: cobra.ExactArgs(0), @@ -59,9 +59,9 @@ the address will be looked up in the local Keybase. return errors.Wrap(err, "failed to read genesis doc from file") } - appIdxNodes, err := getIndexingNodeInfoFromFile(clientCtx.Codec, genIdxNodesDir, *genDoc, genBalancesIterator) + appIdxNodes, err := getMetaNodeInfoFromFile(clientCtx.Codec, genIdxNodesDir, *genDoc, genBalancesIterator) if err != nil { - return fmt.Errorf("failed to get indexing node from file: %w", err) + return fmt.Errorf("failed to get meta node from file: %w", err) } genFile := config.GenesisFile() @@ -71,12 +71,12 @@ the address will be looked up in the local Keybase. } registerGenState := registertypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) - if registerGenState.GetIndexingNodes() == nil { - registerGenState.IndexingNodes = registertypes.IndexingNodes{} + if registerGenState.GetMetaNodes() == nil { + registerGenState.MetaNodes = registertypes.MetaNodes{} } for i, _ := range appIdxNodes { - registerGenState.IndexingNodes = append(registerGenState.IndexingNodes, appIdxNodes[i]) + registerGenState.MetaNodes = append(registerGenState.MetaNodes, appIdxNodes[i]) } registerGenStateBz, err := clientCtx.Codec.MarshalJSON(®isterGenState) @@ -98,12 +98,12 @@ the address will be looked up in the local Keybase. cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().String(flagGenIdxNodeDir, "", "directory of genesis indexing nodes info") + cmd.Flags().String(flagGenIdxNodeDir, "", "directory of genesis meta nodes info") return cmd } -func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc tmtypes.GenesisDoc, genBalanceIterator genutiltypes.GenesisBalancesIterator, -) (appGenIdxNodes []registertypes.IndexingNode, err error) { +func getMetaNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc tmtypes.GenesisDoc, genBalanceIterator genutiltypes.GenesisBalancesIterator, +) (appGenIdxNodes []registertypes.MetaNode, err error) { var fos []os.FileInfo fos, err = ioutil.ReadDir(genIdxNodesDir) if err != nil { @@ -136,33 +136,33 @@ func getIndexingNodeInfoFromFile(cdc codec.Codec, genIdxNodesDir string, genDoc return appGenIdxNodes, err } - var genIdxNode registertypes.GenesisIndexingNode + var genIdxNode registertypes.GenesisMetaNode if err = cdc.UnmarshalJSON(jsonRawIdxNode, &genIdxNode); err != nil { return appGenIdxNodes, err } - indexingNode, err := genIdxNode.ToIndexingNode() + metaNode, err := genIdxNode.ToMetaNode() if err != nil { return appGenIdxNodes, err } - appGenIdxNodes = append(appGenIdxNodes, indexingNode) + appGenIdxNodes = append(appGenIdxNodes, metaNode) - ownerAddrStr := indexingNode.GetOwnerAddress() + ownerAddrStr := metaNode.GetOwnerAddress() ownerBalance, ok := balanceMap[ownerAddrStr] if !ok { return appGenIdxNodes, fmt.Errorf( "account %v not in genesis.json: %+v", ownerAddrStr, balanceMap) } - if ownerBalance.GetCoins().AmountOf(defaultDemon).LT(indexingNode.Tokens) { + if ownerBalance.GetCoins().AmountOf(defaultDemon).LT(metaNode.Tokens) { return appGenIdxNodes, fmt.Errorf( "insufficient fund for delegation %v: %v < %v", - ownerBalance.GetAddress(), ownerBalance.GetCoins().AmountOf(defaultDemon), indexingNode.Tokens, + ownerBalance.GetAddress(), ownerBalance.GetCoins().AmountOf(defaultDemon), metaNode.Tokens, ) } - fmt.Println("Add indexing node: " + indexingNode.GetNetworkAddress() + " success.") + fmt.Println("Add meta node: " + metaNode.GetNetworkAddress() + " success.") } return appGenIdxNodes, nil diff --git a/cmd/stchaind/root.go b/cmd/stchaind/root.go index c8198790..c05c35c7 100644 --- a/cmd/stchaind/root.go +++ b/cmd/stchaind/root.go @@ -107,7 +107,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.ValidateGenesisCmd(app.ModuleBasics), AddGenesisAccountCmd(app.DefaultNodeHome), - AddGenesisIndexingNodeCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + AddGenesisMetaNodeCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), //TODO: fix these cmds //LoadTestCommands(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome), tmcli.NewCompletionCmd(rootCmd, true), diff --git a/proto/stratos/pot/v1/genesis.proto b/proto/stratos/pot/v1/genesis.proto index cfa786fa..17473fa4 100644 --- a/proto/stratos/pot/v1/genesis.proto +++ b/proto/stratos/pot/v1/genesis.proto @@ -4,13 +4,8 @@ package stratos.pot.v1; import "gogoproto/gogo.proto"; -//import "google/protobuf/any.proto"; - -//import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; - import "stratos/pot/v1/pot.proto"; -//import "stratos/register/v1/register.proto"; option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; @@ -24,19 +19,3 @@ message GenesisState { repeated pot.v1.Reward individual_reward_info = 6 [ (gogoproto.moretags) = "yaml:\"individual_reward_info\""]; } -//message GenesisIndexingNode { -// string networkAddr = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the indexing node -// google.protobuf.Any pubKey = 2 [ -// (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", -// (gogoproto.moretags) = "yaml:\"pubkey\"" -// ]; // the consensus public key of the indexing node; bech encoded in JSON -// bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; // has the indexing node been suspended from bonded status? -// cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\""]; // indexing node status (Unspecified/Bonded/Unbonding/Unbonded) -// string token = 5 [ -// (gogoproto.nullable) = false, -// (gogoproto.moretags) = "yaml:\"token\"", -// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" -// ]; // delegated tokens -// string ownerAddress = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the indexing node -// register.v1.Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; // description terms for the indexing node -//} diff --git a/proto/stratos/pot/v1/query.proto b/proto/stratos/pot/v1/query.proto index 03613a29..7bdc51eb 100644 --- a/proto/stratos/pot/v1/query.proto +++ b/proto/stratos/pot/v1/query.proto @@ -3,9 +3,6 @@ package stratos.pot.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -//import "cosmos/base/query/v1beta1/pagination.proto"; - -//import "stratos/pot/v1/pot.proto"; option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; diff --git a/proto/stratos/pot/v1/tx.proto b/proto/stratos/pot/v1/tx.proto index 0ae12220..4cdaade6 100644 --- a/proto/stratos/pot/v1/tx.proto +++ b/proto/stratos/pot/v1/tx.proto @@ -96,7 +96,7 @@ message MsgFoundationDeposit { message MsgFoundationDepositResponse {} -// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message +// MsgRemoveMetaNode - encapsulates an MsgRemoveMetaNode transaction as an SDK message message MsgSlashingResourceNode { repeated string reporters = 1 [ (gogoproto.jsontag) = "reporters", diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto index 74d38057..fead986e 100644 --- a/proto/stratos/register/v1/genesis.proto +++ b/proto/stratos/register/v1/genesis.proto @@ -23,11 +23,11 @@ message GenesisState { // (gogoproto.castrepeated) = "github.com/stratosnet/stratos-chain/x/register/types.ResourceNodes", (gogoproto.moretags) = "yaml:\"resource_nodes\"" ]; - repeated register.v1.IndexingNode indexing_nodes = 3 [ + repeated register.v1.MetaNode meta_nodes = 3 [ (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "IndexingNodes", -// (gogoproto.castrepeated) = "github.com/stratosnet/stratos-chain/x/register/types.IndexingNodes", - (gogoproto.moretags) = "yaml:\"indexing_nodes\"" + (gogoproto.castrepeated) = "MetaNodes", +// (gogoproto.castrepeated) = "github.com/stratosnet/stratos-chain/x/register/types.MetaNodes", + (gogoproto.moretags) = "yaml:\"meta_nodes\"" ]; string initial_uoz_price = 4 [ (gogoproto.moretags) = "yaml:\"initial_uoz_price\"", @@ -42,19 +42,19 @@ message GenesisState { repeated register.v1.Slashing slashing = 6 [ (gogoproto.moretags) = "yaml:\"slashing_info\"" ]; } -message GenesisIndexingNode { - string network_address = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the indexing node +message GenesisMetaNode { + string network_address = 1 [ (gogoproto.moretags) = "yaml:\"network_address\"" ]; // network address of the meta node google.protobuf.Any pubkey = 2 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"pubkey\"" - ]; // the consensus public key of the indexing node; bech encoded in JSON - bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; // has the indexing node been suspended from bonded status? - cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\""]; // indexing node status (Unspecified/Bonded/Unbonding/Unbonded) + ]; // the consensus public key of the meta node; bech encoded in JSON + bool suspend = 3 [ (gogoproto.moretags) = "yaml:\"suspend\"" ]; // has the meta node been suspended from bonded status? + cosmos.staking.v1beta1.BondStatus status = 4 [ (gogoproto.moretags) = "yaml:\"status\""]; // meta node status (Unspecified/Bonded/Unbonding/Unbonded) string tokens = 5 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"token\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ]; // delegated tokens - string owner_address = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the indexing node - register.v1.Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; // description terms for the indexing node + string owner_address = 6 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ]; // owner address of the meta node + register.v1.Description description = 7 [ (gogoproto.moretags) = "yaml:\"description\",omitempty" ]; // description terms for the meta node } diff --git a/proto/stratos/register/v1/query.proto b/proto/stratos/register/v1/query.proto index 66bf0537..7b6f73bf 100644 --- a/proto/stratos/register/v1/query.proto +++ b/proto/stratos/register/v1/query.proto @@ -15,9 +15,9 @@ service Query { option (google.api.http).get = "/stratos/register/v1/resource-nodes/{network_addr}"; } - // IndexingNode queries IndexingNode info for given IndexingNode address. - rpc IndexingNode(QueryIndexingNodeRequest) returns (QueryIndexingNodeResponse) { - option (google.api.http).get = "/stratos/register/v1/indexing-nodes/{network_addr}"; + // MetaNode queries MetaNode info for given MetaNode address. + rpc MetaNode(QueryMetaNodeRequest) returns (QueryMetaNodeResponse) { + option (google.api.http).get = "/stratos/register/v1/meta-nodes/{network_addr}"; } // Params queries Register module Params info. @@ -53,16 +53,16 @@ message QueryResourceNodeResponse { ResourceNode node = 1; } -// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method -message QueryIndexingNodeRequest { +// QueryMetaNodeRequest is request type for the Query/MetaNode RPC method +message QueryMetaNodeRequest { // network_addr defines the node network address to query for. string network_addr = 1; } -// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method -message QueryIndexingNodeResponse { - // node defines the the indexing info. - IndexingNode node = 1; +// QueryMetaNodeResponse is response type for the Query/MetaNode RPC method +message QueryMetaNodeResponse { + // node defines the the meta info. + MetaNode node = 1; } // QueryStakeByNodeRequest is request type for the Query/StakeByNode RPC method diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index 06226f94..b6adad19 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -84,7 +84,7 @@ message ResourceNode { } -message IndexingNode { +message MetaNode { option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = true; @@ -126,7 +126,7 @@ message IndexingNode { ]; } -message IndexingNodeRegistrationVotePool { +message MetaNodeRegistrationVotePool { string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" @@ -186,13 +186,13 @@ message Slashing { // repeated ResourceNode resource_nodes = 1; //} // -//message IndexingNodes { -// repeated IndexingNode indexing_nodes = 1; +//message MetaNodes { +// repeated MetaNode meta_nodes = 1; //} message TotalStakesResponse { cosmos.base.v1beta1.Coin resource_nodes_total_stake = 1; - cosmos.base.v1beta1.Coin indexing_nodes_total_stake = 2; + cosmos.base.v1beta1.Coin meta_nodes_total_stake = 2; cosmos.base.v1beta1.Coin total_bonded_stake = 3; cosmos.base.v1beta1.Coin total_unbonded_stake = 4; cosmos.base.v1beta1.Coin total_unbonding_stake = 5; @@ -263,9 +263,9 @@ message UnbondingNode { (gogoproto.jsontag) = "network_addr", (gogoproto.moretags) = "yaml:\"network_addr\"" ]; - bool is_indexing_node = 2 [ - (gogoproto.jsontag) = "is_indexing_node", - (gogoproto.moretags) = "yaml:\"is_indexing_node\"" + bool is_meta_node = 2 [ + (gogoproto.jsontag) = "is_meta_node", + (gogoproto.moretags) = "yaml:\"is_meta_node\"" ]; repeated UnbondingNodeEntry entries = 3 [ (gogoproto.jsontag) = "entries", diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto index ef9520fb..399348e7 100644 --- a/proto/stratos/register/v1/tx.proto +++ b/proto/stratos/register/v1/tx.proto @@ -28,20 +28,20 @@ service Msg { option (google.api.http).post = "/stratos/register/v1/update_resource_node_stake"; }; - rpc HandleMsgCreateIndexingNode(MsgCreateIndexingNode) returns (MsgCreateIndexingNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/create_indexing_node"; + rpc HandleMsgCreateMetaNode(MsgCreateMetaNode) returns (MsgCreateMetaNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/create_meta_node"; }; - rpc HandleMsgRemoveIndexingNode(MsgRemoveIndexingNode) returns (MsgRemoveIndexingNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/remove_indexing_node"; + rpc HandleMsgRemoveMetaNode(MsgRemoveMetaNode) returns (MsgRemoveMetaNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/remove_meta_node"; }; - rpc HandleMsgUpdateIndexingNode(MsgUpdateIndexingNode) returns (MsgUpdateIndexingNodeResponse) { - option (google.api.http).post = "/stratos/register/v1/update_indexing_node"; + rpc HandleMsgUpdateMetaNode(MsgUpdateMetaNode) returns (MsgUpdateMetaNodeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_meta_node"; }; - rpc HandleMsgUpdateIndexingNodeStake(MsgUpdateIndexingNodeStake) returns (MsgUpdateIndexingNodeStakeResponse) { - option (google.api.http).post = "/stratos/register/v1/update_indexing_node_stake"; + rpc HandleMsgUpdateMetaNodeStake(MsgUpdateMetaNodeStake) returns (MsgUpdateMetaNodeStakeResponse) { + option (google.api.http).post = "/stratos/register/v1/update_meta_node_stake"; }; - rpc HandleMsgIndexingNodeRegistrationVote(MsgIndexingNodeRegistrationVote) returns (MsgIndexingNodeRegistrationVoteResponse) { - option (google.api.http).post = "/stratos/register/v1/indexing_node_registration_vote"; + rpc HandleMsgMetaNodeRegistrationVote(MsgMetaNodeRegistrationVote) returns (MsgMetaNodeRegistrationVoteResponse) { + option (google.api.http).post = "/stratos/register/v1/meta_node_registration_vote"; }; } @@ -79,8 +79,8 @@ message MsgCreateResourceNode { // MsgCreateResourceNodeResponse defines the CreateResourceNodeTx response type message MsgCreateResourceNodeResponse {} -// MsgCreateIndexingNode encapsulates an MsgCreateIndexingNodeTx transaction as an SDK message. -message MsgCreateIndexingNode { +// MsgCreateMetaNode encapsulates an MsgCreateMetaNodeTx transaction as an SDK message. +message MsgCreateMetaNode { string network_address = 1 [ (gogoproto.jsontag) = "network_address", (gogoproto.moretags) = "yaml:\"network_address\"" @@ -106,8 +106,8 @@ message MsgCreateIndexingNode { } -// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type -message MsgCreateIndexingNodeResponse {} +// MsgCreateMetaNodeResponse defines the CreateMetaNode response type +message MsgCreateMetaNodeResponse {} // MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message message MsgRemoveResourceNode { @@ -126,13 +126,13 @@ message MsgRemoveResourceNode { // MsgRemoveResourceNodeResponse defines the Msg/RemoveResourceNode response type. message MsgRemoveResourceNodeResponse {} -// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message -message MsgRemoveIndexingNode { +// MsgRemoveMetaNode - encapsulates an MsgRemoveMetaNode transaction as an SDK message +message MsgRemoveMetaNode { option (gogoproto.goproto_getters) = false; - string indexing_node_address = 1 [ - (gogoproto.jsontag) = "indexing_node_address", - (gogoproto.moretags) = "yaml:\"indexing_node_address\"" + string meta_node_address = 1 [ + (gogoproto.jsontag) = "meta_node_address", + (gogoproto.moretags) = "yaml:\"meta_node_address\"" ]; string owner_address = 2 [ (gogoproto.jsontag) = "owner_address", @@ -140,8 +140,8 @@ message MsgRemoveIndexingNode { ]; } -// MsgRemoveIndexingNodeResponse defines the Msg/RemoveIndexingNode response type. -message MsgRemoveIndexingNodeResponse {} +// MsgRemoveMetaNodeResponse defines the Msg/RemoveMetaNode response type. +message MsgRemoveMetaNodeResponse {} // MsgUpdateResourceNode defines a SDK message for updating an existing resource node. @@ -171,8 +171,8 @@ message MsgUpdateResourceNode { message MsgUpdateResourceNodeResponse {} -// MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. -message MsgUpdateIndexingNode { +// MsgUpdateMetaNode defines a SDK message for updating an existing meta node. +message MsgUpdateMetaNode { option (gogoproto.goproto_getters) = false; Description description = 1 [ @@ -190,8 +190,8 @@ message MsgUpdateIndexingNode { ]; } -// MsgUpdateIndexingNodeResponse defines the Msg/UpdateIndexingNode response type. -message MsgUpdateIndexingNodeResponse {} +// MsgUpdateMetaNodeResponse defines the Msg/UpdateMetaNode response type. +message MsgUpdateMetaNodeResponse {} // MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. @@ -220,8 +220,8 @@ message MsgUpdateResourceNodeStake { message MsgUpdateResourceNodeStakeResponse {} -// MsgUpdateIndexingNodeStake defines a SDK message for updating the stake of an existing indexing node. -message MsgUpdateIndexingNodeStake { +// MsgUpdateMetaNodeStake defines a SDK message for updating the stake of an existing meta node. +message MsgUpdateMetaNodeStake { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -244,21 +244,21 @@ message MsgUpdateIndexingNodeStake { } // MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. -message MsgUpdateIndexingNodeStakeResponse {} +message MsgUpdateMetaNodeStakeResponse {} -// MsgIndexingNodeRegistrationVote defines a SDK message for registration vote of an existing indexing node. -message MsgIndexingNodeRegistrationVote { +// MsgMetaNodeRegistrationVote defines a SDK message for registration vote of an existing meta node. +message MsgMetaNodeRegistrationVote { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; string candidate_network_address = 1 [ (gogoproto.jsontag) = "candidate_network_address", (gogoproto.moretags) = "yaml:\"candidate_network_address\"" - ]; // node address of indexing node + ]; // node address of meta node string candidate_owner_address = 2 [ (gogoproto.jsontag) = "candidate_owner_address", (gogoproto.moretags) = "yaml:\"candidate_owner_address\"" - ]; // owner address of indexing node + ]; // owner address of meta node bool opinion = 3 [ (gogoproto.jsontag) = "opinion", (gogoproto.moretags) = "yaml:\"opinion\"" @@ -266,12 +266,12 @@ message MsgIndexingNodeRegistrationVote { string voter_network_address = 4 [ (gogoproto.jsontag) = "voter_network_address", (gogoproto.moretags) = "yaml:\"voter_network_address\"" - ]; // address of voter (other existed indexing node) + ]; // address of voter (other existed meta node) string voter_owner_address = 5 [ (gogoproto.jsontag) = "voter_owner_address", (gogoproto.moretags) = "yaml:\"voter_owner_address\"" - ]; // address of owner of the voter (other existed indexing node) + ]; // address of owner of the voter (other existed meta node) } -// MsgUpdateResourceNodeStakeResponse defines the Msg/IndexingNodeRegistrationVote response type. -message MsgIndexingNodeRegistrationVoteResponse {} +// MsgUpdateResourceNodeStakeResponse defines the Msg/MetaNodeRegistrationVote response type. +message MsgMetaNodeRegistrationVoteResponse {} diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index d673747d..8e9519e3 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -35,8 +35,8 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single //3, calc reward for resource node, store to rewardDetailMap by wallet address(owner address) rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNode(ctx, totalConsumedUoz, trafficList, distributeGoalBalance, rewardDetailMap) - //4, calc reward from indexing node, store to rewardDetailMap by wallet address(owner address) - rewardDetailMap, distributeGoalBalance = k.CalcRewardForIndexingNode(ctx, distributeGoalBalance, rewardDetailMap) + //4, calc reward from meta node, store to rewardDetailMap by wallet address(owner address) + rewardDetailMap, distributeGoalBalance = k.CalcRewardForMetaNode(ctx, distributeGoalBalance, rewardDetailMap) //5, [TLC] deduct reward from provider account (the value of parameter of distributeGoal will not change) err = k.deductRewardFromRewardProviderAccount(ctx, distributeGoal, epoch) @@ -53,7 +53,7 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single //7, IMPORTANT: sort map and convert to slice to keep the order rewardDetailList := sortDetailMapToSlice(rewardDetailMap) - //8, distribute all rewards to resource nodes & indexing nodes + //8, distribute all rewards to resource nodes & meta nodes err = k.distributeRewardToSdsNodes(ctx, rewardDetailList, epoch) if err != nil { return totalConsumedUoz, err @@ -82,13 +82,13 @@ func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []*types.Single func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal types.DistributeGoal, epoch sdk.Int) (err error) { totalRewardFromMiningPool := goal.BlockChainRewardToValidatorFromMiningPool. - Add(goal.BlockChainRewardToIndexingNodeFromMiningPool). - Add(goal.MetaNodeRewardToIndexingNodeFromMiningPool). + Add(goal.BlockChainRewardToMetaNodeFromMiningPool). + Add(goal.MetaNodeRewardToMetaNodeFromMiningPool). Add(goal.BlockChainRewardToResourceNodeFromMiningPool). Add(goal.TrafficRewardToResourceNodeFromMiningPool) totalRewardFromTrafficPool := goal.BlockChainRewardToValidatorFromTrafficPool. - Add(goal.BlockChainRewardToIndexingNodeFromTrafficPool). - Add(goal.MetaNodeRewardToIndexingNodeFromTrafficPool). + Add(goal.BlockChainRewardToMetaNodeFromTrafficPool). + Add(goal.MetaNodeRewardToMetaNodeFromTrafficPool). Add(goal.BlockChainRewardToResourceNodeFromTrafficPool). Add(goal.TrafficRewardToResourceNodeFromTrafficPool) @@ -140,12 +140,12 @@ func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal type } func (k Keeper) returnBalance(ctx sdk.Context, balance types.DistributeGoal, currentEpoch sdk.Int) (err error) { - balanceOfMiningPool := balance.BlockChainRewardToIndexingNodeFromMiningPool. - Add(balance.MetaNodeRewardToIndexingNodeFromMiningPool). + balanceOfMiningPool := balance.BlockChainRewardToMetaNodeFromMiningPool. + Add(balance.MetaNodeRewardToMetaNodeFromMiningPool). Add(balance.BlockChainRewardToResourceNodeFromMiningPool). Add(balance.TrafficRewardToResourceNodeFromMiningPool) - balanceOfTrafficPool := balance.BlockChainRewardToIndexingNodeFromTrafficPool. - Add(balance.MetaNodeRewardToIndexingNodeFromTrafficPool). + balanceOfTrafficPool := balance.BlockChainRewardToMetaNodeFromTrafficPool. + Add(balance.MetaNodeRewardToMetaNodeFromTrafficPool). Add(balance.BlockChainRewardToResourceNodeFromTrafficPool). Add(balance.TrafficRewardToResourceNodeFromTrafficPool) @@ -199,16 +199,16 @@ func (k Keeper) CalcTrafficRewardInTotal( trafficReward := totalTrafficReward. Mul(miningParam.ResourceNodePercentageInTenThousand.ToDec()). Quo(sdk.NewDec(10000)).TruncateInt() - indexingReward := totalTrafficReward. + metaReward := totalTrafficReward. Mul(miningParam.MetaNodePercentageInTenThousand.ToDec()). Quo(sdk.NewDec(10000)).TruncateInt() - stakeRewardToValidators, stakeRewardToResourceNodes, stakeRewardToIndexingNodes := k.splitRewardByStake(ctx, stakeReward) + stakeRewardToValidators, stakeRewardToResourceNodes, stakeRewardToMetaNodes := k.splitRewardByStake(ctx, stakeReward) distributeGoal = distributeGoal.AddBlockChainRewardToValidatorFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), stakeRewardToValidators)) distributeGoal = distributeGoal.AddBlockChainRewardToResourceNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), stakeRewardToResourceNodes)) - distributeGoal = distributeGoal.AddBlockChainRewardToIndexingNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), stakeRewardToIndexingNodes)) + distributeGoal = distributeGoal.AddBlockChainRewardToMetaNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), stakeRewardToMetaNodes)) distributeGoal = distributeGoal.AddTrafficRewardToResourceNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), trafficReward)) - distributeGoal = distributeGoal.AddMetaNodeRewardToIndexingNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), indexingReward)) + distributeGoal = distributeGoal.AddMetaNodeRewardToMetaNodeFromTrafficPool(sdk.NewCoin(k.BondDenom(ctx), metaReward)) return distributeGoal, nil } @@ -258,16 +258,16 @@ func (k Keeper) CalcMiningRewardInTotal(ctx sdk.Context, distributeGoal types.Di trafficReward := totalMiningReward.Amount.ToDec(). Mul(miningParam.ResourceNodePercentageInTenThousand.ToDec()). Quo(sdk.NewDec(10000)).TruncateInt() - indexingReward := totalMiningReward.Amount.ToDec(). + metaReward := totalMiningReward.Amount.ToDec(). Mul(miningParam.MetaNodePercentageInTenThousand.ToDec()). Quo(sdk.NewDec(10000)).TruncateInt() - stakeRewardToValidators, stakeRewardToResourceNodes, stakeRewardToIndexingNodes := k.splitRewardByStake(ctx, stakeReward) + stakeRewardToValidators, stakeRewardToResourceNodes, stakeRewardToMetaNodes := k.splitRewardByStake(ctx, stakeReward) distributeGoal = distributeGoal.AddBlockChainRewardToValidatorFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardToValidators)) distributeGoal = distributeGoal.AddBlockChainRewardToResourceNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardToResourceNodes)) - distributeGoal = distributeGoal.AddBlockChainRewardToIndexingNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardToIndexingNodes)) + distributeGoal = distributeGoal.AddBlockChainRewardToMetaNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), stakeRewardToMetaNodes)) distributeGoal = distributeGoal.AddTrafficRewardToResourceNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), trafficReward)) - distributeGoal = distributeGoal.AddMetaNodeRewardToIndexingNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), indexingReward)) + distributeGoal = distributeGoal.AddMetaNodeRewardToMetaNodeFromMiningPool(sdk.NewCoin(k.RewardDenom(ctx), metaReward)) return distributeGoal, nil } @@ -453,18 +453,18 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, totalConsumedUoz sdk. return rewardDetailMap, distributeGoalBalance } -func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoalBalance types.DistributeGoal, rewardDetailMap map[string]types.Reward, +func (k Keeper) CalcRewardForMetaNode(ctx sdk.Context, distributeGoalBalance types.DistributeGoal, rewardDetailMap map[string]types.Reward, ) (map[string]types.Reward, types.DistributeGoal) { totalUsedStakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) totalUsedStakeRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - totalUsedIndexingRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) - totalUsedIndexingRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) + totalUsedMetaRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) + totalUsedMetaRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - totalStakeOfIndexingNodes := k.RegisterKeeper.GetIndexingNodeBondedToken(ctx).Amount - indexingNodeList := k.RegisterKeeper.GetAllIndexingNodes(ctx) - indexingNodeCnt := sdk.NewInt(int64(len(indexingNodeList))) - for _, node := range indexingNodeList { + totalStakeOfMetaNodes := k.RegisterKeeper.GetMetaNodeBondedToken(ctx).Amount + metaNodeList := k.RegisterKeeper.GetAllMetaNodes(ctx) + metaNodeCnt := sdk.NewInt(int64(len(metaNodeList))) + for _, node := range metaNodeList { walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) if err != nil { continue @@ -475,23 +475,23 @@ func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoalBalance } // 1, calc stake reward - shareOfToken := tokens.ToDec().Quo(totalStakeOfIndexingNodes.ToDec()) + shareOfToken := tokens.ToDec().Quo(totalStakeOfMetaNodes.ToDec()) stakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), - distributeGoalBalance.BlockChainRewardToIndexingNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) + distributeGoalBalance.BlockChainRewardToMetaNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) stakeRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), - distributeGoalBalance.BlockChainRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) + distributeGoalBalance.BlockChainRewardToMetaNodeFromTrafficPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) totalUsedStakeRewardFromMiningPool = totalUsedStakeRewardFromMiningPool.Add(stakeRewardFromMiningPool) totalUsedStakeRewardFromTrafficPool = totalUsedStakeRewardFromTrafficPool.Add(stakeRewardFromTrafficPool) - // 2, calc indexing reward - indexingRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), - distributeGoalBalance.MetaNodeRewardToIndexingNodeFromMiningPool.Amount.ToDec().Quo(indexingNodeCnt.ToDec()).TruncateInt()) - indexingRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), - distributeGoalBalance.MetaNodeRewardToIndexingNodeFromTrafficPool.Amount.ToDec().Quo(indexingNodeCnt.ToDec()).TruncateInt()) + // 2, calc meta reward + metaRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), + distributeGoalBalance.MetaNodeRewardToMetaNodeFromMiningPool.Amount.ToDec().Quo(metaNodeCnt.ToDec()).TruncateInt()) + metaRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), + distributeGoalBalance.MetaNodeRewardToMetaNodeFromTrafficPool.Amount.ToDec().Quo(metaNodeCnt.ToDec()).TruncateInt()) - totalUsedIndexingRewardFromMiningPool = totalUsedIndexingRewardFromMiningPool.Add(indexingRewardFromMiningPool) - totalUsedIndexingRewardFromTrafficPool = totalUsedIndexingRewardFromTrafficPool.Add(indexingRewardFromTrafficPool) + totalUsedMetaRewardFromMiningPool = totalUsedMetaRewardFromMiningPool.Add(metaRewardFromMiningPool) + totalUsedMetaRewardFromTrafficPool = totalUsedMetaRewardFromTrafficPool.Add(metaRewardFromTrafficPool) if _, ok := rewardDetailMap[walletAddr.String()]; !ok { reward := types.NewDefaultReward(walletAddr) @@ -499,19 +499,19 @@ func (k Keeper) CalcRewardForIndexingNode(ctx sdk.Context, distributeGoalBalance } newReward := rewardDetailMap[walletAddr.String()] - newReward = newReward.AddRewardFromMiningPool(stakeRewardFromMiningPool.Add(indexingRewardFromMiningPool)) - newReward = newReward.AddRewardFromTrafficPool(stakeRewardFromTrafficPool.Add(indexingRewardFromTrafficPool)) + newReward = newReward.AddRewardFromMiningPool(stakeRewardFromMiningPool.Add(metaRewardFromMiningPool)) + newReward = newReward.AddRewardFromTrafficPool(stakeRewardFromTrafficPool.Add(metaRewardFromTrafficPool)) rewardDetailMap[walletAddr.String()] = newReward } // deduct used reward from distributeGoal - distributeGoalBalance.BlockChainRewardToIndexingNodeFromMiningPool = - distributeGoalBalance.BlockChainRewardToIndexingNodeFromMiningPool.Sub(totalUsedStakeRewardFromMiningPool) - distributeGoalBalance.BlockChainRewardToIndexingNodeFromTrafficPool = - distributeGoalBalance.BlockChainRewardToIndexingNodeFromTrafficPool.Sub(totalUsedStakeRewardFromTrafficPool) - distributeGoalBalance.MetaNodeRewardToIndexingNodeFromMiningPool = - distributeGoalBalance.MetaNodeRewardToIndexingNodeFromMiningPool.Sub(totalUsedIndexingRewardFromMiningPool) - distributeGoalBalance.MetaNodeRewardToIndexingNodeFromTrafficPool = - distributeGoalBalance.MetaNodeRewardToIndexingNodeFromTrafficPool.Sub(totalUsedIndexingRewardFromTrafficPool) + distributeGoalBalance.BlockChainRewardToMetaNodeFromMiningPool = + distributeGoalBalance.BlockChainRewardToMetaNodeFromMiningPool.Sub(totalUsedStakeRewardFromMiningPool) + distributeGoalBalance.BlockChainRewardToMetaNodeFromTrafficPool = + distributeGoalBalance.BlockChainRewardToMetaNodeFromTrafficPool.Sub(totalUsedStakeRewardFromTrafficPool) + distributeGoalBalance.MetaNodeRewardToMetaNodeFromMiningPool = + distributeGoalBalance.MetaNodeRewardToMetaNodeFromMiningPool.Sub(totalUsedMetaRewardFromMiningPool) + distributeGoalBalance.MetaNodeRewardToMetaNodeFromTrafficPool = + distributeGoalBalance.MetaNodeRewardToMetaNodeFromTrafficPool.Sub(totalUsedMetaRewardFromTrafficPool) return rewardDetailMap, distributeGoalBalance } @@ -529,17 +529,17 @@ func (k Keeper) GetTotalConsumedUoz(trafficList []*types.SingleWalletVolume) sdk } func (k Keeper) splitRewardByStake(ctx sdk.Context, totalReward sdk.Int, -) (validatorReward sdk.Int, resourceNodeReward sdk.Int, indexingNodeReward sdk.Int) { +) (validatorReward sdk.Int, resourceNodeReward sdk.Int, metaNodeReward sdk.Int) { validatorBondedTokens := k.StakingKeeper.TotalBondedTokens(ctx).ToDec() resourceNodeBondedTokens := k.RegisterKeeper.GetResourceNodeBondedToken(ctx).Amount.ToDec() - indexingNodeBondedTokens := k.RegisterKeeper.GetIndexingNodeBondedToken(ctx).Amount.ToDec() + metaNodeBondedTokens := k.RegisterKeeper.GetMetaNodeBondedToken(ctx).Amount.ToDec() - totalBondedTokens := validatorBondedTokens.Add(resourceNodeBondedTokens).Add(indexingNodeBondedTokens) + totalBondedTokens := validatorBondedTokens.Add(resourceNodeBondedTokens).Add(metaNodeBondedTokens) validatorReward = totalReward.ToDec().Mul(validatorBondedTokens).Quo(totalBondedTokens).TruncateInt() resourceNodeReward = totalReward.ToDec().Mul(resourceNodeBondedTokens).Quo(totalBondedTokens).TruncateInt() - indexingNodeReward = totalReward.ToDec().Mul(indexingNodeBondedTokens).Quo(totalBondedTokens).TruncateInt() + metaNodeReward = totalReward.ToDec().Mul(metaNodeBondedTokens).Quo(totalBondedTokens).TruncateInt() return } diff --git a/x/pot/keeper/keeper.go b/x/pot/keeper/keeper.go index 625e2560..23ce08a8 100644 --- a/x/pot/keeper/keeper.go +++ b/x/pot/keeper/keeper.go @@ -59,7 +59,7 @@ func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes []*types.SingleWalle } func (k Keeper) IsSPNode(ctx sdk.Context, p2pAddr stratos.SdsAddress) (found bool) { - _, found = k.RegisterKeeper.GetIndexingNode(ctx, p2pAddr) + _, found = k.RegisterKeeper.GetMetaNode(ctx, p2pAddr) return found } diff --git a/x/pot/keeper/slashing.go b/x/pot/keeper/slashing.go index a8e464ae..9cce7ee4 100644 --- a/x/pot/keeper/slashing.go +++ b/x/pot/keeper/slashing.go @@ -14,7 +14,7 @@ import ( Deduct slashing amount when: 1, calculate upcoming mature reward, deduct from mature_total & upcoming mature reward. - 2, unstaking indexing node. + 2, unstaking meta node. 3, unstaking resource node. */ func (k Keeper) SlashingResourceNode(ctx sdk.Context, p2pAddr stratos.SdsAddress, walletAddr sdk.AccAddress, diff --git a/x/pot/types/distribute.go b/x/pot/types/distribute.go index ccd9a0ec..070dcf9c 100644 --- a/x/pot/types/distribute.go +++ b/x/pot/types/distribute.go @@ -17,10 +17,10 @@ type DistributeGoal struct { BlockChainRewardToValidatorFromMiningPool sdk.Coin `json:"block_chain_reward_to_validator_from_mining_pool" yaml:"block_chain_reward_to_validator_from_mining_pool"` // 20% mining reward * stakeOfAllValidators / totalStake BlockChainRewardToValidatorFromTrafficPool sdk.Coin `json:"block_chain_reward_to_validator_from_traffic_pool" yaml:"block_chain_reward_to_validator_from_traffic_pool"` // 20% traffic reward * stakeOfAllValidators / totalStake - BlockChainRewardToIndexingNodeFromMiningPool sdk.Coin `json:"block_chain_reward_to_indexing_node_from_mining_pool" yaml:"block_chain_reward_to_indexing_node_from_mining_pool"` // 20% mining reward * stakeOfAllIndexingNodes / totalStake - BlockChainRewardToIndexingNodeFromTrafficPool sdk.Coin `json:"block_chain_reward_to_indexing_node_from_traffic_pool" yaml:"block_chain_reward_to_indexing_node_from_traffic_pool"` // 20% traffic reward * stakeOfAllValidators / totalStake - MetaNodeRewardToIndexingNodeFromMiningPool sdk.Coin `json:"meta_node_reward_to_indexing_node_from_mining_pool" yaml:"meta_node_reward_to_indexing_node_from_mining_pool"` // 20% of mining reward, distribute equally - MetaNodeRewardToIndexingNodeFromTrafficPool sdk.Coin `json:"meta_node_reward_to_indexing_node_from_traffic_pool" yaml:"meta_node_reward_to_indexing_node_from_traffic_pool"` // 20% of traffic reward, distribute equally + BlockChainRewardToMetaNodeFromMiningPool sdk.Coin `json:"block_chain_reward_to_meta_node_from_mining_pool" yaml:"block_chain_reward_to_meta_node_from_mining_pool"` // 20% mining reward * stakeOfAllMetaNodes / totalStake + BlockChainRewardToMetaNodeFromTrafficPool sdk.Coin `json:"block_chain_reward_to_meta_node_from_traffic_pool" yaml:"block_chain_reward_to_meta_node_from_traffic_pool"` // 20% traffic reward * stakeOfAllValidators / totalStake + MetaNodeRewardToMetaNodeFromMiningPool sdk.Coin `json:"meta_node_reward_to_meta_node_from_mining_pool" yaml:"meta_node_reward_to_meta_node_from_mining_pool"` // 20% of mining reward, distribute equally + MetaNodeRewardToMetaNodeFromTrafficPool sdk.Coin `json:"meta_node_reward_to_meta_node_from_traffic_pool" yaml:"meta_node_reward_to_meta_node_from_traffic_pool"` // 20% of traffic reward, distribute equally BlockChainRewardToResourceNodeFromMiningPool sdk.Coin `json:"block_chain_reward_to_resource_node_from_mining_pool" yaml:"block_chain_reward_to_resource_node_from_mining_pool"` // 20% mining reward * stakeOfAllResourceNodes / totalStake BlockChainRewardToResourceNodeFromTrafficPool sdk.Coin `json:"block_chain_reward_to_resource_node_from_traffic_pool" yaml:"block_chain_reward_to_resource_node_from_traffic_pool"` // 20% traffic reward * stakeOfAllValidators / totalStake @@ -29,19 +29,19 @@ type DistributeGoal struct { } func NewDistributeGoal( - blockChainRewardToValidatorFromMiningPool sdk.Coin, blockChainRewardToResourceNodeFromMiningPool sdk.Coin, blockChainRewardToIndexingNodeFromMiningPool sdk.Coin, - blockChainRewardToValidatorFromTrafficPool sdk.Coin, blockChainRewardToResourceNodeFromTrafficPool sdk.Coin, blockChainRewardToIndexingNodeFromTrafficPool sdk.Coin, - metaNodeRewardToIndexingNodeFromMiningPool sdk.Coin, metaNodeRewardToIndexingNodeFromTrafficPool sdk.Coin, trafficRewardToResourceNodeFromMiningPool sdk.Coin, + blockChainRewardToValidatorFromMiningPool sdk.Coin, blockChainRewardToResourceNodeFromMiningPool sdk.Coin, blockChainRewardToMetaNodeFromMiningPool sdk.Coin, + blockChainRewardToValidatorFromTrafficPool sdk.Coin, blockChainRewardToResourceNodeFromTrafficPool sdk.Coin, blockChainRewardToMetaNodeFromTrafficPool sdk.Coin, + metaNodeRewardToMetaNodeFromMiningPool sdk.Coin, metaNodeRewardToMetaNodeFromTrafficPool sdk.Coin, trafficRewardToResourceNodeFromMiningPool sdk.Coin, trafficRewardToResourceNodeFromTrafficPool sdk.Coin) DistributeGoal { return DistributeGoal{ BlockChainRewardToValidatorFromMiningPool: blockChainRewardToValidatorFromMiningPool, BlockChainRewardToResourceNodeFromMiningPool: blockChainRewardToResourceNodeFromMiningPool, - BlockChainRewardToIndexingNodeFromMiningPool: blockChainRewardToIndexingNodeFromMiningPool, + BlockChainRewardToMetaNodeFromMiningPool: blockChainRewardToMetaNodeFromMiningPool, BlockChainRewardToValidatorFromTrafficPool: blockChainRewardToValidatorFromTrafficPool, BlockChainRewardToResourceNodeFromTrafficPool: blockChainRewardToResourceNodeFromTrafficPool, - BlockChainRewardToIndexingNodeFromTrafficPool: blockChainRewardToIndexingNodeFromTrafficPool, - MetaNodeRewardToIndexingNodeFromMiningPool: metaNodeRewardToIndexingNodeFromMiningPool, - MetaNodeRewardToIndexingNodeFromTrafficPool: metaNodeRewardToIndexingNodeFromTrafficPool, + BlockChainRewardToMetaNodeFromTrafficPool: blockChainRewardToMetaNodeFromTrafficPool, + MetaNodeRewardToMetaNodeFromMiningPool: metaNodeRewardToMetaNodeFromMiningPool, + MetaNodeRewardToMetaNodeFromTrafficPool: metaNodeRewardToMetaNodeFromTrafficPool, TrafficRewardToResourceNodeFromMiningPool: trafficRewardToResourceNodeFromMiningPool, TrafficRewardToResourceNodeFromTrafficPool: trafficRewardToResourceNodeFromTrafficPool, } @@ -80,11 +80,11 @@ func (d DistributeGoal) AddBlockChainRewardToResourceNodeFromMiningPool(reward s return d } -func (d DistributeGoal) AddBlockChainRewardToIndexingNodeFromMiningPool(reward sdk.Coin) DistributeGoal { - if d.BlockChainRewardToIndexingNodeFromMiningPool.IsEqual(sdk.Coin{}) { - d.BlockChainRewardToIndexingNodeFromMiningPool = reward +func (d DistributeGoal) AddBlockChainRewardToMetaNodeFromMiningPool(reward sdk.Coin) DistributeGoal { + if d.BlockChainRewardToMetaNodeFromMiningPool.IsEqual(sdk.Coin{}) { + d.BlockChainRewardToMetaNodeFromMiningPool = reward } else { - d.BlockChainRewardToIndexingNodeFromMiningPool = d.BlockChainRewardToIndexingNodeFromMiningPool.Add(reward) + d.BlockChainRewardToMetaNodeFromMiningPool = d.BlockChainRewardToMetaNodeFromMiningPool.Add(reward) } return d } @@ -106,27 +106,27 @@ func (d DistributeGoal) AddBlockChainRewardToResourceNodeFromTrafficPool(reward return d } -func (d DistributeGoal) AddBlockChainRewardToIndexingNodeFromTrafficPool(reward sdk.Coin) DistributeGoal { - if d.BlockChainRewardToIndexingNodeFromTrafficPool.IsEqual(sdk.Coin{}) { - d.BlockChainRewardToIndexingNodeFromTrafficPool = reward +func (d DistributeGoal) AddBlockChainRewardToMetaNodeFromTrafficPool(reward sdk.Coin) DistributeGoal { + if d.BlockChainRewardToMetaNodeFromTrafficPool.IsEqual(sdk.Coin{}) { + d.BlockChainRewardToMetaNodeFromTrafficPool = reward } else { - d.BlockChainRewardToIndexingNodeFromTrafficPool = d.BlockChainRewardToIndexingNodeFromTrafficPool.Add(reward) + d.BlockChainRewardToMetaNodeFromTrafficPool = d.BlockChainRewardToMetaNodeFromTrafficPool.Add(reward) } return d } -func (d DistributeGoal) AddMetaNodeRewardToIndexingNodeFromMiningPool(reward sdk.Coin) DistributeGoal { - if d.MetaNodeRewardToIndexingNodeFromMiningPool.IsEqual(sdk.Coin{}) { - d.MetaNodeRewardToIndexingNodeFromMiningPool = reward +func (d DistributeGoal) AddMetaNodeRewardToMetaNodeFromMiningPool(reward sdk.Coin) DistributeGoal { + if d.MetaNodeRewardToMetaNodeFromMiningPool.IsEqual(sdk.Coin{}) { + d.MetaNodeRewardToMetaNodeFromMiningPool = reward } else { - d.MetaNodeRewardToIndexingNodeFromMiningPool = d.MetaNodeRewardToIndexingNodeFromMiningPool.Add(reward) + d.MetaNodeRewardToMetaNodeFromMiningPool = d.MetaNodeRewardToMetaNodeFromMiningPool.Add(reward) } return d } -func (d DistributeGoal) AddMetaNodeRewardToIndexingNodeFromTrafficPool(reward sdk.Coin) DistributeGoal { - if d.MetaNodeRewardToIndexingNodeFromTrafficPool.IsEqual(sdk.Coin{}) { - d.MetaNodeRewardToIndexingNodeFromTrafficPool = reward +func (d DistributeGoal) AddMetaNodeRewardToMetaNodeFromTrafficPool(reward sdk.Coin) DistributeGoal { + if d.MetaNodeRewardToMetaNodeFromTrafficPool.IsEqual(sdk.Coin{}) { + d.MetaNodeRewardToMetaNodeFromTrafficPool = reward } else { - d.MetaNodeRewardToIndexingNodeFromTrafficPool = d.MetaNodeRewardToIndexingNodeFromTrafficPool.Add(reward) + d.MetaNodeRewardToMetaNodeFromTrafficPool = d.MetaNodeRewardToMetaNodeFromTrafficPool.Add(reward) } return d } @@ -151,25 +151,25 @@ func (d DistributeGoal) AddTrafficRewardToResourceNodeFromTrafficPool(reward sdk func (d DistributeGoal) String() string { return fmt.Sprintf(`DistributeGoal:{ BlockChainRewardToValidatorFromMiningPool: %s - BlockChainRewardToIndexingNodeFromMiningPool: %s + BlockChainRewardToMetaNodeFromMiningPool: %s BlockChainRewardToResourceNodeFromMiningPool: %s - MetaNodeRewardToIndexingNodeFromMiningPool: %s + MetaNodeRewardToMetaNodeFromMiningPool: %s TrafficRewardToResourceNodeFromMiningPool: %s BlockChainRewardToValidatorFromTrafficPool: %s - BlockChainRewardToIndexingNodeFromTrafficPool: %s + BlockChainRewardToMetaNodeFromTrafficPool: %s BlockChainRewardToResourceNodeFromTrafficPool: %s - MetaNodeRewardToIndexingNodeFromTrafficPool: %s + MetaNodeRewardToMetaNodeFromTrafficPool: %s TrafficRewardToResourceNodeFromTrafficPool: %s }`, d.BlockChainRewardToValidatorFromMiningPool, - d.BlockChainRewardToIndexingNodeFromMiningPool, + d.BlockChainRewardToMetaNodeFromMiningPool, d.BlockChainRewardToResourceNodeFromMiningPool, - d.MetaNodeRewardToIndexingNodeFromMiningPool, + d.MetaNodeRewardToMetaNodeFromMiningPool, d.TrafficRewardToResourceNodeFromMiningPool, d.BlockChainRewardToValidatorFromTrafficPool, - d.BlockChainRewardToIndexingNodeFromTrafficPool, + d.BlockChainRewardToMetaNodeFromTrafficPool, d.BlockChainRewardToResourceNodeFromTrafficPool, - d.MetaNodeRewardToIndexingNodeFromTrafficPool, + d.MetaNodeRewardToMetaNodeFromTrafficPool, d.TrafficRewardToResourceNodeFromTrafficPool, ) } diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 63db1b52..450dee71 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -52,8 +52,8 @@ type BankKeeper interface { } type RegisterKeeper interface { - GetIndexingNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (indexingNode types.IndexingNode, found bool) - SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode) + GetMetaNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (metaNode types.MetaNode, found bool) + SetMetaNode(ctx sdk.Context, metaNode types.MetaNode) GetResourceNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (resourceNode types.ResourceNode, found bool) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode) @@ -70,13 +70,13 @@ type RegisterKeeper interface { GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) MintResourceNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error - GetIndexingNodeBondedToken(ctx sdk.Context) (token sdk.Coin) - MintIndexingNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error + GetMetaNodeBondedToken(ctx sdk.Context) (token sdk.Coin) + MintMetaNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) - GetAllIndexingNodes(ctx sdk.Context) (indexingNodes types.IndexingNodes) + GetAllMetaNodes(ctx sdk.Context) (metaNodes types.MetaNodes) //GetAllResourceNodes(ctx sdk.Context) (resourceNodes types.ResourceNodes) GetResourceNodeIterator(ctx sdk.Context) sdk.Iterator } diff --git a/x/pot/types/msg.go b/x/pot/types/msg.go index 7a6f608d..efb1b7fe 100644 --- a/x/pot/types/msg.go +++ b/x/pot/types/msg.go @@ -19,15 +19,6 @@ var ( _ sdk.Msg = &MsgSlashingResourceNode{} ) -//type MsgVolumeReport struct { -// WalletVolumes []SingleWalletVolume `json:"wallet_volumes" yaml:"wallet_volumes"` // volume report -// Reporter stratos.SdsAddress `json:"reporter" yaml:"reporter"` // node p2p address of the reporter -// Epoch sdk.Int `json:"epoch" yaml:"epoch"` // volume report epoch -// ReportReference string `json:"report_reference" yaml:"report_reference"` // volume report reference -// ReporterOwner sdk.AccAddress `json:"reporter_owner" yaml:"reporter_owner"` // owner address of the reporter -// BLSSignature BLSSignatureInfo `json:"bls_signature" yaml:"bls_signature"` // information about the BLS signature -//} - // NewMsgVolumeReport creates a new MsgVolumeReport instance func NewMsgVolumeReport( walletVolumes []*SingleWalletVolume, @@ -130,12 +121,6 @@ func (msg MsgVolumeReport) ValidateBasic() error { return nil } -//type MsgWithdraw struct { -// Amount sdk.Coins `json:"amount" yaml:"amount"` -// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` -// TargetAddress sdk.AccAddress `json:"target_address" yaml:"target_address"` -//} - func NewMsgWithdraw(amount sdk.Coins, walletAddress sdk.AccAddress, targetAddress sdk.AccAddress) *MsgWithdraw { return &MsgWithdraw{ Amount: amount, @@ -181,11 +166,6 @@ func (msg MsgWithdraw) ValidateBasic() error { return nil } -//type MsgFoundationDeposit struct { -// Amount sdk.Coins `json:"amount" yaml:"amount"` -// From sdk.AccAddress `json:"from" yaml:"from"` -//} - func NewMsgFoundationDeposit(amount sdk.Coins, from sdk.AccAddress) *MsgFoundationDeposit { return &MsgFoundationDeposit{ Amount: amount, @@ -227,15 +207,6 @@ func (msg MsgFoundationDeposit) ValidateBasic() error { return nil } -//type MsgSlashingResourceNode struct { -// Reporters []stratos.SdsAddress `json:"reporters" yaml:"reporters"` // reporter p2p address -// ReporterOwner []sdk.AccAddress `json:"reporter_owner" yaml:"reporter_owner"` // reporter wallet address -// NetworkAddress stratos.SdsAddress `json:"network_address" yaml:"network_address"` // p2p address of the pp node -// WalletAddress sdk.AccAddress `json:"wallet_address" yaml:"wallet_address"` // wallet address of the pp node -// Slashing sdk.Int `json:"slashing" yaml:"slashing"` // uoz amount -// Suspend bool `json:"suspend" yaml:"suspend"` -//} - func NewMsgSlashingResourceNode(reporters []stratos.SdsAddress, reporterOwner []sdk.AccAddress, networkAddress stratos.SdsAddress, walletAddress sdk.AccAddress, slashing sdk.Int, suspend bool) *MsgSlashingResourceNode { diff --git a/x/register/client/cli/flags.go b/x/register/client/cli/flags.go index 2aee8bfb..df605d50 100644 --- a/x/register/client/cli/flags.go +++ b/x/register/client/cli/flags.go @@ -57,7 +57,7 @@ const ( //FsNetworkAddress.String(FlagNetworkAddress, "The address of the PP node", "") //FsCandidateNetworkAddress.String(FlagCandidateNetworkAddress, "The network address of the candidate PP node", "") //FsCandidateOwnerAddress.String(FlagCandidateOwnerAddress, "The owner address of the candidate PP node", "") -//FsOpinion.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Indexing node.") +//FsOpinion.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Meta node.") //FsVoterNetworkAddress.String(FlagVoterNetworkAddress, "The address of the PP node that made the vote.", "") //} @@ -115,7 +115,7 @@ func flagSetVoting() *flag.FlagSet { fs.String(FlagCandidateNetworkAddress, "The network address of the candidate PP node", "") fs.String(FlagCandidateOwnerAddress, "The owner address of the candidate PP node", "") - fs.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Indexing node.") + fs.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Meta node.") fs.String(FlagVoterNetworkAddress, "The address of the PP node that made the vote.", "") return fs } diff --git a/x/register/client/cli/query.go b/x/register/client/cli/query.go index 893ef3a5..80c3d86c 100644 --- a/x/register/client/cli/query.go +++ b/x/register/client/cli/query.go @@ -26,8 +26,8 @@ func GetQueryCmd() *cobra.Command { registerQueryCmd.AddCommand( GetCmdQueryResourceNode(), - GetCmdQueryIndexingNode(), - //GetCmdQueryIndexingNodeList(), + GetCmdQueryMetaNode(), + //GetCmdQueryMetaNodeList(), ) return registerQueryCmd @@ -78,15 +78,15 @@ $ %s query register get-resource-node --network-address=stsds1np4d8re98lpgrcdqca return cmd } -// GetCmdQueryIndexingNode implements the query indexing nodes by network address command. -func GetCmdQueryIndexingNode() *cobra.Command { +// GetCmdQueryMetaNode implements the query meta nodes by network address command. +func GetCmdQueryMetaNode() *cobra.Command { cmd := &cobra.Command{ - Use: "get-indexing-node [flag]", - Short: "Query an indexing node by its network address", + Use: "get-meta-node [flag]", + Short: "Query an meta node by its network address", Long: strings.TrimSpace( - fmt.Sprintf(`Query details about an individual indexing node by its network address. + fmt.Sprintf(`Query details about an individual meta node by its network address. Example: -$ %s query register get-indexing-node --network-address=stsds1faej5w4q6hgnt0ft598dlm408g4p747y4krwca +$ %s query register get-meta-node --network-address=stsds1faej5w4q6hgnt0ft598dlm408g4p747y4krwca `, version.AppName, ), @@ -104,7 +104,7 @@ $ %s query register get-indexing-node --network-address=stsds1faej5w4q6hgnt0ft59 return sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") } - result, err := queryClient.IndexingNode(cmd.Context(), &types.QueryIndexingNodeRequest{ + result, err := queryClient.MetaNode(cmd.Context(), &types.QueryMetaNodeRequest{ // Leaving status empty on purpose to query all validators. NetworkAddr: queryFlagNetworkAddr, }) @@ -155,19 +155,19 @@ $ %s query register get-indexing-node --network-address=stsds1faej5w4q6hgnt0ft59 // return cliCtx.QueryWithData(route, bz) //} // -//// GetCmdQueryIndexingNodeList implements the query all indexing nodes by network id command. -//func GetCmdQueryIndexingNodeList(queryRoute string, cdc *codec.Codec) *cobra.Command { +//// GetCmdQueryMetaNodeList implements the query all meta nodes by network id command. +//func GetCmdQueryMetaNodeList(queryRoute string, cdc *codec.Codec) *cobra.Command { // cmd := &cobra.Command{ -// Use: "get-indexing-nodes [flags]", // []byte -// Short: "Query all indexing nodes", +// Use: "get-meta-nodes [flags]", // []byte +// Short: "Query all meta nodes", // Long: strings.TrimSpace( -// fmt.Sprintf(`Query all indexing nodes`), +// fmt.Sprintf(`Query all meta nodes`), // ), // RunE: func(cmd *cobra.Command, args []string) error { // inBuf := bufio.NewReader(cmd.InOrStdin()) // cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) // -// // query all indexing nodes by network address +// // query all meta nodes by network address // queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) // if queryFlagNetworkAddr == "" { // return sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") @@ -185,12 +185,12 @@ $ %s query register get-indexing-node --network-address=stsds1faej5w4q6hgnt0ft59 // return cmd //} // -//// GetIndNodesByNetworkAddr queries all indexing nodes by multiple network addrs (sep: ";") +//// GetIndNodesByNetworkAddr queries all meta nodes by multiple network addrs (sep: ";") //func GetIndNodesByNetworkAddr(cliCtx context.CLIContext, queryRoute string) (res string, err error) { // queryFlagNetworkAddr := viper.GetString(FlagNetworkAddress) // queryByFlagNetworkAddrList := strings.Split(queryFlagNetworkAddr, ";") // for _, v := range queryByFlagNetworkAddrList { -// resp, _, err := QueryIndexingNodes(cliCtx, queryRoute, v) +// resp, _, err := QueryMetaNodes(cliCtx, queryRoute, v) // if err != nil { // return "null", err // } @@ -199,9 +199,9 @@ $ %s query register get-indexing-node --network-address=stsds1faej5w4q6hgnt0ft59 // return res[:len(res)-1], nil //} // -//// QueryIndexingNodes queries all indexing nodes -//func QueryIndexingNodes(cliCtx context.CLIContext, queryRoute, networkAddr string) ([]byte, int64, error) { -// route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryIndexingNodeByNetworkAddr) +//// QueryMetaNodes queries all meta nodes +//func QueryMetaNodes(cliCtx context.CLIContext, queryRoute, networkAddr string) ([]byte, int64, error) { +// route := fmt.Sprintf("custom/%s/%s", queryRoute, keeper.QueryMetaNodeByNetworkAddr) // sdsAddress, err := stratos.SdsAddressFromBech32(networkAddr) // if err != nil { // return []byte{}, 0, sdkerrors.Wrap(types.ErrInvalidNetworkAddr, "Missing network address") diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index a435392f..37ec3fed 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -29,11 +29,11 @@ func NewTxCmd() *cobra.Command { UpdateResourceNodeCmd(), UpdateResourceNodeStakeCmd(), - CreateIndexingNodeCmd(), - RemoveIndexingNodeCmd(), - UpdateIndexingNodeCmd(), - UpdateIndexingNodeStakeCmd(), - IndexingNodeRegistrationVoteCmd(), + CreateMetaNodeCmd(), + RemoveMetaNodeCmd(), + UpdateMetaNodeCmd(), + UpdateMetaNodeStakeCmd(), + MetaNodeRegistrationVoteCmd(), ) return registerTxCmd @@ -78,11 +78,11 @@ func CreateResourceNodeCmd() *cobra.Command { return cmd } -// CreateIndexingNodeCmd will create a file upload tx and sign it with the given key. -func CreateIndexingNodeCmd() *cobra.Command { +// CreateMetaNodeCmd will create a file upload tx and sign it with the given key. +func CreateMetaNodeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "create-indexing-node [flags]", - Short: "create a new indexing node", + Use: "create-meta-node [flags]", + Short: "create a new meta node", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -91,7 +91,7 @@ func CreateIndexingNodeCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - txf, msg, err := newBuildCreateIndexingNodeMsg(clientCtx, txf, cmd.Flags()) + txf, msg, err := newBuildCreateMetaNodeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } @@ -145,18 +145,18 @@ func RemoveResourceNodeCmd() *cobra.Command { return cmd } -func RemoveIndexingNodeCmd() *cobra.Command { +func RemoveMetaNodeCmd() *cobra.Command { //cmd := &cobra.Command{ - // Use: "remove-indexing-node [indexing_node_address]", + // Use: "remove-meta-node [meta_node_address]", // Args: cobra.ExactArgs(2), - // Short: "remove indexing node", + // Short: "remove meta node", // RunE: func(cmd *cobra.Command, args []string) error { // clientCtx, err := client.GetClientTxContext(cmd) // if err != nil { // return err // } // - // indexingNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) + // metaNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) // if err != nil { // return err // } @@ -166,7 +166,7 @@ func RemoveIndexingNodeCmd() *cobra.Command { // // return err // //} // - // msg := types.NewMsgRemoveIndexingNode(indexingNodeAddr, ownerAddr) + // msg := types.NewMsgRemoveMetaNode(metaNodeAddr, ownerAddr) // // return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) // }, @@ -177,9 +177,9 @@ func RemoveIndexingNodeCmd() *cobra.Command { // //return cmd cmd := &cobra.Command{ - Use: "remove-indexing-node [flag]", + Use: "remove-meta-node [flag]", //Args: cobra.ExactArgs(1), - Short: "remove indeixng node", + Short: "remove meta node", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -188,7 +188,7 @@ func RemoveIndexingNodeCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - txf, msg, err := newBuildRemoveIndexingNodeMsg(clientCtx, txf, cmd.Flags()) + txf, msg, err := newBuildRemoveMetaNodeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } @@ -240,10 +240,10 @@ func UpdateResourceNodeCmd() *cobra.Command { return cmd } -func UpdateIndexingNodeCmd() *cobra.Command { +func UpdateMetaNodeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "update-indexing-node [flags]", - Short: "update indexing node info", + Use: "update-meta-node [flags]", + Short: "update meta node info", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -252,7 +252,7 @@ func UpdateIndexingNodeCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - txf, msg, err := newBuildUpdateIndexingNodeMsg(clientCtx, txf, cmd.Flags()) + txf, msg, err := newBuildUpdateMetaNodeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } @@ -308,11 +308,11 @@ func UpdateResourceNodeStakeCmd() *cobra.Command { return cmd } -// UpdateIndexingNodeStakeCmd will add/subtract indexing node's stake. -func UpdateIndexingNodeStakeCmd() *cobra.Command { +// UpdateMetaNodeStakeCmd will add/subtract meta node's stake. +func UpdateMetaNodeStakeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "update-indexing-node-stake [flags]", - Short: "update indexing node's stake", + Use: "update-meta-node-stake [flags]", + Short: "update meta node's stake", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -321,7 +321,7 @@ func UpdateIndexingNodeStakeCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - txf, msg, err := newBuildUpdateIndexingNodeStakeMsg(clientCtx, txf, cmd.Flags()) + txf, msg, err := newBuildUpdateMetaNodeStakeMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err } @@ -342,11 +342,11 @@ func UpdateIndexingNodeStakeCmd() *cobra.Command { return cmd } -// IndexingNodeRegistrationVoteCmd Indexing node registration need to be approved by 2/3 of existing indexing nodes -func IndexingNodeRegistrationVoteCmd() *cobra.Command { +// MetaNodeRegistrationVoteCmd Meta node registration need to be approved by 2/3 of existing meta nodes +func MetaNodeRegistrationVoteCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "indexing_node_reg_vote [flags]", - Short: "vote for the registration of a new indexing node", + Use: "meta_node_reg_vote [flags]", + Short: "vote for the registration of a new meta node", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -355,7 +355,7 @@ func IndexingNodeRegistrationVoteCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - txf, msg, err := newBuildIndexingNodeRegistrationVoteMsg(clientCtx, txf, cmd.Flags()) + txf, msg, err := newBuildMetaNodeRegistrationVoteMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err @@ -439,8 +439,8 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, msg, nil } -// makes a new MsgCreateIndexingNode. -func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateIndexingNode, error) { +// makes a new MsgCreateMetaNode. +func newBuildCreateMetaNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgCreateMetaNode, error) { flagAmountStr, err := fs.GetString(FlagAmount) if err != nil { return txf, nil, err @@ -482,7 +482,7 @@ func newBuildCreateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs security, details, ) - msg, er := types.NewMsgCreateIndexingNode(networkAddr, pubKey, amount, ownerAddr, &description) + msg, er := types.NewMsgCreateMetaNode(networkAddr, pubKey, amount, ownerAddr, &description) if er != nil { return txf, nil, err } @@ -528,8 +528,8 @@ func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, msg, nil } -// makes a new MsgUpdateIndexingNode. -func newBuildUpdateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNode, error) { +// makes a new MsgUpdateMetaNode. +func newBuildUpdateMetaNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateMetaNode, error) { flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) if err != nil { return txf, nil, err @@ -554,7 +554,7 @@ func newBuildUpdateIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs details, ) - msg := types.NewMsgUpdateIndexingNode(description, networkAddr, ownerAddr) + msg := types.NewMsgUpdateMetaNode(description, networkAddr, ownerAddr) return txf, msg, nil } @@ -590,8 +590,8 @@ func newBuildUpdateResourceNodeStakeMsg(clientCtx client.Context, txf tx.Factory return txf, msg, nil } -// newBuildUpdateIndexingNodeStakeMsg makes a new UpdateIndexingNodeStakeMsg. -func newBuildUpdateIndexingNodeStakeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateIndexingNodeStake, error) { +// newBuildUpdateMetaNodeStakeMsg makes a new UpdateMetaNodeStakeMsg. +func newBuildUpdateMetaNodeStakeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgUpdateMetaNodeStake, error) { stakeDeltaStr, err := fs.GetString(FlagStakeDelta) if err != nil { return txf, nil, err @@ -618,11 +618,11 @@ func newBuildUpdateIndexingNodeStakeMsg(clientCtx client.Context, txf tx.Factory ownerAddr := clientCtx.GetFromAddress() - msg := types.NewMsgUpdateIndexingNodeStake(networkAddr, ownerAddr, &stakeDelta, incrStake) + msg := types.NewMsgUpdateMetaNodeStake(networkAddr, ownerAddr, &stakeDelta, incrStake) return txf, msg, nil } -func newBuildIndexingNodeRegistrationVoteMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgIndexingNodeRegistrationVote, error) { +func newBuildMetaNodeRegistrationVoteMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgMetaNodeRegistrationVote, error) { candidateNetworkAddrStr, err := fs.GetString(FlagCandidateNetworkAddress) if err != nil { return txf, nil, err @@ -657,7 +657,7 @@ func newBuildIndexingNodeRegistrationVoteMsg(clientCtx client.Context, txf tx.Fa voterOwnerAddr := clientCtx.GetFromAddress() - msg := types.NewMsgIndexingNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, opinionVal, voterNetworkAddr, voterOwnerAddr) + msg := types.NewMsgMetaNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, opinionVal, voterNetworkAddr, voterOwnerAddr) return txf, msg, nil } @@ -678,7 +678,7 @@ func newBuildRemoveResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, msg, nil } -func newBuildRemoveIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgRemoveIndexingNode, error) { +func newBuildRemoveMetaNodeMsg(clientCtx client.Context, txf tx.Factory, fs *flag.FlagSet) (tx.Factory, *types.MsgRemoveMetaNode, error) { flagNetworkAddrStr, err := fs.GetString(FlagNetworkAddress) if err != nil { return txf, nil, err @@ -690,7 +690,7 @@ func newBuildRemoveIndexingNodeMsg(clientCtx client.Context, txf tx.Factory, fs ownerAddr := clientCtx.GetFromAddress() - msg := types.NewMsgRemoveIndexingNode(networkAddr, ownerAddr) + msg := types.NewMsgRemoveMetaNode(networkAddr, ownerAddr) return txf, msg, nil } diff --git a/x/register/client/rest/query.go b/x/register/client/rest/query.go index 3b2bf13c..947dbd26 100644 --- a/x/register/client/rest/query.go +++ b/x/register/client/rest/query.go @@ -16,7 +16,7 @@ import ( func registerQueryRoutes(clientCtx client.Context, r *mux.Router) { r.HandleFunc("/register/resource-nodes", nodesWithParamsFn(clientCtx, keeper.QueryResourceNodeByNetworkAddr)).Methods("GET") - r.HandleFunc("/register/indexing-nodes", nodesWithParamsFn(clientCtx, keeper.QueryIndexingNodeByNetworkAddr)).Methods("GET") + r.HandleFunc("/register/meta-nodes", nodesWithParamsFn(clientCtx, keeper.QueryMetaNodeByNetworkAddr)).Methods("GET") r.HandleFunc("/register/staking", nodeStakingHandlerFn(clientCtx, keeper.QueryNodesTotalStakes)).Methods("GET") r.HandleFunc("/register/staking/address/{nodeAddress}", nodeStakingByNodeAddressFn(clientCtx, keeper.QueryNodeStakeByNodeAddr)).Methods("GET") r.HandleFunc("/register/staking/owner/{ownerAddress}", nodeStakingByOwnerFn(clientCtx, keeper.QueryNodeStakeByOwner)).Methods("GET") @@ -43,7 +43,7 @@ func registerParamsHandlerFn(clientCtx client.Context, queryPath string) http.Ha } } -// GET request handler to query all resource/indexing nodes +// GET request handler to query all resource/meta nodes func nodesWithParamsFn(clientCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) diff --git a/x/register/client/rest/tx.go b/x/register/client/rest/tx.go index 4108ba48..c704e9fd 100644 --- a/x/register/client/rest/tx.go +++ b/x/register/client/rest/tx.go @@ -33,24 +33,24 @@ func registerTxHandlers(cliCtx client.Context, r *mux.Router) { ).Methods("POST") r.HandleFunc( - "/register/createIndexingNode", - postCreateIndexingNodeHandlerFn(cliCtx), + "/register/createMetaNode", + postCreateMetaNodeHandlerFn(cliCtx), ).Methods("POST") r.HandleFunc( - "/register/removeIndexingNode", - postRemoveIndexingNodeHandlerFn(cliCtx), + "/register/removeMetaNode", + postRemoveMetaNodeHandlerFn(cliCtx), ).Methods("POST") r.HandleFunc( - "/register/updateIndexingNode", - postUpdateIndexingNodeHandlerFn(cliCtx), + "/register/updateMetaNode", + postUpdateMetaNodeHandlerFn(cliCtx), ).Methods("POST") r.HandleFunc( - "/register/updateIndexingNodeStake", - postUpdateIndexingNodeStakeHandlerFn(cliCtx), + "/register/updateMetaNodeStake", + postUpdateMetaNodeStakeHandlerFn(cliCtx), ).Methods("POST") r.HandleFunc( - "/register/indexingNodeRegVote", - postIndexingNodeRegVoteFn(cliCtx), + "/register/metaNodeRegVote", + postMetaNodeRegVoteFn(cliCtx), ).Methods("POST") } @@ -83,7 +83,7 @@ type ( IncrStake string `json:"incr_stake" yaml:"incr_stake"` } - CreateIndexingNodeRequest struct { + CreateMetaNodeRequest struct { BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` NetworkAddr string `json:"network_address" yaml:"network_address"` PubKey string `json:"pubkey" yaml:"pubkey"` // in bech32 @@ -91,25 +91,25 @@ type ( Description types.Description `json:"description" yaml:"description"` } - RemoveIndexingNodeRequest struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - IndexingNodeAddress string `json:"indexing_node_address" yaml:"indexing_node_address"` // in bech32 + RemoveMetaNodeRequest struct { + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + MetaNodeAddress string `json:"meta_node_address" yaml:"meta_node_address"` // in bech32 } - UpdateIndexingNodeRequest struct { + UpdateMetaNodeRequest struct { BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` Description types.Description `json:"description" yaml:"description"` NetworkAddress string `json:"network_address" yaml:"network_address"` } - UpdateIndexingNodeStakeRequest struct { + UpdateMetaNodeStakeRequest struct { BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` NetworkAddress string `json:"network_address" yaml:"network_address"` StakeDelta sdk.Coin `json:"stake_delta" yaml:"stake_delta"` IncrStake string `json:"incr_stake" yaml:"incr_stake"` } - IndexingNodeRegVoteRequest struct { + MetaNodeRegVoteRequest struct { BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` CandidateNetworkAddress string `json:"candidate_network_address" yaml:"candidate_network_address"` CandidateOwnerAddress string `json:"candidate_owner_address" yaml:"candidate_owner_address"` @@ -164,9 +164,9 @@ func postCreateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { } } -func postCreateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { +func postCreateMetaNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req CreateIndexingNodeRequest + var req CreateMetaNodeRequest if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return @@ -193,7 +193,7 @@ func postCreateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - msg, err := types.NewMsgCreateIndexingNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description) + msg, err := types.NewMsgCreateMetaNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -243,9 +243,9 @@ func postRemoveResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { } } -func postRemoveIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { +func postRemoveMetaNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req RemoveIndexingNodeRequest + var req RemoveMetaNodeRequest if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return @@ -256,7 +256,7 @@ func postRemoveIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - nodeAddr, err := stratos.SdsAddressFromBech32(req.IndexingNodeAddress) + nodeAddr, err := stratos.SdsAddressFromBech32(req.MetaNodeAddress) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -268,7 +268,7 @@ func postRemoveIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - msg := types.NewMsgRemoveIndexingNode(nodeAddr, ownerAddr) + msg := types.NewMsgRemoveMetaNode(nodeAddr, ownerAddr) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -359,9 +359,9 @@ func postUpdateResourceNodeStakeHandlerFn(cliCtx client.Context) http.HandlerFun } } -func postUpdateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { +func postUpdateMetaNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req UpdateIndexingNodeRequest + var req UpdateMetaNodeRequest if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return @@ -384,7 +384,7 @@ func postUpdateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - msg := types.NewMsgUpdateIndexingNode(req.Description, networkAddr, ownerAddr) + msg := types.NewMsgUpdateMetaNode(req.Description, networkAddr, ownerAddr) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -394,9 +394,9 @@ func postUpdateIndexingNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { } } -func postUpdateIndexingNodeStakeHandlerFn(cliCtx client.Context) http.HandlerFunc { +func postUpdateMetaNodeStakeHandlerFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req UpdateIndexingNodeStakeRequest + var req UpdateMetaNodeStakeRequest if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return @@ -424,7 +424,7 @@ func postUpdateIndexingNodeStakeHandlerFn(cliCtx client.Context) http.HandlerFun rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - msg := types.NewMsgUpdateIndexingNodeStake(networkAddr, ownerAddr, &req.StakeDelta, incrStake) + msg := types.NewMsgUpdateMetaNodeStake(networkAddr, ownerAddr, &req.StakeDelta, incrStake) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -434,9 +434,9 @@ func postUpdateIndexingNodeStakeHandlerFn(cliCtx client.Context) http.HandlerFun } } -func postIndexingNodeRegVoteFn(cliCtx client.Context) http.HandlerFunc { +func postMetaNodeRegVoteFn(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req IndexingNodeRegVoteRequest + var req MetaNodeRegVoteRequest if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { return @@ -471,7 +471,7 @@ func postIndexingNodeRegVoteFn(cliCtx client.Context) http.HandlerFunc { return } - msg := types.NewMsgIndexingNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, voteOpinion, voterNetworkAddr, voterOwnerAddr) + msg := types.NewMsgMetaNodeRegistrationVote(candidateNetworkAddr, candidateOwnerAddr, voteOpinion, voterNetworkAddr, voterOwnerAddr) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/x/register/exported/exported.go b/x/register/exported/exported.go index b1a80d21..d8d2809e 100644 --- a/x/register/exported/exported.go +++ b/x/register/exported/exported.go @@ -19,8 +19,8 @@ type ResourceNodeI interface { GetNodeType() string // node type } -// IndexingNodeI expected indexing node functions -type IndexingNodeI interface { +// MetaNodeI expected indexing node functions +type MetaNodeI interface { IsSuspended() bool // whether the node is jailed GetMoniker() string // moniker of the node GetStatus() stakingtypes.BondStatus // status of the node diff --git a/x/register/genesis.go b/x/register/genesis.go index bc998b30..75040dcc 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -34,20 +34,20 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } idxNodeBondedToken := sdk.ZeroInt() idxNodeNotBondedToken := sdk.ZeroInt() - for _, indexingNode := range data.GetIndexingNodes() { - if indexingNode.GetStatus() == stakingtypes.Bonded { - initialStakeTotal = initialStakeTotal.Add(indexingNode.Tokens) - idxNodeBondedToken = idxNodeBondedToken.Add(indexingNode.Tokens) - } else if indexingNode.GetStatus() == stakingtypes.Unbonded { - idxNodeNotBondedToken = idxNodeNotBondedToken.Add(indexingNode.Tokens) + for _, metaNode := range data.GetMetaNodes() { + if metaNode.GetStatus() == stakingtypes.Bonded { + initialStakeTotal = initialStakeTotal.Add(metaNode.Tokens) + idxNodeBondedToken = idxNodeBondedToken.Add(metaNode.Tokens) + } else if metaNode.GetStatus() == stakingtypes.Unbonded { + idxNodeNotBondedToken = idxNodeNotBondedToken.Add(metaNode.Tokens) } - keeper.SetIndexingNode(ctx, indexingNode) + keeper.SetMetaNode(ctx, metaNode) } - err = keeper.MintIndexingNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeBondedToken)) + err = keeper.MintMetaNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeBondedToken)) if err != nil { panic(err) } - err = keeper.MintIndexingNodeNotBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeNotBondedToken)) + err = keeper.MintMetaNodeNotBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeNotBondedToken)) if err != nil { panic(err) } @@ -85,7 +85,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisSt params := keeper.GetParams(ctx) resourceNodes := keeper.GetAllResourceNodes(ctx) - indexingNodes := keeper.GetAllIndexingNodes(ctx) + metaNodes := keeper.GetAllMetaNodes(ctx) totalUnissuedPrepay := keeper.GetTotalUnissuedPrepay(ctx).Amount initialUOzonePrice := keeper.CurrUozPrice(ctx) @@ -101,7 +101,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisSt return &types.GenesisState{ Params: ¶ms, ResourceNodes: resourceNodes, - IndexingNodes: indexingNodes, + MetaNodes: metaNodes, InitialUozPrice: initialUOzonePrice, TotalUnissuedPrepay: totalUnissuedPrepay, Slashing: slashingInfo, diff --git a/x/register/handler.go b/x/register/handler.go index ebf1a418..92bebf52 100644 --- a/x/register/handler.go +++ b/x/register/handler.go @@ -29,20 +29,20 @@ func NewHandler(k keeper.Keeper) sdk.Handler { res, err := msgServer.HandleMsgUpdateResourceNodeStake(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgCreateIndexingNode: - res, err := msgServer.HandleMsgCreateIndexingNode(sdk.WrapSDKContext(ctx), msg) + case *types.MsgCreateMetaNode: + res, err := msgServer.HandleMsgCreateMetaNode(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgRemoveIndexingNode: - res, err := msgServer.HandleMsgRemoveIndexingNode(sdk.WrapSDKContext(ctx), msg) + case *types.MsgRemoveMetaNode: + res, err := msgServer.HandleMsgRemoveMetaNode(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgUpdateIndexingNode: - res, err := msgServer.HandleMsgUpdateIndexingNode(sdk.WrapSDKContext(ctx), msg) + case *types.MsgUpdateMetaNode: + res, err := msgServer.HandleMsgUpdateMetaNode(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgUpdateIndexingNodeStake: - res, err := msgServer.HandleMsgUpdateIndexingNodeStake(sdk.WrapSDKContext(ctx), msg) + case *types.MsgUpdateMetaNodeStake: + res, err := msgServer.HandleMsgUpdateMetaNodeStake(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgIndexingNodeRegistrationVote: - res, err := msgServer.HandleMsgIndexingNodeRegistrationVote(sdk.WrapSDKContext(ctx), msg) + case *types.MsgMetaNodeRegistrationVote: + res, err := msgServer.HandleMsgMetaNodeRegistrationVote(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) // this line is used by starport scaffolding # 1 diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index bb7bd6e2..cbd56816 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -42,27 +42,27 @@ func (q Querier) ResourceNode(c context.Context, req *types.QueryResourceNodeReq return &types.QueryResourceNodeResponse{Node: &node}, nil } -func (q Querier) IndexingNode(c context.Context, req *types.QueryIndexingNodeRequest) (*types.QueryIndexingNodeResponse, error) { +func (q Querier) MetaNode(c context.Context, req *types.QueryMetaNodeRequest) (*types.QueryMetaNodeResponse, error) { if req == nil { - return &types.QueryIndexingNodeResponse{}, status.Error(codes.InvalidArgument, "empty request") + return &types.QueryMetaNodeResponse{}, status.Error(codes.InvalidArgument, "empty request") } if req.GetNetworkAddr() == "" { - return &types.QueryIndexingNodeResponse{}, status.Error(codes.InvalidArgument, " network address cannot be empty") + return &types.QueryMetaNodeResponse{}, status.Error(codes.InvalidArgument, " network address cannot be empty") } networkAddr, err := stratos.SdsAddressFromBech32(req.GetNetworkAddr()) if err != nil { - return &types.QueryIndexingNodeResponse{}, err + return &types.QueryMetaNodeResponse{}, err } ctx := sdk.UnwrapSDKContext(c) - node, found := q.GetIndexingNode(ctx, networkAddr) + node, found := q.GetMetaNode(ctx, networkAddr) if !found { - return &types.QueryIndexingNodeResponse{}, status.Errorf(codes.NotFound, "network address %s not found", req.NetworkAddr) + return &types.QueryMetaNodeResponse{}, status.Errorf(codes.NotFound, "network address %s not found", req.NetworkAddr) } - return &types.QueryIndexingNodeResponse{Node: &node}, nil + return &types.QueryMetaNodeResponse{Node: &node}, nil } func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { @@ -90,22 +90,22 @@ func (q Querier) StakeByNode(c context.Context, req *types.QueryStakeByNodeReque stakingInfo := types.StakingInfo{} if queryType == types.QueryType_All || queryType == types.QueryType_SP { - indexingNode, found := q.GetIndexingNode(ctx, accAddr) + metaNode, found := q.GetMetaNode(ctx, accAddr) if found { - // Adding indexing node staking info - networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) + // Adding meta node staking info + networkAddr, _ := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := q.getNodeStakes( ctx, - indexingNode.GetStatus(), + metaNode.GetStatus(), networkAddr, - indexingNode.Tokens, + metaNode.Tokens, ) if err != nil { return &types.QueryStakeByNodeResponse{}, err } - if !indexingNode.Equal(types.IndexingNode{}) { - stakingInfo = types.NewStakingInfoByIndexingNodeAddr( - indexingNode, + if !metaNode.Equal(types.MetaNode{}) { + stakingInfo = types.NewStakingInfoByMetaNodeAddr( + metaNode, unBondingStake, unBondedStake, bondedStake, @@ -180,7 +180,7 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq params = types.NewQueryNodesParams(page, int(req.Pagination.Limit), networkAddr, req.GetMoniker(), ownerAddr) resNodes := q.GetResourceNodesFiltered(ctx, params) - indNodes := q.GetIndexingNodesFiltered(ctx, params) + indNodes := q.GetMetaNodesFiltered(ctx, params) for _, n := range indNodes { networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) @@ -193,8 +193,8 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq if er != nil { return nil, er } - if !n.Equal(types.IndexingNode{}) { - stakingInfo = types.NewStakingInfoByIndexingNodeAddr( + if !n.Equal(types.MetaNode{}) { + stakingInfo = types.NewStakingInfoByMetaNodeAddr( n, unBondingStake, unBondedStake, @@ -240,10 +240,10 @@ func (q Querier) StakeTotal(c context.Context, _ *types.QueryTotalStakeRequest) ctx := sdk.UnwrapSDKContext(c) totalBondedStakeOfResourceNodes := q.GetResourceNodeBondedToken(ctx).Amount - totalBondedStakeOfIndexingNodes := q.GetIndexingNodeBondedToken(ctx).Amount + totalBondedStakeOfMetaNodes := q.GetMetaNodeBondedToken(ctx).Amount totalUnbondedStakeOfResourceNodes := q.GetResourceNodeNotBondedToken(ctx).Amount - totalUnbondedStakeOfIndexingNodes := q.GetIndexingNodeNotBondedToken(ctx).Amount + totalUnbondedStakeOfMetaNodes := q.GetMetaNodeNotBondedToken(ctx).Amount resourceNodeList := q.GetAllResourceNodes(ctx) totalStakeOfResourceNodes := sdk.ZeroInt() @@ -251,19 +251,19 @@ func (q Querier) StakeTotal(c context.Context, _ *types.QueryTotalStakeRequest) totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) } - indexingNodeList := q.GetAllIndexingNodes(ctx) - totalStakeOfIndexingNodes := sdk.ZeroInt() - for _, node := range indexingNodeList { - totalStakeOfIndexingNodes = totalStakeOfIndexingNodes.Add(node.Tokens) + metaNodeList := q.GetAllMetaNodes(ctx) + totalStakeOfMetaNodes := sdk.ZeroInt() + for _, node := range metaNodeList { + totalStakeOfMetaNodes = totalStakeOfMetaNodes.Add(node.Tokens) } - totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfIndexingNodes) - totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfIndexingNodes) + totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfMetaNodes) + totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfMetaNodes) totalUnbondingStake := q.GetAllUnbondingNodesTotalBalance(ctx) totalUnbondedStake = totalUnbondedStake.Sub(totalUnbondingStake) res := types.NewQueryNodesStakingInfo( totalStakeOfResourceNodes, - totalStakeOfIndexingNodes, + totalStakeOfMetaNodes, totalBondedStake, totalUnbondedStake, totalUnbondingStake, diff --git a/x/register/keeper/hooks.go b/x/register/keeper/hooks.go index 7257c171..d02e82e1 100644 --- a/x/register/keeper/hooks.go +++ b/x/register/keeper/hooks.go @@ -10,36 +10,36 @@ import ( var _ types.RegisterHooks = Keeper{} // AfterNodeCreated - call hook if registered -func (k Keeper) AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (k Keeper) AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { if k.hooks != nil { - k.hooks.AfterNodeCreated(ctx, networkAddr, isIndexingNode) + k.hooks.AfterNodeCreated(ctx, networkAddr, isMetaNode) } } // BeforeNodeModified - call hook if registered -func (k Keeper) BeforeNodeModified(ctx sdk.Context, network stratos.SdsAddress, isIndexingNode bool) { +func (k Keeper) BeforeNodeModified(ctx sdk.Context, network stratos.SdsAddress, isMetaNode bool) { if k.hooks != nil { - k.hooks.BeforeNodeModified(ctx, network, isIndexingNode) + k.hooks.BeforeNodeModified(ctx, network, isMetaNode) } } // AfterNodeRemoved - call hook if registered -func (k Keeper) AfterNodeRemoved(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (k Keeper) AfterNodeRemoved(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { if k.hooks != nil { - k.hooks.AfterNodeRemoved(ctx, networkAddr, isIndexingNode) + k.hooks.AfterNodeRemoved(ctx, networkAddr, isMetaNode) } } // AfterNodeBonded - call hook if registered -func (k Keeper) AfterNodeBonded(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (k Keeper) AfterNodeBonded(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { if k.hooks != nil { - k.hooks.AfterNodeBonded(ctx, networkAddr, isIndexingNode) + k.hooks.AfterNodeBonded(ctx, networkAddr, isMetaNode) } } // AfterNodeBeginUnbonding - call hook if registered -func (k Keeper) AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (k Keeper) AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { if k.hooks != nil { - k.hooks.AfterNodeBeginUnbonding(ctx, networkAddr, isIndexingNode) + k.hooks.AfterNodeBeginUnbonding(ctx, networkAddr, isMetaNode) } } diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 26ac1cab..598ff083 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -13,100 +13,100 @@ import ( ) const ( - indexingNodeCacheSize = 500 + metaNodeCacheSize = 500 votingValidityPeriodInSecond = 7 * 24 * 60 * 60 // 7 days ) -// Cache the amino decoding of indexing nodes, as it can be the case that repeated slashing calls -// cause many calls to getIndexingNode, which were shown to throttle the state machine in our +// Cache the amino decoding of meta nodes, as it can be the case that repeated slashing calls +// cause many calls to getMetaNode, which were shown to throttle the state machine in our // simulation. Note this is quite biased though, as the simulator does more slashes than a // live chain should, however we require the slashing to be fast as no one pays gas for it. -type cachedIndexingNode struct { - indexingNode types.IndexingNode - marshalled string // marshalled amino bytes for the IndexingNode object (not address) +type cachedMetaNode struct { + metaNode types.MetaNode + marshalled string // marshalled amino bytes for the MetaNode object (not address) } -func newCachedIndexingNode(indexingNode types.IndexingNode, marshalled string) cachedIndexingNode { - return cachedIndexingNode{ - indexingNode: indexingNode, - marshalled: marshalled, +func newCachedMetaNode(metaNode types.MetaNode, marshalled string) cachedMetaNode { + return cachedMetaNode{ + metaNode: metaNode, + marshalled: marshalled, } } -// getIndexingNode get a single indexing node -func (k Keeper) GetIndexingNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (indexingNode types.IndexingNode, found bool) { +// getMetaNode get a single meta node +func (k Keeper) GetMetaNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (metaNode types.MetaNode, found bool) { store := ctx.KVStore(k.storeKey) - value := store.Get(types.GetIndexingNodeKey(p2pAddress)) + value := store.Get(types.GetMetaNodeKey(p2pAddress)) if value == nil { - return indexingNode, false + return metaNode, false } - // If these amino encoded bytes are in the cache, return the cached indexing node + // If these amino encoded bytes are in the cache, return the cached meta node strValue := string(value) - if val, ok := k.indexingNodeCache[strValue]; ok { - valToReturn := val.indexingNode + if val, ok := k.metaNodeCache[strValue]; ok { + valToReturn := val.metaNode return valToReturn, true } // amino bytes weren't found in cache, so amino unmarshal and add it to the cache - indexingNode = types.MustUnmarshalIndexingNode(k.cdc, value) - cachedVal := newCachedIndexingNode(indexingNode, strValue) - k.indexingNodeCache[strValue] = newCachedIndexingNode(indexingNode, strValue) - k.indexingNodeCacheList.PushBack(cachedVal) + metaNode = types.MustUnmarshalMetaNode(k.cdc, value) + cachedVal := newCachedMetaNode(metaNode, strValue) + k.metaNodeCache[strValue] = newCachedMetaNode(metaNode, strValue) + k.metaNodeCacheList.PushBack(cachedVal) // if the cache is too big, pop off the last element from it - if k.indexingNodeCacheList.Len() > indexingNodeCacheSize { - valToRemove := k.indexingNodeCacheList.Remove(k.indexingNodeCacheList.Front()).(cachedIndexingNode) - delete(k.indexingNodeCache, valToRemove.marshalled) + if k.metaNodeCacheList.Len() > metaNodeCacheSize { + valToRemove := k.metaNodeCacheList.Remove(k.metaNodeCacheList.Front()).(cachedMetaNode) + delete(k.metaNodeCache, valToRemove.marshalled) } - indexingNode = types.MustUnmarshalIndexingNode(k.cdc, value) - return indexingNode, true + metaNode = types.MustUnmarshalMetaNode(k.cdc, value) + return metaNode, true } -// set the main record holding indexing node details -func (k Keeper) SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode) { +// set the main record holding meta node details +func (k Keeper) SetMetaNode(ctx sdk.Context, metaNode types.MetaNode) { store := ctx.KVStore(k.storeKey) - bz := types.MustMarshalIndexingNode(k.cdc, indexingNode) - networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) - store.Set(types.GetIndexingNodeKey(networkAddr), bz) + bz := types.MustMarshalMetaNode(k.cdc, metaNode) + networkAddr, _ := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) + store.Set(types.GetMetaNodeKey(networkAddr), bz) } -// GetAllIndexingNodes get the set of all indexing nodes with no limits, used during genesis dump -func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes types.IndexingNodes) { +// GetAllMetaNodes get the set of all meta nodes with no limits, used during genesis dump +func (k Keeper) GetAllMetaNodes(ctx sdk.Context) (metaNodes types.MetaNodes) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) + iterator := sdk.KVStorePrefixIterator(store, types.MetaNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) - indexingNodes = append(indexingNodes, node) + node := types.MustUnmarshalMetaNode(k.cdc, iterator.Value()) + metaNodes = append(metaNodes, node) } - return indexingNodes + return metaNodes } -// GetAllValidIndexingNodes get the set of all bonded & not suspended indexing nodes -func (k Keeper) GetAllValidIndexingNodes(ctx sdk.Context) (indexingNodes []types.IndexingNode) { +// GetAllValidMetaNodes get the set of all bonded & not suspended meta nodes +func (k Keeper) GetAllValidMetaNodes(ctx sdk.Context) (metaNodes []types.MetaNode) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) + iterator := sdk.KVStorePrefixIterator(store, types.MetaNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) + node := types.MustUnmarshalMetaNode(k.cdc, iterator.Value()) if !node.GetSuspend() && node.GetStatus() == stakingtypes.Bonded { - indexingNodes = append(indexingNodes, node) + metaNodes = append(metaNodes, node) } } - return indexingNodes + return metaNodes } -func (k Keeper) RegisterIndexingNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, +func (k Keeper) RegisterMetaNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description types.Description, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error) { - indexingNode, err := types.NewIndexingNode(networkAddr, pubKey, ownerAddr, &description, ctx.BlockHeader().Time) + metaNode, err := types.NewMetaNode(networkAddr, pubKey, ownerAddr, &description, ctx.BlockHeader().Time) if err != nil { return ozoneLimitChange, err } - ozoneLimitChange, err = k.AddIndexingNodeStake(ctx, indexingNode, stake) + ozoneLimitChange, err = k.AddMetaNodeStake(ctx, metaNode, stake) if err != nil { return ozoneLimitChange, err } @@ -117,18 +117,18 @@ func (k Keeper) RegisterIndexingNode(ctx sdk.Context, networkAddr stratos.SdsAdd expireTime := ctx.BlockHeader().Time.Add(votingValidityPeriod) votePool := types.NewRegistrationVotePool(networkAddr, approveList, rejectList, expireTime) - k.SetIndexingNodeRegistrationVotePool(ctx, votePool) + k.SetMetaNodeRegistrationVotePool(ctx, votePool) return ozoneLimitChange, nil } -// AddIndexingNodeStake Update the tokens of an existing indexing node -func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToAdd sdk.Coin, +// AddMetaNodeStake Update the tokens of an existing meta node +func (k Keeper) AddMetaNodeStake(ctx sdk.Context, metaNode types.MetaNode, tokenToAdd sdk.Coin, ) (ozoneLimitChange sdk.Int, err error) { coins := sdk.NewCoins(tokenToAdd) - ownerAddr, err := sdk.AccAddressFromBech32(indexingNode.GetOwnerAddress()) + ownerAddr, err := sdk.AccAddressFromBech32(metaNode.GetOwnerAddress()) if err != nil { return sdk.ZeroInt(), types.ErrInvalidOwnerAddr } @@ -144,17 +144,17 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin targetModuleAccName := "" - switch indexingNode.GetStatus() { + switch metaNode.GetStatus() { case stakingtypes.Unbonded: - targetModuleAccName = types.IndexingNodeNotBondedPoolName - //notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) + targetModuleAccName = types.MetaNodeNotBondedPoolName + //notBondedTokenInPool := k.GetMetaNodeNotBondedToken(ctx) //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToAdd) - //k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) + //k.SetMetaNodeNotBondedToken(ctx, notBondedTokenInPool) case stakingtypes.Bonded: - targetModuleAccName = types.IndexingNodeBondedPoolName - //bondedTokenInPool := k.GetIndexingNodeBondedToken(ctx) + targetModuleAccName = types.MetaNodeBondedPoolName + //bondedTokenInPool := k.GetMetaNodeBondedToken(ctx) //bondedTokenInPool = bondedTokenInPool.Add(tokenToAdd) - //k.SetIndexingNodeBondedToken(ctx, bondedTokenInPool) + //k.SetMetaNodeBondedToken(ctx, bondedTokenInPool) case stakingtypes.Unbonding: return sdk.ZeroInt(), types.ErrUnbondingNode } @@ -166,52 +166,52 @@ func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.Indexin } } - indexingNode = indexingNode.AddToken(tokenToAdd.Amount) - k.SetIndexingNode(ctx, indexingNode) + metaNode = metaNode.AddToken(tokenToAdd.Amount) + k.SetMetaNode(ctx, metaNode) ozoneLimitChange = k.increaseOzoneLimitByAddStake(ctx, tokenToAdd.Amount) return ozoneLimitChange, nil } -func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - bondedIndexingAccountAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeBondedPoolName) - if bondedIndexingAccountAddr == nil { - ctx.Logger().Error("bonded pool account address for indexing nodes does not exist.") +func (k Keeper) RemoveTokenFromPoolWhileUnbondingMetaNode(ctx sdk.Context, metaNode types.MetaNode, tokenToSub sdk.Coin) error { + bondedMetaAccountAddr := k.accountKeeper.GetModuleAddress(types.MetaNodeBondedPoolName) + if bondedMetaAccountAddr == nil { + ctx.Logger().Error("bonded pool account address for meta nodes does not exist.") return types.ErrUnknownAccountAddress } - hasCoin := k.bankKeeper.HasBalance(ctx, bondedIndexingAccountAddr, tokenToSub) + hasCoin := k.bankKeeper.HasBalance(ctx, bondedMetaAccountAddr, tokenToSub) if !hasCoin { return types.ErrInsufficientBalance } - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.IndexingNodeBondedPoolName, types.IndexingNodeNotBondedPoolName, sdk.NewCoins(tokenToSub)) + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.MetaNodeBondedPoolName, types.MetaNodeNotBondedPoolName, sdk.NewCoins(tokenToSub)) if err != nil { return types.ErrInsufficientBalance } //// get pools - //bondedTokenInPool := k.GetIndexingNodeBondedToken(ctx) - //notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) + //bondedTokenInPool := k.GetMetaNodeBondedToken(ctx) + //notBondedTokenInPool := k.GetMetaNodeNotBondedToken(ctx) //if bondedTokenInPool.IsLT(tokenToSub) { // return types.ErrInsufficientBalanceOfBondedPool //} //// remove token from BondedPool //bondedTokenInPool = bondedTokenInPool.Sub(tokenToSub) - //k.SetIndexingNodeBondedToken(ctx, bondedTokenInPool) + //k.SetMetaNodeBondedToken(ctx, bondedTokenInPool) //// add token into NotBondedPool //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToSub) - //k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) + //k.SetMetaNodeNotBondedToken(ctx, notBondedTokenInPool) return nil } -// SubtractIndexingNodeStake Update the tokens of an existing indexing node -func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error { - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) +// SubtractMetaNodeStake Update the tokens of an existing meta node +func (k Keeper) SubtractMetaNodeStake(ctx sdk.Context, metaNode types.MetaNode, tokenToSub sdk.Coin) error { + networkAddr, err := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) if err != nil { return types.ErrInvalidNetworkAddr } - ownerAddr, err := sdk.AccAddressFromBech32(indexingNode.GetOwnerAddress()) + ownerAddr, err := sdk.AccAddressFromBech32(metaNode.GetOwnerAddress()) if err != nil { return types.ErrInvalidOwnerAddr } @@ -222,47 +222,47 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In coins := sdk.NewCoins(tokenToSub) - if indexingNode.Tokens.LT(tokenToSub.Amount) { + if metaNode.Tokens.LT(tokenToSub.Amount) { return types.ErrInsufficientBalance } // deduct tokens from NotBondedPool - nBondedIndexingAccountAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) - if nBondedIndexingAccountAddr == nil { - ctx.Logger().Error("not bonded account address for indexing nodes does not exist.") + nBondedMetaAccountAddr := k.accountKeeper.GetModuleAddress(types.MetaNodeNotBondedPoolName) + if nBondedMetaAccountAddr == nil { + ctx.Logger().Error("not bonded account address for meta nodes does not exist.") return types.ErrUnknownAccountAddress } - hasCoin := k.bankKeeper.HasBalance(ctx, nBondedIndexingAccountAddr, tokenToSub) + hasCoin := k.bankKeeper.HasBalance(ctx, nBondedMetaAccountAddr, tokenToSub) if !hasCoin { return types.ErrInsufficientBalanceOfNotBondedPool } - //notBondedTokenInPool := k.GetIndexingNodeNotBondedToken(ctx) + //notBondedTokenInPool := k.GetMetaNodeNotBondedToken(ctx) //if notBondedTokenInPool.IsLT(tokenToSub) { // return types.ErrInsufficientBalanceOfNotBondedPool //} //notBondedTokenInPool = notBondedTokenInPool.Sub(tokenToSub) - //k.SetIndexingNodeNotBondedToken(ctx, notBondedTokenInPool) + //k.SetMetaNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first, slashed amt goes into TotalSlashedPool coins, slashed := k.DeductSlashing(ctx, ownerAddr, coins) // add tokens to owner acc - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.IndexingNodeNotBondedPoolName, ownerAddr, coins) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.MetaNodeNotBondedPoolName, ownerAddr, coins) if err != nil { return err } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.IndexingNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.MetaNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) if err != nil { return err } - indexingNode = indexingNode.SubToken(tokenToSub.Amount) - newStake := indexingNode.Tokens + metaNode = metaNode.SubToken(tokenToSub.Amount) + newStake := metaNode.Tokens - k.SetIndexingNode(ctx, indexingNode) + k.SetMetaNode(ctx, metaNode) if newStake.IsZero() { - err = k.removeIndexingNode(ctx, networkAddr) + err = k.removeMetaNode(ctx, networkAddr) if err != nil { return err } @@ -270,50 +270,50 @@ func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.In return nil } -// remove the indexing node record and associated indexes -func (k Keeper) removeIndexingNode(ctx sdk.Context, addr stratos.SdsAddress) error { - // first retrieve the old indexing node record - indexingNode, found := k.GetIndexingNode(ctx, addr) +// remove the meta node record and associated indexes +func (k Keeper) removeMetaNode(ctx sdk.Context, addr stratos.SdsAddress) error { + // first retrieve the old meta node record + metaNode, found := k.GetMetaNode(ctx, addr) if !found { - return types.ErrNoIndexingNodeFound + return types.ErrNoMetaNodeFound } - if indexingNode.Tokens.IsPositive() { - panic("attempting to remove a indexing node which still contains tokens") + if metaNode.Tokens.IsPositive() { + panic("attempting to remove a meta node which still contains tokens") } - // delete the old indexing node record + // delete the old meta node record store := ctx.KVStore(k.storeKey) - store.Delete(types.GetIndexingNodeKey(addr)) + store.Delete(types.GetMetaNodeKey(addr)) return nil } -// getIndexingNodeList get all indexing nodes by networkAddr -func (k Keeper) GetIndexingNodeList(ctx sdk.Context, networkAddr stratos.SdsAddress) (indexingNodes []types.IndexingNode, err error) { +// getMetaNodeList get all meta nodes by networkAddr +func (k Keeper) GetMetaNodeList(ctx sdk.Context, networkAddr stratos.SdsAddress) (metaNodes []types.MetaNode, err error) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) + iterator := sdk.KVStorePrefixIterator(store, types.MetaNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) + node := types.MustUnmarshalMetaNode(k.cdc, iterator.Value()) networkAddrNode, err := stratos.SdsAddressFromBech32(node.GetNetworkAddress()) if err != nil { continue } if bytes.Equal(networkAddrNode, networkAddr) { - indexingNodes = append(indexingNodes, node) + metaNodes = append(metaNodes, node) } } - return indexingNodes, nil + return metaNodes, nil } -func (k Keeper) GetIndexingNodeListByMoniker(ctx sdk.Context, moniker string) (resourceNodes []types.IndexingNode, err error) { +func (k Keeper) GetMetaNodeListByMoniker(ctx sdk.Context, moniker string) (resourceNodes []types.MetaNode, err error) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) + iterator := sdk.KVStorePrefixIterator(store, types.MetaNodeKey) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - node := types.MustUnmarshalIndexingNode(k.cdc, iterator.Value()) + node := types.MustUnmarshalMetaNode(k.cdc, iterator.Value()) if strings.Compare(node.Description.Moniker, moniker) == 0 { resourceNodes = append(resourceNodes, node) } @@ -321,10 +321,10 @@ func (k Keeper) GetIndexingNodeListByMoniker(ctx sdk.Context, moniker string) (r return resourceNodes, nil } -func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress, +func (k Keeper) HandleVoteForMetaNodeRegistration(ctx sdk.Context, nodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress, opinion types.VoteOpinion, voterAddr stratos.SdsAddress) (nodeStatus stakingtypes.BondStatus, err error) { - votePool, found := k.GetIndexingNodeRegistrationVotePool(ctx, nodeAddr) + votePool, found := k.GetMetaNodeRegistrationVotePool(ctx, nodeAddr) if !found { return stakingtypes.Unbonded, types.ErrNoRegistrationVotePoolFound } @@ -335,9 +335,9 @@ func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr return stakingtypes.Unbonded, types.ErrDuplicateVoting } - node, found := k.GetIndexingNode(ctx, nodeAddr) + node, found := k.GetMetaNode(ctx, nodeAddr) if !found { - return stakingtypes.Unbonded, types.ErrNoIndexingNodeFound + return stakingtypes.Unbonded, types.ErrNoMetaNodeFound } ownerAddrNode, err := sdk.AccAddressFromBech32(node.GetOwnerAddress()) if err != nil { @@ -352,58 +352,58 @@ func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr } else { votePool.RejectList = append(votePool.RejectList, voterAddr.String()) } - k.SetIndexingNodeRegistrationVotePool(ctx, votePool) + k.SetMetaNodeRegistrationVotePool(ctx, votePool) if node.Status == stakingtypes.Bonded { return node.Status, nil } - totalSpCount := len(k.GetAllValidIndexingNodes(ctx)) + totalSpCount := len(k.GetAllValidMetaNodes(ctx)) voteCountRequiredToPass := totalSpCount*2/3 + 1 //unbounded to bounded if len(votePool.ApproveList) >= voteCountRequiredToPass { node.Status = stakingtypes.Bonded node.Suspend = false - k.SetIndexingNode(ctx, node) + k.SetMetaNode(ctx, node) // move stake from not bonded pool to bonded pool tokenToBond := sdk.NewCoin(k.BondDenom(ctx), node.Tokens) // sub coins from not bonded pool - nBondedIndexingAccountAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) - if nBondedIndexingAccountAddr == nil { - ctx.Logger().Error("not bonded account address for indexing nodes does not exist.") + nBondedMetaAccountAddr := k.accountKeeper.GetModuleAddress(types.MetaNodeNotBondedPoolName) + if nBondedMetaAccountAddr == nil { + ctx.Logger().Error("not bonded account address for meta nodes does not exist.") return node.Status, types.ErrUnknownAccountAddress } - hasCoin := k.bankKeeper.HasBalance(ctx, nBondedIndexingAccountAddr, tokenToBond) + hasCoin := k.bankKeeper.HasBalance(ctx, nBondedMetaAccountAddr, tokenToBond) if !hasCoin { return node.Status, types.ErrInsufficientBalance } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.IndexingNodeNotBondedPoolName, types.IndexingNodeBondedPoolName, sdk.NewCoins(tokenToBond)) + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.MetaNodeNotBondedPoolName, types.MetaNodeBondedPoolName, sdk.NewCoins(tokenToBond)) if err != nil { return node.Status, err } - //notBondedToken := k.GetIndexingNodeNotBondedToken(ctx) - //bondedToken := k.GetIndexingNodeBondedToken(ctx) + //notBondedToken := k.GetMetaNodeNotBondedToken(ctx) + //bondedToken := k.GetMetaNodeBondedToken(ctx) // //if notBondedToken.IsLT(tokenToBond) { // return node.Status, types.ErrInsufficientBalance //} //notBondedToken = notBondedToken.Sub(tokenToBond) //bondedToken = bondedToken.Add(tokenToBond) - //k.SetIndexingNodeNotBondedToken(ctx, notBondedToken) - //k.SetIndexingNodeBondedToken(ctx, bondedToken) + //k.SetMetaNodeNotBondedToken(ctx, notBondedToken) + //k.SetMetaNodeBondedToken(ctx, bondedToken) } return node.Status, nil } -func (k Keeper) GetIndexingNodeRegistrationVotePool(ctx sdk.Context, nodeAddr stratos.SdsAddress) (votePool types.IndexingNodeRegistrationVotePool, found bool) { +func (k Keeper) GetMetaNodeRegistrationVotePool(ctx sdk.Context, nodeAddr stratos.SdsAddress) (votePool types.MetaNodeRegistrationVotePool, found bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetIndexingNodeRegistrationVotesKey(nodeAddr)) + bz := store.Get(types.GetMetaNodeRegistrationVotesKey(nodeAddr)) if bz == nil { return votePool, false } @@ -411,20 +411,20 @@ func (k Keeper) GetIndexingNodeRegistrationVotePool(ctx sdk.Context, nodeAddr st return votePool, true } -func (k Keeper) SetIndexingNodeRegistrationVotePool(ctx sdk.Context, votePool types.IndexingNodeRegistrationVotePool) { +func (k Keeper) SetMetaNodeRegistrationVotePool(ctx sdk.Context, votePool types.MetaNodeRegistrationVotePool) { nodeAddr := votePool.GetNetworkAddress() store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshalLengthPrefixed(&votePool) node, _ := stratos.SdsAddressFromBech32(nodeAddr) - store.Set(types.GetIndexingNodeRegistrationVotesKey(node), bz) + store.Set(types.GetMetaNodeRegistrationVotesKey(node), bz) } -func (k Keeper) UpdateIndexingNode(ctx sdk.Context, description types.Description, +func (k Keeper) UpdateMetaNode(ctx sdk.Context, description types.Description, networkAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) error { - node, found := k.GetIndexingNode(ctx, networkAddr) + node, found := k.GetMetaNode(ctx, networkAddr) if !found { - return types.ErrNoIndexingNodeFound + return types.ErrNoMetaNodeFound } ownerAddrNode, _ := sdk.AccAddressFromBech32(node.GetOwnerAddress()) @@ -434,18 +434,18 @@ func (k Keeper) UpdateIndexingNode(ctx sdk.Context, description types.Descriptio node.Description = &description - k.SetIndexingNode(ctx, node) + k.SetMetaNode(ctx, node) return nil } -func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.SdsAddress, ownerAddr sdk.AccAddress, +func (k Keeper) UpdateMetaNodeStake(ctx sdk.Context, networkAddr stratos.SdsAddress, ownerAddr sdk.AccAddress, stakeDelta sdk.Coin, incrStake bool) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error) { blockTime := ctx.BlockHeader().Time - node, found := k.GetIndexingNode(ctx, networkAddr) + node, found := k.GetMetaNode(ctx, networkAddr) if !found { - return sdk.ZeroInt(), blockTime, types.ErrNoIndexingNodeFound + return sdk.ZeroInt(), blockTime, types.ErrNoMetaNodeFound } ownerAddrNode, _ := sdk.AccAddressFromBech32(node.GetOwnerAddress()) @@ -454,7 +454,7 @@ func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.Sds } if incrStake { - ozoneLimitChange, err = k.AddIndexingNodeStake(ctx, node, stakeDelta) + ozoneLimitChange, err = k.AddMetaNodeStake(ctx, node, stakeDelta) if err != nil { return sdk.ZeroInt(), blockTime, err } @@ -464,7 +464,7 @@ func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.Sds if node.GetStatus() == stakingtypes.Unbonding { return sdk.ZeroInt(), blockTime, types.ErrUnbondingNode } - ozoneLimitChange, completionTime, err := k.UnbondIndexingNode(ctx, node, stakeDelta.Amount) + ozoneLimitChange, completionTime, err := k.UnbondMetaNode(ctx, node, stakeDelta.Amount) if err != nil { return sdk.ZeroInt(), blockTime, err } @@ -472,64 +472,64 @@ func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.Sds } } -func (k Keeper) MintIndexingNodeBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { - indexingNodeBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.IndexingNodeBondedPoolName) - if indexingNodeBondedPoolAcc == nil { +func (k Keeper) MintMetaNodeBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { + metaNodeBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.MetaNodeBondedPoolName) + if metaNodeBondedPoolAcc == nil { return types.ErrUnknownAccountAddress } - hasCoin := k.bankKeeper.GetBalance(ctx, indexingNodeBondedPoolAcc, k.BondDenom(ctx)) + hasCoin := k.bankKeeper.GetBalance(ctx, metaNodeBondedPoolAcc, k.BondDenom(ctx)) // can only mint when balance is 0 TODO To be tested if hasCoin.Amount.GT(sdk.ZeroInt()) { return types.ErrInitialBalanceNotZero } - return k.bankKeeper.MintCoins(ctx, types.IndexingNodeBondedPoolName, sdk.NewCoins(initialCoins)) + return k.bankKeeper.MintCoins(ctx, types.MetaNodeBondedPoolName, sdk.NewCoins(initialCoins)) } -//func (k Keeper) SetIndexingNodeBondedToken(ctx sdk.Context, token sdk.Coin) { +//func (k Keeper) SetMetaNodeBondedToken(ctx sdk.Context, token sdk.Coin) { // store := ctx.KVStore(k.storeKey) // bz := k.cdc.MustMarshalLengthPrefixed(&token) -// store.Set(types.IndexingNodeBondedTokenKey, bz) +// store.Set(types.MetaNodeBondedTokenKey, bz) //} -func (k Keeper) GetIndexingNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { - indexingNodeBondedAccAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeBondedPoolName) - if indexingNodeBondedAccAddr == nil { - ctx.Logger().Error("account address for indexing node bonded pool does not exist.") +func (k Keeper) GetMetaNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { + metaNodeBondedAccAddr := k.accountKeeper.GetModuleAddress(types.MetaNodeBondedPoolName) + if metaNodeBondedAccAddr == nil { + ctx.Logger().Error("account address for meta node bonded pool does not exist.") return sdk.Coin{ Denom: types.DefaultBondDenom, Amount: sdk.ZeroInt(), } } - return k.bankKeeper.GetBalance(ctx, indexingNodeBondedAccAddr, k.BondDenom(ctx)) + return k.bankKeeper.GetBalance(ctx, metaNodeBondedAccAddr, k.BondDenom(ctx)) } -func (k Keeper) MintIndexingNodeNotBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { - indexingNodeNotBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) - if indexingNodeNotBondedPoolAcc == nil { +func (k Keeper) MintMetaNodeNotBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { + metaNodeNotBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.MetaNodeNotBondedPoolName) + if metaNodeNotBondedPoolAcc == nil { return types.ErrUnknownAccountAddress } - hasCoin := k.bankKeeper.GetBalance(ctx, indexingNodeNotBondedPoolAcc, k.BondDenom(ctx)) + hasCoin := k.bankKeeper.GetBalance(ctx, metaNodeNotBondedPoolAcc, k.BondDenom(ctx)) // can only mint when balance is 0 TODO To be tested if hasCoin.Amount.GT(sdk.ZeroInt()) { return types.ErrInitialBalanceNotZero } - return k.bankKeeper.MintCoins(ctx, types.IndexingNodeNotBondedPoolName, sdk.NewCoins(initialCoins)) + return k.bankKeeper.MintCoins(ctx, types.MetaNodeNotBondedPoolName, sdk.NewCoins(initialCoins)) } -//func (k Keeper) SetIndexingNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { +//func (k Keeper) SetMetaNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { // store := ctx.KVStore(k.storeKey) // bz := k.cdc.MustMarshalLengthPrefixed(&token) -// store.Set(types.IndexingNodeNotBondedTokenKey, bz) +// store.Set(types.MetaNodeNotBondedTokenKey, bz) //} -func (k Keeper) GetIndexingNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) { - indexingNodeNotBondedAccAddr := k.accountKeeper.GetModuleAddress(types.IndexingNodeNotBondedPoolName) - if indexingNodeNotBondedAccAddr == nil { - ctx.Logger().Error("account address for indexing node Not bonded pool does not exist.") +func (k Keeper) GetMetaNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) { + metaNodeNotBondedAccAddr := k.accountKeeper.GetModuleAddress(types.MetaNodeNotBondedPoolName) + if metaNodeNotBondedAccAddr == nil { + ctx.Logger().Error("account address for meta node Not bonded pool does not exist.") return sdk.Coin{ Denom: types.DefaultBondDenom, Amount: sdk.ZeroInt(), } } - return k.bankKeeper.GetBalance(ctx, indexingNodeNotBondedAccAddr, k.BondDenom(ctx)) + return k.bankKeeper.GetBalance(ctx, metaNodeNotBondedAccAddr, k.BondDenom(ctx)) } diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index dd8af73e..8ff33d8f 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -27,8 +27,8 @@ type Keeper struct { hooks types.RegisterHooks resourceNodeCache map[string]cachedResourceNode resourceNodeCacheList *list.List - indexingNodeCache map[string]cachedIndexingNode - indexingNodeCacheList *list.List + metaNodeCache map[string]cachedMetaNode + metaNodeCacheList *list.List } // NewKeeper creates a register keeper @@ -44,8 +44,8 @@ func NewKeeper(cdc codec.Codec, key sdk.StoreKey, paramSpace paramtypes.Subspace hooks: nil, resourceNodeCache: make(map[string]cachedResourceNode, resourceNodeCacheSize), resourceNodeCacheList: list.New(), - indexingNodeCache: make(map[string]cachedIndexingNode, indexingNodeCacheSize), - indexingNodeCacheList: list.New(), + metaNodeCache: make(map[string]cachedMetaNode, metaNodeCacheSize), + metaNodeCacheList: list.New(), } return keeper } @@ -217,10 +217,10 @@ func (k Keeper) GetResourceNetworksIterator(ctx sdk.Context) sdk.Iterator { return sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) } -// GetIndexingNetworksIterator gets an iterator over all network addresses -func (k Keeper) GetIndexingNetworksIterator(ctx sdk.Context) sdk.Iterator { +// GetMetaNetworksIterator gets an iterator over all network addresses +func (k Keeper) GetMetaNetworksIterator(ctx sdk.Context) sdk.Iterator { store := ctx.KVStore(k.storeKey) - return sdk.KVStorePrefixIterator(store, types.IndexingNodeKey) + return sdk.KVStorePrefixIterator(store, types.MetaNodeKey) } func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { @@ -234,10 +234,10 @@ func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { } networkList = append(networkList, networkAddr) } - iter := keeper.GetIndexingNetworksIterator(ctx) + iter := keeper.GetMetaNetworksIterator(ctx) for ; iter.Valid(); iter.Next() { - indexingNode := types.MustUnmarshalIndexingNode(k.cdc, iter.Value()) - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) + metaNode := types.MustUnmarshalMetaNode(k.cdc, iter.Value()) + networkAddr, err := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) if err != nil { continue } @@ -263,27 +263,27 @@ func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res return res[:len(res)-1] } -// GetUnbondingNodes return a given amount of all the UnbondingIndexingNodes +// GetUnbondingNodes return a given amount of all the UnbondingMetaNodes func (k Keeper) GetUnbondingNodes(ctx sdk.Context, networkAddr stratos.SdsAddress, - maxRetrieve uint32) (unbondingIndexingNodes []types.UnbondingNode) { + maxRetrieve uint32) (unbondingMetaNodes []types.UnbondingNode) { - unbondingIndexingNodes = make([]types.UnbondingNode, maxRetrieve) + unbondingMetaNodes = make([]types.UnbondingNode, maxRetrieve) store := ctx.KVStore(k.storeKey) - indexingNodePrefixKey := types.GetUBDNodeKey(networkAddr) - iterator := sdk.KVStorePrefixIterator(store, indexingNodePrefixKey) + metaNodePrefixKey := types.GetUBDNodeKey(networkAddr) + iterator := sdk.KVStorePrefixIterator(store, metaNodePrefixKey) defer iterator.Close() i := 0 for ; iterator.Valid() && i < int(maxRetrieve); iterator.Next() { - unbondingIndexingNode := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) - unbondingIndexingNodes[i] = unbondingIndexingNode + unbondingMetaNode := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) + unbondingMetaNodes[i] = unbondingMetaNode i++ } - return unbondingIndexingNodes[:i] // trim if the array length < maxRetrieve + return unbondingMetaNodes[:i] // trim if the array length < maxRetrieve } -// GetUnbondingNode return a unbonding UnbondingIndexingNode +// GetUnbondingNode return a unbonding UnbondingMetaNode func (k Keeper) GetUnbondingNode(ctx sdk.Context, networkAddr stratos.SdsAddress) (ubd types.UnbondingNode, found bool) { @@ -298,7 +298,7 @@ func (k Keeper) GetUnbondingNode(ctx sdk.Context, return ubd, true } -// IterateUnbondingNodes iterates through all of the unbonding indexingNodes +// IterateUnbondingNodes iterates through all of the unbonding metaNodes func (k Keeper) IterateUnbondingNodes(ctx sdk.Context, fn func(index int64, ubd types.UnbondingNode) (stop bool)) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.UBDNodeKey) @@ -313,7 +313,7 @@ func (k Keeper) IterateUnbondingNodes(ctx sdk.Context, fn func(index int64, ubd } } -// HasMaxUnbondingIndexingNodeEntries - check if unbonding IndexingNode has maximum number of entries +// HasMaxUnbondingMetaNodeEntries - check if unbonding MetaNode has maximum number of entries func (k Keeper) HasMaxUnbondingNodeEntries(ctx sdk.Context, networkAddr stratos.SdsAddress) bool { ubd, found := k.GetUnbondingNode(ctx, networkAddr) if !found { @@ -322,7 +322,7 @@ func (k Keeper) HasMaxUnbondingNodeEntries(ctx sdk.Context, networkAddr stratos. return len(ubd.Entries) >= int(k.MaxEntries(ctx)) } -// SetUnbondingNode sets the unbonding IndexingNode +// SetUnbondingNode sets the unbonding MetaNode func (k Keeper) SetUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalUnbondingNode(k.cdc, ubd) @@ -334,7 +334,7 @@ func (k Keeper) SetUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store.Set(key, bz) } -// RemoveUnbondingNode removes the unbonding IndexingNode object +// RemoveUnbondingNode removes the unbonding MetaNode object func (k Keeper) RemoveUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store := ctx.KVStore(k.storeKey) networkAddr, err := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) @@ -345,16 +345,16 @@ func (k Keeper) RemoveUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode) { store.Delete(key) } -// SetUnbondingIndexingNodeEntry adds an entry to the unbonding IndexingNode at -// the given addresses. It creates the unbonding IndexingNode if it does not exist -func (k Keeper) SetUnbondingNodeEntry(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool, +// SetUnbondingMetaNodeEntry adds an entry to the unbonding MetaNode at +// the given addresses. It creates the unbonding MetaNode if it does not exist +func (k Keeper) SetUnbondingNodeEntry(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool, creationHeight int64, minTime time.Time, balance sdk.Int) types.UnbondingNode { ubd, found := k.GetUnbondingNode(ctx, networkAddr) if found { ubd.AddEntry(creationHeight, minTime, balance) } else { - ubd = types.NewUnbondingNode(networkAddr, isIndexingNode, creationHeight, minTime, balance) + ubd = types.NewUnbondingNode(networkAddr, isMetaNode, creationHeight, minTime, balance) } k.SetUnbondingNode(ctx, ubd) return ubd @@ -467,7 +467,7 @@ func (k Keeper) CompleteUnbondingWithAmount(ctx sdk.Context, networkAddr stratos k.SetUnbondingNode(ctx, ubd) } - return balances, ubd.IsIndexingNode, nil + return balances, ubd.IsMetaNode, nil } // CompleteUnbonding performs the same logic as CompleteUnbondingWithAmount except @@ -478,22 +478,22 @@ func (k Keeper) CompleteUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddres } func (k Keeper) SubtractUBDNodeStake(ctx sdk.Context, ubd types.UnbondingNode, tokenToSub sdk.Coin) error { - // case of indexing node + // case of meta node networkAddr, err := stratos.SdsAddressFromBech32(ubd.GetNetworkAddr()) if err != nil { return err } - if ubd.IsIndexingNode { - indexingNode, found := k.GetIndexingNode(ctx, networkAddr) + if ubd.IsMetaNode { + metaNode, found := k.GetMetaNode(ctx, networkAddr) if !found { - return types.ErrNoIndexingNodeFound + return types.ErrNoMetaNodeFound } - return k.SubtractIndexingNodeStake(ctx, indexingNode, tokenToSub) + return k.SubtractMetaNodeStake(ctx, metaNode, tokenToSub) } // case of resource node resourceNode, found := k.GetResourceNode(ctx, networkAddr) if !found { - return types.ErrNoIndexingNodeFound + return types.ErrNoMetaNodeFound } return k.SubtractResourceNodeStake(ctx, resourceNode, tokenToSub) } @@ -550,15 +550,15 @@ func (k Keeper) UnbondResourceNode( return ozoneLimitChange, unbondingMatureTime, nil } -func (k Keeper) UnbondIndexingNode( - ctx sdk.Context, indexingNode types.IndexingNode, amt sdk.Int, +func (k Keeper) UnbondMetaNode( + ctx sdk.Context, metaNode types.MetaNode, amt sdk.Int, ) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error) { - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) + networkAddr, err := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) if err != nil { return sdk.ZeroInt(), time.Now(), errors.New("invalid network address") } - ownerAddr, err := sdk.AccAddressFromBech32(indexingNode.GetOwnerAddress()) + ownerAddr, err := sdk.AccAddressFromBech32(metaNode.GetOwnerAddress()) if err != nil { return sdk.ZeroInt(), time.Now(), errors.New("invalid wallet address") } @@ -572,27 +572,27 @@ func (k Keeper) UnbondIndexingNode( return sdk.ZeroInt(), time.Time{}, types.ErrMaxUnbondingNodeEntries } - unbondingMatureTime = calcUnbondingMatureTime(ctx, indexingNode.Status, indexingNode.CreationTime, k.UnbondingThreasholdTime(ctx), k.UnbondingCompletionTime(ctx)) + unbondingMatureTime = calcUnbondingMatureTime(ctx, metaNode.Status, metaNode.CreationTime, k.UnbondingThreasholdTime(ctx), k.UnbondingCompletionTime(ctx)) bondDenom := k.GetParams(ctx).BondDenom coin := sdk.NewCoin(bondDenom, amt) - if indexingNode.GetStatus() == stakingtypes.Bonded { + if metaNode.GetStatus() == stakingtypes.Bonded { // transfer the node tokens to the not bonded pool - k.bondedToUnbonding(ctx, indexingNode, true, coin) + k.bondedToUnbonding(ctx, metaNode, true, coin) // adjust ozone limit ozoneLimitChange = k.decreaseOzoneLimitBySubtractStake(ctx, amt) } // change node status to unbonding if unbonding all tokens - if amt.Equal(indexingNode.Tokens) { - indexingNode.Status = stakingtypes.Unbonding - k.SetIndexingNode(ctx, indexingNode) + if amt.Equal(metaNode.Tokens) { + metaNode.Status = stakingtypes.Unbonding + k.SetMetaNode(ctx, metaNode) } // Set the unbonding mature time and completion height appropriately unbondingNode := k.SetUnbondingNodeEntry(ctx, networkAddr, true, ctx.BlockHeight(), unbondingMatureTime, amt) // Add to unbonding node queue k.InsertUnbondingNodeQueue(ctx, unbondingNode, unbondingMatureTime) - ctx.Logger().Info("Unbonding indexing node " + unbondingNode.String() + "\n after mature time" + unbondingMatureTime.String()) + ctx.Logger().Info("Unbonding meta node " + unbondingNode.String() + "\n after mature time" + unbondingMatureTime.String()) return ozoneLimitChange, unbondingMatureTime, nil } diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index fbf4de4a..e13ba3a0 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -78,7 +78,7 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types return &types.MsgCreateResourceNodeResponse{}, nil } -func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types.MsgCreateIndexingNode) (*types.MsgCreateIndexingNodeResponse, error) { +func (k msgServer) HandleMsgCreateMetaNode(goCtx context.Context, msg *types.MsgCreateMetaNode) (*types.MsgCreateMetaNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // check to see if the pubkey or sender has been registered before @@ -88,12 +88,12 @@ func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { - return &types.MsgCreateIndexingNodeResponse{}, err + return &types.MsgCreateMetaNodeResponse{}, err } - if _, found := k.GetIndexingNode(ctx, networkAddr); found { - ctx.Logger().Error("Indexing node already exist") - return nil, types.ErrIndexingNodePubKeyExists + if _, found := k.GetMetaNode(ctx, networkAddr); found { + ctx.Logger().Error("Meta node already exist") + return nil, types.ErrMetaNodePubKeyExists } if msg.Value.Denom != k.BondDenom(ctx) { return nil, types.ErrBadDenom @@ -101,17 +101,17 @@ func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) if err != nil { - return &types.MsgCreateIndexingNodeResponse{}, err + return &types.MsgCreateMetaNodeResponse{}, err } - ozoneLimitChange, err := k.RegisterIndexingNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, msg.Value) + ozoneLimitChange, err := k.RegisterMetaNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, msg.Value) if err != nil { return nil, err } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeCreateIndexingNode, + types.EventTypeCreateMetaNode, sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), sdk.NewAttribute(types.AttributeKeyNetworkAddress, pk.String()), sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.String()), @@ -122,7 +122,7 @@ func (k msgServer) HandleMsgCreateIndexingNode(goCtx context.Context, msg *types sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), ), }) - return &types.MsgCreateIndexingNodeResponse{}, nil + return &types.MsgCreateMetaNodeResponse{}, nil } func (k msgServer) HandleMsgRemoveResourceNode(goCtx context.Context, msg *types.MsgRemoveResourceNode) (*types.MsgRemoveResourceNodeResponse, error) { @@ -163,22 +163,22 @@ func (k msgServer) HandleMsgRemoveResourceNode(goCtx context.Context, msg *types return &types.MsgRemoveResourceNodeResponse{}, nil } -func (k msgServer) HandleMsgRemoveIndexingNode(goCtx context.Context, msg *types.MsgRemoveIndexingNode) (*types.MsgRemoveIndexingNodeResponse, error) { +func (k msgServer) HandleMsgRemoveMetaNode(goCtx context.Context, msg *types.MsgRemoveMetaNode) (*types.MsgRemoveMetaNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - p2pAddress, err := stratos.SdsAddressFromBech32(msg.IndexingNodeAddress) + p2pAddress, err := stratos.SdsAddressFromBech32(msg.MetaNodeAddress) if err != nil { - return &types.MsgRemoveIndexingNodeResponse{}, err + return &types.MsgRemoveMetaNodeResponse{}, err } - indexingNode, found := k.GetIndexingNode(ctx, p2pAddress) + metaNode, found := k.GetMetaNode(ctx, p2pAddress) if !found { - return nil, types.ErrNoIndexingNodeFound + return nil, types.ErrNoMetaNodeFound } - if indexingNode.GetStatus() == stakingtypes.Unbonding { + if metaNode.GetStatus() == stakingtypes.Unbonding { return nil, types.ErrUnbondingNode } - ozoneLimitChange, completionTime, err := k.UnbondIndexingNode(ctx, indexingNode, indexingNode.Tokens) + ozoneLimitChange, completionTime, err := k.UnbondMetaNode(ctx, metaNode, metaNode.Tokens) if err != nil { return nil, err } @@ -186,9 +186,9 @@ func (k msgServer) HandleMsgRemoveIndexingNode(goCtx context.Context, msg *types //completionTimeBz := amino.MustMarshalBinaryLengthPrefixed(completionTime) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeUnbondingIndexingNode, + types.EventTypeUnbondingMetaNode, sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), - sdk.NewAttribute(types.AttributeKeyIndexingNode, msg.IndexingNodeAddress), + sdk.NewAttribute(types.AttributeKeyMetaNode, msg.MetaNodeAddress), sdk.NewAttribute(types.AttributeKeyOZoneLimitChanges, ozoneLimitChange.Neg().String()), sdk.NewAttribute(types.AttributeKeyUnbondingMatureTime, completionTime.Format(time.RFC3339)), ), @@ -199,20 +199,20 @@ func (k msgServer) HandleMsgRemoveIndexingNode(goCtx context.Context, msg *types ), }) - return &types.MsgRemoveIndexingNodeResponse{}, nil + return &types.MsgRemoveMetaNodeResponse{}, nil } -func (k msgServer) HandleMsgIndexingNodeRegistrationVote(goCtx context.Context, msg *types.MsgIndexingNodeRegistrationVote) (*types.MsgIndexingNodeRegistrationVoteResponse, error) { +func (k msgServer) HandleMsgMetaNodeRegistrationVote(goCtx context.Context, msg *types.MsgMetaNodeRegistrationVote) (*types.MsgMetaNodeRegistrationVoteResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) candidateNetworkAddress, err := stratos.SdsAddressFromBech32(msg.CandidateNetworkAddress) if err != nil { - return &types.MsgIndexingNodeRegistrationVoteResponse{}, err + return &types.MsgMetaNodeRegistrationVoteResponse{}, err } - nodeToApprove, found := k.GetIndexingNode(ctx, candidateNetworkAddress) + nodeToApprove, found := k.GetMetaNode(ctx, candidateNetworkAddress) if !found { - return nil, types.ErrNoIndexingNodeFound + return nil, types.ErrNoMetaNodeFound } if nodeToApprove.OwnerAddress != msg.CandidateOwnerAddress { return nil, types.ErrInvalidOwnerAddr @@ -220,30 +220,30 @@ func (k msgServer) HandleMsgIndexingNodeRegistrationVote(goCtx context.Context, voterNetworkAddress, err := stratos.SdsAddressFromBech32(msg.VoterNetworkAddress) if err != nil { - return &types.MsgIndexingNodeRegistrationVoteResponse{}, err + return &types.MsgMetaNodeRegistrationVoteResponse{}, err } - voter, found := k.GetIndexingNode(ctx, voterNetworkAddress) + voter, found := k.GetMetaNode(ctx, voterNetworkAddress) if !found { return nil, types.ErrInvalidVoterAddr } candidateOwnerAddress, err := sdk.AccAddressFromBech32(msg.CandidateOwnerAddress) if err != nil { - return &types.MsgIndexingNodeRegistrationVoteResponse{}, err + return &types.MsgMetaNodeRegistrationVoteResponse{}, err } if !(voter.Status == stakingtypes.Bonded) || voter.Suspend { return nil, types.ErrInvalidVoterStatus } - nodeStatus, err := k.HandleVoteForIndexingNodeRegistration(ctx, candidateNetworkAddress, candidateOwnerAddress, types.VoteOpinion(msg.Opinion), voterNetworkAddress) + nodeStatus, err := k.HandleVoteForMetaNodeRegistration(ctx, candidateNetworkAddress, candidateOwnerAddress, types.VoteOpinion(msg.Opinion), voterNetworkAddress) if err != nil { return nil, err } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeIndexingNodeRegistrationVote, + types.EventTypeMetaNodeRegistrationVote, sdk.NewAttribute(sdk.AttributeKeySender, msg.VoterOwnerAddress), sdk.NewAttribute(types.AttributeKeyVoterNetworkAddress, msg.VoterNetworkAddress), sdk.NewAttribute(types.AttributeKeyCandidateNetworkAddress, msg.CandidateNetworkAddress), @@ -256,7 +256,7 @@ func (k msgServer) HandleMsgIndexingNodeRegistrationVote(goCtx context.Context, ), }) - return &types.MsgIndexingNodeRegistrationVoteResponse{}, nil + return &types.MsgMetaNodeRegistrationVoteResponse{}, nil } func (k msgServer) HandleMsgUpdateResourceNode(goCtx context.Context, msg *types.MsgUpdateResourceNode) (*types.MsgUpdateResourceNodeResponse, error) { @@ -336,26 +336,26 @@ func (k msgServer) HandleMsgUpdateResourceNodeStake(goCtx context.Context, msg * return &types.MsgUpdateResourceNodeStakeResponse{}, nil } -func (k msgServer) HandleMsgUpdateIndexingNode(goCtx context.Context, msg *types.MsgUpdateIndexingNode) (*types.MsgUpdateIndexingNodeResponse, error) { +func (k msgServer) HandleMsgUpdateMetaNode(goCtx context.Context, msg *types.MsgUpdateMetaNode) (*types.MsgUpdateMetaNodeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { - return &types.MsgUpdateIndexingNodeResponse{}, err + return &types.MsgUpdateMetaNodeResponse{}, err } ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) if err != nil { - return &types.MsgUpdateIndexingNodeResponse{}, err + return &types.MsgUpdateMetaNodeResponse{}, err } - err = k.UpdateIndexingNode(ctx, msg.Description, networkAddr, ownerAddress) + err = k.UpdateMetaNode(ctx, msg.Description, networkAddr, ownerAddress) if err != nil { return nil, err } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeUpdateIndexingNode, + types.EventTypeUpdateMetaNode, sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress), ), @@ -365,34 +365,34 @@ func (k msgServer) HandleMsgUpdateIndexingNode(goCtx context.Context, msg *types sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), ), }) - return &types.MsgUpdateIndexingNodeResponse{}, nil + return &types.MsgUpdateMetaNodeResponse{}, nil } -func (k msgServer) HandleMsgUpdateIndexingNodeStake(goCtx context.Context, msg *types.MsgUpdateIndexingNodeStake) (*types.MsgUpdateIndexingNodeStakeResponse, error) { +func (k msgServer) HandleMsgUpdateMetaNodeStake(goCtx context.Context, msg *types.MsgUpdateMetaNodeStake) (*types.MsgUpdateMetaNodeStakeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) networkAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { - return &types.MsgUpdateIndexingNodeStakeResponse{}, err + return &types.MsgUpdateMetaNodeStakeResponse{}, err } ownerAddress, err := sdk.AccAddressFromBech32(msg.OwnerAddress) if err != nil { - return &types.MsgUpdateIndexingNodeStakeResponse{}, err + return &types.MsgUpdateMetaNodeStakeResponse{}, err } if msg.StakeDelta.Amount.LT(sdk.NewInt(0)) { - return &types.MsgUpdateIndexingNodeStakeResponse{}, errors.New("invalid stake delta") + return &types.MsgUpdateMetaNodeStakeResponse{}, errors.New("invalid stake delta") } - ozoneLimitChange, completionTime, err := k.UpdateIndexingNodeStake(ctx, networkAddr, ownerAddress, *msg.StakeDelta, msg.IncrStake) + ozoneLimitChange, completionTime, err := k.UpdateMetaNodeStake(ctx, networkAddr, ownerAddress, *msg.StakeDelta, msg.IncrStake) if err != nil { return nil, err } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeUpdateIndexingNodeStake, + types.EventTypeUpdateMetaNodeStake, sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), sdk.NewAttribute(types.AttributeKeyNetworkAddress, msg.NetworkAddress), sdk.NewAttribute(types.AttributeKeyIncrStakeBool, strconv.FormatBool(msg.IncrStake)), @@ -405,5 +405,5 @@ func (k msgServer) HandleMsgUpdateIndexingNodeStake(goCtx context.Context, msg * sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), ), }) - return &types.MsgUpdateIndexingNodeStakeResponse{}, nil + return &types.MsgUpdateMetaNodeStakeResponse{}, nil } diff --git a/x/register/keeper/node_state_change.go b/x/register/keeper/node_state_change.go index fdf2bec8..68c3f1d3 100644 --- a/x/register/keeper/node_state_change.go +++ b/x/register/keeper/node_state_change.go @@ -17,14 +17,14 @@ func (k Keeper) BlockRegisteredNodesUpdates(ctx sdk.Context) []abci.ValidatorUpd ctx.Logger().Debug("Enter BlockRegisteredNodesUpdates") matureUBDs := k.DequeueAllMatureUBDQueue(ctx, ctx.BlockHeader().Time) for _, networkAddr := range matureUBDs { - balances, isIndexingNode, err := k.CompleteUnbondingWithAmount(ctx, networkAddr) + balances, isMetaNode, err := k.CompleteUnbondingWithAmount(ctx, networkAddr) if err != nil { continue } - if isIndexingNode { + if isMetaNode { ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeCompleteUnbondingIndexingNode, + types.EventTypeCompleteUnbondingMetaNode, sdk.NewAttribute(sdk.AttributeKeyAmount, balances.String()), sdk.NewAttribute(types.AttributeKeyNetworkAddress, networkAddr.String()), ), @@ -46,14 +46,14 @@ func (k Keeper) BlockRegisteredNodesUpdates(ctx sdk.Context) []abci.ValidatorUpd } // Node state transitions -func (k Keeper) bondedToUnbonding(ctx sdk.Context, node interface{}, isIndexingNode bool, coin sdk.Coin) interface{} { - switch isIndexingNode { +func (k Keeper) bondedToUnbonding(ctx sdk.Context, node interface{}, isMetaNode bool, coin sdk.Coin) interface{} { + switch isMetaNode { case true: - temp := node.(types.IndexingNode) + temp := node.(types.MetaNode) if temp.GetStatus() != stakingtypes.Bonded { - panic(fmt.Sprintf("bad state transition bondedToUnbonding, indexingNode: %v\n", temp)) + panic(fmt.Sprintf("bad state transition bondedToUnbonding, metaNode: %v\n", temp)) } - return k.beginUnbondingIndexingNode(ctx, &temp, &coin) + return k.beginUnbondingMetaNode(ctx, &temp, &coin) default: temp := node.(types.ResourceNode) if temp.GetStatus() != stakingtypes.Bonded { @@ -64,20 +64,20 @@ func (k Keeper) bondedToUnbonding(ctx sdk.Context, node interface{}, isIndexingN } // switches a Node from unbonding state to unbonded state -func (k Keeper) unbondingToUnbonded(ctx sdk.Context, node interface{}, isIndexingNode bool) interface{} { - switch isIndexingNode { +func (k Keeper) unbondingToUnbonded(ctx sdk.Context, node interface{}, isMetaNode bool) interface{} { + switch isMetaNode { case true: - temp := node.(types.IndexingNode) + temp := node.(types.MetaNode) if temp.GetStatus() != stakingtypes.Unbonding { - panic(fmt.Sprintf("bad state transition unbondingToBonded, indexingNode: %v\n", temp)) + panic(fmt.Sprintf("bad state transition unbondingToBonded, metaNode: %v\n", temp)) } - return k.completeUnbondingNode(ctx, temp, isIndexingNode) + return k.completeUnbondingNode(ctx, temp, isMetaNode) default: temp := node.(types.ResourceNode) if temp.GetStatus() != stakingtypes.Unbonding { panic(fmt.Sprintf("bad state transition unbondingToBonded, resourceNode: %v\n", temp)) } - return k.completeUnbondingNode(ctx, temp, isIndexingNode) + return k.completeUnbondingNode(ctx, temp, isMetaNode) } } @@ -97,22 +97,22 @@ func (k Keeper) beginUnbondingResourceNode(ctx sdk.Context, resourceNode *types. k.AfterNodeBeginUnbonding(ctx, networkAddr, false) return resourceNode } -func (k Keeper) beginUnbondingIndexingNode(ctx sdk.Context, indexingNode *types.IndexingNode, coin *sdk.Coin) *types.IndexingNode { +func (k Keeper) beginUnbondingMetaNode(ctx sdk.Context, metaNode *types.MetaNode, coin *sdk.Coin) *types.MetaNode { // change node stat, remove token from bonded pool, add token into NotBondedPool - err := k.RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx, *indexingNode, *coin) + err := k.RemoveTokenFromPoolWhileUnbondingMetaNode(ctx, *metaNode, *coin) if err != nil { return nil } if err != nil { - return &types.IndexingNode{} + return &types.MetaNode{} } - networkAddr, err := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) + networkAddr, err := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) if err != nil { - return &types.IndexingNode{} + return &types.MetaNode{} } // trigger hook if registered k.AfterNodeBeginUnbonding(ctx, networkAddr, true) - return indexingNode + return metaNode } func calcUnbondingMatureTime(ctx sdk.Context, currStatus stakingtypes.BondStatus, creationTime time.Time, threasholdTime time.Duration, completionTime time.Duration) time.Time { @@ -130,11 +130,11 @@ func calcUnbondingMatureTime(ctx sdk.Context, currStatus stakingtypes.BondStatus } // perform all the store operations for when a validator status becomes unbonded -func (k Keeper) completeUnbondingNode(ctx sdk.Context, node interface{}, isIndexingNode bool) interface{} { - if isIndexingNode { - temp := node.(types.IndexingNode) +func (k Keeper) completeUnbondingNode(ctx sdk.Context, node interface{}, isMetaNode bool) interface{} { + if isMetaNode { + temp := node.(types.MetaNode) temp.Status = stakingtypes.Unbonded - k.SetIndexingNode(ctx, temp) + k.SetMetaNode(ctx, temp) return temp } else { temp := node.(types.ResourceNode) @@ -182,20 +182,20 @@ func (k Keeper) UnbondAllMatureUBDNodeQueue(ctx sdk.Context) { panic("node in the unbonding queue was not found") } - if ubd.IsIndexingNode { + if ubd.IsMetaNode { - node, found := k.GetIndexingNode(ctx, ubdNetworkAddr) + node, found := k.GetMetaNode(ctx, ubdNetworkAddr) if !found { - panic("cannot find indexing node " + ubd.NetworkAddr) + panic("cannot find meta node " + ubd.NetworkAddr) } if node.GetStatus() != stakingtypes.Unbonding { panic("unexpected node in unbonding queue; status was not unbonding") } - k.unbondingToUnbonded(ctx, node, ubd.IsIndexingNode) - k.removeIndexingNode(ctx, ubdNetworkAddr) - _, found1 := k.GetIndexingNode(ctx, ubdNetworkAddr) + k.unbondingToUnbonded(ctx, node, ubd.IsMetaNode) + k.removeMetaNode(ctx, ubdNetworkAddr) + _, found1 := k.GetMetaNode(ctx, ubdNetworkAddr) if found1 { - ctx.Logger().Info("Removed indexing node with addr " + ubd.NetworkAddr) + ctx.Logger().Info("Removed meta node with addr " + ubd.NetworkAddr) } } else { node, found := k.GetResourceNode(ctx, ubdNetworkAddr) @@ -205,7 +205,7 @@ func (k Keeper) UnbondAllMatureUBDNodeQueue(ctx sdk.Context) { if node.GetStatus() != stakingtypes.Unbonding { panic("unexpected node in unbonding queue; status was not unbonding") } - k.unbondingToUnbonded(ctx, node, ubd.IsIndexingNode) + k.unbondingToUnbonded(ctx, node, ubd.IsMetaNode) k.removeResourceNode(ctx, ubdNetworkAddr) _, found1 := k.GetResourceNode(ctx, ubdNetworkAddr) if found1 { diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 11ad6853..48147a88 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -19,7 +19,7 @@ import ( const ( QueryResourceNodeByNetworkAddr = "resource-nodes" - QueryIndexingNodeByNetworkAddr = "indexing_nodes" + QueryMetaNodeByNetworkAddr = "meta_nodes" QueryNodesTotalStakes = "nodes_total_stakes" QueryNodeStakeByNodeAddr = "node_stakes" QueryNodeStakeByOwner = "node_stakes_by_owner" @@ -34,8 +34,8 @@ func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { switch path[0] { case QueryResourceNodeByNetworkAddr: return getResourceNodeByNetworkAddr(ctx, req, k, legacyQuerierCdc) - case QueryIndexingNodeByNetworkAddr: - return getIndexingNodesStakingInfo(ctx, req, k, legacyQuerierCdc) + case QueryMetaNodeByNetworkAddr: + return getMetaNodesStakingInfo(ctx, req, k, legacyQuerierCdc) case QueryNodesTotalStakes: return getNodesStakingInfo(ctx, req, k, legacyQuerierCdc) case QueryNodeStakeByNodeAddr: @@ -86,11 +86,11 @@ func getResourceNodeByNetworkAddr(ctx sdk.Context, req abci.RequestQuery, k Keep return res, nil } -func getIndexingNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { +func getMetaNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var ( params types.QueryNodesParams - nodes []types.IndexingNode + nodes []types.MetaNode ) err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { @@ -100,12 +100,12 @@ func getIndexingNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keepe if params.NetworkAddr.Empty() { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrInvalidNetworkAddr.Error()) } - node, found := k.GetIndexingNode(ctx, params.NetworkAddr) + node, found := k.GetMetaNode(ctx, params.NetworkAddr) if !found { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoIndexingNodeFound.Error()) + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, types.ErrNoMetaNodeFound.Error()) } nodes = append(nodes, node) - res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.NewIndexingNodes(nodes...)) + res, err := codec.MarshalJSONIndent(legacyQuerierCdc, types.NewMetaNodes(nodes...)) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } @@ -115,10 +115,10 @@ func getIndexingNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keepe func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { totalBondedStakeOfResourceNodes := k.GetResourceNodeBondedToken(ctx).Amount - totalBondedStakeOfIndexingNodes := k.GetIndexingNodeBondedToken(ctx).Amount + totalBondedStakeOfMetaNodes := k.GetMetaNodeBondedToken(ctx).Amount totalUnbondedStakeOfResourceNodes := k.GetResourceNodeNotBondedToken(ctx).Amount - totalUnbondedStakeOfIndexingNodes := k.GetIndexingNodeNotBondedToken(ctx).Amount + totalUnbondedStakeOfMetaNodes := k.GetMetaNodeNotBondedToken(ctx).Amount resourceNodeList := k.GetAllResourceNodes(ctx) totalStakeOfResourceNodes := sdk.ZeroInt() @@ -126,19 +126,19 @@ func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legac totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) } - indexingNodeList := k.GetAllIndexingNodes(ctx) - totalStakeOfIndexingNodes := sdk.ZeroInt() - for _, node := range indexingNodeList { - totalStakeOfIndexingNodes = totalStakeOfIndexingNodes.Add(node.Tokens) + metaNodeList := k.GetAllMetaNodes(ctx) + totalStakeOfMetaNodes := sdk.ZeroInt() + for _, node := range metaNodeList { + totalStakeOfMetaNodes = totalStakeOfMetaNodes.Add(node.Tokens) } - totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfIndexingNodes) - totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfIndexingNodes) + totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfMetaNodes) + totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfMetaNodes) totalUnbondingStake := k.GetAllUnbondingNodesTotalBalance(ctx) totalUnbondedStake = totalUnbondedStake.Sub(totalUnbondingStake) res := types.NewQueryNodesStakingInfo( totalStakeOfResourceNodes, - totalStakeOfIndexingNodes, + totalStakeOfMetaNodes, totalBondedStake, totalUnbondedStake, totalUnbondingStake, @@ -167,31 +167,31 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, queryType := params.QueryType if queryType == types.QueryType_All || queryType == types.QueryType_SP { - indexingNode, found := k.GetIndexingNode(ctx, params.AccAddr) + metaNode, found := k.GetMetaNode(ctx, params.AccAddr) if found { - // Adding indexing node staking info - networkAddr, _ := stratos.SdsAddressFromBech32(indexingNode.GetNetworkAddress()) + // Adding meta node staking info + networkAddr, _ := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, - indexingNode.GetStatus(), + metaNode.GetStatus(), networkAddr, - indexingNode.Tokens, + metaNode.Tokens, ) if err != nil { return nil, err } - if !indexingNode.Equal(types.IndexingNode{}) { - stakingInfo = types.NewStakingInfoByIndexingNodeAddr( - indexingNode, + if !metaNode.Equal(types.MetaNode{}) { + stakingInfo = types.NewStakingInfoByMetaNodeAddr( + metaNode, unBondingStake, unBondedStake, bondedStake, ) - bzIndexing, err := codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfo) + bzMeta, err := codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfo) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } - bz = append(bz, bzIndexing...) + bz = append(bz, bzMeta...) } } } @@ -241,9 +241,9 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } resNodes := k.GetResourceNodesFiltered(ctx, params) - indNodes := k.GetIndexingNodesFiltered(ctx, params) + metaNodes := k.GetMetaNodesFiltered(ctx, params) - for _, n := range indNodes { + for _, n := range metaNodes { networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, @@ -254,8 +254,8 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, if err != nil { return nil, err } - if !n.Equal(types.IndexingNode{}) { - stakingInfo = types.NewStakingInfoByIndexingNodeAddr( + if !n.Equal(types.MetaNode{}) { + stakingInfo = types.NewStakingInfoByMetaNodeAddr( n, unBondingStake, unBondedStake, @@ -310,7 +310,7 @@ func (k Keeper) resourceNodesPagination(filteredNodes []types.ResourceNode, para return filteredNodes } -func (k Keeper) indexingNodesPagination(filteredNodes []types.IndexingNode, params types.QueryNodesParams) []types.IndexingNode { +func (k Keeper) metaNodesPagination(filteredNodes []types.MetaNode, params types.QueryNodesParams) []types.MetaNode { start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) if start < 0 || end < 0 { filteredNodes = nil @@ -340,9 +340,9 @@ func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatu return unbondingStake, unbondedStake, bondedStake, nil } -func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.IndexingNode { - nodes := k.GetAllIndexingNodes(ctx) - filteredNodes := make([]types.IndexingNode, 0, len(nodes)) +func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.MetaNode { + nodes := k.GetAllMetaNodes(ctx) + filteredNodes := make([]types.MetaNode, 0, len(nodes)) for _, n := range nodes { // match NetworkAddr (if supplied) diff --git a/x/register/types/codec.go b/x/register/types/codec.go index 726b5ec2..60df4dd2 100644 --- a/x/register/types/codec.go +++ b/x/register/types/codec.go @@ -16,11 +16,11 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(MsgUpdateResourceNode{}, "register/UpdateResourceNodeTx", nil) cdc.RegisterConcrete(MsgUpdateResourceNodeStake{}, "register/UpdateResourceNodeStakeTx", nil) - cdc.RegisterConcrete(MsgCreateIndexingNode{}, "register/CreateIndexingNodeTx", nil) - cdc.RegisterConcrete(MsgRemoveIndexingNode{}, "register/RemoveIndexingNodeTx", nil) - cdc.RegisterConcrete(MsgUpdateIndexingNode{}, "register/UpdateIndexingNodeTx", nil) - cdc.RegisterConcrete(MsgUpdateIndexingNodeStake{}, "register/UpdateIndexingNodeStakeTx", nil) - cdc.RegisterConcrete(MsgIndexingNodeRegistrationVote{}, "register/MsgIndexingNodeRegistrationVote", nil) + cdc.RegisterConcrete(MsgCreateMetaNode{}, "register/CreateMetaNodeTx", nil) + cdc.RegisterConcrete(MsgRemoveMetaNode{}, "register/RemoveMetaNodeTx", nil) + cdc.RegisterConcrete(MsgUpdateMetaNode{}, "register/UpdateMetaNodeTx", nil) + cdc.RegisterConcrete(MsgUpdateMetaNodeStake{}, "register/UpdateMetaNodeStakeTx", nil) + cdc.RegisterConcrete(MsgMetaNodeRegistrationVote{}, "register/MsgMetaNodeRegistrationVote", nil) } // RegisterInterfaces registers the x/register interfaces types with the interface registry @@ -30,11 +30,11 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgRemoveResourceNode{}, &MsgUpdateResourceNode{}, &MsgUpdateResourceNodeStake{}, - &MsgCreateIndexingNode{}, + &MsgCreateMetaNode{}, &MsgRemoveResourceNode{}, - &MsgUpdateIndexingNode{}, - &MsgUpdateIndexingNodeStake{}, - &MsgIndexingNodeRegistrationVote{}, + &MsgUpdateMetaNode{}, + &MsgUpdateMetaNodeStake{}, + &MsgMetaNodeRegistrationVote{}, ) registry.RegisterImplementations( (*authz.Authorization)(nil), diff --git a/x/register/types/errors.go b/x/register/types/errors.go index 2a0ae07a..d5e7b9fa 100644 --- a/x/register/types/errors.go +++ b/x/register/types/errors.go @@ -12,12 +12,12 @@ const ( codeErrEmptyDescription codeErrEmptyMoniker codeErrEmptyResourceNodeAddr - codeErrEmptyIndexingNodeAddr + codeErrEmptyMetaNodeAddr codeErrBadDenom codeErrResourceNodePubKeyExists - codeErrIndexingNodePubKeyExists + codeErrMetaNodePubKeyExists codeErrNoResourceNodeFound - codeErrNoIndexingNodeFound + codeErrNoMetaNodeFound codeErrNoOwnerAccountFound codeErrInsufficientBalance codeErrNodeType @@ -62,12 +62,12 @@ var ( ErrEmptyDescription = sdkerrors.Register(ModuleName, codeErrEmptyDescription, "description must be not empty") ErrEmptyMoniker = sdkerrors.Register(ModuleName, codeErrEmptyMoniker, "moniker must be not empty") ErrEmptyResourceNodeAddr = sdkerrors.Register(ModuleName, codeErrEmptyResourceNodeAddr, "missing resource node address") - ErrEmptyIndexingNodeAddr = sdkerrors.Register(ModuleName, codeErrEmptyIndexingNodeAddr, "missing indexing node address") + ErrEmptyMetaNodeAddr = sdkerrors.Register(ModuleName, codeErrEmptyMetaNodeAddr, "missing Meta node address") ErrBadDenom = sdkerrors.Register(ModuleName, codeErrBadDenom, "invalid coin denomination") ErrResourceNodePubKeyExists = sdkerrors.Register(ModuleName, codeErrResourceNodePubKeyExists, "resource node already exist for this pubkey; must use new resource node pubkey") - ErrIndexingNodePubKeyExists = sdkerrors.Register(ModuleName, codeErrIndexingNodePubKeyExists, "indexing node already exist for this pubkey; must use new indexing node pubkey") + ErrMetaNodePubKeyExists = sdkerrors.Register(ModuleName, codeErrMetaNodePubKeyExists, "meta node already exist for this pubkey; must use new meta node pubkey") ErrNoResourceNodeFound = sdkerrors.Register(ModuleName, codeErrNoResourceNodeFound, "resource node does not exist") - ErrNoIndexingNodeFound = sdkerrors.Register(ModuleName, codeErrNoIndexingNodeFound, "indexing node does not exist") + ErrNoMetaNodeFound = sdkerrors.Register(ModuleName, codeErrNoMetaNodeFound, "meta node does not exist") ErrNoOwnerAccountFound = sdkerrors.Register(ModuleName, codeErrNoOwnerAccountFound, "account of owner does not exist") ErrInsufficientBalance = sdkerrors.Register(ModuleName, codeErrInsufficientBalance, "insufficient balance") ErrNodeType = sdkerrors.Register(ModuleName, codeErrNodeType, "node type(s) not supported") diff --git a/x/register/types/events.go b/x/register/types/events.go index e9e07aa5..5cdc7957 100644 --- a/x/register/types/events.go +++ b/x/register/types/events.go @@ -2,29 +2,29 @@ package types const ( EventTypeCompleteUnbondingResourceNode = "complete_unbonding_resource_node" - EventTypeCompleteUnbondingIndexingNode = "complete_unbonding_indexing_node" + EventTypeCompleteUnbondingMetaNode = "complete_unbonding_meta_node" EventTypeUnbondNode = "unbond_node" - EventTypeCreateResourceNode = "create_resource_node" - EventTypeRemoveResourceNode = "remove_resource_node" - EventTypeUnbondingResourceNode = "unbonding_resource_node" - EventTypeUpdateResourceNode = "update_resource_node" - EventTypeUpdateResourceNodeStake = "update_resource_node_stake" - EventTypeCreateIndexingNode = "create_indexing_node" - EventTypeRemoveIndexingNode = "remove_indexing_node" - EventTypeUnbondingIndexingNode = "unbonding_indexing_node" - EventTypeUpdateIndexingNode = "update_indexing_node" - EventTypeUpdateIndexingNodeStake = "update_indexing_node_stake" - EventTypeIndexingNodeRegistrationVote = "indexing_node_reg_vote" + EventTypeCreateResourceNode = "create_resource_node" + EventTypeRemoveResourceNode = "remove_resource_node" + EventTypeUnbondingResourceNode = "unbonding_resource_node" + EventTypeUpdateResourceNode = "update_resource_node" + EventTypeUpdateResourceNodeStake = "update_resource_node_stake" + EventTypeCreateMetaNode = "create_meta_node" + EventTypeRemoveMetaNode = "remove_meta_node" + EventTypeUnbondingMetaNode = "unbonding_Meta_node" + EventTypeUpdateMetaNode = "update_meta_node" + EventTypeUpdateMetaNodeStake = "update_meta_node_stake" + EventTypeMetaNodeRegistrationVote = "meta_node_reg_vote" AttributeKeyResourceNode = "resource_node" - AttributeKeyIndexingNode = "indexing_node" + AttributeKeyMetaNode = "meta_node" AttributeKeyNetworkAddress = "network_address" AttributeKeyPubKey = "pub_key" AttributeKeyCandidateNetworkAddress = "candidate_network_address" AttributeKeyVoterNetworkAddress = "voter_network_address" AttributeKeyCandidateStatus = "candidate_status" - AttributeKeyIsIndexingNode = "is_indexing_node" + AttributeKeyIsMetaNode = "is_meta_node" AttributeKeyUnbondingMatureTime = "unbonding_mature_time" diff --git a/x/register/types/expected_keepers.go b/x/register/types/expected_keepers.go index fdef30f1..df7a5f4b 100644 --- a/x/register/types/expected_keepers.go +++ b/x/register/types/expected_keepers.go @@ -59,15 +59,15 @@ type BankKeeper interface { // RegisterHooks event hooks for registered node object (noalias) type RegisterHooks interface { - AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) // Must be called when a node is created - BeforeNodeModified(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) // Must be called when a node's state changes - AfterNodeRemoved(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) // Must be called when a node is deleted + AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) // Must be called when a node is created + BeforeNodeModified(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) // Must be called when a node's state changes + AfterNodeRemoved(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) // Must be called when a node is deleted - AfterNodeBonded(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) // Must be called when a node is bonded - AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) // Must be called when a node begins unbonding + AfterNodeBonded(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) // Must be called when a node is bonded + AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) // Must be called when a node begins unbonding - //BeforeNodeCreated(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) // Must be called when a node is created - //BeforeNodeModified(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) // Must be called when a node's shares are modified - //BeforeNodeRemoved(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) // Must be called when a node is removed - //AfterNodeModified(ctx sdk.Context, networkAddr sdk.AccAddress, isIndexingNode bool) + //BeforeNodeCreated(ctx sdk.Context, networkAddr sdk.AccAddress, isMetaNode bool) // Must be called when a node is created + //BeforeNodeModified(ctx sdk.Context, networkAddr sdk.AccAddress, isMetaNode bool) // Must be called when a node's shares are modified + //BeforeNodeRemoved(ctx sdk.Context, networkAddr sdk.AccAddress, isMetaNode bool) // Must be called when a node is removed + //AfterNodeModified(ctx sdk.Context, networkAddr sdk.AccAddress, isMetaNode bool) } diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index 3328384e..e564adc7 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -12,7 +12,7 @@ import ( // NewGenesisState creates a new GenesisState object func NewGenesisState(params *Params, resourceNodes ResourceNodes, - indexingNodes IndexingNodes, + metaNodes MetaNodes, initialUOzonePrice sdk.Dec, totalUnissuedPrepay sdk.Int, slashingInfo []*Slashing, @@ -20,7 +20,7 @@ func NewGenesisState(params *Params, return GenesisState{ Params: params, ResourceNodes: resourceNodes, - IndexingNodes: indexingNodes, + MetaNodes: metaNodes, InitialUozPrice: initialUOzonePrice, TotalUnissuedPrepay: totalUnissuedPrepay, Slashing: slashingInfo, @@ -32,7 +32,7 @@ func DefaultGenesisState() *GenesisState { return &GenesisState{ Params: DefaultParams(), ResourceNodes: ResourceNodes{}, - IndexingNodes: IndexingNodes{}, + MetaNodes: MetaNodes{}, InitialUozPrice: DefaultUozPrice, TotalUnissuedPrepay: DefaultTotalUnissuedPrepay, Slashing: make([]*Slashing, 0), @@ -58,7 +58,7 @@ func ValidateGenesis(data GenesisState) error { if err := data.GetResourceNodes().Validate(); err != nil { return err } - if err := data.GetIndexingNodes().Validate(); err != nil { + if err := data.GetMetaNodes().Validate(); err != nil { return err } @@ -72,18 +72,18 @@ func ValidateGenesis(data GenesisState) error { return nil } -func (v GenesisIndexingNode) ToIndexingNode() (IndexingNode, error) { +func (v GenesisMetaNode) ToMetaNode() (MetaNode, error) { ownerAddress, err := sdk.AccAddressFromBech32(v.OwnerAddress) if err != nil { - return IndexingNode{}, ErrInvalidOwnerAddr + return MetaNode{}, ErrInvalidOwnerAddr } netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddress()) if err != nil { - return IndexingNode{}, ErrInvalidNetworkAddr + return MetaNode{}, ErrInvalidNetworkAddr } - return IndexingNode{ + return MetaNode{ NetworkAddress: netAddr.String(), Pubkey: v.GetPubkey(), Suspend: v.GetSuspend(), @@ -103,8 +103,8 @@ func NewSlashing(walletAddress sdk.AccAddress, value sdk.Int) *Slashing { // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (g GenesisState) UnpackInterfaces(c codectypes.AnyUnpacker) error { - for i := range g.IndexingNodes { - if err := g.IndexingNodes[i].UnpackInterfaces(c); err != nil { + for i := range g.MetaNodes { + if err := g.MetaNodes[i].UnpackInterfaces(c); err != nil { return err } } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go index 5d7886bc..8a52039b 100644 --- a/x/register/types/genesis.pb.go +++ b/x/register/types/genesis.pb.go @@ -31,7 +31,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` ResourceNodes ResourceNodes `protobuf:"bytes,2,rep,name=resource_nodes,json=resourceNodes,proto3,castrepeated=ResourceNodes" json:"resource_nodes" yaml:"resource_nodes"` - IndexingNodes IndexingNodes `protobuf:"bytes,3,rep,name=indexing_nodes,json=indexingNodes,proto3,castrepeated=IndexingNodes" json:"indexing_nodes" yaml:"indexing_nodes"` + MetaNodes MetaNodes `protobuf:"bytes,3,rep,name=meta_nodes,json=metaNodes,proto3,castrepeated=MetaNodes" json:"meta_nodes" yaml:"meta_nodes"` InitialUozPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=initial_uoz_price,json=initialUozPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initial_uoz_price" yaml:"initial_uoz_price"` TotalUnissuedPrepay github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=total_unissued_prepay,json=totalUnissuedPrepay,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_unissued_prepay" yaml:"total_unissued_prepay"` Slashing []*Slashing `protobuf:"bytes,6,rep,name=slashing,proto3" json:"slashing,omitempty" yaml:"slashing_info"` @@ -84,9 +84,9 @@ func (m *GenesisState) GetResourceNodes() ResourceNodes { return nil } -func (m *GenesisState) GetIndexingNodes() IndexingNodes { +func (m *GenesisState) GetMetaNodes() MetaNodes { if m != nil { - return m.IndexingNodes + return m.MetaNodes } return nil } @@ -98,7 +98,7 @@ func (m *GenesisState) GetSlashing() []*Slashing { return nil } -type GenesisIndexingNode struct { +type GenesisMetaNode struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address,omitempty" yaml:"network_address"` Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty" yaml:"pubkey"` Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend,omitempty" yaml:"suspend"` @@ -108,18 +108,18 @@ type GenesisIndexingNode struct { Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty" yaml:"description",omitempty` } -func (m *GenesisIndexingNode) Reset() { *m = GenesisIndexingNode{} } -func (m *GenesisIndexingNode) String() string { return proto.CompactTextString(m) } -func (*GenesisIndexingNode) ProtoMessage() {} -func (*GenesisIndexingNode) Descriptor() ([]byte, []int) { +func (m *GenesisMetaNode) Reset() { *m = GenesisMetaNode{} } +func (m *GenesisMetaNode) String() string { return proto.CompactTextString(m) } +func (*GenesisMetaNode) ProtoMessage() {} +func (*GenesisMetaNode) Descriptor() ([]byte, []int) { return fileDescriptor_5bdab54ebea9e48e, []int{1} } -func (m *GenesisIndexingNode) XXX_Unmarshal(b []byte) error { +func (m *GenesisMetaNode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GenesisIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GenesisMetaNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GenesisIndexingNode.Marshal(b, m, deterministic) + return xxx_messageInfo_GenesisMetaNode.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -129,54 +129,54 @@ func (m *GenesisIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *GenesisIndexingNode) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisIndexingNode.Merge(m, src) +func (m *GenesisMetaNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisMetaNode.Merge(m, src) } -func (m *GenesisIndexingNode) XXX_Size() int { +func (m *GenesisMetaNode) XXX_Size() int { return m.Size() } -func (m *GenesisIndexingNode) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisIndexingNode.DiscardUnknown(m) +func (m *GenesisMetaNode) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisMetaNode.DiscardUnknown(m) } -var xxx_messageInfo_GenesisIndexingNode proto.InternalMessageInfo +var xxx_messageInfo_GenesisMetaNode proto.InternalMessageInfo -func (m *GenesisIndexingNode) GetNetworkAddress() string { +func (m *GenesisMetaNode) GetNetworkAddress() string { if m != nil { return m.NetworkAddress } return "" } -func (m *GenesisIndexingNode) GetPubkey() *types.Any { +func (m *GenesisMetaNode) GetPubkey() *types.Any { if m != nil { return m.Pubkey } return nil } -func (m *GenesisIndexingNode) GetSuspend() bool { +func (m *GenesisMetaNode) GetSuspend() bool { if m != nil { return m.Suspend } return false } -func (m *GenesisIndexingNode) GetStatus() types1.BondStatus { +func (m *GenesisMetaNode) GetStatus() types1.BondStatus { if m != nil { return m.Status } return types1.Unspecified } -func (m *GenesisIndexingNode) GetOwnerAddress() string { +func (m *GenesisMetaNode) GetOwnerAddress() string { if m != nil { return m.OwnerAddress } return "" } -func (m *GenesisIndexingNode) GetDescription() *Description { +func (m *GenesisMetaNode) GetDescription() *Description { if m != nil { return m.Description } @@ -185,60 +185,60 @@ func (m *GenesisIndexingNode) GetDescription() *Description { func init() { proto.RegisterType((*GenesisState)(nil), "stratos.register.v1.GenesisState") - proto.RegisterType((*GenesisIndexingNode)(nil), "stratos.register.v1.GenesisIndexingNode") + proto.RegisterType((*GenesisMetaNode)(nil), "stratos.register.v1.GenesisMetaNode") } func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } var fileDescriptor_5bdab54ebea9e48e = []byte{ - // 750 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x4e, 0xdb, 0x48, - 0x14, 0x8e, 0xf9, 0x09, 0x60, 0x48, 0x10, 0x26, 0xac, 0x0c, 0xbb, 0x1b, 0x87, 0xd1, 0x6a, 0x95, - 0x95, 0xc0, 0x56, 0xd8, 0xbd, 0x5a, 0x69, 0x57, 0xc2, 0x45, 0xad, 0x68, 0x55, 0x14, 0x39, 0xa2, - 0x95, 0x7a, 0x13, 0x39, 0xf6, 0x60, 0x46, 0x49, 0x66, 0xac, 0x99, 0x71, 0xc0, 0x5c, 0xf6, 0x09, - 0xfa, 0x00, 0x7d, 0x82, 0x4a, 0xbd, 0xeb, 0x43, 0xa0, 0x5e, 0x71, 0x59, 0xf5, 0xc2, 0xad, 0xe0, - 0x0d, 0xf2, 0x04, 0x55, 0x66, 0xc6, 0x60, 0x50, 0x54, 0x89, 0x2b, 0xcf, 0x39, 0xf3, 0x9d, 0xef, - 0x3b, 0x73, 0x7e, 0xac, 0x6f, 0x33, 0x4e, 0x7d, 0x4e, 0x98, 0x43, 0x61, 0x84, 0x18, 0x87, 0xd4, - 0x19, 0xb5, 0x9c, 0x08, 0x62, 0xc8, 0x10, 0xb3, 0x63, 0x4a, 0x38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xce, 0x6d, 0xdc, 0x0d, - 0x63, 0x21, 0x1c, 0xec, 0x90, 0x21, 0xe2, 0x70, 0x18, 0xf3, 0xd4, 0x2b, 0xd2, 0xba, 0x47, 0x97, - 0xd7, 0x75, 0xed, 0xea, 0xba, 0xae, 0x7d, 0xbf, 0xae, 0x6b, 0xef, 0x6e, 0xea, 0xa5, 0xab, 0x9b, - 0x7a, 0xe9, 0xcb, 0x4d, 0xbd, 0xf4, 0xe6, 0x9f, 0xc2, 0xf3, 0x95, 0x28, 0x86, 0x3c, 0x3f, 0xee, - 0x06, 0xa7, 0x3e, 0xc2, 0xce, 0xf9, 0xdd, 0xaf, 0x52, 0x14, 0xa4, 0x57, 0x16, 0xa3, 0xf0, 0xf7, - 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x72, 0x89, 0x37, 0xe3, 0xf5, 0x05, 0x00, 0x00, + // 751 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x4e, 0xeb, 0x46, + 0x14, 0x8e, 0xf9, 0x09, 0x64, 0x20, 0x41, 0x98, 0x50, 0x19, 0xda, 0xc6, 0x61, 0x54, 0xa1, 0x54, + 0x02, 0x5b, 0xa1, 0x5d, 0x55, 0x6a, 0x25, 0x5c, 0xd4, 0xaa, 0xad, 0x40, 0x91, 0x23, 0x5a, 0xa9, + 0x9b, 0x68, 0x62, 0x0f, 0xc6, 0x4a, 0x3c, 0x63, 0x79, 0xc6, 0x01, 0xb3, 0xec, 0xaa, 0xcb, 0xbe, + 0x46, 0xbb, 0xee, 0x43, 0xa0, 0xae, 0x58, 0x56, 0x5d, 0xb8, 0x57, 0xf0, 0x06, 0x79, 0x82, 0xab, + 0xcc, 0x8c, 0x89, 0xb9, 0x37, 0xba, 0x12, 0x2b, 0xcf, 0x39, 0xe7, 0x3b, 0xdf, 0x37, 0x73, 0x7e, + 0x0c, 0x0e, 0x18, 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 0x5d, 0x14, 0xdb, 0x07, 0x1b, 0x3e, 0x66, 0x5e, 0x12, + 0xc6, 0x3c, 0xa4, 0xc4, 0x58, 0x13, 0x15, 0x6f, 0x2f, 0x9c, 0x8e, 0xb3, 0x39, 0xce, 0x69, 0xcf, + 0x07, 0xb1, 0x94, 0x0e, 0x8f, 0x68, 0x14, 0x72, 0x1c, 0xc5, 0x3c, 0x73, 0xcb, 0xb4, 0xce, 0xc5, + 0xfd, 0x63, 0x4b, 0x7b, 0x78, 0x6c, 0x69, 0x6f, 0x1e, 0x5b, 0xda, 0x1f, 0x4f, 0xad, 0xca, 0xc3, + 0x53, 0xab, 0xf2, 0xef, 0x53, 0xab, 0xf2, 0xeb, 0x97, 0xa5, 0xe7, 0x2b, 0x51, 0x82, 0x79, 0x71, + 0x3c, 0xf6, 0xae, 0x51, 0x48, 0xec, 0xdb, 0xf9, 0x2f, 0x51, 0x14, 0x64, 0x58, 0x15, 0xa3, 0xf0, + 0xc5, 0xdb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xd5, 0x28, 0x12, 0xdd, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -295,10 +295,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x22 - if len(m.IndexingNodes) > 0 { - for iNdEx := len(m.IndexingNodes) - 1; iNdEx >= 0; iNdEx-- { + if len(m.MetaNodes) > 0 { + for iNdEx := len(m.MetaNodes) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.IndexingNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MetaNodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -338,7 +338,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GenesisIndexingNode) Marshal() (dAtA []byte, err error) { +func (m *GenesisMetaNode) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -348,12 +348,12 @@ func (m *GenesisIndexingNode) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GenesisIndexingNode) MarshalTo(dAtA []byte) (int, error) { +func (m *GenesisMetaNode) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GenesisIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GenesisMetaNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -451,8 +451,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.IndexingNodes) > 0 { - for _, e := range m.IndexingNodes { + if len(m.MetaNodes) > 0 { + for _, e := range m.MetaNodes { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -470,7 +470,7 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *GenesisIndexingNode) Size() (n int) { +func (m *GenesisMetaNode) Size() (n int) { if m == nil { return 0 } @@ -610,7 +610,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaNodes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -637,8 +637,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.IndexingNodes = append(m.IndexingNodes, IndexingNode{}) - if err := m.IndexingNodes[len(m.IndexingNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.MetaNodes = append(m.MetaNodes, MetaNode{}) + if err := m.MetaNodes[len(m.MetaNodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -765,7 +765,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { +func (m *GenesisMetaNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -788,10 +788,10 @@ func (m *GenesisIndexingNode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GenesisIndexingNode: wiretype end group for non-group") + return fmt.Errorf("proto: GenesisMetaNode: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisIndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GenesisMetaNode: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/register/types/hooks.go b/x/register/types/hooks.go index 64bbc59a..711cafd2 100644 --- a/x/register/types/hooks.go +++ b/x/register/types/hooks.go @@ -13,28 +13,28 @@ func NewMultiRegisterHooks(hooks ...RegisterHooks) MultiRegisterHooks { } // nolint -func (h MultiRegisterHooks) AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (h MultiRegisterHooks) AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { for i := range h { - h[i].AfterNodeCreated(ctx, networkAddr, isIndexingNode) + h[i].AfterNodeCreated(ctx, networkAddr, isMetaNode) } } -func (h MultiRegisterHooks) BeforeNodeModified(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (h MultiRegisterHooks) BeforeNodeModified(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { for i := range h { - h[i].BeforeNodeModified(ctx, networkAddr, isIndexingNode) + h[i].BeforeNodeModified(ctx, networkAddr, isMetaNode) } } -func (h MultiRegisterHooks) AfterNodeRemoved(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (h MultiRegisterHooks) AfterNodeRemoved(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { for i := range h { - h[i].AfterNodeRemoved(ctx, networkAddr, isIndexingNode) + h[i].AfterNodeRemoved(ctx, networkAddr, isMetaNode) } } -func (h MultiRegisterHooks) AfterNodeBonded(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (h MultiRegisterHooks) AfterNodeBonded(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { for i := range h { - h[i].AfterNodeBonded(ctx, networkAddr, isIndexingNode) + h[i].AfterNodeBonded(ctx, networkAddr, isMetaNode) } } -func (h MultiRegisterHooks) AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool) { +func (h MultiRegisterHooks) AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress, isMetaNode bool) { for i := range h { - h[i].AfterNodeBeginUnbonding(ctx, networkAddr, isIndexingNode) + h[i].AfterNodeBeginUnbonding(ctx, networkAddr, isMetaNode) } } diff --git a/x/register/types/keys.go b/x/register/types/keys.go index 857aa0f8..6d22b7c9 100644 --- a/x/register/types/keys.go +++ b/x/register/types/keys.go @@ -22,10 +22,10 @@ const ( ResourceNodeBondedPoolName = "resource_node_bonded_pool" // ResourceNodeNotBondedPoolName stores the total balance of not bonded resource nodes ResourceNodeNotBondedPoolName = "resource_node_not_bonded_pool" - // IndexingNodeBondedPoolName stores the total balance of bonded indexing nodes - IndexingNodeBondedPoolName = "indexing_node_bonded_pool" - // IndexingNodeNotBondedPoolName stores the total balance of not bonded indexing nodes - IndexingNodeNotBondedPoolName = "indexing_node_not_bonded_pool" + // MetaNodeBondedPoolName stores the total balance of bonded Meta nodes + MetaNodeBondedPoolName = "meta_node_bonded_pool" + // MetaNodeNotBondedPoolName stores the total balance of not bonded meta nodes + MetaNodeNotBondedPoolName = "meta_node_not_bonded_pool" // TotalUnissuedPrepayName stores the balance of total unissued prepay TotalUnissuedPrepayName = "total_unissued_prepay" // TotalSlashedPoolName stores the balance of total unissued prepay @@ -33,13 +33,13 @@ const ( ) var ( - ResourceNodeKey = []byte{0x01} // prefix for each key to a resource node - IndexingNodeKey = []byte{0x02} // prefix for each key to a indexing node - IndexingNodeRegistrationVotesKey = []byte{0x03} // prefix for each key to the vote for Indexing node registration - UpperBoundOfTotalOzoneKey = []byte{0x04} - SlashingPrefix = []byte{0x05} - InitialGenesisStakeTotalKey = []byte{0x06} // key of initial genesis deposit by all resource nodes and meta nodes at t=0 - InitialUOzonePriceKey = []byte{0x07} // key of initial uoz price at t=0 + ResourceNodeKey = []byte{0x01} // prefix for each key to a resource node + MetaNodeKey = []byte{0x02} // prefix for each key to a meta node + MetaNodeRegistrationVotesKey = []byte{0x03} // prefix for each key to the vote for meta node registration + UpperBoundOfTotalOzoneKey = []byte{0x04} + SlashingPrefix = []byte{0x05} + InitialGenesisStakeTotalKey = []byte{0x06} // key of initial genesis deposit by all resource nodes and meta nodes at t=0 + InitialUOzonePriceKey = []byte{0x07} // key of initial uoz price at t=0 UBDNodeKey = []byte{0x11} // prefix for each key to an unbonding node UBDNodeQueueKey = []byte{0x12} // prefix for the timestamps in unbonding node queue @@ -51,15 +51,15 @@ func GetResourceNodeKey(nodeAddr stratos.SdsAddress) []byte { return append(ResourceNodeKey, nodeAddr.Bytes()...) } -// GetIndexingNodeKey gets the key for the indexingNode with address +// GetMetaNodeKey gets the key for the metaNode with address // VALUE: ResourceNode -func GetIndexingNodeKey(nodeAddr stratos.SdsAddress) []byte { - return append(IndexingNodeKey, nodeAddr.Bytes()...) +func GetMetaNodeKey(nodeAddr stratos.SdsAddress) []byte { + return append(MetaNodeKey, nodeAddr.Bytes()...) } -// GetIndexingNodeRegistrationVotesKey get the key for the vote for Indexing node registration -func GetIndexingNodeRegistrationVotesKey(nodeAddr stratos.SdsAddress) []byte { - return append(IndexingNodeRegistrationVotesKey, nodeAddr.Bytes()...) +// GetMetaNodeRegistrationVotesKey get the key for the vote for Meta node registration +func GetMetaNodeRegistrationVotesKey(nodeAddr stratos.SdsAddress) []byte { + return append(MetaNodeRegistrationVotesKey, nodeAddr.Bytes()...) } // GetURNKey gets the key for the unbonding Node with address diff --git a/x/register/types/indexing_node.go b/x/register/types/meta_node.go similarity index 60% rename from x/register/types/indexing_node.go rename to x/register/types/meta_node.go index ece9a5f6..01452503 100644 --- a/x/register/types/indexing_node.go +++ b/x/register/types/meta_node.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "fmt" "strings" "time" @@ -14,13 +13,13 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -// NewIndexingNode - initialize a new indexing node -func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description *Description, creationTime time.Time) (IndexingNode, error) { +// NewMetaNode - initialize a new meta node +func NewMetaNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description *Description, creationTime time.Time) (MetaNode, error) { pkAny, err := codectypes.NewAnyWithValue(pubKey) if err != nil { - return IndexingNode{}, err + return MetaNode{}, err } - return IndexingNode{ + return MetaNode{ NetworkAddress: networkAddr.String(), Pubkey: pkAny, Suspend: true, @@ -32,8 +31,8 @@ func NewIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, }, nil } -// ConvertToString returns a human-readable string representation of an indexing node. -func (v IndexingNode) ConvertToString() string { +// ConvertToString returns a human-readable string representation of an meta node. +func (v MetaNode) ConvertToString() string { pkAny, err := codectypes.NewAnyWithValue(v.GetPubkey()) if err != nil { return ErrUnknownPubKey.Error() @@ -42,7 +41,7 @@ func (v IndexingNode) ConvertToString() string { if err != nil { return ErrUnknownPubKey.Error() } - return fmt.Sprintf(`IndexingNode:{ + return fmt.Sprintf(`MetaNode:{ Network Id: %s Pubkey: %s Suspend: %v @@ -55,14 +54,14 @@ func (v IndexingNode) ConvertToString() string { v.Tokens, v.GetOwnerAddress(), v.GetDescription(), v.GetCreationTime()) } -// AddToken adds tokens to a indexing node -func (v IndexingNode) AddToken(amount sdk.Int) IndexingNode { +// AddToken adds tokens to a meta node +func (v MetaNode) AddToken(amount sdk.Int) MetaNode { v.Tokens = v.Tokens.Add(amount) return v } -// SubToken removes tokens from a indexing node -func (v IndexingNode) SubToken(amount sdk.Int) IndexingNode { +// SubToken removes tokens from a meta node +func (v MetaNode) SubToken(amount sdk.Int) MetaNode { if amount.IsNegative() { panic(fmt.Sprintf("should not happen: trying to remove negative tokens %v", amount)) } @@ -73,7 +72,7 @@ func (v IndexingNode) SubToken(amount sdk.Int) IndexingNode { return v } -func (v IndexingNode) Validate() error { +func (v MetaNode) Validate() error { netAddr, err := stratos.SdsAddressFromBech32(v.GetNetworkAddress()) if err != nil { return err @@ -116,58 +115,58 @@ func (v IndexingNode) Validate() error { } // IsBonded checks if the node status equals Bonded -func (v IndexingNode) IsBonded() bool { +func (v MetaNode) IsBonded() bool { return v.GetStatus() == stakingtypes.Bonded } // IsUnBonded checks if the node status equals Unbonded -func (v IndexingNode) IsUnBonded() bool { +func (v MetaNode) IsUnBonded() bool { return v.GetStatus() == stakingtypes.Unbonded } // IsUnBonding checks if the node status equals Unbonding -func (v IndexingNode) IsUnBonding() bool { +func (v MetaNode) IsUnBonding() bool { return v.GetStatus() == stakingtypes.Unbonding } -// MustMarshalIndexingNode returns the indexingNode bytes. Panics if fails -func MustMarshalIndexingNode(cdc codec.Codec, indexingNode IndexingNode) []byte { - return cdc.MustMarshal(&indexingNode) +// MustMarshalMetaNode returns the metaNode bytes. Panics if fails +func MustMarshalMetaNode(cdc codec.Codec, metaNode MetaNode) []byte { + return cdc.MustMarshal(&metaNode) } -// MustUnmarshalIndexingNode unmarshal an indexing node from a store value. Panics if fails -func MustUnmarshalIndexingNode(cdc codec.Codec, value []byte) IndexingNode { - indexingNode, err := UnmarshalIndexingNode(cdc, value) +// MustUnmarshalMetaNode unmarshal an meta node from a store value. Panics if fails +func MustUnmarshalMetaNode(cdc codec.Codec, value []byte) MetaNode { + metaNode, err := UnmarshalMetaNode(cdc, value) if err != nil { panic(err) } - return indexingNode + return metaNode } -// UnmarshalIndexingNode unmarshal an indexing node from a store value -func UnmarshalIndexingNode(cdc codec.Codec, value []byte) (indexingNode IndexingNode, err error) { - err = cdc.Unmarshal(value, &indexingNode) - return indexingNode, err +// UnmarshalMetaNode unmarshal an meta node from a store value +func UnmarshalMetaNode(cdc codec.Codec, value []byte) (metaNode MetaNode, err error) { + err = cdc.Unmarshal(value, &metaNode) + return metaNode, err } -//IndexingNodes is a collection of indexing node -type IndexingNodes []IndexingNode +//MetaNodes is a collection of meta node +type MetaNodes []MetaNode -func NewIndexingNodes(indexingNodes ...IndexingNode) IndexingNodes { - if len(indexingNodes) == 0 { - return IndexingNodes{} +func NewMetaNodes(metaNodes ...MetaNode) MetaNodes { + if len(metaNodes) == 0 { + return MetaNodes{} } - return indexingNodes + return metaNodes } -func (v IndexingNodes) String() (out string) { +func (v MetaNodes) String() (out string) { for _, node := range v { out += node.String() + "\n" } return strings.TrimSpace(out) } -func (v IndexingNodes) Validate() error { +func (v MetaNodes) Validate() error { for _, node := range v { if err := node.Validate(); err != nil { return err @@ -207,7 +206,7 @@ func (v VoteOpinion) String() string { } } -func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []stratos.SdsAddress, rejectList []stratos.SdsAddress, expireTime time.Time) IndexingNodeRegistrationVotePool { +func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []stratos.SdsAddress, rejectList []stratos.SdsAddress, expireTime time.Time) MetaNodeRegistrationVotePool { approveSlice := make([]string, len(approveList)) rejectSlice := make([]string, len(rejectList)) for _, approval := range approveList { @@ -216,7 +215,7 @@ func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []strat for _, reject := range rejectList { rejectSlice = append(rejectSlice, reject.String()) } - return IndexingNodeRegistrationVotePool{ + return MetaNodeRegistrationVotePool{ NetworkAddress: nodeAddress.String(), ApproveList: approveSlice, RejectList: rejectSlice, @@ -224,34 +223,34 @@ func NewRegistrationVotePool(nodeAddress stratos.SdsAddress, approveList []strat } } -// MustMarshalIndexingNodeRegistrationVotePool returns the indexingNode bytes. Panics if fails -func MustMarshalIndexingNodeRegistrationVotePool(cdc codec.Codec, votePool IndexingNodeRegistrationVotePool) []byte { +// MustMarshalMetaNodeRegistrationVotePool returns the MetaNode bytes. Panics if fails +func MustMarshalMetaNodeRegistrationVotePool(cdc codec.Codec, votePool MetaNodeRegistrationVotePool) []byte { return cdc.MustMarshal(&votePool) } -// MustUnmarshalIndexingNodeRegistrationVotePool unmarshal an indexing node from a store value. Panics if fails -func MustUnmarshalIndexingNodeRegistrationVotePool(cdc codec.Codec, value []byte) IndexingNodeRegistrationVotePool { - votePool, err := UnmarshalIndexingNodeRegistrationVotePool(cdc, value) +// MustUnmarshalMetaNodeRegistrationVotePool unmarshal an meta node from a store value. Panics if fails +func MustUnmarshalMetaNodeRegistrationVotePool(cdc codec.Codec, value []byte) MetaNodeRegistrationVotePool { + votePool, err := UnmarshalMetaNodeRegistrationVotePool(cdc, value) if err != nil { panic(err) } return votePool } -// UnmarshalIndexingNodeRegistrationVotePool unmarshal an indexing node from a store value -func UnmarshalIndexingNodeRegistrationVotePool(cdc codec.Codec, value []byte) (votePool IndexingNodeRegistrationVotePool, err error) { +// UnmarshalMetaNodeRegistrationVotePool unmarshal an Meta node from a store value +func UnmarshalMetaNodeRegistrationVotePool(cdc codec.Codec, value []byte) (votePool MetaNodeRegistrationVotePool, err error) { err = cdc.Unmarshal(value, &votePool) return votePool, err } -func (v1 IndexingNode) Equal(v2 IndexingNode) bool { - bz1 := ModuleCdc.MustMarshalLengthPrefixed(&v1) - bz2 := ModuleCdc.MustMarshalLengthPrefixed(&v2) - return bytes.Equal(bz1, bz2) -} +//func (v1 MetaNode) Equal(v2 MetaNode) bool { +// bz1 := ModuleCdc.MustMarshalLengthPrefixed(&v1) +// bz2 := ModuleCdc.MustMarshalLengthPrefixed(&v2) +// return bytes.Equal(bz1, bz2) +//} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (v IndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (v MetaNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { var pk cryptotypes.PubKey return unpacker.UnpackAny(v.Pubkey, &pk) } diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 24fb1e33..962fb2b7 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -15,25 +15,25 @@ var ( _ sdk.Msg = &MsgRemoveResourceNode{} _ sdk.Msg = &MsgUpdateResourceNode{} _ sdk.Msg = &MsgUpdateResourceNodeStake{} - _ sdk.Msg = &MsgCreateIndexingNode{} - _ sdk.Msg = &MsgRemoveIndexingNode{} - _ sdk.Msg = &MsgUpdateIndexingNode{} - _ sdk.Msg = &MsgUpdateIndexingNodeStake{} - _ sdk.Msg = &MsgIndexingNodeRegistrationVote{} + _ sdk.Msg = &MsgCreateMetaNode{} + _ sdk.Msg = &MsgRemoveMetaNode{} + _ sdk.Msg = &MsgUpdateMetaNode{} + _ sdk.Msg = &MsgUpdateMetaNodeStake{} + _ sdk.Msg = &MsgMetaNodeRegistrationVote{} ) // message type and route constants const ( // TypeMsgCreateResourceNodeTx defines the type string of an CreateResourceNodeTx transaction - TypeMsgCreateResourceNodeTx = "create_resource_node" - TypeMsgRemoveResourceNodeTx = "remove_resource_node" - TypeUpdateResourceNodeTx = "update_resource_node" - TypeUpdateResourceNodeStakeTx = "update_resource_node_stake" - TypeCreateIndexingNodeTx = "create_indexing_node" - TypeRemoveIndexingNodeTx = "remove_indexing_node" - TypeUpdateIndexingNodeTx = "update_indexing_node" - TypeUpdateIndexingNodeStakeTx = "update_indexing_node_stake" - TypeIndexingNodeRegistrationVoteTx = "indexing_node_registration_vote" + TypeMsgCreateResourceNodeTx = "create_resource_node" + TypeMsgRemoveResourceNodeTx = "remove_resource_node" + TypeUpdateResourceNodeTx = "update_resource_node" + TypeUpdateResourceNodeStakeTx = "update_resource_node_stake" + TypeCreateMetaNodeTx = "create_meta_node" + TypeRemoveMetaNodeTx = "remove_meta_node" + TypeUpdateMetaNodeTx = "update_meta_node" + TypeUpdateMetaNodeStakeTx = "update_meta_node_stake" + TypeMetaNodeRegistrationVoteTx = "meta_node_registration_vote" ) // NewMsgCreateResourceNode NewMsg creates a new Msg instance @@ -128,10 +128,10 @@ func (msg MsgCreateResourceNode) UnpackInterfaces(unpacker codectypes.AnyUnpacke return unpacker.UnpackAny(msg.Pubkey, &pk) } -// NewMsgCreateIndexingNode creates a new Msg instance -func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer +// NewMsgCreateMetaNode creates a new Msg instance +func NewMsgCreateMetaNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, -) (*MsgCreateIndexingNode, error) { +) (*MsgCreateMetaNode, error) { var pkAny *codectypes.Any if pubKey != nil { var err error @@ -142,7 +142,7 @@ func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes return nil, ErrEmptyPubKey } - return &MsgCreateIndexingNode{ + return &MsgCreateMetaNode{ NetworkAddress: networkAddr.String(), Pubkey: pkAny, Value: value, @@ -151,11 +151,11 @@ func NewMsgCreateIndexingNode(networkAddr stratos.SdsAddress, pubKey cryptotypes }, nil } -func (msg MsgCreateIndexingNode) Route() string { return RouterKey } +func (msg MsgCreateMetaNode) Route() string { return RouterKey } -func (msg MsgCreateIndexingNode) Type() string { return TypeCreateIndexingNodeTx } +func (msg MsgCreateMetaNode) Type() string { return TypeCreateMetaNodeTx } -func (msg MsgCreateIndexingNode) ValidateBasic() error { +func (msg MsgCreateMetaNode) ValidateBasic() error { netAddr, err := stratos.SdsAddressFromBech32(msg.GetNetworkAddress()) if err != nil { return err @@ -192,12 +192,12 @@ func (msg MsgCreateIndexingNode) ValidateBasic() error { return nil } -func (msg MsgCreateIndexingNode) GetSignBytes() []byte { +func (msg MsgCreateMetaNode) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } -func (msg MsgCreateIndexingNode) GetSigners() []sdk.AccAddress { +func (msg MsgCreateMetaNode) GetSigners() []sdk.AccAddress { // Owner pays the tx fees addr, err := sdk.AccAddressFromBech32(msg.GetOwnerAddress()) if err != nil { @@ -208,7 +208,7 @@ func (msg MsgCreateIndexingNode) GetSigners() []sdk.AccAddress { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgCreateIndexingNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (msg MsgCreateMetaNode) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { var pk cryptotypes.PubKey return unpacker.UnpackAny(msg.Pubkey, &pk) } @@ -262,22 +262,22 @@ func (msg MsgRemoveResourceNode) ValidateBasic() error { return nil } -// NewMsgRemoveIndexingNode creates a new MsgRemoveIndexingNode instance. -func NewMsgRemoveIndexingNode(indexingNodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) *MsgRemoveIndexingNode { - return &MsgRemoveIndexingNode{ - IndexingNodeAddress: indexingNodeAddr.String(), - OwnerAddress: ownerAddr.String(), +// NewMsgRemoveMetaNode creates a new MsgRemoveMetaNode instance. +func NewMsgRemoveMetaNode(metaNodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) *MsgRemoveMetaNode { + return &MsgRemoveMetaNode{ + MetaNodeAddress: metaNodeAddr.String(), + OwnerAddress: ownerAddr.String(), } } // Route implements the sdk.Msg interface. -func (msg MsgRemoveIndexingNode) Route() string { return RouterKey } +func (msg MsgRemoveMetaNode) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgRemoveIndexingNode) Type() string { return TypeRemoveIndexingNodeTx } +func (msg MsgRemoveMetaNode) Type() string { return TypeRemoveMetaNodeTx } // GetSigners implements the sdk.Msg interface. -func (msg MsgRemoveIndexingNode) GetSigners() []sdk.AccAddress { +func (msg MsgRemoveMetaNode) GetSigners() []sdk.AccAddress { addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) if err != nil { panic(err) @@ -286,19 +286,19 @@ func (msg MsgRemoveIndexingNode) GetSigners() []sdk.AccAddress { } // GetSignBytes implements the sdk.Msg interface. -func (msg MsgRemoveIndexingNode) GetSignBytes() []byte { +func (msg MsgRemoveMetaNode) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. -func (msg MsgRemoveIndexingNode) ValidateBasic() error { - sdsAddress, err := stratos.SdsAddressFromBech32(msg.IndexingNodeAddress) +func (msg MsgRemoveMetaNode) ValidateBasic() error { + sdsAddress, err := stratos.SdsAddressFromBech32(msg.MetaNodeAddress) if err != nil { return err } if sdsAddress.Empty() { - return ErrEmptyIndexingNodeAddr + return ErrEmptyMetaNodeAddr } ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) @@ -430,10 +430,10 @@ func (msg MsgUpdateResourceNodeStake) ValidateBasic() error { return nil } -func NewMsgUpdateIndexingNode(description Description, networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress, -) *MsgUpdateIndexingNode { +func NewMsgUpdateMetaNode(description Description, networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress, +) *MsgUpdateMetaNode { - return &MsgUpdateIndexingNode{ + return &MsgUpdateMetaNode{ Description: description, NetworkAddress: networkAddress.String(), OwnerAddress: ownerAddress.String(), @@ -441,13 +441,13 @@ func NewMsgUpdateIndexingNode(description Description, networkAddress stratos.Sd } // Route implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNode) Route() string { return RouterKey } +func (msg MsgUpdateMetaNode) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNode) Type() string { return TypeUpdateIndexingNodeTx } +func (msg MsgUpdateMetaNode) Type() string { return TypeUpdateMetaNodeTx } // GetSigners implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNode) GetSigners() []sdk.AccAddress { +func (msg MsgUpdateMetaNode) GetSigners() []sdk.AccAddress { addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) if err != nil { panic(err) @@ -456,13 +456,13 @@ func (msg MsgUpdateIndexingNode) GetSigners() []sdk.AccAddress { } // GetSignBytes implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNode) GetSignBytes() []byte { +func (msg MsgUpdateMetaNode) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNode) ValidateBasic() error { +func (msg MsgUpdateMetaNode) ValidateBasic() error { netAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { return err @@ -486,9 +486,9 @@ func (msg MsgUpdateIndexingNode) ValidateBasic() error { return nil } -func NewMsgUpdateIndexingNodeStake(networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress, - stakeDelta *sdk.Coin, incrStake bool) *MsgUpdateIndexingNodeStake { - return &MsgUpdateIndexingNodeStake{ +func NewMsgUpdateMetaNodeStake(networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress, + stakeDelta *sdk.Coin, incrStake bool) *MsgUpdateMetaNodeStake { + return &MsgUpdateMetaNodeStake{ NetworkAddress: networkAddress.String(), OwnerAddress: ownerAddress.String(), StakeDelta: stakeDelta, @@ -497,13 +497,13 @@ func NewMsgUpdateIndexingNodeStake(networkAddress stratos.SdsAddress, ownerAddre } // Route implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNodeStake) Route() string { return RouterKey } +func (msg MsgUpdateMetaNodeStake) Route() string { return RouterKey } // Type implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNodeStake) Type() string { return TypeUpdateIndexingNodeStakeTx } +func (msg MsgUpdateMetaNodeStake) Type() string { return TypeUpdateMetaNodeStakeTx } // GetSigners implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNodeStake) GetSigners() []sdk.AccAddress { +func (msg MsgUpdateMetaNodeStake) GetSigners() []sdk.AccAddress { addr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) if err != nil { panic(err) @@ -512,13 +512,13 @@ func (msg MsgUpdateIndexingNodeStake) GetSigners() []sdk.AccAddress { } // GetSignBytes implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNodeStake) GetSignBytes() []byte { +func (msg MsgUpdateMetaNodeStake) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. -func (msg MsgUpdateIndexingNodeStake) ValidateBasic() error { +func (msg MsgUpdateMetaNodeStake) ValidateBasic() error { netAddr, err := stratos.SdsAddressFromBech32(msg.NetworkAddress) if err != nil { return err @@ -541,10 +541,10 @@ func (msg MsgUpdateIndexingNodeStake) ValidateBasic() error { return nil } -func NewMsgIndexingNodeRegistrationVote(candidateNetworkAddress stratos.SdsAddress, candidateOwnerAddress sdk.AccAddress, opinion bool, - voterNetworkAddress stratos.SdsAddress, voterOwnerAddress sdk.AccAddress) *MsgIndexingNodeRegistrationVote { +func NewMsgMetaNodeRegistrationVote(candidateNetworkAddress stratos.SdsAddress, candidateOwnerAddress sdk.AccAddress, opinion bool, + voterNetworkAddress stratos.SdsAddress, voterOwnerAddress sdk.AccAddress) *MsgMetaNodeRegistrationVote { - return &MsgIndexingNodeRegistrationVote{ + return &MsgMetaNodeRegistrationVote{ CandidateNetworkAddress: candidateNetworkAddress.String(), CandidateOwnerAddress: candidateOwnerAddress.String(), Opinion: opinion, @@ -553,11 +553,11 @@ func NewMsgIndexingNodeRegistrationVote(candidateNetworkAddress stratos.SdsAddre } } -func (mmsg MsgIndexingNodeRegistrationVote) Route() string { return RouterKey } +func (mmsg MsgMetaNodeRegistrationVote) Route() string { return RouterKey } -func (msg MsgIndexingNodeRegistrationVote) Type() string { return TypeIndexingNodeRegistrationVoteTx } +func (msg MsgMetaNodeRegistrationVote) Type() string { return TypeMetaNodeRegistrationVoteTx } -func (msg MsgIndexingNodeRegistrationVote) ValidateBasic() error { +func (msg MsgMetaNodeRegistrationVote) ValidateBasic() error { candidateNetworkAddress, err := stratos.SdsAddressFromBech32(msg.CandidateNetworkAddress) if err != nil { return err @@ -596,12 +596,12 @@ func (msg MsgIndexingNodeRegistrationVote) ValidateBasic() error { return nil } -func (msg MsgIndexingNodeRegistrationVote) GetSignBytes() []byte { +func (msg MsgMetaNodeRegistrationVote) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } -func (msg MsgIndexingNodeRegistrationVote) GetSigners() []sdk.AccAddress { +func (msg MsgMetaNodeRegistrationVote) GetSigners() []sdk.AccAddress { addr, err := sdk.AccAddressFromBech32(msg.VoterOwnerAddress) if err != nil { panic(err) diff --git a/x/register/types/querier.go b/x/register/types/querier.go index b49a9769..050eddbe 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -34,7 +34,7 @@ func NewQueryNodesParams(page, limit int, networkAddr stratos.SdsAddress, monike type QueryNodeStakingParams struct { AccAddr stratos.SdsAddress - QueryType int64 //0:All(Default) 1: indexingNode; 2: ResourceNode + QueryType int64 //0:All(Default) 1: metaNode; 2: ResourceNode } // NewQueryNodeStakingParams creates a new instance of QueryNodesParams @@ -46,16 +46,16 @@ func NewQueryNodeStakingParams(nodeAddr stratos.SdsAddress, queryType int64) Que } // NewQueryNodesStakingInfo creates a new instance of TotalStakesResponse -func NewQueryNodesStakingInfo(ResourceNodeTotalStake, IndexingNodeTotalStake, totalBondedStake, totalUnbondedStake, totalUnbondingStake sdk.Int) *TotalStakesResponse { +func NewQueryNodesStakingInfo(ResourceNodeTotalStake, MetaNodeTotalStake, totalBondedStake, totalUnbondedStake, totalUnbondingStake sdk.Int) *TotalStakesResponse { resValue := sdk.NewCoin(defaultDenom, ResourceNodeTotalStake) - indValue := sdk.NewCoin(defaultDenom, IndexingNodeTotalStake) + metaValue := sdk.NewCoin(defaultDenom, MetaNodeTotalStake) bonedValue := sdk.NewCoin(defaultDenom, totalBondedStake) unBondedValue := sdk.NewCoin(defaultDenom, totalUnbondedStake) unBondingValue := sdk.NewCoin(defaultDenom, totalUnbondingStake) return &TotalStakesResponse{ ResourceNodesTotalStake: &resValue, - IndexingNodesTotalStake: &indValue, + MetaNodesTotalStake: &metaValue, TotalBondedStake: &bonedValue, TotalUnbondedStake: &unBondedValue, TotalUnbondingStake: &unBondingValue, @@ -90,9 +90,9 @@ func NewStakingInfoByResourceNodeAddr( } } -// NewStakingInfoByIndexingNodeAddr creates a new instance of StakingInfoByNodeAddr -func NewStakingInfoByIndexingNodeAddr( - indexingNode IndexingNode, +// NewStakingInfoByMetaNodeAddr creates a new instance of StakingInfoByNodeAddr +func NewStakingInfoByMetaNodeAddr( + metaNode MetaNode, unBondingStake sdk.Int, unBondedStake sdk.Int, bondedStake sdk.Int, @@ -101,15 +101,15 @@ func NewStakingInfoByIndexingNodeAddr( unBondedValue := sdk.NewCoin(defaultDenom, unBondedStake) unBondingValue := sdk.NewCoin(defaultDenom, unBondingStake) return StakingInfo{ - NetworkAddress: indexingNode.GetNetworkAddress(), - Pubkey: indexingNode.GetPubkey(), - Suspend: indexingNode.Suspend, - Status: indexingNode.Status, - Tokens: &indexingNode.Tokens, - OwnerAddress: indexingNode.GetOwnerAddress(), - Description: indexingNode.Description, + NetworkAddress: metaNode.GetNetworkAddress(), + Pubkey: metaNode.GetPubkey(), + Suspend: metaNode.Suspend, + Status: metaNode.Status, + Tokens: &metaNode.Tokens, + OwnerAddress: metaNode.GetOwnerAddress(), + Description: metaNode.Description, NodeType: "metanode", - CreationTime: indexingNode.CreationTime, + CreationTime: metaNode.CreationTime, UnBondingStake: &unBondingValue, UnBondedStake: &unBondedValue, BondedStake: &bonedValue, diff --git a/x/register/types/query.pb.go b/x/register/types/query.pb.go index 2cba149d..9b847307 100644 --- a/x/register/types/query.pb.go +++ b/x/register/types/query.pb.go @@ -121,24 +121,24 @@ func (m *QueryResourceNodeResponse) GetNode() *ResourceNode { return nil } -// QueryIndexingNodeRequest is request type for the Query/IndexingNode RPC method -type QueryIndexingNodeRequest struct { +// QueryMetaNodeRequest is request type for the Query/MetaNode RPC method +type QueryMetaNodeRequest struct { // network_addr defines the node network address to query for. NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` } -func (m *QueryIndexingNodeRequest) Reset() { *m = QueryIndexingNodeRequest{} } -func (m *QueryIndexingNodeRequest) String() string { return proto.CompactTextString(m) } -func (*QueryIndexingNodeRequest) ProtoMessage() {} -func (*QueryIndexingNodeRequest) Descriptor() ([]byte, []int) { +func (m *QueryMetaNodeRequest) Reset() { *m = QueryMetaNodeRequest{} } +func (m *QueryMetaNodeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMetaNodeRequest) ProtoMessage() {} +func (*QueryMetaNodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_59a612d1da8c0670, []int{2} } -func (m *QueryIndexingNodeRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryMetaNodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryIndexingNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMetaNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryIndexingNodeRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMetaNodeRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -148,43 +148,43 @@ func (m *QueryIndexingNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryIndexingNodeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryIndexingNodeRequest.Merge(m, src) +func (m *QueryMetaNodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMetaNodeRequest.Merge(m, src) } -func (m *QueryIndexingNodeRequest) XXX_Size() int { +func (m *QueryMetaNodeRequest) XXX_Size() int { return m.Size() } -func (m *QueryIndexingNodeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryIndexingNodeRequest.DiscardUnknown(m) +func (m *QueryMetaNodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMetaNodeRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryIndexingNodeRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryMetaNodeRequest proto.InternalMessageInfo -func (m *QueryIndexingNodeRequest) GetNetworkAddr() string { +func (m *QueryMetaNodeRequest) GetNetworkAddr() string { if m != nil { return m.NetworkAddr } return "" } -// QueryIndexingNodeResponse is response type for the Query/IndexingNode RPC method -type QueryIndexingNodeResponse struct { - // node defines the the indexing info. - Node *IndexingNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` +// QueryMetaNodeResponse is response type for the Query/MetaNode RPC method +type QueryMetaNodeResponse struct { + // node defines the the meta info. + Node *MetaNode `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` } -func (m *QueryIndexingNodeResponse) Reset() { *m = QueryIndexingNodeResponse{} } -func (m *QueryIndexingNodeResponse) String() string { return proto.CompactTextString(m) } -func (*QueryIndexingNodeResponse) ProtoMessage() {} -func (*QueryIndexingNodeResponse) Descriptor() ([]byte, []int) { +func (m *QueryMetaNodeResponse) Reset() { *m = QueryMetaNodeResponse{} } +func (m *QueryMetaNodeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMetaNodeResponse) ProtoMessage() {} +func (*QueryMetaNodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_59a612d1da8c0670, []int{3} } -func (m *QueryIndexingNodeResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryMetaNodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMetaNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryIndexingNodeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMetaNodeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -194,19 +194,19 @@ func (m *QueryIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryIndexingNodeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryIndexingNodeResponse.Merge(m, src) +func (m *QueryMetaNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMetaNodeResponse.Merge(m, src) } -func (m *QueryIndexingNodeResponse) XXX_Size() int { +func (m *QueryMetaNodeResponse) XXX_Size() int { return m.Size() } -func (m *QueryIndexingNodeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryIndexingNodeResponse.DiscardUnknown(m) +func (m *QueryMetaNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMetaNodeResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryIndexingNodeResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryMetaNodeResponse proto.InternalMessageInfo -func (m *QueryIndexingNodeResponse) GetNode() *IndexingNode { +func (m *QueryMetaNodeResponse) GetNode() *MetaNode { if m != nil { return m.Node } @@ -218,8 +218,6 @@ type QueryStakeByNodeRequest struct { // acc_addr defines the node network address to query for. AccAddr string `protobuf:"bytes,1,opt,name=acc_addr,json=accAddr,proto3" json:"acc_addr,omitempty"` QueryType int64 `protobuf:"varint,2,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryStakeByNodeRequest) Reset() { *m = QueryStakeByNodeRequest{} } @@ -269,19 +267,10 @@ func (m *QueryStakeByNodeRequest) GetQueryType() int64 { return 0 } -func (m *QueryStakeByNodeRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - // QueryStakeByNodeResponse is response type for the Query/StakeByNode RPC method type QueryStakeByNodeResponse struct { // staking_info defines the the staking_info info of the node. StakingInfo *StakingInfo `protobuf:"bytes,1,opt,name=staking_info,json=stakingInfo,proto3" json:"staking_info,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryStakeByNodeResponse) Reset() { *m = QueryStakeByNodeResponse{} } @@ -324,13 +313,6 @@ func (m *QueryStakeByNodeResponse) GetStakingInfo() *StakingInfo { return nil } -func (m *QueryStakeByNodeResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - // QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method type QueryStakeByOwnerRequest struct { // owner_addr defines the owner address to query for. @@ -626,8 +608,8 @@ func (m *QueryParamsResponse) GetParams() *Params { func init() { proto.RegisterType((*QueryResourceNodeRequest)(nil), "stratos.register.v1.QueryResourceNodeRequest") proto.RegisterType((*QueryResourceNodeResponse)(nil), "stratos.register.v1.QueryResourceNodeResponse") - proto.RegisterType((*QueryIndexingNodeRequest)(nil), "stratos.register.v1.QueryIndexingNodeRequest") - proto.RegisterType((*QueryIndexingNodeResponse)(nil), "stratos.register.v1.QueryIndexingNodeResponse") + proto.RegisterType((*QueryMetaNodeRequest)(nil), "stratos.register.v1.QueryMetaNodeRequest") + proto.RegisterType((*QueryMetaNodeResponse)(nil), "stratos.register.v1.QueryMetaNodeResponse") proto.RegisterType((*QueryStakeByNodeRequest)(nil), "stratos.register.v1.QueryStakeByNodeRequest") proto.RegisterType((*QueryStakeByNodeResponse)(nil), "stratos.register.v1.QueryStakeByNodeResponse") proto.RegisterType((*QueryStakeByOwnerRequest)(nil), "stratos.register.v1.QueryStakeByOwnerRequest") @@ -641,58 +623,58 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/query.proto", fileDescriptor_59a612d1da8c0670) } var fileDescriptor_59a612d1da8c0670 = []byte{ - // 805 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f, 0xd3, 0x48, - 0x14, 0xc7, 0x3b, 0x4d, 0xb7, 0xdd, 0x4c, 0xb2, 0x97, 0xe9, 0x6a, 0x37, 0x4d, 0xb7, 0xd9, 0xd4, - 0x95, 0xb6, 0xd9, 0xdd, 0xc6, 0x26, 0x6d, 0x41, 0xa8, 0x12, 0x12, 0x14, 0x01, 0x2a, 0x48, 0xa5, - 0xb8, 0x3d, 0x71, 0x89, 0x26, 0xce, 0xd4, 0xb5, 0xd2, 0xcc, 0xa4, 0x9e, 0x49, 0xdb, 0x28, 0x8a, - 0x84, 0xf8, 0x0b, 0x10, 0x1c, 0x39, 0x23, 0x81, 0xe0, 0x6f, 0xe0, 0xcc, 0x09, 0x55, 0xe2, 0xc2, - 0x11, 0xb5, 0xfc, 0x21, 0xc8, 0xe3, 0x49, 0x63, 0xd3, 0xc9, 0x0f, 0x2a, 0x6e, 0xf1, 0xf8, 0x7d, - 0xdf, 0xfb, 0xbc, 0xf7, 0xc6, 0x5f, 0x05, 0xfe, 0xcd, 0x85, 0x8f, 0x05, 0xe3, 0x96, 0x4f, 0x5c, - 0x8f, 0x0b, 0xe2, 0x5b, 0x87, 0x25, 0xeb, 0xa0, 0x49, 0xfc, 0x96, 0xd9, 0xf0, 0x99, 0x60, 0x68, - 0x5a, 0x05, 0x98, 0xdd, 0x00, 0xf3, 0xb0, 0x94, 0xfd, 0xcb, 0x65, 0xcc, 0xdd, 0x27, 0x16, 0x6e, - 0x78, 0x16, 0xa6, 0x94, 0x09, 0x2c, 0x3c, 0x46, 0x79, 0x28, 0xc9, 0xfe, 0xe7, 0x30, 0x5e, 0x67, - 0xdc, 0xaa, 0x60, 0x4e, 0xc2, 0x5c, 0xd6, 0x61, 0xa9, 0x42, 0x04, 0x2e, 0x59, 0x0d, 0xec, 0x7a, - 0x54, 0x06, 0xab, 0x58, 0x43, 0x57, 0xff, 0xbc, 0x94, 0x8c, 0x31, 0x6e, 0xc0, 0xcc, 0xa3, 0x20, - 0x8b, 0x4d, 0x38, 0x6b, 0xfa, 0x0e, 0xd9, 0x64, 0x55, 0x62, 0x93, 0x83, 0x26, 0xe1, 0x02, 0xcd, - 0xc3, 0x34, 0x25, 0xe2, 0x88, 0xf9, 0xb5, 0x32, 0xae, 0x56, 0xfd, 0x0c, 0xc8, 0x83, 0x42, 0xd2, - 0x4e, 0xa9, 0xb3, 0x5b, 0xd5, 0xaa, 0x6f, 0xd8, 0x70, 0x46, 0x23, 0xe7, 0x0d, 0x46, 0x39, 0x41, - 0x57, 0xe1, 0x04, 0x65, 0x55, 0x22, 0x75, 0xa9, 0xe5, 0x79, 0x53, 0xd3, 0xad, 0x19, 0x13, 0xca, - 0xf0, 0x73, 0xa4, 0x0d, 0x5a, 0x25, 0xc7, 0x1e, 0x75, 0x2f, 0x89, 0x14, 0x97, 0xff, 0x00, 0x52, - 0x4c, 0x18, 0x22, 0xbd, 0x04, 0xf0, 0x4f, 0x99, 0x74, 0x5b, 0xe0, 0x1a, 0x59, 0x6f, 0x45, 0x91, - 0x66, 0xe0, 0xaf, 0xd8, 0x71, 0xa2, 0x38, 0x53, 0xd8, 0x71, 0x02, 0x14, 0x34, 0x07, 0xa1, 0x5c, - 0x51, 0x59, 0xb4, 0x1a, 0x24, 0x33, 0x9e, 0x07, 0x85, 0x84, 0x9d, 0x94, 0x27, 0x3b, 0xad, 0x06, - 0x41, 0x77, 0x21, 0xec, 0xed, 0x2c, 0x93, 0x90, 0x48, 0xff, 0x98, 0xe1, 0x82, 0xcd, 0x60, 0xc1, - 0x66, 0x78, 0x59, 0xd4, 0x82, 0xcd, 0x2d, 0xec, 0x76, 0xab, 0xda, 0x11, 0xa5, 0xf1, 0x1a, 0xa8, - 0x89, 0xc5, 0xe8, 0x54, 0xc7, 0xb7, 0x61, 0x9a, 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 0x56, 0x84, 0xff, 0x4a, 0xc2, 0x05, 0x34, 0xaf, 0x25, 0x8c, 0xfa, 0xcd, 0xfa, 0xe6, - 0x87, 0xd3, 0x1c, 0x38, 0x39, 0xcd, 0x81, 0x2f, 0xa7, 0x39, 0xf0, 0xec, 0x2c, 0x37, 0x76, 0x72, - 0x96, 0x1b, 0xfb, 0x7c, 0x96, 0x1b, 0x7b, 0xbc, 0xea, 0x7a, 0x62, 0xaf, 0x59, 0x31, 0x1d, 0x56, - 0xef, 0xa6, 0xa1, 0x44, 0x74, 0x7f, 0x16, 0x9d, 0x3d, 0xec, 0x51, 0xeb, 0xb8, 0x97, 0x39, 0x58, - 0x06, 0xaf, 0x4c, 0xca, 0x7f, 0x3a, 0x2b, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x6a, 0x60, - 0xb9, 0x8f, 0x09, 0x00, 0x00, + // 803 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x96, 0x41, 0x4f, 0x13, 0x41, + 0x14, 0xc7, 0x19, 0x40, 0xa0, 0xd3, 0x7a, 0x19, 0x50, 0x4b, 0x91, 0x5a, 0x96, 0x44, 0x0a, 0xd2, + 0x5d, 0x0b, 0x68, 0x94, 0xc4, 0x44, 0x31, 0x6a, 0xc4, 0x88, 0xb8, 0x70, 0xf2, 0xd2, 0x4c, 0xb7, + 0x43, 0xd9, 0x94, 0xee, 0x94, 0x9d, 0x29, 0xd8, 0x34, 0x4d, 0x8c, 0x9f, 0xc0, 0xe8, 0xc9, 0x0f, + 0xe0, 0xc1, 0xe8, 0x67, 0xe0, 0xec, 0x91, 0xc4, 0x8b, 0x47, 0x03, 0x7e, 0x10, 0xb3, 0xb3, 0xb3, + 0xec, 0x2e, 0x4c, 0x6d, 0xbd, 0xd1, 0xb7, 0xef, 0xff, 0xde, 0x6f, 0xde, 0xbc, 0xf9, 0x07, 0x78, + 0x83, 0x71, 0x17, 0x73, 0xca, 0x0c, 0x97, 0x54, 0x6d, 0xc6, 0x89, 0x6b, 0x1c, 0x14, 0x8d, 0xfd, + 0x26, 0x71, 0x5b, 0x7a, 0xc3, 0xa5, 0x9c, 0xa2, 0x71, 0x99, 0xa0, 0x07, 0x09, 0xfa, 0x41, 0x31, + 0x73, 0xbd, 0x4a, 0x69, 0x75, 0x8f, 0x18, 0xb8, 0x61, 0x1b, 0xd8, 0x71, 0x28, 0xc7, 0xdc, 0xa6, + 0x0e, 0xf3, 0x25, 0x99, 0x05, 0x8b, 0xb2, 0x3a, 0x65, 0x46, 0x19, 0x33, 0xe2, 0xd7, 0x32, 0x0e, + 0x8a, 0x65, 0xc2, 0x71, 0xd1, 0x68, 0xe0, 0xaa, 0xed, 0x88, 0x64, 0x99, 0xab, 0xa9, 0xfa, 0x9f, + 0xb5, 0x12, 0x39, 0xda, 0x03, 0x98, 0x7e, 0xed, 0x55, 0x31, 0x09, 0xa3, 0x4d, 0xd7, 0x22, 0x1b, + 0xb4, 0x42, 0x4c, 0xb2, 0xdf, 0x24, 0x8c, 0xa3, 0x19, 0x98, 0x72, 0x08, 0x3f, 0xa4, 0x6e, 0xad, + 0x84, 0x2b, 0x15, 0x37, 0x0d, 0x72, 0x20, 0x9f, 0x30, 0x93, 0x32, 0xf6, 0xa8, 0x52, 0x71, 0x35, + 0x13, 0x4e, 0x2a, 0xe4, 0xac, 0x41, 0x1d, 0x46, 0xd0, 0x1d, 0x38, 0xec, 0xd0, 0x0a, 0x11, 0xba, + 0xe4, 0xd2, 0x8c, 0xae, 0x38, 0xad, 0x1e, 0x13, 0x8a, 0x74, 0xed, 0x3e, 0x9c, 0x10, 0x35, 0x5f, + 0x12, 0x8e, 0xff, 0x13, 0x67, 0x1d, 0x5e, 0x39, 0x27, 0x95, 0x28, 0xc5, 0x18, 0xca, 0xb4, 0x12, + 0xe5, 0x4c, 0xe4, 0x63, 0x6c, 0xc1, 0x6b, 0xa2, 0xd6, 0x16, 0xc7, 0x35, 0xb2, 0xd6, 0x8a, 0x92, + 0x4c, 0xc2, 0x31, 0x6c, 0x59, 0x51, 0x8a, 0x51, 0x6c, 0x59, 0x1e, 0x01, 0x9a, 0x86, 0x50, 0xdc, + 0x4a, 0x89, 0xb7, 0x1a, 0x24, 0x3d, 0x98, 0x03, 0xf9, 0x21, 0x33, 0x21, 0x22, 0xdb, 0xad, 0x06, + 0xd1, 0x4a, 0x72, 0xdc, 0xb1, 0xa2, 0x92, 0xf1, 0x31, 0x4c, 0x31, 0x8e, 0x6b, 0xb6, 0x53, 0x2d, + 0xd9, 0xce, 0x0e, 0x95, 0xac, 0x39, 0x25, 0xeb, 0x96, 0x9f, 0xf8, 0xdc, 0xd9, 0xa1, 0x66, 0x92, + 0x85, 0x3f, 0xb4, 0x23, 0x10, 0xef, 0xf0, 0xea, 0xd0, 0x21, 0x6e, 0xff, 0x13, 0x44, 0x69, 0x38, + 0x5a, 0xa7, 0x8e, 0x5d, 0x23, 0xae, 0x80, 0x4f, 0x98, 0xc1, 0x4f, 0xef, 0x64, 0xd4, 0x2b, 0xe6, + 0x4b, 0x87, 0xc4, 0xc7, 0x84, 0x88, 0x08, 0xe1, 0x53, 0x08, 0xc3, 0x05, 0x4c, 0x0f, 0x0b, 0xf6, + 0x9b, 0xba, 0xbf, 0xad, 0xba, 0xb7, 0xad, 0xba, 0xbf, 0xf9, 0x72, 0x5b, 0xf5, 0x4d, 0x5c, 0x0d, + 0xe6, 0x69, 0x46, 0x94, 0xda, 0x37, 0x20, 0x57, 0x2a, 0x7e, 0x00, 0x39, 0xa3, 0x27, 0xf0, 0x72, + 0x74, 0x46, 0x2c, 0x0d, 0x72, 0x43, 0x7d, 0x0d, 0x29, 0x15, 0x19, 0x12, 0x43, 0xcf, 0x62, 0xb0, + 0x83, 0x02, 0x76, 0xae, 0x27, 0xac, 0xcf, 0x10, 0xa3, 0x4d, 0xc3, 0xab, 0x02, 0x76, 0x9b, 0x72, + 0xbc, 0x27, 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0x9f, 0xd9, 0x92, 0xe8, 0xa1, 0x20, 0x5a, 0x45, + 0xf7, 0x94, 0x44, 0xfe, 0x2b, 0x28, 0x79, 0x93, 0x32, 0xda, 0x81, 0xaf, 0x76, 0x8c, 0x76, 0xe8, + 0xa3, 0x1d, 0xf4, 0x05, 0xc0, 0x54, 0xd4, 0x10, 0x50, 0x6f, 0x82, 0xa8, 0xf3, 0xfd, 0x6b, 0xf3, + 0x54, 0x3e, 0xd3, 0xe3, 0x66, 0x25, 0xb1, 0x30, 0x3f, 0xa3, 0x1d, 0xba, 0x62, 0x07, 0x7d, 0x04, + 0x10, 0x8a, 0x82, 0xe2, 0xdd, 0xa2, 0x5b, 0xdd, 0xdb, 0x5e, 0x70, 0x8c, 0xcc, 0x62, 0x7f, 0xc9, + 0x92, 0x70, 0x5e, 0x10, 0xce, 0xa2, 0x19, 0x25, 0x61, 0xd4, 0x5f, 0xd6, 0x36, 0x7e, 0x9c, 0x64, + 0xc1, 0xf1, 0x49, 0x16, 0xfc, 0x3e, 0xc9, 0x82, 0x0f, 0xa7, 0xd9, 0x81, 0xe3, 0xd3, 0xec, 0xc0, + 0xaf, 0xd3, 0xec, 0xc0, 0x9b, 0x95, 0xaa, 0xcd, 0x77, 0x9b, 0x65, 0xdd, 0xa2, 0xf5, 0xa0, 0x8c, + 0x43, 0x78, 0xf0, 0x67, 0xc1, 0xda, 0xc5, 0xb6, 0x63, 0xbc, 0x0d, 0x2b, 0x7b, 0x97, 0xc1, 0xca, + 0x23, 0xe2, 0x5f, 0x87, 0xe5, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xce, 0x7d, 0xd4, 0x4c, 0xe0, + 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -709,8 +691,8 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // ResourceNode queries ResourceNode info for given ResourceNode address. ResourceNode(ctx context.Context, in *QueryResourceNodeRequest, opts ...grpc.CallOption) (*QueryResourceNodeResponse, error) - // IndexingNode queries IndexingNode info for given IndexingNode address. - IndexingNode(ctx context.Context, in *QueryIndexingNodeRequest, opts ...grpc.CallOption) (*QueryIndexingNodeResponse, error) + // MetaNode queries MetaNode info for given MetaNode address. + MetaNode(ctx context.Context, in *QueryMetaNodeRequest, opts ...grpc.CallOption) (*QueryMetaNodeResponse, error) // Params queries Register module Params info. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // StakeByNode queries all staking info for given node network address. @@ -738,9 +720,9 @@ func (c *queryClient) ResourceNode(ctx context.Context, in *QueryResourceNodeReq return out, nil } -func (c *queryClient) IndexingNode(ctx context.Context, in *QueryIndexingNodeRequest, opts ...grpc.CallOption) (*QueryIndexingNodeResponse, error) { - out := new(QueryIndexingNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/IndexingNode", in, out, opts...) +func (c *queryClient) MetaNode(ctx context.Context, in *QueryMetaNodeRequest, opts ...grpc.CallOption) (*QueryMetaNodeResponse, error) { + out := new(QueryMetaNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Query/MetaNode", in, out, opts...) if err != nil { return nil, err } @@ -787,8 +769,8 @@ func (c *queryClient) StakeTotal(ctx context.Context, in *QueryTotalStakeRequest type QueryServer interface { // ResourceNode queries ResourceNode info for given ResourceNode address. ResourceNode(context.Context, *QueryResourceNodeRequest) (*QueryResourceNodeResponse, error) - // IndexingNode queries IndexingNode info for given IndexingNode address. - IndexingNode(context.Context, *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) + // MetaNode queries MetaNode info for given MetaNode address. + MetaNode(context.Context, *QueryMetaNodeRequest) (*QueryMetaNodeResponse, error) // Params queries Register module Params info. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // StakeByNode queries all staking info for given node network address. @@ -806,8 +788,8 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) ResourceNode(ctx context.Context, req *QueryResourceNodeRequest) (*QueryResourceNodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ResourceNode not implemented") } -func (*UnimplementedQueryServer) IndexingNode(ctx context.Context, req *QueryIndexingNodeRequest) (*QueryIndexingNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method IndexingNode not implemented") +func (*UnimplementedQueryServer) MetaNode(ctx context.Context, req *QueryMetaNodeRequest) (*QueryMetaNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MetaNode not implemented") } func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") @@ -844,20 +826,20 @@ func _Query_ResourceNode_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Query_IndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryIndexingNodeRequest) +func _Query_MetaNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMetaNodeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).IndexingNode(ctx, in) + return srv.(QueryServer).MetaNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Query/IndexingNode", + FullMethod: "/stratos.register.v1.Query/MetaNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).IndexingNode(ctx, req.(*QueryIndexingNodeRequest)) + return srv.(QueryServer).MetaNode(ctx, req.(*QueryMetaNodeRequest)) } return interceptor(ctx, in, info, handler) } @@ -943,8 +925,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_ResourceNode_Handler, }, { - MethodName: "IndexingNode", - Handler: _Query_IndexingNode_Handler, + MethodName: "MetaNode", + Handler: _Query_MetaNode_Handler, }, { MethodName: "Params", @@ -1032,7 +1014,7 @@ func (m *QueryResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryIndexingNodeRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryMetaNodeRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1042,12 +1024,12 @@ func (m *QueryIndexingNodeRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryIndexingNodeRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMetaNodeRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryIndexingNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMetaNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1062,7 +1044,7 @@ func (m *QueryIndexingNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryIndexingNodeResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryMetaNodeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1072,12 +1054,12 @@ func (m *QueryIndexingNodeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMetaNodeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMetaNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1117,18 +1099,6 @@ func (m *QueryStakeByNodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = 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] = 0x1a - } if m.QueryType != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.QueryType)) i-- @@ -1164,18 +1134,6 @@ func (m *QueryStakeByNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } if m.StakingInfo != nil { { size, err := m.StakingInfo.MarshalToSizedBuffer(dAtA[:i]) @@ -1449,7 +1407,7 @@ func (m *QueryResourceNodeResponse) Size() (n int) { return n } -func (m *QueryIndexingNodeRequest) Size() (n int) { +func (m *QueryMetaNodeRequest) Size() (n int) { if m == nil { return 0 } @@ -1462,7 +1420,7 @@ func (m *QueryIndexingNodeRequest) Size() (n int) { return n } -func (m *QueryIndexingNodeResponse) Size() (n int) { +func (m *QueryMetaNodeResponse) Size() (n int) { if m == nil { return 0 } @@ -1488,10 +1446,6 @@ func (m *QueryStakeByNodeRequest) Size() (n int) { if m.QueryType != 0 { n += 1 + sovQuery(uint64(m.QueryType)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -1505,10 +1459,6 @@ func (m *QueryStakeByNodeResponse) Size() (n int) { l = m.StakingInfo.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -1774,7 +1724,7 @@ func (m *QueryResourceNodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMetaNodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1797,10 +1747,10 @@ func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryIndexingNodeRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMetaNodeRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryIndexingNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMetaNodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1856,7 +1806,7 @@ func (m *QueryIndexingNodeRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryIndexingNodeResponse) Unmarshal(dAtA []byte) error { +func (m *QueryMetaNodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1879,10 +1829,10 @@ func (m *QueryIndexingNodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryIndexingNodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMetaNodeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryIndexingNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMetaNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1915,7 +1865,7 @@ func (m *QueryIndexingNodeResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Node == nil { - m.Node = &IndexingNode{} + m.Node = &MetaNode{} } if err := m.Node.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2022,42 +1972,6 @@ func (m *QueryStakeByNodeRequest) Unmarshal(dAtA []byte) error { break } } - case 3: - 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:]) @@ -2144,42 +2058,6 @@ func (m *QueryStakeByNodeResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/register/types/query.pb.gw.go b/x/register/types/query.pb.gw.go index bb73b5ea..47b23936 100644 --- a/x/register/types/query.pb.gw.go +++ b/x/register/types/query.pb.gw.go @@ -85,8 +85,8 @@ func local_request_Query_ResourceNode_0(ctx context.Context, marshaler runtime.M } -func request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryIndexingNodeRequest +func request_Query_MetaNode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMetaNodeRequest var metadata runtime.ServerMetadata var ( @@ -107,13 +107,13 @@ func request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.Marshal return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "network_addr", err) } - msg, err := client.IndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.MetaNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryIndexingNodeRequest +func local_request_Query_MetaNode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMetaNodeRequest var metadata runtime.ServerMetadata var ( @@ -134,7 +134,7 @@ func local_request_Query_IndexingNode_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "network_addr", err) } - msg, err := server.IndexingNode(ctx, &protoReq) + msg, err := server.MetaNode(ctx, &protoReq) return msg, metadata, err } @@ -157,10 +157,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -var ( - filter_Query_StakeByNode_0 = &utilities.DoubleArray{Encoding: map[string]int{"acc_addr": 0, "query_type": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} -) - func request_Query_StakeByNode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryStakeByNodeRequest var metadata runtime.ServerMetadata @@ -194,13 +190,6 @@ func request_Query_StakeByNode_0(ctx context.Context, marshaler runtime.Marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_type", 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_StakeByNode_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.StakeByNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -239,13 +228,6 @@ func local_request_Query_StakeByNode_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_type", 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_StakeByNode_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.StakeByNode(ctx, &protoReq) return msg, metadata, err @@ -367,7 +349,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_IndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_MetaNode_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) @@ -376,14 +358,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_IndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_MetaNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_IndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_MetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -528,7 +510,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_IndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_MetaNode_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) @@ -537,14 +519,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_IndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_MetaNode_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_IndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_MetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -634,7 +616,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_ResourceNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "resource-nodes", "network_addr"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_IndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "indexing-nodes", "network_addr"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_MetaNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "register", "v1", "meta-nodes", "network_addr"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) @@ -648,7 +630,7 @@ var ( var ( forward_Query_ResourceNode_0 = runtime.ForwardResponseMessage - forward_Query_IndexingNode_0 = runtime.ForwardResponseMessage + forward_Query_MetaNode_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index 9f62e30a..adcdb3ce 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -203,7 +203,7 @@ func (m *ResourceNode) GetNodeType() string { return "" } -type IndexingNode struct { +type MetaNode struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` Suspend bool `protobuf:"varint,3,opt,name=suspend,proto3" json:"suspend" yaml:"suspend"` @@ -214,18 +214,18 @@ type IndexingNode struct { CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` } -func (m *IndexingNode) Reset() { *m = IndexingNode{} } -func (m *IndexingNode) String() string { return proto.CompactTextString(m) } -func (*IndexingNode) ProtoMessage() {} -func (*IndexingNode) Descriptor() ([]byte, []int) { +func (m *MetaNode) Reset() { *m = MetaNode{} } +func (m *MetaNode) String() string { return proto.CompactTextString(m) } +func (*MetaNode) ProtoMessage() {} +func (*MetaNode) Descriptor() ([]byte, []int) { return fileDescriptor_fef1e3aeec8499d6, []int{2} } -func (m *IndexingNode) XXX_Unmarshal(b []byte) error { +func (m *MetaNode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *IndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MetaNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_IndexingNode.Marshal(b, m, deterministic) + return xxx_messageInfo_MetaNode.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -235,86 +235,86 @@ func (m *IndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *IndexingNode) XXX_Merge(src proto.Message) { - xxx_messageInfo_IndexingNode.Merge(m, src) +func (m *MetaNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetaNode.Merge(m, src) } -func (m *IndexingNode) XXX_Size() int { +func (m *MetaNode) XXX_Size() int { return m.Size() } -func (m *IndexingNode) XXX_DiscardUnknown() { - xxx_messageInfo_IndexingNode.DiscardUnknown(m) +func (m *MetaNode) XXX_DiscardUnknown() { + xxx_messageInfo_MetaNode.DiscardUnknown(m) } -var xxx_messageInfo_IndexingNode proto.InternalMessageInfo +var xxx_messageInfo_MetaNode proto.InternalMessageInfo -func (m *IndexingNode) GetNetworkAddress() string { +func (m *MetaNode) GetNetworkAddress() string { if m != nil { return m.NetworkAddress } return "" } -func (m *IndexingNode) GetPubkey() *types.Any { +func (m *MetaNode) GetPubkey() *types.Any { if m != nil { return m.Pubkey } return nil } -func (m *IndexingNode) GetSuspend() bool { +func (m *MetaNode) GetSuspend() bool { if m != nil { return m.Suspend } return false } -func (m *IndexingNode) GetStatus() types1.BondStatus { +func (m *MetaNode) GetStatus() types1.BondStatus { if m != nil { return m.Status } return types1.Unspecified } -func (m *IndexingNode) GetOwnerAddress() string { +func (m *MetaNode) GetOwnerAddress() string { if m != nil { return m.OwnerAddress } return "" } -func (m *IndexingNode) GetDescription() *Description { +func (m *MetaNode) GetDescription() *Description { if m != nil { return m.Description } return nil } -func (m *IndexingNode) GetCreationTime() time.Time { +func (m *MetaNode) GetCreationTime() time.Time { if m != nil { return m.CreationTime } return time.Time{} } -type IndexingNodeRegistrationVotePool struct { +type MetaNodeRegistrationVotePool struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` ApproveList []string `protobuf:"bytes,2,rep,name=approve_list,json=approveList,proto3" json:"approve_list" yaml:"approve_list"` RejectList []string `protobuf:"bytes,3,rep,name=reject_list,json=rejectList,proto3" json:"reject_list" yaml:"reject_list"` ExpireTime time.Time `protobuf:"bytes,4,opt,name=expire_time,json=expireTime,proto3,stdtime" json:"expire_time" yaml:"expire_time"` } -func (m *IndexingNodeRegistrationVotePool) Reset() { *m = IndexingNodeRegistrationVotePool{} } -func (m *IndexingNodeRegistrationVotePool) String() string { return proto.CompactTextString(m) } -func (*IndexingNodeRegistrationVotePool) ProtoMessage() {} -func (*IndexingNodeRegistrationVotePool) Descriptor() ([]byte, []int) { +func (m *MetaNodeRegistrationVotePool) Reset() { *m = MetaNodeRegistrationVotePool{} } +func (m *MetaNodeRegistrationVotePool) String() string { return proto.CompactTextString(m) } +func (*MetaNodeRegistrationVotePool) ProtoMessage() {} +func (*MetaNodeRegistrationVotePool) Descriptor() ([]byte, []int) { return fileDescriptor_fef1e3aeec8499d6, []int{3} } -func (m *IndexingNodeRegistrationVotePool) XXX_Unmarshal(b []byte) error { +func (m *MetaNodeRegistrationVotePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *IndexingNodeRegistrationVotePool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MetaNodeRegistrationVotePool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_IndexingNodeRegistrationVotePool.Marshal(b, m, deterministic) + return xxx_messageInfo_MetaNodeRegistrationVotePool.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -324,40 +324,40 @@ func (m *IndexingNodeRegistrationVotePool) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *IndexingNodeRegistrationVotePool) XXX_Merge(src proto.Message) { - xxx_messageInfo_IndexingNodeRegistrationVotePool.Merge(m, src) +func (m *MetaNodeRegistrationVotePool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetaNodeRegistrationVotePool.Merge(m, src) } -func (m *IndexingNodeRegistrationVotePool) XXX_Size() int { +func (m *MetaNodeRegistrationVotePool) XXX_Size() int { return m.Size() } -func (m *IndexingNodeRegistrationVotePool) XXX_DiscardUnknown() { - xxx_messageInfo_IndexingNodeRegistrationVotePool.DiscardUnknown(m) +func (m *MetaNodeRegistrationVotePool) XXX_DiscardUnknown() { + xxx_messageInfo_MetaNodeRegistrationVotePool.DiscardUnknown(m) } -var xxx_messageInfo_IndexingNodeRegistrationVotePool proto.InternalMessageInfo +var xxx_messageInfo_MetaNodeRegistrationVotePool proto.InternalMessageInfo -func (m *IndexingNodeRegistrationVotePool) GetNetworkAddress() string { +func (m *MetaNodeRegistrationVotePool) GetNetworkAddress() string { if m != nil { return m.NetworkAddress } return "" } -func (m *IndexingNodeRegistrationVotePool) GetApproveList() []string { +func (m *MetaNodeRegistrationVotePool) GetApproveList() []string { if m != nil { return m.ApproveList } return nil } -func (m *IndexingNodeRegistrationVotePool) GetRejectList() []string { +func (m *MetaNodeRegistrationVotePool) GetRejectList() []string { if m != nil { return m.RejectList } return nil } -func (m *IndexingNodeRegistrationVotePool) GetExpireTime() time.Time { +func (m *MetaNodeRegistrationVotePool) GetExpireTime() time.Time { if m != nil { return m.ExpireTime } @@ -494,7 +494,7 @@ func (m *Slashing) GetValue() int64 { type TotalStakesResponse struct { ResourceNodesTotalStake *types2.Coin `protobuf:"bytes,1,opt,name=resource_nodes_total_stake,json=resourceNodesTotalStake,proto3" json:"resource_nodes_total_stake,omitempty"` - IndexingNodesTotalStake *types2.Coin `protobuf:"bytes,2,opt,name=indexing_nodes_total_stake,json=indexingNodesTotalStake,proto3" json:"indexing_nodes_total_stake,omitempty"` + MetaNodesTotalStake *types2.Coin `protobuf:"bytes,2,opt,name=meta_nodes_total_stake,json=metaNodesTotalStake,proto3" json:"meta_nodes_total_stake,omitempty"` TotalBondedStake *types2.Coin `protobuf:"bytes,3,opt,name=total_bonded_stake,json=totalBondedStake,proto3" json:"total_bonded_stake,omitempty"` TotalUnbondedStake *types2.Coin `protobuf:"bytes,4,opt,name=total_unbonded_stake,json=totalUnbondedStake,proto3" json:"total_unbonded_stake,omitempty"` TotalUnbondingStake *types2.Coin `protobuf:"bytes,5,opt,name=total_unbonding_stake,json=totalUnbondingStake,proto3" json:"total_unbonding_stake,omitempty"` @@ -540,9 +540,9 @@ func (m *TotalStakesResponse) GetResourceNodesTotalStake() *types2.Coin { return nil } -func (m *TotalStakesResponse) GetIndexingNodesTotalStake() *types2.Coin { +func (m *TotalStakesResponse) GetMetaNodesTotalStake() *types2.Coin { if m != nil { - return m.IndexingNodesTotalStake + return m.MetaNodesTotalStake } return nil } @@ -696,9 +696,9 @@ func (m *StakingInfo) GetUnBondedStake() *types2.Coin { // UnbondingNode stores all of a single delegator's unbonding bonds // for a single unbonding node in a time-ordered list type UnbondingNode struct { - NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr" yaml:"network_addr"` - IsIndexingNode bool `protobuf:"varint,2,opt,name=is_indexing_node,json=isIndexingNode,proto3" json:"is_indexing_node" yaml:"is_indexing_node"` - Entries []*UnbondingNodeEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries" yaml:"entries"` + NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr" yaml:"network_addr"` + IsMetaNode bool `protobuf:"varint,2,opt,name=is_meta_node,json=isMetaNode,proto3" json:"is_meta_node" yaml:"is_meta_node"` + Entries []*UnbondingNodeEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries" yaml:"entries"` } func (m *UnbondingNode) Reset() { *m = UnbondingNode{} } @@ -741,9 +741,9 @@ func (m *UnbondingNode) GetNetworkAddr() string { return "" } -func (m *UnbondingNode) GetIsIndexingNode() bool { +func (m *UnbondingNode) GetIsMetaNode() bool { if m != nil { - return m.IsIndexingNode + return m.IsMetaNode } return false } @@ -868,8 +868,8 @@ func (m *Staking) GetOwnerAddress() string { func init() { proto.RegisterType((*Params)(nil), "stratos.register.v1.Params") proto.RegisterType((*ResourceNode)(nil), "stratos.register.v1.ResourceNode") - proto.RegisterType((*IndexingNode)(nil), "stratos.register.v1.IndexingNode") - proto.RegisterType((*IndexingNodeRegistrationVotePool)(nil), "stratos.register.v1.IndexingNodeRegistrationVotePool") + proto.RegisterType((*MetaNode)(nil), "stratos.register.v1.MetaNode") + proto.RegisterType((*MetaNodeRegistrationVotePool)(nil), "stratos.register.v1.MetaNodeRegistrationVotePool") proto.RegisterType((*Description)(nil), "stratos.register.v1.Description") proto.RegisterType((*Slashing)(nil), "stratos.register.v1.Slashing") proto.RegisterType((*TotalStakesResponse)(nil), "stratos.register.v1.TotalStakesResponse") @@ -884,110 +884,240 @@ func init() { } var fileDescriptor_fef1e3aeec8499d6 = []byte{ - // 1610 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1b, 0xb9, - 0x15, 0xb7, 0xa4, 0xf8, 0x8b, 0x92, 0x65, 0x77, 0xec, 0x34, 0xb2, 0xdb, 0x9a, 0x0e, 0xfb, 0x11, - 0x17, 0xa9, 0x25, 0x38, 0x29, 0x50, 0xb4, 0x87, 0x02, 0x99, 0xd8, 0x4d, 0x9d, 0xb4, 0x81,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9, 0xf2, 0x03, 0xcf, 0x17, 0xf4, 0x55, 0x11, 0x6c, - 0x64, 0xcf, 0xbb, 0xa7, 0xd7, 0x63, 0xae, 0xbc, 0x47, 0x4c, 0xe0, 0x7d, 0xc6, 0x3a, 0x1f, 0x2c, - 0x07, 0xee, 0x83, 0x8a, 0xdf, 0xeb, 0x45, 0xec, 0x04, 0x37, 0x3b, 0x84, 0x8b, 0x5a, 0x71, 0xa3, - 0xb4, 0x39, 0xef, 0xde, 0x18, 0x4a, 0x38, 0x86, 0xc7, 0x12, 0x2e, 0x1b, 0xc6, 0x2c, 0x8a, 0xbc, - 0xb2, 0x1d, 0xfe, 0x85, 0x70, 0xe1, 0xfc, 0x09, 0x94, 0x23, 0xfc, 0x0c, 0x07, 0xc2, 0x50, 0x95, - 0x34, 0x95, 0x8e, 0x42, 0x06, 0x4e, 0xa3, 0x90, 0x01, 0x91, 0x07, 0xcc, 0x48, 0xf3, 0x3c, 0x03, - 0x65, 0x7c, 0xd6, 0x23, 0x11, 0x36, 0x21, 0xb8, 0x32, 0x31, 0x04, 0x5b, 0x36, 0x04, 0x59, 0xb3, - 0xd4, 0x4f, 0x06, 0x34, 0xdb, 0x0f, 0x0c, 0xa2, 0x37, 0xff, 0xcb, 0x22, 0x28, 0x67, 0x0e, 0x8d, - 0x4a, 0xd8, 0x2e, 0xa3, 0xe4, 0x18, 0x47, 0x76, 0x7f, 0x75, 0xc2, 0x5a, 0x28, 0x4d, 0x58, 0x0b, - 0x20, 0x2f, 0x11, 0x39, 0xbb, 0x60, 0x8e, 0x84, 0x98, 0x0a, 0x22, 0x4c, 0x39, 0x31, 0xe7, 0x7d, - 0x84, 0xc5, 0x12, 0xae, 0x1a, 0xd3, 0x04, 0xc9, 0xb6, 0x0b, 0x23, 0x35, 0xe7, 0x0e, 0x98, 0x3d, - 0xc5, 0x2d, 0x4e, 0x84, 0x69, 0x87, 0x4c, 0x28, 0x12, 0x28, 0x96, 0xb0, 0x66, 0x48, 0x2c, 0x90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 0x94, 0x88, 0xd0, 0xf3, 0x22, 0x98, 0xb5, 0xb7, 0xed, 0x07, 0xbb, 0x69, 0xcf, - 0xdd, 0x0a, 0xc5, 0x6f, 0x77, 0x2b, 0x3c, 0x49, 0xfa, 0x3f, 0x13, 0x8e, 0x7b, 0xef, 0xf1, 0x57, - 0x77, 0x07, 0x07, 0x93, 0xba, 0x45, 0xf7, 0xe1, 0xcb, 0x37, 0xeb, 0x85, 0xd7, 0x6f, 0xd6, 0x0b, - 0x9f, 0xbd, 0x59, 0x2f, 0x3c, 0x7f, 0xbb, 0x3e, 0xf5, 0xfa, 0xed, 0xfa, 0xd4, 0xc7, 0x6f, 0xd7, - 0xa7, 0xfe, 0xf1, 0xdb, 0x8c, 0x07, 0x9b, 0x54, 0x14, 0x8b, 0xe4, 0x73, 0x2b, 0x38, 0xf2, 0x09, - 0x6d, 0x9c, 0xa5, 0x6f, 0xe0, 0xda, 0x67, 0x6b, 0x46, 0x9f, 0xcf, 0xdb, 0x5f, 0x07, 0x00, 0x00, - 0xff, 0xff, 0x0e, 0x13, 0x8d, 0x95, 0x24, 0x17, 0x00, 0x00, + // 1624 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4f, 0x6f, 0x1b, 0xc7, + 0x15, 0x17, 0x49, 0x4b, 0xa2, 0x86, 0x14, 0xa5, 0xae, 0x64, 0x9b, 0x52, 0x5d, 0x8d, 0x3c, 0xfd, + 0x63, 0x15, 0xae, 0x48, 0xc8, 0x2e, 0x50, 0xd4, 0x87, 0x02, 0x5e, 0x4b, 0x75, 0x65, 0xd7, 0x82, + 0xb0, 0x52, 0x6d, 0xa0, 0x80, 0xc1, 0x2e, 0x77, 0xc7, 0xd4, 0x58, 0xdc, 0x1d, 0x62, 0x67, 0x28, + 0x89, 0xb7, 0x02, 0xbe, 0xf4, 0x56, 0x1f, 0x7d, 0x34, 0xf2, 0x19, 0x02, 0xe4, 0x2b, 0x18, 0x3e, + 0xf9, 0x18, 0xe4, 0xb0, 0x09, 0xec, 0x1c, 0x02, 0x1e, 0x37, 0x40, 0xce, 0xc1, 0xce, 0xcc, 0xee, + 0x0e, 0x57, 0x32, 0x08, 0x27, 0xf1, 0x21, 0x81, 0x4e, 0xe4, 0xfc, 0xde, 0x7b, 0xbf, 0x37, 0x7f, + 0xde, 0x7b, 0xf3, 0x76, 0x00, 0x62, 0x3c, 0xb0, 0x39, 0x65, 0xcd, 0x00, 0x77, 0x08, 0xe3, 0x38, + 0x68, 0x1e, 0x6d, 0xa4, 0xff, 0x1b, 0xbd, 0x80, 0x72, 0x6a, 0x2c, 0x28, 0x9d, 0x46, 0x8a, 0x1f, + 0x6d, 0x2c, 0x2f, 0x76, 0x68, 0x87, 0x0a, 0x79, 0x33, 0xfe, 0x27, 0x55, 0x97, 0x97, 0x3a, 0x94, + 0x76, 0xba, 0xb8, 0x29, 0x46, 0xed, 0xfe, 0x93, 0xa6, 0xed, 0x0f, 0x94, 0x08, 0xe6, 0x45, 0x9c, + 0x78, 0x98, 0x71, 0xdb, 0xeb, 0x29, 0x85, 0x95, 0xbc, 0x82, 0xdb, 0x0f, 0x6c, 0x4e, 0xa8, 0x9f, + 0x70, 0x3b, 0x94, 0x79, 0x94, 0xb5, 0xa4, 0x53, 0x39, 0x48, 0x4c, 0xe5, 0xa8, 0xd9, 0xb6, 0x19, + 0x6e, 0x1e, 0x6d, 0xb4, 0x31, 0xb7, 0x37, 0x9a, 0x0e, 0x25, 0x89, 0xe9, 0xef, 0x94, 0x9c, 0x71, + 0xfb, 0x90, 0xf8, 0x9d, 0x54, 0x45, 0x8d, 0xa5, 0x16, 0xfa, 0xba, 0x04, 0xa6, 0x76, 0xed, 0xc0, + 0xf6, 0x98, 0x61, 0x02, 0xd0, 0xa6, 0xbe, 0xdb, 0x72, 0xb1, 0x4f, 0xbd, 0x7a, 0x61, 0xb5, 0xb0, + 0x36, 0x63, 0xfe, 0x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, 0xf0, 0x38, 0xe9, 0xf3, 0xe4, 0x71, 0xdc, 0xfd, 0x80, 0x4f, 0xdc, 0x4d, + 0xec, 0x8c, 0xeb, 0x0a, 0xcd, 0x9d, 0x57, 0x6f, 0x57, 0x0a, 0x6f, 0xde, 0xae, 0x14, 0xbe, 0x7a, + 0xbb, 0x52, 0x78, 0xfe, 0x6e, 0x65, 0xe2, 0xcd, 0xbb, 0x95, 0x89, 0xcf, 0xdf, 0xad, 0x4c, 0xfc, + 0xfb, 0xcf, 0x9a, 0x07, 0x95, 0x54, 0x3e, 0xe6, 0xc9, 0xdf, 0x75, 0xe7, 0xc0, 0x26, 0x7e, 0xf3, + 0x24, 0x7b, 0x01, 0x17, 0x3e, 0xdb, 0x53, 0x22, 0x3e, 0x6f, 0x7e, 0x1f, 0x00, 0x00, 0xff, 0xff, + 0x5d, 0x17, 0x4e, 0x0f, 0x22, 0x17, 0x00, 0x00, +} + +func (this *ResourceNode) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ResourceNode) + if !ok { + that2, ok := that.(ResourceNode) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.NetworkAddress != that1.NetworkAddress { + return false + } + if !this.Pubkey.Equal(that1.Pubkey) { + return false + } + if this.Suspend != that1.Suspend { + return false + } + if this.Status != that1.Status { + return false + } + if !this.Tokens.Equal(that1.Tokens) { + return false + } + if this.OwnerAddress != that1.OwnerAddress { + return false + } + if !this.Description.Equal(that1.Description) { + return false + } + if !this.CreationTime.Equal(that1.CreationTime) { + return false + } + if this.NodeType != that1.NodeType { + return false + } + return true } +func (this *MetaNode) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + that1, ok := that.(*MetaNode) + if !ok { + that2, ok := that.(MetaNode) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.NetworkAddress != that1.NetworkAddress { + return false + } + if !this.Pubkey.Equal(that1.Pubkey) { + return false + } + if this.Suspend != that1.Suspend { + return false + } + if this.Status != that1.Status { + return false + } + if !this.Tokens.Equal(that1.Tokens) { + return false + } + if this.OwnerAddress != that1.OwnerAddress { + return false + } + if !this.Description.Equal(that1.Description) { + return false + } + if !this.CreationTime.Equal(that1.CreationTime) { + return false + } + return true +} +func (this *Description) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Description) + if !ok { + that2, ok := that.(Description) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Moniker != that1.Moniker { + return false + } + if this.Identity != that1.Identity { + return false + } + if this.Website != that1.Website { + return false + } + if this.SecurityContact != that1.SecurityContact { + return false + } + if this.Details != that1.Details { + return false + } + return true +} func (m *Params) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1140,7 +1270,7 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *IndexingNode) Marshal() (dAtA []byte, err error) { +func (m *MetaNode) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1150,12 +1280,12 @@ func (m *IndexingNode) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *IndexingNode) MarshalTo(dAtA []byte) (int, error) { +func (m *MetaNode) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MetaNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1234,7 +1364,7 @@ func (m *IndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *IndexingNodeRegistrationVotePool) Marshal() (dAtA []byte, err error) { +func (m *MetaNodeRegistrationVotePool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1244,12 +1374,12 @@ func (m *IndexingNodeRegistrationVotePool) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *IndexingNodeRegistrationVotePool) MarshalTo(dAtA []byte) (int, error) { +func (m *MetaNodeRegistrationVotePool) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *IndexingNodeRegistrationVotePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MetaNodeRegistrationVotePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1439,9 +1569,9 @@ func (m *TotalStakesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if m.IndexingNodesTotalStake != nil { + if m.MetaNodesTotalStake != nil { { - size, err := m.IndexingNodesTotalStake.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MetaNodesTotalStake.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1639,9 +1769,9 @@ func (m *UnbondingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } } - if m.IsIndexingNode { + if m.IsMetaNode { i-- - if m.IsIndexingNode { + if m.IsMetaNode { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -1836,7 +1966,7 @@ func (m *ResourceNode) Size() (n int) { return n } -func (m *IndexingNode) Size() (n int) { +func (m *MetaNode) Size() (n int) { if m == nil { return 0 } @@ -1871,7 +2001,7 @@ func (m *IndexingNode) Size() (n int) { return n } -func (m *IndexingNodeRegistrationVotePool) Size() (n int) { +func (m *MetaNodeRegistrationVotePool) Size() (n int) { if m == nil { return 0 } @@ -1953,8 +2083,8 @@ func (m *TotalStakesResponse) Size() (n int) { l = m.ResourceNodesTotalStake.Size() n += 1 + l + sovRegister(uint64(l)) } - if m.IndexingNodesTotalStake != nil { - l = m.IndexingNodesTotalStake.Size() + if m.MetaNodesTotalStake != nil { + l = m.MetaNodesTotalStake.Size() n += 1 + l + sovRegister(uint64(l)) } if m.TotalBondedStake != nil { @@ -2035,7 +2165,7 @@ func (m *UnbondingNode) Size() (n int) { if l > 0 { n += 1 + l + sovRegister(uint64(l)) } - if m.IsIndexingNode { + if m.IsMetaNode { n += 2 } if len(m.Entries) > 0 { @@ -2585,7 +2715,7 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } return nil } -func (m *IndexingNode) Unmarshal(dAtA []byte) error { +func (m *MetaNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2608,10 +2738,10 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IndexingNode: wiretype end group for non-group") + return fmt.Errorf("proto: MetaNode: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MetaNode: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2877,7 +3007,7 @@ func (m *IndexingNode) Unmarshal(dAtA []byte) error { } return nil } -func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { +func (m *MetaNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2900,10 +3030,10 @@ func (m *IndexingNodeRegistrationVotePool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IndexingNodeRegistrationVotePool: wiretype end group for non-group") + return fmt.Errorf("proto: MetaNodeRegistrationVotePool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IndexingNodeRegistrationVotePool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MetaNodeRegistrationVotePool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3434,7 +3564,7 @@ func (m *TotalStakesResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodesTotalStake", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaNodesTotalStake", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3461,10 +3591,10 @@ func (m *TotalStakesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.IndexingNodesTotalStake == nil { - m.IndexingNodesTotalStake = &types2.Coin{} + if m.MetaNodesTotalStake == nil { + m.MetaNodesTotalStake = &types2.Coin{} } - if err := m.IndexingNodesTotalStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MetaNodesTotalStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4094,7 +4224,7 @@ func (m *UnbondingNode) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsIndexingNode", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IsMetaNode", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -4111,7 +4241,7 @@ func (m *UnbondingNode) Unmarshal(dAtA []byte) error { break } } - m.IsIndexingNode = bool(v != 0) + m.IsMetaNode = bool(v != 0) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) diff --git a/x/register/types/registration.go b/x/register/types/registration.go index 7ce45d52..5b8cda19 100644 --- a/x/register/types/registration.go +++ b/x/register/types/registration.go @@ -25,7 +25,7 @@ func NewDescription(moniker, identity, website, securityContact, details string) } } -// EnsureLength ensures the length of a resource/indexing node's description. +// EnsureLength ensures the length of a resource/meta node's description. func (d Description) EnsureLength() (Description, error) { if len(d.Moniker) > MaxMonikerLength { return d, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid moniker length; got: %d, max: %d", len(d.Moniker), MaxMonikerLength) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index 378c77ec..e30ce9f8 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "fmt" "strconv" "strings" @@ -13,7 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" - "github.com/stratosnet/stratos-chain/x/evm/types" ) type NodeType uint8 @@ -220,11 +218,11 @@ func UnmarshalResourceNode(cdc codec.BinaryCodec, value []byte) (v ResourceNode, return v, err } -func (v1 ResourceNode) Equal(v2 ResourceNode) bool { - bz1 := types.ModuleCdc.MustMarshalLengthPrefixed(&v1) - bz2 := types.ModuleCdc.MustMarshalLengthPrefixed(&v2) - return bytes.Equal(bz1, bz2) -} +//func (v1 ResourceNode) Equal(v2 ResourceNode) bool { +// bz1 := types.ModuleCdc.MustMarshalLengthPrefixed(&v1) +// bz2 := types.ModuleCdc.MustMarshalLengthPrefixed(&v2) +// return bytes.Equal(bz1, bz2) +//} // GetOwnerAddr //func (s *Staking) GetNetworkAddress() stratos.SdsAddress { diff --git a/x/register/types/tx.pb.go b/x/register/types/tx.pb.go index 3a334362..ff619bad 100644 --- a/x/register/types/tx.pb.go +++ b/x/register/types/tx.pb.go @@ -154,8 +154,8 @@ func (m *MsgCreateResourceNodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateResourceNodeResponse proto.InternalMessageInfo -// MsgCreateIndexingNode encapsulates an MsgCreateIndexingNodeTx transaction as an SDK message. -type MsgCreateIndexingNode struct { +// MsgCreateMetaNode encapsulates an MsgCreateMetaNodeTx transaction as an SDK message. +type MsgCreateMetaNode struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` Pubkey *types.Any `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey" yaml:"pubkey"` Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` @@ -163,18 +163,18 @@ type MsgCreateIndexingNode struct { Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` } -func (m *MsgCreateIndexingNode) Reset() { *m = MsgCreateIndexingNode{} } -func (m *MsgCreateIndexingNode) String() string { return proto.CompactTextString(m) } -func (*MsgCreateIndexingNode) ProtoMessage() {} -func (*MsgCreateIndexingNode) Descriptor() ([]byte, []int) { +func (m *MsgCreateMetaNode) Reset() { *m = MsgCreateMetaNode{} } +func (m *MsgCreateMetaNode) String() string { return proto.CompactTextString(m) } +func (*MsgCreateMetaNode) ProtoMessage() {} +func (*MsgCreateMetaNode) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{2} } -func (m *MsgCreateIndexingNode) XXX_Unmarshal(b []byte) error { +func (m *MsgCreateMetaNode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCreateMetaNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateIndexingNode.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCreateMetaNode.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -184,69 +184,69 @@ func (m *MsgCreateIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgCreateIndexingNode) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateIndexingNode.Merge(m, src) +func (m *MsgCreateMetaNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateMetaNode.Merge(m, src) } -func (m *MsgCreateIndexingNode) XXX_Size() int { +func (m *MsgCreateMetaNode) XXX_Size() int { return m.Size() } -func (m *MsgCreateIndexingNode) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateIndexingNode.DiscardUnknown(m) +func (m *MsgCreateMetaNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateMetaNode.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateIndexingNode proto.InternalMessageInfo +var xxx_messageInfo_MsgCreateMetaNode proto.InternalMessageInfo -func (m *MsgCreateIndexingNode) GetNetworkAddress() string { +func (m *MsgCreateMetaNode) GetNetworkAddress() string { if m != nil { return m.NetworkAddress } return "" } -func (m *MsgCreateIndexingNode) GetPubkey() *types.Any { +func (m *MsgCreateMetaNode) GetPubkey() *types.Any { if m != nil { return m.Pubkey } return nil } -func (m *MsgCreateIndexingNode) GetValue() types1.Coin { +func (m *MsgCreateMetaNode) GetValue() types1.Coin { if m != nil { return m.Value } return types1.Coin{} } -func (m *MsgCreateIndexingNode) GetOwnerAddress() string { +func (m *MsgCreateMetaNode) GetOwnerAddress() string { if m != nil { return m.OwnerAddress } return "" } -func (m *MsgCreateIndexingNode) GetDescription() *Description { +func (m *MsgCreateMetaNode) GetDescription() *Description { if m != nil { return m.Description } return nil } -// MsgCreateIndexingNodeResponse defines the CreateIndexingNode response type -type MsgCreateIndexingNodeResponse struct { +// MsgCreateMetaNodeResponse defines the CreateMetaNode response type +type MsgCreateMetaNodeResponse struct { } -func (m *MsgCreateIndexingNodeResponse) Reset() { *m = MsgCreateIndexingNodeResponse{} } -func (m *MsgCreateIndexingNodeResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateIndexingNodeResponse) ProtoMessage() {} -func (*MsgCreateIndexingNodeResponse) Descriptor() ([]byte, []int) { +func (m *MsgCreateMetaNodeResponse) Reset() { *m = MsgCreateMetaNodeResponse{} } +func (m *MsgCreateMetaNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateMetaNodeResponse) ProtoMessage() {} +func (*MsgCreateMetaNodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{3} } -func (m *MsgCreateIndexingNodeResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgCreateMetaNodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCreateMetaNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateIndexingNodeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCreateMetaNodeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -256,17 +256,17 @@ func (m *MsgCreateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *MsgCreateIndexingNodeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateIndexingNodeResponse.Merge(m, src) +func (m *MsgCreateMetaNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateMetaNodeResponse.Merge(m, src) } -func (m *MsgCreateIndexingNodeResponse) XXX_Size() int { +func (m *MsgCreateMetaNodeResponse) XXX_Size() int { return m.Size() } -func (m *MsgCreateIndexingNodeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateIndexingNodeResponse.DiscardUnknown(m) +func (m *MsgCreateMetaNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateMetaNodeResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateIndexingNodeResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgCreateMetaNodeResponse proto.InternalMessageInfo // MsgRemoveResourceNode - encapsulates an RemoveResourceNode transaction as an SDK message type MsgRemoveResourceNode struct { @@ -344,24 +344,24 @@ func (m *MsgRemoveResourceNodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveResourceNodeResponse proto.InternalMessageInfo -// MsgRemoveIndexingNode - encapsulates an MsgRemoveIndexingNode transaction as an SDK message -type MsgRemoveIndexingNode struct { - IndexingNodeAddress string `protobuf:"bytes,1,opt,name=indexing_node_address,json=indexingNodeAddress,proto3" json:"indexing_node_address" yaml:"indexing_node_address"` - OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` +// MsgRemoveMetaNode - encapsulates an MsgRemoveMetaNode transaction as an SDK message +type MsgRemoveMetaNode struct { + MetaNodeAddress string `protobuf:"bytes,1,opt,name=meta_node_address,json=metaNodeAddress,proto3" json:"meta_node_address" yaml:"meta_node_address"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` } -func (m *MsgRemoveIndexingNode) Reset() { *m = MsgRemoveIndexingNode{} } -func (m *MsgRemoveIndexingNode) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveIndexingNode) ProtoMessage() {} -func (*MsgRemoveIndexingNode) Descriptor() ([]byte, []int) { +func (m *MsgRemoveMetaNode) Reset() { *m = MsgRemoveMetaNode{} } +func (m *MsgRemoveMetaNode) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMetaNode) ProtoMessage() {} +func (*MsgRemoveMetaNode) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{6} } -func (m *MsgRemoveIndexingNode) XXX_Unmarshal(b []byte) error { +func (m *MsgRemoveMetaNode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRemoveIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRemoveMetaNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRemoveIndexingNode.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRemoveMetaNode.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -371,34 +371,34 @@ func (m *MsgRemoveIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgRemoveIndexingNode) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveIndexingNode.Merge(m, src) +func (m *MsgRemoveMetaNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMetaNode.Merge(m, src) } -func (m *MsgRemoveIndexingNode) XXX_Size() int { +func (m *MsgRemoveMetaNode) XXX_Size() int { return m.Size() } -func (m *MsgRemoveIndexingNode) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveIndexingNode.DiscardUnknown(m) +func (m *MsgRemoveMetaNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMetaNode.DiscardUnknown(m) } -var xxx_messageInfo_MsgRemoveIndexingNode proto.InternalMessageInfo +var xxx_messageInfo_MsgRemoveMetaNode proto.InternalMessageInfo -// MsgRemoveIndexingNodeResponse defines the Msg/RemoveIndexingNode response type. -type MsgRemoveIndexingNodeResponse struct { +// MsgRemoveMetaNodeResponse defines the Msg/RemoveMetaNode response type. +type MsgRemoveMetaNodeResponse struct { } -func (m *MsgRemoveIndexingNodeResponse) Reset() { *m = MsgRemoveIndexingNodeResponse{} } -func (m *MsgRemoveIndexingNodeResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveIndexingNodeResponse) ProtoMessage() {} -func (*MsgRemoveIndexingNodeResponse) Descriptor() ([]byte, []int) { +func (m *MsgRemoveMetaNodeResponse) Reset() { *m = MsgRemoveMetaNodeResponse{} } +func (m *MsgRemoveMetaNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMetaNodeResponse) ProtoMessage() {} +func (*MsgRemoveMetaNodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{7} } -func (m *MsgRemoveIndexingNodeResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRemoveMetaNodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRemoveIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRemoveMetaNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRemoveIndexingNodeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRemoveMetaNodeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -408,17 +408,17 @@ func (m *MsgRemoveIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *MsgRemoveIndexingNodeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveIndexingNodeResponse.Merge(m, src) +func (m *MsgRemoveMetaNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMetaNodeResponse.Merge(m, src) } -func (m *MsgRemoveIndexingNodeResponse) XXX_Size() int { +func (m *MsgRemoveMetaNodeResponse) XXX_Size() int { return m.Size() } -func (m *MsgRemoveIndexingNodeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveIndexingNodeResponse.DiscardUnknown(m) +func (m *MsgRemoveMetaNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMetaNodeResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgRemoveIndexingNodeResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgRemoveMetaNodeResponse proto.InternalMessageInfo // MsgUpdateResourceNode defines a SDK message for updating an existing resource node. type MsgUpdateResourceNode struct { @@ -498,25 +498,25 @@ func (m *MsgUpdateResourceNodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateResourceNodeResponse proto.InternalMessageInfo -// MsgUpdateIndexingNode defines a SDK message for updating an existing indexing node. -type MsgUpdateIndexingNode struct { +// MsgUpdateMetaNode defines a SDK message for updating an existing meta node. +type MsgUpdateMetaNode struct { Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description" yaml:"description"` NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` } -func (m *MsgUpdateIndexingNode) Reset() { *m = MsgUpdateIndexingNode{} } -func (m *MsgUpdateIndexingNode) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateIndexingNode) ProtoMessage() {} -func (*MsgUpdateIndexingNode) Descriptor() ([]byte, []int) { +func (m *MsgUpdateMetaNode) Reset() { *m = MsgUpdateMetaNode{} } +func (m *MsgUpdateMetaNode) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMetaNode) ProtoMessage() {} +func (*MsgUpdateMetaNode) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{10} } -func (m *MsgUpdateIndexingNode) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateMetaNode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateMetaNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateIndexingNode.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateMetaNode.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -526,34 +526,34 @@ func (m *MsgUpdateIndexingNode) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgUpdateIndexingNode) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateIndexingNode.Merge(m, src) +func (m *MsgUpdateMetaNode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMetaNode.Merge(m, src) } -func (m *MsgUpdateIndexingNode) XXX_Size() int { +func (m *MsgUpdateMetaNode) XXX_Size() int { return m.Size() } -func (m *MsgUpdateIndexingNode) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateIndexingNode.DiscardUnknown(m) +func (m *MsgUpdateMetaNode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMetaNode.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateIndexingNode proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateMetaNode proto.InternalMessageInfo -// MsgUpdateIndexingNodeResponse defines the Msg/UpdateIndexingNode response type. -type MsgUpdateIndexingNodeResponse struct { +// MsgUpdateMetaNodeResponse defines the Msg/UpdateMetaNode response type. +type MsgUpdateMetaNodeResponse struct { } -func (m *MsgUpdateIndexingNodeResponse) Reset() { *m = MsgUpdateIndexingNodeResponse{} } -func (m *MsgUpdateIndexingNodeResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateIndexingNodeResponse) ProtoMessage() {} -func (*MsgUpdateIndexingNodeResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateMetaNodeResponse) Reset() { *m = MsgUpdateMetaNodeResponse{} } +func (m *MsgUpdateMetaNodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMetaNodeResponse) ProtoMessage() {} +func (*MsgUpdateMetaNodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{11} } -func (m *MsgUpdateIndexingNodeResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateMetaNodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateMetaNodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateIndexingNodeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateMetaNodeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -563,17 +563,17 @@ func (m *MsgUpdateIndexingNodeResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *MsgUpdateIndexingNodeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateIndexingNodeResponse.Merge(m, src) +func (m *MsgUpdateMetaNodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMetaNodeResponse.Merge(m, src) } -func (m *MsgUpdateIndexingNodeResponse) XXX_Size() int { +func (m *MsgUpdateMetaNodeResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateIndexingNodeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateIndexingNodeResponse.DiscardUnknown(m) +func (m *MsgUpdateMetaNodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMetaNodeResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateIndexingNodeResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateMetaNodeResponse proto.InternalMessageInfo // MsgUpdateResourceNodeStake defines a SDK message for updating the stake of an existing resource node. type MsgUpdateResourceNodeStake struct { @@ -653,26 +653,26 @@ func (m *MsgUpdateResourceNodeStakeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateResourceNodeStakeResponse proto.InternalMessageInfo -// MsgUpdateIndexingNodeStake defines a SDK message for updating the stake of an existing indexing node. -type MsgUpdateIndexingNodeStake struct { +// MsgUpdateMetaNodeStake defines a SDK message for updating the stake of an existing meta node. +type MsgUpdateMetaNodeStake struct { NetworkAddress string `protobuf:"bytes,1,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` IncrStake bool `protobuf:"varint,3,opt,name=incr_stake,json=incrStake,proto3" json:"incr_stake" yaml:"incr_stake"` StakeDelta *types1.Coin `protobuf:"bytes,4,opt,name=stake_delta,json=stakeDelta,proto3" json:"stake_delta" yaml:"stake_delta"` } -func (m *MsgUpdateIndexingNodeStake) Reset() { *m = MsgUpdateIndexingNodeStake{} } -func (m *MsgUpdateIndexingNodeStake) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateIndexingNodeStake) ProtoMessage() {} -func (*MsgUpdateIndexingNodeStake) Descriptor() ([]byte, []int) { +func (m *MsgUpdateMetaNodeStake) Reset() { *m = MsgUpdateMetaNodeStake{} } +func (m *MsgUpdateMetaNodeStake) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMetaNodeStake) ProtoMessage() {} +func (*MsgUpdateMetaNodeStake) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{14} } -func (m *MsgUpdateIndexingNodeStake) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateMetaNodeStake) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateIndexingNodeStake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateMetaNodeStake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateIndexingNodeStake.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateMetaNodeStake.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -682,34 +682,34 @@ func (m *MsgUpdateIndexingNodeStake) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *MsgUpdateIndexingNodeStake) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateIndexingNodeStake.Merge(m, src) +func (m *MsgUpdateMetaNodeStake) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMetaNodeStake.Merge(m, src) } -func (m *MsgUpdateIndexingNodeStake) XXX_Size() int { +func (m *MsgUpdateMetaNodeStake) XXX_Size() int { return m.Size() } -func (m *MsgUpdateIndexingNodeStake) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateIndexingNodeStake.DiscardUnknown(m) +func (m *MsgUpdateMetaNodeStake) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMetaNodeStake.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateIndexingNodeStake proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateMetaNodeStake proto.InternalMessageInfo // MsgUpdateResourceNodeStakeResponse defines the Msg/UpdateResourceNodeStake response type. -type MsgUpdateIndexingNodeStakeResponse struct { +type MsgUpdateMetaNodeStakeResponse struct { } -func (m *MsgUpdateIndexingNodeStakeResponse) Reset() { *m = MsgUpdateIndexingNodeStakeResponse{} } -func (m *MsgUpdateIndexingNodeStakeResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateIndexingNodeStakeResponse) ProtoMessage() {} -func (*MsgUpdateIndexingNodeStakeResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateMetaNodeStakeResponse) Reset() { *m = MsgUpdateMetaNodeStakeResponse{} } +func (m *MsgUpdateMetaNodeStakeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMetaNodeStakeResponse) ProtoMessage() {} +func (*MsgUpdateMetaNodeStakeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{15} } -func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateMetaNodeStakeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateMetaNodeStakeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateMetaNodeStakeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -719,20 +719,20 @@ func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse.Merge(m, src) +func (m *MsgUpdateMetaNodeStakeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMetaNodeStakeResponse.Merge(m, src) } -func (m *MsgUpdateIndexingNodeStakeResponse) XXX_Size() int { +func (m *MsgUpdateMetaNodeStakeResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateIndexingNodeStakeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse.DiscardUnknown(m) +func (m *MsgUpdateMetaNodeStakeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMetaNodeStakeResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateIndexingNodeStakeResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateMetaNodeStakeResponse proto.InternalMessageInfo -// MsgIndexingNodeRegistrationVote defines a SDK message for registration vote of an existing indexing node. -type MsgIndexingNodeRegistrationVote struct { +// MsgMetaNodeRegistrationVote defines a SDK message for registration vote of an existing meta node. +type MsgMetaNodeRegistrationVote struct { CandidateNetworkAddress string `protobuf:"bytes,1,opt,name=candidate_network_address,json=candidateNetworkAddress,proto3" json:"candidate_network_address" yaml:"candidate_network_address"` CandidateOwnerAddress string `protobuf:"bytes,2,opt,name=candidate_owner_address,json=candidateOwnerAddress,proto3" json:"candidate_owner_address" yaml:"candidate_owner_address"` Opinion bool `protobuf:"varint,3,opt,name=opinion,proto3" json:"opinion" yaml:"opinion"` @@ -740,18 +740,18 @@ type MsgIndexingNodeRegistrationVote struct { VoterOwnerAddress string `protobuf:"bytes,5,opt,name=voter_owner_address,json=voterOwnerAddress,proto3" json:"voter_owner_address" yaml:"voter_owner_address"` } -func (m *MsgIndexingNodeRegistrationVote) Reset() { *m = MsgIndexingNodeRegistrationVote{} } -func (m *MsgIndexingNodeRegistrationVote) String() string { return proto.CompactTextString(m) } -func (*MsgIndexingNodeRegistrationVote) ProtoMessage() {} -func (*MsgIndexingNodeRegistrationVote) Descriptor() ([]byte, []int) { +func (m *MsgMetaNodeRegistrationVote) Reset() { *m = MsgMetaNodeRegistrationVote{} } +func (m *MsgMetaNodeRegistrationVote) String() string { return proto.CompactTextString(m) } +func (*MsgMetaNodeRegistrationVote) ProtoMessage() {} +func (*MsgMetaNodeRegistrationVote) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{16} } -func (m *MsgIndexingNodeRegistrationVote) XXX_Unmarshal(b []byte) error { +func (m *MsgMetaNodeRegistrationVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgIndexingNodeRegistrationVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgMetaNodeRegistrationVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgIndexingNodeRegistrationVote.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgMetaNodeRegistrationVote.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -761,36 +761,34 @@ func (m *MsgIndexingNodeRegistrationVote) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *MsgIndexingNodeRegistrationVote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgIndexingNodeRegistrationVote.Merge(m, src) +func (m *MsgMetaNodeRegistrationVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMetaNodeRegistrationVote.Merge(m, src) } -func (m *MsgIndexingNodeRegistrationVote) XXX_Size() int { +func (m *MsgMetaNodeRegistrationVote) XXX_Size() int { return m.Size() } -func (m *MsgIndexingNodeRegistrationVote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgIndexingNodeRegistrationVote.DiscardUnknown(m) +func (m *MsgMetaNodeRegistrationVote) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMetaNodeRegistrationVote.DiscardUnknown(m) } -var xxx_messageInfo_MsgIndexingNodeRegistrationVote proto.InternalMessageInfo +var xxx_messageInfo_MsgMetaNodeRegistrationVote proto.InternalMessageInfo -// MsgUpdateResourceNodeStakeResponse defines the Msg/IndexingNodeRegistrationVote response type. -type MsgIndexingNodeRegistrationVoteResponse struct { +// MsgUpdateResourceNodeStakeResponse defines the Msg/MetaNodeRegistrationVote response type. +type MsgMetaNodeRegistrationVoteResponse struct { } -func (m *MsgIndexingNodeRegistrationVoteResponse) Reset() { - *m = MsgIndexingNodeRegistrationVoteResponse{} -} -func (m *MsgIndexingNodeRegistrationVoteResponse) String() string { return proto.CompactTextString(m) } -func (*MsgIndexingNodeRegistrationVoteResponse) ProtoMessage() {} -func (*MsgIndexingNodeRegistrationVoteResponse) Descriptor() ([]byte, []int) { +func (m *MsgMetaNodeRegistrationVoteResponse) Reset() { *m = MsgMetaNodeRegistrationVoteResponse{} } +func (m *MsgMetaNodeRegistrationVoteResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMetaNodeRegistrationVoteResponse) ProtoMessage() {} +func (*MsgMetaNodeRegistrationVoteResponse) Descriptor() ([]byte, []int) { return fileDescriptor_75d4b90d7a185a31, []int{17} } -func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgMetaNodeRegistrationVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgMetaNodeRegistrationVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgMetaNodeRegistrationVoteResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -800,121 +798,123 @@ func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Marshal(b []byte, determin return b[:n], nil } } -func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse.Merge(m, src) +func (m *MsgMetaNodeRegistrationVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMetaNodeRegistrationVoteResponse.Merge(m, src) } -func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_Size() int { +func (m *MsgMetaNodeRegistrationVoteResponse) XXX_Size() int { return m.Size() } -func (m *MsgIndexingNodeRegistrationVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse.DiscardUnknown(m) +func (m *MsgMetaNodeRegistrationVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMetaNodeRegistrationVoteResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgIndexingNodeRegistrationVoteResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgMetaNodeRegistrationVoteResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgCreateResourceNode)(nil), "stratos.register.v1.MsgCreateResourceNode") proto.RegisterType((*MsgCreateResourceNodeResponse)(nil), "stratos.register.v1.MsgCreateResourceNodeResponse") - proto.RegisterType((*MsgCreateIndexingNode)(nil), "stratos.register.v1.MsgCreateIndexingNode") - proto.RegisterType((*MsgCreateIndexingNodeResponse)(nil), "stratos.register.v1.MsgCreateIndexingNodeResponse") + proto.RegisterType((*MsgCreateMetaNode)(nil), "stratos.register.v1.MsgCreateMetaNode") + proto.RegisterType((*MsgCreateMetaNodeResponse)(nil), "stratos.register.v1.MsgCreateMetaNodeResponse") proto.RegisterType((*MsgRemoveResourceNode)(nil), "stratos.register.v1.MsgRemoveResourceNode") proto.RegisterType((*MsgRemoveResourceNodeResponse)(nil), "stratos.register.v1.MsgRemoveResourceNodeResponse") - proto.RegisterType((*MsgRemoveIndexingNode)(nil), "stratos.register.v1.MsgRemoveIndexingNode") - proto.RegisterType((*MsgRemoveIndexingNodeResponse)(nil), "stratos.register.v1.MsgRemoveIndexingNodeResponse") + proto.RegisterType((*MsgRemoveMetaNode)(nil), "stratos.register.v1.MsgRemoveMetaNode") + proto.RegisterType((*MsgRemoveMetaNodeResponse)(nil), "stratos.register.v1.MsgRemoveMetaNodeResponse") proto.RegisterType((*MsgUpdateResourceNode)(nil), "stratos.register.v1.MsgUpdateResourceNode") proto.RegisterType((*MsgUpdateResourceNodeResponse)(nil), "stratos.register.v1.MsgUpdateResourceNodeResponse") - proto.RegisterType((*MsgUpdateIndexingNode)(nil), "stratos.register.v1.MsgUpdateIndexingNode") - proto.RegisterType((*MsgUpdateIndexingNodeResponse)(nil), "stratos.register.v1.MsgUpdateIndexingNodeResponse") + proto.RegisterType((*MsgUpdateMetaNode)(nil), "stratos.register.v1.MsgUpdateMetaNode") + proto.RegisterType((*MsgUpdateMetaNodeResponse)(nil), "stratos.register.v1.MsgUpdateMetaNodeResponse") proto.RegisterType((*MsgUpdateResourceNodeStake)(nil), "stratos.register.v1.MsgUpdateResourceNodeStake") proto.RegisterType((*MsgUpdateResourceNodeStakeResponse)(nil), "stratos.register.v1.MsgUpdateResourceNodeStakeResponse") - proto.RegisterType((*MsgUpdateIndexingNodeStake)(nil), "stratos.register.v1.MsgUpdateIndexingNodeStake") - proto.RegisterType((*MsgUpdateIndexingNodeStakeResponse)(nil), "stratos.register.v1.MsgUpdateIndexingNodeStakeResponse") - proto.RegisterType((*MsgIndexingNodeRegistrationVote)(nil), "stratos.register.v1.MsgIndexingNodeRegistrationVote") - proto.RegisterType((*MsgIndexingNodeRegistrationVoteResponse)(nil), "stratos.register.v1.MsgIndexingNodeRegistrationVoteResponse") + proto.RegisterType((*MsgUpdateMetaNodeStake)(nil), "stratos.register.v1.MsgUpdateMetaNodeStake") + proto.RegisterType((*MsgUpdateMetaNodeStakeResponse)(nil), "stratos.register.v1.MsgUpdateMetaNodeStakeResponse") + proto.RegisterType((*MsgMetaNodeRegistrationVote)(nil), "stratos.register.v1.MsgMetaNodeRegistrationVote") + proto.RegisterType((*MsgMetaNodeRegistrationVoteResponse)(nil), "stratos.register.v1.MsgMetaNodeRegistrationVoteResponse") } func init() { proto.RegisterFile("stratos/register/v1/tx.proto", fileDescriptor_75d4b90d7a185a31) } var fileDescriptor_75d4b90d7a185a31 = []byte{ - // 1233 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0xe3, 0xc4, - 0x1b, 0xae, 0xd3, 0xb4, 0xbf, 0x76, 0xba, 0xdd, 0x1f, 0x9b, 0xb6, 0xd0, 0x86, 0x36, 0x53, 0x06, - 0x56, 0x6c, 0x41, 0xb5, 0x95, 0x6e, 0xa1, 0x62, 0xb5, 0x20, 0x35, 0xbb, 0x07, 0x10, 0x6a, 0x41, - 0x06, 0xf6, 0xc0, 0x25, 0x72, 0x92, 0x21, 0x6b, 0xb5, 0xf1, 0x44, 0xb6, 0x93, 0x6d, 0x0e, 0x5c, - 0x38, 0x71, 0x44, 0xe2, 0x8c, 0x84, 0xc4, 0x3f, 0xb0, 0x87, 0xfd, 0x17, 0x90, 0x56, 0x9c, 0x56, - 0xe2, 0x02, 0x12, 0x8c, 0x50, 0xcb, 0x01, 0xf9, 0x86, 0x05, 0x77, 0xe4, 0x19, 0xdb, 0xf1, 0xc7, - 0xd8, 0x71, 0xf7, 0x83, 0x03, 0xea, 0x2d, 0xf3, 0x7e, 0x78, 0x9e, 0xf7, 0x7d, 0x1e, 0xcf, 0xbc, - 0x0e, 0x58, 0xb7, 0x6c, 0x53, 0xb3, 0x89, 0xa5, 0x98, 0xb8, 0xab, 0x5b, 0x36, 0x36, 0x95, 0x61, - 0x5d, 0xb1, 0x4f, 0xe4, 0xbe, 0x49, 0x6c, 0x52, 0x59, 0xf2, 0xbd, 0x72, 0xe0, 0x95, 0x87, 0xf5, - 0xea, 0x72, 0x97, 0x74, 0x09, 0xf3, 0x2b, 0xde, 0x2f, 0x1e, 0x5a, 0x5d, 0xeb, 0x12, 0xd2, 0x3d, - 0xc6, 0x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, 0x7e, 0x42, 0xe5, 0x10, 0xcc, 0x0c, 0xb5, 0xe3, 0x01, 0x5e, - 0x9d, 0x66, 0x3b, 0xac, 0xc9, 0x7e, 0xb4, 0xd7, 0x04, 0xd9, 0x6f, 0x82, 0x7c, 0x8b, 0xe8, 0x46, - 0x63, 0xe3, 0x21, 0x85, 0x53, 0x0e, 0x85, 0x3c, 0xde, 0xa5, 0xf0, 0x12, 0xdf, 0x89, 0x2d, 0x91, - 0xca, 0xcd, 0x95, 0x43, 0xb0, 0x48, 0xee, 0x19, 0xd8, 0x0c, 0x1b, 0x51, 0x66, 0x8d, 0xd8, 0x72, - 0x28, 0x8c, 0x3b, 0x5c, 0x0a, 0x97, 0xf9, 0x03, 0x62, 0x66, 0xa4, 0x5e, 0x62, 0xeb, 0xa0, 0x05, - 0x3a, 0x58, 0xe8, 0x60, 0xab, 0x6d, 0xea, 0x7d, 0x8f, 0xe9, 0xd5, 0x19, 0x86, 0x72, 0x53, 0x16, - 0xa8, 0x49, 0xbe, 0x3d, 0x8e, 0x6b, 0x5c, 0x75, 0x28, 0x8c, 0x26, 0xba, 0x14, 0x56, 0xf8, 0x6e, - 0x11, 0x23, 0x52, 0xa3, 0x21, 0x95, 0x77, 0xc0, 0xbc, 0x41, 0x3a, 0xb8, 0x69, 0x8f, 0xfa, 0x78, - 0x75, 0x96, 0xc1, 0x7e, 0xc9, 0xa1, 0x70, 0x6c, 0x74, 0x29, 0x7c, 0xce, 0x67, 0x2e, 0x30, 0x21, - 0x75, 0xce, 0xfb, 0xfd, 0xb1, 0xf7, 0x13, 0x82, 0x0d, 0xa1, 0x3c, 0x54, 0x6c, 0xf5, 0x89, 0x61, - 0x61, 0xf4, 0xeb, 0x74, 0x44, 0x40, 0xef, 0x19, 0x1d, 0x7c, 0xa2, 0x1b, 0xdd, 0x0b, 0x01, 0xfd, - 0x57, 0x04, 0x14, 0x13, 0x40, 0x94, 0xde, 0x50, 0x00, 0xbf, 0x48, 0x4c, 0x00, 0x2a,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, 0xe9, 0xd8, 0x49, 0x02, 0x7f, 0x0c, 0xc8, 0xbe, 0xc0, 0x73, 0x20, 0x0b, 0x46, - 0xe8, 0x09, 0x02, 0x2f, 0x06, 0x39, 0x67, 0xc8, 0x2c, 0x24, 0xf0, 0x38, 0x64, 0x81, 0xc0, 0xd3, - 0x33, 0x90, 0x52, 0x1c, 0x4b, 0x21, 0x81, 0x67, 0x5f, 0xf7, 0x85, 0x04, 0x1e, 0xff, 0xbc, 0xe5, - 0x02, 0xff, 0x59, 0x02, 0x57, 0xc3, 0x3a, 0x72, 0xa7, 0x85, 0xdd, 0x2c, 0x6c, 0x79, 0x59, 0xd5, - 0x9b, 0x8f, 0x93, 0x15, 0x96, 0x75, 0x93, 0x95, 0xf5, 0x26, 0xda, 0x15, 0x96, 0x15, 0xaf, 0xc7, - 0x8c, 0x3c, 0xa4, 0xe9, 0xdd, 0x73, 0x8d, 0xc3, 0x87, 0xa7, 0x35, 0xe9, 0xd1, 0x69, 0x4d, 0xfa, - 0xed, 0xb4, 0x26, 0x7d, 0x75, 0x56, 0x9b, 0x7a, 0x74, 0x56, 0x9b, 0xfa, 0xe9, 0xac, 0x36, 0xf5, - 0xe9, 0x6e, 0x57, 0xb7, 0xef, 0x0e, 0x5a, 0x72, 0x9b, 0xf4, 0x82, 0x27, 0x1b, 0xd8, 0x0e, 0x7e, - 0x6e, 0xb7, 0xef, 0x6a, 0xba, 0xa1, 0x9c, 0x8c, 0x37, 0xf3, 0x3e, 0x0a, 0xad, 0xd6, 0x2c, 0xfb, - 0xcb, 0xeb, 0xfa, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x2f, 0x84, 0x5c, 0xa7, 0x16, 0x00, - 0x00, + // 1272 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0x3a, 0x4e, 0x48,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0x03, 0x70, 0x85, 0x3c, 0xd6, 0xb0, 0xee, 0x37, 0x22, 0xcf, 0x1a, 0xb1, 0x61, 0x51, 0x18, + 0x76, 0xd8, 0x14, 0x2e, 0xf0, 0x09, 0x42, 0x66, 0x24, 0xcf, 0xb2, 0xb1, 0xd7, 0x02, 0x15, 0xcc, + 0xb4, 0xb0, 0xd1, 0xd4, 0xd5, 0xae, 0xc3, 0x74, 0x71, 0x82, 0xa1, 0xac, 0x88, 0x09, 0x6a, 0x12, + 0x1f, 0x0c, 0xe3, 0x6a, 0x6b, 0x16, 0x85, 0xc1, 0x44, 0x9b, 0xc2, 0x02, 0x5f, 0x2d, 0x60, 0x44, + 0x72, 0x30, 0xa4, 0xf0, 0x3e, 0x98, 0xd6, 0x48, 0x0b, 0xd7, 0xcd, 0x41, 0x17, 0x17, 0x27, 0x19, + 0xec, 0x9b, 0x16, 0x85, 0x43, 0xa3, 0x4d, 0xe1, 0xeb, 0x2e, 0x73, 0x9e, 0x09, 0xc9, 0x53, 0xce, + 0xef, 0x4f, 0x9d, 0x9f, 0x10, 0xac, 0x26, 0xca, 0x43, 0xc6, 0x46, 0x97, 0x68, 0x06, 0x46, 0xbf, + 0x8f, 0x83, 0x39, 0x3f, 0x62, 0x1f, 0x9b, 0xca, 0xa5, 0x78, 0xfe, 0x2f, 0xe2, 0x41, 0xcb, 0x60, + 0x29, 0x46, 0xad, 0x4f, 0xfc, 0x1f, 0x02, 0xdb, 0x39, 0x64, 0xdc, 0x21, 0xfd, 0xf0, 0xce, 0xd1, + 0x01, 0x8b, 0xba, 0x3b, 0xae, 0x33, 0x51, 0x85, 0x25, 0xf0, 0xae, 0x45, 0x61, 0x72, 0x80, 0x4d, + 0xe1, 0x0a, 0xc7, 0x94, 0xe8, 0x46, 0xf2, 0xbc, 0x1e, 0x58, 0xc7, 0x6b, 0x48, 0xac, 0xc1, 0xb9, + 0x97, 0x6a, 0xf0, 0xbd, 0xfc, 0x37, 0x4f, 0xe1, 0x98, 0x2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4, 0x2a, 0xbc, 0x9e, + 0xcd, 0xe9, 0xd9, 0x10, 0x53, 0x2e, 0x8a, 0xd9, 0x10, 0x5d, 0xca, 0x87, 0x10, 0x7f, 0x12, 0xc0, + 0x4a, 0x0a, 0x44, 0x2e, 0xd6, 0xcd, 0xd1, 0xd6, 0xe7, 0x42, 0xdd, 0x39, 0x47, 0xb0, 0x8f, 0x78, + 0x87, 0x21, 0xde, 0x42, 0x9b, 0x23, 0x21, 0x76, 0x05, 0xfa, 0x8b, 0x00, 0x6e, 0xfa, 0xb8, 0x53, + 0x4f, 0xf9, 0x3b, 0x69, 0x78, 0xd2, 0x32, 0x4a, 0x77, 0xcf, 0x9b, 0xe1, 0x97, 0x71, 0x97, 0x95, + 0xb1, 0x8d, 0xee, 0x24, 0x96, 0x31, 0xc4, 0xaf, 0x07, 0x26, 0xa8, 0x3b, 0x67, 0x52, 0xed, 0xe0, + 0xf8, 0xa4, 0x2c, 0x3c, 0x3f, 0x29, 0x0b, 0x7f, 0x9e, 0x94, 0x85, 0x6f, 0x4f, 0xcb, 0x63, 0xcf, + 0x4f, 0xcb, 0x63, 0xbf, 0x9d, 0x96, 0xc7, 0x3e, 0x7f, 0xbb, 0xad, 0x9a, 0x8f, 0x7a, 0x0d, 0xb1, + 0x49, 0x3a, 0xde, 0xac, 0x1a, 0x36, 0xbd, 0x9f, 0x5b, 0xcd, 0x47, 0x8a, 0xaa, 0x49, 0x4f, 0x86, + 0x0b, 0x39, 0x8f, 0x35, 0xa3, 0x31, 0xc9, 0xfe, 0x6e, 0xda, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, + 0x6c, 0xa9, 0x47, 0x9b, 0x1f, 0x16, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -934,11 +934,11 @@ type MsgClient interface { HandleMsgRemoveResourceNode(ctx context.Context, in *MsgRemoveResourceNode, opts ...grpc.CallOption) (*MsgRemoveResourceNodeResponse, error) HandleMsgUpdateResourceNode(ctx context.Context, in *MsgUpdateResourceNode, opts ...grpc.CallOption) (*MsgUpdateResourceNodeResponse, error) HandleMsgUpdateResourceNodeStake(ctx context.Context, in *MsgUpdateResourceNodeStake, opts ...grpc.CallOption) (*MsgUpdateResourceNodeStakeResponse, error) - HandleMsgCreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) - HandleMsgRemoveIndexingNode(ctx context.Context, in *MsgRemoveIndexingNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) - HandleMsgUpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) - HandleMsgUpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) - HandleMsgIndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) + HandleMsgCreateMetaNode(ctx context.Context, in *MsgCreateMetaNode, opts ...grpc.CallOption) (*MsgCreateMetaNodeResponse, error) + HandleMsgRemoveMetaNode(ctx context.Context, in *MsgRemoveMetaNode, opts ...grpc.CallOption) (*MsgRemoveMetaNodeResponse, error) + HandleMsgUpdateMetaNode(ctx context.Context, in *MsgUpdateMetaNode, opts ...grpc.CallOption) (*MsgUpdateMetaNodeResponse, error) + HandleMsgUpdateMetaNodeStake(ctx context.Context, in *MsgUpdateMetaNodeStake, opts ...grpc.CallOption) (*MsgUpdateMetaNodeStakeResponse, error) + HandleMsgMetaNodeRegistrationVote(ctx context.Context, in *MsgMetaNodeRegistrationVote, opts ...grpc.CallOption) (*MsgMetaNodeRegistrationVoteResponse, error) } type msgClient struct { @@ -985,45 +985,45 @@ func (c *msgClient) HandleMsgUpdateResourceNodeStake(ctx context.Context, in *Ms return out, nil } -func (c *msgClient) HandleMsgCreateIndexingNode(ctx context.Context, in *MsgCreateIndexingNode, opts ...grpc.CallOption) (*MsgCreateIndexingNodeResponse, error) { - out := new(MsgCreateIndexingNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgCreateIndexingNode", in, out, opts...) +func (c *msgClient) HandleMsgCreateMetaNode(ctx context.Context, in *MsgCreateMetaNode, opts ...grpc.CallOption) (*MsgCreateMetaNodeResponse, error) { + out := new(MsgCreateMetaNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgCreateMetaNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) HandleMsgRemoveIndexingNode(ctx context.Context, in *MsgRemoveIndexingNode, opts ...grpc.CallOption) (*MsgRemoveIndexingNodeResponse, error) { - out := new(MsgRemoveIndexingNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgRemoveIndexingNode", in, out, opts...) +func (c *msgClient) HandleMsgRemoveMetaNode(ctx context.Context, in *MsgRemoveMetaNode, opts ...grpc.CallOption) (*MsgRemoveMetaNodeResponse, error) { + out := new(MsgRemoveMetaNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgRemoveMetaNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) HandleMsgUpdateIndexingNode(ctx context.Context, in *MsgUpdateIndexingNode, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeResponse, error) { - out := new(MsgUpdateIndexingNodeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNode", in, out, opts...) +func (c *msgClient) HandleMsgUpdateMetaNode(ctx context.Context, in *MsgUpdateMetaNode, opts ...grpc.CallOption) (*MsgUpdateMetaNodeResponse, error) { + out := new(MsgUpdateMetaNodeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateMetaNode", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) HandleMsgUpdateIndexingNodeStake(ctx context.Context, in *MsgUpdateIndexingNodeStake, opts ...grpc.CallOption) (*MsgUpdateIndexingNodeStakeResponse, error) { - out := new(MsgUpdateIndexingNodeStakeResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNodeStake", in, out, opts...) +func (c *msgClient) HandleMsgUpdateMetaNodeStake(ctx context.Context, in *MsgUpdateMetaNodeStake, opts ...grpc.CallOption) (*MsgUpdateMetaNodeStakeResponse, error) { + out := new(MsgUpdateMetaNodeStakeResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgUpdateMetaNodeStake", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) HandleMsgIndexingNodeRegistrationVote(ctx context.Context, in *MsgIndexingNodeRegistrationVote, opts ...grpc.CallOption) (*MsgIndexingNodeRegistrationVoteResponse, error) { - out := new(MsgIndexingNodeRegistrationVoteResponse) - err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgIndexingNodeRegistrationVote", in, out, opts...) +func (c *msgClient) HandleMsgMetaNodeRegistrationVote(ctx context.Context, in *MsgMetaNodeRegistrationVote, opts ...grpc.CallOption) (*MsgMetaNodeRegistrationVoteResponse, error) { + out := new(MsgMetaNodeRegistrationVoteResponse) + err := c.cc.Invoke(ctx, "/stratos.register.v1.Msg/HandleMsgMetaNodeRegistrationVote", in, out, opts...) if err != nil { return nil, err } @@ -1037,11 +1037,11 @@ type MsgServer interface { HandleMsgRemoveResourceNode(context.Context, *MsgRemoveResourceNode) (*MsgRemoveResourceNodeResponse, error) HandleMsgUpdateResourceNode(context.Context, *MsgUpdateResourceNode) (*MsgUpdateResourceNodeResponse, error) HandleMsgUpdateResourceNodeStake(context.Context, *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) - HandleMsgCreateIndexingNode(context.Context, *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) - HandleMsgRemoveIndexingNode(context.Context, *MsgRemoveIndexingNode) (*MsgRemoveIndexingNodeResponse, error) - HandleMsgUpdateIndexingNode(context.Context, *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) - HandleMsgUpdateIndexingNodeStake(context.Context, *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) - HandleMsgIndexingNodeRegistrationVote(context.Context, *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) + HandleMsgCreateMetaNode(context.Context, *MsgCreateMetaNode) (*MsgCreateMetaNodeResponse, error) + HandleMsgRemoveMetaNode(context.Context, *MsgRemoveMetaNode) (*MsgRemoveMetaNodeResponse, error) + HandleMsgUpdateMetaNode(context.Context, *MsgUpdateMetaNode) (*MsgUpdateMetaNodeResponse, error) + HandleMsgUpdateMetaNodeStake(context.Context, *MsgUpdateMetaNodeStake) (*MsgUpdateMetaNodeStakeResponse, error) + HandleMsgMetaNodeRegistrationVote(context.Context, *MsgMetaNodeRegistrationVote) (*MsgMetaNodeRegistrationVoteResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1060,20 +1060,20 @@ func (*UnimplementedMsgServer) HandleMsgUpdateResourceNode(ctx context.Context, func (*UnimplementedMsgServer) HandleMsgUpdateResourceNodeStake(ctx context.Context, req *MsgUpdateResourceNodeStake) (*MsgUpdateResourceNodeStakeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateResourceNodeStake not implemented") } -func (*UnimplementedMsgServer) HandleMsgCreateIndexingNode(ctx context.Context, req *MsgCreateIndexingNode) (*MsgCreateIndexingNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HandleMsgCreateIndexingNode not implemented") +func (*UnimplementedMsgServer) HandleMsgCreateMetaNode(ctx context.Context, req *MsgCreateMetaNode) (*MsgCreateMetaNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgCreateMetaNode not implemented") } -func (*UnimplementedMsgServer) HandleMsgRemoveIndexingNode(ctx context.Context, req *MsgRemoveIndexingNode) (*MsgRemoveIndexingNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HandleMsgRemoveIndexingNode not implemented") +func (*UnimplementedMsgServer) HandleMsgRemoveMetaNode(ctx context.Context, req *MsgRemoveMetaNode) (*MsgRemoveMetaNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgRemoveMetaNode not implemented") } -func (*UnimplementedMsgServer) HandleMsgUpdateIndexingNode(ctx context.Context, req *MsgUpdateIndexingNode) (*MsgUpdateIndexingNodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateIndexingNode not implemented") +func (*UnimplementedMsgServer) HandleMsgUpdateMetaNode(ctx context.Context, req *MsgUpdateMetaNode) (*MsgUpdateMetaNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateMetaNode not implemented") } -func (*UnimplementedMsgServer) HandleMsgUpdateIndexingNodeStake(ctx context.Context, req *MsgUpdateIndexingNodeStake) (*MsgUpdateIndexingNodeStakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateIndexingNodeStake not implemented") +func (*UnimplementedMsgServer) HandleMsgUpdateMetaNodeStake(ctx context.Context, req *MsgUpdateMetaNodeStake) (*MsgUpdateMetaNodeStakeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgUpdateMetaNodeStake not implemented") } -func (*UnimplementedMsgServer) HandleMsgIndexingNodeRegistrationVote(ctx context.Context, req *MsgIndexingNodeRegistrationVote) (*MsgIndexingNodeRegistrationVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HandleMsgIndexingNodeRegistrationVote not implemented") +func (*UnimplementedMsgServer) HandleMsgMetaNodeRegistrationVote(ctx context.Context, req *MsgMetaNodeRegistrationVote) (*MsgMetaNodeRegistrationVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleMsgMetaNodeRegistrationVote not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { @@ -1152,92 +1152,92 @@ func _Msg_HandleMsgUpdateResourceNodeStake_Handler(srv interface{}, ctx context. return interceptor(ctx, in, info, handler) } -func _Msg_HandleMsgCreateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateIndexingNode) +func _Msg_HandleMsgCreateMetaNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateMetaNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).HandleMsgCreateIndexingNode(ctx, in) + return srv.(MsgServer).HandleMsgCreateMetaNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/HandleMsgCreateIndexingNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgCreateMetaNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).HandleMsgCreateIndexingNode(ctx, req.(*MsgCreateIndexingNode)) + return srv.(MsgServer).HandleMsgCreateMetaNode(ctx, req.(*MsgCreateMetaNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_HandleMsgRemoveIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveIndexingNode) +func _Msg_HandleMsgRemoveMetaNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveMetaNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).HandleMsgRemoveIndexingNode(ctx, in) + return srv.(MsgServer).HandleMsgRemoveMetaNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/HandleMsgRemoveIndexingNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgRemoveMetaNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).HandleMsgRemoveIndexingNode(ctx, req.(*MsgRemoveIndexingNode)) + return srv.(MsgServer).HandleMsgRemoveMetaNode(ctx, req.(*MsgRemoveMetaNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_HandleMsgUpdateIndexingNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateIndexingNode) +func _Msg_HandleMsgUpdateMetaNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateMetaNode) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).HandleMsgUpdateIndexingNode(ctx, in) + return srv.(MsgServer).HandleMsgUpdateMetaNode(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNode", + FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateMetaNode", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).HandleMsgUpdateIndexingNode(ctx, req.(*MsgUpdateIndexingNode)) + return srv.(MsgServer).HandleMsgUpdateMetaNode(ctx, req.(*MsgUpdateMetaNode)) } return interceptor(ctx, in, info, handler) } -func _Msg_HandleMsgUpdateIndexingNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateIndexingNodeStake) +func _Msg_HandleMsgUpdateMetaNodeStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateMetaNodeStake) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).HandleMsgUpdateIndexingNodeStake(ctx, in) + return srv.(MsgServer).HandleMsgUpdateMetaNodeStake(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateIndexingNodeStake", + FullMethod: "/stratos.register.v1.Msg/HandleMsgUpdateMetaNodeStake", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).HandleMsgUpdateIndexingNodeStake(ctx, req.(*MsgUpdateIndexingNodeStake)) + return srv.(MsgServer).HandleMsgUpdateMetaNodeStake(ctx, req.(*MsgUpdateMetaNodeStake)) } return interceptor(ctx, in, info, handler) } -func _Msg_HandleMsgIndexingNodeRegistrationVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgIndexingNodeRegistrationVote) +func _Msg_HandleMsgMetaNodeRegistrationVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMetaNodeRegistrationVote) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).HandleMsgIndexingNodeRegistrationVote(ctx, in) + return srv.(MsgServer).HandleMsgMetaNodeRegistrationVote(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stratos.register.v1.Msg/HandleMsgIndexingNodeRegistrationVote", + FullMethod: "/stratos.register.v1.Msg/HandleMsgMetaNodeRegistrationVote", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).HandleMsgIndexingNodeRegistrationVote(ctx, req.(*MsgIndexingNodeRegistrationVote)) + return srv.(MsgServer).HandleMsgMetaNodeRegistrationVote(ctx, req.(*MsgMetaNodeRegistrationVote)) } return interceptor(ctx, in, info, handler) } @@ -1263,24 +1263,24 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_HandleMsgUpdateResourceNodeStake_Handler, }, { - MethodName: "HandleMsgCreateIndexingNode", - Handler: _Msg_HandleMsgCreateIndexingNode_Handler, + MethodName: "HandleMsgCreateMetaNode", + Handler: _Msg_HandleMsgCreateMetaNode_Handler, }, { - MethodName: "HandleMsgRemoveIndexingNode", - Handler: _Msg_HandleMsgRemoveIndexingNode_Handler, + MethodName: "HandleMsgRemoveMetaNode", + Handler: _Msg_HandleMsgRemoveMetaNode_Handler, }, { - MethodName: "HandleMsgUpdateIndexingNode", - Handler: _Msg_HandleMsgUpdateIndexingNode_Handler, + MethodName: "HandleMsgUpdateMetaNode", + Handler: _Msg_HandleMsgUpdateMetaNode_Handler, }, { - MethodName: "HandleMsgUpdateIndexingNodeStake", - Handler: _Msg_HandleMsgUpdateIndexingNodeStake_Handler, + MethodName: "HandleMsgUpdateMetaNodeStake", + Handler: _Msg_HandleMsgUpdateMetaNodeStake_Handler, }, { - MethodName: "HandleMsgIndexingNodeRegistrationVote", - Handler: _Msg_HandleMsgIndexingNodeRegistrationVote_Handler, + MethodName: "HandleMsgMetaNodeRegistrationVote", + Handler: _Msg_HandleMsgMetaNodeRegistrationVote_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -1388,7 +1388,7 @@ func (m *MsgCreateResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgCreateIndexingNode) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateMetaNode) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1398,12 +1398,12 @@ func (m *MsgCreateIndexingNode) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateIndexingNode) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateMetaNode) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateMetaNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1459,7 +1459,7 @@ func (m *MsgCreateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgCreateIndexingNodeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateMetaNodeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1469,12 +1469,12 @@ func (m *MsgCreateIndexingNodeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateMetaNodeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateMetaNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1542,7 +1542,7 @@ func (m *MsgRemoveResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgRemoveIndexingNode) Marshal() (dAtA []byte, err error) { +func (m *MsgRemoveMetaNode) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1552,12 +1552,12 @@ func (m *MsgRemoveIndexingNode) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRemoveIndexingNode) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRemoveMetaNode) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRemoveIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRemoveMetaNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1569,17 +1569,17 @@ func (m *MsgRemoveIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.IndexingNodeAddress) > 0 { - i -= len(m.IndexingNodeAddress) - copy(dAtA[i:], m.IndexingNodeAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.IndexingNodeAddress))) + if len(m.MetaNodeAddress) > 0 { + i -= len(m.MetaNodeAddress) + copy(dAtA[i:], m.MetaNodeAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.MetaNodeAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgRemoveIndexingNodeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRemoveMetaNodeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1589,12 +1589,12 @@ func (m *MsgRemoveIndexingNodeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRemoveIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRemoveMetaNodeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRemoveIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRemoveMetaNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1679,7 +1679,7 @@ func (m *MsgUpdateResourceNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgUpdateIndexingNode) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateMetaNode) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1689,12 +1689,12 @@ func (m *MsgUpdateIndexingNode) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateIndexingNode) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNode) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1726,7 +1726,7 @@ func (m *MsgUpdateIndexingNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateIndexingNodeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateMetaNodeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1736,12 +1736,12 @@ func (m *MsgUpdateIndexingNodeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateIndexingNodeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNodeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateIndexingNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1831,7 +1831,7 @@ func (m *MsgUpdateResourceNodeStakeResponse) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } -func (m *MsgUpdateIndexingNodeStake) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateMetaNodeStake) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1841,12 +1841,12 @@ func (m *MsgUpdateIndexingNodeStake) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateIndexingNodeStake) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNodeStake) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateIndexingNodeStake) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNodeStake) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1890,7 +1890,7 @@ func (m *MsgUpdateIndexingNodeStake) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *MsgUpdateIndexingNodeStakeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateMetaNodeStakeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1900,12 +1900,12 @@ func (m *MsgUpdateIndexingNodeStakeResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *MsgUpdateIndexingNodeStakeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNodeStakeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateIndexingNodeStakeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateMetaNodeStakeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1913,7 +1913,7 @@ func (m *MsgUpdateIndexingNodeStakeResponse) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } -func (m *MsgIndexingNodeRegistrationVote) Marshal() (dAtA []byte, err error) { +func (m *MsgMetaNodeRegistrationVote) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1923,12 +1923,12 @@ func (m *MsgIndexingNodeRegistrationVote) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgIndexingNodeRegistrationVote) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgMetaNodeRegistrationVote) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgIndexingNodeRegistrationVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgMetaNodeRegistrationVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1974,7 +1974,7 @@ func (m *MsgIndexingNodeRegistrationVote) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *MsgIndexingNodeRegistrationVoteResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgMetaNodeRegistrationVoteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1984,12 +1984,12 @@ func (m *MsgIndexingNodeRegistrationVoteResponse) Marshal() (dAtA []byte, err er return dAtA[:n], nil } -func (m *MsgIndexingNodeRegistrationVoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgMetaNodeRegistrationVoteResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgIndexingNodeRegistrationVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgMetaNodeRegistrationVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2048,7 +2048,7 @@ func (m *MsgCreateResourceNodeResponse) Size() (n int) { return n } -func (m *MsgCreateIndexingNode) Size() (n int) { +func (m *MsgCreateMetaNode) Size() (n int) { if m == nil { return 0 } @@ -2075,7 +2075,7 @@ func (m *MsgCreateIndexingNode) Size() (n int) { return n } -func (m *MsgCreateIndexingNodeResponse) Size() (n int) { +func (m *MsgCreateMetaNodeResponse) Size() (n int) { if m == nil { return 0 } @@ -2110,13 +2110,13 @@ func (m *MsgRemoveResourceNodeResponse) Size() (n int) { return n } -func (m *MsgRemoveIndexingNode) Size() (n int) { +func (m *MsgRemoveMetaNode) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.IndexingNodeAddress) + l = len(m.MetaNodeAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2127,7 +2127,7 @@ func (m *MsgRemoveIndexingNode) Size() (n int) { return n } -func (m *MsgRemoveIndexingNodeResponse) Size() (n int) { +func (m *MsgRemoveMetaNodeResponse) Size() (n int) { if m == nil { return 0 } @@ -2168,7 +2168,7 @@ func (m *MsgUpdateResourceNodeResponse) Size() (n int) { return n } -func (m *MsgUpdateIndexingNode) Size() (n int) { +func (m *MsgUpdateMetaNode) Size() (n int) { if m == nil { return 0 } @@ -2187,7 +2187,7 @@ func (m *MsgUpdateIndexingNode) Size() (n int) { return n } -func (m *MsgUpdateIndexingNodeResponse) Size() (n int) { +func (m *MsgUpdateMetaNodeResponse) Size() (n int) { if m == nil { return 0 } @@ -2229,7 +2229,7 @@ func (m *MsgUpdateResourceNodeStakeResponse) Size() (n int) { return n } -func (m *MsgUpdateIndexingNodeStake) Size() (n int) { +func (m *MsgUpdateMetaNodeStake) Size() (n int) { if m == nil { return 0 } @@ -2253,7 +2253,7 @@ func (m *MsgUpdateIndexingNodeStake) Size() (n int) { return n } -func (m *MsgUpdateIndexingNodeStakeResponse) Size() (n int) { +func (m *MsgUpdateMetaNodeStakeResponse) Size() (n int) { if m == nil { return 0 } @@ -2262,7 +2262,7 @@ func (m *MsgUpdateIndexingNodeStakeResponse) Size() (n int) { return n } -func (m *MsgIndexingNodeRegistrationVote) Size() (n int) { +func (m *MsgMetaNodeRegistrationVote) Size() (n int) { if m == nil { return 0 } @@ -2290,7 +2290,7 @@ func (m *MsgIndexingNodeRegistrationVote) Size() (n int) { return n } -func (m *MsgIndexingNodeRegistrationVoteResponse) Size() (n int) { +func (m *MsgMetaNodeRegistrationVoteResponse) Size() (n int) { if m == nil { return 0 } @@ -2606,7 +2606,7 @@ func (m *MsgCreateResourceNodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateIndexingNode) Unmarshal(dAtA []byte) error { +func (m *MsgCreateMetaNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2629,10 +2629,10 @@ func (m *MsgCreateIndexingNode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateIndexingNode: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateMetaNode: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateIndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateMetaNode: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2825,7 +2825,7 @@ func (m *MsgCreateIndexingNode) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateIndexingNodeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateMetaNodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2848,10 +2848,10 @@ func (m *MsgCreateIndexingNodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateIndexingNodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateMetaNodeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateIndexingNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateMetaNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3039,7 +3039,7 @@ func (m *MsgRemoveResourceNodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRemoveIndexingNode) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveMetaNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3062,15 +3062,15 @@ func (m *MsgRemoveIndexingNode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRemoveIndexingNode: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveMetaNode: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveIndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveMetaNode: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexingNodeAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaNodeAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3098,7 +3098,7 @@ func (m *MsgRemoveIndexingNode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.IndexingNodeAddress = string(dAtA[iNdEx:postIndex]) + m.MetaNodeAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -3153,7 +3153,7 @@ func (m *MsgRemoveIndexingNode) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRemoveIndexingNodeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveMetaNodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3176,10 +3176,10 @@ func (m *MsgRemoveIndexingNodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRemoveIndexingNodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveMetaNodeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveIndexingNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveMetaNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3432,7 +3432,7 @@ func (m *MsgUpdateResourceNodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateIndexingNode) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateMetaNode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3455,10 +3455,10 @@ func (m *MsgUpdateIndexingNode) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateIndexingNode: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateMetaNode: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateIndexingNode: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateMetaNode: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3579,7 +3579,7 @@ func (m *MsgUpdateIndexingNode) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateIndexingNodeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateMetaNodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3602,10 +3602,10 @@ func (m *MsgUpdateIndexingNodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateIndexingNodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateMetaNodeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateIndexingNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateMetaNodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3849,7 +3849,7 @@ func (m *MsgUpdateResourceNodeStakeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateIndexingNodeStake) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateMetaNodeStake) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3872,10 +3872,10 @@ func (m *MsgUpdateIndexingNodeStake) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateIndexingNodeStake: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateMetaNodeStake: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateIndexingNodeStake: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateMetaNodeStake: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4019,7 +4019,7 @@ func (m *MsgUpdateIndexingNodeStake) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateIndexingNodeStakeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateMetaNodeStakeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4042,10 +4042,10 @@ func (m *MsgUpdateIndexingNodeStakeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateIndexingNodeStakeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateMetaNodeStakeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateIndexingNodeStakeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateMetaNodeStakeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4069,7 +4069,7 @@ func (m *MsgUpdateIndexingNodeStakeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgIndexingNodeRegistrationVote) Unmarshal(dAtA []byte) error { +func (m *MsgMetaNodeRegistrationVote) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4092,10 +4092,10 @@ func (m *MsgIndexingNodeRegistrationVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgIndexingNodeRegistrationVote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMetaNodeRegistrationVote: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIndexingNodeRegistrationVote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMetaNodeRegistrationVote: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4267,7 +4267,7 @@ func (m *MsgIndexingNodeRegistrationVote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgIndexingNodeRegistrationVoteResponse) Unmarshal(dAtA []byte) error { +func (m *MsgMetaNodeRegistrationVoteResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4290,10 +4290,10 @@ func (m *MsgIndexingNodeRegistrationVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgIndexingNodeRegistrationVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMetaNodeRegistrationVoteResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIndexingNodeRegistrationVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMetaNodeRegistrationVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/register/types/tx.pb.gw.go b/x/register/types/tx.pb.gw.go index 8f78dbfa..670114d1 100644 --- a/x/register/types/tx.pb.gw.go +++ b/x/register/types/tx.pb.gw.go @@ -176,181 +176,181 @@ func local_request_Msg_HandleMsgUpdateResourceNodeStake_0(ctx context.Context, m } var ( - filter_Msg_HandleMsgCreateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgCreateMetaNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_HandleMsgCreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgCreateIndexingNode +func request_Msg_HandleMsgCreateMetaNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateMetaNode 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_Msg_HandleMsgCreateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgCreateMetaNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.HandleMsgCreateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgCreateMetaNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_HandleMsgCreateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgCreateIndexingNode +func local_request_Msg_HandleMsgCreateMetaNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateMetaNode 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_Msg_HandleMsgCreateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgCreateMetaNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.HandleMsgCreateIndexingNode(ctx, &protoReq) + msg, err := server.HandleMsgCreateMetaNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_HandleMsgRemoveIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgRemoveMetaNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_HandleMsgRemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgRemoveIndexingNode +func request_Msg_HandleMsgRemoveMetaNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveMetaNode 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_Msg_HandleMsgRemoveIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgRemoveMetaNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.HandleMsgRemoveIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgRemoveMetaNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_HandleMsgRemoveIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgRemoveIndexingNode +func local_request_Msg_HandleMsgRemoveMetaNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRemoveMetaNode 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_Msg_HandleMsgRemoveIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgRemoveMetaNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.HandleMsgRemoveIndexingNode(ctx, &protoReq) + msg, err := server.HandleMsgRemoveMetaNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_HandleMsgUpdateIndexingNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgUpdateMetaNode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_HandleMsgUpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgUpdateIndexingNode +func request_Msg_HandleMsgUpdateMetaNode_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateMetaNode 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_Msg_HandleMsgUpdateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateMetaNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.HandleMsgUpdateIndexingNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgUpdateMetaNode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_HandleMsgUpdateIndexingNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgUpdateIndexingNode +func local_request_Msg_HandleMsgUpdateMetaNode_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateMetaNode 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_Msg_HandleMsgUpdateIndexingNode_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateMetaNode_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.HandleMsgUpdateIndexingNode(ctx, &protoReq) + msg, err := server.HandleMsgUpdateMetaNode(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_HandleMsgUpdateIndexingNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgUpdateMetaNodeStake_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgUpdateIndexingNodeStake +func request_Msg_HandleMsgUpdateMetaNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateMetaNodeStake 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_Msg_HandleMsgUpdateIndexingNodeStake_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateMetaNodeStake_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.HandleMsgUpdateIndexingNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgUpdateMetaNodeStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgUpdateIndexingNodeStake +func local_request_Msg_HandleMsgUpdateMetaNodeStake_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgUpdateMetaNodeStake 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_Msg_HandleMsgUpdateIndexingNodeStake_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgUpdateMetaNodeStake_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.HandleMsgUpdateIndexingNodeStake(ctx, &protoReq) + msg, err := server.HandleMsgUpdateMetaNodeStake(ctx, &protoReq) return msg, metadata, err } var ( - filter_Msg_HandleMsgIndexingNodeRegistrationVote_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Msg_HandleMsgMetaNodeRegistrationVote_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgIndexingNodeRegistrationVote +func request_Msg_HandleMsgMetaNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgMetaNodeRegistrationVote 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_Msg_HandleMsgIndexingNodeRegistrationVote_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgMetaNodeRegistrationVote_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.HandleMsgIndexingNodeRegistrationVote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.HandleMsgMetaNodeRegistrationVote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgIndexingNodeRegistrationVote +func local_request_Msg_HandleMsgMetaNodeRegistrationVote_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgMetaNodeRegistrationVote 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_Msg_HandleMsgIndexingNodeRegistrationVote_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_HandleMsgMetaNodeRegistrationVote_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.HandleMsgIndexingNodeRegistrationVote(ctx, &protoReq) + msg, err := server.HandleMsgMetaNodeRegistrationVote(ctx, &protoReq) return msg, metadata, err } @@ -441,7 +441,7 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server }) - mux.Handle("POST", pattern_Msg_HandleMsgCreateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgCreateMetaNode_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) @@ -450,18 +450,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_HandleMsgCreateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgCreateMetaNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgCreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgCreateMetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgRemoveIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgRemoveMetaNode_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) @@ -470,18 +470,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_HandleMsgRemoveIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgRemoveMetaNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgRemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgRemoveMetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateMetaNode_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) @@ -490,18 +490,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_HandleMsgUpdateIndexingNode_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgUpdateMetaNode_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgUpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateMetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateMetaNodeStake_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) @@ -510,18 +510,18 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_HandleMsgUpdateIndexingNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgUpdateMetaNodeStake_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateMetaNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgIndexingNodeRegistrationVote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgMetaNodeRegistrationVote_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) @@ -530,14 +530,14 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Msg_HandleMsgIndexingNodeRegistrationVote_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Msg_HandleMsgMetaNodeRegistrationVote_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgMetaNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -662,7 +662,7 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client }) - mux.Handle("POST", pattern_Msg_HandleMsgCreateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgCreateMetaNode_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) @@ -671,18 +671,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_HandleMsgCreateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgCreateMetaNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgCreateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgCreateMetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgRemoveIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgRemoveMetaNode_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) @@ -691,18 +691,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_HandleMsgRemoveIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgRemoveMetaNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgRemoveIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgRemoveMetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateMetaNode_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) @@ -711,18 +711,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_HandleMsgUpdateIndexingNode_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgUpdateMetaNode_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgUpdateIndexingNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateMetaNode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgUpdateIndexingNodeStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgUpdateMetaNodeStake_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) @@ -731,18 +731,18 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_HandleMsgUpdateIndexingNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgUpdateMetaNodeStake_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgUpdateIndexingNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgUpdateMetaNodeStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Msg_HandleMsgIndexingNodeRegistrationVote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Msg_HandleMsgMetaNodeRegistrationVote_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) @@ -751,14 +751,14 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Msg_HandleMsgIndexingNodeRegistrationVote_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Msg_HandleMsgMetaNodeRegistrationVote_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Msg_HandleMsgIndexingNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Msg_HandleMsgMetaNodeRegistrationVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -774,15 +774,15 @@ var ( pattern_Msg_HandleMsgUpdateResourceNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_resource_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_HandleMsgCreateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgCreateMetaNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "create_meta_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_HandleMsgRemoveIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgRemoveMetaNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "remove_meta_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_HandleMsgUpdateIndexingNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgUpdateMetaNode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_meta_node"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_HandleMsgUpdateIndexingNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_indexing_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgUpdateMetaNodeStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "update_meta_node_stake"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Msg_HandleMsgIndexingNodeRegistrationVote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "indexing_node_registration_vote"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_HandleMsgMetaNodeRegistrationVote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stratos", "register", "v1", "meta_node_registration_vote"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -794,13 +794,13 @@ var ( forward_Msg_HandleMsgUpdateResourceNodeStake_0 = runtime.ForwardResponseMessage - forward_Msg_HandleMsgCreateIndexingNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgCreateMetaNode_0 = runtime.ForwardResponseMessage - forward_Msg_HandleMsgRemoveIndexingNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgRemoveMetaNode_0 = runtime.ForwardResponseMessage - forward_Msg_HandleMsgUpdateIndexingNode_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgUpdateMetaNode_0 = runtime.ForwardResponseMessage - forward_Msg_HandleMsgUpdateIndexingNodeStake_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgUpdateMetaNodeStake_0 = runtime.ForwardResponseMessage - forward_Msg_HandleMsgIndexingNodeRegistrationVote_0 = runtime.ForwardResponseMessage + forward_Msg_HandleMsgMetaNodeRegistrationVote_0 = runtime.ForwardResponseMessage ) diff --git a/x/register/types/unbonding_node.go b/x/register/types/unbonding_node.go index 74e9b89a..b7055fd1 100644 --- a/x/register/types/unbonding_node.go +++ b/x/register/types/unbonding_node.go @@ -17,14 +17,14 @@ func (e UnbondingNodeEntry) IsMature(currentTime time.Time) bool { } // NewUnbondingNode - create a new unbonding Node object -func NewUnbondingNode(networkAddr stratos.SdsAddress, isIndexingNode bool, creationHeight int64, minTime time.Time, +func NewUnbondingNode(networkAddr stratos.SdsAddress, isMetaNode bool, creationHeight int64, minTime time.Time, balance sdk.Int) UnbondingNode { entry := NewUnbondingNodeEntry(creationHeight, minTime, balance) return UnbondingNode{ - NetworkAddr: networkAddr.String(), - IsIndexingNode: isIndexingNode, - Entries: []*UnbondingNodeEntry{&entry}, + NetworkAddr: networkAddr.String(), + IsMetaNode: isMetaNode, + Entries: []*UnbondingNodeEntry{&entry}, } } diff --git a/x/sds/client/rest/rest_test.go b/x/sds/client/rest/rest_test.go index 0254ab91..1eddcdc1 100644 --- a/x/sds/client/rest/rest_test.go +++ b/x/sds/client/rest/rest_test.go @@ -1,38 +1,38 @@ package rest -import ( - "bytes" - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/libs/bech32" - "testing" -) - -func TestAccAddrPrefix(t *testing.T) { - - hexStr := "c03661732294feb49caf6dc16c7cbb2534986d73" - acc, err := sdk.AccAddressFromHex(hexStr) - - bech, err := bech32.ConvertAndEncode("st", acc.Bytes()) - - if err != nil { - t.Error(err) - } - - // accAddr in bech32 is in form of "st1cqmxzuezjnltf890dhqkcl9my56fsmtnunn4z4", - // where "st" is the hrp (human-reading prefix) and the last 4 digits work as checksum - fmt.Println(bech) - hrp, data, err := bech32.DecodeAndConvert(bech) - - if err != nil { - t.Error(err) - } - if hrp != "st" { - t.Error("Invalid hrp") - } - if !bytes.Equal(data, acc.Bytes()) { - t.Error("Invalid decode") - } - fmt.Println(hrp) - fmt.Println(data) -} +//import ( +// "bytes" +// "fmt" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/tendermint/tendermint/libs/bech32" +// "testing" +//) +// +//func TestAccAddrPrefix(t *testing.T) { +// +// hexStr := "c03661732294feb49caf6dc16c7cbb2534986d73" +// acc, err := sdk.AccAddressFromHex(hexStr) +// +// bech, err := bech32.ConvertAndEncode("st", acc.Bytes()) +// +// if err != nil { +// t.Error(err) +// } +// +// // accAddr in bech32 is in form of "st1cqmxzuezjnltf890dhqkcl9my56fsmtnunn4z4", +// // where "st" is the hrp (human-reading prefix) and the last 4 digits work as checksum +// fmt.Println(bech) +// hrp, data, err := bech32.DecodeAndConvert(bech) +// +// if err != nil { +// t.Error(err) +// } +// if hrp != "st" { +// t.Error("Invalid hrp") +// } +// if !bytes.Equal(data, acc.Bytes()) { +// t.Error("Invalid decode") +// } +// fmt.Println(hrp) +// fmt.Println(data) +//} diff --git a/x/sds/keeper/msg_server.go b/x/sds/keeper/msg_server.go index 97c5fcc1..307aff24 100644 --- a/x/sds/keeper/msg_server.go +++ b/x/sds/keeper/msg_server.go @@ -30,7 +30,7 @@ func (k msgServer) HandleMsgFileUpload(c context.Context, msg *types.MsgFileUplo return &types.MsgFileUploadResponse{}, err } - if _, found := k.RegisterKeeper.GetIndexingNode(ctx, reporter); found == false { + if _, found := k.RegisterKeeper.GetMetaNode(ctx, reporter); found == false { return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "Reporter %s isn't an SP node", msg.GetReporter()) } height := sdk.NewInt(ctx.BlockHeight()) From 9f681c375debcbe50ec4d61f9241628881725e4d Mon Sep 17 00:00:00 2001 From: jialbai Date: Thu, 2 Jun 2022 17:24:49 -0400 Subject: [PATCH 089/113] - qb-1165: fix prepay tx --- x/sds/types/msg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/sds/types/msg.go b/x/sds/types/msg.go index b07cebcd..16e0e4ae 100644 --- a/x/sds/types/msg.go +++ b/x/sds/types/msg.go @@ -97,7 +97,7 @@ func (msg MsgPrepay) GetSignBytes() []byte { // ValidateBasic validity check for the AnteHandler func (msg MsgPrepay) ValidateBasic() error { - sender, err := stratos.SdsAddressFromBech32(msg.GetSender()) + sender, err := sdk.AccAddressFromBech32(msg.GetSender()) if err != nil { return err } From 4ba4bb8f22f2757be1bb2d00d543b052ca5e9e2c Mon Sep 17 00:00:00 2001 From: jialbai Date: Thu, 2 Jun 2022 19:19:46 -0400 Subject: [PATCH 090/113] - qb-1165: fix file-upload tx and query (via cmd line) --- x/sds/keeper/grpc_query.go | 4 ++-- x/sds/types/msg.go | 12 +++++++++++- x/sds/types/uploaded_file.go | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/x/sds/keeper/grpc_query.go b/x/sds/keeper/grpc_query.go index c839fc9d..e341ec2d 100644 --- a/x/sds/keeper/grpc_query.go +++ b/x/sds/keeper/grpc_query.go @@ -28,11 +28,11 @@ func (q Querier) Fileupload(c context.Context, req *types.QueryFileUploadRequest ctx := sdk.UnwrapSDKContext(c) - fileHashByteArr, err := hex.DecodeString(req.GetFileHash()) + _, err := hex.DecodeString(req.GetFileHash()) if err != nil { return &types.QueryFileUploadResponse{}, fmt.Errorf("invalid file hash, please specify a hash in hex format %w", err) } - fileInfoBytes, err := q.GetFileInfoBytesByFileHash(ctx, fileHashByteArr) + fileInfoBytes, err := q.GetFileInfoBytesByFileHash(ctx, []byte(req.GetFileHash())) if err != nil { return &types.QueryFileUploadResponse{}, err } diff --git a/x/sds/types/msg.go b/x/sds/types/msg.go index 16e0e4ae..bec0720b 100644 --- a/x/sds/types/msg.go +++ b/x/sds/types/msg.go @@ -1,6 +1,8 @@ package types import ( + "encoding/hex" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" stratos "github.com/stratosnet/stratos-chain/types" @@ -43,16 +45,24 @@ func (msg MsgFileUpload) GetSignBytes() []byte { // ValidateBasic validity check for the AnteHandler func (msg MsgFileUpload) ValidateBasic() error { + fileHashBytes, err := hex.DecodeString(msg.FileHash) + if err != nil { + return err + } + reporter, err := stratos.SdsAddressFromBech32(msg.GetReporter()) if err != nil { return err } - uploader, err := stratos.SdsAddressFromBech32(msg.GetUploader()) + uploader, err := sdk.AccAddressFromBech32(msg.GetUploader()) if err != nil { return err } + if len(fileHashBytes) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing file hash") + } if reporter.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing address of tx reporter") } diff --git a/x/sds/types/uploaded_file.go b/x/sds/types/uploaded_file.go index 0682e08e..e89fee26 100644 --- a/x/sds/types/uploaded_file.go +++ b/x/sds/types/uploaded_file.go @@ -16,7 +16,7 @@ func NewFileInfo(height *sdk.Int, reporter, uploader string) FileInfo { // MustMarshalFileInfo returns the fileInfo's bytes. Panics if fails func MustMarshalFileInfo(cdc codec.Codec, file FileInfo) []byte { - return cdc.MustMarshalLengthPrefixed(&file) + return cdc.MustMarshal(&file) } // MustUnmarshalFileInfo unmarshal a file's info from a store value. Panics if fails @@ -30,6 +30,6 @@ func MustUnmarshalFileInfo(cdc codec.Codec, value []byte) FileInfo { // UnmarshalFileInfo unmarshal a file's info from a store value func UnmarshalFileInfo(cdc codec.Codec, value []byte) (fi FileInfo, err error) { - err = cdc.UnmarshalLengthPrefixed(value, &fi) + err = cdc.Unmarshal(value, &fi) return fi, err } From 89a27d0977d4989abfa3a596ba126525317b3660 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 3 Jun 2022 09:47:29 -0400 Subject: [PATCH 091/113] completed register rest queries --- x/register/client/rest/query.go | 10 ++-- x/register/keeper/grpc_query.go | 4 +- .../keeper/{indexing_node.go => meta_node.go} | 0 x/register/keeper/querier.go | 46 +++++++++---------- x/register/types/querier.go | 21 ++++++++- 5 files changed, 51 insertions(+), 30 deletions(-) rename x/register/keeper/{indexing_node.go => meta_node.go} (100%) diff --git a/x/register/client/rest/query.go b/x/register/client/rest/query.go index 947dbd26..ae69409c 100644 --- a/x/register/client/rest/query.go +++ b/x/register/client/rest/query.go @@ -161,7 +161,6 @@ func nodeStakingByNodeAddressFn(cliCtx client.Context, queryPath string) http.Ha rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - cliCtx = cliCtx.WithHeight(height) if rest.CheckInternalServerError(w, err) { return @@ -174,8 +173,8 @@ func nodeStakingByNodeAddressFn(cliCtx client.Context, queryPath string) http.Ha func nodeStakingByOwnerFn(cliCtx client.Context, queryPath string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - nodeWalletAddressStr := mux.Vars(r)["ownerAddress"] - nodeWalletAddress, ok := keeper.CheckAccAddr(w, r, nodeWalletAddressStr) + ownerAddressStr := mux.Vars(r)["ownerAddress"] + ownerAddress, ok := keeper.CheckAccAddr(w, r, ownerAddressStr) if !ok { return } @@ -190,7 +189,7 @@ func nodeStakingByOwnerFn(cliCtx client.Context, queryPath string) http.HandlerF return } - params := types.NewQueryNodesParams(page, limit, nil, "", nodeWalletAddress) + params := types.NewQueryNodesParams(page, limit, nil, "", ownerAddress) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { return @@ -203,6 +202,9 @@ func nodeStakingByOwnerFn(cliCtx client.Context, queryPath string) http.HandlerF } cliCtx = cliCtx.WithHeight(height) + if rest.CheckInternalServerError(w, err) { + return + } rest.PostProcessResponse(w, cliCtx, res) } } diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index cbd56816..4f7219fd 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -180,9 +180,9 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq params = types.NewQueryNodesParams(page, int(req.Pagination.Limit), networkAddr, req.GetMoniker(), ownerAddr) resNodes := q.GetResourceNodesFiltered(ctx, params) - indNodes := q.GetMetaNodesFiltered(ctx, params) + metaNodes := q.GetMetaNodesFiltered(ctx, params) - for _, n := range indNodes { + for _, n := range metaNodes { networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( ctx, diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/meta_node.go similarity index 100% rename from x/register/keeper/indexing_node.go rename to x/register/keeper/meta_node.go diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 48147a88..7eeb8bd2 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -233,7 +233,7 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, var ( params types.QueryNodesParams stakingInfo types.StakingInfo - stakingInfos []types.StakingInfo + stakingInfos types.StakingInfos ) err = legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) @@ -243,20 +243,20 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, resNodes := k.GetResourceNodesFiltered(ctx, params) metaNodes := k.GetMetaNodesFiltered(ctx, params) - for _, n := range metaNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) + for i, _ := range metaNodes { + networkAddr, _ := stratos.SdsAddressFromBech32(metaNodes[i].GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, - n.GetStatus(), + metaNodes[i].GetStatus(), networkAddr, - n.Tokens, + metaNodes[i].Tokens, ) if err != nil { return nil, err } - if !n.Equal(types.MetaNode{}) { + if !metaNodes[i].Equal(types.MetaNode{}) { stakingInfo = types.NewStakingInfoByMetaNodeAddr( - n, + metaNodes[i], unBondingStake, unBondedStake, bondedStake, @@ -265,20 +265,20 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, } } - for _, n := range resNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) + for i, _ := range resNodes { + networkAddr, _ := stratos.SdsAddressFromBech32(resNodes[i].GetNetworkAddress()) unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( ctx, - n.GetStatus(), + resNodes[i].GetStatus(), networkAddr, - n.Tokens, + resNodes[i].Tokens, ) if err != nil { return nil, err } - if !n.Equal(types.ResourceNode{}) { + if !resNodes[i].Equal(types.ResourceNode{}) { stakingInfo = types.NewStakingInfoByResourceNodeAddr( - n, + resNodes[i], unBondingStake, unBondedStake, bondedStake, @@ -344,9 +344,9 @@ func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesPar nodes := k.GetAllMetaNodes(ctx) filteredNodes := make([]types.MetaNode, 0, len(nodes)) - for _, n := range nodes { + for i, _ := range nodes { // match NetworkAddr (if supplied) - nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) + nodeNetworkAddr, er := stratos.SdsAddressFromBech32(nodes[i].GetNetworkAddress()) if er != nil { continue } @@ -358,18 +358,18 @@ func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesPar // match Moniker (if supplied) if len(params.Moniker) > 0 { - if strings.Compare(n.Description.Moniker, params.Moniker) != 0 { + if strings.Compare(nodes[i].Description.Moniker, params.Moniker) != 0 { continue } } // match OwnerAddr (if supplied) - nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddress()) + nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) if er != nil { continue } if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, n) + filteredNodes = append(filteredNodes, nodes[i]) } } return filteredNodes @@ -379,9 +379,9 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode nodes := k.GetAllResourceNodes(ctx) filteredNodes := make([]types.ResourceNode, 0, len(nodes)) - for _, n := range nodes { + for i, _ := range nodes { // match NetworkAddr (if supplied) - nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) + nodeNetworkAddr, er := stratos.SdsAddressFromBech32(nodes[i].GetNetworkAddress()) if er != nil { continue } @@ -393,18 +393,18 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode // match Moniker (if supplied) if len(params.Moniker) > 0 { - if strings.Compare(n.Description.Moniker, params.Moniker) != 0 { + if strings.Compare(nodes[i].Description.Moniker, params.Moniker) != 0 { continue } } // match OwnerAddr (if supplied) - nodeOwnerAddr, er := sdk.AccAddressFromBech32(n.GetNetworkAddress()) + nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) if er != nil { continue } if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, n) + filteredNodes = append(filteredNodes, nodes[i]) } } return filteredNodes diff --git a/x/register/types/querier.go b/x/register/types/querier.go index 050eddbe..bfd1c918 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -1,6 +1,8 @@ package types import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" ) @@ -34,7 +36,7 @@ func NewQueryNodesParams(page, limit int, networkAddr stratos.SdsAddress, monike type QueryNodeStakingParams struct { AccAddr stratos.SdsAddress - QueryType int64 //0:All(Default) 1: metaNode; 2: ResourceNode + QueryType int64 //0:All(Default) 1: MetaNode; 2: ResourceNode } // NewQueryNodeStakingParams creates a new instance of QueryNodesParams @@ -115,3 +117,20 @@ func NewStakingInfoByMetaNodeAddr( BondedStake: &bonedValue, } } + +type StakingInfos []StakingInfo + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (v StakingInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(v.Pubkey, &pk) +} + +func (v StakingInfos) UnpackInterfaces(c codectypes.AnyUnpacker) error { + for i := range v { + if err := v[i].UnpackInterfaces(c); err != nil { + return err + } + } + return nil +} From 45dff7e3789104df0dc2d85aed08abd1d2e052fe Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 3 Jun 2022 13:52:01 -0400 Subject: [PATCH 092/113] - qb-1165: fix export related logic of sds/FileUpload --- x/register/genesis.go | 15 --------------- x/sds/keeper/keeper.go | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/x/register/genesis.go b/x/register/genesis.go index 75040dcc..8b318049 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -43,14 +43,6 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } keeper.SetMetaNode(ctx, metaNode) } - err = keeper.MintMetaNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeBondedToken)) - if err != nil { - panic(err) - } - err = keeper.MintMetaNodeNotBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), idxNodeNotBondedToken)) - if err != nil { - panic(err) - } totalUnissuedPrepay := data.TotalUnissuedPrepay initialUOzonePrice := sdk.ZeroDec() @@ -59,13 +51,6 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetInitialUOzonePrice(ctx, initialUOzonePrice) initOzoneLimit := initialStakeTotal.Add(totalUnissuedPrepay).ToDec().Quo(initialUOzonePrice).TruncateInt() keeper.SetRemainingOzoneLimit(ctx, initOzoneLimit) - err = keeper.MintTotalUnissuedPrepayPool(ctx, sdk.Coin{ - Denom: data.Params.BondDenom, - Amount: totalUnissuedPrepay, - }) - if err != nil { - panic(err) - } for _, slashing := range data.Slashing { walletAddress, err := sdk.AccAddressFromBech32(slashing.GetWalletAddress()) diff --git a/x/sds/keeper/keeper.go b/x/sds/keeper/keeper.go index cd623964..bb6c3dc2 100644 --- a/x/sds/keeper/keeper.go +++ b/x/sds/keeper/keeper.go @@ -240,7 +240,7 @@ func (k Keeper) IterateFileUpload(ctx sdk.Context, handler func(string, types.Fi for ; iter.Valid(); iter.Next() { fileHash := string(iter.Key()[len(types.FileStoreKeyPrefix):]) var fileInfo types.FileInfo - k.cdc.MustUnmarshalLengthPrefixed(iter.Value(), &fileInfo) + k.cdc.MustUnmarshal(iter.Value(), &fileInfo) if handler(fileHash, fileInfo) { break } From e63abdffde42796cf501d99d2649bd41a2474b6d Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 3 Jun 2022 16:42:04 -0400 Subject: [PATCH 093/113] - qb-1165: remove dup KV of pools (bonded/notbonded), now module accs working as alternatives - qb-1165: remove total_unissued_prepay from register/genesisState (same logic impl by module acc) --- proto/stratos/register/v1/genesis.proto | 7 +- x/register/genesis.go | 30 +---- x/register/types/genesis.go | 27 ++--- x/register/types/genesis.pb.go | 153 ++++++++---------------- 4 files changed, 69 insertions(+), 148 deletions(-) diff --git a/proto/stratos/register/v1/genesis.proto b/proto/stratos/register/v1/genesis.proto index fead986e..db961ae9 100644 --- a/proto/stratos/register/v1/genesis.proto +++ b/proto/stratos/register/v1/genesis.proto @@ -34,12 +34,7 @@ message GenesisState { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; //initial price of uoz - string total_unissued_prepay = 5 [ - (gogoproto.moretags) = "yaml:\"total_unissued_prepay\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - repeated register.v1.Slashing slashing = 6 [ (gogoproto.moretags) = "yaml:\"slashing_info\"" ]; + repeated register.v1.Slashing slashing = 5 [ (gogoproto.moretags) = "yaml:\"slashing_info\"" ]; } message GenesisMetaNode { diff --git a/x/register/genesis.go b/x/register/genesis.go index 8b318049..7cff9ed7 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -13,38 +13,22 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetParams(ctx, *data.Params) initialStakeTotal := sdk.ZeroInt() - resNodeBondedToken := sdk.ZeroInt() - resNodeNotBondedToken := sdk.ZeroInt() for _, resourceNode := range data.GetResourceNodes() { if resourceNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(resourceNode.Tokens) - resNodeBondedToken = resNodeBondedToken.Add(resourceNode.Tokens) } else if resourceNode.GetStatus() == stakingtypes.Unbonded { - resNodeNotBondedToken = resNodeNotBondedToken.Add(resourceNode.Tokens) } keeper.SetResourceNode(ctx, resourceNode) } - err := keeper.MintResourceNodeBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeBondedToken)) - if err != nil { - panic(err) - } - err = keeper.MintResourceNodeNotBondedTokenPool(ctx, sdk.NewCoin(keeper.BondDenom(ctx), resNodeNotBondedToken)) - if err != nil { - panic(err) - } - idxNodeBondedToken := sdk.ZeroInt() - idxNodeNotBondedToken := sdk.ZeroInt() for _, metaNode := range data.GetMetaNodes() { if metaNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(metaNode.Tokens) - idxNodeBondedToken = idxNodeBondedToken.Add(metaNode.Tokens) } else if metaNode.GetStatus() == stakingtypes.Unbonded { - idxNodeNotBondedToken = idxNodeNotBondedToken.Add(metaNode.Tokens) } keeper.SetMetaNode(ctx, metaNode) } - totalUnissuedPrepay := data.TotalUnissuedPrepay + totalUnissuedPrepay := keeper.GetTotalUnissuedPrepay(ctx).Amount initialUOzonePrice := sdk.ZeroDec() initialUOzonePrice = initialUOzonePrice.Add(data.InitialUozPrice) keeper.SetInitialGenesisStakeTotal(ctx, initialStakeTotal) @@ -71,7 +55,6 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisSt resourceNodes := keeper.GetAllResourceNodes(ctx) metaNodes := keeper.GetAllMetaNodes(ctx) - totalUnissuedPrepay := keeper.GetTotalUnissuedPrepay(ctx).Amount initialUOzonePrice := keeper.CurrUozPrice(ctx) var slashingInfo []*types.Slashing @@ -84,11 +67,10 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisSt }) return &types.GenesisState{ - Params: ¶ms, - ResourceNodes: resourceNodes, - MetaNodes: metaNodes, - InitialUozPrice: initialUOzonePrice, - TotalUnissuedPrepay: totalUnissuedPrepay, - Slashing: slashingInfo, + Params: ¶ms, + ResourceNodes: resourceNodes, + MetaNodes: metaNodes, + InitialUozPrice: initialUOzonePrice, + Slashing: slashingInfo, } } diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index e564adc7..a39148a8 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -14,28 +14,25 @@ func NewGenesisState(params *Params, resourceNodes ResourceNodes, metaNodes MetaNodes, initialUOzonePrice sdk.Dec, - totalUnissuedPrepay sdk.Int, slashingInfo []*Slashing, ) GenesisState { return GenesisState{ - Params: params, - ResourceNodes: resourceNodes, - MetaNodes: metaNodes, - InitialUozPrice: initialUOzonePrice, - TotalUnissuedPrepay: totalUnissuedPrepay, - Slashing: slashingInfo, + Params: params, + ResourceNodes: resourceNodes, + MetaNodes: metaNodes, + InitialUozPrice: initialUOzonePrice, + Slashing: slashingInfo, } } // DefaultGenesisState - default GenesisState used by Cosmos Hub func DefaultGenesisState() *GenesisState { return &GenesisState{ - Params: DefaultParams(), - ResourceNodes: ResourceNodes{}, - MetaNodes: MetaNodes{}, - InitialUozPrice: DefaultUozPrice, - TotalUnissuedPrepay: DefaultTotalUnissuedPrepay, - Slashing: make([]*Slashing, 0), + Params: DefaultParams(), + ResourceNodes: ResourceNodes{}, + MetaNodes: MetaNodes{}, + InitialUozPrice: DefaultUozPrice, + Slashing: make([]*Slashing, 0), } } @@ -65,10 +62,6 @@ func ValidateGenesis(data GenesisState) error { if (data.InitialUozPrice).LTE(sdk.ZeroDec()) { return ErrInitialUOzonePrice } - - if data.TotalUnissuedPrepay.LT(sdk.ZeroInt()) { - return ErrInitialUOzonePrice - } return nil } diff --git a/x/register/types/genesis.pb.go b/x/register/types/genesis.pb.go index 8a52039b..7c1c8198 100644 --- a/x/register/types/genesis.pb.go +++ b/x/register/types/genesis.pb.go @@ -29,12 +29,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the register module's genesis state. type GenesisState struct { - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` - ResourceNodes ResourceNodes `protobuf:"bytes,2,rep,name=resource_nodes,json=resourceNodes,proto3,castrepeated=ResourceNodes" json:"resource_nodes" yaml:"resource_nodes"` - MetaNodes MetaNodes `protobuf:"bytes,3,rep,name=meta_nodes,json=metaNodes,proto3,castrepeated=MetaNodes" json:"meta_nodes" yaml:"meta_nodes"` - InitialUozPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=initial_uoz_price,json=initialUozPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initial_uoz_price" yaml:"initial_uoz_price"` - TotalUnissuedPrepay github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=total_unissued_prepay,json=totalUnissuedPrepay,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_unissued_prepay" yaml:"total_unissued_prepay"` - Slashing []*Slashing `protobuf:"bytes,6,rep,name=slashing,proto3" json:"slashing,omitempty" yaml:"slashing_info"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` + ResourceNodes ResourceNodes `protobuf:"bytes,2,rep,name=resource_nodes,json=resourceNodes,proto3,castrepeated=ResourceNodes" json:"resource_nodes" yaml:"resource_nodes"` + MetaNodes MetaNodes `protobuf:"bytes,3,rep,name=meta_nodes,json=metaNodes,proto3,castrepeated=MetaNodes" json:"meta_nodes" yaml:"meta_nodes"` + InitialUozPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=initial_uoz_price,json=initialUozPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"initial_uoz_price" yaml:"initial_uoz_price"` + Slashing []*Slashing `protobuf:"bytes,5,rep,name=slashing,proto3" json:"slashing,omitempty" yaml:"slashing_info"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -191,54 +190,52 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/genesis.proto", fileDescriptor_5bdab54ebea9e48e) } var fileDescriptor_5bdab54ebea9e48e = []byte{ - // 751 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x4e, 0xeb, 0x46, - 0x14, 0x8e, 0xf9, 0x09, 0x64, 0x20, 0x41, 0x98, 0x50, 0x19, 0xda, 0xc6, 0x61, 0x54, 0xa1, 0x54, - 0x02, 0x5b, 0xa1, 0x5d, 0x55, 0x6a, 0x25, 0x5c, 0xd4, 0xaa, 0xad, 0x40, 0x91, 0x23, 0x5a, 0xa9, - 0x9b, 0x68, 0x62, 0x0f, 0xc6, 0x4a, 0x3c, 0x63, 0x79, 0xc6, 0x01, 0xb3, 0xec, 0xaa, 0xcb, 0xbe, - 0x46, 0xbb, 0xee, 0x43, 0xa0, 0xae, 0x58, 0x56, 0x5d, 0xb8, 0x57, 0xf0, 0x06, 0x79, 0x82, 0xab, - 0xcc, 0x8c, 0x89, 0xb9, 0x37, 0xba, 0x12, 0x2b, 0xcf, 0x39, 0xe7, 0x3b, 0xdf, 0x37, 0x73, 0x7e, - 0x0c, 0x0e, 0x18, 0x4f, 0x10,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, 0xdb, 0x07, 0x1b, 0x3e, 0x66, 0x5e, 0x12, - 0xc6, 0x3c, 0xa4, 0xc4, 0x58, 0x13, 0x15, 0x6f, 0x2f, 0x9c, 0x8e, 0xb3, 0x39, 0xce, 0x69, 0xcf, - 0x07, 0xb1, 0x94, 0x0e, 0x8f, 0x68, 0x14, 0x72, 0x1c, 0xc5, 0x3c, 0x73, 0xcb, 0xb4, 0xce, 0xc5, - 0xfd, 0x63, 0x4b, 0x7b, 0x78, 0x6c, 0x69, 0x6f, 0x1e, 0x5b, 0xda, 0x1f, 0x4f, 0xad, 0xca, 0xc3, - 0x53, 0xab, 0xf2, 0xef, 0x53, 0xab, 0xf2, 0xeb, 0x97, 0xa5, 0xe7, 0x2b, 0x51, 0x82, 0x79, 0x71, - 0x3c, 0xf6, 0xae, 0x51, 0x48, 0xec, 0xdb, 0xf9, 0x2f, 0x51, 0x14, 0x64, 0x58, 0x15, 0xa3, 0xf0, - 0xc5, 0xdb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xd5, 0x28, 0x12, 0xdd, 0x05, 0x00, 0x00, + // 717 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdd, 0x4e, 0xdb, 0x48, + 0x14, 0xc7, 0x13, 0x3e, 0x02, 0x19, 0x48, 0x10, 0xde, 0xec, 0xca, 0xb0, 0xbb, 0x71, 0x18, 0xad, + 0x50, 0x56, 0x02, 0x5b, 0x61, 0xf7, 0x6a, 0xa5, 0xad, 0x84, 0x8b, 0x5a, 0xb5, 0x15, 0x08, 0x39, + 0x6a, 0x2b, 0xf5, 0x26, 0x9a, 0xd8, 0x83, 0xb1, 0x12, 0xcf, 0x58, 0x9e, 0x71, 0xc0, 0xdc, 0xf6, + 0x05, 0xfa, 0x1a, 0xed, 0x75, 0x1f, 0x02, 0xf5, 0x8a, 0xcb, 0xaa, 0x17, 0x6e, 0x05, 0x6f, 0xe0, + 0x27, 0xa8, 0x32, 0x33, 0x06, 0xd3, 0x46, 0x95, 0x7a, 0xe5, 0x39, 0x67, 0xfe, 0xe7, 0x77, 0xe6, + 0x9c, 0x39, 0x63, 0xb0, 0xc5, 0x78, 0x8c, 0x38, 0x65, 0x56, 0x8c, 0xfd, 0x80, 0x71, 0x1c, 0x5b, + 0x93, 0x9e, 0xe5, 0x63, 0x82, 0x59, 0xc0, 0xcc, 0x28, 0xa6, 0x9c, 0x6a, 0xbf, 0x28, 0x89, 0x59, + 0x48, 0xcc, 0x49, 0x6f, 0x73, 0xc3, 0xa7, 0xd4, 0x1f, 0x63, 0x4b, 0x48, 0x86, 0xc9, 0x89, 0x85, + 0x48, 0x2a, 0xf5, 0x9b, 0x2d, 0x9f, 0xfa, 0x54, 0x2c, 0xad, 0xe9, 0x4a, 0x79, 0x37, 0x5c, 0xca, + 0x42, 0xca, 0x06, 0x72, 0x43, 0x1a, 0x6a, 0xeb, 0x2f, 0x69, 0x59, 0x8c, 0xa3, 0x51, 0x40, 0x7c, + 0x6b, 0xd2, 0x1b, 0x62, 0x8e, 0x7a, 0x85, 0xad, 0x54, 0x70, 0xd6, 0x49, 0x6f, 0x8f, 0x24, 0x34, + 0xf0, 0xf5, 0x02, 0x58, 0x7d, 0x2c, 0x0f, 0xdf, 0xe7, 0x88, 0x63, 0xed, 0x11, 0xa8, 0x45, 0x28, + 0x46, 0x21, 0xd3, 0xab, 0x9d, 0x6a, 0x77, 0x65, 0xef, 0x77, 0x73, 0x46, 0x31, 0xe6, 0xb1, 0x90, + 0xd8, 0xeb, 0x79, 0x66, 0x34, 0x52, 0x14, 0x8e, 0xff, 0x83, 0x32, 0x08, 0x3a, 0x2a, 0x5a, 0x3b, + 0x07, 0xcd, 0x18, 0x33, 0x9a, 0xc4, 0x2e, 0x1e, 0x10, 0xea, 0x61, 0xa6, 0xcf, 0x75, 0xe6, 0xbb, + 0x2b, 0x7b, 0x5b, 0x33, 0x79, 0x8e, 0x92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b, 0x33, 0xa7, 0xe3, 0xe0, 0x4e, 0x67, 0x77, 0xf2, 0xcc, 0xf8, 0x43, 0xe2, + 0x4b, 0xe1, 0x70, 0x87, 0x86, 0x01, 0xc7, 0x61, 0xc4, 0x53, 0xa7, 0x8c, 0xb5, 0x8f, 0x2e, 0xaf, + 0xdb, 0xd5, 0xab, 0xeb, 0x76, 0xf5, 0xcb, 0x75, 0xbb, 0xfa, 0xe6, 0xa6, 0x5d, 0xb9, 0xba, 0x69, + 0x57, 0x3e, 0xde, 0xb4, 0x2b, 0xaf, 0xfe, 0x2d, 0x95, 0xaf, 0x92, 0x12, 0xcc, 0x8b, 0xe5, 0xae, + 0x7b, 0x8a, 0x02, 0x62, 0x9d, 0xdf, 0xfd, 0x8d, 0x44, 0x43, 0x86, 0x35, 0x31, 0x0a, 0xff, 0x7c, + 0x0d, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xe8, 0x8b, 0x98, 0x58, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -272,19 +269,9 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } } - { - size := m.TotalUnissuedPrepay.Size() - i -= size - if _, err := m.TotalUnissuedPrepay.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a { size := m.InitialUozPrice.Size() i -= size @@ -459,8 +446,6 @@ func (m *GenesisState) Size() (n int) { } l = m.InitialUozPrice.Size() n += 1 + l + sovGenesis(uint64(l)) - l = m.TotalUnissuedPrepay.Size() - n += 1 + l + sovGenesis(uint64(l)) if len(m.Slashing) > 0 { for _, e := range m.Slashing { l = e.Size() @@ -677,40 +662,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalUnissuedPrepay", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TotalUnissuedPrepay.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Slashing", wireType) } From 1aee26e1b858b9011f4ee85f4135a399cb41adfe Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 3 Jun 2022 23:59:45 -0400 Subject: [PATCH 094/113] finished testing and optimize register queries --- proto/stratos/register/v1/query.proto | 10 +- x/register/keeper/grpc_query.go | 156 +++++++----- x/register/keeper/querier.go | 333 +++++++++++++++++++++++--- x/register/types/query.pb.go | 217 +++++------------ 4 files changed, 454 insertions(+), 262 deletions(-) diff --git a/proto/stratos/register/v1/query.proto b/proto/stratos/register/v1/query.proto index 7b6f73bf..8658d0e9 100644 --- a/proto/stratos/register/v1/query.proto +++ b/proto/stratos/register/v1/query.proto @@ -85,11 +85,13 @@ message QueryStakeByNodeResponse { // QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method message QueryStakeByOwnerRequest { // owner_addr defines the owner address to query for. - string network_addr = 1; - string moniker = 2; - string owner_addr = 3; +// string network_addr = 1; +// string moniker = 2; + string owner_addr = 1; +// int64 page = 2; +// int64 limit = 3; // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 4; + cosmos.base.query.v1beta1.PageRequest pagination = 2; } // QueryStakeByOwnerResponse is response type for the Query/StakeByOwner RPC method diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index 4f7219fd..0f6dbf50 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -2,9 +2,9 @@ package keeper import ( "context" - "strconv" + "fmt" - "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" @@ -156,84 +156,108 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq } ctx := sdk.UnwrapSDKContext(c) - var ( - params types.QueryNodesParams - stakingInfo types.StakingInfo - stakingInfos []*types.StakingInfo - ) - - networkAddr, er := stratos.SdsAddressFromBech32(req.GetNetworkAddr()) - if er != nil { - return &types.QueryStakeByOwnerResponse{}, er - } + var metaNodes types.MetaNodes ownerAddr, er := sdk.AccAddressFromBech32(req.GetOwnerAddr()) if er != nil { return &types.QueryStakeByOwnerResponse{}, er } - page, er := strconv.Atoi(string(req.Pagination.Key)) - if er != nil { - return &types.QueryStakeByOwnerResponse{}, er - } + store := ctx.KVStore(q.storeKey) + resourceNodeStore := prefix.NewStore(store, types.MetaNodeKey) - params = types.NewQueryNodesParams(page, int(req.Pagination.Limit), networkAddr, req.GetMoniker(), ownerAddr) - - resNodes := q.GetResourceNodesFiltered(ctx, params) - metaNodes := q.GetMetaNodesFiltered(ctx, params) - - for _, n := range metaNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) - unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( - ctx, - n.GetStatus(), - networkAddr, - n.Tokens, - ) - if er != nil { - return nil, er - } - if !n.Equal(types.MetaNode{}) { - stakingInfo = types.NewStakingInfoByMetaNodeAddr( - n, - unBondingStake, - unBondedStake, - bondedStake, - ) - stakingInfos = append(stakingInfos, &stakingInfo) + pageRes, err := FilteredPaginate(q.cdc, resourceNodeStore, ownerAddr, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { + val, err := types.UnmarshalMetaNode(q.cdc, value) + if err != nil { + return false, err } - } - for _, n := range resNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) - unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( - ctx, - n.GetStatus(), - networkAddr, - n.Tokens, - ) - if er != nil { - return nil, er - } - if !n.Equal(types.ResourceNode{}) { - stakingInfo = types.NewStakingInfoByResourceNodeAddr( - n, - unBondingStake, - unBondedStake, - bondedStake, - ) - stakingInfos = append(stakingInfos, &stakingInfo) + if accumulate { + metaNodes = append(metaNodes, val) } + + return true, nil + }) + + if err != nil { + return &types.QueryStakeByOwnerResponse{}, status.Error(codes.Internal, err.Error()) } + fmt.Println("MetaNodes: ", metaNodes) - start, end := client.Paginate(len(stakingInfos), params.Page, params.Limit, QueryDefaultLimit) - if start < 0 || end < 0 { - return &types.QueryStakeByOwnerResponse{}, nil - } else { - stakingInfos = stakingInfos[start:end] - return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfos}, nil + stakingInfoResponses, err := StakingInfosToStakingInfoResponses(ctx, q.Keeper, metaNodes) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } + return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfoResponses, Pagination: pageRes}, nil + + //page := req.GetPage() + //if page == 0 { + // page = QueryDefaultPage + //} + // + //limit := req.GetLimit() + //if limit == 0 { + // limit = QueryDefaultLimit + //} + // + //params = types.NewQueryNodesParams(int(page), int(limit), nil, "", ownerAddr) + // + //resNodes := q.GetResourceNodesFiltered(ctx, params) + //metaNodes := q.GetMetaNodesFiltered(ctx, params) + // + //for i, _ := range metaNodes { + // networkAddr, _ := stratos.SdsAddressFromBech32(metaNodes[i].GetNetworkAddress()) + // unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( + // ctx, + // metaNodes[i].GetStatus(), + // networkAddr, + // metaNodes[i].Tokens, + // ) + // if er != nil { + // return nil, er + // } + // if !metaNodes[i].Equal(types.MetaNode{}) { + // stakingInfo := types.NewStakingInfoByMetaNodeAddr( + // metaNodes[i], + // unBondingStake, + // unBondedStake, + // bondedStake, + // ) + // stakingInfos = append(stakingInfos, stakingInfo) + // } + //} + // + //for i, _ := range resNodes { + // networkAddr, _ := stratos.SdsAddressFromBech32(resNodes[i].GetNetworkAddress()) + // unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( + // ctx, + // resNodes[i].GetStatus(), + // networkAddr, + // resNodes[i].Tokens, + // ) + // if er != nil { + // return nil, er + // } + // if !resNodes[i].Equal(types.ResourceNode{}) { + // stakingInfo := types.NewStakingInfoByResourceNodeAddr( + // resNodes[i], + // unBondingStake, + // unBondedStake, + // bondedStake, + // ) + // stakingInfos = append(stakingInfos, stakingInfo) + // } + //} + // + //start, end := client.Paginate(len(stakingInfos), params.Page, params.Limit, QueryDefaultLimit) + //if start < 0 || end < 0 { + // return &types.QueryStakeByOwnerResponse{}, nil + //} else { + // stakingInfos = stakingInfos[start:end] + // return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfos}, nil + //} + } func (q Querier) StakeTotal(c context.Context, _ *types.QueryTotalStakeRequest) (*types.QueryTotalStakeResponse, error) { diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 7eeb8bd2..a50bbb0d 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -2,13 +2,15 @@ package keeper import ( "fmt" - "strings" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + pagiquery "github.com/cosmos/cosmos-sdk/types/query" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" + db "github.com/tendermint/tm-db" // this line is used by starport scaffolding # 1 abci "github.com/tendermint/tendermint/abci/types" @@ -26,6 +28,7 @@ const ( QueryRegisterParams = "register_params" QueryDefaultLimit = 100 + QueryDefaultPage = 1 ) // NewQuerier creates a new querier for register clients. @@ -345,30 +348,30 @@ func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesPar filteredNodes := make([]types.MetaNode, 0, len(nodes)) for i, _ := range nodes { - // match NetworkAddr (if supplied) - nodeNetworkAddr, er := stratos.SdsAddressFromBech32(nodes[i].GetNetworkAddress()) - if er != nil { - continue - } - if !params.NetworkAddr.Empty() { - if nodeNetworkAddr.Equals(params.NetworkAddr) { - continue - } - } - - // match Moniker (if supplied) - if len(params.Moniker) > 0 { - if strings.Compare(nodes[i].Description.Moniker, params.Moniker) != 0 { - continue - } - } + //// match NetworkAddr (if supplied) + //nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) + //if er != nil { + // continue + //} + //if !params.NetworkAddr.Empty() { + // if nodeNetworkAddr.Equals(params.NetworkAddr) { + // continue + // } + //} + // + //// match Moniker (if supplied) + //if len(params.Moniker) > 0 { + // if strings.Compare(n.Description.Moniker, params.Moniker) != 0 { + // continue + // } + //} // match OwnerAddr (if supplied) nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) if er != nil { continue } - if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { + if nodeOwnerAddr.Equals(params.OwnerAddr) { filteredNodes = append(filteredNodes, nodes[i]) } } @@ -380,32 +383,294 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode filteredNodes := make([]types.ResourceNode, 0, len(nodes)) for i, _ := range nodes { - // match NetworkAddr (if supplied) - nodeNetworkAddr, er := stratos.SdsAddressFromBech32(nodes[i].GetNetworkAddress()) + //// match NetworkAddr (if supplied) + //nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) + //if er != nil { + // continue + //} + //if !params.NetworkAddr.Empty() { + // if nodeNetworkAddr.Equals(params.NetworkAddr) { + // continue + // } + //} + // + //// match Moniker (if supplied) + //if len(params.Moniker) > 0 { + // if strings.Compare(n.Description.Moniker, params.Moniker) != 0 { + // continue + // } + //} + + // match OwnerAddr + nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) if er != nil { continue } - if !params.NetworkAddr.Empty() { - if nodeNetworkAddr.Equals(params.NetworkAddr) { - continue + if nodeOwnerAddr.Equals(params.OwnerAddr) { + filteredNodes = append(filteredNodes, nodes[i]) + } + } + return filteredNodes +} + +func Paginate( + prefixStore storetypes.KVStore, + pageRequest *pagiquery.PageRequest, + onResult func(key []byte, value []byte) error, +) (*pagiquery.PageResponse, error) { + + // if the PageRequest is nil, use default PageRequest + if pageRequest == nil { + pageRequest = &pagiquery.PageRequest{} + } + + offset := pageRequest.Offset + key := pageRequest.Key + limit := pageRequest.Limit + countTotal := pageRequest.CountTotal + reverse := pageRequest.Reverse + + if offset > 0 && key != nil { + return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") + } + + if limit == 0 { + limit = QueryDefaultLimit + + // count total results when the limit is zero/not supplied + countTotal = true + } + + if len(key) != 0 { + iterator := getIterator(prefixStore, key, reverse) + defer iterator.Close() + + var count uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + + if count == limit { + nextKey = iterator.Key() + break + } + if iterator.Error() != nil { + return nil, iterator.Error() + } + err := onResult(iterator.Key(), iterator.Value()) + if err != nil { + return nil, err } + + count++ + } + + return &pagiquery.PageResponse{ + NextKey: nextKey, + }, nil + } + + iterator := getIterator(prefixStore, nil, reverse) + defer iterator.Close() + + end := offset + limit + + var count uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + count++ + + if count <= offset { + continue + } + if count <= end { + err := onResult(iterator.Key(), iterator.Value()) + if err != nil { + return nil, err + } + } else if count == end+1 { + nextKey = iterator.Key() + + if !countTotal { + break + } + } + if iterator.Error() != nil { + return nil, iterator.Error() } + } + + res := &pagiquery.PageResponse{NextKey: nextKey} + if countTotal { + res.Total = count + } + + return res, nil +} - // match Moniker (if supplied) - if len(params.Moniker) > 0 { - if strings.Compare(nodes[i].Description.Moniker, params.Moniker) != 0 { - continue +func getIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator { + if reverse { + var end []byte + if start != nil { + itr := prefixStore.Iterator(start, nil) + defer itr.Close() + if itr.Valid() { + itr.Next() + end = itr.Key() } } + return prefixStore.ReverseIterator(nil, end) + } + return prefixStore.Iterator(start, nil) +} - // match OwnerAddr (if supplied) - nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) - if er != nil { +func FilteredPaginate(cdc codec.Codec, + prefixStore storetypes.KVStore, + queryOwnerAddr sdk.AccAddress, + pageRequest *pagiquery.PageRequest, + onResult func(key []byte, value []byte, accumulate bool) (bool, error), +) (*pagiquery.PageResponse, error) { + + // if the PageRequest is nil, use default PageRequest + if pageRequest == nil { + pageRequest = &pagiquery.PageRequest{} + } + + offset := pageRequest.Offset + key := pageRequest.Key + limit := pageRequest.Limit + countTotal := pageRequest.CountTotal + reverse := pageRequest.Reverse + + if offset > 0 && key != nil { + return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") + } + + if limit == 0 { + limit = QueryDefaultLimit + + // count total results when the limit is zero/not supplied + countTotal = true + } + + if len(key) != 0 { + iterator := getIterator(prefixStore, key, reverse) + defer iterator.Close() + + var numHits uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + if numHits == limit { + nextKey = iterator.Key() + break + } + + if iterator.Error() != nil { + return nil, iterator.Error() + } + + hit, err := onResult(iterator.Key(), iterator.Value(), true) + if err != nil { + return nil, err + } + + if hit { + numHits++ + } + } + + return &pagiquery.PageResponse{ + NextKey: nextKey, + }, nil + } + + iterator := getIterator(prefixStore, nil, reverse) + defer iterator.Close() + + end := offset + limit + + var numHits uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + if iterator.Error() != nil { + return nil, iterator.Error() + } + metaNode := types.MustUnmarshalMetaNode(cdc, iterator.Value()) + ownerAddr, err := sdk.AccAddressFromBech32(metaNode.GetOwnerAddress()) + if err != nil { continue } - if params.OwnerAddr.Empty() || nodeOwnerAddr.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, nodes[i]) + + if queryOwnerAddr.String() != ownerAddr.String() { + continue + } + accumulate := numHits >= offset && numHits < end + hit, err := onResult(iterator.Key(), iterator.Value(), accumulate) + if err != nil { + return nil, err + } + + if hit { + numHits++ + } + + if numHits == end+1 { + nextKey = iterator.Key() + + if !countTotal { + break + } } } - return filteredNodes + + res := &pagiquery.PageResponse{NextKey: nextKey} + if countTotal { + res.Total = numHits + } + + return res, nil +} + +func StakingInfosToStakingInfoResponses( + ctx sdk.Context, k Keeper, metaNodes types.MetaNodes, +) ([]*types.StakingInfo, error) { + resp := make([]*types.StakingInfo, len(metaNodes)) + + for i, metaNode := range metaNodes { + stakingInfoResp, err := StakingInfoToStakingInfoResponse(ctx, k, metaNode) + if err != nil { + return nil, err + } + + resp[i] = &stakingInfoResp + } + + return resp, nil +} + +func StakingInfoToStakingInfoResponse(ctx sdk.Context, k Keeper, node types.MetaNode) (types.StakingInfo, error) { + networkAddr, _ := stratos.SdsAddressFromBech32(node.GetNetworkAddress()) + stakingInfo := types.StakingInfo{} + unBondingStake, unBondedStake, bondedStake, er := k.getNodeStakes( + ctx, + node.GetStatus(), + networkAddr, + node.Tokens, + ) + if er != nil { + return stakingInfo, er + } + + if !node.Equal(types.MetaNode{}) { + stakingInfo = types.NewStakingInfoByMetaNodeAddr( + node, + unBondingStake, + unBondedStake, + bondedStake, + ) + } + return stakingInfo, nil } diff --git a/x/register/types/query.pb.go b/x/register/types/query.pb.go index 9b847307..dc1819ed 100644 --- a/x/register/types/query.pb.go +++ b/x/register/types/query.pb.go @@ -316,11 +316,13 @@ func (m *QueryStakeByNodeResponse) GetStakingInfo() *StakingInfo { // QueryStakeByOwnerRequest is request type for the Query/StakeByOwner RPC method type QueryStakeByOwnerRequest struct { // owner_addr defines the owner address to query for. - NetworkAddr string `protobuf:"bytes,1,opt,name=network_addr,json=networkAddr,proto3" json:"network_addr,omitempty"` - Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` - OwnerAddr string `protobuf:"bytes,3,opt,name=owner_addr,json=ownerAddr,proto3" json:"owner_addr,omitempty"` + // string network_addr = 1; + // string moniker = 2; + OwnerAddr string `protobuf:"bytes,1,opt,name=owner_addr,json=ownerAddr,proto3" json:"owner_addr,omitempty"` + // int64 page = 2; + // int64 limit = 3; // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryStakeByOwnerRequest) Reset() { *m = QueryStakeByOwnerRequest{} } @@ -356,20 +358,6 @@ func (m *QueryStakeByOwnerRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryStakeByOwnerRequest proto.InternalMessageInfo -func (m *QueryStakeByOwnerRequest) GetNetworkAddr() string { - if m != nil { - return m.NetworkAddr - } - return "" -} - -func (m *QueryStakeByOwnerRequest) GetMoniker() string { - if m != nil { - return m.Moniker - } - return "" -} - func (m *QueryStakeByOwnerRequest) GetOwnerAddr() string { if m != nil { return m.OwnerAddr @@ -623,58 +611,57 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/query.proto", fileDescriptor_59a612d1da8c0670) } var fileDescriptor_59a612d1da8c0670 = []byte{ - // 803 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x96, 0x41, 0x4f, 0x13, 0x41, - 0x14, 0xc7, 0x19, 0x40, 0xa0, 0xd3, 0x7a, 0x19, 0x50, 0x4b, 0x91, 0x5a, 0x96, 0x44, 0x0a, 0xd2, - 0x5d, 0x0b, 0x68, 0x94, 0xc4, 0x44, 0x31, 0x6a, 0xc4, 0x88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0xc5, 0xb6, 0x63, 0xbc, 0x0d, 0x2b, 0x7b, 0x97, 0xc1, 0xca, - 0x23, 0xe2, 0x5f, 0x87, 0xe5, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xce, 0x7d, 0xd4, 0x4c, 0xe0, - 0x08, 0x00, 0x00, + // 788 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xcf, 0x4e, 0x1b, 0x49, + 0x10, 0xc6, 0x69, 0xd8, 0xe5, 0x4f, 0xd9, 0x7b, 0x69, 0xd8, 0x5d, 0x63, 0xd6, 0x5e, 0x33, 0x48, + 0x8b, 0x61, 0xf1, 0xcc, 0xda, 0xb0, 0xab, 0x0d, 0x52, 0xa4, 0x84, 0x28, 0x89, 0x42, 0x14, 0x42, + 0x0c, 0xa7, 0x5c, 0xac, 0xf6, 0xb8, 0x31, 0x23, 0xf0, 0xb4, 0x99, 0x6e, 0x43, 0x2c, 0xcb, 0x52, + 0x92, 0x27, 0x88, 0x92, 0x53, 0x1e, 0x20, 0x87, 0x28, 0x79, 0x86, 0x9c, 0x73, 0x44, 0xca, 0x25, + 0xc7, 0x08, 0xf2, 0x20, 0xd1, 0xf4, 0xf4, 0xe0, 0x19, 0x68, 0xc7, 0xce, 0x8d, 0x29, 0xbe, 0xaa, + 0xfa, 0x55, 0x77, 0xf5, 0x67, 0xf8, 0x93, 0x0b, 0x8f, 0x08, 0xc6, 0x2d, 0x8f, 0xd6, 0x1d, 0x2e, + 0xa8, 0x67, 0x1d, 0x17, 0xad, 0xa3, 0x16, 0xf5, 0xda, 0x66, 0xd3, 0x63, 0x82, 0xe1, 0x69, 0x25, + 0x30, 0x43, 0x81, 0x79, 0x5c, 0x4c, 0xff, 0x51, 0x67, 0xac, 0x7e, 0x48, 0x2d, 0xd2, 0x74, 0x2c, + 0xe2, 0xba, 0x4c, 0x10, 0xe1, 0x30, 0x97, 0x07, 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x2b, 0x8e, 0x91, 0x5e, 0x19, + 0x4e, 0xac, 0x08, 0x97, 0x24, 0xe1, 0x02, 0x9e, 0xd7, 0x12, 0x46, 0xfd, 0x65, 0x63, 0xeb, 0xe3, + 0x59, 0x16, 0x9d, 0x9e, 0x65, 0xd1, 0x97, 0xb3, 0x2c, 0x7a, 0x71, 0x9e, 0x1d, 0x39, 0x3d, 0xcf, + 0x8e, 0x7c, 0x3e, 0xcf, 0x8e, 0x3c, 0x5e, 0xab, 0x3b, 0x62, 0xbf, 0x55, 0x35, 0x6d, 0xd6, 0x08, + 0xcb, 0xb8, 0x54, 0x84, 0x7f, 0x16, 0xec, 0x7d, 0xe2, 0xb8, 0xd6, 0x93, 0x5e, 0x65, 0xff, 0x32, + 0x78, 0x75, 0x5c, 0xfe, 0xfa, 0xaf, 0x7e, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x11, 0x9b, 0x40, 0x4d, + 0xa3, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1179,27 +1166,13 @@ func (m *QueryStakeByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x12 } if len(m.OwnerAddr) > 0 { i -= len(m.OwnerAddr) copy(dAtA[i:], m.OwnerAddr) i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddr))) i-- - dAtA[i] = 0x1a - } - if len(m.Moniker) > 0 { - i -= len(m.Moniker) - copy(dAtA[i:], m.Moniker) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Moniker))) - i-- - dAtA[i] = 0x12 - } - if len(m.NetworkAddr) > 0 { - i -= len(m.NetworkAddr) - copy(dAtA[i:], m.NetworkAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NetworkAddr))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -1468,14 +1441,6 @@ func (m *QueryStakeByOwnerRequest) Size() (n int) { } var l int _ = l - l = len(m.NetworkAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Moniker) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } l = len(m.OwnerAddr) if l > 0 { n += 1 + l + sovQuery(uint64(l)) @@ -2109,70 +2074,6 @@ func (m *QueryStakeByOwnerRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkAddr", 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.NetworkAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Moniker", 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.Moniker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddr", wireType) } @@ -2204,7 +2105,7 @@ func (m *QueryStakeByOwnerRequest) Unmarshal(dAtA []byte) error { } m.OwnerAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } From 9fd7dcc1e0b319ca3472b1e5aedd432524cc5d60 Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 6 Jun 2022 13:48:11 -0400 Subject: [PATCH 095/113] - qb-1165: remove some unused comments - qb-1165: some tiny fixes --- x/pot/types/expected_keepers.go | 4 +- x/register/keeper/indexing_node.go | 58 ++++--------------- x/register/keeper/keeper.go | 33 ----------- x/register/keeper/resource_node.go | 92 ++++-------------------------- 4 files changed, 26 insertions(+), 161 deletions(-) diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 450dee71..5cf27a61 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -69,9 +69,9 @@ type RegisterKeeper interface { //SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) - MintResourceNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error + //MintResourceNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error GetMetaNodeBondedToken(ctx sdk.Context) (token sdk.Coin) - MintMetaNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error + //MintMetaNodeBondedTokenPool(ctx sdk.Context, token sdk.Coin) error GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index 598ff083..ff4657a6 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -245,15 +245,19 @@ func (k Keeper) SubtractMetaNodeStake(ctx sdk.Context, metaNode types.MetaNode, //k.SetMetaNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first, slashed amt goes into TotalSlashedPool - coins, slashed := k.DeductSlashing(ctx, ownerAddr, coins) - // add tokens to owner acc - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.MetaNodeNotBondedPoolName, ownerAddr, coins) - if err != nil { - return err + remaining, slashed := k.DeductSlashing(ctx, ownerAddr, coins) + if !remaining.IsZero() { + // add remaining tokens to owner acc + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.MetaNodeNotBondedPoolName, ownerAddr, remaining) + if err != nil { + return err + } } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.MetaNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) - if err != nil { - return err + if !slashed.IsZero() { + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.MetaNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) + if err != nil { + return err + } } metaNode = metaNode.SubToken(tokenToSub.Amount) @@ -472,25 +476,6 @@ func (k Keeper) UpdateMetaNodeStake(ctx sdk.Context, networkAddr stratos.SdsAddr } } -func (k Keeper) MintMetaNodeBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { - metaNodeBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.MetaNodeBondedPoolName) - if metaNodeBondedPoolAcc == nil { - return types.ErrUnknownAccountAddress - } - hasCoin := k.bankKeeper.GetBalance(ctx, metaNodeBondedPoolAcc, k.BondDenom(ctx)) - // can only mint when balance is 0 TODO To be tested - if hasCoin.Amount.GT(sdk.ZeroInt()) { - return types.ErrInitialBalanceNotZero - } - return k.bankKeeper.MintCoins(ctx, types.MetaNodeBondedPoolName, sdk.NewCoins(initialCoins)) -} - -//func (k Keeper) SetMetaNodeBondedToken(ctx sdk.Context, token sdk.Coin) { -// store := ctx.KVStore(k.storeKey) -// bz := k.cdc.MustMarshalLengthPrefixed(&token) -// store.Set(types.MetaNodeBondedTokenKey, bz) -//} - func (k Keeper) GetMetaNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { metaNodeBondedAccAddr := k.accountKeeper.GetModuleAddress(types.MetaNodeBondedPoolName) if metaNodeBondedAccAddr == nil { @@ -503,25 +488,6 @@ func (k Keeper) GetMetaNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { return k.bankKeeper.GetBalance(ctx, metaNodeBondedAccAddr, k.BondDenom(ctx)) } -func (k Keeper) MintMetaNodeNotBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { - metaNodeNotBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.MetaNodeNotBondedPoolName) - if metaNodeNotBondedPoolAcc == nil { - return types.ErrUnknownAccountAddress - } - hasCoin := k.bankKeeper.GetBalance(ctx, metaNodeNotBondedPoolAcc, k.BondDenom(ctx)) - // can only mint when balance is 0 TODO To be tested - if hasCoin.Amount.GT(sdk.ZeroInt()) { - return types.ErrInitialBalanceNotZero - } - return k.bankKeeper.MintCoins(ctx, types.MetaNodeNotBondedPoolName, sdk.NewCoins(initialCoins)) -} - -//func (k Keeper) SetMetaNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { -// store := ctx.KVStore(k.storeKey) -// bz := k.cdc.MustMarshalLengthPrefixed(&token) -// store.Set(types.MetaNodeNotBondedTokenKey, bz) -//} - func (k Keeper) GetMetaNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) { metaNodeNotBondedAccAddr := k.accountKeeper.GetModuleAddress(types.MetaNodeNotBondedPoolName) if metaNodeNotBondedAccAddr == nil { diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 8ff33d8f..0bff4ec3 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -80,28 +80,6 @@ func (k Keeper) GetInitialUOzonePrice(ctx sdk.Context) (price sdk.Dec) { return } -// SetTotalUnissuedPrepay is deprecated after starting to use TotalUnissuedPrepay module acc -//func (k Keeper) SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin) { -// store := ctx.KVStore(k.storeKey) -// b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) -// store.Set(types.TotalUnissuedPrepayKey, b) -//} -func (k Keeper) MintTotalUnissuedPrepayPool(ctx sdk.Context, initialCoins sdk.Coin) error { - totalUnissuedPrepayAcc := k.accountKeeper.GetModuleAddress(types.TotalUnissuedPrepayName) - if totalUnissuedPrepayAcc == nil { - return types.ErrUnknownAccountAddress - } - hasCoin := k.bankKeeper.GetBalance(ctx, totalUnissuedPrepayAcc, k.BondDenom(ctx)) - // can only mint when balance is 0 TODO To be tested - if hasCoin.Amount.GT(sdk.ZeroInt()) { - return types.ErrInitialBalanceNotZero - } - return k.bankKeeper.MintCoins(ctx, types.TotalUnissuedPrepayName, sdk.NewCoins(initialCoins)) - //store := ctx.KVStore(k.storeKey) - //b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) - //store.Set(types.TotalUnissuedPrepayKey, b) -} - func (k Keeper) SendCoinsFromAccount2TotalUnissuedPrepayPool(ctx sdk.Context, fromWallet sdk.AccAddress, coinToSend sdk.Coin) error { fromAcc := k.accountKeeper.GetAccount(ctx, fromWallet) if fromAcc == nil { @@ -112,10 +90,6 @@ func (k Keeper) SendCoinsFromAccount2TotalUnissuedPrepayPool(ctx sdk.Context, fr return types.ErrInsufficientBalance } return k.bankKeeper.SendCoinsFromAccountToModule(ctx, fromWallet, types.TotalUnissuedPrepayName, sdk.NewCoins(coinToSend)) - - //store := ctx.KVStore(k.storeKey) - //b := types.ModuleCdc.MustMarshalLengthPrefixed(totalUnissuedPrepay) - //store.Set(types.TotalUnissuedPrepayKey, b) } func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk.Coin) { @@ -128,13 +102,6 @@ func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk } } return k.bankKeeper.GetBalance(ctx, totalUnissuedPrepayAccAddr, k.BondDenom(ctx)) - //store := ctx.KVStore(k.storeKey) - //b := store.Get(types.TotalUnissuedPrepayKey) - //if b == nil { - // return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - //} - //types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &totalUnissuedPrepay) - //return } func (k Keeper) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) { diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index d55c92fc..c649a64e 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -187,19 +187,6 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingResourceNode(ctx sdk.Context, r if err != nil { return types.ErrInsufficientBalance } - - //// get pools - //bondedTokenInPool := k.GetResourceNodeBondedToken(ctx) - //notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) - //if bondedTokenInPool.IsLT(tokenToSub) { - // return types.ErrInsufficientBalanceOfBondedPool - //} - //// remove token from BondedPool - //bondedTokenInPool = bondedTokenInPool.Sub(tokenToSub) - //k.SetResourceNodeBondedToken(ctx, bondedTokenInPool) - //// add token into NotBondedPool - //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToSub) - //k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) return nil } @@ -236,23 +223,21 @@ func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.Re if !hasCoin { return types.ErrInsufficientBalanceOfNotBondedPool } - //notBondedTokenInPool := k.GetResourceNodeNotBondedToken(ctx) - //if notBondedTokenInPool.IsLT(tokenToSub) { - // return types.ErrInsufficientBalanceOfNotBondedPool - //} - //notBondedTokenInPool = notBondedTokenInPool.Sub(tokenToSub) - //k.SetResourceNodeNotBondedToken(ctx, notBondedTokenInPool) // deduct slashing amount first, slashed amt goes into TotalSlashedPool - coins, slashed := k.DeductSlashing(ctx, ownerAddr, coins) - // add tokens to owner acc - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ResourceNodeNotBondedPoolName, ownerAddr, coins) - if err != nil { - return err + remaining, slashed := k.DeductSlashing(ctx, ownerAddr, coins) + if !remaining.IsZero() { + // add remaining tokens to owner acc + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ResourceNodeNotBondedPoolName, ownerAddr, remaining) + if err != nil { + return err + } } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ResourceNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) - if err != nil { - return err + if !slashed.IsZero() { + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ResourceNodeNotBondedPoolName, types.TotalSlashedPoolName, slashed) + if err != nil { + return err + } } resourceNode = resourceNode.SubToken(tokenToSub.Amount) @@ -355,25 +340,6 @@ func (k Keeper) UpdateResourceNodeStake(ctx sdk.Context, networkAddr stratos.Sds } } -func (k Keeper) MintResourceNodeBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { - resourceNodeBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.ResourceNodeBondedPoolName) - if resourceNodeBondedPoolAcc == nil { - return types.ErrUnknownAccountAddress - } - hasCoin := k.bankKeeper.GetBalance(ctx, resourceNodeBondedPoolAcc, k.BondDenom(ctx)) - // can only mint when balance is 0 TODO To be tested - if hasCoin.Amount.GT(sdk.ZeroInt()) { - return types.ErrInitialBalanceNotZero - } - return k.bankKeeper.MintCoins(ctx, types.ResourceNodeBondedPoolName, sdk.NewCoins(initialCoins)) -} - -//func (k Keeper) SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin) { -// store := ctx.KVStore(k.storeKey) -// bz := k.cdc.MustMarshalLengthPrefixed(&token) -// store.Set(types.ResourceNodeBondedTokenKey, bz) -//} - func (k Keeper) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { resourceNodeBondedAccAddr := k.accountKeeper.GetModuleAddress(types.ResourceNodeBondedPoolName) if resourceNodeBondedAccAddr == nil { @@ -384,34 +350,8 @@ func (k Keeper) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin) { } } return k.bankKeeper.GetBalance(ctx, resourceNodeBondedAccAddr, k.BondDenom(ctx)) - //store := ctx.KVStore(k.storeKey) - //bz := store.Get(types.ResourceNodeBondedTokenKey) - //if bz == nil { - // return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - //} - //k.cdc.MustUnmarshalLengthPrefixed(bz, &token) - //return token } -func (k Keeper) MintResourceNodeNotBondedTokenPool(ctx sdk.Context, initialCoins sdk.Coin) error { - resourceNodeNotBondedPoolAcc := k.accountKeeper.GetModuleAddress(types.ResourceNodeNotBondedPoolName) - if resourceNodeNotBondedPoolAcc == nil { - return types.ErrUnknownAccountAddress - } - hasCoin := k.bankKeeper.GetBalance(ctx, resourceNodeNotBondedPoolAcc, k.BondDenom(ctx)) - // can only mint when balance is 0 TODO To be tested - if hasCoin.Amount.GT(sdk.ZeroInt()) { - return types.ErrInitialBalanceNotZero - } - return k.bankKeeper.MintCoins(ctx, types.ResourceNodeNotBondedPoolName, sdk.NewCoins(initialCoins)) -} - -//func (k Keeper) SetResourceNodeNotBondedToken(ctx sdk.Context, token sdk.Coin) { -// store := ctx.KVStore(k.storeKey) -// bz := k.cdc.MustMarshalLengthPrefixed(&token) -// store.Set(types.ResourceNodeNotBondedTokenKey, bz) -//} - func (k Keeper) GetResourceNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) { resourceNodeNotBondedAccAddr := k.accountKeeper.GetModuleAddress(types.ResourceNodeNotBondedPoolName) if resourceNodeNotBondedAccAddr == nil { @@ -422,12 +362,4 @@ func (k Keeper) GetResourceNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) } } return k.bankKeeper.GetBalance(ctx, resourceNodeNotBondedAccAddr, k.BondDenom(ctx)) - - //store := ctx.KVStore(k.storeKey) - //bz := store.Get(types.ResourceNodeNotBondedTokenKey) - //if bz == nil { - // return sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) - //} - //k.cdc.MustUnmarshalLengthPrefixed(bz, &token) - //return token } From af80bcc7055b76b1db0f3a4038de40c8cfd4be46 Mon Sep 17 00:00:00 2001 From: jialbai Date: Mon, 6 Jun 2022 17:47:10 -0400 Subject: [PATCH 096/113] - qb-1165: fix token flow when creating meta node --- x/register/keeper/indexing_node.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/x/register/keeper/indexing_node.go b/x/register/keeper/indexing_node.go index ff4657a6..4e9593ac 100644 --- a/x/register/keeper/indexing_node.go +++ b/x/register/keeper/indexing_node.go @@ -137,11 +137,6 @@ func (k Keeper) AddMetaNodeStake(ctx sdk.Context, metaNode types.MetaNode, token if !hasCoin { return sdk.ZeroInt(), types.ErrInsufficientBalance } - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddr, types.ModuleName, coins) - if err != nil { - return sdk.ZeroInt(), err - } - targetModuleAccName := "" switch metaNode.GetStatus() { @@ -189,19 +184,6 @@ func (k Keeper) RemoveTokenFromPoolWhileUnbondingMetaNode(ctx sdk.Context, metaN if err != nil { return types.ErrInsufficientBalance } - - //// get pools - //bondedTokenInPool := k.GetMetaNodeBondedToken(ctx) - //notBondedTokenInPool := k.GetMetaNodeNotBondedToken(ctx) - //if bondedTokenInPool.IsLT(tokenToSub) { - // return types.ErrInsufficientBalanceOfBondedPool - //} - //// remove token from BondedPool - //bondedTokenInPool = bondedTokenInPool.Sub(tokenToSub) - //k.SetMetaNodeBondedToken(ctx, bondedTokenInPool) - //// add token into NotBondedPool - //notBondedTokenInPool = notBondedTokenInPool.Add(tokenToSub) - //k.SetMetaNodeNotBondedToken(ctx, notBondedTokenInPool) return nil } From 5401427ad02fe66f11bd62344a0522865111dccd Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 6 Jun 2022 22:48:41 -0400 Subject: [PATCH 097/113] finished optimizing grpc query StakeByOwner --- x/register/keeper/grpc_query.go | 125 ++++++-------- x/register/keeper/querier.go | 286 ++++++++++++++++---------------- 2 files changed, 193 insertions(+), 218 deletions(-) diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index 0f6dbf50..2f4cbefc 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -2,10 +2,10 @@ package keeper import ( "context" - "fmt" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" "google.golang.org/grpc/codes" @@ -156,20 +156,56 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq } ctx := sdk.UnwrapSDKContext(c) - var metaNodes types.MetaNodes - ownerAddr, er := sdk.AccAddressFromBech32(req.GetOwnerAddr()) if er != nil { return &types.QueryStakeByOwnerResponse{}, er } store := ctx.KVStore(q.storeKey) - resourceNodeStore := prefix.NewStore(store, types.MetaNodeKey) + sum := uint64(0) + var stakingInfoResponses []*types.StakingInfo - pageRes, err := FilteredPaginate(q.cdc, resourceNodeStore, ownerAddr, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { + // get resource nodes + var resourceNodes types.ResourceNodes + resourceNodeStore := prefix.NewStore(store, types.ResourceNodeKey) + + resourceNodesPageRes, err := FilteredPaginate(q.cdc, resourceNodeStore, ownerAddr, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { + val, err := types.UnmarshalResourceNode(q.cdc, value) + if err != nil { + return true, err + } + + if accumulate { + resourceNodes = append(resourceNodes, val) + } + + return true, nil + }) + + if err != nil { + return &types.QueryStakeByOwnerResponse{}, status.Error(codes.Internal, err.Error()) + } + //sum = resourceNodesPageRes.Total + + stakingInfoResponses, err = StakingInfosToStakingResourceNodes(ctx, q.Keeper, resourceNodes) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + // Continue to get meta nodes + metaNodesPageLimit := req.Pagination.Limit - resourceNodesPageRes.Total + if metaNodesPageLimit <= 0 { + return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfoResponses, Pagination: resourceNodesPageRes}, nil + } + metaNodesPageRequest := query.PageRequest{Limit: metaNodesPageLimit, CountTotal: true} + + var metaNodes types.MetaNodes + metaNodeStore := prefix.NewStore(store, types.MetaNodeKey) + + metaNodesPageRes, err := FilteredPaginate(q.cdc, metaNodeStore, ownerAddr, &metaNodesPageRequest, func(key []byte, value []byte, accumulate bool) (bool, error) { val, err := types.UnmarshalMetaNode(q.cdc, value) if err != nil { - return false, err + return true, err } if accumulate { @@ -182,82 +218,17 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq if err != nil { return &types.QueryStakeByOwnerResponse{}, status.Error(codes.Internal, err.Error()) } - fmt.Println("MetaNodes: ", metaNodes) + sum = sum + metaNodesPageRes.Total - stakingInfoResponses, err := StakingInfosToStakingInfoResponses(ctx, q.Keeper, metaNodes) + metaNodesStakingInfoResponses, err := StakingInfosToStakingMetaNodes(ctx, q.Keeper, metaNodes) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfoResponses, Pagination: pageRes}, nil - - //page := req.GetPage() - //if page == 0 { - // page = QueryDefaultPage - //} - // - //limit := req.GetLimit() - //if limit == 0 { - // limit = QueryDefaultLimit - //} - // - //params = types.NewQueryNodesParams(int(page), int(limit), nil, "", ownerAddr) - // - //resNodes := q.GetResourceNodesFiltered(ctx, params) - //metaNodes := q.GetMetaNodesFiltered(ctx, params) - // - //for i, _ := range metaNodes { - // networkAddr, _ := stratos.SdsAddressFromBech32(metaNodes[i].GetNetworkAddress()) - // unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( - // ctx, - // metaNodes[i].GetStatus(), - // networkAddr, - // metaNodes[i].Tokens, - // ) - // if er != nil { - // return nil, er - // } - // if !metaNodes[i].Equal(types.MetaNode{}) { - // stakingInfo := types.NewStakingInfoByMetaNodeAddr( - // metaNodes[i], - // unBondingStake, - // unBondedStake, - // bondedStake, - // ) - // stakingInfos = append(stakingInfos, stakingInfo) - // } - //} - // - //for i, _ := range resNodes { - // networkAddr, _ := stratos.SdsAddressFromBech32(resNodes[i].GetNetworkAddress()) - // unBondingStake, unBondedStake, bondedStake, er := q.getNodeStakes( - // ctx, - // resNodes[i].GetStatus(), - // networkAddr, - // resNodes[i].Tokens, - // ) - // if er != nil { - // return nil, er - // } - // if !resNodes[i].Equal(types.ResourceNode{}) { - // stakingInfo := types.NewStakingInfoByResourceNodeAddr( - // resNodes[i], - // unBondingStake, - // unBondedStake, - // bondedStake, - // ) - // stakingInfos = append(stakingInfos, stakingInfo) - // } - //} - // - //start, end := client.Paginate(len(stakingInfos), params.Page, params.Limit, QueryDefaultLimit) - //if start < 0 || end < 0 { - // return &types.QueryStakeByOwnerResponse{}, nil - //} else { - // stakingInfos = stakingInfos[start:end] - // return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfos}, nil - //} - + stakingInfoResponses = append(stakingInfoResponses, metaNodesStakingInfoResponses...) + PageRes := resourceNodesPageRes + PageRes.Total = uint64(len(stakingInfoResponses)) + return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfoResponses, Pagination: PageRes}, nil } func (q Querier) StakeTotal(c context.Context, _ *types.QueryTotalStakeRequest) (*types.QueryTotalStakeResponse, error) { diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index a50bbb0d..a5bf7edb 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -413,101 +413,101 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode return filteredNodes } -func Paginate( - prefixStore storetypes.KVStore, - pageRequest *pagiquery.PageRequest, - onResult func(key []byte, value []byte) error, -) (*pagiquery.PageResponse, error) { - - // if the PageRequest is nil, use default PageRequest - if pageRequest == nil { - pageRequest = &pagiquery.PageRequest{} - } - - offset := pageRequest.Offset - key := pageRequest.Key - limit := pageRequest.Limit - countTotal := pageRequest.CountTotal - reverse := pageRequest.Reverse - - if offset > 0 && key != nil { - return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") - } - - if limit == 0 { - limit = QueryDefaultLimit - - // count total results when the limit is zero/not supplied - countTotal = true - } - - if len(key) != 0 { - iterator := getIterator(prefixStore, key, reverse) - defer iterator.Close() - - var count uint64 - var nextKey []byte - - for ; iterator.Valid(); iterator.Next() { - - if count == limit { - nextKey = iterator.Key() - break - } - if iterator.Error() != nil { - return nil, iterator.Error() - } - err := onResult(iterator.Key(), iterator.Value()) - if err != nil { - return nil, err - } - - count++ - } - - return &pagiquery.PageResponse{ - NextKey: nextKey, - }, nil - } - - iterator := getIterator(prefixStore, nil, reverse) - defer iterator.Close() - - end := offset + limit - - var count uint64 - var nextKey []byte - - for ; iterator.Valid(); iterator.Next() { - count++ - - if count <= offset { - continue - } - if count <= end { - err := onResult(iterator.Key(), iterator.Value()) - if err != nil { - return nil, err - } - } else if count == end+1 { - nextKey = iterator.Key() - - if !countTotal { - break - } - } - if iterator.Error() != nil { - return nil, iterator.Error() - } - } - - res := &pagiquery.PageResponse{NextKey: nextKey} - if countTotal { - res.Total = count - } - - return res, nil -} +//func Paginate( +// prefixStore storetypes.KVStore, +// pageRequest *pagiquery.PageRequest, +// onResult func(key []byte, value []byte) error, +//) (*pagiquery.PageResponse, error) { +// +// // if the PageRequest is nil, use default PageRequest +// if pageRequest == nil { +// pageRequest = &pagiquery.PageRequest{} +// } +// +// offset := pageRequest.Offset +// key := pageRequest.Key +// limit := pageRequest.Limit +// countTotal := pageRequest.CountTotal +// reverse := pageRequest.Reverse +// +// if offset > 0 && key != nil { +// return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") +// } +// +// if limit == 0 { +// limit = QueryDefaultLimit +// +// // count total results when the limit is zero/not supplied +// countTotal = true +// } +// +// if len(key) != 0 { +// iterator := getIterator(prefixStore, key, reverse) +// defer iterator.Close() +// +// var count uint64 +// var nextKey []byte +// +// for ; iterator.Valid(); iterator.Next() { +// +// if count == limit { +// nextKey = iterator.Key() +// break +// } +// if iterator.Error() != nil { +// return nil, iterator.Error() +// } +// err := onResult(iterator.Key(), iterator.Value()) +// if err != nil { +// return nil, err +// } +// +// count++ +// } +// +// return &pagiquery.PageResponse{ +// NextKey: nextKey, +// }, nil +// } +// +// iterator := getIterator(prefixStore, nil, reverse) +// defer iterator.Close() +// +// end := offset + limit +// +// var count uint64 +// var nextKey []byte +// +// for ; iterator.Valid(); iterator.Next() { +// count++ +// +// if count <= offset { +// continue +// } +// if count <= end { +// err := onResult(iterator.Key(), iterator.Value()) +// if err != nil { +// return nil, err +// } +// } else if count == end+1 { +// nextKey = iterator.Key() +// +// if !countTotal { +// break +// } +// } +// if iterator.Error() != nil { +// return nil, iterator.Error() +// } +// } +// +// res := &pagiquery.PageResponse{NextKey: nextKey} +// if countTotal { +// res.Total = count +// } +// +// return res, nil +//} func getIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator { if reverse { @@ -551,7 +551,7 @@ func FilteredPaginate(cdc codec.Codec, limit = QueryDefaultLimit // count total results when the limit is zero/not supplied - countTotal = true + countTotal = pageRequest.CountTotal } if len(key) != 0 { @@ -560,6 +560,7 @@ func FilteredPaginate(cdc codec.Codec, var numHits uint64 var nextKey []byte + var ownerAddr sdk.AccAddress for ; iterator.Valid(); iterator.Next() { if numHits == limit { @@ -571,6 +572,32 @@ func FilteredPaginate(cdc codec.Codec, return nil, iterator.Error() } + if prefixStore.Has(types.MetaNodeKey) { + metaNode, err := types.UnmarshalMetaNode(cdc, iterator.Value()) + if err != nil { + continue + } + + ownerAddr, err = sdk.AccAddressFromBech32(metaNode.GetOwnerAddress()) + if err != nil { + continue + } + } else { + resourceNode, err := types.UnmarshalResourceNode(cdc, iterator.Value()) + if err != nil { + continue + } + + ownerAddr, err = sdk.AccAddressFromBech32(resourceNode.GetOwnerAddress()) + if err != nil { + continue + } + } + + if queryOwnerAddr.String() != ownerAddr.String() { + continue + } + hit, err := onResult(iterator.Key(), iterator.Value(), true) if err != nil { return nil, err @@ -593,15 +620,33 @@ func FilteredPaginate(cdc codec.Codec, var numHits uint64 var nextKey []byte + var ownerAddr sdk.AccAddress for ; iterator.Valid(); iterator.Next() { if iterator.Error() != nil { return nil, iterator.Error() } - metaNode := types.MustUnmarshalMetaNode(cdc, iterator.Value()) - ownerAddr, err := sdk.AccAddressFromBech32(metaNode.GetOwnerAddress()) - if err != nil { - continue + + if prefixStore.Has(types.MetaNodeKey) { + metaNode, err := types.UnmarshalMetaNode(cdc, iterator.Value()) + if err != nil { + continue + } + + ownerAddr, err = sdk.AccAddressFromBech32(metaNode.GetOwnerAddress()) + if err != nil { + continue + } + } else { + resourceNode, err := types.UnmarshalResourceNode(cdc, iterator.Value()) + if err != nil { + continue + } + + ownerAddr, err = sdk.AccAddressFromBech32(resourceNode.GetOwnerAddress()) + if err != nil { + continue + } } if queryOwnerAddr.String() != ownerAddr.String() { @@ -633,44 +678,3 @@ func FilteredPaginate(cdc codec.Codec, return res, nil } - -func StakingInfosToStakingInfoResponses( - ctx sdk.Context, k Keeper, metaNodes types.MetaNodes, -) ([]*types.StakingInfo, error) { - resp := make([]*types.StakingInfo, len(metaNodes)) - - for i, metaNode := range metaNodes { - stakingInfoResp, err := StakingInfoToStakingInfoResponse(ctx, k, metaNode) - if err != nil { - return nil, err - } - - resp[i] = &stakingInfoResp - } - - return resp, nil -} - -func StakingInfoToStakingInfoResponse(ctx sdk.Context, k Keeper, node types.MetaNode) (types.StakingInfo, error) { - networkAddr, _ := stratos.SdsAddressFromBech32(node.GetNetworkAddress()) - stakingInfo := types.StakingInfo{} - unBondingStake, unBondedStake, bondedStake, er := k.getNodeStakes( - ctx, - node.GetStatus(), - networkAddr, - node.Tokens, - ) - if er != nil { - return stakingInfo, er - } - - if !node.Equal(types.MetaNode{}) { - stakingInfo = types.NewStakingInfoByMetaNodeAddr( - node, - unBondingStake, - unBondedStake, - bondedStake, - ) - } - return stakingInfo, nil -} From 893d035d9f7cfb6d2c83664527bc704b9b76345b Mon Sep 17 00:00:00 2001 From: hong-pang Date: Tue, 7 Jun 2022 10:33:23 -0400 Subject: [PATCH 098/113] finished optimizing grpc query StakeByOwner --- x/register/keeper/grpc_query.go | 20 +-- x/register/keeper/querier.go | 215 ++++++++++++-------------------- 2 files changed, 94 insertions(+), 141 deletions(-) diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index 2f4cbefc..df6bb962 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -162,7 +162,6 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq } store := ctx.KVStore(q.storeKey) - sum := uint64(0) var stakingInfoResponses []*types.StakingInfo // get resource nodes @@ -185,24 +184,30 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq if err != nil { return &types.QueryStakeByOwnerResponse{}, status.Error(codes.Internal, err.Error()) } - //sum = resourceNodesPageRes.Total - stakingInfoResponses, err = StakingInfosToStakingResourceNodes(ctx, q.Keeper, resourceNodes) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } // Continue to get meta nodes - metaNodesPageLimit := req.Pagination.Limit - resourceNodesPageRes.Total - if metaNodesPageLimit <= 0 { + if req.Pagination.Limit < resourceNodesPageRes.Total { + resourceNodesPageRes.Total = uint64(len(stakingInfoResponses)) return &types.QueryStakeByOwnerResponse{StakingInfos: stakingInfoResponses, Pagination: resourceNodesPageRes}, nil + + } + + metaNodesPageLimit := req.Pagination.Limit - resourceNodesPageRes.Total + + metaNodesPageOffset := uint64(0) + if req.Pagination.Offset > resourceNodesPageRes.Total { + metaNodesPageOffset = req.Pagination.Offset - resourceNodesPageRes.Total } - metaNodesPageRequest := query.PageRequest{Limit: metaNodesPageLimit, CountTotal: true} + metaNodesPageRequest := query.PageRequest{Offset: metaNodesPageOffset, Limit: metaNodesPageLimit, CountTotal: req.Pagination.CountTotal} var metaNodes types.MetaNodes metaNodeStore := prefix.NewStore(store, types.MetaNodeKey) - metaNodesPageRes, err := FilteredPaginate(q.cdc, metaNodeStore, ownerAddr, &metaNodesPageRequest, func(key []byte, value []byte, accumulate bool) (bool, error) { + _, err = FilteredPaginate(q.cdc, metaNodeStore, ownerAddr, &metaNodesPageRequest, func(key []byte, value []byte, accumulate bool) (bool, error) { val, err := types.UnmarshalMetaNode(q.cdc, value) if err != nil { return true, err @@ -218,7 +223,6 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq if err != nil { return &types.QueryStakeByOwnerResponse{}, status.Error(codes.Internal, err.Error()) } - sum = sum + metaNodesPageRes.Total metaNodesStakingInfoResponses, err := StakingInfosToStakingMetaNodes(ctx, q.Keeper, metaNodes) if err != nil { diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index a5bf7edb..8dcd7f6a 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -28,7 +28,6 @@ const ( QueryRegisterParams = "register_params" QueryDefaultLimit = 100 - QueryDefaultPage = 1 ) // NewQuerier creates a new querier for register clients. @@ -348,24 +347,6 @@ func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesPar filteredNodes := make([]types.MetaNode, 0, len(nodes)) for i, _ := range nodes { - //// match NetworkAddr (if supplied) - //nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) - //if er != nil { - // continue - //} - //if !params.NetworkAddr.Empty() { - // if nodeNetworkAddr.Equals(params.NetworkAddr) { - // continue - // } - //} - // - //// match Moniker (if supplied) - //if len(params.Moniker) > 0 { - // if strings.Compare(n.Description.Moniker, params.Moniker) != 0 { - // continue - // } - //} - // match OwnerAddr (if supplied) nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) if er != nil { @@ -383,24 +364,6 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode filteredNodes := make([]types.ResourceNode, 0, len(nodes)) for i, _ := range nodes { - //// match NetworkAddr (if supplied) - //nodeNetworkAddr, er := stratos.SdsAddressFromBech32(n.GetNetworkAddress()) - //if er != nil { - // continue - //} - //if !params.NetworkAddr.Empty() { - // if nodeNetworkAddr.Equals(params.NetworkAddr) { - // continue - // } - //} - // - //// match Moniker (if supplied) - //if len(params.Moniker) > 0 { - // if strings.Compare(n.Description.Moniker, params.Moniker) != 0 { - // continue - // } - //} - // match OwnerAddr nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) if er != nil { @@ -413,102 +376,6 @@ func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNode return filteredNodes } -//func Paginate( -// prefixStore storetypes.KVStore, -// pageRequest *pagiquery.PageRequest, -// onResult func(key []byte, value []byte) error, -//) (*pagiquery.PageResponse, error) { -// -// // if the PageRequest is nil, use default PageRequest -// if pageRequest == nil { -// pageRequest = &pagiquery.PageRequest{} -// } -// -// offset := pageRequest.Offset -// key := pageRequest.Key -// limit := pageRequest.Limit -// countTotal := pageRequest.CountTotal -// reverse := pageRequest.Reverse -// -// if offset > 0 && key != nil { -// return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") -// } -// -// if limit == 0 { -// limit = QueryDefaultLimit -// -// // count total results when the limit is zero/not supplied -// countTotal = true -// } -// -// if len(key) != 0 { -// iterator := getIterator(prefixStore, key, reverse) -// defer iterator.Close() -// -// var count uint64 -// var nextKey []byte -// -// for ; iterator.Valid(); iterator.Next() { -// -// if count == limit { -// nextKey = iterator.Key() -// break -// } -// if iterator.Error() != nil { -// return nil, iterator.Error() -// } -// err := onResult(iterator.Key(), iterator.Value()) -// if err != nil { -// return nil, err -// } -// -// count++ -// } -// -// return &pagiquery.PageResponse{ -// NextKey: nextKey, -// }, nil -// } -// -// iterator := getIterator(prefixStore, nil, reverse) -// defer iterator.Close() -// -// end := offset + limit -// -// var count uint64 -// var nextKey []byte -// -// for ; iterator.Valid(); iterator.Next() { -// count++ -// -// if count <= offset { -// continue -// } -// if count <= end { -// err := onResult(iterator.Key(), iterator.Value()) -// if err != nil { -// return nil, err -// } -// } else if count == end+1 { -// nextKey = iterator.Key() -// -// if !countTotal { -// break -// } -// } -// if iterator.Error() != nil { -// return nil, iterator.Error() -// } -// } -// -// res := &pagiquery.PageResponse{NextKey: nextKey} -// if countTotal { -// res.Total = count -// } -// -// return res, nil -//} - func getIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator { if reverse { var end []byte @@ -678,3 +545,85 @@ func FilteredPaginate(cdc codec.Codec, return res, nil } + +func StakingInfosToStakingResourceNodes( + ctx sdk.Context, k Keeper, resourceNodes types.ResourceNodes, +) ([]*types.StakingInfo, error) { + resp := make([]*types.StakingInfo, len(resourceNodes)) + + for i, resourceNode := range resourceNodes { + stakingInfoResp, err := StakingInfoToStakingInfoResourceNode(ctx, k, resourceNode) + if err != nil { + return nil, err + } + + resp[i] = &stakingInfoResp + } + + return resp, nil +} + +func StakingInfosToStakingMetaNodes( + ctx sdk.Context, k Keeper, metaNodes types.MetaNodes, +) ([]*types.StakingInfo, error) { + resp := make([]*types.StakingInfo, len(metaNodes)) + + for i, metaNode := range metaNodes { + stakingInfoResp, err := StakingInfoToStakingInfoMetaNode(ctx, k, metaNode) + if err != nil { + return nil, err + } + + resp[i] = &stakingInfoResp + } + + return resp, nil +} + +func StakingInfoToStakingInfoResourceNode(ctx sdk.Context, k Keeper, node types.ResourceNode) (types.StakingInfo, error) { + networkAddr, _ := stratos.SdsAddressFromBech32(node.GetNetworkAddress()) + stakingInfo := types.StakingInfo{} + unBondingStake, unBondedStake, bondedStake, er := k.getNodeStakes( + ctx, + node.GetStatus(), + networkAddr, + node.Tokens, + ) + if er != nil { + return stakingInfo, er + } + + if !node.Equal(types.ResourceNode{}) { + stakingInfo = types.NewStakingInfoByResourceNodeAddr( + node, + unBondingStake, + unBondedStake, + bondedStake, + ) + } + return stakingInfo, nil +} + +func StakingInfoToStakingInfoMetaNode(ctx sdk.Context, k Keeper, node types.MetaNode) (types.StakingInfo, error) { + networkAddr, _ := stratos.SdsAddressFromBech32(node.GetNetworkAddress()) + stakingInfo := types.StakingInfo{} + unBondingStake, unBondedStake, bondedStake, er := k.getNodeStakes( + ctx, + node.GetStatus(), + networkAddr, + node.Tokens, + ) + if er != nil { + return stakingInfo, er + } + + if !node.Equal(types.MetaNode{}) { + stakingInfo = types.NewStakingInfoByMetaNodeAddr( + node, + unBondingStake, + unBondedStake, + bondedStake, + ) + } + return stakingInfo, nil +} From 7d64f7e242299c3b33eb031be9b295d797ee7554 Mon Sep 17 00:00:00 2001 From: jialbai Date: Tue, 7 Jun 2022 13:48:52 -0400 Subject: [PATCH 099/113] - qb-1163: clear unused codes in register/genesis.go --- x/register/genesis.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/x/register/genesis.go b/x/register/genesis.go index 7cff9ed7..8cfd926e 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -16,14 +16,12 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState for _, resourceNode := range data.GetResourceNodes() { if resourceNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(resourceNode.Tokens) - } else if resourceNode.GetStatus() == stakingtypes.Unbonded { } keeper.SetResourceNode(ctx, resourceNode) } for _, metaNode := range data.GetMetaNodes() { if metaNode.GetStatus() == stakingtypes.Bonded { initialStakeTotal = initialStakeTotal.Add(metaNode.Tokens) - } else if metaNode.GetStatus() == stakingtypes.Unbonded { } keeper.SetMetaNode(ctx, metaNode) } From 25228b3940c33c703ffb7b78be4a5aa2040f770e Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 8 Jun 2022 13:22:03 -0400 Subject: [PATCH 100/113] finished optimizing restful query StakeByOwner --- x/register/client/rest/query.go | 35 +++- x/register/keeper/grpc_query.go | 2 +- x/register/keeper/querier.go | 338 ++++++++++++++++++++++---------- x/register/types/querier.go | 18 +- 4 files changed, 280 insertions(+), 113 deletions(-) diff --git a/x/register/client/rest/query.go b/x/register/client/rest/query.go index ae69409c..6d84761b 100644 --- a/x/register/client/rest/query.go +++ b/x/register/client/rest/query.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" stratos "github.com/stratosnet/stratos-chain/types" @@ -81,7 +82,20 @@ func nodesWithParamsFn(clientCtx client.Context, queryPath string) http.HandlerF } } - params := types.NewQueryNodesParams(page, limit, networkAddr, moniker, ownerAddr) + countTotal, err := strconv.ParseBool(r.FormValue("count_total")) + if err != nil { + countTotal = true + } + + reverse, err := strconv.ParseBool(r.FormValue("reverse")) + if err != nil { + reverse = false + } + offset := page * limit + + NodesPageRequest := query.PageRequest{Offset: uint64(offset), Limit: uint64(limit), CountTotal: countTotal, Reverse: reverse} + + params := types.NewQueryNodesParams(networkAddr, moniker, ownerAddr, NodesPageRequest) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) @@ -189,7 +203,24 @@ func nodeStakingByOwnerFn(cliCtx client.Context, queryPath string) http.HandlerF return } - params := types.NewQueryNodesParams(page, limit, nil, "", ownerAddress) + countTotal, err := strconv.ParseBool(r.FormValue("count_total")) + if err != nil { + countTotal = true + } + + reverse, err := strconv.ParseBool(r.FormValue("reverse")) + if err != nil { + reverse = false + } + + offset := (page - 1) * limit + + if limit <= 0 { + limit = types.QueryDefaultLimit + } + + NodesPageRequest := query.PageRequest{Offset: uint64(offset), Limit: uint64(limit), CountTotal: countTotal, Reverse: reverse} + params := types.NewQueryNodesParams(nil, "", ownerAddress, NodesPageRequest) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { return diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index df6bb962..8d433ba5 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -202,7 +202,7 @@ func (q Querier) StakeByOwner(c context.Context, req *types.QueryStakeByOwnerReq if req.Pagination.Offset > resourceNodesPageRes.Total { metaNodesPageOffset = req.Pagination.Offset - resourceNodesPageRes.Total } - metaNodesPageRequest := query.PageRequest{Offset: metaNodesPageOffset, Limit: metaNodesPageLimit, CountTotal: req.Pagination.CountTotal} + metaNodesPageRequest := query.PageRequest{Offset: metaNodesPageOffset, Limit: metaNodesPageLimit, CountTotal: req.Pagination.CountTotal, Reverse: req.Pagination.CountTotal} var metaNodes types.MetaNodes metaNodeStore := prefix.NewStore(store, types.MetaNodeKey) diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 8dcd7f6a..d8bb713c 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -3,14 +3,16 @@ package keeper import ( "fmt" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" pagiquery "github.com/cosmos/cosmos-sdk/types/query" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/register/types" db "github.com/tendermint/tm-db" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" // this line is used by starport scaffolding # 1 abci "github.com/tendermint/tendermint/abci/types" @@ -26,8 +28,6 @@ const ( QueryNodeStakeByNodeAddr = "node_stakes" QueryNodeStakeByOwner = "node_stakes_by_owner" QueryRegisterParams = "register_params" - - QueryDefaultLimit = 100 ) // NewQuerier creates a new querier for register clients. @@ -233,95 +233,191 @@ func getStakingInfoByNodeAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) (result []byte, err error) { var ( - params types.QueryNodesParams - stakingInfo types.StakingInfo - stakingInfos types.StakingInfos + params types.QueryNodesParams + //stakingInfo types.StakingInfo + stakingInfoResponses types.StakingInfos ) + if req.Data == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + err = legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - resNodes := k.GetResourceNodesFiltered(ctx, params) - metaNodes := k.GetMetaNodesFiltered(ctx, params) - for i, _ := range metaNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(metaNodes[i].GetNetworkAddress()) - unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( - ctx, - metaNodes[i].GetStatus(), - networkAddr, - metaNodes[i].Tokens, - ) - if err != nil { - return nil, err - } - if !metaNodes[i].Equal(types.MetaNode{}) { - stakingInfo = types.NewStakingInfoByMetaNodeAddr( - metaNodes[i], - unBondingStake, - unBondedStake, - bondedStake, - ) - stakingInfos = append(stakingInfos, stakingInfo) - } + if params.OwnerAddr.String() == "" { + return nil, status.Error(codes.InvalidArgument, "owner address cannot be empty") } - for i, _ := range resNodes { - networkAddr, _ := stratos.SdsAddressFromBech32(resNodes[i].GetNetworkAddress()) - unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( - ctx, - resNodes[i].GetStatus(), - networkAddr, - resNodes[i].Tokens, - ) + store := ctx.KVStore(k.storeKey) + + // get resource nodes + var resourceNodes types.ResourceNodes + resourceNodeStore := prefix.NewStore(store, types.ResourceNodeKey) + + limit := params.PageQuery.Limit + if limit == 0 { + limit = types.QueryDefaultLimit + } + offset := params.PageQuery.Offset + countTotal := params.PageQuery.CountTotal + reverse := params.PageQuery.Reverse + PageRequest := pagiquery.PageRequest{Offset: offset, Limit: limit, CountTotal: countTotal, Reverse: reverse} + + resourceNodesPageRes, err := FilteredPaginate(k.cdc, resourceNodeStore, params.OwnerAddr, &PageRequest, func(key []byte, value []byte, accumulate bool) (bool, error) { + val, err := types.UnmarshalResourceNode(k.cdc, value) if err != nil { - return nil, err + return true, err } - if !resNodes[i].Equal(types.ResourceNode{}) { - stakingInfo = types.NewStakingInfoByResourceNodeAddr( - resNodes[i], - unBondingStake, - unBondedStake, - bondedStake, - ) - stakingInfos = append(stakingInfos, stakingInfo) + + if accumulate { + resourceNodes = append(resourceNodes, val) } + + return true, nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + stakingInfoResponses, err = StakingInfosResourceNodes(ctx, k, resourceNodes) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } - start, end := client.Paginate(len(stakingInfos), params.Page, params.Limit, QueryDefaultLimit) - if start < 0 || end < 0 { - return nil, nil - } else { - stakingInfos = stakingInfos[start:end] - result, err = codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfos) + // Continue to get meta nodes + if PageRequest.Limit < resourceNodesPageRes.Total { + resourceNodesPageRes.Total = uint64(len(stakingInfoResponses)) + result, err = codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfoResponses) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return result, nil } -} -func (k Keeper) resourceNodesPagination(filteredNodes []types.ResourceNode, params types.QueryNodesParams) []types.ResourceNode { - start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) - if start < 0 || end < 0 { - filteredNodes = nil - } else { - filteredNodes = filteredNodes[start:end] + metaNodesPageLimit := limit - uint64(len(stakingInfoResponses)) + + metaNodesPageOffset := uint64(0) + if offset > resourceNodesPageRes.Total { + metaNodesPageOffset = offset - resourceNodesPageRes.Total + } + metaNodesPageRequest := pagiquery.PageRequest{Offset: metaNodesPageOffset, Limit: metaNodesPageLimit, CountTotal: countTotal, Reverse: reverse} + var metaNodes types.MetaNodes + metaNodeStore := prefix.NewStore(store, types.MetaNodeKey) + + _, err = FilteredPaginate(k.cdc, metaNodeStore, params.OwnerAddr, &metaNodesPageRequest, func(key []byte, value []byte, accumulate bool) (bool, error) { + val, err := types.UnmarshalMetaNode(k.cdc, value) + if err != nil { + return true, err + } + + if accumulate { + metaNodes = append(metaNodes, val) + } + + return true, nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } - return filteredNodes -} -func (k Keeper) metaNodesPagination(filteredNodes []types.MetaNode, params types.QueryNodesParams) []types.MetaNode { - start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) - if start < 0 || end < 0 { - filteredNodes = nil - } else { - filteredNodes = filteredNodes[start:end] + metaNodesStakingInfoResponses, err := StakingInfosMetaNodes(ctx, k, metaNodes) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } - return filteredNodes + + stakingInfoResponses = append(stakingInfoResponses, metaNodesStakingInfoResponses...) + PageRes := resourceNodesPageRes + PageRes.Total = uint64(len(stakingInfoResponses)) + result, err = codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfoResponses) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + } + return result, nil + + //resNodes := k.GetResourceNodesFiltered(ctx, params) + //metaNodes := k.GetMetaNodesFiltered(ctx, params) + // + //for i, _ := range metaNodes { + // networkAddr, _ := stratos.SdsAddressFromBech32(metaNodes[i].GetNetworkAddress()) + // unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( + // ctx, + // metaNodes[i].GetStatus(), + // networkAddr, + // metaNodes[i].Tokens, + // ) + // if err != nil { + // return nil, err + // } + // if !metaNodes[i].Equal(types.MetaNode{}) { + // stakingInfo = types.NewStakingInfoByMetaNodeAddr( + // metaNodes[i], + // unBondingStake, + // unBondedStake, + // bondedStake, + // ) + // stakingInfos = append(stakingInfos, stakingInfo) + // } + //} + // + //for i, _ := range resNodes { + // networkAddr, _ := stratos.SdsAddressFromBech32(resNodes[i].GetNetworkAddress()) + // unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( + // ctx, + // resNodes[i].GetStatus(), + // networkAddr, + // resNodes[i].Tokens, + // ) + // if err != nil { + // return nil, err + // } + // if !resNodes[i].Equal(types.ResourceNode{}) { + // stakingInfo = types.NewStakingInfoByResourceNodeAddr( + // resNodes[i], + // unBondingStake, + // unBondedStake, + // bondedStake, + // ) + // stakingInfos = append(stakingInfos, stakingInfo) + // } + //} + // + //start, end := client.Paginate(len(stakingInfos), params.Page, params.Limit, QueryDefaultLimit) + //if start < 0 || end < 0 { + // return nil, nil + //} else { + // stakingInfos = stakingInfos[start:end] + // result, err = codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfos) + // if err != nil { + // return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + // } + // return result, nil + //} } +//func (k Keeper) resourceNodesPagination(filteredNodes []types.ResourceNode, params types.QueryNodesParams) []types.ResourceNode { +// start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) +// if start < 0 || end < 0 { +// filteredNodes = nil +// } else { +// filteredNodes = filteredNodes[start:end] +// } +// return filteredNodes +//} +// +//func (k Keeper) metaNodesPagination(filteredNodes []types.MetaNode, params types.QueryNodesParams) []types.MetaNode { +// start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) +// if start < 0 || end < 0 { +// filteredNodes = nil +// } else { +// filteredNodes = filteredNodes[start:end] +// } +// return filteredNodes +//} + func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatus, nodeAddress stratos.SdsAddress, tokens sdk.Int) (unbondingStake, unbondedStake, bondedStake sdk.Int, err error) { unbondingStake = sdk.NewInt(0) unbondedStake = sdk.NewInt(0) @@ -342,39 +438,39 @@ func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatu return unbondingStake, unbondedStake, bondedStake, nil } -func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.MetaNode { - nodes := k.GetAllMetaNodes(ctx) - filteredNodes := make([]types.MetaNode, 0, len(nodes)) - - for i, _ := range nodes { - // match OwnerAddr (if supplied) - nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) - if er != nil { - continue - } - if nodeOwnerAddr.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, nodes[i]) - } - } - return filteredNodes -} - -func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.ResourceNode { - nodes := k.GetAllResourceNodes(ctx) - filteredNodes := make([]types.ResourceNode, 0, len(nodes)) - - for i, _ := range nodes { - // match OwnerAddr - nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) - if er != nil { - continue - } - if nodeOwnerAddr.Equals(params.OwnerAddr) { - filteredNodes = append(filteredNodes, nodes[i]) - } - } - return filteredNodes -} +//func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.MetaNode { +// nodes := k.GetAllMetaNodes(ctx) +// filteredNodes := make([]types.MetaNode, 0, len(nodes)) +// +// for i, _ := range nodes { +// // match OwnerAddr (if supplied) +// nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) +// if er != nil { +// continue +// } +// if nodeOwnerAddr.Equals(params.OwnerAddr) { +// filteredNodes = append(filteredNodes, nodes[i]) +// } +// } +// return filteredNodes +//} + +//func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.ResourceNode { +// nodes := k.GetAllResourceNodes(ctx) +// filteredNodes := make([]types.ResourceNode, 0, len(nodes)) +// +// for i, _ := range nodes { +// // match OwnerAddr +// nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) +// if er != nil { +// continue +// } +// if nodeOwnerAddr.Equals(params.OwnerAddr) { +// filteredNodes = append(filteredNodes, nodes[i]) +// } +// } +// return filteredNodes +//} func getIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator { if reverse { @@ -415,7 +511,7 @@ func FilteredPaginate(cdc codec.Codec, } if limit == 0 { - limit = QueryDefaultLimit + limit = types.QueryDefaultLimit // count total results when the limit is zero/not supplied countTotal = pageRequest.CountTotal @@ -546,6 +642,44 @@ func FilteredPaginate(cdc codec.Codec, return res, nil } +func StakingInfosResourceNodes( + ctx sdk.Context, k Keeper, resourceNodes types.ResourceNodes, +) (types.StakingInfos, error) { + res := types.StakingInfos{} + resp := make([]*types.StakingInfo, len(resourceNodes)) + + for i, resourceNode := range resourceNodes { + stakingInfoResp, err := StakingInfoToStakingInfoResourceNode(ctx, k, resourceNode) + if err != nil { + return nil, err + } + + resp[i] = &stakingInfoResp + res = append(res, *resp[i]) + } + + return res, nil +} + +func StakingInfosMetaNodes( + ctx sdk.Context, k Keeper, metaNodes types.MetaNodes, +) (types.StakingInfos, error) { + res := types.StakingInfos{} + resp := make([]*types.StakingInfo, len(metaNodes)) + + for i, metaNode := range metaNodes { + stakingInfoResp, err := StakingInfoToStakingInfoMetaNode(ctx, k, metaNode) + if err != nil { + return nil, err + } + + resp[i] = &stakingInfoResp + res = append(res, *resp[i]) + } + + return res, nil +} + func StakingInfosToStakingResourceNodes( ctx sdk.Context, k Keeper, resourceNodes types.ResourceNodes, ) ([]*types.StakingInfo, error) { @@ -566,6 +700,7 @@ func StakingInfosToStakingResourceNodes( func StakingInfosToStakingMetaNodes( ctx sdk.Context, k Keeper, metaNodes types.MetaNodes, ) ([]*types.StakingInfo, error) { + resp := make([]*types.StakingInfo, len(metaNodes)) for i, metaNode := range metaNodes { @@ -575,6 +710,7 @@ func StakingInfosToStakingMetaNodes( } resp[i] = &stakingInfoResp + } return resp, nil diff --git a/x/register/types/querier.go b/x/register/types/querier.go index bfd1c918..d798e8f6 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -4,30 +4,30 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + pagiquery "github.com/cosmos/cosmos-sdk/types/query" stratos "github.com/stratosnet/stratos-chain/types" ) const ( - defaultDenom = "ustos" - QueryType_All = 0 - QueryType_SP = 1 - QueryType_PP = 2 + defaultDenom = "ustos" + QueryType_All = 0 + QueryType_SP = 1 + QueryType_PP = 2 + QueryDefaultLimit = 100 ) // QueryNodesParams Params for query 'custom/register/resource-nodes' type QueryNodesParams struct { - Page int - Limit int + PageQuery pagiquery.PageRequest NetworkAddr stratos.SdsAddress Moniker string OwnerAddr sdk.AccAddress } // NewQueryNodesParams creates a new instance of QueryNodesParams -func NewQueryNodesParams(page, limit int, networkAddr stratos.SdsAddress, moniker string, ownerAddr sdk.AccAddress) QueryNodesParams { +func NewQueryNodesParams(networkAddr stratos.SdsAddress, moniker string, ownerAddr sdk.AccAddress, pageQuery pagiquery.PageRequest) QueryNodesParams { return QueryNodesParams{ - Page: page, - Limit: limit, + PageQuery: pageQuery, NetworkAddr: networkAddr, Moniker: moniker, OwnerAddr: ownerAddr, From 2a14f5c93846bd2b67a929b8724dc898606810da Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 8 Jun 2022 13:25:52 -0400 Subject: [PATCH 101/113] cleanup --- x/register/keeper/querier.go | 113 ----------------------------------- 1 file changed, 113 deletions(-) diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index d8bb713c..c96fb2a1 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -337,87 +337,8 @@ func getStakingInfoByOwnerAddr(ctx sdk.Context, req abci.RequestQuery, k Keeper, return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return result, nil - - //resNodes := k.GetResourceNodesFiltered(ctx, params) - //metaNodes := k.GetMetaNodesFiltered(ctx, params) - // - //for i, _ := range metaNodes { - // networkAddr, _ := stratos.SdsAddressFromBech32(metaNodes[i].GetNetworkAddress()) - // unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( - // ctx, - // metaNodes[i].GetStatus(), - // networkAddr, - // metaNodes[i].Tokens, - // ) - // if err != nil { - // return nil, err - // } - // if !metaNodes[i].Equal(types.MetaNode{}) { - // stakingInfo = types.NewStakingInfoByMetaNodeAddr( - // metaNodes[i], - // unBondingStake, - // unBondedStake, - // bondedStake, - // ) - // stakingInfos = append(stakingInfos, stakingInfo) - // } - //} - // - //for i, _ := range resNodes { - // networkAddr, _ := stratos.SdsAddressFromBech32(resNodes[i].GetNetworkAddress()) - // unBondingStake, unBondedStake, bondedStake, err := k.getNodeStakes( - // ctx, - // resNodes[i].GetStatus(), - // networkAddr, - // resNodes[i].Tokens, - // ) - // if err != nil { - // return nil, err - // } - // if !resNodes[i].Equal(types.ResourceNode{}) { - // stakingInfo = types.NewStakingInfoByResourceNodeAddr( - // resNodes[i], - // unBondingStake, - // unBondedStake, - // bondedStake, - // ) - // stakingInfos = append(stakingInfos, stakingInfo) - // } - //} - // - //start, end := client.Paginate(len(stakingInfos), params.Page, params.Limit, QueryDefaultLimit) - //if start < 0 || end < 0 { - // return nil, nil - //} else { - // stakingInfos = stakingInfos[start:end] - // result, err = codec.MarshalJSONIndent(legacyQuerierCdc, stakingInfos) - // if err != nil { - // return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) - // } - // return result, nil - //} } -//func (k Keeper) resourceNodesPagination(filteredNodes []types.ResourceNode, params types.QueryNodesParams) []types.ResourceNode { -// start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) -// if start < 0 || end < 0 { -// filteredNodes = nil -// } else { -// filteredNodes = filteredNodes[start:end] -// } -// return filteredNodes -//} -// -//func (k Keeper) metaNodesPagination(filteredNodes []types.MetaNode, params types.QueryNodesParams) []types.MetaNode { -// start, end := client.Paginate(len(filteredNodes), params.Page, params.Limit, QueryDefaultLimit) -// if start < 0 || end < 0 { -// filteredNodes = nil -// } else { -// filteredNodes = filteredNodes[start:end] -// } -// return filteredNodes -//} - func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatus, nodeAddress stratos.SdsAddress, tokens sdk.Int) (unbondingStake, unbondedStake, bondedStake sdk.Int, err error) { unbondingStake = sdk.NewInt(0) unbondedStake = sdk.NewInt(0) @@ -438,40 +359,6 @@ func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatu return unbondingStake, unbondedStake, bondedStake, nil } -//func (k Keeper) GetMetaNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.MetaNode { -// nodes := k.GetAllMetaNodes(ctx) -// filteredNodes := make([]types.MetaNode, 0, len(nodes)) -// -// for i, _ := range nodes { -// // match OwnerAddr (if supplied) -// nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) -// if er != nil { -// continue -// } -// if nodeOwnerAddr.Equals(params.OwnerAddr) { -// filteredNodes = append(filteredNodes, nodes[i]) -// } -// } -// return filteredNodes -//} - -//func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.ResourceNode { -// nodes := k.GetAllResourceNodes(ctx) -// filteredNodes := make([]types.ResourceNode, 0, len(nodes)) -// -// for i, _ := range nodes { -// // match OwnerAddr -// nodeOwnerAddr, er := sdk.AccAddressFromBech32(nodes[i].GetOwnerAddress()) -// if er != nil { -// continue -// } -// if nodeOwnerAddr.Equals(params.OwnerAddr) { -// filteredNodes = append(filteredNodes, nodes[i]) -// } -// } -// return filteredNodes -//} - func getIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator { if reverse { var end []byte From ba5ad6d2f13d5f5e029c38598953aae00c1b97a1 Mon Sep 17 00:00:00 2001 From: Xiong Date: Thu, 9 Jun 2022 12:42:25 -0400 Subject: [PATCH 102/113] unit test fix --- app/app.go | 53 +- app/encoding.go | 19 + app/test_helpers.go | 541 +++++++++++++++++++ app/utils.go | 27 + x/pot/app_test.go | 870 +++++++++++++++---------------- x/pot/genesis.go | 2 +- x/pot/keeper/params.go | 4 +- x/pot/keeper/store.go | 1 - x/pot/pot_test.go | 516 +++++++++--------- x/pot/types/params.go | 2 +- x/register/client/cli/tx.go | 8 +- x/register/types/genesis.go | 4 +- x/register/types/registration.go | 6 +- 13 files changed, 1317 insertions(+), 736 deletions(-) create mode 100644 app/encoding.go create mode 100644 app/test_helpers.go create mode 100644 app/utils.go diff --git a/app/app.go b/app/app.go index 268e858e..4bbe65bf 100644 --- a/app/app.go +++ b/app/app.go @@ -87,6 +87,7 @@ import ( ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v3/modules/core" ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" @@ -129,6 +130,8 @@ var ( distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, + ibcclientclient.UpdateClientProposalHandler, + ibcclientclient.UpgradeProposalHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -182,7 +185,8 @@ var ( // module accounts that are allowed to receive tokens allowedReceivingModAcc = map[string]bool{ - distrtypes.ModuleName: true, + distrtypes.ModuleName: true, + authtypes.FeeCollectorName: true, //pot.FoundationAccount: true, } ) @@ -558,6 +562,31 @@ func NewInitApp( app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) + // create the simulation manager and define the order of the modules for deterministic simulations + + // NOTE: this is not required apps that don't use the simulator for fuzz testing + // transactions + app.sm = module.NewSimulationManager( + // Use custom RandomGenesisAccounts so that auth module could create random EthAccounts in genesis state when genesis.json not specified + auth.NewAppModule(appCodec, app.accountKeeper, RandomGenesisAccounts), + bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper), + capability.NewAppModule(appCodec, *app.capabilityKeeper), + gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper), + mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper), + staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), + distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), + slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), + params.NewAppModule(app.paramsKeeper), + evidence.NewAppModule(app.evidenceKeeper), + feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.feeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), + ibc.NewAppModule(app.ibcKeeper), + transferModule, + evm.NewAppModule(app.evmKeeper, app.accountKeeper), + ) + + app.sm.RegisterStoreDecoders() + // initialize stores app.MountKVStores(keys) app.MountTransientStores(tKeys) @@ -641,7 +670,7 @@ func (app *NewApp) BlockedAddrs() map[string]bool { return blockedAddrs } -func (app *NewApp) Codec() codec.Codec { +func (app *NewApp) AppCodec() codec.Codec { return app.appCodec } @@ -700,6 +729,26 @@ func (app *NewApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICon } } +func (app *NewApp) GetAccountKeeper() authkeeper.AccountKeeper { + return app.accountKeeper +} + +func (app *NewApp) GetBankKeeper() bankkeeper.Keeper { + return app.bankKeeper +} + +func (app *NewApp) GetStakingKeeper() stakingkeeper.Keeper { + return app.stakingKeeper +} + +func (app *NewApp) GetRegisterKeeper() registerkeeper.Keeper { + return app.registerKeeper +} + +func (app *NewApp) GetPotKeeper() potkeeper.Keeper { + return app.potKeeper +} + // RegisterSwaggerAPI registers swagger route with API Server func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { statikFS, err := fs.New() diff --git a/app/encoding.go b/app/encoding.go new file mode 100644 index 00000000..fd2d01e9 --- /dev/null +++ b/app/encoding.go @@ -0,0 +1,19 @@ +package app + +import ( + simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + "github.com/cosmos/cosmos-sdk/std" +) + +// MakeTestEncodingConfig creates an EncodingConfig for testing. This function +// should be used only in tests or when creating a new app instance (NewApp*()). +// App user shouldn't create new codecs - use the app.AppCodec instead. +// [DEPRECATED] +func MakeTestEncodingConfig() simappparams.EncodingConfig { + encodingConfig := simappparams.MakeTestEncodingConfig() + std.RegisterLegacyAminoCodec(encodingConfig.Amino) + std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) + ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig +} diff --git a/app/test_helpers.go b/app/test_helpers.go new file mode 100644 index 00000000..c07476a9 --- /dev/null +++ b/app/test_helpers.go @@ -0,0 +1,541 @@ +package app + +import ( + "bytes" + "encoding/hex" + "encoding/json" + "fmt" + "strconv" + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/simapp" + stratos "github.com/stratosnet/stratos-chain/types" + evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" + pottypes "github.com/stratosnet/stratos-chain/x/pot/types" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" + sdstypes "github.com/stratosnet/stratos-chain/x/sds/types" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" + dbm "github.com/tendermint/tm-db" + + bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/simapp/helpers" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// DefaultConsensusParams defines the default Tendermint consensus params used in +// SimApp testing. +var DefaultConsensusParams = &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxBytes: 200000, + MaxGas: 2000000, + }, + Evidence: &tmproto.EvidenceParams{ + MaxAgeNumBlocks: 302400, + MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration + MaxBytes: 10000, + }, + Validator: &tmproto.ValidatorParams{ + PubKeyTypes: []string{ + tmtypes.ABCIPubKeyTypeEd25519, + }, + }, +} + +func setup(withGenesis bool, invCheckPeriod uint) (*NewApp, simapp.GenesisState) { + db := dbm.NewMemDB() + encCdc := MakeTestEncodingConfig() + app := NewInitApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, EmptyAppOptions{}) + if withGenesis { + return app, simapp.NewDefaultGenesisState(encCdc.Marshaler) + } + return app, simapp.GenesisState{} +} + +// Setup initializes a new SimApp. A Nop logger is set in SimApp. +func Setup(isCheckTx bool, chainId string) *NewApp { + app, genesisState := setup(!isCheckTx, 5) + if !isCheckTx { + // init chain must be called to stop deliverState from being nil + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + if err != nil { + panic(err) + } + + // Initialize the chain + app.InitChain( + abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: DefaultConsensusParams, + AppStateBytes: stateBytes, + ChainId: chainId, + }, + ) + } + + return app +} + +// SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts +// that also act as delegators. For simplicity, each validator is bonded with a delegation +// of one consensus engine unit (10^6) in the default token of the simapp from first genesis +// account. A Nop logger is set in SimApp. +func SetupWithGenesisNodeSet(t *testing.T, + valSet *tmtypes.ValidatorSet, + metaNodes []registertypes.MetaNode, + resourceNodes []registertypes.ResourceNode, + genAccs []authtypes.GenesisAccount, + totalUnissuedPrepay sdk.Coin, + chainId string, + balances ...banktypes.Balance) *NewApp { + + app, genesisState := setup(true, 5) + // set genesis accounts + authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) + genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) + + validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) + delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) + + bondedAmt := sdk.ZeroInt() + bondAmt := sdk.NewInt(1000000) + + for _, val := range valSet.Validators { + pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) + require.NoError(t, err) + pkAny, err := codectypes.NewAnyWithValue(pk) + require.NoError(t, err) + validator := stakingtypes.Validator{ + OperatorAddress: sdk.ValAddress(val.Address).String(), + ConsensusPubkey: pkAny, + Jailed: false, + Status: stakingtypes.Bonded, + Tokens: bondAmt, + DelegatorShares: sdk.OneDec(), + Description: stakingtypes.Description{}, + UnbondingHeight: int64(0), + UnbondingTime: time.Unix(0, 0).UTC(), + Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + MinSelfDelegation: sdk.ZeroInt(), + } + validators = append(validators, validator) + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) + bondedAmt = bondedAmt.Add(bondAmt) + } + // set validators and delegations + stakingGenesis := stakingtypes.NewGenesisState( + stakingtypes.NewParams( + stakingtypes.DefaultUnbondingTime, + stakingtypes.DefaultMaxValidators, + stakingtypes.DefaultMaxEntries, + stakingtypes.DefaultHistoricalEntries, + stratos.USTOS), + validators, + delegations) + genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) + + // add bonded amount to bonded pool module account + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), + Coins: sdk.Coins{sdk.NewCoin(stratos.USTOS, bondedAmt)}, + }) + + // add bonded amount of resource nodes to module account + resNodeBondedAmt := sdk.ZeroInt() + for _, resNode := range resourceNodes { + resNodeBondedAmt = resNodeBondedAmt.Add(resNode.Tokens) + } + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(registertypes.ResourceNodeBondedPoolName).String(), + Coins: sdk.Coins{sdk.NewCoin(stratos.USTOS, resNodeBondedAmt)}, + }) + + // add bonded amount of meta nodes to module account + metaNodeBondedAmt := sdk.ZeroInt() + for _, metaNode := range metaNodes { + metaNodeBondedAmt = metaNodeBondedAmt.Add(metaNode.Tokens) + } + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(registertypes.MetaNodeBondedPoolName).String(), + Coins: sdk.Coins{sdk.NewCoin(stratos.USTOS, metaNodeBondedAmt)}, + }) + + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(registertypes.TotalUnissuedPrepayName).String(), + Coins: sdk.Coins{totalUnissuedPrepay}, + }) + + totalSupply := sdk.NewCoins() + for _, b := range balances { + // add genesis acc tokens and delegated tokens to total supply + totalSupply = totalSupply.Add(b.Coins.Add(sdk.NewCoin(stratos.USTOS, bondedAmt))...) + } + + // update total supply + bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) + genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) + + //registerGenesis := registertypes.DefaultGenesisState() + registerGenesis := registertypes.NewGenesisState( + registertypes.DefaultParams(), + resourceNodes, + metaNodes, + registertypes.DefaultUozPrice, + make([]*registertypes.Slashing, 0), + ) + genesisState[registertypes.ModuleName] = app.AppCodec().MustMarshalJSON(registerGenesis) + + potGenesis := pottypes.DefaultGenesisState() + genesisState[pottypes.ModuleName] = app.AppCodec().MustMarshalJSON(potGenesis) + + sdsGenesis := sdstypes.DefaultGenesisState() + genesisState[sdstypes.ModuleName] = app.AppCodec().MustMarshalJSON(sdsGenesis) + + evmGenesis := evmtypes.DefaultGenesisState() + genesisState[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) + + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + require.NoError(t, err) + + // init chain will set the validator set and initialize the genesis accounts + app.InitChain( + abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: DefaultConsensusParams, + AppStateBytes: stateBytes, + ChainId: chainId, + }, + ) + + // commit genesis changes + app.Commit() + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{ + Height: app.LastBlockHeight() + 1, + AppHash: app.LastCommitID().Hash, + ValidatorsHash: valSet.Hash(), + NextValidatorsHash: valSet.Hash(), + ChainID: chainId, + }}) + + return app +} + +// SetupWithGenesisAccounts initializes a new SimApp with the provided genesis +// accounts and possible balances. +func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, chainId string, balances ...banktypes.Balance) *NewApp { + app, genesisState := setup(true, 0) + authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) + genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) + + totalSupply := sdk.NewCoins() + for _, b := range balances { + totalSupply = totalSupply.Add(b.Coins...) + } + + bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) + genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) + + evmGenesis := evmtypes.DefaultGenesisState() + genesisState[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) + + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + if err != nil { + panic(err) + } + + app.InitChain( + abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: DefaultConsensusParams, + AppStateBytes: stateBytes, + ChainId: chainId, + }, + ) + + app.Commit() + app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, ChainID: chainId}}) + + return app +} + +type GenerateAccountStrategy func(int) []sdk.AccAddress + +// createRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order. +func createRandomAccounts(accNum int) []sdk.AccAddress { + testAddrs := make([]sdk.AccAddress, accNum) + for i := 0; i < accNum; i++ { + pk := ed25519.GenPrivKey().PubKey() + testAddrs[i] = sdk.AccAddress(pk.Address()) + } + + return testAddrs +} + +// createIncrementalAccounts is a strategy used by addTestAddrs() in order to generated addresses in ascending order. +func createIncrementalAccounts(accNum int) []sdk.AccAddress { + var addresses []sdk.AccAddress + var buffer bytes.Buffer + + // start at 100 so we can make up to 999 test addresses with valid test addresses + for i := 100; i < (accNum + 100); i++ { + numString := strconv.Itoa(i) + buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") // base address string + + buffer.WriteString(numString) // adding on final two digits to make addresses unique + res, _ := sdk.AccAddressFromHex(buffer.String()) + bech := res.String() + addr, _ := TestAddr(buffer.String(), bech) + + addresses = append(addresses, addr) + buffer.Reset() + } + + return addresses +} + +// AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys. +func AddTestAddrsFromPubKeys(app *NewApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int) { + initCoins := sdk.NewCoins(sdk.NewCoin(app.stakingKeeper.BondDenom(ctx), accAmt)) + + for _, pk := range pubKeys { + initAccountWithCoins(app, ctx, sdk.AccAddress(pk.Address()), initCoins) + } +} + +// AddTestAddrs constructs and returns accNum amount of accounts with an +// initial balance of accAmt in random order +func AddTestAddrs(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress { + return addTestAddrs(app, ctx, accNum, accAmt, createRandomAccounts) +} + +// AddTestAddrs constructs and returns accNum amount of accounts with an +// initial balance of accAmt in random order +func AddTestAddrsIncremental(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress { + return addTestAddrs(app, ctx, accNum, accAmt, createIncrementalAccounts) +} + +func addTestAddrs(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int, strategy GenerateAccountStrategy) []sdk.AccAddress { + testAddrs := strategy(accNum) + + initCoins := sdk.NewCoins(sdk.NewCoin(app.stakingKeeper.BondDenom(ctx), accAmt)) + + for _, addr := range testAddrs { + initAccountWithCoins(app, ctx, addr, initCoins) + } + + return testAddrs +} + +func initAccountWithCoins(app *NewApp, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) { + err := app.bankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + if err != nil { + panic(err) + } + + err = app.bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) + if err != nil { + panic(err) + } +} + +// ConvertAddrsToValAddrs converts the provided addresses to ValAddress. +func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress { + valAddrs := make([]sdk.ValAddress, len(addrs)) + + for i, addr := range addrs { + valAddrs[i] = sdk.ValAddress(addr) + } + + return valAddrs +} + +func TestAddr(addr string, bech string) (sdk.AccAddress, error) { + res, err := sdk.AccAddressFromHex(addr) + if err != nil { + return nil, err + } + bechexpected := res.String() + if bech != bechexpected { + return nil, fmt.Errorf("bech encoding doesn't match reference") + } + + bechres, err := sdk.AccAddressFromBech32(bech) + if err != nil { + return nil, err + } + if !bytes.Equal(bechres, res) { + return nil, err + } + + return res, nil +} + +// CheckBalance checks the balance of an account. +func CheckBalance(t *testing.T, app *NewApp, addr sdk.AccAddress, balances sdk.Coins) { + ctxCheck := app.BaseApp.NewContext(true, tmproto.Header{}) + require.True(t, balances.IsEqual(app.bankKeeper.GetAllBalances(ctxCheck, addr))) +} + +// SignCheckDeliver checks a generated signed transaction and simulates a +// block commitment with the given transaction. A test assertion is made using +// the parameter 'expPass' against the result. A corresponding result is +// returned. +func SignCheckDeliver( + t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg, + chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, +) (sdk.GasInfo, *sdk.Result, error) { + + tx, err := helpers.GenTx( + txCfg, + msgs, + sdk.Coins{sdk.NewInt64Coin(stratos.USTOS, 0)}, + helpers.DefaultGenTxGas, + chainID, + accNums, + accSeqs, + priv..., + ) + require.NoError(t, err) + txBytes, err := txCfg.TxEncoder()(tx) + require.Nil(t, err) + + // Must simulate now as CheckTx doesn't run Msgs anymore + _, res, err := app.Simulate(txBytes) + + if expSimPass { + require.NoError(t, err) + require.NotNil(t, res) + } else { + require.Error(t, err) + require.Nil(t, res) + } + + // Simulate a sending a transaction and committing a block + app.BeginBlock(abci.RequestBeginBlock{Header: header}) + gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx) + + if expPass { + require.NoError(t, err) + require.NotNil(t, res) + } else { + require.Error(t, err) + require.Nil(t, res) + } + + app.EndBlock(abci.RequestEndBlock{}) + app.Commit() + + return gInfo, res, err +} + +// GenSequenceOfTxs generates a set of signed transactions of messages, such +// that they differ only by having the sequence numbers incremented between +// every transaction. +func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...cryptotypes.PrivKey) ([]sdk.Tx, error) { + txs := make([]sdk.Tx, numToGenerate) + var err error + for i := 0; i < numToGenerate; i++ { + txs[i], err = helpers.GenTx( + txGen, + msgs, + sdk.Coins{sdk.NewInt64Coin(stratos.USTOS, 0)}, + helpers.DefaultGenTxGas, + "", + accNums, + initSeqNums, + priv..., + ) + if err != nil { + break + } + incrementAllSequenceNumbers(initSeqNums) + } + + return txs, err +} + +func incrementAllSequenceNumbers(initSeqNums []uint64) { + for i := 0; i < len(initSeqNums); i++ { + initSeqNums[i]++ + } +} + +// CreateTestPubKeys returns a total of numPubKeys public keys in ascending order. +func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey { + var publicKeys []cryptotypes.PubKey + var buffer bytes.Buffer + + // start at 10 to avoid changing 1 to 01, 2 to 02, etc + for i := 100; i < (numPubKeys + 100); i++ { + numString := strconv.Itoa(i) + buffer.WriteString("0B485CFC0EECC619440448436F8FC9DF40566F2369E72400281454CB552AF") // base pubkey string + buffer.WriteString(numString) // adding on final two digits to make pubkeys unique + publicKeys = append(publicKeys, NewPubKeyFromHex(buffer.String())) + buffer.Reset() + } + + return publicKeys +} + +// NewPubKeyFromHex returns a PubKey from a hex string. +func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) { + pkBytes, err := hex.DecodeString(pk) + if err != nil { + panic(err) + } + if len(pkBytes) != ed25519.PubKeySize { + panic(errors.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size")) + } + return &ed25519.PubKey{Key: pkBytes} +} + +// EmptyAppOptions is a stub implementing AppOptions +type EmptyAppOptions struct{} + +// Get implements AppOptions +func (ao EmptyAppOptions) Get(o string) interface{} { + return nil +} + +// FundAccount is a utility function that funds an account by minting and +// sending the coins to the address. This should be used for testing purposes +// only! +// +// TODO: Instead of using the mint module account, which has the +// permission of minting, create a "faucet" account. (@fdymylja) +func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error { + if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil { + return err + } + + return bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts) +} + +// FundModuleAccount is a utility function that funds a module account by +// minting and sending the coins to the address. This should be used for testing +// purposes only! +// +// TODO: Instead of using the mint module account, which has the +// permission of minting, create a "faucet" account. (@fdymylja) +func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error { + if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil { + return err + } + + return bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, recipientMod, amounts) +} diff --git a/app/utils.go b/app/utils.go new file mode 100644 index 00000000..68788e32 --- /dev/null +++ b/app/utils.go @@ -0,0 +1,27 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + stratos "github.com/stratosnet/stratos-chain/types" +) + +// RandomGenesisAccounts is used by the auth module to create random genesis accounts in simulation when a genesis.json is not specified. +// In contrast, the default auth module's RandomGenesisAccounts implementation creates only base accounts and vestings accounts. +func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAccounts { + emptyCodeHash := crypto.Keccak256(nil) + genesisAccs := make(authtypes.GenesisAccounts, len(simState.Accounts)) + for i, acc := range simState.Accounts { + bacc := authtypes.NewBaseAccountWithAddress(acc.Address) + + ethacc := &stratos.EthAccount{ + BaseAccount: bacc, + CodeHash: common.BytesToHash(emptyCodeHash).String(), + } + genesisAccs[i] = ethacc + } + + return genesisAccs +} diff --git a/x/pot/app_test.go b/x/pot/app_test.go index e138c520..3ba51e1b 100644 --- a/x/pot/app_test.go +++ b/x/pot/app_test.go @@ -1,459 +1,401 @@ -package pot +package pot_test + +import ( + "testing" + + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stratosnet/stratos-chain/app" + stratos "github.com/stratosnet/stratos-chain/types" + potKeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" + registerKeeper "github.com/stratosnet/stratos-chain/x/register/keeper" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" + + abci "github.com/tendermint/tendermint/abci/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stratosnet/stratos-chain/x/pot/types" +) + +const ( + stopFlagOutOfTotalMiningReward = true + stopFlagSpecificMinedReward = false + stopFlagSpecificEpoch = true +) + +var ( + paramSpecificMinedReward = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(160000000000))) + paramSpecificEpoch = sdk.NewInt(10) +) + +// initialize data of volume report +func setupMsgVolumeReport(newEpoch int64) *types.MsgVolumeReport { + volume1 := types.NewSingleWalletVolume(resOwner1, resourceNodeVolume1) + volume2 := types.NewSingleWalletVolume(resOwner2, resourceNodeVolume2) + volume3 := types.NewSingleWalletVolume(resOwner3, resourceNodeVolume3) + + nodesVolume := []*types.SingleWalletVolume{volume1, volume2, volume3} + reporter := idxNodeNetworkId1 + epoch := sdk.NewInt(newEpoch) + reportReference := "report for epoch " + epoch.String() + reporterOwner := idxOwner1 + + pubKeys := make([][]byte, 1) + for i := range pubKeys { + pubKeys[i] = make([]byte, 1) + } + + signature := types.NewBLSSignatureInfo(pubKeys, []byte("signature"), []byte("txData")) + + volumeReportMsg := types.NewMsgVolumeReport(nodesVolume, reporter, epoch, reportReference, reporterOwner, signature) + + return volumeReportMsg +} + +func setupSlashingMsg() *types.MsgSlashingResourceNode { + reporters := make([]stratos.SdsAddress, 0) + reporters = append(reporters, idxNodeNetworkId1) + reportOwner := make([]sdk.AccAddress, 0) + reportOwner = append(reportOwner, idxOwner1) + + slashingMsg := types.NewMsgSlashingResourceNode(reporters, reportOwner, resNodeNetworkId1, resOwner1, resNodeSlashingUOZAmt1, true) + return slashingMsg +} + +// Test case termination conditions +// modify stop flag & variable could make the test case stop when reach a specific condition +func isNeedStop(ctx sdk.Context, k potKeeper.Keeper, epoch sdk.Int, minedToken sdk.Coin) bool { + + if stopFlagOutOfTotalMiningReward && (minedToken.Amount.GT(foundationDeposit.AmountOf(k.RewardDenom(ctx))) || + minedToken.Amount.GT(foundationDeposit.AmountOf(k.RewardDenom(ctx)))) { + return true + } + if stopFlagSpecificMinedReward && minedToken.Amount.GT(paramSpecificMinedReward.AmountOf(k.BondDenom(ctx))) { + return true + } + if stopFlagSpecificEpoch && epoch.GT(paramSpecificEpoch) { + return true + } + return false +} + +func TestPotVolumeReportMsgs(t *testing.T) { + /********************* initialize mock app *********************/ + //mApp, k, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper := getMockApp(t) + accs, balances := setupAccounts() + //stApp := app.SetupWithGenesisAccounts(accs, chainID, balances...) + validators := make([]*tmtypes.Validator, 0) + valSet := tmtypes.NewValidatorSet(validators) + metaNodes := setupAllMetaNodes() + resourceNodes := setupAllResourceNodes() + + stApp := app.SetupWithGenesisNodeSet(t, valSet, metaNodes, resourceNodes, accs, totalUnissuedPrepay, chainID, balances...) + + accountKeeper := stApp.GetAccountKeeper() + bankKeeper := stApp.GetBankKeeper() + registerKeeper := stApp.GetRegisterKeeper() + potKeeper := stApp.GetPotKeeper() + + /********************* foundation account deposit *********************/ + header := tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + ctx := stApp.BaseApp.NewContext(true, header) + + foundationDepositMsg := types.NewMsgFoundationDeposit(foundationDeposit, foundationDepositorAccAddr) + txGen := app.MakeTestEncodingConfig().TxConfig + + foundationDepositorAcc := accountKeeper.GetAccount(ctx, foundationDepositorAccAddr) + accNum := foundationDepositorAcc.GetAccountNumber() + accSeq := foundationDepositorAcc.GetSequence() + _, _, err := app.SignCheckDeliver(t, txGen, stApp.BaseApp, header, []sdk.Msg{foundationDepositMsg}, chainID, []uint64{accNum}, []uint64{accSeq}, true, true, foundationDepositorPrivKey) + require.NoError(t, err) + foundationAccountAddr := accountKeeper.GetModuleAddress(types.FoundationAccount) + app.CheckBalance(t, stApp, foundationAccountAddr, foundationDeposit) + + /********************* create validator with 50% commission *********************/ + header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + ctx = stApp.BaseApp.NewContext(true, header) + + commission := stakingtypes.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) + description := stakingtypes.NewDescription("foo_moniker", chainID, "", "", "") + createValidatorMsg, err := stakingtypes.NewMsgCreateValidator(valOpValAddr1, valConsPubk1, sdk.NewCoin("ustos", valInitialStake), description, commission, sdk.OneInt()) + + valOpAcc1 := accountKeeper.GetAccount(ctx, valOpAccAddr1) + accNum = valOpAcc1.GetAccountNumber() + accSeq = valOpAcc1.GetSequence() + _, _, err = app.SignCheckDeliver(t, txGen, stApp.BaseApp, header, []sdk.Msg{createValidatorMsg}, chainID, []uint64{accNum}, []uint64{accSeq}, true, true, valOpPrivKey1) + require.NoError(t, err) + app.CheckBalance(t, stApp, valOpAccAddr1, nil) + + /********************** commit **********************/ + header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + ctx = stApp.BaseApp.NewContext(true, header) + stApp.BeginBlock(abci.RequestBeginBlock{Header: header}) + + validator := checkValidator(t, stApp, valOpValAddr1, true) + require.Equal(t, stakingtypes.Bonded, validator.Status) + require.True(sdk.IntEq(t, valInitialStake, validator.BondedTokens())) + + /********************** loop sending volume report **********************/ + var i int64 + var slashingAmtSetup sdk.Int + i = 0 + slashingAmtSetup = sdk.ZeroInt() + for { + + /********************* test slashing msg when i==2 *********************/ + if i == 2 { + println("********************************* Deliver Slashing Tx START ********************************************") + slashingMsg := setupSlashingMsg() + /********************* deliver tx *********************/ + + idxOwnerAcc1 := accountKeeper.GetAccount(ctx, idxOwner1) + ownerAccNum := idxOwnerAcc1.GetAccountNumber() + ownerAccSeq := idxOwnerAcc1.GetSequence() + + _, _, err = app.SignCheckDeliver(t, txGen, stApp.BaseApp, header, []sdk.Msg{slashingMsg}, chainID, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) + require.NoError(t, err) + /********************* commit & check result *********************/ + header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + ctx = stApp.BaseApp.NewContext(true, header) + + slashingAmtSetup = registerKeeper.GetSlashing(ctx, resOwner1) + + totalConsumedUoz := resNodeSlashingUOZAmt1.ToDec() + + slashingAmtCheck := potKeeper.GetTrafficReward(ctx, totalConsumedUoz) + println("slashingAmtSetup=" + slashingAmtSetup.String()) + require.Equal(t, slashingAmtSetup, slashingAmtCheck.TruncateInt()) + + println("********************************* Deliver Slashing Tx END ********************************************") + } + + println("*****************************************************************************") + /********************* prepare tx data *********************/ + volumeReportMsg := setupMsgVolumeReport(i + 1) + + lastTotalMinedToken := potKeeper.GetTotalMinedTokens(ctx) + println("last committed TotalMinedTokens = " + lastTotalMinedToken.String()) + epoch, ok := sdk.NewIntFromString(volumeReportMsg.Epoch.String()) + require.Equal(t, ok, true) + + if isNeedStop(ctx, potKeeper, epoch, lastTotalMinedToken) { + break + } + + totalConsumedUoz := potKeeper.GetTotalConsumedUoz(volumeReportMsg.WalletVolumes).ToDec() + + /********************* print info *********************/ + println("epoch " + volumeReportMsg.Epoch.String()) + S := registerKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() + Pt := registerKeeper.GetTotalUnissuedPrepay(ctx).Amount.ToDec() + Y := totalConsumedUoz + Lt := registerKeeper.GetRemainingOzoneLimit(ctx).ToDec() + R := S.Add(Pt).Mul(Y).Quo(Lt.Add(Y)) + //println("R = (S + Pt) * Y / (Lt + Y)") + println("S=" + S.String() + "\nPt=" + Pt.String() + "\nY=" + Y.String() + "\nLt=" + Lt.String() + "\nR=" + R.String() + "\n") + + println("---------------------------") + distributeGoal := types.InitDistributeGoal() + distributeGoal, err := potKeeper.CalcTrafficRewardInTotal(ctx, distributeGoal, totalConsumedUoz) + require.NoError(t, err) + + /********************************************************** Main net part Start *********************************************************************/ + distributeGoal, err = potKeeper.CalcMiningRewardInTotal(ctx, distributeGoal) //for main net + require.NoError(t, err) + println(distributeGoal.String()) + + println("---------------------------") + println("distribute detail:") + distributeGoalBalance := distributeGoal + rewardDetailMap := make(map[string]types.Reward) + rewardDetailMap, distributeGoalBalance = potKeeper.CalcRewardForResourceNode(ctx, totalConsumedUoz, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap) + /********************************************************** Main net part End *********************************************************************/ + + println("resource_wallet1: address = " + resOwner1.String()) + println(" miningReward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) + + println("resource_wallet2: address = " + resOwner2.String()) + println(" miningReward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) + + println("resource_wallet3: address = " + resOwner3.String()) + println(" miningReward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) + + println("resource_wallet4: address = " + resOwner4.String()) + println(" miningReward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) + + println("resource_wallet5: address = " + resOwner5.String()) + println(" miningReward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) + + println("indexing_wallet1: address = " + idxOwner1.String()) + println(" miningReward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) + + println("indexing_wallet2: address = " + idxOwner2.String()) + println(" miningReward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) + + println("indexing_wallet3: address = " + idxOwner3.String()) + println(" miningReward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) + println("---------------------------") + + /********************* record data before delivering tx *********************/ + feePoolAccAddr := accountKeeper.GetModuleAddress(authtypes.FeeCollectorName) + require.NotNil(t, feePoolAccAddr) + lastFoundationAccBalance := bankKeeper.GetAllBalances(ctx, foundationAccountAddr) + lastFeePool := bankKeeper.GetAllBalances(ctx, feePoolAccAddr) + lastUnissuedPrepay := registerKeeper.GetTotalUnissuedPrepay(ctx) + lastMatureTotalOfResNode1 := potKeeper.GetMatureTotalReward(ctx, resOwner2) + + /********************* deliver tx *********************/ + + idxOwnerAcc1 := accountKeeper.GetAccount(ctx, idxOwner1) + ownerAccNum := idxOwnerAcc1.GetAccountNumber() + ownerAccSeq := idxOwnerAcc1.GetSequence() + + _, _, err = app.SignCheckDeliver(t, txGen, stApp.BaseApp, header, []sdk.Msg{volumeReportMsg}, chainID, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) + require.NoError(t, err) + + /********************* commit & check result *********************/ + header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + ctx = stApp.BaseApp.NewContext(true, header) + + epoch, ok = sdk.NewIntFromString(volumeReportMsg.Epoch.String()) + require.Equal(t, ok, true) + + checkResult(t, ctx, potKeeper, + accountKeeper, + bankKeeper, + registerKeeper, + epoch, + lastFoundationAccBalance, + lastUnissuedPrepay, + lastFeePool, + lastMatureTotalOfResNode1, + slashingAmtSetup, + ) // Main net + + i++ + } +} + +// return : coins - slashing +func deductSlashingAmt(ctx sdk.Context, coins sdk.Coins, slashing sdk.Int) sdk.Coins { + ret := sdk.Coins{} + for _, coin := range coins { + if coin.Amount.GTE(slashing) { + coin = coin.Sub(sdk.NewCoin(coin.Denom, slashing)) + ret = ret.Add(coin) + slashing = sdk.ZeroInt() + } else { + slashing = slashing.Sub(coin.Amount) + coin = sdk.NewCoin(coin.Denom, sdk.ZeroInt()) + ret = ret.Add(coin) + } + } + return ret +} + +//for main net +func checkResult(t *testing.T, ctx sdk.Context, + k potKeeper.Keeper, + accountKeeper authkeeper.AccountKeeper, + bankKeeper bankKeeper.Keeper, + registerKeeper registerKeeper.Keeper, + currentEpoch sdk.Int, + lastFoundationAccBalance sdk.Coins, + lastUnissuedPrepay sdk.Coin, + lastFeePool sdk.Coins, + lastMatureTotalOfResNode1 sdk.Coins, + slashingAmtSetup sdk.Int) { + + currentSlashing := registerKeeper.GetSlashing(ctx, resNodeAddr2) + println("currentSlashing =" + currentSlashing.String()) + + individualRewardTotal := sdk.Coins{} + newMatureEpoch := currentEpoch.Add(sdk.NewInt(k.MatureEpoch(ctx))) + + k.IteratorIndividualReward(ctx, newMatureEpoch, func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { + individualRewardTotal = individualRewardTotal.Add(individualReward.RewardFromTrafficPool...).Add(individualReward.RewardFromMiningPool...) + println("individualReward of [" + walletAddress.String() + "] = " + individualReward.String()) + return false + }) + + feePoolAccAddr := accountKeeper.GetModuleAddress(authtypes.FeeCollectorName) + require.NotNil(t, feePoolAccAddr) + foundationAccountAddr := accountKeeper.GetModuleAddress(types.FoundationAccount) + newFoundationAccBalance := bankKeeper.GetAllBalances(ctx, foundationAccountAddr) + newUnissuedPrepay := sdk.NewCoins(registerKeeper.GetTotalUnissuedPrepay(ctx)) + + slashingChange := slashingAmtSetup.Sub(registerKeeper.GetSlashing(ctx, resOwner1)) + println("resource node 1 slashing change = " + slashingChange.String()) + matureTotal := k.GetMatureTotalReward(ctx, resOwner1) + immatureTotal := k.GetImmatureTotalReward(ctx, resOwner1) + println("resource node 1 matureTotal = " + matureTotal.String()) + println("resource node 1 immatureTotal = " + immatureTotal.String()) + + rewardSrcChange := lastFoundationAccBalance. + Sub(newFoundationAccBalance). + Add(lastUnissuedPrepay). + Sub(newUnissuedPrepay) + println("rewardSrcChange = " + rewardSrcChange.String()) + + // get fee pool changes + newFeePool := bankKeeper.GetAllBalances(ctx, feePoolAccAddr) + println("lastFeePool = " + lastFeePool.String()) + println("newFeePool = " + newFeePool.String()) + + feePoolValChange := newFeePool.Sub(lastFeePool) + println("reward send to validator fee pool= " + feePoolValChange.String()) + + rewardDestChange := feePoolValChange.Add(individualRewardTotal...) + println("rewardDestChange = " + rewardDestChange.String()) + + require.Equal(t, rewardSrcChange, rewardDestChange) + + println("************************ slashing test***********************************") + println("slashing change = " + slashingChange.String()) + + upcomingMaturedIndividual := sdk.Coins{} + individualReward, found := k.GetIndividualReward(ctx, resOwner1, currentEpoch) + if found { + tmp := individualReward.RewardFromTrafficPool.Add(individualReward.RewardFromMiningPool...) + upcomingMaturedIndividual = deductSlashingAmt(ctx, tmp, slashingChange) + } + println("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) + + // get mature total changes + newMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner1) + matureTotalOfResNode1Change, _ := newMatureTotalOfResNode1.SafeSub(lastMatureTotalOfResNode1) + + if upcomingMaturedIndividual == nil { + upcomingMaturedIndividual = sdk.Coins{} + } + if matureTotalOfResNode1Change == nil || matureTotalOfResNode1Change.IsAnyNegative() { + matureTotalOfResNode1Change = sdk.Coins{} + } + + println("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) + require.Equal(t, matureTotalOfResNode1Change, upcomingMaturedIndividual) +} + +func checkValidator(t *testing.T, app *app.NewApp, addr sdk.ValAddress, expFound bool) stakingtypes.Validator { + ctxCheck := app.BaseApp.NewContext(true, tmproto.Header{}) + validator, found := app.GetStakingKeeper().GetValidator(ctxCheck, addr) + + require.Equal(t, expFound, found) + return validator +} -// -//import ( -// "testing" -// -// stratos "github.com/stratosnet/stratos-chain/types" -// "github.com/stretchr/testify/require" -// -// abci "github.com/tendermint/tendermint/abci/types" -// -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/x/auth" -// "github.com/cosmos/cosmos-sdk/x/bank" -// "github.com/cosmos/cosmos-sdk/x/mock" -// "github.com/cosmos/cosmos-sdk/x/staking" -// "github.com/cosmos/cosmos-sdk/x/supply" -// supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" -// "github.com/stratosnet/stratos-chain/x/pot/types" -// "github.com/stratosnet/stratos-chain/x/register" -//) -// -//const ( -// stopFlagOutOfTotalMiningReward = true -// stopFlagSpecificMinedReward = false -// stopFlagSpecificEpoch = true -//) -// -//var ( -// paramSpecificMinedReward = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(160000000000))) -// paramSpecificEpoch = sdk.NewInt(10) -//) -// -//// initialize data of volume report -//func setupMsgVolumeReport(newEpoch int64) types.MsgVolumeReport { -// volume1 := types.NewSingleWalletVolume(resOwner1, resourceNodeVolume1) -// volume2 := types.NewSingleWalletVolume(resOwner2, resourceNodeVolume2) -// volume3 := types.NewSingleWalletVolume(resOwner3, resourceNodeVolume3) -// -// nodesVolume := []types.SingleWalletVolume{volume1, volume2, volume3} -// reporter := idxNodeNetworkId1 -// epoch := sdk.NewInt(newEpoch) -// reportReference := "report for epoch " + epoch.String() -// reporterOwner := idxOwner1 -// -// pubKeys := make([][]byte, 1) -// for i := range pubKeys { -// pubKeys[i] = make([]byte, 1) -// } -// -// signature := types.NewBLSSignatureInfo(pubKeys, []byte("signature"), []byte("txData")) -// -// volumeReportMsg := types.NewMsgVolumeReport(nodesVolume, reporter, epoch, reportReference, reporterOwner, signature) -// -// return volumeReportMsg -//} -// -//func setupSlashingMsg() types.MsgSlashingResourceNode { -// reporters := make([]stratos.SdsAddress, 0) -// reporters = append(reporters, idxNodeNetworkId1) -// reportOwner := make([]sdk.AccAddress, 0) -// reportOwner = append(reportOwner, idxOwner1) -// -// slashingMsg := types.NewMsgSlashingResourceNode(reporters, reportOwner, resNodeNetworkId1, resOwner1, resNodeSlashingUOZAmt1, true) -// return slashingMsg -//} -// -//// Test case termination conditions -//// modify stop flag & variable could make the test case stop when reach a specific condition -//func isNeedStop(ctx sdk.Context, k Keeper, epoch sdk.Int, minedToken sdk.Coin) bool { -// -// if stopFlagOutOfTotalMiningReward && (minedToken.Amount.GT(foundationDeposit.AmountOf(k.BondDenom(ctx))) || -// minedToken.Amount.GT(foundationDeposit.AmountOf(k.RewardDenom(ctx)))) { -// return true -// } -// if stopFlagSpecificMinedReward && minedToken.Amount.GT(paramSpecificMinedReward.AmountOf(k.BondDenom(ctx))) { -// return true -// } -// if stopFlagSpecificEpoch && epoch.GT(paramSpecificEpoch) { -// return true -// } -// return false -//} -// -//func TestPotVolumeReportMsgs(t *testing.T) { -// /********************* initialize mock app *********************/ -// mApp, k, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper := getMockApp(t) -// accs := setupAccounts(mApp) -// mock.SetGenesis(mApp, accs) -// -// /********************* foundation account deposit *********************/ -// header := abci.Header{Height: mApp.LastBlockHeight() + 1} -// ctx := mApp.BaseApp.NewContext(true, header) -// foundationDepositMsg := NewMsgFoundationDeposit(foundationDeposit, foundationDepositorAccAddr) -// foundationDepositorAcc := mApp.AccountKeeper.GetAccount(ctx, foundationDepositorAccAddr) -// accNum := foundationDepositorAcc.GetAccountNumber() -// accSeq := foundationDepositorAcc.GetSequence() -// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{foundationDepositMsg}, []uint64{accNum}, []uint64{accSeq}, true, true, foundationDepositorPrivKey) -// foundationAccAddr := supplyKeeper.GetModuleAddress(types.FoundationAccount) -// mock.CheckBalance(t, mApp, foundationAccAddr, foundationDeposit) -// -// /********************* create validator with 50% commission *********************/ -// header = abci.Header{Height: mApp.LastBlockHeight() + 1} -// ctx = mApp.BaseApp.NewContext(true, header) -// -// commission := staking.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) -// description := staking.NewDescription("foo_moniker", "", "", "", "") -// createValidatorMsg := staking.NewMsgCreateValidator(valOpValAddr1, valConsPubk1, sdk.NewCoin("ustos", valInitialStake), description, commission, sdk.OneInt()) -// -// valOpAcc1 := mApp.AccountKeeper.GetAccount(ctx, valOpAccAddr1) -// accNum = valOpAcc1.GetAccountNumber() -// accSeq = valOpAcc1.GetSequence() -// mock.SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{createValidatorMsg}, []uint64{accNum}, []uint64{accSeq}, true, true, valOpPrivKey1) -// mock.CheckBalance(t, mApp, valOpAccAddr1, nil) -// -// /********************** commit **********************/ -// header = abci.Header{Height: mApp.LastBlockHeight() + 1} -// ctx = mApp.BaseApp.NewContext(true, header) -// -// mApp.BeginBlock(abci.RequestBeginBlock{Header: header}) -// stakingKeeper.ApplyAndReturnValidatorSetUpdates(mApp.BaseApp.NewContext(true, header)) -// validator := checkValidator(t, mApp, stakingKeeper, valOpValAddr1, true) -// -// require.Equal(t, valOpValAddr1, validator.OperatorAddress) -// require.Equal(t, sdk.Bonded, validator.Status) -// require.True(sdk.IntEq(t, valInitialStake, validator.BondedTokens())) -// -// /********************** loop sending volume report **********************/ -// var i int64 -// var slashingAmtSetup sdk.Int -// i = 0 -// slashingAmtSetup = sdk.ZeroInt() -// for { -// -// /********************* test slashing msg when i==2 *********************/ -// if i == 2 { -// ctx.Logger().Info("********************************* Deliver Slashing Tx START ********************************************") -// slashingMsg := setupSlashingMsg() -// /********************* deliver tx *********************/ -// -// idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwner1) -// ownerAccNum := idxOwnerAcc1.GetAccountNumber() -// ownerAccSeq := idxOwnerAcc1.GetSequence() -// -// SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{slashingMsg}, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) -// /********************* commit & check result *********************/ -// header = abci.Header{Height: mApp.LastBlockHeight() + 1} -// ctx = mApp.BaseApp.NewContext(true, header) -// -// slashingAmtSetup = registerKeeper.GetSlashing(ctx, resOwner1) -// -// _, slashingAmtCheck := k.GetTrafficReward(ctx, []types.SingleWalletVolume{{ -// WalletAddress: resOwner1, -// Volume: resNodeSlashingUOZAmt1, -// }}) -// println("slashingAmtSetup=" + slashingAmtSetup.String()) -// require.Equal(t, slashingAmtSetup, slashingAmtCheck.TruncateInt()) -// -// ctx.Logger().Info("********************************* Deliver Slashing Tx END ********************************************") -// } -// -// ctx.Logger().Info("*****************************************************************************") -// /********************* prepare tx data *********************/ -// volumeReportMsg := setupMsgVolumeReport(i + 1) -// -// lastTotalMinedToken := k.GetTotalMinedTokens(ctx) -// ctx.Logger().Info("last committed mined token = " + lastTotalMinedToken.String()) -// if isNeedStop(ctx, k, volumeReportMsg.Epoch, lastTotalMinedToken) { -// break -// } -// -// /********************* print info *********************/ -// ctx.Logger().Info("epoch " + volumeReportMsg.Epoch.String()) -// S := k.RegisterKeeper.GetInitialGenesisStakeTotal(ctx).ToDec() -// Pt := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx).Amount.ToDec() -// Y := k.GetTotalConsumedUoz(volumeReportMsg.WalletVolumes).ToDec() -// Lt := k.RegisterKeeper.GetRemainingOzoneLimit(ctx).ToDec() -// R := S.Add(Pt).Mul(Y).Quo(Lt.Add(Y)) -// //ctx.Logger().Info("R = (S + Pt) * Y / (Lt + Y)") -// ctx.Logger().Info("S=" + S.String() + "\nPt=" + Pt.String() + "\nY=" + Y.String() + "\nLt=" + Lt.String() + "\nR=" + R.String() + "\n") -// -// ctx.Logger().Info("---------------------------") -// distributeGoal := types.InitDistributeGoal() -// _, distributeGoal, err := k.CalcTrafficRewardInTotal(ctx, volumeReportMsg.WalletVolumes, distributeGoal) -// require.NoError(t, err) -// -// //TODO: recovery when shift to main net -// /********************************************************** Main net part Start *********************************************************************/ -// distributeGoal, err = k.CalcMiningRewardInTotal(ctx, distributeGoal) //for main net -// require.NoError(t, err) -// ctx.Logger().Info(distributeGoal.String()) -// -// ctx.Logger().Info("---------------------------") -// distributeGoalBalance := distributeGoal -// rewardDetailMap := make(map[string]types.Reward) -// rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNode(ctx, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap) -// /********************************************************** Main net part End *********************************************************************/ -// -// //TODO: remove when shift to main net -// /********************************************************** Incentive testnet part Start *********************************************************************/ -// //distributeGoal, idxNodeCnt, resNodeCnt, err := k.CalcMiningRewardInTotalForTestnet(ctx, distributeGoal) //for incentive test net -// //require.NoError(t, err) -// //ctx.Logger().Info(distributeGoal.String()) -// //ctx.Logger().Info("---------------------------") -// //distributeGoalBalance := distributeGoal -// //rewardDetailMap := make(map[string]types.Reward) -// // -// //rewardDetailMap, distributeGoalBalance = k.CalcRewardForResourceNodeForTestnet(ctx, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap, resNodeCnt) -// //rewardDetailMap, distributeGoalBalance = k.CalcRewardForIndexingNodeForTestnet(ctx, distributeGoalBalance, rewardDetailMap, idxNodeCnt) -// // -// ////calc mining reward to distribute to validators -// //rewardFromMiningPool := distributeGoal.BlockChainRewardToValidatorFromMiningPool -// //usedRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) -// //validatorWalletList := make([]sdk.AccAddress, 0) -// //validators := k.StakingKeeper.GetAllValidators(ctx) -// //for _, validator := range validators { -// // if validator.IsBonded() && !validator.IsJailed() { -// // validatorWalletList = append(validatorWalletList, sdk.AccAddress(validator.GetOperator())) -// // } -// //} -// //rewardPerValidator := sdk.NewCoin(k.RewardDenom(ctx), rewardFromMiningPool.Amount.ToDec().Quo(sdk.NewDec(int64(len(validatorWalletList)))).TruncateInt()) -// //usedRewardFromMiningPool = sdk.NewCoin(k.RewardDenom(ctx), rewardPerValidator.Amount.Mul(sdk.NewInt(int64(len(validatorWalletList))))) -// /********************************************************** Incentive testnet part End *********************************************************************/ -// -// ctx.Logger().Info("resource_wallet1: address = " + resOwner1.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) -// -// ctx.Logger().Info("resource_wallet2: address = " + resOwner2.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) -// -// ctx.Logger().Info("resource_wallet3: address = " + resOwner3.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) -// -// ctx.Logger().Info("resource_wallet4: address = " + resOwner4.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) -// -// ctx.Logger().Info("resource_wallet5: address = " + resOwner5.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) -// -// ctx.Logger().Info("indexing_wallet1: address = " + idxOwner1.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) -// -// ctx.Logger().Info("indexing_wallet2: address = " + idxOwner2.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) -// -// ctx.Logger().Info("indexing_wallet3: address = " + idxOwner3.String()) -// ctx.Logger().Info(" miningReward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) -// ctx.Logger().Info(" trafficReward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) -// ctx.Logger().Info("---------------------------") -// -// /********************* record data before delivering tx *********************/ -// feePoolAccAddr := supplyKeeper.GetModuleAddress(auth.FeeCollectorName) -// lastFoundationAccBalance := bankKeeper.GetCoins(ctx, foundationAccAddr) -// lastFeePool := bankKeeper.GetCoins(ctx, feePoolAccAddr) -// lastUnissuedPrepay := k.RegisterKeeper.GetTotalUnissuedPrepay(ctx) -// lastMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner2) -// -// /********************* deliver tx *********************/ -// -// idxOwnerAcc1 := mApp.AccountKeeper.GetAccount(ctx, idxOwner1) -// ownerAccNum := idxOwnerAcc1.GetAccountNumber() -// ownerAccSeq := idxOwnerAcc1.GetSequence() -// -// SignCheckDeliver(t, mApp.Cdc, mApp.BaseApp, header, []sdk.Msg{volumeReportMsg}, []uint64{ownerAccNum}, []uint64{ownerAccSeq}, true, true, idxOwnerPrivKey1) -// -// /********************* commit & check result *********************/ -// header = abci.Header{Height: mApp.LastBlockHeight() + 1} -// ctx = mApp.BaseApp.NewContext(true, header) -// -// //TODO: recovery when shift to main net -// checkResult(t, ctx, k, registerKeeper, -// volumeReportMsg.Epoch, -// lastFoundationAccBalance, -// lastUnissuedPrepay, -// lastFeePool, -// lastMatureTotalOfResNode1, -// slashingAmtSetup, -// ) // Main net -// -// //TODO: remove when shift to main net -// //checkResultForIncentiveTestnet( -// // t, ctx, k, -// // volumeReportMsg.Epoch, -// // lastFoundationAccBalance, -// // lastUnissuedPrepay, -// // lastFeePool, -// // usedRewardFromMiningPool, -// // slashingAmtSetup, -// //) //Incentive test net -// -// i++ -// } -//} -// -////for incentive test net -////func checkResultForIncentiveTestnet(t *testing.T, ctx sdk.Context, k Keeper, -//// currentEpoch sdk.Int, -//// lastFoundationAccBalance sdk.Coins, -//// lastUnissuedPrepay sdk.Coin, -//// lastFeePool sdk.Coins, -//// validatorDirectDeposited sdk.Coin, -//// slashingAmtSetup sdk.Int) { -//// -//// currentSlashing := k.RegisterKeeper.GetSlashing(ctx, resNodeAddr2) -//// println("currentSlashing=" + currentSlashing.String()) -//// -//// individualRewardTotal := sdk.Coins{} -//// newMatureEpoch := currentEpoch.Add(sdk.NewInt(k.MatureEpoch(ctx))) -//// rewardAddrList := k.GetRewardAddressPool(ctx) -//// for _, addr := range rewardAddrList { -//// individualReward, found := k.GetIndividualReward(ctx, addr, newMatureEpoch) -//// if found { -//// individualRewardTotal = individualRewardTotal.Add(individualReward.RewardFromTrafficPool...).Add(individualReward.RewardFromMiningPool...) -//// } -//// -//// ctx.Logger().Info("individualReward of [" + addr.String() + "] = " + individualReward.String()) -//// } -//// -//// feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(auth.FeeCollectorName) -//// foundationAccAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) -//// newFoundationAccBalance := k.BankKeeper.GetCoins(ctx, foundationAccAddr) -//// newUnissuedPrepay := sdk.NewCoins(k.RegisterKeeper.GetTotalUnissuedPrepay(ctx)) -//// -//// slashingChange := slashingAmtSetup.Sub(k.RegisterKeeper.GetSlashing(ctx, resOwner1)) -//// ctx.Logger().Info("resource node 1 slashing change = " + slashingChange.String()) -//// matureTotal := k.GetMatureTotalReward(ctx, resOwner1) -//// immatureTotal := k.GetImmatureTotalReward(ctx, resOwner1) -//// ctx.Logger().Info("resource node 1 matureTotal = " + matureTotal.String()) -//// ctx.Logger().Info("resource node 1 immatureTotal = " + immatureTotal.String()) -//// -//// rewardSrcChange := lastFoundationAccBalance. -//// Sub(newFoundationAccBalance). -//// Add(lastUnissuedPrepay). -//// Sub(newUnissuedPrepay) -//// -//// ctx.Logger().Info("rewardSrcChange = " + rewardSrcChange.String()) -//// -//// rewardSrcChangeSubSlashing := deductSlashingAmt(ctx, rewardSrcChange, slashingChange) -//// -//// newFeePool := k.BankKeeper.GetCoins(ctx, feePoolAccAddr) -//// ctx.Logger().Info("lastFeePool = " + lastFeePool.String()) -//// ctx.Logger().Info("newFeePool = " + newFeePool.String()) -//// -//// feePoolValChange := newFeePool.Sub(lastFeePool) -//// ctx.Logger().Info("reward send to validator fee pool= " + feePoolValChange.String()) -//// rewardDestChange := feePoolValChange.Add(individualRewardTotal...).Add(validatorDirectDeposited) -//// -//// rewardDestChange = k.RegisterKeeper.DeductSlashing(ctx, resOwner1, rewardDestChange) -//// -//// ctx.Logger().Info("rewardDestChange = " + rewardDestChange.String()) -//// require.Equal(t, rewardSrcChangeSubSlashing, rewardDestChange) -//// -////} -// -//// return : coins - slashing -//func deductSlashingAmt(ctx sdk.Context, coins sdk.Coins, slashing sdk.Int) sdk.Coins { -// ret := sdk.Coins{} -// for _, coin := range coins { -// if coin.Amount.GTE(slashing) { -// coin = coin.Sub(sdk.NewCoin(coin.Denom, slashing)) -// ret = ret.Add(coin) -// slashing = sdk.ZeroInt() -// } else { -// slashing = slashing.Sub(coin.Amount) -// coin = sdk.NewCoin(coin.Denom, sdk.ZeroInt()) -// ret = ret.Add(coin) -// } -// } -// return ret -//} -// -////for main net -//func checkResult(t *testing.T, ctx sdk.Context, k Keeper, registerKeeper register.Keeper, -// currentEpoch sdk.Int, -// lastFoundationAccBalance sdk.Coins, -// lastUnissuedPrepay sdk.Coin, -// lastFeePool sdk.Coins, -// lastMatureTotalOfResNode1 sdk.Coins, -// slashingAmtSetup sdk.Int) { -// -// currentSlashing := registerKeeper.GetSlashing(ctx, resNodeAddr2) -// println("currentSlashing =" + currentSlashing.String()) -// -// individualRewardTotal := sdk.Coins{} -// newMatureEpoch := currentEpoch.Add(sdk.NewInt(k.MatureEpoch(ctx))) -// -// k.IteratorIndividualReward(ctx, newMatureEpoch, func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { -// individualRewardTotal = individualRewardTotal.Add(individualReward.RewardFromTrafficPool...).Add(individualReward.RewardFromMiningPool...) -// ctx.Logger().Info("individualReward of [" + walletAddress.String() + "] = " + individualReward.String()) -// return false -// }) -// -// feePoolAccAddr := k.SupplyKeeper.GetModuleAddress(auth.FeeCollectorName) -// foundationAccAddr := k.SupplyKeeper.GetModuleAddress(types.FoundationAccount) -// newFoundationAccBalance := k.BankKeeper.GetCoins(ctx, foundationAccAddr) -// newUnissuedPrepay := sdk.NewCoins(registerKeeper.GetTotalUnissuedPrepay(ctx)) -// -// slashingChange := slashingAmtSetup.Sub(registerKeeper.GetSlashing(ctx, resOwner1)) -// ctx.Logger().Info("resource node 1 slashing change = " + slashingChange.String()) -// matureTotal := k.GetMatureTotalReward(ctx, resOwner1) -// immatureTotal := k.GetImmatureTotalReward(ctx, resOwner1) -// ctx.Logger().Info("resource node 1 matureTotal = " + matureTotal.String()) -// ctx.Logger().Info("resource node 1 immatureTotal = " + immatureTotal.String()) -// -// rewardSrcChange := lastFoundationAccBalance. -// Sub(newFoundationAccBalance). -// Add(lastUnissuedPrepay). -// Sub(newUnissuedPrepay) -// ctx.Logger().Info("rewardSrcChange = " + rewardSrcChange.String()) -// -// // get fee pool changes -// newFeePool := k.BankKeeper.GetCoins(ctx, feePoolAccAddr) -// ctx.Logger().Info("lastFeePool = " + lastFeePool.String()) -// ctx.Logger().Info("newFeePool = " + newFeePool.String()) -// -// feePoolValChange := newFeePool.Sub(lastFeePool) -// ctx.Logger().Info("reward send to validator fee pool= " + feePoolValChange.String()) -// -// rewardDestChange := feePoolValChange.Add(individualRewardTotal...) -// ctx.Logger().Info("rewardDestChange = " + rewardDestChange.String()) -// -// require.Equal(t, rewardSrcChange, rewardDestChange) -// -// ctx.Logger().Info("************************ slashing test***********************************") -// ctx.Logger().Info("slashing change = " + slashingChange.String()) -// -// upcomingMaturedIndividual := sdk.Coins{} -// individualReward, found := k.GetIndividualReward(ctx, resOwner1, currentEpoch) -// if found { -// tmp := individualReward.RewardFromTrafficPool.Add(individualReward.RewardFromMiningPool...) -// upcomingMaturedIndividual = deductSlashingAmt(ctx, tmp, slashingChange) -// } -// ctx.Logger().Info("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) -// -// // get mature total changes -// newMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner1) -// matureTotalOfResNode1Change, _ := newMatureTotalOfResNode1.SafeSub(lastMatureTotalOfResNode1) -// -// if upcomingMaturedIndividual == nil { -// upcomingMaturedIndividual = sdk.Coins{} -// } -// if matureTotalOfResNode1Change == nil || matureTotalOfResNode1Change.IsAnyNegative() { -// matureTotalOfResNode1Change = sdk.Coins{} -// } -// -// ctx.Logger().Info("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) -// require.Equal(t, matureTotalOfResNode1Change, upcomingMaturedIndividual) -//} -// //func checkValidator(t *testing.T, mApp *mock.App, stakingKeeper staking.Keeper, // addr sdk.ValAddress, expFound bool) staking.Validator { // @@ -463,7 +405,7 @@ package pot // require.Equal(t, expFound, found) // return validator //} -// + //func getMockApp(t *testing.T) (*mock.App, Keeper, staking.Keeper, bank.Keeper, supply.Keeper, register.Keeper) { // mApp := mock.NewApp() // @@ -512,9 +454,9 @@ package pot // // return mApp, keeper, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper //} -// -//// getInitChainer initializes the chainer of the mock app and sets the genesis -//// state. It returns an empty ResponseInitChain. + +// getInitChainer initializes the chainer of the mock app and sets the genesis +// state. It returns an empty ResponseInitChain. //func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, // blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper) sdk.InitChainer { // return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { @@ -526,12 +468,12 @@ package pot // mapp.InitChainer(ctx, req) // // resourceNodes := setupAllResourceNodes() -// indexingNodes := setupAllIndexingNodes() +// metaNodes := setupAllMetaNodes() // -// registerGenesis := register.NewGenesisState( +// registerGenesis := registertypes.NewGenesisState( // register.DefaultParams(), // resourceNodes, -// indexingNodes, +// metaNodes, // initialUOzonePrice, // sdk.ZeroInt(), // make([]register.Slashing, 0), @@ -575,8 +517,8 @@ package pot // } // //} -// -//// getEndBlocker returns a staking endblocker. + +// getEndBlocker returns a staking endblocker. //func getEndBlocker(keeper Keeper) sdk.EndBlocker { // return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { // validatorUpdates := keeper.StakingKeeper.BlockValidatorUpdates(ctx) diff --git a/x/pot/genesis.go b/x/pot/genesis.go index 556b6a19..392d116c 100644 --- a/x/pot/genesis.go +++ b/x/pot/genesis.go @@ -11,7 +11,7 @@ import ( func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) { keeper.SetParams(ctx, *data.Params) //keeper.SetTotalMinedTokens(ctx, *data.TotalMinedToken) - keeper.SetTotalMinedTokens(ctx, sdk.NewCoin(keeper.BondDenom(ctx), sdk.NewInt(0))) + keeper.SetTotalMinedTokens(ctx, sdk.NewCoin(keeper.RewardDenom(ctx), sdk.NewInt(0))) keeper.SetLastReportedEpoch(ctx, sdk.NewInt(data.LastReportedEpoch)) for _, immatureTotal := range data.ImmatureTotalInfo { diff --git a/x/pot/keeper/params.go b/x/pot/keeper/params.go index ce861ba3..63578e21 100644 --- a/x/pot/keeper/params.go +++ b/x/pot/keeper/params.go @@ -32,12 +32,12 @@ func (k Keeper) MatureEpoch(ctx sdk.Context) (res int64) { return } -func (k Keeper) MiningRewardParams(ctx sdk.Context) (res []types.MiningRewardParam) { +func (k Keeper) MiningRewardParams(ctx sdk.Context) (res []*types.MiningRewardParam) { k.paramSpace.Get(ctx, types.KeyMiningRewardParams, &res) return } -func (k Keeper) GetMiningRewardParamByMinedToken(ctx sdk.Context, minedToken sdk.Coin) (types.MiningRewardParam, error) { +func (k Keeper) GetMiningRewardParamByMinedToken(ctx sdk.Context, minedToken sdk.Coin) (*types.MiningRewardParam, error) { miningRewardParams := k.MiningRewardParams(ctx) for _, param := range miningRewardParams { if minedToken.IsGTE(*param.TotalMinedValveStart) && minedToken.IsLT(*param.TotalMinedValveEnd) { diff --git a/x/pot/keeper/store.go b/x/pot/keeper/store.go index fe378289..db0cc4b5 100644 --- a/x/pot/keeper/store.go +++ b/x/pot/keeper/store.go @@ -34,7 +34,6 @@ func (k Keeper) GetMinedTokens(ctx sdk.Context, epoch sdk.Int) (minedToken sdk.C return sdk.NewCoin(k.RewardDenom(ctx), sdk.ZeroInt()) } types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &minedToken) - types.ModuleCdc.MustUnmarshalLengthPrefixed(b, &minedToken) return } diff --git a/x/pot/pot_test.go b/x/pot/pot_test.go index 07beceee..14e72787 100644 --- a/x/pot/pot_test.go +++ b/x/pot/pot_test.go @@ -1,258 +1,262 @@ -package pot +package pot_test -// -//import ( -// "os" -// "testing" -// "time" -// -// "github.com/cosmos/cosmos-sdk/baseapp" -// "github.com/cosmos/cosmos-sdk/codec" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/x/auth" -// authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" -// "github.com/cosmos/cosmos-sdk/x/mock" -// stratos "github.com/stratosnet/stratos-chain/types" -// "github.com/stratosnet/stratos-chain/x/register" -// "github.com/stretchr/testify/require" -// abci "github.com/tendermint/tendermint/abci/types" -// "github.com/tendermint/tendermint/crypto" -// "github.com/tendermint/tendermint/crypto/secp256k1" -//) -// -//const ( -// chainID = "" -// StratosBech32Prefix = "st" -// -// stos2ustos = 1000000000 -//) -// -//var ( -// AccountPubKeyPrefix = StratosBech32Prefix + "pub" -// ValidatorAddressPrefix = StratosBech32Prefix + "valoper" -// ValidatorPubKeyPrefix = StratosBech32Prefix + "valoperpub" -// ConsNodeAddressPrefix = StratosBech32Prefix + "valcons" -// ConsNodePubKeyPrefix = StratosBech32Prefix + "valconspub" -// SdsNodeP2PKeyPrefix = StratosBech32Prefix + "sdsp2p" -// -// resNodeSlashingUOZAmt1 = sdk.NewInt(1000000000000000000) -// -// resourceNodeVolume1 = sdk.NewInt(500000) -// resourceNodeVolume2 = sdk.NewInt(300000) -// resourceNodeVolume3 = sdk.NewInt(200000) -// -// depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") -// totalUnissuedPrepayVal, _ = sdk.NewIntFromString("1000000000000") -// totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) -// initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz -// -// foundationDepositorPrivKey = secp256k1.GenPrivKey() -// foundationDepositorAccAddr = sdk.AccAddress(foundationDepositorPrivKey.PubKey().Address()) -// foundationDeposit = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(40000000000000000)), sdk.NewCoin("utros", sdk.NewInt(40000000000000000))) -// -// resOwnerPrivKey1 = secp256k1.GenPrivKey() -// resOwnerPrivKey2 = secp256k1.GenPrivKey() -// resOwnerPrivKey3 = secp256k1.GenPrivKey() -// resOwnerPrivKey4 = secp256k1.GenPrivKey() -// resOwnerPrivKey5 = secp256k1.GenPrivKey() -// idxOwnerPrivKey1 = secp256k1.GenPrivKey() -// idxOwnerPrivKey2 = secp256k1.GenPrivKey() -// idxOwnerPrivKey3 = secp256k1.GenPrivKey() -// -// resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) -// resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) -// resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) -// resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) -// resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) -// idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) -// idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) -// idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) -// -// resNodePubKey1 = secp256k1.GenPrivKey().PubKey() -// resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) -// resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) -// resNodeInitialStake1 = sdk.NewInt(3 * stos2ustos) -// -// resNodePubKey2 = secp256k1.GenPrivKey().PubKey() -// resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) -// resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) -// resNodeInitialStake2 = sdk.NewInt(3 * stos2ustos) -// -// resNodePubKey3 = secp256k1.GenPrivKey().PubKey() -// resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) -// resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) -// resNodeInitialStake3 = sdk.NewInt(3 * stos2ustos) -// -// resNodePubKey4 = secp256k1.GenPrivKey().PubKey() -// resNodeAddr4 = sdk.AccAddress(resNodePubKey4.Address()) -// resNodeNetworkId4 = stratos.SdsAddress(resNodePubKey4.Address()) -// resNodeInitialStake4 = sdk.NewInt(3 * stos2ustos) -// -// resNodePubKey5 = secp256k1.GenPrivKey().PubKey() -// resNodeAddr5 = sdk.AccAddress(resNodePubKey5.Address()) -// resNodeNetworkId5 = stratos.SdsAddress(resNodePubKey5.Address()) -// resNodeInitialStake5 = sdk.NewInt(3 * stos2ustos) -// -// idxNodePrivKey1 = secp256k1.GenPrivKey() -// idxNodePubKey1 = idxNodePrivKey1.PubKey() -// idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) -// idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) -// idxNodeInitialStake1 = sdk.NewInt(5 * stos2ustos) -// -// idxNodePubKey2 = secp256k1.GenPrivKey().PubKey() -// idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) -// idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) -// idxNodeInitialStake2 = sdk.NewInt(5 * stos2ustos) -// -// idxNodePubKey3 = secp256k1.GenPrivKey().PubKey() -// idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) -// idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) -// idxNodeInitialStake3 = sdk.NewInt(5 * stos2ustos) -// -// valOpPrivKey1 = secp256k1.GenPrivKey() -// valOpPubKey1 = valOpPrivKey1.PubKey() -// valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) -// valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) -// -// valConsPrivKey1 = secp256k1.GenPrivKey() -// valConsPubk1 = valConsPrivKey1.PubKey() -// valInitialStake = sdk.NewInt(15 * stos2ustos) -//) -// -//func TestMain(m *testing.M) { -// config := stratos.GetConfig() -// config.Seal() -// exitVal := m.Run() -// os.Exit(exitVal) -//} -// -//func setupAccounts(mApp *mock.App) []authexported.Account { -// -// //************************** setup resource nodes owners' accounts ************************** -// resOwnerAcc1 := &auth.BaseAccount{ -// Address: resOwner1, -// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake1.Add(depositForSendingTx))}, -// } -// resOwnerAcc2 := &auth.BaseAccount{ -// Address: resOwner2, -// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake2)}, -// } -// resOwnerAcc3 := &auth.BaseAccount{ -// Address: resOwner3, -// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake3)}, -// } -// resOwnerAcc4 := &auth.BaseAccount{ -// Address: resOwner4, -// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake4)}, -// } -// resOwnerAcc5 := &auth.BaseAccount{ -// Address: resOwner5, -// Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake5)}, -// } -// -// //************************** setup indexing nodes owners' accounts ************************** -// idxOwnerAcc1 := &auth.BaseAccount{ -// Address: idxOwner1, -// Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake1)}, -// } -// idxOwnerAcc2 := &auth.BaseAccount{ -// Address: idxOwner2, -// Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake2)}, -// } -// idxOwnerAcc3 := &auth.BaseAccount{ -// Address: idxOwner3, -// Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake3)}, -// } -// -// //************************** setup validator delegators' accounts ************************** -// valOwnerAcc1 := &auth.BaseAccount{ -// Address: valOpAccAddr1, -// Coins: sdk.Coins{sdk.NewCoin("ustos", valInitialStake)}, -// } -// -// //************************** setup indexing nodes' accounts ************************** -// idxNodeAcc1 := &auth.BaseAccount{ -// Address: idxNodeAddr1, -// Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, -// } -// -// foundationDepositorAcc := &auth.BaseAccount{ -// Address: foundationDepositorAccAddr, -// Coins: foundationDeposit, -// } -// -// accs := []authexported.Account{ -// resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, -// idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, -// valOwnerAcc1, -// foundationDepositorAcc, -// idxNodeAcc1, -// } -// -// ctx1 := mApp.BaseApp.NewContext(true, abci.Header{}) -// ctx1.Logger().Info("idxNodeAcc1 -> " + idxNodeAcc1.String()) -// -// return accs -//} -// -//func setupAllResourceNodes() []register.ResourceNode { -// -// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") -// resourceNode1 := register.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, register.NewDescription("sds://resourceNode1", "", "", "", ""), 4, time) -// resourceNode2 := register.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, register.NewDescription("sds://resourceNode2", "", "", "", ""), 4, time) -// resourceNode3 := register.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, register.NewDescription("sds://resourceNode3", "", "", "", ""), 4, time) -// resourceNode4 := register.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, register.NewDescription("sds://resourceNode4", "", "", "", ""), 4, time) -// resourceNode5 := register.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, register.NewDescription("sds://resourceNode5", "", "", "", ""), 4, time) -// -// resourceNode1 = resourceNode1.AddToken(resNodeInitialStake1) -// resourceNode2 = resourceNode2.AddToken(resNodeInitialStake2) -// resourceNode3 = resourceNode3.AddToken(resNodeInitialStake3) -// resourceNode4 = resourceNode4.AddToken(resNodeInitialStake4) -// resourceNode5 = resourceNode5.AddToken(resNodeInitialStake5) -// -// resourceNode1.Status = sdk.Bonded -// resourceNode2.Status = sdk.Bonded -// resourceNode3.Status = sdk.Bonded -// resourceNode4.Status = sdk.Bonded -// resourceNode5.Status = sdk.Bonded -// -// var resourceNodes []register.ResourceNode -// resourceNodes = append(resourceNodes, resourceNode1) -// resourceNodes = append(resourceNodes, resourceNode2) -// resourceNodes = append(resourceNodes, resourceNode3) -// resourceNodes = append(resourceNodes, resourceNode4) -// resourceNodes = append(resourceNodes, resourceNode5) -// return resourceNodes -//} -// -//func setupAllIndexingNodes() []register.IndexingNode { -// var indexingNodes []register.IndexingNode -// -// time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") -// indexingNode1 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwner1, register.NewDescription("sds://indexingNode1", "", "", "", ""), time) -// indexingNode2 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwner2, register.NewDescription("sds://indexingNode2", "", "", "", ""), time) -// indexingNode3 := register.NewIndexingNode(stratos.SdsAddress(idxNodeAddr3), idxNodePubKey3, idxOwner3, register.NewDescription("sds://indexingNode3", "", "", "", ""), time) -// -// indexingNode1 = indexingNode1.AddToken(idxNodeInitialStake1) -// indexingNode2 = indexingNode2.AddToken(idxNodeInitialStake2) -// indexingNode3 = indexingNode3.AddToken(idxNodeInitialStake3) -// -// indexingNode1.Status = sdk.Bonded -// indexingNode2.Status = sdk.Bonded -// indexingNode3.Status = sdk.Bonded -// -// indexingNodes = append(indexingNodes, indexingNode1) -// indexingNodes = append(indexingNodes, indexingNode2) -// indexingNodes = append(indexingNodes, indexingNode3) -// -// return indexingNodes -// -//} -// -//// SignCheckDeliver checks a generated signed transaction and simulates a -//// block commitment with the given transaction. A test assertion is made using -//// the parameter 'expPass' against the result. A corresponding result is -//// returned. +import ( + "os" + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" + + //"github.com/cosmos/cosmos-sdk/x/auth" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + stratos "github.com/stratosnet/stratos-chain/types" +) + +const ( + chainID = "testchain_1-1" + stos2ustos = 1000000000 +) + +var ( + resNodeSlashingUOZAmt1 = sdk.NewInt(1000000000000000000) + + resourceNodeVolume1 = sdk.NewInt(500000) + resourceNodeVolume2 = sdk.NewInt(300000) + resourceNodeVolume3 = sdk.NewInt(200000) + + depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") + totalUnissuedPrepayVal, _ = sdk.NewIntFromString("1000000000000") + totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) + initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz + + foundationDepositorPrivKey = secp256k1.GenPrivKey() + foundationDepositorAccAddr = sdk.AccAddress(foundationDepositorPrivKey.PubKey().Address()) + foundationDeposit = sdk.NewCoins(sdk.NewCoin("utros", sdk.NewInt(40000000000000000))) + + resOwnerPrivKey1 = secp256k1.GenPrivKey() + resOwnerPrivKey2 = secp256k1.GenPrivKey() + resOwnerPrivKey3 = secp256k1.GenPrivKey() + resOwnerPrivKey4 = secp256k1.GenPrivKey() + resOwnerPrivKey5 = secp256k1.GenPrivKey() + idxOwnerPrivKey1 = secp256k1.GenPrivKey() + idxOwnerPrivKey2 = secp256k1.GenPrivKey() + idxOwnerPrivKey3 = secp256k1.GenPrivKey() + + resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) + resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) + resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) + resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) + resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) + idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) + idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) + idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) + + resNodePubKey1 = secp256k1.GenPrivKey().PubKey() + resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) + resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) + resNodeInitialStake1 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey2 = secp256k1.GenPrivKey().PubKey() + resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) + resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) + resNodeInitialStake2 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey3 = secp256k1.GenPrivKey().PubKey() + resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) + resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) + resNodeInitialStake3 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey4 = secp256k1.GenPrivKey().PubKey() + resNodeAddr4 = sdk.AccAddress(resNodePubKey4.Address()) + resNodeNetworkId4 = stratos.SdsAddress(resNodePubKey4.Address()) + resNodeInitialStake4 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey5 = secp256k1.GenPrivKey().PubKey() + resNodeAddr5 = sdk.AccAddress(resNodePubKey5.Address()) + resNodeNetworkId5 = stratos.SdsAddress(resNodePubKey5.Address()) + resNodeInitialStake5 = sdk.NewInt(3 * stos2ustos) + + idxNodePrivKey1 = secp256k1.GenPrivKey() + idxNodePubKey1 = idxNodePrivKey1.PubKey() + idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) + idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) + idxNodeInitialStake1 = sdk.NewInt(5 * stos2ustos) + + idxNodePubKey2 = secp256k1.GenPrivKey().PubKey() + idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) + idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) + idxNodeInitialStake2 = sdk.NewInt(5 * stos2ustos) + + idxNodePubKey3 = secp256k1.GenPrivKey().PubKey() + idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) + idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) + idxNodeInitialStake3 = sdk.NewInt(5 * stos2ustos) + + valOpPrivKey1 = secp256k1.GenPrivKey() + valOpPubKey1 = valOpPrivKey1.PubKey() + valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) + valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) + + valConsPrivKey1 = ed25519.GenPrivKey() + valConsPubk1 = valConsPrivKey1.PubKey() + valInitialStake = sdk.NewInt(15 * stos2ustos) +) + +func TestMain(m *testing.M) { + config := stratos.GetConfig() + config.Seal() + exitVal := m.Run() + os.Exit(exitVal) +} + +func setupAccounts() ([]authtypes.GenesisAccount, []banktypes.Balance) { + + //************************** setup resource nodes owners' accounts ************************** + resOwnerAcc1 := &authtypes.BaseAccount{Address: resOwner1.String()} + resOwnerAcc2 := &authtypes.BaseAccount{Address: resOwner2.String()} + resOwnerAcc3 := &authtypes.BaseAccount{Address: resOwner3.String()} + resOwnerAcc4 := &authtypes.BaseAccount{Address: resOwner4.String()} + resOwnerAcc5 := &authtypes.BaseAccount{Address: resOwner5.String()} + //************************** setup indexing nodes owners' accounts ************************** + idxOwnerAcc1 := &authtypes.BaseAccount{Address: idxOwner1.String()} + idxOwnerAcc2 := &authtypes.BaseAccount{Address: idxOwner2.String()} + idxOwnerAcc3 := &authtypes.BaseAccount{Address: idxOwner3.String()} + //************************** setup validator delegators' accounts ************************** + valOwnerAcc1 := &authtypes.BaseAccount{Address: valOpAccAddr1.String()} + //************************** setup indexing nodes' accounts ************************** + idxNodeAcc1 := &authtypes.BaseAccount{Address: idxNodeAddr1.String()} + foundationDepositorAcc := &authtypes.BaseAccount{Address: foundationDepositorAccAddr.String()} + + accs := []authtypes.GenesisAccount{ + resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, + idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, + valOwnerAcc1, + foundationDepositorAcc, + idxNodeAcc1, + } + + balances := []banktypes.Balance{ + { + Address: resOwner1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake1.Add(depositForSendingTx))}, + }, + { + Address: resOwner2.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake2)}, + }, + { + Address: resOwner3.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake3)}, + }, + { + Address: resOwner4.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake4)}, + }, + { + Address: resOwner5.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake5)}, + }, + { + Address: idxOwner1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake1)}, + }, + { + Address: idxOwner2.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake2)}, + }, + { + Address: idxOwner3.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake3)}, + }, + { + Address: valOpAccAddr1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", valInitialStake)}, + }, + { + Address: idxNodeAddr1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, + }, + { + Address: foundationDepositorAccAddr.String(), + Coins: foundationDeposit, + }, + } + + //app := simapp.SetupWithGenesisAccounts(accs, balances...) + //simapp.CheckBalance(t, app, addr1, sdk.Coins{genCoin}) + //simapp.CheckBalance(t, app, addr2, sdk.Coins{genCoin}) + + //ctx1 := mApp.BaseApp.NewContext(true, abci.Header{}) + //ctx1.Logger().Info("idxNodeAcc1 -> " + idxNodeAcc1.String()) + + return accs, balances +} + +func setupAllResourceNodes() []registertypes.ResourceNode { + + time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") + nodeType := registertypes.STORAGE + resourceNode1, _ := registertypes.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, registertypes.NewDescription("sds://resourceNode1", "", "", "", ""), &nodeType, time) + resourceNode2, _ := registertypes.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, registertypes.NewDescription("sds://resourceNode2", "", "", "", ""), &nodeType, time) + resourceNode3, _ := registertypes.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, registertypes.NewDescription("sds://resourceNode3", "", "", "", ""), &nodeType, time) + resourceNode4, _ := registertypes.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, registertypes.NewDescription("sds://resourceNode4", "", "", "", ""), &nodeType, time) + resourceNode5, _ := registertypes.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, registertypes.NewDescription("sds://resourceNode5", "", "", "", ""), &nodeType, time) + + resourceNode1 = resourceNode1.AddToken(resNodeInitialStake1) + resourceNode2 = resourceNode2.AddToken(resNodeInitialStake2) + resourceNode3 = resourceNode3.AddToken(resNodeInitialStake3) + resourceNode4 = resourceNode4.AddToken(resNodeInitialStake4) + resourceNode5 = resourceNode5.AddToken(resNodeInitialStake5) + + resourceNode1.Status = stakingtypes.Bonded + resourceNode2.Status = stakingtypes.Bonded + resourceNode3.Status = stakingtypes.Bonded + resourceNode4.Status = stakingtypes.Bonded + resourceNode5.Status = stakingtypes.Bonded + + var resourceNodes []registertypes.ResourceNode + resourceNodes = append(resourceNodes, resourceNode1) + resourceNodes = append(resourceNodes, resourceNode2) + resourceNodes = append(resourceNodes, resourceNode3) + resourceNodes = append(resourceNodes, resourceNode4) + resourceNodes = append(resourceNodes, resourceNode5) + return resourceNodes +} + +func setupAllMetaNodes() []registertypes.MetaNode { + var indexingNodes []registertypes.MetaNode + + time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") + indexingNode1, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwner1, registertypes.NewDescription("sds://indexingNode1", "", "", "", ""), time) + indexingNode2, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwner2, registertypes.NewDescription("sds://indexingNode2", "", "", "", ""), time) + indexingNode3, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr3), idxNodePubKey3, idxOwner3, registertypes.NewDescription("sds://indexingNode3", "", "", "", ""), time) + + indexingNode1 = indexingNode1.AddToken(idxNodeInitialStake1) + indexingNode2 = indexingNode2.AddToken(idxNodeInitialStake2) + indexingNode3 = indexingNode3.AddToken(idxNodeInitialStake3) + + indexingNode1.Status = stakingtypes.Bonded + indexingNode2.Status = stakingtypes.Bonded + indexingNode3.Status = stakingtypes.Bonded + + indexingNodes = append(indexingNodes, indexingNode1) + indexingNodes = append(indexingNodes, indexingNode2) + indexingNodes = append(indexingNodes, indexingNode3) + + return indexingNodes + +} + +// SignCheckDeliver checks a generated signed transaction and simulates a +// block commitment with the given transaction. A test assertion is made using +// the parameter 'expPass' against the result. A corresponding result is +// returned. //func SignCheckDeliver( // t *testing.T, cdc *codec.Codec, app *baseapp.BaseApp, header abci.Header, msgs []sdk.Msg, // accNums, seq []uint64, expSimPass, expPass bool, priv ...crypto.PrivKey, @@ -291,8 +295,8 @@ package pot // // return gInfo, res, err //} -// -//// GenTx generates a signed mock transaction. + +// GenTx generates a signed mock transaction. //func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx { // // Make the transaction free // fee := auth.StdFee{ diff --git a/x/pot/types/params.go b/x/pot/types/params.go index b1500a18..b3fa9dc9 100644 --- a/x/pot/types/params.go +++ b/x/pot/types/params.go @@ -11,7 +11,6 @@ import ( // DefaultParamSpace Default parameter namespace const ( - DefaultParamSpace = ModuleName DefaultBondDenom = "ustos" DefaultRewardDenom = "utros" DefaultMatureEpoch = 2016 @@ -81,6 +80,7 @@ func DefaultParams() Params { sdk.NewCoin(DefaultRewardDenom, sdk.NewInt(40000000000000000)), sdk.NewCoin(DefaultRewardDenom, sdk.NewInt(2500000000)), sdk.NewInt(7000), sdk.NewInt(1000), sdk.NewInt(2000))) + return NewParams(DefaultBondDenom, DefaultRewardDenom, DefaultMatureEpoch, miningRewardParams) } diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index 37ec3fed..32cd3004 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -432,7 +432,7 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs if t := newNodeType.Type(); t == "UNKNOWN" { return txf, nil, types.ErrNodeType } - msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, &description, strconv.Itoa(nodeTypeRef)) + msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, description, strconv.Itoa(nodeTypeRef)) if er != nil { return txf, nil, err } @@ -482,7 +482,7 @@ func newBuildCreateMetaNodeMsg(clientCtx client.Context, txf tx.Factory, fs *fla security, details, ) - msg, er := types.NewMsgCreateMetaNode(networkAddr, pubKey, amount, ownerAddr, &description) + msg, er := types.NewMsgCreateMetaNode(networkAddr, pubKey, amount, ownerAddr, description) if er != nil { return txf, nil, err } @@ -524,7 +524,7 @@ func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, nil, types.ErrInvalidNodeType } nodeTypeStr := strconv.Itoa(nodeTypeRef) - msg := types.NewMsgUpdateResourceNode(description, nodeTypeStr, networkAddr, ownerAddr) + msg := types.NewMsgUpdateResourceNode(*description, nodeTypeStr, networkAddr, ownerAddr) return txf, msg, nil } @@ -554,7 +554,7 @@ func newBuildUpdateMetaNodeMsg(clientCtx client.Context, txf tx.Factory, fs *fla details, ) - msg := types.NewMsgUpdateMetaNode(description, networkAddr, ownerAddr) + msg := types.NewMsgUpdateMetaNode(*description, networkAddr, ownerAddr) return txf, msg, nil } diff --git a/x/register/types/genesis.go b/x/register/types/genesis.go index a39148a8..b5f20e0f 100644 --- a/x/register/types/genesis.go +++ b/x/register/types/genesis.go @@ -15,8 +15,8 @@ func NewGenesisState(params *Params, metaNodes MetaNodes, initialUOzonePrice sdk.Dec, slashingInfo []*Slashing, -) GenesisState { - return GenesisState{ +) *GenesisState { + return &GenesisState{ Params: params, ResourceNodes: resourceNodes, MetaNodes: metaNodes, diff --git a/x/register/types/registration.go b/x/register/types/registration.go index 5b8cda19..80de4f49 100644 --- a/x/register/types/registration.go +++ b/x/register/types/registration.go @@ -15,8 +15,8 @@ const ( ) // NewDescription returns a new Description with the provided values. -func NewDescription(moniker, identity, website, securityContact, details string) Description { - return Description{ +func NewDescription(moniker, identity, website, securityContact, details string) *Description { + return &Description{ Moniker: moniker, Identity: identity, Website: website, @@ -26,7 +26,7 @@ func NewDescription(moniker, identity, website, securityContact, details string) } // EnsureLength ensures the length of a resource/meta node's description. -func (d Description) EnsureLength() (Description, error) { +func (d *Description) EnsureLength() (*Description, error) { if len(d.Moniker) > MaxMonikerLength { return d, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid moniker length; got: %d, max: %d", len(d.Moniker), MaxMonikerLength) } From 37fccb086c41873ae0be6505b487a98dcb7679df Mon Sep 17 00:00:00 2001 From: hong-pang Date: Thu, 9 Jun 2022 13:19:40 -0400 Subject: [PATCH 103/113] added comments on all iterations --- x/pot/keeper/distribute.go | 8 ++ x/pot/keeper/utils.go | 1 + x/register/keeper/keeper.go | 188 +++++++++++++++-------------- x/register/keeper/meta_node.go | 3 +- x/register/keeper/querier.go | 8 +- x/register/keeper/resource_node.go | 1 + x/register/keeper/slashing.go | 1 + x/register/types/resource_node.go | 4 +- x/sds/keeper/keeper.go | 2 + 9 files changed, 119 insertions(+), 97 deletions(-) diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index 8e9519e3..eaf12983 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -271,6 +271,7 @@ func (k Keeper) CalcMiningRewardInTotal(ctx sdk.Context, distributeGoal types.Di return distributeGoal, nil } +// Iteration for each rewarded SDS node func (k Keeper) distributeRewardToSdsNodes(ctx sdk.Context, rewardDetailList []types.Reward, currentEpoch sdk.Int) (err error) { matureEpoch := k.getMatureEpochByCurrentEpoch(ctx, currentEpoch) @@ -293,6 +294,7 @@ func (k Keeper) addNewIndividualAndUpdateImmatureTotal(ctx sdk.Context, account k.SetImmatureTotalReward(ctx, account, newImmatureTotal) } +// Iteration for mature rewards/slashing of all nodes func (k Keeper) rewardMatureAndSubSlashing(ctx sdk.Context, currentEpoch sdk.Int) (totalSlashed sdk.Coins) { matureStartEpoch := k.GetLastReportedEpoch(ctx).Int64() + 1 @@ -364,6 +366,7 @@ func (k Keeper) distributeValidatorRewardToFeePool(ctx sdk.Context, distributeGo return distributeGoal, nil } +// Iteration for calculating reward of resource nodes func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, totalConsumedUoz sdk.Dec, trafficList []*types.SingleWalletVolume, distributeGoalBalance types.DistributeGoal, rewardDetailMap map[string]types.Reward, ) (map[string]types.Reward, types.DistributeGoal) { @@ -453,6 +456,7 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, totalConsumedUoz sdk. return rewardDetailMap, distributeGoalBalance } +// Iteration for calculating reward of meta nodes func (k Keeper) CalcRewardForMetaNode(ctx sdk.Context, distributeGoalBalance types.DistributeGoal, rewardDetailMap map[string]types.Reward, ) (map[string]types.Reward, types.DistributeGoal) { @@ -516,6 +520,7 @@ func (k Keeper) CalcRewardForMetaNode(ctx sdk.Context, distributeGoalBalance typ return rewardDetailMap, distributeGoalBalance } +// Iteration for getting total consumed OZ from traffic func (k Keeper) GetTotalConsumedUoz(trafficList []*types.SingleWalletVolume) sdk.Int { totalTraffic := sdk.ZeroInt() for _, vol := range trafficList { @@ -544,6 +549,7 @@ func (k Keeper) splitRewardByStake(ctx sdk.Context, totalReward sdk.Int, return } +// Iteration for getting individule reward of each owner at a specific epoch func (k Keeper) IteratorIndividualReward(ctx sdk.Context, epoch sdk.Int, handler func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.GetIndividualRewardIteratorKey(epoch)) @@ -559,6 +565,7 @@ func (k Keeper) IteratorIndividualReward(ctx sdk.Context, epoch sdk.Int, handler } } +// Iteration for getting total immature reward func (k Keeper) IteratorImmatureTotal(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, immatureTotal sdk.Coins) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.ImmatureTotalRewardKeyPrefix) @@ -573,6 +580,7 @@ func (k Keeper) IteratorImmatureTotal(ctx sdk.Context, handler func(walletAddres } } +// IteratorMatureTotal Iteration for getting total mature reward func (k Keeper) IteratorMatureTotal(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, matureTotal sdk.Coins) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.MatureTotalRewardKeyPrefix) diff --git a/x/pot/keeper/utils.go b/x/pot/keeper/utils.go index 572d15b0..dd2af44f 100644 --- a/x/pot/keeper/utils.go +++ b/x/pot/keeper/utils.go @@ -6,6 +6,7 @@ import ( "github.com/stratosnet/stratos-chain/x/pot/types" ) +// Iteration for sorting map to slice func sortDetailMapToSlice(rewardDetailMap map[string]types.Reward) (rewardDetailList []types.Reward) { keys := make([]string, 0, len(rewardDetailMap)) for key := range rewardDetailMap { diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 0bff4ec3..2424ed2b 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -190,65 +190,65 @@ func (k Keeper) GetMetaNetworksIterator(ctx sdk.Context) sdk.Iterator { return sdk.KVStorePrefixIterator(store, types.MetaNodeKey) } -func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { - var networkList []stratos.SdsAddress - iterator := keeper.GetResourceNetworksIterator(ctx) - for ; iterator.Valid(); iterator.Next() { - resourceNode := types.MustUnmarshalResourceNode(k.cdc, iterator.Value()) - networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) - if err != nil { - continue - } - networkList = append(networkList, networkAddr) - } - iter := keeper.GetMetaNetworksIterator(ctx) - for ; iter.Valid(); iter.Next() { - metaNode := types.MustUnmarshalMetaNode(k.cdc, iter.Value()) - networkAddr, err := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) - if err != nil { - continue - } - networkList = append(networkList, networkAddr) - } - r := removeDuplicateValues(k, networkList) - return r -} - -func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res []byte) { - keys := make(map[string]bool) - for _, entry := range stringSlice { - if _, value := keys[entry.String()]; !value { - bytes, err := entry.MarshalJSON() - if err != nil { - continue - } - keys[entry.String()] = true - res = append(res, bytes...) - res = append(res, ';') - } - } - return res[:len(res)-1] -} - -// GetUnbondingNodes return a given amount of all the UnbondingMetaNodes -func (k Keeper) GetUnbondingNodes(ctx sdk.Context, networkAddr stratos.SdsAddress, - maxRetrieve uint32) (unbondingMetaNodes []types.UnbondingNode) { - - unbondingMetaNodes = make([]types.UnbondingNode, maxRetrieve) - - store := ctx.KVStore(k.storeKey) - metaNodePrefixKey := types.GetUBDNodeKey(networkAddr) - iterator := sdk.KVStorePrefixIterator(store, metaNodePrefixKey) - defer iterator.Close() - - i := 0 - for ; iterator.Valid() && i < int(maxRetrieve); iterator.Next() { - unbondingMetaNode := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) - unbondingMetaNodes[i] = unbondingMetaNode - i++ - } - return unbondingMetaNodes[:i] // trim if the array length < maxRetrieve -} +//func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { +// var networkList []stratos.SdsAddress +// iterator := keeper.GetResourceNetworksIterator(ctx) +// for ; iterator.Valid(); iterator.Next() { +// resourceNode := types.MustUnmarshalResourceNode(k.cdc, iterator.Value()) +// networkAddr, err := stratos.SdsAddressFromBech32(resourceNode.GetNetworkAddress()) +// if err != nil { +// continue +// } +// networkList = append(networkList, networkAddr) +// } +// iter := keeper.GetMetaNetworksIterator(ctx) +// for ; iter.Valid(); iter.Next() { +// metaNode := types.MustUnmarshalMetaNode(k.cdc, iter.Value()) +// networkAddr, err := stratos.SdsAddressFromBech32(metaNode.GetNetworkAddress()) +// if err != nil { +// continue +// } +// networkList = append(networkList, networkAddr) +// } +// r := removeDuplicateValues(k, networkList) +// return r +//} + +//func removeDuplicateValues(keeper Keeper, stringSlice []stratos.SdsAddress) (res []byte) { +// keys := make(map[string]bool) +// for _, entry := range stringSlice { +// if _, value := keys[entry.String()]; !value { +// bytes, err := entry.MarshalJSON() +// if err != nil { +// continue +// } +// keys[entry.String()] = true +// res = append(res, bytes...) +// res = append(res, ';') +// } +// } +// return res[:len(res)-1] +//} + +//// GetUnbondingNodes return a given amount of all the UnbondingMetaNodes +//func (k Keeper) GetUnbondingNodes(ctx sdk.Context, networkAddr stratos.SdsAddress, +// maxRetrieve uint32) (unbondingMetaNodes []types.UnbondingNode) { +// +// unbondingMetaNodes = make([]types.UnbondingNode, maxRetrieve) +// +// store := ctx.KVStore(k.storeKey) +// metaNodePrefixKey := types.GetUBDNodeKey(networkAddr) +// iterator := sdk.KVStorePrefixIterator(store, metaNodePrefixKey) +// defer iterator.Close() +// +// i := 0 +// for ; iterator.Valid() && i < int(maxRetrieve); iterator.Next() { +// unbondingMetaNode := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) +// unbondingMetaNodes[i] = unbondingMetaNode +// i++ +// } +// return unbondingMetaNodes[:i] // trim if the array length < maxRetrieve +//} // GetUnbondingNode return a unbonding UnbondingMetaNode func (k Keeper) GetUnbondingNode(ctx sdk.Context, @@ -265,20 +265,20 @@ func (k Keeper) GetUnbondingNode(ctx sdk.Context, return ubd, true } -// IterateUnbondingNodes iterates through all of the unbonding metaNodes -func (k Keeper) IterateUnbondingNodes(ctx sdk.Context, fn func(index int64, ubd types.UnbondingNode) (stop bool)) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.UBDNodeKey) - defer iterator.Close() - - for i := int64(0); iterator.Valid(); iterator.Next() { - ubd := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) - if stop := fn(i, ubd); stop { - break - } - i++ - } -} +//// IterateUnbondingNodes iterates through all of the unbonding metaNodes +//func (k Keeper) IterateUnbondingNodes(ctx sdk.Context, fn func(index int64, ubd types.UnbondingNode) (stop bool)) { +// store := ctx.KVStore(k.storeKey) +// iterator := sdk.KVStorePrefixIterator(store, types.UBDNodeKey) +// defer iterator.Close() +// +// for i := int64(0); iterator.Valid(); iterator.Next() { +// ubd := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) +// if stop := fn(i, ubd); stop { +// break +// } +// i++ +// } +//} // HasMaxUnbondingMetaNodeEntries - check if unbonding MetaNode has maximum number of entries func (k Keeper) HasMaxUnbondingNodeEntries(ctx sdk.Context, networkAddr stratos.SdsAddress) bool { @@ -374,6 +374,7 @@ func (k Keeper) UnbondingNodeQueueIterator(ctx sdk.Context, endTime time.Time) s // DequeueAllMatureUBDQueue returns a concatenated list of all the timeslices inclusively previous to // currTime, and deletes the timeslices from the queue +// Iteration for dequeuing all mature unbonding queue func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []stratos.SdsAddress) { @@ -437,12 +438,12 @@ func (k Keeper) CompleteUnbondingWithAmount(ctx sdk.Context, networkAddr stratos return balances, ubd.IsMetaNode, nil } -// CompleteUnbonding performs the same logic as CompleteUnbondingWithAmount except -// it does not return the total unbonding amount. -func (k Keeper) CompleteUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress) error { - _, _, err := k.CompleteUnbondingWithAmount(ctx, networkAddr) - return err -} +//// CompleteUnbonding performs the same logic as CompleteUnbondingWithAmount except +//// it does not return the total unbonding amount. +//func (k Keeper) CompleteUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress) error { +// _, _, err := k.CompleteUnbondingWithAmount(ctx, networkAddr) +// return err +//} func (k Keeper) SubtractUBDNodeStake(ctx sdk.Context, ubd types.UnbondingNode, tokenToSub sdk.Coin) error { // case of meta node @@ -563,19 +564,20 @@ func (k Keeper) UnbondMetaNode( return ozoneLimitChange, unbondingMatureTime, nil } -// GetAllUnbondingNodes get the set of all ubd nodes with no limits, used during genesis dump -func (k Keeper) GetAllUnbondingNodes(ctx sdk.Context) (unbondingNodes []types.UnbondingNode) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.UBDNodeKey) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - node := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) - unbondingNodes = append(unbondingNodes, node) - } - return unbondingNodes -} - +//// GetAllUnbondingNodes get the set of all ubd nodes with no limits, used during genesis dump +//func (k Keeper) GetAllUnbondingNodes(ctx sdk.Context) (unbondingNodes []types.UnbondingNode) { +// store := ctx.KVStore(k.storeKey) +// iterator := sdk.KVStorePrefixIterator(store, types.UBDNodeKey) +// defer iterator.Close() +// +// for ; iterator.Valid(); iterator.Next() { +// node := types.MustUnmarshalUnbondingNode(k.cdc, iterator.Value()) +// unbondingNodes = append(unbondingNodes, node) +// } +// return unbondingNodes +//} + +// GetAllUnbondingNodesTotalBalance Iteration for getting the total balance of all unbonding nodes func (k Keeper) GetAllUnbondingNodesTotalBalance(ctx sdk.Context) sdk.Int { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.UBDNodeKey) @@ -621,7 +623,7 @@ func (k Keeper) CurrUozPrice(ctx sdk.Context) sdk.Dec { return currUozPrice } -// calc remaining/total supply for uoz +// UozSupply calc remaining/total supply for uoz func (k Keeper) UozSupply(ctx sdk.Context) (remaining, total sdk.Int) { remaining = k.GetRemainingOzoneLimit(ctx) // Lt S := k.GetInitialGenesisStakeTotal(ctx) diff --git a/x/register/keeper/meta_node.go b/x/register/keeper/meta_node.go index 4e9593ac..b7a72a32 100644 --- a/x/register/keeper/meta_node.go +++ b/x/register/keeper/meta_node.go @@ -63,7 +63,7 @@ func (k Keeper) GetMetaNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (met return metaNode, true } -// set the main record holding meta node details +// SetMetaNode sets the main record holding meta node details func (k Keeper) SetMetaNode(ctx sdk.Context, metaNode types.MetaNode) { store := ctx.KVStore(k.storeKey) bz := types.MustMarshalMetaNode(k.cdc, metaNode) @@ -72,6 +72,7 @@ func (k Keeper) SetMetaNode(ctx sdk.Context, metaNode types.MetaNode) { } // GetAllMetaNodes get the set of all meta nodes with no limits, used during genesis dump +//Iteration for all meta nodes func (k Keeper) GetAllMetaNodes(ctx sdk.Context) (metaNodes types.MetaNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.MetaNodeKey) diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index c96fb2a1..68882eae 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -114,7 +114,8 @@ func getMetaNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, l return res, nil } -func getNodesStakingInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { +// Iteration for querying total stakes of resource/meta nodes +func getNodesStakingInfo(ctx sdk.Context, _ abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { totalBondedStakeOfResourceNodes := k.GetResourceNodeBondedToken(ctx).Amount totalBondedStakeOfMetaNodes := k.GetMetaNodeBondedToken(ctx).Amount @@ -375,6 +376,7 @@ func getIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db. return prefixStore.Iterator(start, nil) } +// Iteration for querying total stakes of resource/meta nodes func FilteredPaginate(cdc codec.Codec, prefixStore storetypes.KVStore, queryOwnerAddr sdk.AccAddress, @@ -529,6 +531,7 @@ func FilteredPaginate(cdc codec.Codec, return res, nil } +// StakingInfosResourceNodes Iteration for querying StakingInfos of resource nodes by owner(cmd and rest) func StakingInfosResourceNodes( ctx sdk.Context, k Keeper, resourceNodes types.ResourceNodes, ) (types.StakingInfos, error) { @@ -548,6 +551,7 @@ func StakingInfosResourceNodes( return res, nil } +// StakingInfosMetaNodes Iteration for querying StakingInfos of meta nodes by owner(cmd and rest) func StakingInfosMetaNodes( ctx sdk.Context, k Keeper, metaNodes types.MetaNodes, ) (types.StakingInfos, error) { @@ -567,6 +571,7 @@ func StakingInfosMetaNodes( return res, nil } +// StakingInfosToStakingResourceNodes Iteration for querying StakingInfos of resource nodes by owner(grpc) func StakingInfosToStakingResourceNodes( ctx sdk.Context, k Keeper, resourceNodes types.ResourceNodes, ) ([]*types.StakingInfo, error) { @@ -584,6 +589,7 @@ func StakingInfosToStakingResourceNodes( return resp, nil } +// StakingInfosToStakingMetaNodes Iteration for querying StakingInfos of meta nodes by owner(grpc) func StakingInfosToStakingMetaNodes( ctx sdk.Context, k Keeper, metaNodes types.MetaNodes, ) ([]*types.StakingInfo, error) { diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index c649a64e..2752a423 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -70,6 +70,7 @@ func (k Keeper) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode } // GetAllResourceNodes get the set of all resource nodes with no limits, used during genesis dump +// Iteration for all resource nodes func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes types.ResourceNodes) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) diff --git a/x/register/keeper/slashing.go b/x/register/keeper/slashing.go index 9eea04a3..82ded146 100644 --- a/x/register/keeper/slashing.go +++ b/x/register/keeper/slashing.go @@ -31,6 +31,7 @@ func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, co return remaining, deducted } +// Iteration for each slashing func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, slashing sdk.Int) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.SlashingPrefix) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index e30ce9f8..ff49ead6 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -252,8 +252,8 @@ func (s *Staking) GetShares() sdk.Dec { return s.Value } type Stakings []Staking func (ss Stakings) String() (out string) { - for _, del := range ss { - out += del.String() + "\n" + for _, staking := range ss { + out += staking.String() + "\n" } return strings.TrimSpace(out) diff --git a/x/sds/keeper/keeper.go b/x/sds/keeper/keeper.go index bb6c3dc2..e45bb65d 100644 --- a/x/sds/keeper/keeper.go +++ b/x/sds/keeper/keeper.go @@ -233,6 +233,7 @@ func (k Keeper) doPrepay(ctx sdk.Context, sender sdk.AccAddress, coins sdk.Coins } // IterateFileUpload Iterate over all uploaded files. +// Iteration for all uploaded files func (k Keeper) IterateFileUpload(ctx sdk.Context, handler func(string, types.FileInfo) (stop bool)) { store := ctx.KVStore(k.key) iter := sdk.KVStorePrefixIterator(store, types.FileStoreKeyPrefix) @@ -248,6 +249,7 @@ func (k Keeper) IterateFileUpload(ctx sdk.Context, handler func(string, types.Fi } // IteratePrepay Iterate over all prepay KVs. +// Iteration for all prepay KVs func (k Keeper) IteratePrepay(ctx sdk.Context, handler func(sdk.AccAddress, sdk.Int) (stop bool)) { store := ctx.KVStore(k.key) iter := sdk.KVStorePrefixIterator(store, types.PrepayBalancePrefix) From 1552f62b498e22095b2184ae72d96188ec28ac15 Mon Sep 17 00:00:00 2001 From: Xiong Date: Thu, 9 Jun 2022 21:23:52 -0400 Subject: [PATCH 104/113] bug fix --- app/test_helpers.go | 79 ++++++++++++++++++++++++++++++++++++++++++--- x/pot/app_test.go | 73 ++++++++++++++++++----------------------- x/pot/types/msg.go | 4 +-- 3 files changed, 108 insertions(+), 48 deletions(-) diff --git a/app/test_helpers.go b/app/test_helpers.go index c07476a9..42fb1aa4 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -5,11 +5,14 @@ import ( "encoding/hex" "encoding/json" "fmt" + "math/rand" "strconv" "testing" "time" "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/types/tx/signing" stratos "github.com/stratosnet/stratos-chain/types" evmtypes "github.com/stratosnet/stratos-chain/x/evm/types" pottypes "github.com/stratosnet/stratos-chain/x/pot/types" @@ -28,9 +31,9 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp/helpers" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" + authsign "github.com/cosmos/cosmos-sdk/x/auth/signing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -38,6 +41,11 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) +const ( + DefaultGenTxGas = 5000000 + //SimAppChainID = "simulation-app" +) + // DefaultConsensusParams defines the default Tendermint consensus params used in // SimApp testing. var DefaultConsensusParams = &abci.ConsensusParams{ @@ -400,11 +408,11 @@ func SignCheckDeliver( chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { - tx, err := helpers.GenTx( + tx, err := GenTx( txCfg, msgs, sdk.Coins{sdk.NewInt64Coin(stratos.USTOS, 0)}, - helpers.DefaultGenTxGas, + DefaultGenTxGas, chainID, accNums, accSeqs, @@ -450,11 +458,11 @@ func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, i txs := make([]sdk.Tx, numToGenerate) var err error for i := 0; i < numToGenerate; i++ { - txs[i], err = helpers.GenTx( + txs[i], err = GenTx( txGen, msgs, sdk.Coins{sdk.NewInt64Coin(stratos.USTOS, 0)}, - helpers.DefaultGenTxGas, + DefaultGenTxGas, "", accNums, initSeqNums, @@ -539,3 +547,64 @@ func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientM return bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, recipientMod, amounts) } + +// GenTx generates a signed mock transaction. +func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) { + sigs := make([]signing.SignatureV2, len(priv)) + + // create a random length memo + r := rand.New(rand.NewSource(time.Now().UnixNano())) + + memo := simulation.RandStringOfLength(r, simulation.RandIntBetween(r, 0, 100)) + + signMode := gen.SignModeHandler().DefaultMode() + + // 1st round: set SignatureV2 with empty signatures, to set correct + // signer infos. + for i, p := range priv { + sigs[i] = signing.SignatureV2{ + PubKey: p.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: signMode, + }, + Sequence: accSeqs[i], + } + } + + tx := gen.NewTxBuilder() + err := tx.SetMsgs(msgs...) + if err != nil { + return nil, err + } + err = tx.SetSignatures(sigs...) + if err != nil { + return nil, err + } + tx.SetMemo(memo) + tx.SetFeeAmount(feeAmt) + tx.SetGasLimit(gas) + + // 2nd round: once all signer infos are set, every signer can sign. + for i, p := range priv { + signerData := authsign.SignerData{ + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], + } + signBytes, err := gen.SignModeHandler().GetSignBytes(signMode, signerData, tx.GetTx()) + if err != nil { + panic(err) + } + sig, err := p.Sign(signBytes) + if err != nil { + panic(err) + } + sigs[i].Data.(*signing.SingleSignatureData).Signature = sig + err = tx.SetSignatures(sigs...) + if err != nil { + panic(err) + } + } + + return tx.GetTx(), nil +} diff --git a/x/pot/app_test.go b/x/pot/app_test.go index 3ba51e1b..98ceb1aa 100644 --- a/x/pot/app_test.go +++ b/x/pot/app_test.go @@ -61,7 +61,6 @@ func setupSlashingMsg() *types.MsgSlashingResourceNode { reporters = append(reporters, idxNodeNetworkId1) reportOwner := make([]sdk.AccAddress, 0) reportOwner = append(reportOwner, idxOwner1) - slashingMsg := types.NewMsgSlashingResourceNode(reporters, reportOwner, resNodeNetworkId1, resOwner1, resNodeSlashingUOZAmt1, true) return slashingMsg } @@ -102,6 +101,7 @@ func TestPotVolumeReportMsgs(t *testing.T) { /********************* foundation account deposit *********************/ header := tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + stApp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx := stApp.BaseApp.NewContext(true, header) foundationDepositMsg := types.NewMsgFoundationDeposit(foundationDeposit, foundationDepositorAccAddr) @@ -117,6 +117,7 @@ func TestPotVolumeReportMsgs(t *testing.T) { /********************* create validator with 50% commission *********************/ header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + stApp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx = stApp.BaseApp.NewContext(true, header) commission := stakingtypes.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) @@ -132,8 +133,8 @@ func TestPotVolumeReportMsgs(t *testing.T) { /********************** commit **********************/ header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} - ctx = stApp.BaseApp.NewContext(true, header) stApp.BeginBlock(abci.RequestBeginBlock{Header: header}) + ctx = stApp.BaseApp.NewContext(true, header) validator := checkValidator(t, stApp, valOpValAddr1, true) require.Equal(t, stakingtypes.Bonded, validator.Status) @@ -203,7 +204,6 @@ func TestPotVolumeReportMsgs(t *testing.T) { distributeGoal, err := potKeeper.CalcTrafficRewardInTotal(ctx, distributeGoal, totalConsumedUoz) require.NoError(t, err) - /********************************************************** Main net part Start *********************************************************************/ distributeGoal, err = potKeeper.CalcMiningRewardInTotal(ctx, distributeGoal) //for main net require.NoError(t, err) println(distributeGoal.String()) @@ -213,51 +213,47 @@ func TestPotVolumeReportMsgs(t *testing.T) { distributeGoalBalance := distributeGoal rewardDetailMap := make(map[string]types.Reward) rewardDetailMap, distributeGoalBalance = potKeeper.CalcRewardForResourceNode(ctx, totalConsumedUoz, volumeReportMsg.WalletVolumes, distributeGoalBalance, rewardDetailMap) - /********************************************************** Main net part End *********************************************************************/ + rewardDetailMap, distributeGoalBalance = potKeeper.CalcRewardForMetaNode(ctx, distributeGoalBalance, rewardDetailMap) println("resource_wallet1: address = " + resOwner1.String()) - println(" miningReward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[resOwner1.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner1.String()].RewardFromTrafficPool.String()) println("resource_wallet2: address = " + resOwner2.String()) - println(" miningReward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[resOwner2.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner2.String()].RewardFromTrafficPool.String()) println("resource_wallet3: address = " + resOwner3.String()) - println(" miningReward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[resOwner3.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner3.String()].RewardFromTrafficPool.String()) println("resource_wallet4: address = " + resOwner4.String()) - println(" miningReward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[resOwner4.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner4.String()].RewardFromTrafficPool.String()) println("resource_wallet5: address = " + resOwner5.String()) - println(" miningReward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[resOwner5.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[resOwner5.String()].RewardFromTrafficPool.String()) println("indexing_wallet1: address = " + idxOwner1.String()) - println(" miningReward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[idxOwner1.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[idxOwner1.String()].RewardFromTrafficPool.String()) println("indexing_wallet2: address = " + idxOwner2.String()) - println(" miningReward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[idxOwner2.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[idxOwner2.String()].RewardFromTrafficPool.String()) println("indexing_wallet3: address = " + idxOwner3.String()) - println(" miningReward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) - println(" trafficReward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) + println(" miningReward = " + rewardDetailMap[idxOwner3.String()].RewardFromMiningPool.String()) + println(" trafficReward = " + rewardDetailMap[idxOwner3.String()].RewardFromTrafficPool.String()) println("---------------------------") /********************* record data before delivering tx *********************/ - feePoolAccAddr := accountKeeper.GetModuleAddress(authtypes.FeeCollectorName) - require.NotNil(t, feePoolAccAddr) lastFoundationAccBalance := bankKeeper.GetAllBalances(ctx, foundationAccountAddr) - lastFeePool := bankKeeper.GetAllBalances(ctx, feePoolAccAddr) lastUnissuedPrepay := registerKeeper.GetTotalUnissuedPrepay(ctx) lastMatureTotalOfResNode1 := potKeeper.GetMatureTotalReward(ctx, resOwner2) /********************* deliver tx *********************/ - idxOwnerAcc1 := accountKeeper.GetAccount(ctx, idxOwner1) ownerAccNum := idxOwnerAcc1.GetAccountNumber() ownerAccSeq := idxOwnerAcc1.GetSequence() @@ -267,6 +263,7 @@ func TestPotVolumeReportMsgs(t *testing.T) { /********************* commit & check result *********************/ header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + stApp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx = stApp.BaseApp.NewContext(true, header) epoch, ok = sdk.NewIntFromString(volumeReportMsg.Epoch.String()) @@ -279,10 +276,9 @@ func TestPotVolumeReportMsgs(t *testing.T) { epoch, lastFoundationAccBalance, lastUnissuedPrepay, - lastFeePool, lastMatureTotalOfResNode1, slashingAmtSetup, - ) // Main net + ) i++ } @@ -314,12 +310,11 @@ func checkResult(t *testing.T, ctx sdk.Context, currentEpoch sdk.Int, lastFoundationAccBalance sdk.Coins, lastUnissuedPrepay sdk.Coin, - lastFeePool sdk.Coins, lastMatureTotalOfResNode1 sdk.Coins, slashingAmtSetup sdk.Int) { currentSlashing := registerKeeper.GetSlashing(ctx, resNodeAddr2) - println("currentSlashing =" + currentSlashing.String()) + println("currentSlashing = " + currentSlashing.String()) individualRewardTotal := sdk.Coins{} newMatureEpoch := currentEpoch.Add(sdk.NewInt(k.MatureEpoch(ctx))) @@ -337,28 +332,24 @@ func checkResult(t *testing.T, ctx sdk.Context, newUnissuedPrepay := sdk.NewCoins(registerKeeper.GetTotalUnissuedPrepay(ctx)) slashingChange := slashingAmtSetup.Sub(registerKeeper.GetSlashing(ctx, resOwner1)) - println("resource node 1 slashing change = " + slashingChange.String()) + println("resource node 1 slashing change = " + slashingChange.String()) matureTotal := k.GetMatureTotalReward(ctx, resOwner1) immatureTotal := k.GetImmatureTotalReward(ctx, resOwner1) println("resource node 1 matureTotal = " + matureTotal.String()) - println("resource node 1 immatureTotal = " + immatureTotal.String()) + println("resource node 1 immatureTotal = " + immatureTotal.String()) rewardSrcChange := lastFoundationAccBalance. Sub(newFoundationAccBalance). Add(lastUnissuedPrepay). Sub(newUnissuedPrepay) - println("rewardSrcChange = " + rewardSrcChange.String()) - - // get fee pool changes - newFeePool := bankKeeper.GetAllBalances(ctx, feePoolAccAddr) - println("lastFeePool = " + lastFeePool.String()) - println("newFeePool = " + newFeePool.String()) + println("rewardSrcChange = " + rewardSrcChange.String()) - feePoolValChange := newFeePool.Sub(lastFeePool) - println("reward send to validator fee pool= " + feePoolValChange.String()) + // distribution module will send all tokens from "fee_collector" to "distribution" account in the BeginBlocker() method + feePoolValChange := bankKeeper.GetAllBalances(ctx, feePoolAccAddr) + println("reward send to validator fee pool = " + feePoolValChange.String()) rewardDestChange := feePoolValChange.Add(individualRewardTotal...) - println("rewardDestChange = " + rewardDestChange.String()) + println("rewardDestChange = " + rewardDestChange.String()) require.Equal(t, rewardSrcChange, rewardDestChange) @@ -371,7 +362,7 @@ func checkResult(t *testing.T, ctx sdk.Context, tmp := individualReward.RewardFromTrafficPool.Add(individualReward.RewardFromMiningPool...) upcomingMaturedIndividual = deductSlashingAmt(ctx, tmp, slashingChange) } - println("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) + println("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) // get mature total changes newMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner1) @@ -384,7 +375,7 @@ func checkResult(t *testing.T, ctx sdk.Context, matureTotalOfResNode1Change = sdk.Coins{} } - println("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) + println("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) require.Equal(t, matureTotalOfResNode1Change, upcomingMaturedIndividual) } diff --git a/x/pot/types/msg.go b/x/pot/types/msg.go index efb1b7fe..0ed59e39 100644 --- a/x/pot/types/msg.go +++ b/x/pot/types/msg.go @@ -210,12 +210,12 @@ func (msg MsgFoundationDeposit) ValidateBasic() error { func NewMsgSlashingResourceNode(reporters []stratos.SdsAddress, reporterOwner []sdk.AccAddress, networkAddress stratos.SdsAddress, walletAddress sdk.AccAddress, slashing sdk.Int, suspend bool) *MsgSlashingResourceNode { - reporterStrSlice := make([]string, len(reporters)) + reporterStrSlice := make([]string, 0) for _, reporter := range reporters { reporterStrSlice = append(reporterStrSlice, reporter.String()) } - reporterOwnerStrSlice := make([]string, len(reporterOwner)) + reporterOwnerStrSlice := make([]string, 0) for _, reporterOwner := range reporterOwner { reporterOwnerStrSlice = append(reporterOwnerStrSlice, reporterOwner.String()) } From 8c2d50fd9afac938a24f06cc1d613843deadd375 Mon Sep 17 00:00:00 2001 From: Xiong Date: Thu, 9 Jun 2022 21:54:09 -0400 Subject: [PATCH 105/113] unit test fix --- x/pot/app_test.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/x/pot/app_test.go b/x/pot/app_test.go index 98ceb1aa..35c6f6af 100644 --- a/x/pot/app_test.go +++ b/x/pot/app_test.go @@ -251,7 +251,7 @@ func TestPotVolumeReportMsgs(t *testing.T) { /********************* record data before delivering tx *********************/ lastFoundationAccBalance := bankKeeper.GetAllBalances(ctx, foundationAccountAddr) lastUnissuedPrepay := registerKeeper.GetTotalUnissuedPrepay(ctx) - lastMatureTotalOfResNode1 := potKeeper.GetMatureTotalReward(ctx, resOwner2) + lastMatureTotalOfResNode1 := potKeeper.GetMatureTotalReward(ctx, resOwner1) /********************* deliver tx *********************/ idxOwnerAcc1 := accountKeeper.GetAccount(ctx, idxOwner1) @@ -354,7 +354,7 @@ func checkResult(t *testing.T, ctx sdk.Context, require.Equal(t, rewardSrcChange, rewardDestChange) println("************************ slashing test***********************************") - println("slashing change = " + slashingChange.String()) + println("slashing change = " + slashingChange.String()) upcomingMaturedIndividual := sdk.Coins{} individualReward, found := k.GetIndividualReward(ctx, resOwner1, currentEpoch) @@ -362,19 +362,14 @@ func checkResult(t *testing.T, ctx sdk.Context, tmp := individualReward.RewardFromTrafficPool.Add(individualReward.RewardFromMiningPool...) upcomingMaturedIndividual = deductSlashingAmt(ctx, tmp, slashingChange) } - println("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) + println("upcomingMaturedIndividual = " + upcomingMaturedIndividual.String()) // get mature total changes newMatureTotalOfResNode1 := k.GetMatureTotalReward(ctx, resOwner1) matureTotalOfResNode1Change, _ := newMatureTotalOfResNode1.SafeSub(lastMatureTotalOfResNode1) - - if upcomingMaturedIndividual == nil { - upcomingMaturedIndividual = sdk.Coins{} - } if matureTotalOfResNode1Change == nil || matureTotalOfResNode1Change.IsAnyNegative() { matureTotalOfResNode1Change = sdk.Coins{} } - println("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) require.Equal(t, matureTotalOfResNode1Change, upcomingMaturedIndividual) } From 10b968f3956c720238ddc1e945f07aa21d953eaa Mon Sep 17 00:00:00 2001 From: Xiong Date: Thu, 9 Jun 2022 22:01:14 -0400 Subject: [PATCH 106/113] optimize unit test --- x/pot/app_test.go | 378 +++++++++++++++++++++++++++++----------------- x/pot/pot_test.go | 323 --------------------------------------- 2 files changed, 237 insertions(+), 464 deletions(-) delete mode 100644 x/pot/pot_test.go diff --git a/x/pot/app_test.go b/x/pot/app_test.go index 35c6f6af..21025a3d 100644 --- a/x/pot/app_test.go +++ b/x/pot/app_test.go @@ -1,27 +1,37 @@ package pot_test import ( + "os" "testing" + "time" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" + "github.com/stretchr/testify/require" + + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stratosnet/stratos-chain/app" stratos "github.com/stratosnet/stratos-chain/types" potKeeper "github.com/stratosnet/stratos-chain/x/pot/keeper" - registerKeeper "github.com/stratosnet/stratos-chain/x/register/keeper" - "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" - - abci "github.com/tendermint/tendermint/abci/types" - - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stratosnet/stratos-chain/x/pot/types" + registerKeeper "github.com/stratosnet/stratos-chain/x/register/keeper" ) const ( + chainID = "testchain_1-1" + stos2ustos = 1000000000 + stopFlagOutOfTotalMiningReward = true stopFlagSpecificMinedReward = false stopFlagSpecificEpoch = true @@ -30,6 +40,89 @@ const ( var ( paramSpecificMinedReward = sdk.NewCoins(sdk.NewCoin("ustos", sdk.NewInt(160000000000))) paramSpecificEpoch = sdk.NewInt(10) + + resNodeSlashingUOZAmt1 = sdk.NewInt(1000000000000000000) + + resourceNodeVolume1 = sdk.NewInt(500000) + resourceNodeVolume2 = sdk.NewInt(300000) + resourceNodeVolume3 = sdk.NewInt(200000) + + depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") + totalUnissuedPrepayVal, _ = sdk.NewIntFromString("1000000000000") + totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) + initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz + + foundationDepositorPrivKey = secp256k1.GenPrivKey() + foundationDepositorAccAddr = sdk.AccAddress(foundationDepositorPrivKey.PubKey().Address()) + foundationDeposit = sdk.NewCoins(sdk.NewCoin("utros", sdk.NewInt(40000000000000000))) + + resOwnerPrivKey1 = secp256k1.GenPrivKey() + resOwnerPrivKey2 = secp256k1.GenPrivKey() + resOwnerPrivKey3 = secp256k1.GenPrivKey() + resOwnerPrivKey4 = secp256k1.GenPrivKey() + resOwnerPrivKey5 = secp256k1.GenPrivKey() + idxOwnerPrivKey1 = secp256k1.GenPrivKey() + idxOwnerPrivKey2 = secp256k1.GenPrivKey() + idxOwnerPrivKey3 = secp256k1.GenPrivKey() + + resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) + resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) + resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) + resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) + resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) + idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) + idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) + idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) + + resNodePubKey1 = secp256k1.GenPrivKey().PubKey() + resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) + resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) + resNodeInitialStake1 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey2 = secp256k1.GenPrivKey().PubKey() + resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) + resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) + resNodeInitialStake2 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey3 = secp256k1.GenPrivKey().PubKey() + resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) + resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) + resNodeInitialStake3 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey4 = secp256k1.GenPrivKey().PubKey() + resNodeAddr4 = sdk.AccAddress(resNodePubKey4.Address()) + resNodeNetworkId4 = stratos.SdsAddress(resNodePubKey4.Address()) + resNodeInitialStake4 = sdk.NewInt(3 * stos2ustos) + + resNodePubKey5 = secp256k1.GenPrivKey().PubKey() + resNodeAddr5 = sdk.AccAddress(resNodePubKey5.Address()) + resNodeNetworkId5 = stratos.SdsAddress(resNodePubKey5.Address()) + resNodeInitialStake5 = sdk.NewInt(3 * stos2ustos) + + idxNodePrivKey1 = secp256k1.GenPrivKey() + idxNodePubKey1 = idxNodePrivKey1.PubKey() + idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) + idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) + idxNodeInitialStake1 = sdk.NewInt(5 * stos2ustos) + + idxNodePubKey2 = secp256k1.GenPrivKey().PubKey() + idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) + idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) + idxNodeInitialStake2 = sdk.NewInt(5 * stos2ustos) + + idxNodePubKey3 = secp256k1.GenPrivKey().PubKey() + idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) + idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) + idxNodeInitialStake3 = sdk.NewInt(5 * stos2ustos) + + valOpPrivKey1 = secp256k1.GenPrivKey() + valOpPubKey1 = valOpPrivKey1.PubKey() + valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) + valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) + + valConsPrivKey1 = ed25519.GenPrivKey() + valConsPubk1 = valConsPrivKey1.PubKey() + valInitialStake = sdk.NewInt(15 * stos2ustos) ) // initialize data of volume report @@ -382,136 +475,139 @@ func checkValidator(t *testing.T, app *app.NewApp, addr sdk.ValAddress, expFound return validator } -//func checkValidator(t *testing.T, mApp *mock.App, stakingKeeper staking.Keeper, -// addr sdk.ValAddress, expFound bool) staking.Validator { -// -// ctxCheck := mApp.BaseApp.NewContext(true, abci.Header{}) -// validator, found := stakingKeeper.GetValidator(ctxCheck, addr) -// -// require.Equal(t, expFound, found) -// return validator -//} - -//func getMockApp(t *testing.T) (*mock.App, Keeper, staking.Keeper, bank.Keeper, supply.Keeper, register.Keeper) { -// mApp := mock.NewApp() -// -// RegisterCodec(mApp.Cdc) -// supply.RegisterCodec(mApp.Cdc) -// staking.RegisterCodec(mApp.Cdc) -// register.RegisterCodec(mApp.Cdc) -// -// keySupply := sdk.NewKVStoreKey(supply.StoreKey) -// keyStaking := sdk.NewKVStoreKey(staking.StoreKey) -// keyRegister := sdk.NewKVStoreKey(register.StoreKey) -// keyPot := sdk.NewKVStoreKey(StoreKey) -// -// feeCollector := supply.NewEmptyModuleAccount(auth.FeeCollectorName) -// notBondedPool := supply.NewEmptyModuleAccount(staking.NotBondedPoolName, supply.Burner, supply.Staking) -// bondPool := supply.NewEmptyModuleAccount(staking.BondedPoolName, supply.Burner, supply.Staking) -// foundationAccount := supply.NewEmptyModuleAccount(types.FoundationAccount) -// -// blacklistedAddrs := make(map[string]bool) -// blacklistedAddrs[feeCollector.GetAddress().String()] = true -// blacklistedAddrs[notBondedPool.GetAddress().String()] = true -// blacklistedAddrs[bondPool.GetAddress().String()] = true -// blacklistedAddrs[foundationAccount.GetAddress().String()] = true -// -// bankKeeper := bank.NewBaseKeeper(mApp.AccountKeeper, mApp.ParamsKeeper.Subspace(bank.DefaultParamspace), blacklistedAddrs) -// maccPerms := map[string][]string{ -// auth.FeeCollectorName: nil, -// staking.NotBondedPoolName: {supply.Burner, supply.Staking}, -// staking.BondedPoolName: {supply.Burner, supply.Staking}, -// types.FoundationAccount: nil, -// } -// supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bankKeeper, maccPerms) -// stakingKeeper := staking.NewKeeper(mApp.Cdc, keyStaking, supplyKeeper, mApp.ParamsKeeper.Subspace(staking.DefaultParamspace)) -// registerKeeper := register.NewKeeper(mApp.Cdc, keyRegister, mApp.ParamsKeeper.Subspace(register.DefaultParamSpace), mApp.AccountKeeper, bankKeeper) -// -// keeper := NewKeeper(mApp.Cdc, keyPot, mApp.ParamsKeeper.Subspace(DefaultParamSpace), auth.FeeCollectorName, bankKeeper, supplyKeeper, mApp.AccountKeeper, stakingKeeper, registerKeeper) -// -// mApp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) -// mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) -// mApp.SetEndBlocker(getEndBlocker(keeper)) -// mApp.SetInitChainer(getInitChainer(mApp, keeper, mApp.AccountKeeper, supplyKeeper, -// []supplyexported.ModuleAccountI{feeCollector, notBondedPool, bondPool}, stakingKeeper, registerKeeper)) -// -// err := mApp.CompleteSetup(keyStaking, keySupply, keyRegister, keyPot) -// require.NoError(t, err) -// -// return mApp, keeper, stakingKeeper, bankKeeper, supplyKeeper, registerKeeper -//} - -// getInitChainer initializes the chainer of the mock app and sets the genesis -// state. It returns an empty ResponseInitChain. -//func getInitChainer(mapp *mock.App, keeper Keeper, accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, -// blacklistedAddrs []supplyexported.ModuleAccountI, stakingKeeper staking.Keeper, registerKeeper register.Keeper) sdk.InitChainer { -// return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { -// // set module accounts -// for _, macc := range blacklistedAddrs { -// supplyKeeper.SetModuleAccount(ctx, macc) -// } -// -// mapp.InitChainer(ctx, req) -// -// resourceNodes := setupAllResourceNodes() -// metaNodes := setupAllMetaNodes() -// -// registerGenesis := registertypes.NewGenesisState( -// register.DefaultParams(), -// resourceNodes, -// metaNodes, -// initialUOzonePrice, -// sdk.ZeroInt(), -// make([]register.Slashing, 0), -// ) -// -// register.InitGenesis(ctx, registerKeeper, registerGenesis) -// -// // set module accounts -// for _, macc := range blacklistedAddrs { -// supplyKeeper.SetModuleAccount(ctx, macc) -// } -// -// stakingGenesis := staking.NewGenesisState(staking.NewParams(staking.DefaultUnbondingTime, staking.DefaultMaxValidators, staking.DefaultMaxEntries, 0, "ustos"), nil, nil) -// -// totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))) -// supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) -// -// // set module accounts -// for _, macc := range blacklistedAddrs { -// supplyKeeper.SetModuleAccount(ctx, macc) -// } -// -// validators := staking.InitGenesis(ctx, stakingKeeper, accountKeeper, supplyKeeper, stakingGenesis) -// -// //preset -// keeper.RegisterKeeper.SetTotalUnissuedPrepay(ctx, totalUnissuedPrepay) -// -// //pot genesis data load -// InitGenesis(ctx, keeper, NewGenesisState( -// types.DefaultParams(), -// sdk.NewCoin(types.DefaultRewardDenom, sdk.ZeroInt()), -// 0, -// make([]types.ImmatureTotal, 0), -// make([]types.MatureTotal, 0), -// make([]types.Reward, 0), -// )) -// -// return abci.ResponseInitChain{ -// Validators: validators, -// } -// } -// -//} - -// getEndBlocker returns a staking endblocker. -//func getEndBlocker(keeper Keeper) sdk.EndBlocker { -// return func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { -// validatorUpdates := keeper.StakingKeeper.BlockValidatorUpdates(ctx) -// -// return abci.ResponseEndBlock{ -// ValidatorUpdates: validatorUpdates, -// } -// } -// return nil -//} +func TestMain(m *testing.M) { + config := stratos.GetConfig() + config.Seal() + exitVal := m.Run() + os.Exit(exitVal) +} + +func setupAccounts() ([]authtypes.GenesisAccount, []banktypes.Balance) { + + //************************** setup resource nodes owners' accounts ************************** + resOwnerAcc1 := &authtypes.BaseAccount{Address: resOwner1.String()} + resOwnerAcc2 := &authtypes.BaseAccount{Address: resOwner2.String()} + resOwnerAcc3 := &authtypes.BaseAccount{Address: resOwner3.String()} + resOwnerAcc4 := &authtypes.BaseAccount{Address: resOwner4.String()} + resOwnerAcc5 := &authtypes.BaseAccount{Address: resOwner5.String()} + //************************** setup indexing nodes owners' accounts ************************** + idxOwnerAcc1 := &authtypes.BaseAccount{Address: idxOwner1.String()} + idxOwnerAcc2 := &authtypes.BaseAccount{Address: idxOwner2.String()} + idxOwnerAcc3 := &authtypes.BaseAccount{Address: idxOwner3.String()} + //************************** setup validator delegators' accounts ************************** + valOwnerAcc1 := &authtypes.BaseAccount{Address: valOpAccAddr1.String()} + //************************** setup indexing nodes' accounts ************************** + idxNodeAcc1 := &authtypes.BaseAccount{Address: idxNodeAddr1.String()} + foundationDepositorAcc := &authtypes.BaseAccount{Address: foundationDepositorAccAddr.String()} + + accs := []authtypes.GenesisAccount{ + resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, + idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, + valOwnerAcc1, + foundationDepositorAcc, + idxNodeAcc1, + } + + balances := []banktypes.Balance{ + { + Address: resOwner1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake1.Add(depositForSendingTx))}, + }, + { + Address: resOwner2.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake2)}, + }, + { + Address: resOwner3.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake3)}, + }, + { + Address: resOwner4.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake4)}, + }, + { + Address: resOwner5.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake5)}, + }, + { + Address: idxOwner1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake1)}, + }, + { + Address: idxOwner2.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake2)}, + }, + { + Address: idxOwner3.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake3)}, + }, + { + Address: valOpAccAddr1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", valInitialStake)}, + }, + { + Address: idxNodeAddr1.String(), + Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, + }, + { + Address: foundationDepositorAccAddr.String(), + Coins: foundationDeposit, + }, + } + return accs, balances +} + +func setupAllResourceNodes() []registertypes.ResourceNode { + + time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") + nodeType := registertypes.STORAGE + resourceNode1, _ := registertypes.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, registertypes.NewDescription("sds://resourceNode1", "", "", "", ""), &nodeType, time) + resourceNode2, _ := registertypes.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, registertypes.NewDescription("sds://resourceNode2", "", "", "", ""), &nodeType, time) + resourceNode3, _ := registertypes.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, registertypes.NewDescription("sds://resourceNode3", "", "", "", ""), &nodeType, time) + resourceNode4, _ := registertypes.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, registertypes.NewDescription("sds://resourceNode4", "", "", "", ""), &nodeType, time) + resourceNode5, _ := registertypes.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, registertypes.NewDescription("sds://resourceNode5", "", "", "", ""), &nodeType, time) + + resourceNode1 = resourceNode1.AddToken(resNodeInitialStake1) + resourceNode2 = resourceNode2.AddToken(resNodeInitialStake2) + resourceNode3 = resourceNode3.AddToken(resNodeInitialStake3) + resourceNode4 = resourceNode4.AddToken(resNodeInitialStake4) + resourceNode5 = resourceNode5.AddToken(resNodeInitialStake5) + + resourceNode1.Status = stakingtypes.Bonded + resourceNode2.Status = stakingtypes.Bonded + resourceNode3.Status = stakingtypes.Bonded + resourceNode4.Status = stakingtypes.Bonded + resourceNode5.Status = stakingtypes.Bonded + + var resourceNodes []registertypes.ResourceNode + resourceNodes = append(resourceNodes, resourceNode1) + resourceNodes = append(resourceNodes, resourceNode2) + resourceNodes = append(resourceNodes, resourceNode3) + resourceNodes = append(resourceNodes, resourceNode4) + resourceNodes = append(resourceNodes, resourceNode5) + return resourceNodes +} + +func setupAllMetaNodes() []registertypes.MetaNode { + var indexingNodes []registertypes.MetaNode + + time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") + indexingNode1, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwner1, registertypes.NewDescription("sds://indexingNode1", "", "", "", ""), time) + indexingNode2, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwner2, registertypes.NewDescription("sds://indexingNode2", "", "", "", ""), time) + indexingNode3, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr3), idxNodePubKey3, idxOwner3, registertypes.NewDescription("sds://indexingNode3", "", "", "", ""), time) + + indexingNode1 = indexingNode1.AddToken(idxNodeInitialStake1) + indexingNode2 = indexingNode2.AddToken(idxNodeInitialStake2) + indexingNode3 = indexingNode3.AddToken(idxNodeInitialStake3) + + indexingNode1.Status = stakingtypes.Bonded + indexingNode2.Status = stakingtypes.Bonded + indexingNode3.Status = stakingtypes.Bonded + + indexingNodes = append(indexingNodes, indexingNode1) + indexingNodes = append(indexingNodes, indexingNode2) + indexingNodes = append(indexingNodes, indexingNode3) + + return indexingNodes + +} diff --git a/x/pot/pot_test.go b/x/pot/pot_test.go deleted file mode 100644 index 14e72787..00000000 --- a/x/pot/pot_test.go +++ /dev/null @@ -1,323 +0,0 @@ -package pot_test - -import ( - "os" - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - registertypes "github.com/stratosnet/stratos-chain/x/register/types" - - //"github.com/cosmos/cosmos-sdk/x/auth" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - stratos "github.com/stratosnet/stratos-chain/types" -) - -const ( - chainID = "testchain_1-1" - stos2ustos = 1000000000 -) - -var ( - resNodeSlashingUOZAmt1 = sdk.NewInt(1000000000000000000) - - resourceNodeVolume1 = sdk.NewInt(500000) - resourceNodeVolume2 = sdk.NewInt(300000) - resourceNodeVolume3 = sdk.NewInt(200000) - - depositForSendingTx, _ = sdk.NewIntFromString("100000000000000000000000000000") - totalUnissuedPrepayVal, _ = sdk.NewIntFromString("1000000000000") - totalUnissuedPrepay = sdk.NewCoin("ustos", totalUnissuedPrepayVal) - initialUOzonePrice = sdk.NewDecWithPrec(10000000, 9) // 0.001 ustos -> 1 uoz - - foundationDepositorPrivKey = secp256k1.GenPrivKey() - foundationDepositorAccAddr = sdk.AccAddress(foundationDepositorPrivKey.PubKey().Address()) - foundationDeposit = sdk.NewCoins(sdk.NewCoin("utros", sdk.NewInt(40000000000000000))) - - resOwnerPrivKey1 = secp256k1.GenPrivKey() - resOwnerPrivKey2 = secp256k1.GenPrivKey() - resOwnerPrivKey3 = secp256k1.GenPrivKey() - resOwnerPrivKey4 = secp256k1.GenPrivKey() - resOwnerPrivKey5 = secp256k1.GenPrivKey() - idxOwnerPrivKey1 = secp256k1.GenPrivKey() - idxOwnerPrivKey2 = secp256k1.GenPrivKey() - idxOwnerPrivKey3 = secp256k1.GenPrivKey() - - resOwner1 = sdk.AccAddress(resOwnerPrivKey1.PubKey().Address()) - resOwner2 = sdk.AccAddress(resOwnerPrivKey2.PubKey().Address()) - resOwner3 = sdk.AccAddress(resOwnerPrivKey3.PubKey().Address()) - resOwner4 = sdk.AccAddress(resOwnerPrivKey4.PubKey().Address()) - resOwner5 = sdk.AccAddress(resOwnerPrivKey5.PubKey().Address()) - idxOwner1 = sdk.AccAddress(idxOwnerPrivKey1.PubKey().Address()) - idxOwner2 = sdk.AccAddress(idxOwnerPrivKey2.PubKey().Address()) - idxOwner3 = sdk.AccAddress(idxOwnerPrivKey3.PubKey().Address()) - - resNodePubKey1 = secp256k1.GenPrivKey().PubKey() - resNodeAddr1 = sdk.AccAddress(resNodePubKey1.Address()) - resNodeNetworkId1 = stratos.SdsAddress(resNodePubKey1.Address()) - resNodeInitialStake1 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey2 = secp256k1.GenPrivKey().PubKey() - resNodeAddr2 = sdk.AccAddress(resNodePubKey2.Address()) - resNodeNetworkId2 = stratos.SdsAddress(resNodePubKey2.Address()) - resNodeInitialStake2 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey3 = secp256k1.GenPrivKey().PubKey() - resNodeAddr3 = sdk.AccAddress(resNodePubKey3.Address()) - resNodeNetworkId3 = stratos.SdsAddress(resNodePubKey3.Address()) - resNodeInitialStake3 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey4 = secp256k1.GenPrivKey().PubKey() - resNodeAddr4 = sdk.AccAddress(resNodePubKey4.Address()) - resNodeNetworkId4 = stratos.SdsAddress(resNodePubKey4.Address()) - resNodeInitialStake4 = sdk.NewInt(3 * stos2ustos) - - resNodePubKey5 = secp256k1.GenPrivKey().PubKey() - resNodeAddr5 = sdk.AccAddress(resNodePubKey5.Address()) - resNodeNetworkId5 = stratos.SdsAddress(resNodePubKey5.Address()) - resNodeInitialStake5 = sdk.NewInt(3 * stos2ustos) - - idxNodePrivKey1 = secp256k1.GenPrivKey() - idxNodePubKey1 = idxNodePrivKey1.PubKey() - idxNodeAddr1 = sdk.AccAddress(idxNodePubKey1.Address()) - idxNodeNetworkId1 = stratos.SdsAddress(idxNodePubKey1.Address()) - idxNodeInitialStake1 = sdk.NewInt(5 * stos2ustos) - - idxNodePubKey2 = secp256k1.GenPrivKey().PubKey() - idxNodeAddr2 = sdk.AccAddress(idxNodePubKey2.Address()) - idxNodeNetworkId2 = stratos.SdsAddress(idxNodePubKey2.Address()) - idxNodeInitialStake2 = sdk.NewInt(5 * stos2ustos) - - idxNodePubKey3 = secp256k1.GenPrivKey().PubKey() - idxNodeAddr3 = sdk.AccAddress(idxNodePubKey3.Address()) - idxNodeNetworkId3 = stratos.SdsAddress(idxNodePubKey3.Address()) - idxNodeInitialStake3 = sdk.NewInt(5 * stos2ustos) - - valOpPrivKey1 = secp256k1.GenPrivKey() - valOpPubKey1 = valOpPrivKey1.PubKey() - valOpValAddr1 = sdk.ValAddress(valOpPubKey1.Address()) - valOpAccAddr1 = sdk.AccAddress(valOpPubKey1.Address()) - - valConsPrivKey1 = ed25519.GenPrivKey() - valConsPubk1 = valConsPrivKey1.PubKey() - valInitialStake = sdk.NewInt(15 * stos2ustos) -) - -func TestMain(m *testing.M) { - config := stratos.GetConfig() - config.Seal() - exitVal := m.Run() - os.Exit(exitVal) -} - -func setupAccounts() ([]authtypes.GenesisAccount, []banktypes.Balance) { - - //************************** setup resource nodes owners' accounts ************************** - resOwnerAcc1 := &authtypes.BaseAccount{Address: resOwner1.String()} - resOwnerAcc2 := &authtypes.BaseAccount{Address: resOwner2.String()} - resOwnerAcc3 := &authtypes.BaseAccount{Address: resOwner3.String()} - resOwnerAcc4 := &authtypes.BaseAccount{Address: resOwner4.String()} - resOwnerAcc5 := &authtypes.BaseAccount{Address: resOwner5.String()} - //************************** setup indexing nodes owners' accounts ************************** - idxOwnerAcc1 := &authtypes.BaseAccount{Address: idxOwner1.String()} - idxOwnerAcc2 := &authtypes.BaseAccount{Address: idxOwner2.String()} - idxOwnerAcc3 := &authtypes.BaseAccount{Address: idxOwner3.String()} - //************************** setup validator delegators' accounts ************************** - valOwnerAcc1 := &authtypes.BaseAccount{Address: valOpAccAddr1.String()} - //************************** setup indexing nodes' accounts ************************** - idxNodeAcc1 := &authtypes.BaseAccount{Address: idxNodeAddr1.String()} - foundationDepositorAcc := &authtypes.BaseAccount{Address: foundationDepositorAccAddr.String()} - - accs := []authtypes.GenesisAccount{ - resOwnerAcc1, resOwnerAcc2, resOwnerAcc3, resOwnerAcc4, resOwnerAcc5, - idxOwnerAcc1, idxOwnerAcc2, idxOwnerAcc3, - valOwnerAcc1, - foundationDepositorAcc, - idxNodeAcc1, - } - - balances := []banktypes.Balance{ - { - Address: resOwner1.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake1.Add(depositForSendingTx))}, - }, - { - Address: resOwner2.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake2)}, - }, - { - Address: resOwner3.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake3)}, - }, - { - Address: resOwner4.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake4)}, - }, - { - Address: resOwner5.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", resNodeInitialStake5)}, - }, - { - Address: idxOwner1.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake1)}, - }, - { - Address: idxOwner2.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake2)}, - }, - { - Address: idxOwner3.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", idxNodeInitialStake3)}, - }, - { - Address: valOpAccAddr1.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", valInitialStake)}, - }, - { - Address: idxNodeAddr1.String(), - Coins: sdk.Coins{sdk.NewCoin("ustos", sdk.ZeroInt())}, - }, - { - Address: foundationDepositorAccAddr.String(), - Coins: foundationDeposit, - }, - } - - //app := simapp.SetupWithGenesisAccounts(accs, balances...) - //simapp.CheckBalance(t, app, addr1, sdk.Coins{genCoin}) - //simapp.CheckBalance(t, app, addr2, sdk.Coins{genCoin}) - - //ctx1 := mApp.BaseApp.NewContext(true, abci.Header{}) - //ctx1.Logger().Info("idxNodeAcc1 -> " + idxNodeAcc1.String()) - - return accs, balances -} - -func setupAllResourceNodes() []registertypes.ResourceNode { - - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - nodeType := registertypes.STORAGE - resourceNode1, _ := registertypes.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, registertypes.NewDescription("sds://resourceNode1", "", "", "", ""), &nodeType, time) - resourceNode2, _ := registertypes.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, registertypes.NewDescription("sds://resourceNode2", "", "", "", ""), &nodeType, time) - resourceNode3, _ := registertypes.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, registertypes.NewDescription("sds://resourceNode3", "", "", "", ""), &nodeType, time) - resourceNode4, _ := registertypes.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, registertypes.NewDescription("sds://resourceNode4", "", "", "", ""), &nodeType, time) - resourceNode5, _ := registertypes.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, registertypes.NewDescription("sds://resourceNode5", "", "", "", ""), &nodeType, time) - - resourceNode1 = resourceNode1.AddToken(resNodeInitialStake1) - resourceNode2 = resourceNode2.AddToken(resNodeInitialStake2) - resourceNode3 = resourceNode3.AddToken(resNodeInitialStake3) - resourceNode4 = resourceNode4.AddToken(resNodeInitialStake4) - resourceNode5 = resourceNode5.AddToken(resNodeInitialStake5) - - resourceNode1.Status = stakingtypes.Bonded - resourceNode2.Status = stakingtypes.Bonded - resourceNode3.Status = stakingtypes.Bonded - resourceNode4.Status = stakingtypes.Bonded - resourceNode5.Status = stakingtypes.Bonded - - var resourceNodes []registertypes.ResourceNode - resourceNodes = append(resourceNodes, resourceNode1) - resourceNodes = append(resourceNodes, resourceNode2) - resourceNodes = append(resourceNodes, resourceNode3) - resourceNodes = append(resourceNodes, resourceNode4) - resourceNodes = append(resourceNodes, resourceNode5) - return resourceNodes -} - -func setupAllMetaNodes() []registertypes.MetaNode { - var indexingNodes []registertypes.MetaNode - - time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") - indexingNode1, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr1), idxNodePubKey1, idxOwner1, registertypes.NewDescription("sds://indexingNode1", "", "", "", ""), time) - indexingNode2, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr2), idxNodePubKey2, idxOwner2, registertypes.NewDescription("sds://indexingNode2", "", "", "", ""), time) - indexingNode3, _ := registertypes.NewMetaNode(stratos.SdsAddress(idxNodeAddr3), idxNodePubKey3, idxOwner3, registertypes.NewDescription("sds://indexingNode3", "", "", "", ""), time) - - indexingNode1 = indexingNode1.AddToken(idxNodeInitialStake1) - indexingNode2 = indexingNode2.AddToken(idxNodeInitialStake2) - indexingNode3 = indexingNode3.AddToken(idxNodeInitialStake3) - - indexingNode1.Status = stakingtypes.Bonded - indexingNode2.Status = stakingtypes.Bonded - indexingNode3.Status = stakingtypes.Bonded - - indexingNodes = append(indexingNodes, indexingNode1) - indexingNodes = append(indexingNodes, indexingNode2) - indexingNodes = append(indexingNodes, indexingNode3) - - return indexingNodes - -} - -// SignCheckDeliver checks a generated signed transaction and simulates a -// block commitment with the given transaction. A test assertion is made using -// the parameter 'expPass' against the result. A corresponding result is -// returned. -//func SignCheckDeliver( -// t *testing.T, cdc *codec.Codec, app *baseapp.BaseApp, header abci.Header, msgs []sdk.Msg, -// accNums, seq []uint64, expSimPass, expPass bool, priv ...crypto.PrivKey, -//) (sdk.GasInfo, *sdk.Result, error) { -// -// tx := GenTx(msgs, accNums, seq, priv...) -// -// txBytes, err := cdc.MarshalBinaryLengthPrefixed(tx) -// require.Nil(t, err) -// -// // Must simulate now as CheckTx doesn't run Msgs anymore -// _, res, err := app.Simulate(txBytes, tx) -// -// if expSimPass { -// require.NoError(t, err) -// require.NotNil(t, res) -// } else { -// require.Error(t, err) -// require.Nil(t, res) -// } -// -// // Simulate a sending a transaction and committing a block -// app.BeginBlock(abci.RequestBeginBlock{Header: header}) -// gInfo, res, err := app.Deliver(tx) -// -// if expPass { -// require.NoError(t, err) -// require.NotNil(t, res) -// } else { -// require.Error(t, err) -// require.Nil(t, res) -// } -// -// app.EndBlock(abci.RequestEndBlock{}) -// app.Commit() -// -// return gInfo, res, err -//} - -// GenTx generates a signed mock transaction. -//func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKey) auth.StdTx { -// // Make the transaction free -// fee := auth.StdFee{ -// Amount: sdk.NewCoins(sdk.NewInt64Coin("foocoin", 0)), -// Gas: 5000000, -// } -// -// sigs := make([]auth.StdSignature, len(priv)) -// memo := "testmemotestmemo" -// -// for i, p := range priv { -// sig, err := p.Sign(auth.StdSignBytes(chainID, accnums[i], seq[i], fee, msgs, memo)) -// if err != nil { -// panic(err) -// } -// -// sigs[i] = auth.StdSignature{ -// PubKey: p.PubKey(), -// Signature: sig, -// } -// } -// -// return auth.NewStdTx(msgs, fee, sigs, memo) -//} From 66e3e3ec37ee8bf7089890a87048cf22b0637f06 Mon Sep 17 00:00:00 2001 From: Xiong Date: Fri, 10 Jun 2022 16:16:23 -0400 Subject: [PATCH 107/113] nodeType: use uint32 instead of string unit test for pot module upgrade --- proto/stratos/register/v1/register.proto | 4 +- proto/stratos/register/v1/tx.proto | 4 +- x/pot/app_test.go | 13 +- x/pot/handler.go | 105 ----------- x/pot/keeper/slashing.go | 8 +- x/register/client/cli/flags.go | 39 +--- x/register/client/cli/tx.go | 21 +-- x/register/client/rest/tx.go | 18 +- x/register/keeper/msg_server.go | 14 +- x/register/keeper/resource_node.go | 4 +- x/register/types/msg.go | 21 +-- x/register/types/querier.go | 2 +- x/register/types/register.pb.go | 80 +++------ x/register/types/resource_node.go | 15 +- x/register/types/tx.pb.go | 218 ++++++++++------------- 15 files changed, 167 insertions(+), 399 deletions(-) diff --git a/proto/stratos/register/v1/register.proto b/proto/stratos/register/v1/register.proto index b6adad19..62123983 100644 --- a/proto/stratos/register/v1/register.proto +++ b/proto/stratos/register/v1/register.proto @@ -77,7 +77,7 @@ message ResourceNode { (gogoproto.jsontag) = "creation_time", (gogoproto.moretags) = "yaml:\"creation_time\"" ]; - string node_type = 9 [ + uint32 node_type = 9 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -234,7 +234,7 @@ message StakingInfo { (gogoproto.jsontag) = "creation_time", (gogoproto.moretags) = "yaml:\"creation_time\"" ]; - string node_type = 9 [ + uint32 node_type = 9 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; diff --git a/proto/stratos/register/v1/tx.proto b/proto/stratos/register/v1/tx.proto index 399348e7..fe3bb316 100644 --- a/proto/stratos/register/v1/tx.proto +++ b/proto/stratos/register/v1/tx.proto @@ -70,7 +70,7 @@ message MsgCreateResourceNode { (gogoproto.jsontag) = "description", (gogoproto.moretags) = "yaml:\"description\"" ]; - string node_type = 6 [ + uint32 node_type = 6 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; @@ -161,7 +161,7 @@ message MsgUpdateResourceNode { (gogoproto.jsontag) = "owner_address", (gogoproto.moretags) = "yaml:\"owner_address\"" ]; - string node_type = 4 [ + uint32 node_type = 4 [ (gogoproto.jsontag) = "node_type", (gogoproto.moretags) = "yaml:\"node_type\"" ]; diff --git a/x/pot/app_test.go b/x/pot/app_test.go index 21025a3d..f5990ec8 100644 --- a/x/pot/app_test.go +++ b/x/pot/app_test.go @@ -254,6 +254,7 @@ func TestPotVolumeReportMsgs(t *testing.T) { require.NoError(t, err) /********************* commit & check result *********************/ header = tmproto.Header{Height: stApp.LastBlockHeight() + 1, ChainID: chainID} + stApp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx = stApp.BaseApp.NewContext(true, header) slashingAmtSetup = registerKeeper.GetSlashing(ctx, resOwner1) @@ -464,7 +465,7 @@ func checkResult(t *testing.T, ctx sdk.Context, matureTotalOfResNode1Change = sdk.Coins{} } println("matureTotalOfResNode1Change = " + matureTotalOfResNode1Change.String()) - require.Equal(t, matureTotalOfResNode1Change, upcomingMaturedIndividual) + require.Equal(t, matureTotalOfResNode1Change.String(), upcomingMaturedIndividual.String()) } func checkValidator(t *testing.T, app *app.NewApp, addr sdk.ValAddress, expFound bool) stakingtypes.Validator { @@ -561,11 +562,11 @@ func setupAllResourceNodes() []registertypes.ResourceNode { time, _ := time.Parse(time.RubyDate, "Fri Sep 24 10:37:13 -0400 2021") nodeType := registertypes.STORAGE - resourceNode1, _ := registertypes.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, registertypes.NewDescription("sds://resourceNode1", "", "", "", ""), &nodeType, time) - resourceNode2, _ := registertypes.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, registertypes.NewDescription("sds://resourceNode2", "", "", "", ""), &nodeType, time) - resourceNode3, _ := registertypes.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, registertypes.NewDescription("sds://resourceNode3", "", "", "", ""), &nodeType, time) - resourceNode4, _ := registertypes.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, registertypes.NewDescription("sds://resourceNode4", "", "", "", ""), &nodeType, time) - resourceNode5, _ := registertypes.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, registertypes.NewDescription("sds://resourceNode5", "", "", "", ""), &nodeType, time) + resourceNode1, _ := registertypes.NewResourceNode(resNodeNetworkId1, resNodePubKey1, resOwner1, registertypes.NewDescription("sds://resourceNode1", "", "", "", ""), nodeType, time) + resourceNode2, _ := registertypes.NewResourceNode(resNodeNetworkId2, resNodePubKey2, resOwner2, registertypes.NewDescription("sds://resourceNode2", "", "", "", ""), nodeType, time) + resourceNode3, _ := registertypes.NewResourceNode(resNodeNetworkId3, resNodePubKey3, resOwner3, registertypes.NewDescription("sds://resourceNode3", "", "", "", ""), nodeType, time) + resourceNode4, _ := registertypes.NewResourceNode(resNodeNetworkId4, resNodePubKey4, resOwner4, registertypes.NewDescription("sds://resourceNode4", "", "", "", ""), nodeType, time) + resourceNode5, _ := registertypes.NewResourceNode(resNodeNetworkId5, resNodePubKey5, resOwner5, registertypes.NewDescription("sds://resourceNode5", "", "", "", ""), nodeType, time) resourceNode1 = resourceNode1.AddToken(resNodeInitialStake1) resourceNode2 = resourceNode2.AddToken(resNodeInitialStake2) diff --git a/x/pot/handler.go b/x/pot/handler.go index f49b8889..944f44a6 100644 --- a/x/pot/handler.go +++ b/x/pot/handler.go @@ -38,108 +38,3 @@ func NewHandler(k keeper.Keeper) sdk.Handler { } } } - -//// Handle handleMsgVolumeReport. -//func handleMsgVolumeReport(ctx sdk.Context, k keeper.Keeper, msg types.MsgVolumeReport) (*sdk.Result, error) { -// if !(k.IsSPNode(ctx, msg.Reporter)) { -// errMsg := fmt.Sprint("Volume report is not sent by a superior peer") -// return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, errMsg) -// } -// -// // ensure epoch increment -// lastEpoch := k.GetLastReportedEpoch(ctx) -// if msg.Epoch.LTE(lastEpoch) { -// e := sdkerrors.Wrapf(types.ErrMatureEpoch, "expected epoch should be greater than %s, got %s", -// lastEpoch.String(), msg.Epoch.String()) -// return nil, e -// } -// -// // TODO: verify BLS signature -// -// txBytes := ctx.TxBytes() -// txhash := fmt.Sprintf("%X", tmhash.Sum(txBytes)) -// -// totalConsumedOzone, err := k.VolumeReport(ctx, msg.WalletVolumes, msg.Reporter, msg.Epoch, msg.ReportReference, txhash) -// if err != nil { -// return nil, err -// } -// -// ctx.EventManager().EmitEvents(sdk.Events{ -// sdk.NewEvent( -// types.EventTypeVolumeReport, -// sdk.NewAttribute(types.AttributeKeyTotalConsumedOzone, totalConsumedOzone.String()), -// sdk.NewAttribute(types.AttributeKeyReportReference, hex.EncodeToString([]byte(msg.ReportReference))), -// sdk.NewAttribute(types.AttributeKeyEpoch, msg.Epoch.String()), -// ), -// sdk.NewEvent( -// sdk.EventTypeMessage, -// sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), -// sdk.NewAttribute(sdk.AttributeKeySender, msg.ReporterOwner.String()), -// ), -// }) -// -// return &sdk.Result{Events: ctx.EventManager().Events()}, nil -//} -// -//func handleMsgWithdraw(ctx sdk.Context, k keeper.Keeper, msg types.MsgWithdraw) (*sdk.Result, error) { -// err := k.Withdraw(ctx, msg.Amount, msg.WalletAddress, msg.TargetAddress) -// if err != nil { -// return nil, err -// } -// -// ctx.EventManager().EmitEvents(sdk.Events{ -// sdk.NewEvent( -// types.EventTypeWithdraw, -// sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), -// sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress.String()), -// ), -// sdk.NewEvent( -// sdk.EventTypeMessage, -// sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), -// sdk.NewAttribute(sdk.AttributeKeySender, msg.WalletAddress.String()), -// ), -// }) -// return &sdk.Result{Events: ctx.EventManager().Events()}, nil -//} -// -//func handleMsgFoundationDeposit(ctx sdk.Context, k keeper.Keeper, msg types.MsgFoundationDeposit) (*sdk.Result, error) { -// err := k.FoundationDeposit(ctx, msg.Amount, msg.From) -// if err != nil { -// return nil, err -// } -// -// ctx.EventManager().EmitEvents(sdk.Events{ -// sdk.NewEvent( -// types.EventTypeFoundationDeposit, -// sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), -// ), -// sdk.NewEvent( -// sdk.EventTypeMessage, -// sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), -// sdk.NewAttribute(sdk.AttributeKeySender, msg.From.String()), -// ), -// }) -// return &sdk.Result{Events: ctx.EventManager().Events()}, nil -//} -// -//func handleMsgSlashingResourceNode(ctx sdk.Context, k keeper.Keeper, msg types.MsgSlashingResourceNode) (*sdk.Result, error) { -// for _, reporter := range msg.Reporters { -// if !(k.IsSPNode(ctx, reporter)) { -// errMsg := fmt.Sprint("Slashing msg is not sent by a meta node") -// return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, errMsg) -// } -// } -// -// amt, nodeType, err := k.SlashingResourceNode(ctx, msg.NetworkAddress, msg.WalletAddress, msg.Slashing, msg.Suspend) -// ctx.EventManager().EmitEvents(sdk.Events{ -// sdk.NewEvent( -// types.EventTypeSlashing, -// sdk.NewAttribute(types.AttributeKeyWalletAddress, msg.WalletAddress.String()), -// sdk.NewAttribute(types.AttributeKeyNodeP2PAddress, msg.NetworkAddress.String()), -// sdk.NewAttribute(types.AttributeKeyAmount, amt.String()), -// sdk.NewAttribute(types.AttributeKeySlashingNodeType, nodeType.String()), -// sdk.NewAttribute(types.AttributeKeyNodeSuspended, strconv.FormatBool(msg.Suspend)), -// ), -// }) -// return &sdk.Result{Events: ctx.EventManager().Events()}, err -//} diff --git a/x/pot/keeper/slashing.go b/x/pot/keeper/slashing.go index 9cce7ee4..fd318bea 100644 --- a/x/pot/keeper/slashing.go +++ b/x/pot/keeper/slashing.go @@ -1,8 +1,6 @@ package keeper import ( - "strconv" - sdk "github.com/cosmos/cosmos-sdk/types" stratos "github.com/stratosnet/stratos-chain/types" "github.com/stratosnet/stratos-chain/x/pot/types" @@ -42,10 +40,6 @@ func (k Keeper) SlashingResourceNode(ctx sdk.Context, p2pAddr stratos.SdsAddress k.RegisterKeeper.SetResourceNode(ctx, node) k.RegisterKeeper.SetSlashing(ctx, walletAddr, newSlashing) - resourceNodeType, err := strconv.Atoi(node.NodeType) - if err != nil { - return sdk.ZeroInt(), registertypes.NodeType(0), registertypes.ErrNodeType - } - return slash.TruncateInt(), registertypes.NodeType(resourceNodeType), nil + return slash.TruncateInt(), registertypes.NodeType(node.NodeType), nil } diff --git a/x/register/client/cli/flags.go b/x/register/client/cli/flags.go index df605d50..f86367b0 100644 --- a/x/register/client/cli/flags.go +++ b/x/register/client/cli/flags.go @@ -24,43 +24,6 @@ const ( FlagVoterNetworkAddress = "voter-network-address" ) -// common flagsets to add to various functions -//var ( -//FsPk = flag.NewFlagSet("", flag.ContinueOnError) -//FsAmount = flag.NewFlagSet("", flag.ContinueOnError) -//FsStakeDelta = flag.NewFlagSet("", flag.ContinueOnError) -//FsIncrStake = flag.NewFlagSet("", flag.ContinueOnError) -//FsNetworkAddr = flag.NewFlagSet("", flag.ContinueOnError) -//FsNodeType = flag.NewFlagSet("", flag.ContinueOnError) -//FsDescription = flag.NewFlagSet("", flag.ContinueOnError) -//FsNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) -//FsCandidateNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) -//FsCandidateOwnerAddress = flag.NewFlagSet("", flag.ContinueOnError) -//FsOpinion = flag.NewFlagSet("", flag.ContinueOnError) -//FsVoterNetworkAddress = flag.NewFlagSet("", flag.ContinueOnError) -//) - -//func init() { -//FsPk.String(FlagPubKey, "", "The Bech32 encoded PubKey of the node") -//FsAmount.String(FlagAmount, "", "Amount of coins to bond") -//FsStakeDelta.String(FlagStakeDelta, "", "Stake change of coins to be made (always positive like 100000ustos)") -//FsIncrStake.String(FlagIncrStake, "", "Boolean indicator of increase/decrease of stake delta, true for increase and false for decrease") -//FsNodeType.Int(FlagNodeType, 0, "The value of node_type is determined by the three node "+ -// "types (storage=4/database=2/computation=1) and their arbitrary combinations.") - -//FsDescription.String(FlagMoniker, "", "The node's name") -//FsDescription.String(FlagIdentity, "", "The optional identity signature (ex. UPort or Keybase)") -//FsDescription.String(FlagWebsite, "", "The node's (optional) website") -//FsDescription.String(FlagSecurityContact, "", "The node's (optional) security contact email") -//FsDescription.String(FlagDetails, "", "The node's (optional) details") - -//FsNetworkAddress.String(FlagNetworkAddress, "The address of the PP node", "") -//FsCandidateNetworkAddress.String(FlagCandidateNetworkAddress, "The network address of the candidate PP node", "") -//FsCandidateOwnerAddress.String(FlagCandidateOwnerAddress, "The owner address of the candidate PP node", "") -//FsOpinion.Bool(FlagOpinion, false, "Opinion of the vote for the registration of Meta node.") -//FsVoterNetworkAddress.String(FlagVoterNetworkAddress, "The address of the PP node that made the vote.", "") -//} - func flagSetDescriptionCreate() *flag.FlagSet { fs := flag.NewFlagSet("", flag.ContinueOnError) @@ -97,7 +60,7 @@ func flagSetNetworkAddress() *flag.FlagSet { // FlagSetNodeType Returns the flagset for node type of resource node func flagSetNodeType() *flag.FlagSet { fs := flag.NewFlagSet("", flag.ContinueOnError) - fs.Int(FlagNodeType, 0, "The value of node_type is determined by the three node types (storage=4/database=2/computation=1) and their arbitrary combinations.") + fs.Uint32(FlagNodeType, 0, "The value of node_type is determined by the three node types (storage=4/database=2/computation=1) and their arbitrary combinations.") return fs } diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index 32cd3004..e7b06265 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -409,7 +409,7 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs return txf, nil, err } - nodeTypeRef, err := fs.GetInt(FlagNodeType) + nodeTypeVal, err := fs.GetUint32(FlagNodeType) if err != nil { return txf, nil, err } @@ -427,12 +427,12 @@ func newBuildCreateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs details, ) - // validate nodeTypeRef - newNodeType := types.NodeType(nodeTypeRef) - if t := newNodeType.Type(); t == "UNKNOWN" { + // validate nodeTypeVal + nodeType := types.NodeType(nodeTypeVal) + if t := nodeType.Type(); t == "UNKNOWN" { return txf, nil, types.ErrNodeType } - msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, description, strconv.Itoa(nodeTypeRef)) + msg, er := types.NewMsgCreateResourceNode(networkAddr, pubKey, amount, ownerAddr, description, nodeTypeVal) if er != nil { return txf, nil, err } @@ -515,16 +515,17 @@ func newBuildUpdateResourceNodeMsg(clientCtx client.Context, txf tx.Factory, fs details, ) - nodeTypeRef, err := fs.GetInt(FlagNodeType) + nodeTypeVal, err := fs.GetUint32(FlagNodeType) if err != nil { return txf, nil, types.ErrInvalidNodeType } - if nodeTypeRef > 7 || nodeTypeRef < 0 { - return txf, nil, types.ErrInvalidNodeType + // validate nodeTypeVal + nodeType := types.NodeType(nodeTypeVal) + if t := nodeType.Type(); t == "UNKNOWN" { + return txf, nil, types.ErrNodeType } - nodeTypeStr := strconv.Itoa(nodeTypeRef) - msg := types.NewMsgUpdateResourceNode(*description, nodeTypeStr, networkAddr, ownerAddr) + msg := types.NewMsgUpdateResourceNode(*description, nodeTypeVal, networkAddr, ownerAddr) return txf, msg, nil } diff --git a/x/register/client/rest/tx.go b/x/register/client/rest/tx.go index c704e9fd..42da21cd 100644 --- a/x/register/client/rest/tx.go +++ b/x/register/client/rest/tx.go @@ -61,7 +61,7 @@ type ( PubKey string `json:"pubkey" yaml:"pubkey"` // in bech32 Amount sdk.Coin `json:"amount" yaml:"amount"` Description types.Description `json:"description" yaml:"description"` - NodeType int `json:"node_type" yaml:"node_type"` + NodeType uint32 `json:"node_type" yaml:"node_type"` } RemoveResourceNodeRequest struct { @@ -72,7 +72,7 @@ type ( UpdateResourceNodeRequest struct { BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` Description types.Description `json:"description" yaml:"description"` - NodeType int `json:"node_type" yaml:"node_type"` + NodeType uint32 `json:"node_type" yaml:"node_type"` NetworkAddress string `json:"network_address" yaml:"network_address"` } @@ -137,13 +137,12 @@ func postCreateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - nodeTypeRef := req.NodeType ownerAddr, er := sdk.AccAddressFromBech32(req.BaseReq.From) if er != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, er.Error()) return } - if t := types.NodeType(nodeTypeRef).Type(); t == "UNKNOWN" { + if t := types.NodeType(req.NodeType).Type(); t == "UNKNOWN" { rest.WriteErrorResponse(w, http.StatusBadRequest, "node type(s) not supported") return } @@ -152,9 +151,9 @@ func postCreateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - //nodeType := types.NodeType(nodeTypeRef) + msg, err := types.NewMsgCreateResourceNode(networkAddr, pubKey, req.Amount, ownerAddr, &req.Description, - string(nodeTypeRef)) + req.NodeType) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -291,8 +290,6 @@ func postUpdateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - nodeTypeRef := req.NodeType - networkAddr, err := stratos.SdsAddressFromBech32(req.NetworkAddress) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) @@ -304,12 +301,11 @@ func postUpdateResourceNodeHandlerFn(cliCtx client.Context) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusBadRequest, er.Error()) return } - if t := types.NodeType(nodeTypeRef).Type(); t == "UNKNOWN" { + if t := types.NodeType(req.NodeType).Type(); t == "UNKNOWN" { rest.WriteErrorResponse(w, http.StatusBadRequest, "node type(s) not supported") return } - msg := types.NewMsgUpdateResourceNode(req.Description, - string(types.NodeType(nodeTypeRef)), networkAddr, ownerAddr) + msg := types.NewMsgUpdateResourceNode(req.Description, req.NodeType, networkAddr, ownerAddr) if err := msg.ValidateBasic(); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return diff --git a/x/register/keeper/msg_server.go b/x/register/keeper/msg_server.go index e13ba3a0..0e86777c 100644 --- a/x/register/keeper/msg_server.go +++ b/x/register/keeper/msg_server.go @@ -51,11 +51,8 @@ func (k msgServer) HandleMsgCreateResourceNode(goCtx context.Context, msg *types if msg.Value.Denom != k.BondDenom(ctx) { return nil, types.ErrBadDenom } - nodeType, err := strconv.ParseUint(msg.NodeType, 10, 8) - if err != nil { - return &types.MsgCreateResourceNodeResponse{}, err - } - ozoneLimitChange, err := k.RegisterResourceNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, types.NodeType(nodeType), msg.Value) + + ozoneLimitChange, err := k.RegisterResourceNode(ctx, networkAddr, pk, ownerAddress, *msg.Description, types.NodeType(msg.NodeType), msg.Value) if err != nil { return nil, err } @@ -271,12 +268,7 @@ func (k msgServer) HandleMsgUpdateResourceNode(goCtx context.Context, msg *types if err != nil { return &types.MsgUpdateResourceNodeResponse{}, err } - //nodeType, err := strconv.ParseUint(msg.NodeType, 10, 64) - nodeType, err := strconv.Atoi(msg.NodeType) - if err != nil { - return &types.MsgUpdateResourceNodeResponse{}, err - } - err = k.UpdateResourceNode(ctx, msg.Description, types.NodeType(nodeType), networkAddr, ownerAddress) + err = k.UpdateResourceNode(ctx, msg.Description, types.NodeType(msg.NodeType), networkAddr, ownerAddress) if err != nil { return nil, err } diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 2752a423..7a6939ef 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -276,7 +276,7 @@ func (k Keeper) removeResourceNode(ctx sdk.Context, addr stratos.SdsAddress) err func (k Keeper) RegisterResourceNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, description types.Description, nodeType types.NodeType, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error) { - resourceNode, err := types.NewResourceNode(networkAddr, pubKey, ownerAddr, &description, &nodeType, ctx.BlockHeader().Time) + resourceNode, err := types.NewResourceNode(networkAddr, pubKey, ownerAddr, &description, nodeType, ctx.BlockHeader().Time) if err != nil { return ozoneLimitChange, err } @@ -299,7 +299,7 @@ func (k Keeper) UpdateResourceNode(ctx sdk.Context, description types.Descriptio node.Description = &description if nodeType != 0 { - node.NodeType = nodeType.String() + node.NodeType = uint32(nodeType) } k.SetResourceNode(ctx, node) diff --git a/x/register/types/msg.go b/x/register/types/msg.go index 962fb2b7..d89742d8 100644 --- a/x/register/types/msg.go +++ b/x/register/types/msg.go @@ -1,8 +1,6 @@ package types import ( - "strconv" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,7 +36,7 @@ const ( // NewMsgCreateResourceNode NewMsg creates a new Msg instance func NewMsgCreateResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, //nolint:interfacer - value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, nodeType string, + value sdk.Coin, ownerAddr sdk.AccAddress, description *Description, nodeType uint32, ) (*MsgCreateResourceNode, error) { var pkAny *codectypes.Any if pubKey != nil { @@ -98,13 +96,11 @@ func (msg MsgCreateResourceNode) ValidateBasic() error { return ErrEmptyDescription } - nodeTypeNum, err := strconv.Atoi(msg.GetNodeType()) - if err != nil { - return ErrInvalidNodeType - } - if nodeTypeNum > 7 || nodeTypeNum < 1 { + nodeType := NodeType(msg.GetNodeType()) + if nodeType.Type() == "UNKNOWN" { return ErrInvalidNodeType } + return nil } @@ -311,7 +307,7 @@ func (msg MsgRemoveMetaNode) ValidateBasic() error { return nil } -func NewMsgUpdateResourceNode(description Description, nodeType string, +func NewMsgUpdateResourceNode(description Description, nodeType uint32, networkAddress stratos.SdsAddress, ownerAddress sdk.AccAddress) *MsgUpdateResourceNode { return &MsgUpdateResourceNode{ @@ -365,11 +361,8 @@ func (msg MsgUpdateResourceNode) ValidateBasic() error { // return ErrEmptyMoniker //} - nodeTypeNum, err := strconv.Atoi(msg.NodeType) - if err != nil { - return ErrInvalidNodeType - } - if nodeTypeNum > 7 || nodeTypeNum < 0 { + nodeType := NodeType(msg.NodeType) + if nodeType.Type() == "UNKNOWN" { return ErrInvalidNodeType } return nil diff --git a/x/register/types/querier.go b/x/register/types/querier.go index d798e8f6..dde7c7ca 100644 --- a/x/register/types/querier.go +++ b/x/register/types/querier.go @@ -110,7 +110,7 @@ func NewStakingInfoByMetaNodeAddr( Tokens: &metaNode.Tokens, OwnerAddress: metaNode.GetOwnerAddress(), Description: metaNode.Description, - NodeType: "metanode", + NodeType: uint32(0), CreationTime: metaNode.CreationTime, UnBondingStake: &unBondingValue, UnBondedStake: &unBondedValue, diff --git a/x/register/types/register.pb.go b/x/register/types/register.pb.go index adcdb3ce..00eaa671 100644 --- a/x/register/types/register.pb.go +++ b/x/register/types/register.pb.go @@ -111,7 +111,7 @@ type ResourceNode struct { OwnerAddress string `protobuf:"bytes,6,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` - NodeType string `protobuf:"bytes,9,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` + NodeType uint32 `protobuf:"varint,9,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *ResourceNode) Reset() { *m = ResourceNode{} } @@ -196,11 +196,11 @@ func (m *ResourceNode) GetCreationTime() time.Time { return time.Time{} } -func (m *ResourceNode) GetNodeType() string { +func (m *ResourceNode) GetNodeType() uint32 { if m != nil { return m.NodeType } - return "" + return 0 } type MetaNode struct { @@ -577,7 +577,7 @@ type StakingInfo struct { OwnerAddress string `protobuf:"bytes,6,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` Description *Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description" yaml:"description"` CreationTime time.Time `protobuf:"bytes,8,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time" yaml:"creation_time"` - NodeType string `protobuf:"bytes,9,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` + NodeType uint32 `protobuf:"varint,9,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` BondedStake *types2.Coin `protobuf:"bytes,10,opt,name=bonded_stake,json=bondedStake,proto3" json:"bonded_stake" yaml:"bonded_stake"` UnBondingStake *types2.Coin `protobuf:"bytes,11,opt,name=un_bonding_stake,json=unBondingStake,proto3" json:"un_bonding_stake" yaml:"un_bonding_stake"` UnBondedStake *types2.Coin `protobuf:"bytes,12,opt,name=un_bonded_stake,json=unBondedStake,proto3" json:"un_bonded_stake" yaml:"un_bonded_stake"` @@ -665,11 +665,11 @@ func (m *StakingInfo) GetCreationTime() time.Time { return time.Time{} } -func (m *StakingInfo) GetNodeType() string { +func (m *StakingInfo) GetNodeType() uint32 { if m != nil { return m.NodeType } - return "" + return 0 } func (m *StakingInfo) GetBondedStake() *types2.Coin { @@ -931,7 +931,7 @@ var fileDescriptor_fef1e3aeec8499d6 = []byte{ 0x51, 0x08, 0x0d, 0xe9, 0x4d, 0x03, 0x91, 0xa5, 0xab, 0x18, 0x01, 0x98, 0x75, 0x02, 0x6c, 0x67, 0x39, 0x56, 0x16, 0xce, 0x96, 0x4f, 0x45, 0xc6, 0x7e, 0x52, 0x1c, 0xcd, 0x0d, 0x95, 0x64, 0xa3, 0x86, 0xd9, 0xd2, 0x46, 0x60, 0xf4, 0x3c, 0x4e, 0xa6, 0x6a, 0x82, 0x89, 0x0c, 0xfa, 0x1b, 0x98, - 0xf1, 0xa9, 0x8b, 0x5b, 0xf1, 0x1e, 0xd7, 0x67, 0xc4, 0x56, 0x5d, 0x1d, 0x86, 0x30, 0x03, 0xa3, + 0xf1, 0xa9, 0x8b, 0x5b, 0xf1, 0x1e, 0xd7, 0x67, 0x44, 0xfe, 0x5c, 0x1d, 0x86, 0x30, 0x03, 0xa3, 0x10, 0xce, 0xab, 0x90, 0x4e, 0x20, 0x64, 0x95, 0xe3, 0xff, 0xfb, 0x83, 0x1e, 0xbe, 0x55, 0x7e, 0xf1, 0x12, 0x16, 0xbe, 0x79, 0x09, 0x0b, 0xe8, 0xdb, 0x49, 0x50, 0x7e, 0x80, 0xb9, 0x7d, 0x9e, 0x35, 0xe7, 0x59, 0xf3, 0x0b, 0xcf, 0x1a, 0x2d, 0xea, 0xbf, 0x2b, 0x82, 0x2b, 0x49, 0xd4, 0x5b, @@ -986,7 +986,7 @@ var fileDescriptor_fef1e3aeec8499d6 = []byte{ 0xbb, 0x52, 0x78, 0xfe, 0x6e, 0x65, 0xe2, 0xcd, 0xbb, 0x95, 0x89, 0xcf, 0xdf, 0xad, 0x4c, 0xfc, 0xfb, 0xcf, 0x9a, 0x07, 0x95, 0x54, 0x3e, 0xe6, 0xc9, 0xdf, 0x75, 0xe7, 0xc0, 0x26, 0x7e, 0xf3, 0x24, 0x7b, 0x01, 0x17, 0x3e, 0xdb, 0x53, 0x22, 0x3e, 0x6f, 0x7e, 0x1f, 0x00, 0x00, 0xff, 0xff, - 0x5d, 0x17, 0x4e, 0x0f, 0x22, 0x17, 0x00, 0x00, + 0x38, 0x58, 0xc1, 0x21, 0x22, 0x17, 0x00, 0x00, } func (this *ResourceNode) Equal(that interface{}) bool { @@ -1189,12 +1189,10 @@ func (m *ResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NodeType) > 0 { - i -= len(m.NodeType) - copy(dAtA[i:], m.NodeType) - i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeType))) + if m.NodeType != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.NodeType)) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x48 } n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) if err3 != nil { @@ -1652,12 +1650,10 @@ func (m *StakingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x52 } - if len(m.NodeType) > 0 { - i -= len(m.NodeType) - copy(dAtA[i:], m.NodeType) - i = encodeVarintRegister(dAtA, i, uint64(len(m.NodeType))) + if m.NodeType != 0 { + i = encodeVarintRegister(dAtA, i, uint64(m.NodeType)) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x48 } n18, err18 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime):]) if err18 != nil { @@ -1959,9 +1955,8 @@ func (m *ResourceNode) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) n += 1 + l + sovRegister(uint64(l)) - l = len(m.NodeType) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.NodeType != 0 { + n += 1 + sovRegister(uint64(m.NodeType)) } return n } @@ -2136,9 +2131,8 @@ func (m *StakingInfo) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreationTime) n += 1 + l + sovRegister(uint64(l)) - l = len(m.NodeType) - if l > 0 { - n += 1 + l + sovRegister(uint64(l)) + if m.NodeType != 0 { + n += 1 + sovRegister(uint64(m.NodeType)) } if m.BondedStake != nil { l = m.BondedStake.Size() @@ -2663,10 +2657,10 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 9: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) } - var stringLen uint64 + m.NodeType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -2676,24 +2670,11 @@ func (m *ResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NodeType |= uint32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRegister - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegister - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRegister(dAtA[iNdEx:]) @@ -4001,10 +3982,10 @@ func (m *StakingInfo) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 9: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) } - var stringLen uint64 + m.NodeType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegister @@ -4014,24 +3995,11 @@ func (m *StakingInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NodeType |= uint32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRegister - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegister - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BondedStake", wireType) diff --git a/x/register/types/resource_node.go b/x/register/types/resource_node.go index ff49ead6..e2be33c3 100644 --- a/x/register/types/resource_node.go +++ b/x/register/types/resource_node.go @@ -2,7 +2,6 @@ package types import ( "fmt" - "strconv" "strings" "time" @@ -14,7 +13,7 @@ import ( stratos "github.com/stratosnet/stratos-chain/types" ) -type NodeType uint8 +type NodeType uint32 const ( STORAGE NodeType = 4 @@ -74,7 +73,7 @@ func (v ResourceNodes) Validate() error { // NewResourceNode - initialize a new resource node func NewResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, ownerAddr sdk.AccAddress, - description *Description, nodeType *NodeType, creationTime time.Time) (ResourceNode, error) { + description *Description, nodeType NodeType, creationTime time.Time) (ResourceNode, error) { pkAny, err := codectypes.NewAnyWithValue(pubKey) if err != nil { return ResourceNode{}, err @@ -87,7 +86,7 @@ func NewResourceNode(networkAddr stratos.SdsAddress, pubKey cryptotypes.PubKey, Tokens: sdk.ZeroInt(), OwnerAddress: ownerAddr.String(), Description: description, - NodeType: nodeType.Type(), + NodeType: uint32(nodeType), CreationTime: creationTime, }, nil } @@ -173,11 +172,9 @@ func (v ResourceNode) Validate() error { if v.GetDescription().Moniker == "" { return ErrEmptyMoniker } - nodeTypeNum, err := strconv.Atoi(v.GetNodeType()) - if err != nil { - return ErrInvalidNodeType - } - if nodeTypeNum > 7 || nodeTypeNum < 1 { + + nodeType := NodeType(v.GetNodeType()) + if nodeType.Type() == "UNKNOWN" { return ErrInvalidNodeType } return nil diff --git a/x/register/types/tx.pb.go b/x/register/types/tx.pb.go index ff619bad..957782f6 100644 --- a/x/register/types/tx.pb.go +++ b/x/register/types/tx.pb.go @@ -39,7 +39,7 @@ type MsgCreateResourceNode struct { Value types1.Coin `protobuf:"bytes,3,opt,name=value,proto3" json:"value" yaml:"value"` OwnerAddress string `protobuf:"bytes,4,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` Description *Description `protobuf:"bytes,5,opt,name=description,proto3" json:"description" yaml:"description"` - NodeType string `protobuf:"bytes,6,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` + NodeType uint32 `protobuf:"varint,6,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *MsgCreateResourceNode) Reset() { *m = MsgCreateResourceNode{} } @@ -110,11 +110,11 @@ func (m *MsgCreateResourceNode) GetDescription() *Description { return nil } -func (m *MsgCreateResourceNode) GetNodeType() string { +func (m *MsgCreateResourceNode) GetNodeType() uint32 { if m != nil { return m.NodeType } - return "" + return 0 } // MsgCreateResourceNodeResponse defines the CreateResourceNodeTx response type @@ -425,7 +425,7 @@ type MsgUpdateResourceNode struct { Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description" yaml:"description"` NetworkAddress string `protobuf:"bytes,2,opt,name=network_address,json=networkAddress,proto3" json:"network_address" yaml:"network_address"` OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address" yaml:"owner_address"` - NodeType string `protobuf:"bytes,4,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` + NodeType uint32 `protobuf:"varint,4,opt,name=node_type,json=nodeType,proto3" json:"node_type" yaml:"node_type"` } func (m *MsgUpdateResourceNode) Reset() { *m = MsgUpdateResourceNode{} } @@ -834,87 +834,87 @@ func init() { func init() { proto.RegisterFile("stratos/register/v1/tx.proto", fileDescriptor_75d4b90d7a185a31) } var fileDescriptor_75d4b90d7a185a31 = []byte{ - // 1272 bytes of a gzipped FileDescriptorProto + // 1275 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xce, 0x3a, 0x4e, 0x48, 0x26, 0x69, 0x4b, 0x9c, 0xa4, 0x75, 0x9c, 0xc4, 0xe3, 0x4e, 0x49, - 0x68, 0x88, 0xb2, 0x5b, 0x27, 0xa0, 0x94, 0x4a, 0x20, 0xc5, 0xed, 0x01, 0x09, 0x25, 0xa0, 0x05, + 0x18, 0xce, 0x3a, 0x6e, 0x49, 0x26, 0x49, 0x4b, 0x9c, 0xa4, 0x75, 0x9c, 0xc4, 0xe3, 0x4e, 0x49, + 0x48, 0x88, 0xb2, 0x5b, 0x27, 0xa0, 0x94, 0x4a, 0x20, 0xc5, 0xed, 0x01, 0x09, 0x25, 0xa0, 0x05, 0x7a, 0x40, 0x42, 0xd6, 0xda, 0x1e, 0xdc, 0x55, 0xe2, 0x1d, 0x6b, 0x77, 0xed, 0x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x7d, 0xa2, 0x6a, 0xb5, 0xd5, - 0x63, 0x0a, 0xc7, 0x2c, 0x0a, 0x79, 0xbc, 0x4d, 0xe1, 0x2c, 0x5f, 0x89, 0x0d, 0x91, 0xcc, 0xcd, - 0x85, 0x03, 0x70, 0x85, 0x3c, 0xd6, 0xb0, 0xee, 0x37, 0x22, 0xcf, 0x1a, 0xb1, 0x61, 0x51, 0x18, - 0x76, 0xd8, 0x14, 0x2e, 0xf0, 0x09, 0x42, 0x66, 0x24, 0xcf, 0xb2, 0xb1, 0xd7, 0x02, 0x15, 0xcc, - 0xb4, 0xb0, 0xd1, 0xd4, 0xd5, 0xae, 0xc3, 0x74, 0x71, 0x82, 0xa1, 0xac, 0x88, 0x09, 0x6a, 0x12, - 0x1f, 0x0c, 0xe3, 0x6a, 0x6b, 0x16, 0x85, 0xc1, 0x44, 0x9b, 0xc2, 0x02, 0x5f, 0x2d, 0x60, 0x44, - 0x72, 0x30, 0xa4, 0xf0, 0x3e, 0x98, 0xd6, 0x48, 0x0b, 0xd7, 0xcd, 0x41, 0x17, 0x17, 0x27, 0x19, - 0xec, 0x9b, 0x16, 0x85, 0x43, 0xa3, 0x4d, 0xe1, 0xeb, 0x2e, 0x73, 0x9e, 0x09, 0xc9, 0x53, 0xce, - 0xef, 0x4f, 0x9d, 0x9f, 0x10, 0xac, 0x26, 0xca, 0x43, 0xc6, 0x46, 0x97, 0x68, 0x06, 0x46, 0xbf, - 0x8f, 0x83, 0x39, 0x3f, 0x62, 0x1f, 0x9b, 0xca, 0xa5, 0x78, 0xfe, 0x2f, 0xe2, 0x41, 0xcb, 0x60, - 0x29, 0x46, 0xad, 0x4f, 0xfc, 0x1f, 0x02, 0xdb, 0x39, 0x64, 0xdc, 0x21, 0xfd, 0xf0, 0xce, 0xd1, - 0x01, 0x8b, 0xba, 0x3b, 0xae, 0x33, 0x51, 0x85, 0x25, 0xf0, 0xae, 0x45, 0x61, 0x72, 0x80, 0x4d, - 0xe1, 0x0a, 0xc7, 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05, 0x22, 0x17, 0xeb, 0xe6, 0x68, 0xeb, 0x73, 0xa1, 0xee, 0x9c, 0x23, + 0xd8, 0x47, 0xbc, 0xc3, 0x10, 0x6f, 0xa1, 0xcd, 0x91, 0x10, 0xbb, 0x02, 0xfd, 0x45, 0x00, 0xb7, + 0x7c, 0xdc, 0xa9, 0xa7, 0xfc, 0x9d, 0x34, 0x3c, 0x69, 0x19, 0xa5, 0xbb, 0xe7, 0xcd, 0xf0, 0xcb, + 0xb8, 0xcb, 0xca, 0xd8, 0x46, 0x77, 0x12, 0xcb, 0x18, 0xe2, 0xd7, 0x03, 0x13, 0xd4, 0x9d, 0x33, + 0xa9, 0x76, 0x70, 0x7c, 0x52, 0x16, 0x9e, 0x9f, 0x94, 0x85, 0x3f, 0x4f, 0xca, 0xc2, 0xb7, 0xa7, + 0xe5, 0xb1, 0xe7, 0xa7, 0xe5, 0xb1, 0xdf, 0x4e, 0xcb, 0x63, 0x9f, 0xbf, 0xdd, 0x56, 0xcd, 0x47, + 0xbd, 0x86, 0xd8, 0x24, 0x1d, 0x6f, 0x56, 0x0d, 0x9b, 0xde, 0xcf, 0xad, 0xe6, 0x23, 0x45, 0xd5, + 0xa4, 0x27, 0xc3, 0x85, 0x9c, 0xc7, 0x9a, 0xd1, 0xb8, 0xca, 0xfe, 0x6e, 0xda, 0xf9, 0x2f, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xc6, 0x03, 0x6c, 0x1f, 0x16, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1307,12 +1307,10 @@ func (m *MsgCreateResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NodeType) > 0 { - i -= len(m.NodeType) - copy(dAtA[i:], m.NodeType) - i = encodeVarintTx(dAtA, i, uint64(len(m.NodeType))) + if m.NodeType != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NodeType)) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x30 } if m.Description != nil { { @@ -1622,12 +1620,10 @@ func (m *MsgUpdateResourceNode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NodeType) > 0 { - i -= len(m.NodeType) - copy(dAtA[i:], m.NodeType) - i = encodeVarintTx(dAtA, i, uint64(len(m.NodeType))) + if m.NodeType != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NodeType)) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x20 } if len(m.OwnerAddress) > 0 { i -= len(m.OwnerAddress) @@ -2032,9 +2028,8 @@ func (m *MsgCreateResourceNode) Size() (n int) { l = m.Description.Size() n += 1 + l + sovTx(uint64(l)) } - l = len(m.NodeType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.NodeType != 0 { + n += 1 + sovTx(uint64(m.NodeType)) } return n } @@ -2152,9 +2147,8 @@ func (m *MsgUpdateResourceNode) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.NodeType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.NodeType != 0 { + n += 1 + sovTx(uint64(m.NodeType)) } return n } @@ -2504,10 +2498,10 @@ func (m *MsgCreateResourceNode) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) } - var stringLen uint64 + m.NodeType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2517,24 +2511,11 @@ func (m *MsgCreateResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NodeType |= uint32(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.NodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3330,10 +3311,10 @@ func (m *MsgUpdateResourceNode) Unmarshal(dAtA []byte) error { m.OwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NodeType", wireType) } - var stringLen uint64 + m.NodeType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3343,24 +3324,11 @@ func (m *MsgUpdateResourceNode) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NodeType |= uint32(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.NodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From fdaa5275ee67cc520b8cdda665dc7b317d32e152 Mon Sep 17 00:00:00 2001 From: jialbai Date: Fri, 10 Jun 2022 16:42:22 -0400 Subject: [PATCH 108/113] - qb-1165: add util funcs for SdsAddress --- types/address.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/address.go b/types/address.go index 5b1ec6e6..0b23bcd3 100644 --- a/types/address.go +++ b/types/address.go @@ -62,6 +62,26 @@ func SdsPubKeyFromBech32(pubkeyStr string) (cryptotypes.PubKey, error) { return pk, nil } +// SdsPubKeyFromBytes returns a SdsPublicKey from a byte array. +func SdsPubKeyFromByteArr(bytes []byte) (cryptotypes.PubKey, error) { + bech32PubPrefix := GetConfig().GetBech32SdsNodeP2PPubPrefix() + pubStr, err := sdk.Bech32ifyAddressBytes(bech32PubPrefix, bytes) + if err != nil { + return nil, err + } + return SdsPubKeyFromBech32(pubStr) +} + +// SdsPubKeyFromBech32 convert a SdsPublicKey to a Bech32 string. +func SdsPubKeyToBech32(pubkey cryptotypes.PubKey) (string, error) { + bech32PubPrefix := GetConfig().GetBech32SdsNodeP2PPubPrefix() + bech32Pub, err := bech32.ConvertAndEncode(bech32PubPrefix, pubkey.Bytes()) + if err != nil { + panic(err) + } + return bech32Pub, nil +} + // SdsAddressFromHex creates an SdsAddress from a hex string. func SdsAddressFromHex(address string) (addr SdsAddress, err error) { bz, err := addressBytesFromHexString(address) From 63e25dbc31b7e579d939db5ea33cc9ead85c0a46 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Fri, 10 Jun 2022 16:46:05 -0400 Subject: [PATCH 109/113] optimized iterations --- x/pot/keeper/distribute.go | 28 ++++++++-- x/pot/types/expected_keepers.go | 7 ++- x/register/client/cli/tx.go | 31 +---------- x/register/genesis.go | 8 +++ x/register/keeper/grpc_query.go | 24 +++++---- x/register/keeper/keeper.go | 74 ++++++++++++++++++++++---- x/register/keeper/node_state_change.go | 2 + x/register/keeper/querier.go | 24 +++++---- x/register/types/keys.go | 6 ++- 9 files changed, 133 insertions(+), 71 deletions(-) diff --git a/x/pot/keeper/distribute.go b/x/pot/keeper/distribute.go index eaf12983..5a64312b 100644 --- a/x/pot/keeper/distribute.go +++ b/x/pot/keeper/distribute.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stratosnet/stratos-chain/x/pot/types" regtypes "github.com/stratosnet/stratos-chain/x/register/types" ) @@ -135,7 +136,9 @@ func (k Keeper) deductRewardFromRewardProviderAccount(ctx sdk.Context, goal type // return types.ErrInsufficientUnissuedPrePayBalance //} //k.RegisterKeeper.SetTotalUnissuedPrepay(ctx, newTotalUnIssuedPrePay) - + if err != nil { + return err + } return nil } @@ -380,7 +383,11 @@ func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, totalConsumedUoz sdk. resourceNodeIterator := k.RegisterKeeper.GetResourceNodeIterator(ctx) defer resourceNodeIterator.Close() for ; resourceNodeIterator.Valid(); resourceNodeIterator.Next() { + node := regtypes.MustUnmarshalResourceNode(k.cdc, resourceNodeIterator.Value()) + if node.Status != stakingtypes.Bonded { + continue + } walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) if err != nil { @@ -466,9 +473,20 @@ func (k Keeper) CalcRewardForMetaNode(ctx sdk.Context, distributeGoalBalance typ totalUsedMetaRewardFromTrafficPool := sdk.NewCoin(k.BondDenom(ctx), sdk.ZeroInt()) totalStakeOfMetaNodes := k.RegisterKeeper.GetMetaNodeBondedToken(ctx).Amount - metaNodeList := k.RegisterKeeper.GetAllMetaNodes(ctx) - metaNodeCnt := sdk.NewInt(int64(len(metaNodeList))) - for _, node := range metaNodeList { + //metaNodeList := k.RegisterKeeper.GetAllMetaNodes(ctx)// bonded nodes + //metaNodeCnt := sdk.NewInt(int64(len(metaNodeList))) + + metaNodeCnt := k.RegisterKeeper.GetBondedMetaNodeCnt(ctx) + // 1, calc stake reward + mataNodeIterator := k.RegisterKeeper.GetMetaNodeIterator(ctx) + defer mataNodeIterator.Close() + + for ; mataNodeIterator.Valid(); mataNodeIterator.Next() { + node := regtypes.MustUnmarshalMetaNode(k.cdc, mataNodeIterator.Value()) + if node.Status != stakingtypes.Bonded { + continue + } + walletAddr, err := sdk.AccAddressFromBech32(node.OwnerAddress) if err != nil { continue @@ -478,7 +496,6 @@ func (k Keeper) CalcRewardForMetaNode(ctx sdk.Context, distributeGoalBalance typ continue } - // 1, calc stake reward shareOfToken := tokens.ToDec().Quo(totalStakeOfMetaNodes.ToDec()) stakeRewardFromMiningPool := sdk.NewCoin(k.RewardDenom(ctx), distributeGoalBalance.BlockChainRewardToMetaNodeFromMiningPool.Amount.ToDec().Mul(shareOfToken).TruncateInt()) @@ -507,6 +524,7 @@ func (k Keeper) CalcRewardForMetaNode(ctx sdk.Context, distributeGoalBalance typ newReward = newReward.AddRewardFromTrafficPool(stakeRewardFromTrafficPool.Add(metaRewardFromTrafficPool)) rewardDetailMap[walletAddr.String()] = newReward } + // deduct used reward from distributeGoal distributeGoalBalance.BlockChainRewardToMetaNodeFromMiningPool = distributeGoalBalance.BlockChainRewardToMetaNodeFromMiningPool.Sub(totalUsedStakeRewardFromMiningPool) diff --git a/x/pot/types/expected_keepers.go b/x/pot/types/expected_keepers.go index 5cf27a61..faf2761d 100644 --- a/x/pot/types/expected_keepers.go +++ b/x/pot/types/expected_keepers.go @@ -76,9 +76,14 @@ type RegisterKeeper interface { GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int) - GetAllMetaNodes(ctx sdk.Context) (metaNodes types.MetaNodes) + //GetAllMetaNodes(ctx sdk.Context) (metaNodes types.MetaNodes) //GetAllResourceNodes(ctx sdk.Context) (resourceNodes types.ResourceNodes) GetResourceNodeIterator(ctx sdk.Context) sdk.Iterator + GetMetaNodeIterator(ctx sdk.Context) sdk.Iterator + GetBondedMetaNodeCnt(ctx sdk.Context) sdk.Int + GetBondedResourceNodeCnt(ctx sdk.Context) sdk.Int + SetBondedResourceNodeCnt(ctx sdk.Context, delta sdk.Int) + SetBondedMetaNodeCnt(ctx sdk.Context, delta sdk.Int) } type StakingKeeper interface { diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index 32cd3004..3777b733 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -146,36 +146,7 @@ func RemoveResourceNodeCmd() *cobra.Command { } func RemoveMetaNodeCmd() *cobra.Command { - //cmd := &cobra.Command{ - // Use: "remove-meta-node [meta_node_address]", - // Args: cobra.ExactArgs(2), - // Short: "remove meta node", - // RunE: func(cmd *cobra.Command, args []string) error { - // clientCtx, err := client.GetClientTxContext(cmd) - // if err != nil { - // return err - // } - // - // metaNodeAddr, err := stratos.SdsAddressFromBech32(args[0]) - // if err != nil { - // return err - // } - // ownerAddr := clientCtx.GetFromAddress() - // //ownerAddr, err := sdk.AccAddressFromBech32(args[1]) - // //if err != nil { - // // return err - // //} - // - // msg := types.NewMsgRemoveMetaNode(metaNodeAddr, ownerAddr) - // - // return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - // }, - //} - //_ = cmd.MarkFlagRequired(flags.FlagFrom) - // - //flags.AddTxFlagsToCmd(cmd) - // - //return cmd + cmd := &cobra.Command{ Use: "remove-meta-node [flag]", //Args: cobra.ExactArgs(1), diff --git a/x/register/genesis.go b/x/register/genesis.go index 8cfd926e..ecb69e49 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -13,18 +13,26 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetParams(ctx, *data.Params) initialStakeTotal := sdk.ZeroInt() + lenOfGenesisBondedResourceNode := int64(0) for _, resourceNode := range data.GetResourceNodes() { if resourceNode.GetStatus() == stakingtypes.Bonded { + lenOfGenesisBondedResourceNode++ initialStakeTotal = initialStakeTotal.Add(resourceNode.Tokens) + } keeper.SetResourceNode(ctx, resourceNode) } + keeper.SetInitialGenesisBondedResourceNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedResourceNode)) + + lenOfGenesisBondedMetaNode := int64(0) for _, metaNode := range data.GetMetaNodes() { if metaNode.GetStatus() == stakingtypes.Bonded { + lenOfGenesisBondedResourceNode++ initialStakeTotal = initialStakeTotal.Add(metaNode.Tokens) } keeper.SetMetaNode(ctx, metaNode) } + keeper.SetInitialGenesisBondedMetaNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedMetaNode)) totalUnissuedPrepay := keeper.GetTotalUnissuedPrepay(ctx).Amount initialUOzonePrice := sdk.ZeroDec() diff --git a/x/register/keeper/grpc_query.go b/x/register/keeper/grpc_query.go index 8d433ba5..3e42d571 100644 --- a/x/register/keeper/grpc_query.go +++ b/x/register/keeper/grpc_query.go @@ -244,17 +244,19 @@ func (q Querier) StakeTotal(c context.Context, _ *types.QueryTotalStakeRequest) totalUnbondedStakeOfResourceNodes := q.GetResourceNodeNotBondedToken(ctx).Amount totalUnbondedStakeOfMetaNodes := q.GetMetaNodeNotBondedToken(ctx).Amount - resourceNodeList := q.GetAllResourceNodes(ctx) - totalStakeOfResourceNodes := sdk.ZeroInt() - for _, node := range resourceNodeList { - totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) - } - - metaNodeList := q.GetAllMetaNodes(ctx) - totalStakeOfMetaNodes := sdk.ZeroInt() - for _, node := range metaNodeList { - totalStakeOfMetaNodes = totalStakeOfMetaNodes.Add(node.Tokens) - } + //resourceNodeList := q.GetAllResourceNodes(ctx) + //totalStakeOfResourceNodes := sdk.ZeroInt() + //for _, node := range resourceNodeList { + // totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) + //} + totalStakeOfResourceNodes := totalBondedStakeOfResourceNodes.Add(totalUnbondedStakeOfResourceNodes) + + //metaNodeList := q.GetAllMetaNodes(ctx) + //totalStakeOfMetaNodes := sdk.ZeroInt() + //for _, node := range metaNodeList { + // totalStakeOfMetaNodes = totalStakeOfMetaNodes.Add(node.Tokens) + //} + totalStakeOfMetaNodes := totalBondedStakeOfMetaNodes.Add(totalUnbondedStakeOfMetaNodes) totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfMetaNodes) totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfMetaNodes) diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index 2424ed2b..a1ad8510 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -178,17 +178,17 @@ func (k Keeper) decreaseOzoneLimitBySubtractStake(ctx sdk.Context, stake sdk.Int return limitToSub.TruncateInt() } -// GetResourceNetworksIterator gets an iterator over all network addresses -func (k Keeper) GetResourceNetworksIterator(ctx sdk.Context) sdk.Iterator { - store := ctx.KVStore(k.storeKey) - return sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) -} - -// GetMetaNetworksIterator gets an iterator over all network addresses -func (k Keeper) GetMetaNetworksIterator(ctx sdk.Context) sdk.Iterator { - store := ctx.KVStore(k.storeKey) - return sdk.KVStorePrefixIterator(store, types.MetaNodeKey) -} +//// GetResourceNetworksIterator gets an iterator over all network addresses +//func (k Keeper) GetResourceNetworksIterator(ctx sdk.Context) sdk.Iterator { +// store := ctx.KVStore(k.storeKey) +// return sdk.KVStorePrefixIterator(store, types.ResourceNodeKey) +//} +// +//// GetMetaNetworksIterator gets an iterator over all network addresses +//func (k Keeper) GetMetaNetworksIterator(ctx sdk.Context) sdk.Iterator { +// store := ctx.KVStore(k.storeKey) +// return sdk.KVStorePrefixIterator(store, types.MetaNodeKey) +//} //func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte) { // var networkList []stratos.SdsAddress @@ -632,3 +632,55 @@ func (k Keeper) UozSupply(ctx sdk.Context) (remaining, total sdk.Int) { total = (Pt.ToDec().Quo(S.ToDec()).TruncateInt().Add(sdk.NewInt(1))).Mul(remaining) return remaining, total } + +func (k Keeper) SetInitialGenesisBondedResourceNodeCnt(ctx sdk.Context, count sdk.Int) { + store := ctx.KVStore(k.storeKey) + b := types.ModuleCdc.MustMarshalLengthPrefixed(count) + store.Set(types.ResourceNodeCntKey, b) +} + +func (k Keeper) SetInitialGenesisBondedMetaNodeCnt(ctx sdk.Context, count sdk.Int) { + store := ctx.KVStore(k.storeKey) + b := types.ModuleCdc.MustMarshalLengthPrefixed(count) + store.Set(types.MetaNodeCntKey, b) +} + +func (k Keeper) SetBondedResourceNodeCnt(ctx sdk.Context, delta sdk.Int) { + store := ctx.KVStore(k.storeKey) + oldValue := store.Get(types.ResourceNodeCntKey) + var balance sdk.Int + types.ModuleCdc.MustUnmarshalLengthPrefixed(oldValue, &balance) + b := types.ModuleCdc.MustMarshalLengthPrefixed(balance.Add(delta)) + store.Set(types.ResourceNodeCntKey, b) +} + +func (k Keeper) SetBondedMetaNodeCnt(ctx sdk.Context, delta sdk.Int) { + store := ctx.KVStore(k.storeKey) + oldValue := store.Get(types.MetaNodeKey) + var balance sdk.Int + types.ModuleCdc.MustUnmarshalLengthPrefixed(oldValue, &balance) + b := types.ModuleCdc.MustMarshalLengthPrefixed(balance.Add(delta)) + store.Set(types.MetaNodeCntKey, b) +} + +func (k Keeper) GetBondedResourceNodeCnt(ctx sdk.Context) sdk.Int { + store := ctx.KVStore(k.storeKey) + value := store.Get(types.ResourceNodeCntKey) + if value == nil { + return sdk.ZeroInt() + } + var balance sdk.Int + types.ModuleCdc.MustUnmarshalLengthPrefixed(value, &balance) + return balance +} + +func (k Keeper) GetBondedMetaNodeCnt(ctx sdk.Context) sdk.Int { + store := ctx.KVStore(k.storeKey) + value := store.Get(types.MetaNodeCntKey) + if value == nil { + return sdk.ZeroInt() + } + var balance sdk.Int + types.ModuleCdc.MustUnmarshalLengthPrefixed(value, &balance) + return balance +} diff --git a/x/register/keeper/node_state_change.go b/x/register/keeper/node_state_change.go index 68c3f1d3..97e8bd7d 100644 --- a/x/register/keeper/node_state_change.go +++ b/x/register/keeper/node_state_change.go @@ -53,12 +53,14 @@ func (k Keeper) bondedToUnbonding(ctx sdk.Context, node interface{}, isMetaNode if temp.GetStatus() != stakingtypes.Bonded { panic(fmt.Sprintf("bad state transition bondedToUnbonding, metaNode: %v\n", temp)) } + k.SetBondedMetaNodeCnt(ctx, sdk.NewInt(-1)) return k.beginUnbondingMetaNode(ctx, &temp, &coin) default: temp := node.(types.ResourceNode) if temp.GetStatus() != stakingtypes.Bonded { panic(fmt.Sprintf("bad state transition bondedToUnbonding, resourceNode: %v\n", temp)) } + k.SetBondedResourceNodeCnt(ctx, sdk.NewInt(-1)) return k.beginUnbondingResourceNode(ctx, &temp, &coin) } } diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index 68882eae..d85b9cb4 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -123,17 +123,19 @@ func getNodesStakingInfo(ctx sdk.Context, _ abci.RequestQuery, k Keeper, legacyQ totalUnbondedStakeOfResourceNodes := k.GetResourceNodeNotBondedToken(ctx).Amount totalUnbondedStakeOfMetaNodes := k.GetMetaNodeNotBondedToken(ctx).Amount - resourceNodeList := k.GetAllResourceNodes(ctx) - totalStakeOfResourceNodes := sdk.ZeroInt() - for _, node := range resourceNodeList { - totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) - } - - metaNodeList := k.GetAllMetaNodes(ctx) - totalStakeOfMetaNodes := sdk.ZeroInt() - for _, node := range metaNodeList { - totalStakeOfMetaNodes = totalStakeOfMetaNodes.Add(node.Tokens) - } + //resourceNodeList := k.GetAllResourceNodes(ctx) + //totalStakeOfResourceNodes := sdk.ZeroInt() + //for _, node := range resourceNodeList { + // totalStakeOfResourceNodes = totalStakeOfResourceNodes.Add(node.Tokens) + //} + totalStakeOfResourceNodes := totalBondedStakeOfResourceNodes.Add(totalUnbondedStakeOfResourceNodes) + + //metaNodeList := k.GetAllMetaNodes(ctx) + //totalStakeOfMetaNodes := sdk.ZeroInt() + //for _, node := range metaNodeList { + // totalStakeOfMetaNodes = totalStakeOfMetaNodes.Add(node.Tokens) + //} + totalStakeOfMetaNodes := totalBondedStakeOfMetaNodes.Add(totalUnbondedStakeOfMetaNodes) totalBondedStake := totalBondedStakeOfResourceNodes.Add(totalBondedStakeOfMetaNodes) totalUnbondedStake := totalUnbondedStakeOfResourceNodes.Add(totalUnbondedStakeOfMetaNodes) diff --git a/x/register/types/keys.go b/x/register/types/keys.go index 6d22b7c9..f7409fdc 100644 --- a/x/register/types/keys.go +++ b/x/register/types/keys.go @@ -41,8 +41,10 @@ var ( InitialGenesisStakeTotalKey = []byte{0x06} // key of initial genesis deposit by all resource nodes and meta nodes at t=0 InitialUOzonePriceKey = []byte{0x07} // key of initial uoz price at t=0 - UBDNodeKey = []byte{0x11} // prefix for each key to an unbonding node - UBDNodeQueueKey = []byte{0x12} // prefix for the timestamps in unbonding node queue + UBDNodeKey = []byte{0x11} // prefix for each key to an unbonding node + UBDNodeQueueKey = []byte{0x12} // prefix for the timestamps in unbonding node queue + MetaNodeCntKey = []byte{0x13} // the number of all meta nodes + ResourceNodeCntKey = []byte{0x14} // the number of all resource nodes ) // GetResourceNodeKey gets the key for the resourceNode with address From 13ec3d573a65cac1745fb59435fbaa7aafc91ef9 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Sat, 11 Jun 2022 00:21:21 -0400 Subject: [PATCH 110/113] added resourceNodeCnt and metaNodeCnt --- x/register/genesis.go | 3 +++ x/register/keeper/keeper.go | 6 ++++++ x/register/keeper/meta_node.go | 9 ++++++++- x/register/keeper/resource_node.go | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/x/register/genesis.go b/x/register/genesis.go index ecb69e49..bbab11a3 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -22,6 +22,8 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } keeper.SetResourceNode(ctx, resourceNode) } + + // set initial genesis number of resource nodes keeper.SetInitialGenesisBondedResourceNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedResourceNode)) lenOfGenesisBondedMetaNode := int64(0) @@ -32,6 +34,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } keeper.SetMetaNode(ctx, metaNode) } + // set initial genesis number of meta nodes keeper.SetInitialGenesisBondedMetaNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedMetaNode)) totalUnissuedPrepay := keeper.GetTotalUnissuedPrepay(ctx).Amount diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index a1ad8510..df82ffb3 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -503,7 +503,11 @@ func (k Keeper) UnbondResourceNode( // change node status to unbonding if unbonding all tokens if amt.Equal(resourceNode.Tokens) { resourceNode.Status = stakingtypes.Unbonding + k.SetResourceNode(ctx, resourceNode) + + // decrease resource node count + k.SetBondedResourceNodeCnt(ctx, sdk.NewInt(-1)) } // set the unbonding mature time and completion height appropriately @@ -553,6 +557,8 @@ func (k Keeper) UnbondMetaNode( // change node status to unbonding if unbonding all tokens if amt.Equal(metaNode.Tokens) { metaNode.Status = stakingtypes.Unbonding + // decrease meta node count + k.SetBondedMetaNodeCnt(ctx, sdk.NewInt(-1)) k.SetMetaNode(ctx, metaNode) } diff --git a/x/register/keeper/meta_node.go b/x/register/keeper/meta_node.go index b7a72a32..ac203526 100644 --- a/x/register/keeper/meta_node.go +++ b/x/register/keeper/meta_node.go @@ -352,7 +352,8 @@ func (k Keeper) HandleVoteForMetaNodeRegistration(ctx sdk.Context, nodeAddr stra node.Status = stakingtypes.Bonded node.Suspend = false k.SetMetaNode(ctx, node) - + // increase mata node count + k.SetBondedMetaNodeCnt(ctx, sdk.NewInt(1)) // move stake from not bonded pool to bonded pool tokenToBond := sdk.NewCoin(k.BondDenom(ctx), node.Tokens) @@ -482,3 +483,9 @@ func (k Keeper) GetMetaNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin) { } return k.bankKeeper.GetBalance(ctx, metaNodeNotBondedAccAddr, k.BondDenom(ctx)) } + +func (k Keeper) GetMetaNodeIterator(ctx sdk.Context) sdk.Iterator { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.MetaNodeKey) + return iterator +} diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index 7a6939ef..f348b4c0 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -167,6 +167,8 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc } k.SetResourceNode(ctx, resourceNode) + // increase resource node count + k.SetBondedResourceNodeCnt(ctx, sdk.NewInt(1)) ozoneLimitChange = k.increaseOzoneLimitByAddStake(ctx, tokenToAdd.Amount) return ozoneLimitChange, nil From 4e1abe84b2fa0db35c7131f3fe97ddabea1dcb8f Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 13 Jun 2022 20:16:22 -0400 Subject: [PATCH 111/113] finished grpc_query for pot module --- proto/stratos/pot/v1/pot.proto | 2 + proto/stratos/pot/v1/query.proto | 74 ++ x/pot/keeper/grpc_query.go | 342 ++++++ x/pot/types/querier.go | 16 +- x/pot/types/query.pb.go | 1913 ++++++++++++++++++++++++++++-- x/pot/types/query.pb.gw.go | 312 +++++ x/register/keeper/querier.go | 6 +- 7 files changed, 2551 insertions(+), 114 deletions(-) diff --git a/proto/stratos/pot/v1/pot.proto b/proto/stratos/pot/v1/pot.proto index d229d86f..d5ced2ae 100644 --- a/proto/stratos/pot/v1/pot.proto +++ b/proto/stratos/pot/v1/pot.proto @@ -126,3 +126,5 @@ message BLSSignatureInfo { + + diff --git a/proto/stratos/pot/v1/query.proto b/proto/stratos/pot/v1/query.proto index 7bdc51eb..f274a317 100644 --- a/proto/stratos/pot/v1/query.proto +++ b/proto/stratos/pot/v1/query.proto @@ -3,6 +3,10 @@ package stratos.pot.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +import "stratos/pot/v1/pot.proto"; option go_package = "github.com/stratosnet/stratos-chain/x/pot/types"; @@ -12,6 +16,21 @@ service Query { rpc VolumeReport(QueryVolumeReportRequest) returns (QueryVolumeReportResponse) { option (google.api.http).get = "/stratos/pot/v1/volume-report/{epoch}"; } + + // PotRewardsByEpoch queries Pot rewards by a given epoch. + rpc PotRewardsByEpoch(QueryPotRewardsByEpochRequest) returns (QueryPotRewardsByEpochResponse) { + option (google.api.http).get = "/stratos/pot/v1/rewards/epoch/{epoch}"; + } + + // PotRewardsByOwner queries Pot rewards by a given owner wallet address. + rpc PotRewardsByOwner(QueryPotRewardsByOwnerRequest) returns (QueryPotRewardsByOwnerResponse) { + option (google.api.http).get = "/stratos/pot/v1/rewards/wallet/{wallet_address}"; + } + + // PotSlashingByOwner queries Pot Pot slashingBy by owner wallet address. + rpc PotSlashingByOwner(QueryPotSlashingByOwnerRequest) returns (QueryPotSlashingByOwnerResponse) { + option (google.api.http).get = "/stratos/pot/v1/slashing/{wallet_address}"; + } } // QueryVolumeReportRequest is request type for the Query/VolumeReport RPC method @@ -37,3 +56,58 @@ message QueryVolumeReportResponse { +// QueryPotRewardsByEpochRequest is request type for the Query/PotRewardsByEpoch by a given epoch RPC method +message QueryPotRewardsByEpochRequest { + string epoch = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryVolumeReportResponse is response type for the Query/PotRewardsByEpoch RPC method +message QueryPotRewardsByEpochResponse { + repeated Reward rewards = 1; + int64 height = 2; + cosmos.base.query.v1beta1.PageResponse pagination = 3; +} + +message PotRewardByOwner { + string wallet_address = 1; + repeated cosmos.base.v1beta1.Coin MatureTotalReward = 2 + [(gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + repeated cosmos.base.v1beta1.Coin ImmatureTotalReward = 3 +[(gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + + +// QueryPotRewardsByOwnerRequest is request type for the Query/PotRewardsByOwner by a given owner RPC method +message QueryPotRewardsByOwnerRequest { + string wallet_address = 1; +} + +// QueryPotRewardsByOwnerResponse is response type for the Query/PotRewardsByOwner RPC method +message QueryPotRewardsByOwnerResponse { + PotRewardByOwner rewards = 1; + int64 height = 2; +} + + + + + +// QueryPotSlashingByOwnerRequest is request type for the Query/Slashing by a given owner RPC method +message QueryPotSlashingByOwnerRequest { + string wallet_address = 1; +} + +// QueryPotSlashingByOwnerResponse is response type for the Query/Slashing RPC method +message QueryPotSlashingByOwnerResponse { + string slashing = 1; + int64 height = 2; +} + + + + + diff --git a/x/pot/keeper/grpc_query.go b/x/pot/keeper/grpc_query.go index 6a4a4c23..77d81835 100644 --- a/x/pot/keeper/grpc_query.go +++ b/x/pot/keeper/grpc_query.go @@ -2,10 +2,19 @@ package keeper import ( "context" + "fmt" "strconv" + //"github.com/cosmos/cosmos-sdk/client" + //"github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + pagiquery "github.com/cosmos/cosmos-sdk/types/query" "github.com/stratosnet/stratos-chain/x/pot/types" + registerkeeper "github.com/stratosnet/stratos-chain/x/register/keeper" + registertypes "github.com/stratosnet/stratos-chain/x/register/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -47,3 +56,336 @@ func (q Querier) VolumeReport(c context.Context, req *types.QueryVolumeReportReq Height: height, }, nil } + +func (q Querier) PotRewardsByEpoch(c context.Context, req *types.QueryPotRewardsByEpochRequest) (*types.QueryPotRewardsByEpochResponse, error) { + if req == nil { + return &types.QueryPotRewardsByEpochResponse{}, status.Errorf(codes.InvalidArgument, "empty request") + } + + queryEpochStr := req.GetEpoch() + + if queryEpochStr == "" { + return &types.QueryPotRewardsByEpochResponse{}, status.Error(codes.InvalidArgument, "epoch cannot be empty") + } + ctx := sdk.UnwrapSDKContext(c) + + queryEpochInt64, err := strconv.ParseInt(queryEpochStr, 10, 64) + if err != nil { + return nil, err + } + queryEpoch := sdk.NewInt(queryEpochInt64) + matureEpoch := queryEpoch.Add(sdk.NewInt(q.MatureEpoch(ctx))) + var res []*types.Reward + + store := ctx.KVStore(q.storeKey) + RewardStore := prefix.NewStore(store, types.GetIndividualRewardIteratorKey(matureEpoch)) + + //if req.Pagination.Limit == 0 { + // req.Pagination.Limit = registertypes.QueryDefaultLimit + // + // // count total results when the limit is zero/not supplied + // req.Pagination.CountTotal = true + //} + + rewardsPageRes, err := FilteredPaginate(q.cdc, RewardStore, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { + val, err := UnmarshalIndividualReward(q.cdc, value) + if err != nil { + return true, err + } + + if accumulate { + res = append(res, &val) + } + + return true, nil + }) + if err != nil { + return &types.QueryPotRewardsByEpochResponse{}, status.Error(codes.Internal, err.Error()) + } + + // height := ctx.BlockHeight() + // return &types.QueryPotRewardsByEpochResponse{Rewards: res, Height: height}, nil + // q.IteratorIndividualReward(ctx, matureEpoch, func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { + // if !((individualReward.RewardFromMiningPool.Empty() || individualReward.RewardFromMiningPool.IsZero()) && + // (individualReward.RewardFromTrafficPool.Empty() || individualReward.RewardFromTrafficPool.IsZero())) { + // res = append(res, &individualReward) + // } + // return false + // }) + // + // offset := req.Pagination.Offset + // page := 1 + // if offset != 0 { + // page = + // } + // start, end := client.Paginate(len(res), params.Page, params.Limit, QueryDefaultLimit) + // if start < 0 || end < 0 { + // return &types.QueryPotRewardsByEpochResponse{}, nil + // } else { + // res = res[start:end] + // } + height := ctx.BlockHeight() + return &types.QueryPotRewardsByEpochResponse{Rewards: res, Height: height, Pagination: rewardsPageRes}, nil + //} +} + +func UnmarshalIndividualReward(cdc codec.BinaryCodec, value []byte) (v types.Reward, err error) { + err = cdc.Unmarshal(value, &v) + return v, err +} + +func FilteredPaginate(cdc codec.Codec, + prefixStore storetypes.KVStore, + pageRequest *pagiquery.PageRequest, + onResult func(key []byte, value []byte, accumulate bool) (bool, error), +) (*pagiquery.PageResponse, error) { + + // if the PageRequest is nil, use default PageRequest + if pageRequest == nil { + pageRequest = &pagiquery.PageRequest{} + } + + offset := pageRequest.Offset + key := pageRequest.Key + limit := pageRequest.Limit + countTotal := pageRequest.CountTotal + reverse := pageRequest.Reverse + + if offset > 0 && key != nil { + return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") + } + + if limit == 0 { + limit = registertypes.QueryDefaultLimit + + // count total results when the limit is zero/not supplied + countTotal = pageRequest.CountTotal + } + + if len(key) != 0 { + iterator := registerkeeper.GetIterator(prefixStore, key, reverse) + defer iterator.Close() + + var numHits uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + if numHits == limit { + nextKey = iterator.Key() + break + } + + if iterator.Error() != nil { + return nil, iterator.Error() + } + reward, err := UnmarshalIndividualReward(cdc, iterator.Value()) + if err != nil { + continue + } + if (reward.RewardFromMiningPool.Empty() || reward.RewardFromMiningPool.IsZero()) && + (reward.RewardFromTrafficPool.Empty() || reward.RewardFromTrafficPool.IsZero()) { + continue + } + + hit, err := onResult(iterator.Key(), iterator.Value(), true) + if err != nil { + return nil, err + } + + if hit { + numHits++ + } + } + + return &pagiquery.PageResponse{ + NextKey: nextKey, + }, nil + } + + iterator := registerkeeper.GetIterator(prefixStore, nil, reverse) + defer iterator.Close() + + end := offset + limit + + var numHits uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + if iterator.Error() != nil { + return nil, iterator.Error() + } + + reward, err := UnmarshalIndividualReward(cdc, iterator.Value()) + if err != nil { + continue + } + if (reward.RewardFromMiningPool.Empty() || reward.RewardFromMiningPool.IsZero()) && + (reward.RewardFromTrafficPool.Empty() || reward.RewardFromTrafficPool.IsZero()) { + continue + } + accumulate := numHits >= offset && numHits < end + hit, err := onResult(iterator.Key(), iterator.Value(), accumulate) + if err != nil { + return nil, err + } + + if hit { + numHits++ + } + + if numHits == end+1 { + nextKey = iterator.Key() + + if !countTotal { + break + } + } + } + + res := &pagiquery.PageResponse{NextKey: nextKey} + if countTotal { + res.Total = numHits + } + + return res, nil +} + +func (q Querier) PotRewardsByOwner(c context.Context, req *types.QueryPotRewardsByOwnerRequest) (*types.QueryPotRewardsByOwnerResponse, error) { + if req == nil { + return &types.QueryPotRewardsByOwnerResponse{}, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.GetWalletAddress() == "" { + return &types.QueryPotRewardsByOwnerResponse{}, status.Error(codes.InvalidArgument, "wallet address cannot be empty") + } + ctx := sdk.UnwrapSDKContext(c) + height := ctx.BlockHeight() + + walletAddr, err := sdk.AccAddressFromBech32(req.GetWalletAddress()) + if err != nil { + return &types.QueryPotRewardsByOwnerResponse{}, err + } + + immatureTotalReward := q.GetImmatureTotalReward(ctx, walletAddr) + matureTotalReward := q.GetMatureTotalReward(ctx, walletAddr) + reward := types.NewPotRewardInfo(walletAddr, matureTotalReward, immatureTotalReward) + return &types.QueryPotRewardsByOwnerResponse{Rewards: &reward, Height: height}, nil + +} + +func (q Querier) PotSlashingByOwner(c context.Context, req *types.QueryPotSlashingByOwnerRequest) (*types.QueryPotSlashingByOwnerResponse, error) { + if req == nil { + return &types.QueryPotSlashingByOwnerResponse{}, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.GetWalletAddress() == "" { + return &types.QueryPotSlashingByOwnerResponse{}, status.Error(codes.InvalidArgument, "wallet address cannot be empty") + } + ctx := sdk.UnwrapSDKContext(c) + height := ctx.BlockHeight() + + walletAddr, err := sdk.AccAddressFromBech32(req.GetWalletAddress()) + if err != nil { + return &types.QueryPotSlashingByOwnerResponse{}, err + } + + slashing := q.RegisterKeeper.GetSlashing(ctx, walletAddr).String() + return &types.QueryPotSlashingByOwnerResponse{Slashing: slashing, Height: height}, nil + +} + +func Paginate( + prefixStore storetypes.KVStore, + pageRequest *pagiquery.PageRequest, + onResult func(key []byte, value []byte) error, +) (*pagiquery.PageResponse, error) { + + // if the PageRequest is nil, use default PageRequest + if pageRequest == nil { + pageRequest = &pagiquery.PageRequest{} + } + + offset := pageRequest.Offset + key := pageRequest.Key + limit := pageRequest.Limit + countTotal := pageRequest.CountTotal + reverse := pageRequest.Reverse + + if offset > 0 && key != nil { + return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") + } + + if limit == 0 { + limit = QueryDefaultLimit + + // count total results when the limit is zero/not supplied + countTotal = true + } + + if len(key) != 0 { + iterator := registerkeeper.GetIterator(prefixStore, key, reverse) + defer iterator.Close() + + var count uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + + if count == limit { + nextKey = iterator.Key() + break + } + if iterator.Error() != nil { + return nil, iterator.Error() + } + err := onResult(iterator.Key(), iterator.Value()) + if err != nil { + return nil, err + } + + count++ + } + + return &pagiquery.PageResponse{ + NextKey: nextKey, + }, nil + } + + iterator := registerkeeper.GetIterator(prefixStore, nil, reverse) + defer iterator.Close() + + end := offset + limit + + var count uint64 + var nextKey []byte + + for ; iterator.Valid(); iterator.Next() { + count++ + + if count <= offset { + continue + } + if count <= end { + err := onResult(iterator.Key(), iterator.Value()) + if err != nil { + return nil, err + } + } else if count == end+1 { + nextKey = iterator.Key() + + if !countTotal { + break + } + } + if iterator.Error() != nil { + return nil, iterator.Error() + } + } + + res := &pagiquery.PageResponse{NextKey: nextKey} + if countTotal { + res.Total = count + } + + return res, nil +} diff --git a/x/pot/types/querier.go b/x/pot/types/querier.go index 20c7faa1..ca5fb36f 100644 --- a/x/pot/types/querier.go +++ b/x/pot/types/querier.go @@ -10,20 +10,20 @@ const ( QueryVolumeReportHash = "volume_report" ) -type PotRewardInfo struct { - WalletAddress sdk.AccAddress - MatureTotalReward sdk.Coins - ImmatureTotalReward sdk.Coins -} +//type PotRewardInfo struct { +// WalletAddress sdk.AccAddress +// MatureTotalReward sdk.Coins +// ImmatureTotalReward sdk.Coins +//} // NewPotRewardInfo creates a new instance of PotRewardInfo func NewPotRewardInfo( walletAddress sdk.AccAddress, matureTotal sdk.Coins, immatureTotal sdk.Coins, -) PotRewardInfo { - return PotRewardInfo{ - WalletAddress: walletAddress, +) PotRewardByOwner { + return PotRewardByOwner{ + WalletAddress: walletAddress.String(), MatureTotalReward: matureTotal, ImmatureTotalReward: immatureTotal, } diff --git a/x/pot/types/query.pb.go b/x/pot/types/query.pb.go index 88460967..f8075318 100644 --- a/x/pot/types/query.pb.go +++ b/x/pot/types/query.pb.go @@ -6,6 +6,9 @@ package types import ( context "context" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -181,38 +184,440 @@ func (m *QueryVolumeReportResponse) GetHeight() int64 { return 0 } +// QueryPotRewardsByEpochRequest is request type for the Query/PotRewardsByEpoch by a given epoch RPC method +type QueryPotRewardsByEpochRequest struct { + Epoch string `protobuf:"bytes,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPotRewardsByEpochRequest) Reset() { *m = QueryPotRewardsByEpochRequest{} } +func (m *QueryPotRewardsByEpochRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPotRewardsByEpochRequest) ProtoMessage() {} +func (*QueryPotRewardsByEpochRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{3} +} +func (m *QueryPotRewardsByEpochRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPotRewardsByEpochRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPotRewardsByEpochRequest.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 *QueryPotRewardsByEpochRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPotRewardsByEpochRequest.Merge(m, src) +} +func (m *QueryPotRewardsByEpochRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPotRewardsByEpochRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPotRewardsByEpochRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPotRewardsByEpochRequest proto.InternalMessageInfo + +func (m *QueryPotRewardsByEpochRequest) GetEpoch() string { + if m != nil { + return m.Epoch + } + return "" +} + +func (m *QueryPotRewardsByEpochRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryVolumeReportResponse is response type for the Query/PotRewardsByEpoch RPC method +type QueryPotRewardsByEpochResponse struct { + Rewards []*Reward `protobuf:"bytes,1,rep,name=rewards,proto3" json:"rewards,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPotRewardsByEpochResponse) Reset() { *m = QueryPotRewardsByEpochResponse{} } +func (m *QueryPotRewardsByEpochResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPotRewardsByEpochResponse) ProtoMessage() {} +func (*QueryPotRewardsByEpochResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{4} +} +func (m *QueryPotRewardsByEpochResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPotRewardsByEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPotRewardsByEpochResponse.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 *QueryPotRewardsByEpochResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPotRewardsByEpochResponse.Merge(m, src) +} +func (m *QueryPotRewardsByEpochResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPotRewardsByEpochResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPotRewardsByEpochResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPotRewardsByEpochResponse proto.InternalMessageInfo + +func (m *QueryPotRewardsByEpochResponse) GetRewards() []*Reward { + if m != nil { + return m.Rewards + } + return nil +} + +func (m *QueryPotRewardsByEpochResponse) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *QueryPotRewardsByEpochResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type PotRewardByOwner struct { + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address,omitempty"` + MatureTotalReward github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=MatureTotalReward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"MatureTotalReward"` + ImmatureTotalReward github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=ImmatureTotalReward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"ImmatureTotalReward"` +} + +func (m *PotRewardByOwner) Reset() { *m = PotRewardByOwner{} } +func (m *PotRewardByOwner) String() string { return proto.CompactTextString(m) } +func (*PotRewardByOwner) ProtoMessage() {} +func (*PotRewardByOwner) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{5} +} +func (m *PotRewardByOwner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PotRewardByOwner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PotRewardByOwner.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 *PotRewardByOwner) XXX_Merge(src proto.Message) { + xxx_messageInfo_PotRewardByOwner.Merge(m, src) +} +func (m *PotRewardByOwner) XXX_Size() int { + return m.Size() +} +func (m *PotRewardByOwner) XXX_DiscardUnknown() { + xxx_messageInfo_PotRewardByOwner.DiscardUnknown(m) +} + +var xxx_messageInfo_PotRewardByOwner proto.InternalMessageInfo + +func (m *PotRewardByOwner) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +func (m *PotRewardByOwner) GetMatureTotalReward() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.MatureTotalReward + } + return nil +} + +func (m *PotRewardByOwner) GetImmatureTotalReward() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.ImmatureTotalReward + } + return nil +} + +// QueryPotRewardsByOwnerRequest is request type for the Query/PotRewardsByOwner by a given owner RPC method +type QueryPotRewardsByOwnerRequest struct { + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address,omitempty"` +} + +func (m *QueryPotRewardsByOwnerRequest) Reset() { *m = QueryPotRewardsByOwnerRequest{} } +func (m *QueryPotRewardsByOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPotRewardsByOwnerRequest) ProtoMessage() {} +func (*QueryPotRewardsByOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{6} +} +func (m *QueryPotRewardsByOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPotRewardsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPotRewardsByOwnerRequest.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 *QueryPotRewardsByOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPotRewardsByOwnerRequest.Merge(m, src) +} +func (m *QueryPotRewardsByOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPotRewardsByOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPotRewardsByOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPotRewardsByOwnerRequest proto.InternalMessageInfo + +func (m *QueryPotRewardsByOwnerRequest) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +// QueryPotRewardsByOwnerResponse is response type for the Query/PotRewardsByOwner RPC method +type QueryPotRewardsByOwnerResponse struct { + Rewards *PotRewardByOwner `protobuf:"bytes,1,opt,name=rewards,proto3" json:"rewards,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryPotRewardsByOwnerResponse) Reset() { *m = QueryPotRewardsByOwnerResponse{} } +func (m *QueryPotRewardsByOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPotRewardsByOwnerResponse) ProtoMessage() {} +func (*QueryPotRewardsByOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{7} +} +func (m *QueryPotRewardsByOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPotRewardsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPotRewardsByOwnerResponse.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 *QueryPotRewardsByOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPotRewardsByOwnerResponse.Merge(m, src) +} +func (m *QueryPotRewardsByOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPotRewardsByOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPotRewardsByOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPotRewardsByOwnerResponse proto.InternalMessageInfo + +func (m *QueryPotRewardsByOwnerResponse) GetRewards() *PotRewardByOwner { + if m != nil { + return m.Rewards + } + return nil +} + +func (m *QueryPotRewardsByOwnerResponse) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +// QueryPotSlashingByOwnerRequest is request type for the Query/Slashing by a given owner RPC method +type QueryPotSlashingByOwnerRequest struct { + WalletAddress string `protobuf:"bytes,1,opt,name=wallet_address,json=walletAddress,proto3" json:"wallet_address,omitempty"` +} + +func (m *QueryPotSlashingByOwnerRequest) Reset() { *m = QueryPotSlashingByOwnerRequest{} } +func (m *QueryPotSlashingByOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPotSlashingByOwnerRequest) ProtoMessage() {} +func (*QueryPotSlashingByOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{8} +} +func (m *QueryPotSlashingByOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPotSlashingByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPotSlashingByOwnerRequest.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 *QueryPotSlashingByOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPotSlashingByOwnerRequest.Merge(m, src) +} +func (m *QueryPotSlashingByOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPotSlashingByOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPotSlashingByOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPotSlashingByOwnerRequest proto.InternalMessageInfo + +func (m *QueryPotSlashingByOwnerRequest) GetWalletAddress() string { + if m != nil { + return m.WalletAddress + } + return "" +} + +// QueryPotSlashingByOwnerResponse is response type for the Query/Slashing RPC method +type QueryPotSlashingByOwnerResponse struct { + Slashing string `protobuf:"bytes,1,opt,name=slashing,proto3" json:"slashing,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryPotSlashingByOwnerResponse) Reset() { *m = QueryPotSlashingByOwnerResponse{} } +func (m *QueryPotSlashingByOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPotSlashingByOwnerResponse) ProtoMessage() {} +func (*QueryPotSlashingByOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c09bd09df76a68e0, []int{9} +} +func (m *QueryPotSlashingByOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPotSlashingByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPotSlashingByOwnerResponse.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 *QueryPotSlashingByOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPotSlashingByOwnerResponse.Merge(m, src) +} +func (m *QueryPotSlashingByOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPotSlashingByOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPotSlashingByOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPotSlashingByOwnerResponse proto.InternalMessageInfo + +func (m *QueryPotSlashingByOwnerResponse) GetSlashing() string { + if m != nil { + return m.Slashing + } + return "" +} + +func (m *QueryPotSlashingByOwnerResponse) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + func init() { proto.RegisterType((*QueryVolumeReportRequest)(nil), "stratos.pot.v1.QueryVolumeReportRequest") proto.RegisterType((*ReportInfo)(nil), "stratos.pot.v1.ReportInfo") proto.RegisterType((*QueryVolumeReportResponse)(nil), "stratos.pot.v1.QueryVolumeReportResponse") + proto.RegisterType((*QueryPotRewardsByEpochRequest)(nil), "stratos.pot.v1.QueryPotRewardsByEpochRequest") + proto.RegisterType((*QueryPotRewardsByEpochResponse)(nil), "stratos.pot.v1.QueryPotRewardsByEpochResponse") + proto.RegisterType((*PotRewardByOwner)(nil), "stratos.pot.v1.PotRewardByOwner") + proto.RegisterType((*QueryPotRewardsByOwnerRequest)(nil), "stratos.pot.v1.QueryPotRewardsByOwnerRequest") + proto.RegisterType((*QueryPotRewardsByOwnerResponse)(nil), "stratos.pot.v1.QueryPotRewardsByOwnerResponse") + proto.RegisterType((*QueryPotSlashingByOwnerRequest)(nil), "stratos.pot.v1.QueryPotSlashingByOwnerRequest") + proto.RegisterType((*QueryPotSlashingByOwnerResponse)(nil), "stratos.pot.v1.QueryPotSlashingByOwnerResponse") } func init() { proto.RegisterFile("stratos/pot/v1/query.proto", fileDescriptor_c09bd09df76a68e0) } var fileDescriptor_c09bd09df76a68e0 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xb1, 0x4a, 0x03, 0x41, - 0x10, 0xcd, 0x46, 0x12, 0xc8, 0x46, 0x2c, 0x96, 0x20, 0xf1, 0x08, 0x87, 0x1c, 0x88, 0xb1, 0xc8, - 0xad, 0x89, 0xa5, 0x8d, 0xd8, 0xa5, 0xf4, 0x0a, 0x0b, 0x1b, 0xb9, 0x1c, 0x93, 0xbb, 0x83, 0x64, - 0x67, 0xb3, 0xbb, 0x17, 0x0c, 0x62, 0xe3, 0x17, 0x88, 0xb6, 0x7e, 0x90, 0x65, 0xc0, 0xc6, 0x52, - 0x12, 0x3f, 0x44, 0xb2, 0x97, 0x10, 0x0d, 0x11, 0xec, 0x66, 0xe6, 0x3d, 0xde, 0x7b, 0x33, 0x43, - 0x1d, 0x6d, 0x54, 0x68, 0x50, 0x73, 0x89, 0x86, 0x8f, 0xdb, 0x7c, 0x94, 0x81, 0x9a, 0xf8, 0x52, - 0xa1, 0x41, 0xb6, 0xb7, 0xc4, 0x7c, 0x89, 0xc6, 0x1f, 0xb7, 0x9d, 0x5a, 0x8c, 0x31, 0x5a, 0x88, - 0x2f, 0xaa, 0x9c, 0xe5, 0x34, 0x62, 0xc4, 0x78, 0x00, 0x3c, 0x94, 0x29, 0x0f, 0x85, 0x40, 0x13, - 0x9a, 0x14, 0x85, 0xce, 0x51, 0xef, 0x94, 0xd6, 0xaf, 0x16, 0x92, 0xd7, 0x38, 0xc8, 0x86, 0x10, - 0x80, 0x44, 0x65, 0x02, 0x18, 0x65, 0xa0, 0x0d, 0xab, 0xd1, 0x12, 0x48, 0x8c, 0x92, 0x3a, 0x39, - 0x24, 0xcd, 0x4a, 0x90, 0x37, 0xde, 0x05, 0xa5, 0x39, 0xad, 0x2b, 0xfa, 0xb8, 0x9d, 0xc3, 0x1a, - 0xb4, 0xa2, 0xa0, 0x0f, 0x0a, 0x44, 0x04, 0xf5, 0xa2, 0x45, 0xd6, 0x03, 0x4f, 0xd2, 0x83, 0x2d, - 0x9e, 0x5a, 0xa2, 0xd0, 0xc0, 0xce, 0x69, 0x55, 0xd9, 0xc9, 0x6d, 0x2a, 0xfa, 0x68, 0x65, 0xab, - 0x1d, 0xc7, 0xff, 0xbd, 0xaa, 0xbf, 0x4e, 0x10, 0x50, 0xb5, 0x4e, 0xb3, 0x4f, 0xcb, 0x09, 0xa4, - 0x71, 0x62, 0xac, 0xe9, 0x4e, 0xb0, 0xec, 0x3a, 0xaf, 0x84, 0x96, 0xac, 0x25, 0x7b, 0x26, 0x74, - 0xf7, 0xa7, 0x2f, 0x6b, 0x6e, 0x4a, 0xff, 0x75, 0x0e, 0xe7, 0xe4, 0x1f, 0xcc, 0x7c, 0x09, 0xaf, - 0xf5, 0xf8, 0xfe, 0xf5, 0x52, 0x3c, 0x66, 0x47, 0x7c, 0xe3, 0x7d, 0x63, 0xcb, 0x6e, 0xe5, 0x91, - 0xf9, 0xbd, 0xbd, 0xd6, 0xc3, 0x65, 0xf7, 0x6d, 0xe6, 0x92, 0xe9, 0xcc, 0x25, 0x9f, 0x33, 0x97, - 0x3c, 0xcd, 0xdd, 0xc2, 0x74, 0xee, 0x16, 0x3e, 0xe6, 0x6e, 0xe1, 0x86, 0xc7, 0xa9, 0x49, 0xb2, - 0x9e, 0x1f, 0xe1, 0x70, 0x25, 0x25, 0xc0, 0xac, 0xca, 0x56, 0x94, 0x84, 0xa9, 0xe0, 0x77, 0x56, - 0xdd, 0x4c, 0x24, 0xe8, 0x5e, 0xd9, 0xbe, 0xf5, 0xec, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x17, 0x9d, - 0x01, 0xa7, 0x38, 0x02, 0x00, 0x00, + // 749 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0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 0x00, 0x00, 0xff, 0xff, 0x84, 0xec, 0x59, 0x3d, 0x64, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -229,6 +634,12 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // VolumeReport queries VolumeReport info for given epoch. VolumeReport(ctx context.Context, in *QueryVolumeReportRequest, opts ...grpc.CallOption) (*QueryVolumeReportResponse, error) + // PotRewardsByEpoch queries Pot rewards by a given epoch. + PotRewardsByEpoch(ctx context.Context, in *QueryPotRewardsByEpochRequest, opts ...grpc.CallOption) (*QueryPotRewardsByEpochResponse, error) + // PotRewardsByOwner queries Pot rewards by a given owner wallet address. + PotRewardsByOwner(ctx context.Context, in *QueryPotRewardsByOwnerRequest, opts ...grpc.CallOption) (*QueryPotRewardsByOwnerResponse, error) + // PotSlashingByOwner queries Pot Pot slashingBy by owner wallet address. + PotSlashingByOwner(ctx context.Context, in *QueryPotSlashingByOwnerRequest, opts ...grpc.CallOption) (*QueryPotSlashingByOwnerResponse, error) } type queryClient struct { @@ -248,10 +659,43 @@ func (c *queryClient) VolumeReport(ctx context.Context, in *QueryVolumeReportReq return out, nil } +func (c *queryClient) PotRewardsByEpoch(ctx context.Context, in *QueryPotRewardsByEpochRequest, opts ...grpc.CallOption) (*QueryPotRewardsByEpochResponse, error) { + out := new(QueryPotRewardsByEpochResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Query/PotRewardsByEpoch", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) PotRewardsByOwner(ctx context.Context, in *QueryPotRewardsByOwnerRequest, opts ...grpc.CallOption) (*QueryPotRewardsByOwnerResponse, error) { + out := new(QueryPotRewardsByOwnerResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Query/PotRewardsByOwner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) PotSlashingByOwner(ctx context.Context, in *QueryPotSlashingByOwnerRequest, opts ...grpc.CallOption) (*QueryPotSlashingByOwnerResponse, error) { + out := new(QueryPotSlashingByOwnerResponse) + err := c.cc.Invoke(ctx, "/stratos.pot.v1.Query/PotSlashingByOwner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // VolumeReport queries VolumeReport info for given epoch. VolumeReport(context.Context, *QueryVolumeReportRequest) (*QueryVolumeReportResponse, error) + // PotRewardsByEpoch queries Pot rewards by a given epoch. + PotRewardsByEpoch(context.Context, *QueryPotRewardsByEpochRequest) (*QueryPotRewardsByEpochResponse, error) + // PotRewardsByOwner queries Pot rewards by a given owner wallet address. + PotRewardsByOwner(context.Context, *QueryPotRewardsByOwnerRequest) (*QueryPotRewardsByOwnerResponse, error) + // PotSlashingByOwner queries Pot Pot slashingBy by owner wallet address. + PotSlashingByOwner(context.Context, *QueryPotSlashingByOwnerRequest) (*QueryPotSlashingByOwnerResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -261,6 +705,15 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) VolumeReport(ctx context.Context, req *QueryVolumeReportRequest) (*QueryVolumeReportResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VolumeReport not implemented") } +func (*UnimplementedQueryServer) PotRewardsByEpoch(ctx context.Context, req *QueryPotRewardsByEpochRequest) (*QueryPotRewardsByEpochResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PotRewardsByEpoch not implemented") +} +func (*UnimplementedQueryServer) PotRewardsByOwner(ctx context.Context, req *QueryPotRewardsByOwnerRequest) (*QueryPotRewardsByOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PotRewardsByOwner not implemented") +} +func (*UnimplementedQueryServer) PotSlashingByOwner(ctx context.Context, req *QueryPotSlashingByOwnerRequest) (*QueryPotSlashingByOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PotSlashingByOwner not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -284,20 +737,86 @@ func _Query_VolumeReport_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "stratos.pot.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "VolumeReport", - Handler: _Query_VolumeReport_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "stratos/pot/v1/query.proto", -} - -func (m *QueryVolumeReportRequest) Marshal() (dAtA []byte, err error) { +func _Query_PotRewardsByEpoch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPotRewardsByEpochRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PotRewardsByEpoch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Query/PotRewardsByEpoch", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PotRewardsByEpoch(ctx, req.(*QueryPotRewardsByEpochRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_PotRewardsByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPotRewardsByOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PotRewardsByOwner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Query/PotRewardsByOwner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PotRewardsByOwner(ctx, req.(*QueryPotRewardsByOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_PotSlashingByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPotSlashingByOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PotSlashingByOwner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/stratos.pot.v1.Query/PotSlashingByOwner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PotSlashingByOwner(ctx, req.(*QueryPotSlashingByOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stratos.pot.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "VolumeReport", + Handler: _Query_VolumeReport_Handler, + }, + { + MethodName: "PotRewardsByEpoch", + Handler: _Query_PotRewardsByEpoch_Handler, + }, + { + MethodName: "PotRewardsByOwner", + Handler: _Query_PotRewardsByOwner_Handler, + }, + { + MethodName: "PotSlashingByOwner", + Handler: _Query_PotSlashingByOwner_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stratos/pot/v1/query.proto", +} + +func (m *QueryVolumeReportRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -404,70 +923,1039 @@ func (m *QueryVolumeReportResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro 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++ +func (m *QueryPotRewardsByEpochRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryVolumeReportRequest) Size() (n int) { - if m == nil { - return 0 + +func (m *QueryPotRewardsByEpochRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPotRewardsByEpochRequest) 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.Epoch) > 0 { + i -= len(m.Epoch) + copy(dAtA[i:], m.Epoch) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Epoch))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPotRewardsByEpochResponse) 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 *QueryPotRewardsByEpochResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPotRewardsByEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Epoch) - if l > 0 { - n += 1 + l + sovQuery(uint64(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] = 0x1a } - return n + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rewards[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 *ReportInfo) Size() (n int) { - if m == nil { - return 0 +func (m *PotRewardByOwner) 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 *PotRewardByOwner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PotRewardByOwner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Epoch) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ImmatureTotalReward) > 0 { + for iNdEx := len(m.ImmatureTotalReward) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ImmatureTotalReward[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } - l = len(m.Reference) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.MatureTotalReward) > 0 { + for iNdEx := len(m.MatureTotalReward) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MatureTotalReward[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } - return n + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryVolumeReportResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryPotRewardsByOwnerRequest) 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 *QueryPotRewardsByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPotRewardsByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ReportInfo != nil { - l = m.ReportInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPotRewardsByOwnerResponse) 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 *QueryPotRewardsByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPotRewardsByOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l if m.Height != 0 { - n += 1 + sovQuery(uint64(m.Height)) + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if m.Rewards != nil { + { + size, err := m.Rewards.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 *QueryPotSlashingByOwnerRequest) 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 *QueryPotSlashingByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPotSlashingByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WalletAddress) > 0 { + i -= len(m.WalletAddress) + copy(dAtA[i:], m.WalletAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.WalletAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPotSlashingByOwnerResponse) 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 *QueryPotSlashingByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPotSlashingByOwnerResponse) 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] = 0x10 + } + if len(m.Slashing) > 0 { + i -= len(m.Slashing) + copy(dAtA[i:], m.Slashing) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Slashing))) + 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 *QueryVolumeReportRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Epoch) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *ReportInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Epoch) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Reference) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVolumeReportResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ReportInfo != nil { + l = m.ReportInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryPotRewardsByEpochRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Epoch) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPotRewardsByEpochResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *PotRewardByOwner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.MatureTotalReward) > 0 { + for _, e := range m.MatureTotalReward { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.ImmatureTotalReward) > 0 { + for _, e := range m.ImmatureTotalReward { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryPotRewardsByOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPotRewardsByOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Rewards != nil { + l = m.Rewards.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryPotSlashingByOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WalletAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPotSlashingByOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Slashing) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + 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 *QueryVolumeReportRequest) 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: QueryVolumeReportRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVolumeReportRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", 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.Epoch = 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 *ReportInfo) 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: ReportInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReportInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", 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.Epoch = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reference", 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.Reference = 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 *QueryVolumeReportResponse) 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: QueryVolumeReportResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVolumeReportResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReportInfo", 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.ReportInfo == nil { + m.ReportInfo = &ReportInfo{} + } + if err := m.ReportInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + 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 |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPotRewardsByEpochRequest) 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: QueryPotRewardsByEpochRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPotRewardsByEpochRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", 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.Epoch = string(dAtA[iNdEx:postIndex]) + 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.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 *QueryPotRewardsByEpochResponse) 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: QueryPotRewardsByEpochResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPotRewardsByEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", 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.Rewards = append(m.Rewards, &Reward{}) + if err := m.Rewards[len(m.Rewards)-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 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 |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - return n -} -func 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)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *QueryVolumeReportRequest) Unmarshal(dAtA []byte) error { +func (m *PotRewardByOwner) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -490,15 +1978,15 @@ func (m *QueryVolumeReportRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVolumeReportRequest: wiretype end group for non-group") + return fmt.Errorf("proto: PotRewardByOwner: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVolumeReportRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PotRewardByOwner: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -526,7 +2014,75 @@ func (m *QueryVolumeReportRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Epoch = string(dAtA[iNdEx:postIndex]) + m.WalletAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MatureTotalReward", 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.MatureTotalReward = append(m.MatureTotalReward, types.Coin{}) + if err := m.MatureTotalReward[len(m.MatureTotalReward)-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 ImmatureTotalReward", 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.ImmatureTotalReward = append(m.ImmatureTotalReward, types.Coin{}) + if err := m.ImmatureTotalReward[len(m.ImmatureTotalReward)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -549,7 +2105,7 @@ func (m *QueryVolumeReportRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ReportInfo) Unmarshal(dAtA []byte) error { +func (m *QueryPotRewardsByOwnerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -572,15 +2128,15 @@ func (m *ReportInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ReportInfo: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPotRewardsByOwnerRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ReportInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPotRewardsByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -608,11 +2164,166 @@ func (m *ReportInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Epoch = string(dAtA[iNdEx:postIndex]) + m.WalletAddress = 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 *QueryPotRewardsByOwnerResponse) 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: QueryPotRewardsByOwnerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPotRewardsByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", 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.Rewards == nil { + m.Rewards = &PotRewardByOwner{} + } + if err := m.Rewards.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: + 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 |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPotSlashingByOwnerRequest) 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: QueryPotSlashingByOwnerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPotSlashingByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reference", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WalletAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -640,7 +2351,7 @@ func (m *ReportInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Reference = string(dAtA[iNdEx:postIndex]) + m.WalletAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -663,7 +2374,7 @@ func (m *ReportInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVolumeReportResponse) Unmarshal(dAtA []byte) error { +func (m *QueryPotSlashingByOwnerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -686,17 +2397,17 @@ func (m *QueryVolumeReportResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVolumeReportResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPotSlashingByOwnerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVolumeReportResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPotSlashingByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReportInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Slashing", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -706,27 +2417,23 @@ func (m *QueryVolumeReportResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ReportInfo == nil { - m.ReportInfo = &ReportInfo{} - } - if err := m.ReportInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Slashing = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { diff --git a/x/pot/types/query.pb.gw.go b/x/pot/types/query.pb.gw.go index 827fc9ea..886171f3 100644 --- a/x/pot/types/query.pb.gw.go +++ b/x/pot/types/query.pb.gw.go @@ -85,6 +85,186 @@ func local_request_Query_VolumeReport_0(ctx context.Context, marshaler runtime.M } +var ( + filter_Query_PotRewardsByEpoch_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_PotRewardsByEpoch_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPotRewardsByEpochRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", 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_PotRewardsByEpoch_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.PotRewardsByEpoch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PotRewardsByEpoch_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPotRewardsByEpochRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", 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_PotRewardsByEpoch_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.PotRewardsByEpoch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_PotRewardsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPotRewardsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["wallet_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wallet_address") + } + + protoReq.WalletAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wallet_address", err) + } + + msg, err := client.PotRewardsByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PotRewardsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPotRewardsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["wallet_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wallet_address") + } + + protoReq.WalletAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wallet_address", err) + } + + msg, err := server.PotRewardsByOwner(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_PotSlashingByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPotSlashingByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["wallet_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wallet_address") + } + + protoReq.WalletAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wallet_address", err) + } + + msg, err := client.PotSlashingByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PotSlashingByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPotSlashingByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["wallet_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wallet_address") + } + + protoReq.WalletAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wallet_address", err) + } + + msg, err := server.PotSlashingByOwner(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. @@ -111,6 +291,66 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_PotRewardsByEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PotRewardsByEpoch_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PotRewardsByEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PotRewardsByOwner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PotRewardsByOwner_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PotRewardsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PotSlashingByOwner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PotSlashingByOwner_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PotSlashingByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -172,13 +412,85 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_PotRewardsByEpoch_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_PotRewardsByEpoch_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_PotRewardsByEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PotRewardsByOwner_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_PotRewardsByOwner_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_PotRewardsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PotSlashingByOwner_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_PotSlashingByOwner_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_PotSlashingByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_VolumeReport_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "pot", "v1", "volume-report", "epoch"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_PotRewardsByEpoch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 4}, []string{"stratos", "pot", "v1", "rewards", "epoch"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_PotRewardsByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"stratos", "pot", "v1", "rewards", "wallet", "wallet_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_PotSlashingByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stratos", "pot", "v1", "slashing", "wallet_address"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Query_VolumeReport_0 = runtime.ForwardResponseMessage + + forward_Query_PotRewardsByEpoch_0 = runtime.ForwardResponseMessage + + forward_Query_PotRewardsByOwner_0 = runtime.ForwardResponseMessage + + forward_Query_PotSlashingByOwner_0 = runtime.ForwardResponseMessage ) diff --git a/x/register/keeper/querier.go b/x/register/keeper/querier.go index d85b9cb4..74198bbe 100644 --- a/x/register/keeper/querier.go +++ b/x/register/keeper/querier.go @@ -362,7 +362,7 @@ func (k Keeper) getNodeStakes(ctx sdk.Context, bondStatus stakingtypes.BondStatu return unbondingStake, unbondedStake, bondedStake, nil } -func getIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator { +func GetIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator { if reverse { var end []byte if start != nil { @@ -409,7 +409,7 @@ func FilteredPaginate(cdc codec.Codec, } if len(key) != 0 { - iterator := getIterator(prefixStore, key, reverse) + iterator := GetIterator(prefixStore, key, reverse) defer iterator.Close() var numHits uint64 @@ -467,7 +467,7 @@ func FilteredPaginate(cdc codec.Codec, }, nil } - iterator := getIterator(prefixStore, nil, reverse) + iterator := GetIterator(prefixStore, nil, reverse) defer iterator.Close() end := offset + limit From 84cfc28642d49a4746daa52a28e50e1126949349 Mon Sep 17 00:00:00 2001 From: hong-pang Date: Mon, 13 Jun 2022 20:31:58 -0400 Subject: [PATCH 112/113] finished grpc_query for pot module --- x/pot/keeper/grpc_query.go | 56 ++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/x/pot/keeper/grpc_query.go b/x/pot/keeper/grpc_query.go index 77d81835..d8bb9db7 100644 --- a/x/pot/keeper/grpc_query.go +++ b/x/pot/keeper/grpc_query.go @@ -80,13 +80,6 @@ func (q Querier) PotRewardsByEpoch(c context.Context, req *types.QueryPotRewards store := ctx.KVStore(q.storeKey) RewardStore := prefix.NewStore(store, types.GetIndividualRewardIteratorKey(matureEpoch)) - //if req.Pagination.Limit == 0 { - // req.Pagination.Limit = registertypes.QueryDefaultLimit - // - // // count total results when the limit is zero/not supplied - // req.Pagination.CountTotal = true - //} - rewardsPageRes, err := FilteredPaginate(q.cdc, RewardStore, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { val, err := UnmarshalIndividualReward(q.cdc, value) if err != nil { @@ -102,33 +95,36 @@ func (q Querier) PotRewardsByEpoch(c context.Context, req *types.QueryPotRewards if err != nil { return &types.QueryPotRewardsByEpochResponse{}, status.Error(codes.Internal, err.Error()) } - - // height := ctx.BlockHeight() - // return &types.QueryPotRewardsByEpochResponse{Rewards: res, Height: height}, nil - // q.IteratorIndividualReward(ctx, matureEpoch, func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { - // if !((individualReward.RewardFromMiningPool.Empty() || individualReward.RewardFromMiningPool.IsZero()) && - // (individualReward.RewardFromTrafficPool.Empty() || individualReward.RewardFromTrafficPool.IsZero())) { - // res = append(res, &individualReward) - // } - // return false - // }) - // - // offset := req.Pagination.Offset - // page := 1 - // if offset != 0 { - // page = - // } - // start, end := client.Paginate(len(res), params.Page, params.Limit, QueryDefaultLimit) - // if start < 0 || end < 0 { - // return &types.QueryPotRewardsByEpochResponse{}, nil - // } else { - // res = res[start:end] - // } height := ctx.BlockHeight() return &types.QueryPotRewardsByEpochResponse{Rewards: res, Height: height, Pagination: rewardsPageRes}, nil - //} } +// height := ctx.BlockHeight() +// return &types.QueryPotRewardsByEpochResponse{Rewards: res, Height: height}, nil +// q.IteratorIndividualReward(ctx, matureEpoch, func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool) { +// if !((individualReward.RewardFromMiningPool.Empty() || individualReward.RewardFromMiningPool.IsZero()) && +// (individualReward.RewardFromTrafficPool.Empty() || individualReward.RewardFromTrafficPool.IsZero())) { +// res = append(res, &individualReward) +// } +// return false +// }) +// +// offset := req.Pagination.Offset +// page := 1 +// if offset != 0 { +// page = +// } +// start, end := client.Paginate(len(res), params.Page, params.Limit, QueryDefaultLimit) +// if start < 0 || end < 0 { +// return &types.QueryPotRewardsByEpochResponse{}, nil +// } else { +// res = res[start:end] +// } +// height := ctx.BlockHeight() +// return &types.QueryPotRewardsByEpochResponse{Rewards: res, Height: height, Pagination: rewardsPageRes}, nil +// //} +//} + func UnmarshalIndividualReward(cdc codec.BinaryCodec, value []byte) (v types.Reward, err error) { err = cdc.Unmarshal(value, &v) return v, err From 33276052e3a5d6b97636000e26ebe0bdeb1d1fcd Mon Sep 17 00:00:00 2001 From: hong-pang Date: Wed, 15 Jun 2022 18:08:06 -0400 Subject: [PATCH 113/113] fixed resourceNodeCNT and metaNodeCNT issues --- go.mod | 3 ++ x/register/client/cli/tx.go | 2 +- x/register/genesis.go | 6 +-- x/register/keeper/keeper.go | 59 +++++++++++++------------- x/register/keeper/meta_node.go | 4 +- x/register/keeper/node_state_change.go | 11 ++++- x/register/keeper/resource_node.go | 5 ++- x/register/types/keys.go | 9 ++-- 8 files changed, 58 insertions(+), 41 deletions(-) diff --git a/go.mod b/go.mod index b695d65e..9b852130 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,9 @@ module github.com/stratosnet/stratos-chain go 1.17 +replace google.golang.org/grpc => google.golang.org/grpc v1.33.2 + + require ( github.com/btcsuite/btcd v0.22.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce diff --git a/x/register/client/cli/tx.go b/x/register/client/cli/tx.go index 317bbc75..06340d85 100644 --- a/x/register/client/cli/tx.go +++ b/x/register/client/cli/tx.go @@ -316,7 +316,7 @@ func UpdateMetaNodeStakeCmd() *cobra.Command { // MetaNodeRegistrationVoteCmd Meta node registration need to be approved by 2/3 of existing meta nodes func MetaNodeRegistrationVoteCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "meta_node_reg_vote [flags]", + Use: "meta-node-reg-vote [flags]", Short: "vote for the registration of a new meta node", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/register/genesis.go b/x/register/genesis.go index bbab11a3..90564529 100644 --- a/x/register/genesis.go +++ b/x/register/genesis.go @@ -24,18 +24,18 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState } // set initial genesis number of resource nodes - keeper.SetInitialGenesisBondedResourceNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedResourceNode)) + keeper.SetBondedResourceNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedResourceNode)) lenOfGenesisBondedMetaNode := int64(0) for _, metaNode := range data.GetMetaNodes() { if metaNode.GetStatus() == stakingtypes.Bonded { - lenOfGenesisBondedResourceNode++ + lenOfGenesisBondedMetaNode++ initialStakeTotal = initialStakeTotal.Add(metaNode.Tokens) } keeper.SetMetaNode(ctx, metaNode) } // set initial genesis number of meta nodes - keeper.SetInitialGenesisBondedMetaNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedMetaNode)) + keeper.SetBondedMetaNodeCnt(ctx, sdk.NewInt(lenOfGenesisBondedMetaNode)) totalUnissuedPrepay := keeper.GetTotalUnissuedPrepay(ctx).Amount initialUOzonePrice := sdk.ZeroDec() diff --git a/x/register/keeper/keeper.go b/x/register/keeper/keeper.go index df82ffb3..642aa247 100644 --- a/x/register/keeper/keeper.go +++ b/x/register/keeper/keeper.go @@ -66,7 +66,7 @@ func (k *Keeper) SetHooks(sh types.RegisterHooks) *Keeper { func (k Keeper) SetInitialUOzonePrice(ctx sdk.Context, price sdk.Dec) { store := ctx.KVStore(k.storeKey) - b := types.ModuleCdc.MustMarshalLengthPrefixed(&price) + b := types.ModuleCdc.MustMarshalLengthPrefixed(price) store.Set(types.InitialUOzonePriceKey, b) } @@ -507,7 +507,9 @@ func (k Keeper) UnbondResourceNode( k.SetResourceNode(ctx, resourceNode) // decrease resource node count - k.SetBondedResourceNodeCnt(ctx, sdk.NewInt(-1)) + v := k.GetBondedResourceNodeCnt(ctx) + count := v.Sub(sdk.NewInt(1)) + k.SetBondedResourceNodeCnt(ctx, count) } // set the unbonding mature time and completion height appropriately @@ -558,7 +560,10 @@ func (k Keeper) UnbondMetaNode( if amt.Equal(metaNode.Tokens) { metaNode.Status = stakingtypes.Unbonding // decrease meta node count - k.SetBondedMetaNodeCnt(ctx, sdk.NewInt(-1)) + v := k.GetBondedMetaNodeCnt(ctx) + count := v.Sub(sdk.NewInt(1)) + k.SetBondedMetaNodeCnt(ctx, count) + // set meta node k.SetMetaNode(ctx, metaNode) } @@ -639,54 +644,50 @@ func (k Keeper) UozSupply(ctx sdk.Context) (remaining, total sdk.Int) { return remaining, total } -func (k Keeper) SetInitialGenesisBondedResourceNodeCnt(ctx sdk.Context, count sdk.Int) { - store := ctx.KVStore(k.storeKey) - b := types.ModuleCdc.MustMarshalLengthPrefixed(count) - store.Set(types.ResourceNodeCntKey, b) -} +//func (k Keeper) SetInitialGenesisBondedResourceNodeCnt(ctx sdk.Context, count sdk.Int) { +// store := ctx.KVStore(k.storeKey) +// b := types.ModuleCdc.MustMarshalLengthPrefixed(count) +// store.Set(types.ResourceNodeCntKey, b) +//} -func (k Keeper) SetInitialGenesisBondedMetaNodeCnt(ctx sdk.Context, count sdk.Int) { - store := ctx.KVStore(k.storeKey) - b := types.ModuleCdc.MustMarshalLengthPrefixed(count) - store.Set(types.MetaNodeCntKey, b) -} +//func (k Keeper) SetInitialGenesisBondedMetaNodeCnt(ctx sdk.Context, count sdk.Int) { +// store := ctx.KVStore(k.storeKey) +// b := types.ModuleCdc.MustMarshal(count) +// store.Set(types.MetaNodeCntKey, b) +//} -func (k Keeper) SetBondedResourceNodeCnt(ctx sdk.Context, delta sdk.Int) { +func (k Keeper) SetBondedResourceNodeCnt(ctx sdk.Context, count sdk.Int) { store := ctx.KVStore(k.storeKey) - oldValue := store.Get(types.ResourceNodeCntKey) - var balance sdk.Int - types.ModuleCdc.MustUnmarshalLengthPrefixed(oldValue, &balance) - b := types.ModuleCdc.MustMarshalLengthPrefixed(balance.Add(delta)) + b := types.ModuleCdc.MustMarshalLengthPrefixed(count) + //ctx.Logger().Info("count = " + count.String()) store.Set(types.ResourceNodeCntKey, b) } -func (k Keeper) SetBondedMetaNodeCnt(ctx sdk.Context, delta sdk.Int) { +func (k Keeper) SetBondedMetaNodeCnt(ctx sdk.Context, count sdk.Int) { store := ctx.KVStore(k.storeKey) - oldValue := store.Get(types.MetaNodeKey) - var balance sdk.Int - types.ModuleCdc.MustUnmarshalLengthPrefixed(oldValue, &balance) - b := types.ModuleCdc.MustMarshalLengthPrefixed(balance.Add(delta)) + b := types.ModuleCdc.MustMarshalLengthPrefixed(count) + //ctx.Logger().Info("count = " + count.String()) store.Set(types.MetaNodeCntKey, b) } -func (k Keeper) GetBondedResourceNodeCnt(ctx sdk.Context) sdk.Int { +func (k Keeper) GetBondedResourceNodeCnt(ctx sdk.Context) (balance sdk.Int) { store := ctx.KVStore(k.storeKey) value := store.Get(types.ResourceNodeCntKey) if value == nil { return sdk.ZeroInt() } - var balance sdk.Int types.ModuleCdc.MustUnmarshalLengthPrefixed(value, &balance) - return balance + //ctx.Logger().Info("balance = " + balance.String()) + return } -func (k Keeper) GetBondedMetaNodeCnt(ctx sdk.Context) sdk.Int { +func (k Keeper) GetBondedMetaNodeCnt(ctx sdk.Context) (balance sdk.Int) { store := ctx.KVStore(k.storeKey) value := store.Get(types.MetaNodeCntKey) if value == nil { return sdk.ZeroInt() } - var balance sdk.Int types.ModuleCdc.MustUnmarshalLengthPrefixed(value, &balance) - return balance + //ctx.Logger().Info("balance = " + balance.String()) + return } diff --git a/x/register/keeper/meta_node.go b/x/register/keeper/meta_node.go index ac203526..52c5dfdb 100644 --- a/x/register/keeper/meta_node.go +++ b/x/register/keeper/meta_node.go @@ -353,7 +353,9 @@ func (k Keeper) HandleVoteForMetaNodeRegistration(ctx sdk.Context, nodeAddr stra node.Suspend = false k.SetMetaNode(ctx, node) // increase mata node count - k.SetBondedMetaNodeCnt(ctx, sdk.NewInt(1)) + v := k.GetBondedMetaNodeCnt(ctx) + count := v.Add(sdk.NewInt(1)) + k.SetBondedMetaNodeCnt(ctx, count) // move stake from not bonded pool to bonded pool tokenToBond := sdk.NewCoin(k.BondDenom(ctx), node.Tokens) diff --git a/x/register/keeper/node_state_change.go b/x/register/keeper/node_state_change.go index 97e8bd7d..5b11338a 100644 --- a/x/register/keeper/node_state_change.go +++ b/x/register/keeper/node_state_change.go @@ -53,14 +53,21 @@ func (k Keeper) bondedToUnbonding(ctx sdk.Context, node interface{}, isMetaNode if temp.GetStatus() != stakingtypes.Bonded { panic(fmt.Sprintf("bad state transition bondedToUnbonding, metaNode: %v\n", temp)) } - k.SetBondedMetaNodeCnt(ctx, sdk.NewInt(-1)) + // decrease meta node count + v := k.GetBondedMetaNodeCnt(ctx) + count := v.Sub(sdk.NewInt(1)) + k.SetBondedMetaNodeCnt(ctx, count) + return k.beginUnbondingMetaNode(ctx, &temp, &coin) default: temp := node.(types.ResourceNode) if temp.GetStatus() != stakingtypes.Bonded { panic(fmt.Sprintf("bad state transition bondedToUnbonding, resourceNode: %v\n", temp)) } - k.SetBondedResourceNodeCnt(ctx, sdk.NewInt(-1)) + // decrease resource node count + v := k.GetBondedResourceNodeCnt(ctx) + count := v.Sub(sdk.NewInt(1)) + k.SetBondedResourceNodeCnt(ctx, count) return k.beginUnbondingResourceNode(ctx, &temp, &coin) } } diff --git a/x/register/keeper/resource_node.go b/x/register/keeper/resource_node.go index f348b4c0..b9d395b9 100644 --- a/x/register/keeper/resource_node.go +++ b/x/register/keeper/resource_node.go @@ -168,7 +168,10 @@ func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.Resourc k.SetResourceNode(ctx, resourceNode) // increase resource node count - k.SetBondedResourceNodeCnt(ctx, sdk.NewInt(1)) + v := k.GetBondedResourceNodeCnt(ctx) + count := v.Add(sdk.NewInt(1)) + k.SetBondedResourceNodeCnt(ctx, count) + ozoneLimitChange = k.increaseOzoneLimitByAddStake(ctx, tokenToAdd.Amount) return ozoneLimitChange, nil diff --git a/x/register/types/keys.go b/x/register/types/keys.go index f7409fdc..545df44c 100644 --- a/x/register/types/keys.go +++ b/x/register/types/keys.go @@ -40,11 +40,12 @@ var ( SlashingPrefix = []byte{0x05} InitialGenesisStakeTotalKey = []byte{0x06} // key of initial genesis deposit by all resource nodes and meta nodes at t=0 InitialUOzonePriceKey = []byte{0x07} // key of initial uoz price at t=0 + MetaNodeCntKey = []byte{0x08} // the number of all meta nodes + ResourceNodeCntKey = []byte{0x09} // the number of all resource nodes + + UBDNodeKey = []byte{0x11} // prefix for each key to an unbonding node + UBDNodeQueueKey = []byte{0x12} // prefix for the timestamps in unbonding node queue - UBDNodeKey = []byte{0x11} // prefix for each key to an unbonding node - UBDNodeQueueKey = []byte{0x12} // prefix for the timestamps in unbonding node queue - MetaNodeCntKey = []byte{0x13} // the number of all meta nodes - ResourceNodeCntKey = []byte{0x14} // the number of all resource nodes ) // GetResourceNodeKey gets the key for the resourceNode with address