diff --git a/go.mod b/go.mod index bb1d15af872..21a520ca052 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/confio/ics23/go v0.9.0 github.com/cosmos/btcutil v1.0.4 github.com/cosmos/go-bip39 v1.0.0 + github.com/cosmos/gogoproto v1.4.3 github.com/cosmos/iavl v0.19.5 github.com/cosmos/ledger-cosmos-go v0.12.2 github.com/gogo/gateway v1.1.0 @@ -55,6 +56,7 @@ require ( require ( cosmossdk.io/api v0.2.6 // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect + cosmossdk.io/errors v1.0.0-beta.7 filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect @@ -70,7 +72,7 @@ require ( github.com/cockroachdb/redact v1.1.3 // indirect github.com/cometbft/cometbft-db v0.7.0 // indirect github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.1 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.1 github.com/creachadair/taskgroup v0.3.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -136,6 +138,7 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect + sigs.k8s.io/yaml v1.3.0 ) replace ( diff --git a/go.sum b/go.sum index e5f2f8ed52a..2d7adb453fe 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= +cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= +cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -228,6 +230,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.1/go.mod h1:8k2GNZghi5sDRFw/scPL8gMSo 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/gogoproto v1.4.3 h1:RP3yyVREh9snv/lsOvmsAPQt8f44LgL281X0IOIhhcI= +github.com/cosmos/gogoproto v1.4.3/go.mod h1:0hLIG5TR7IvV1fme1HCFKjfzW9X2x0Mo+RooWXCnOWU= github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -1530,4 +1534,6 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/simapp/app.go b/simapp/app.go index fc49f24c6a7..39e57a221c1 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -2,7 +2,6 @@ package simapp import ( "encoding/json" - "fmt" "io" "net/http" "os" @@ -18,9 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/server/api" @@ -34,7 +31,6 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" - authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" 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" @@ -89,6 +85,7 @@ import ( // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" + storetypes "github.com/cosmos/cosmos-sdk/store/types" ) const appName = "SimApp" @@ -149,9 +146,9 @@ type SimApp struct { invCheckPeriod uint // keys to access the substores - keys map[string]*sdk.KVStoreKey - tkeys map[string]*sdk.TransientStoreKey - memKeys map[string]*sdk.MemoryStoreKey + keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey + memKeys map[string]*storetypes.MemoryStoreKey // keepers AccountKeeper authkeeper.AccountKeeper @@ -211,15 +208,14 @@ func NewSimApp( authzkeeper.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - // NOTE: The testingkey is just mounted for testing purposes. Actual applications should // not include this key. memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, "testingkey") - // load state streaming if enabled + // configure state listening capabilities using AppOptions + // we are doing nothing with the returned streamingServices and waitGroup in this case if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, keys); err != nil { - fmt.Printf("failed to load state streaming: %s", err) - os.Exit(1) + tmos.Exit(err.Error()) } app := &SimApp{ @@ -259,7 +255,7 @@ func NewSimApp( ) app.DistrKeeper = distrkeeper.NewKeeper( appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper, - &stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(), + &stakingKeeper, authtypes.FeeCollectorName, ) app.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName), @@ -269,7 +265,6 @@ func NewSimApp( ) 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 @@ -277,14 +272,20 @@ func NewSimApp( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter()) - - // register the proposal types + app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter()) + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://github.com/cosmos/cosmos-sdk/blob/release/v0.46.x/x/gov/spec/01_concepts.md#proposal-messages 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)) + /* + Example of setting gov params: + govConfig.MaxMetadataLen = 10000 + */ govKeeper := govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, &stakingKeeper, govRouter, @@ -295,7 +296,8 @@ func NewSimApp( // register the governance hooks ), ) - + // set the governance module account as the authority for conducting upgrades + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper, @@ -356,6 +358,7 @@ func NewSimApp( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. // 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. @@ -375,6 +378,10 @@ func NewSimApp( app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) + // RegisterUpgradeHandlers is used for registering any on-chain upgrades. + // Make sure it's called after `app.mm` and `app.configurator` are set. + // app.RegisterUpgradeHandlers() + // add test gRPC service for testing gRPC queries in isolation testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) @@ -397,12 +404,37 @@ func NewSimApp( // initialize BaseApp app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) + app.SetEndBlocker(app.EndBlocker) + app.setAnteHandler(encodingConfig.TxConfig) + // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like + // antehandlers, but are run _after_ the `runMsgs` execution. They are also + // defined as a chain, and have the same signature as antehandlers. + // + // In baseapp, postHandlers are run in the same store branch as `runMsgs`, + // meaning that both `runMsgs` and `postHandler` state will be committed if + // both are successful, and both will be reverted if any of the two fails. + // + // The SDK exposes a default empty postHandlers chain. + // + // Please note that changing any of the anteHandler or postHandler chain is + // likely to be a state-machine breaking change, which needs a coordinated + // upgrade. + + if loadLatest { + if err := app.LoadLatestVersion(); err != nil { + tmos.Exit(err.Error()) + } + } + return app +} + +func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { anteHandler, err := ante.NewAnteHandler( ante.HandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + SignModeHandler: txConfig.SignModeHandler(), FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, @@ -412,15 +444,6 @@ func NewSimApp( } app.SetAnteHandler(anteHandler) - app.SetEndBlocker(app.EndBlocker) - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) - } - } - - return app } // Name returns the name of the App @@ -485,21 +508,21 @@ func (app *SimApp) InterfaceRegistry() types.InterfaceRegistry { // GetKey returns the KVStoreKey for the provided store key. // // NOTE: This is solely to be used for testing purposes. -func (app *SimApp) GetKey(storeKey string) *sdk.KVStoreKey { +func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey { return app.keys[storeKey] } // GetTKey returns the TransientStoreKey for the provided store key. // // NOTE: This is solely to be used for testing purposes. -func (app *SimApp) GetTKey(storeKey string) *sdk.TransientStoreKey { +func (app *SimApp) GetTKey(storeKey string) *storetypes.TransientStoreKey { return app.tkeys[storeKey] } // GetMemKey returns the MemStoreKey for the provided mem key. // // NOTE: This is solely used for testing purposes. -func (app *SimApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey { +func (app *SimApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return app.memKeys[storeKey] } @@ -520,16 +543,12 @@ func (app *SimApp) SimulationManager() *module.SimulationManager { // API server. func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) - // Register legacy tx routes. - authrest.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) + // Register grpc-gateway routes for all modules. ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily @@ -545,15 +564,15 @@ func (app *SimApp) RegisterTxService(clientCtx client.Context) { // RegisterTendermintService implements the Application.RegisterTendermintService method. func (app *SimApp) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) -} - -func (app *SimApp) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) + tmservice.RegisterTendermintService( + app.BaseApp.GRPCQueryRouter(), + clientCtx, + app.interfaceRegistry, + ) } // RegisterSwaggerAPI registers swagger route with API Server -func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { +func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { statikFS, err := fs.New() if err != nil { panic(err) @@ -573,7 +592,7 @@ func GetMaccPerms() map[string][]string { } // initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper { +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) paramsKeeper.Subspace(authtypes.ModuleName) diff --git a/simapp/genesis.go b/simapp/genesis.go index a002aead9ae..7cb6dd52c33 100644 --- a/simapp/genesis.go +++ b/simapp/genesis.go @@ -3,7 +3,20 @@ package simapp import ( "encoding/json" + "testing" + "time" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stdstaking "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" + tmtypes "github.com/tendermint/tendermint/types" ) // GenesisState of the blockchain is represented here as a map of raw json @@ -19,3 +32,92 @@ type GenesisState map[string]json.RawMessage func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { return ModuleBasics.DefaultGenesis(cdc) } + +// GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts +// that also act as delegators. +func GenesisStateWithSingleValidator(t *testing.T, app *SimApp) GenesisState { + pk := ed25519.GenPrivKey().PubKey() + pubKey, _ := cryptocodec.ToTmPubKeyInterface(pk) + + // create validator set with single validator + validator := tmtypes.NewValidator(pubKey, 1) + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + + // generate genesis account + senderPrivKey := secp256k1.GenPrivKey() + acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + balances := []banktypes.Balance{ + { + Address: acc.GetAddress().String(), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), + }, + } + + genesisState := NewDefaultGenesisState(app.appCodec) + genesisState = genesisStateWithValSet(t, app, genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...) + + return genesisState +} + +func genesisStateWithValSet(t *testing.T, + app *SimApp, genesisState GenesisState, + valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, + balances ...banktypes.Balance, +) GenesisState { + // set genesis accounts + authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) + genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) + + validators := make([]stdstaking.Validator, 0, len(valSet.Validators)) + delegations := make([]stdstaking.Delegation, 0, len(valSet.Validators)) + + bondAmt := sdk.DefaultPowerReduction + + 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 := stdstaking.Validator{ + OperatorAddress: sdk.ValAddress(val.Address).String(), + ConsensusPubkey: pkAny, + Jailed: false, + Status: stdstaking.Bonded, + Tokens: bondAmt, + DelegatorShares: sdk.OneDec(), + Description: stdstaking.Description{}, + UnbondingHeight: int64(0), + UnbondingTime: time.Unix(0, 0).UTC(), + Commission: stdstaking.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + } + validators = append(validators, validator) + delegations = append(delegations, stdstaking.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec(), false)) + + } + // set validators and delegations + stakingGenesis := stdstaking.NewGenesisState(stdstaking.DefaultParams(), validators, delegations) + genesisState[stdstaking.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) + + totalSupply := sdk.NewCoins() + for _, b := range balances { + // add genesis acc tokens to total supply + totalSupply = totalSupply.Add(b.Coins...) + } + + for range delegations { + // add delegated tokens to total supply + totalSupply = totalSupply.Add(sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)) + } + + // add bonded amount to bonded pool module account + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(stdstaking.BondedPoolName).String(), + Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)}, + }) + + // update total supply + bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) + genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) + + return genesisState +} diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index 122569e79af..67c5db7ff9d 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -147,7 +147,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand( genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome), - genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd(simapp.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome), genutilcli.ValidateGenesisCmd(simapp.ModuleBasics), AddGenesisAccountCmd(simapp.DefaultNodeHome), diff --git a/simapp/simd/cmd/testnet.go b/simapp/simd/cmd/testnet.go index 150dd895ca0..ad9b1923180 100644 --- a/simapp/simd/cmd/testnet.go +++ b/simapp/simd/cmd/testnet.go @@ -213,7 +213,6 @@ func InitTestnet( sdk.NewCoin(sdk.DefaultBondDenom, valTokens), stakingtypes.NewDescription(nodeDirName, "", "", "", ""), stakingtypes.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()), - sdk.OneInt(), ) if err != nil { return err diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index c428fdb2e2b..96894033015 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -19,9 +19,10 @@ import ( bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + // codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/simapp/helpers" sdk "github.com/cosmos/cosmos-sdk/types" @@ -30,7 +31,7 @@ import ( 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" + // stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // DefaultConsensusParams defines the default Tendermint consensus params used in @@ -85,62 +86,38 @@ func Setup(isCheckTx bool) *SimApp { 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 SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { - 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)) +func SetupWithValSet(t *testing.T, _ bool) *SimApp { + t.Helper() - bondAmt := sdk.NewInt(1000000) + pk := ed25519.GenPrivKey().PubKey() + pubKey, err := cryptocodec.ToTmPubKeyInterface(pk) + require.NoError(t, err) - 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())) + // create validator set with single validator + validator := tmtypes.NewValidator(pubKey, 1) + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + // generate genesis account + senderPrivKey := secp256k1.GenPrivKey() + acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + balance := banktypes.Balance{ + Address: acc.GetAddress().String(), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), } - // set validators and delegations - stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) - genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) + app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, balance) - 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(sdk.DefaultBondDenom, bondAmt))...) - } + return app +} - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)}, - }) +// 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 SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { + t.Helper() - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) - genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) + app, genesisState := setup(true, 5) + genesisState = genesisStateWithValSet(t, app, genesisState, valSet, genAccs, balances...) stateBytes, err := json.MarshalIndent(genesisState, "", " ") require.NoError(t, err) diff --git a/testutil/network/network.go b/testutil/network/network.go index d4214644c49..6f5891fdc88 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -316,7 +316,6 @@ func New(t *testing.T, cfg Config) *Network { sdk.NewCoin(cfg.BondDenom, cfg.BondedTokens), stakingtypes.NewDescription(nodeDirName, "", "", "", ""), stakingtypes.NewCommissionRates(commission, sdk.OneDec(), sdk.OneDec()), - sdk.OneInt(), ) require.NoError(t, err) diff --git a/x/auth/client/rest/decode.go b/x/auth/client/rest/decode.go deleted file mode 100644 index 725991fd61a..00000000000 --- a/x/auth/client/rest/decode.go +++ /dev/null @@ -1,90 +0,0 @@ -package rest - -import ( - "encoding/base64" - "fmt" - "io" - "net/http" - - "github.com/cosmos/cosmos-sdk/client" - clienttx "github.com/cosmos/cosmos-sdk/client/tx" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx" - "github.com/cosmos/cosmos-sdk/x/auth/signing" -) - -type ( - // DecodeReq defines a tx decoding request. - DecodeReq struct { - Tx string `json:"tx"` - } - - // DecodeResp defines a tx decoding response. - DecodeResp legacytx.StdTx -) - -// DecodeTxRequestHandlerFn returns the decode tx REST handler. In particular, -// it takes base64-decoded bytes, decodes it from the Amino wire protocol, -// and responds with a json-formatted transaction. -func DecodeTxRequestHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req DecodeReq - - body, err := io.ReadAll(r.Body) - if rest.CheckBadRequestError(w, err) { - return - } - - // NOTE: amino is used intentionally here, don't migrate it - err = clientCtx.LegacyAmino.UnmarshalJSON(body, &req) - if rest.CheckBadRequestError(w, err) { - return - } - - txBytes, err := base64.StdEncoding.DecodeString(req.Tx) - if rest.CheckBadRequestError(w, err) { - return - } - - stdTx, err := convertToStdTx(w, clientCtx, txBytes) - if err != nil { - // Error is already returned by convertToStdTx. - return - } - - response := DecodeResp(stdTx) - - err = checkAminoMarshalError(clientCtx, response, "/cosmos/tx/v1beta1/txs/decode") - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - - return - } - - rest.PostProcessResponse(w, clientCtx, response) - } -} - -// convertToStdTx converts tx proto binary bytes retrieved from Tendermint into -// a StdTx. Returns the StdTx, as well as a flag denoting if the function -// successfully converted or not. -func convertToStdTx(w http.ResponseWriter, clientCtx client.Context, txBytes []byte) (legacytx.StdTx, error) { - txI, err := clientCtx.TxConfig.TxDecoder()(txBytes) - if rest.CheckBadRequestError(w, err) { - return legacytx.StdTx{}, err - } - - tx, ok := txI.(signing.Tx) - if !ok { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("%+v is not backwards compatible with %T", tx, legacytx.StdTx{})) - return legacytx.StdTx{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expected %T, got %T", (signing.Tx)(nil), txI) - } - - stdTx, err := clienttx.ConvertTxToStdTx(clientCtx.LegacyAmino, tx) - if rest.CheckBadRequestError(w, err) { - return legacytx.StdTx{}, err - } - - return stdTx, nil -} diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go deleted file mode 100644 index 812b4cd4bc1..00000000000 --- a/x/auth/client/rest/query.go +++ /dev/null @@ -1,218 +0,0 @@ -package rest - -import ( - "fmt" - "net/http" - "strconv" - "strings" - - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - clientrest "github.com/cosmos/cosmos-sdk/client/rest" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/cosmos/cosmos-sdk/x/auth/types" - genutilrest "github.com/cosmos/cosmos-sdk/x/genutil/client/rest" -) - -// QueryAccountRequestHandlerFn is the query accountREST Handler. -func QueryAccountRequestHandlerFn(storeName string, clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - bech32addr := vars["address"] - - addr, err := sdk.AccAddressFromBech32(bech32addr) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - accGetter := types.AccountRetriever{} - - account, height, err := accGetter.GetAccountWithHeight(clientCtx, addr) - if err != nil { - // TODO: Handle more appropriately based on the error type. - // Ref: https://github.com/cosmos/cosmos-sdk/issues/4923 - if err := accGetter.EnsureExists(clientCtx, addr); err != nil { - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, types.BaseAccount{}) - return - } - - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, account) - } -} - -// QueryTxsRequestHandlerFn implements a REST handler that searches for transactions. -// Genesis transactions are returned if the height parameter is set to zero, -// otherwise the transactions are searched for by events. -func QueryTxsRequestHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - err := r.ParseForm() - if err != nil { - rest.WriteErrorResponse( - w, http.StatusBadRequest, - fmt.Sprintf("failed to parse query parameters: %s", err), - ) - return - } - - // if the height query param is set to zero, query for genesis transactions - heightStr := r.FormValue("height") - if heightStr != "" { - if height, err := strconv.ParseInt(heightStr, 10, 64); err == nil && height == 0 { - genutilrest.QueryGenesisTxs(clientCtx, w) - return - } - } - - var ( - events []string - txs []sdk.TxResponse - page, limit int - ) - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - if len(r.Form) == 0 { - rest.PostProcessResponseBare(w, clientCtx, txs) - return - } - - events, page, limit, err = rest.ParseHTTPArgs(r) - if rest.CheckBadRequestError(w, err) { - return - } - - searchResult, err := authtx.QueryTxsByEvents(clientCtx, events, page, limit, "") - if rest.CheckInternalServerError(w, err) { - return - } - - for _, txRes := range searchResult.Txs { - packStdTxResponse(w, clientCtx, txRes) - } - - err = checkAminoMarshalError(clientCtx, searchResult, "/cosmos/tx/v1beta1/txs") - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - - return - } - - rest.PostProcessResponseBare(w, clientCtx, searchResult) - } -} - -// 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 - } - - output, err := authtx.QueryTx(clientCtx, hashHexStr) - if err != nil { - if strings.Contains(err.Error(), hashHexStr) { - rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) - return - } - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - - err = packStdTxResponse(w, clientCtx, output) - if err != nil { - // Error is already returned by packStdTxResponse. - return - } - - if output.Empty() { - rest.WriteErrorResponse(w, http.StatusNotFound, fmt.Sprintf("no transaction found with hash %s", hashHexStr)) - } - - err = checkAminoMarshalError(clientCtx, output, "/cosmos/tx/v1beta1/txs/{txhash}") - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - - return - } - - rest.PostProcessResponseBare(w, clientCtx, output) - } -} - -func queryParamsHandler(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParams) - res, height, err := clientCtx.QueryWithData(route, nil) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -// packStdTxResponse takes a sdk.TxResponse, converts the Tx into a StdTx, and -// packs the StdTx again into the sdk.TxResponse Any. Amino then takes care of -// seamlessly JSON-outputting the Any. -func packStdTxResponse(w http.ResponseWriter, clientCtx client.Context, txRes *sdk.TxResponse) error { - // We just unmarshalled from Tendermint, we take the proto Tx's raw - // bytes, and convert them into a StdTx to be displayed. - txBytes := txRes.Tx.Value - stdTx, err := convertToStdTx(w, clientCtx, txBytes) - if err != nil { - return err - } - - // Pack the amino stdTx into the TxResponse's Any. - txRes.Tx = codectypes.UnsafePackAny(stdTx) - - return nil -} - -// checkAminoMarshalError checks if there are errors with marshalling non-amino -// txs with amino. -func checkAminoMarshalError(ctx client.Context, resp interface{}, grpcEndPoint string) error { - // LegacyAmino used intentionally here to handle the SignMode errors - marshaler := ctx.LegacyAmino - - _, err := marshaler.MarshalJSON(resp) - if err != nil { - // If there's an unmarshalling error, we assume that it's because we're - // using amino to unmarshal a non-amino tx. - return fmt.Errorf("this transaction cannot be displayed via legacy REST endpoints, because it does not support"+ - " Amino serialization. Please either use CLI, gRPC, gRPC-gateway, or directly query the Tendermint RPC"+ - " endpoint to query this transaction. The new REST endpoint (via gRPC-gateway) is %s. Please also see the"+ - "REST endpoints migration guide at %s for more info", grpcEndPoint, clientrest.DeprecationURL) - } - - return nil -} diff --git a/x/auth/client/rest/rest.go b/x/auth/client/rest/rest.go deleted file mode 100644 index 03b7564acef..00000000000 --- a/x/auth/client/rest/rest.go +++ /dev/null @@ -1,34 +0,0 @@ -package rest - -import ( - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/rest" -) - -// REST query and parameter values -const ( - MethodGet = "GET" -) - -// RegisterRoutes registers the auth module REST routes. -func RegisterRoutes(clientCtx client.Context, rtr *mux.Router, storeName string) { - r := rest.WithHTTPDeprecationHeaders(rtr) - r.HandleFunc( - "/auth/accounts/{address}", QueryAccountRequestHandlerFn(storeName, clientCtx), - ).Methods(MethodGet) - - r.HandleFunc( - "/auth/params", - queryParamsHandler(clientCtx), - ).Methods(MethodGet) -} - -// RegisterTxRoutes registers all transaction routes on the provided router. -func RegisterTxRoutes(clientCtx client.Context, rtr *mux.Router) { - r := rest.WithHTTPDeprecationHeaders(rtr) - r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(clientCtx)).Methods("GET") - r.HandleFunc("/txs", QueryTxsRequestHandlerFn(clientCtx)).Methods("GET") - r.HandleFunc("/txs/decode", DecodeTxRequestHandlerFn(clientCtx)).Methods("POST") -} diff --git a/x/auth/module.go b/x/auth/module.go index ef13f74a590..c30a7650bad 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/x/auth/client/rest" "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/simulation" "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -62,7 +61,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterRESTRoutes registers the REST routes for the auth module. func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(clientCtx, rtr, types.StoreKey) + // rest.RegisterRoutes(clientCtx, rtr, types.StoreKey) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the auth module. diff --git a/x/bank/client/rest/grpc_query_test.go b/x/bank/client/rest/grpc_query_test.go index c5d3d74dada..b9b612c8cf4 100644 --- a/x/bank/client/rest/grpc_query_test.go +++ b/x/bank/client/rest/grpc_query_test.go @@ -3,268 +3,3 @@ package rest_test -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -func (s *IntegrationTestSuite) TestTotalSupplyGRPCHandler() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - headers map[string]string - respType proto.Message - expected proto.Message - }{ - { - "test GRPC total supply", - fmt.Sprintf("%s/cosmos/bank/v1beta1/supply", baseURL), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - &types.QueryTotalSupplyResponse{}, - &types.QueryTotalSupplyResponse{ - Supply: sdk.NewCoins( - sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens), - sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))), - ), - Pagination: &query.PageResponse{ - Total: 2, - }, - }, - }, - { - "GRPC total supply of a specific denom", - fmt.Sprintf("%s/cosmos/bank/v1beta1/supply/%s", baseURL, s.cfg.BondDenom), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - &types.QuerySupplyOfResponse{}, - &types.QuerySupplyOfResponse{ - Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))), - }, - }, - { - "Query for `height` > 1", - fmt.Sprintf("%s/cosmos/bank/v1beta1/supply/%s", baseURL, s.cfg.BondDenom), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "2", - }, - &types.QuerySupplyOfResponse{}, - &types.QuerySupplyOfResponse{ - Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(20))), - }, - }, - { - "Query params shouldn't be considered as height", - fmt.Sprintf("%s/cosmos/bank/v1beta1/supply/%s?height=2", baseURL, s.cfg.BondDenom), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - &types.QuerySupplyOfResponse{}, - &types.QuerySupplyOfResponse{ - Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))), - }, - }, - { - "GRPC total supply of a bogus denom", - fmt.Sprintf("%s/cosmos/bank/v1beta1/supply/foobar", baseURL), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - &types.QuerySupplyOfResponse{}, - &types.QuerySupplyOfResponse{ - Amount: sdk.NewCoin("foobar", sdk.ZeroInt()), - }, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) - s.Require().NoError(err) - - s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) - s.Require().Equal(tc.expected.String(), tc.respType.String()) - }) - } -} - -func (s *IntegrationTestSuite) TestDenomMetadataGRPCHandler() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - headers map[string]string - expErr bool - respType proto.Message - expected proto.Message - }{ - { - "test GRPC client metadata", - fmt.Sprintf("%s/cosmos/bank/v1beta1/denoms_metadata", baseURL), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - false, - &types.QueryDenomsMetadataResponse{}, - &types.QueryDenomsMetadataResponse{ - Metadatas: []types.Metadata{ - { - Name: "Cosmos Hub Atom", - Symbol: "ATOM", - Description: "The native staking token of the Cosmos Hub.", - DenomUnits: []*types.DenomUnit{ - { - Denom: "uatom", - Exponent: 0, - Aliases: []string{"microatom"}, - }, - { - Denom: "atom", - Exponent: 6, - Aliases: []string{"ATOM"}, - }, - }, - Base: "uatom", - Display: "atom", - }, - }, - Pagination: &query.PageResponse{Total: 1}, - }, - }, - { - "GRPC client metadata of a specific denom", - fmt.Sprintf("%s/cosmos/bank/v1beta1/denoms_metadata/uatom", baseURL), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - false, - &types.QueryDenomMetadataResponse{}, - &types.QueryDenomMetadataResponse{ - Metadata: types.Metadata{ - Name: "Cosmos Hub Atom", - Symbol: "ATOM", - Description: "The native staking token of the Cosmos Hub.", - DenomUnits: []*types.DenomUnit{ - { - Denom: "uatom", - Exponent: 0, - Aliases: []string{"microatom"}, - }, - { - Denom: "atom", - Exponent: 6, - Aliases: []string{"ATOM"}, - }, - }, - Base: "uatom", - Display: "atom", - }, - }, - }, - { - "GRPC client metadata of a bogus denom", - fmt.Sprintf("%s/cosmos/bank/v1beta1/denoms_metadata/foobar", baseURL), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - true, - &types.QueryDenomMetadataResponse{}, - &types.QueryDenomMetadataResponse{ - Metadata: types.Metadata{ - DenomUnits: []*types.DenomUnit{}, - }, - }, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) - s.Require().NoError(err) - - if tc.expErr { - s.Require().Error(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) - } else { - s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) - s.Require().Equal(tc.expected.String(), tc.respType.String()) - } - }) - } -} - -func (s *IntegrationTestSuite) TestBalancesGRPCHandler() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - respType proto.Message - expected proto.Message - }{ - { - "gRPC total account balance", - fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", baseURL, val.Address.String()), - &types.QueryAllBalancesResponse{}, - &types.QueryAllBalancesResponse{ - Balances: sdk.NewCoins( - sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens), - sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)), - ), - Pagination: &query.PageResponse{ - Total: 2, - }, - }, - }, - { - "gPRC account balance of a denom", - fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s/by_denom?denom=%s", baseURL, val.Address.String(), s.cfg.BondDenom), - &types.QueryBalanceResponse{}, - &types.QueryBalanceResponse{ - Balance: &sdk.Coin{ - Denom: s.cfg.BondDenom, - Amount: s.cfg.StakingTokens.Sub(s.cfg.BondedTokens), - }, - }, - }, - { - "gPRC account balance of a bogus denom", - fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s/by_denom?denom=foobar", baseURL, val.Address.String()), - &types.QueryBalanceResponse{}, - &types.QueryBalanceResponse{ - Balance: &sdk.Coin{ - Denom: "foobar", - Amount: sdk.NewInt(0), - }, - }, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) - s.Require().Equal(tc.expected.String(), tc.respType.String()) - }) - } -} diff --git a/x/bank/client/rest/query_test.go b/x/bank/client/rest/query_test.go index dbf96844267..b9b612c8cf4 100644 --- a/x/bank/client/rest/query_test.go +++ b/x/bank/client/rest/query_test.go @@ -3,197 +3,3 @@ package rest_test -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/suite" - - "github.com/cosmos/cosmos-sdk/testutil/network" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -type IntegrationTestSuite struct { - suite.Suite - - cfg network.Config - network *network.Network -} - -func (s *IntegrationTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - - cfg := network.DefaultConfig() - genesisState := cfg.GenesisState - cfg.NumValidators = 1 - - var bankGenesis types.GenesisState - s.Require().NoError(cfg.Codec.UnmarshalJSON(genesisState[types.ModuleName], &bankGenesis)) - - bankGenesis.DenomMetadata = []types.Metadata{ - { - Name: "Cosmos Hub Atom", - Symbol: "ATOM", - Description: "The native staking token of the Cosmos Hub.", - DenomUnits: []*types.DenomUnit{ - { - Denom: "uatom", - Exponent: 0, - Aliases: []string{"microatom"}, - }, - { - Denom: "atom", - Exponent: 6, - Aliases: []string{"ATOM"}, - }, - }, - Base: "uatom", - Display: "atom", - }, - } - - bankGenesisBz, err := cfg.Codec.MarshalJSON(&bankGenesis) - s.Require().NoError(err) - genesisState[types.ModuleName] = bankGenesisBz - cfg.GenesisState = genesisState - - s.cfg = cfg - s.network = network.New(s.T(), cfg) - - _, err = s.network.WaitForHeight(2) - s.Require().NoError(err) -} - -func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - s.network.Cleanup() -} - -func (s *IntegrationTestSuite) TestQueryBalancesRequestHandlerFn() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - expHeight int64 - respType fmt.Stringer - expected fmt.Stringer - }{ - { - "total account balance", - fmt.Sprintf("%s/bank/balances/%s", baseURL, val.Address), - -1, - &sdk.Coins{}, - sdk.NewCoins( - sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens), - sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)), - ), - }, - { - "total account balance with height", - fmt.Sprintf("%s/bank/balances/%s?height=1", baseURL, val.Address), - 1, - &sdk.Coins{}, - sdk.NewCoins( - sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens), - sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)), - ), - }, - { - "total account balance of a specific denom", - fmt.Sprintf("%s/bank/balances/%s?denom=%s", baseURL, val.Address, s.cfg.BondDenom), - -1, - &sdk.Coin{}, - sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)), - }, - { - "total account balance of a bogus denom", - fmt.Sprintf("%s/bank/balances/%s?denom=foobar", baseURL, val.Address), - -1, - &sdk.Coin{}, - sdk.NewCoin("foobar", sdk.ZeroInt()), - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - respJSON, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - resp := rest.ResponseWithHeight{} - err = val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &resp) - s.Require().NoError(err) - - // Check height. - if tc.expHeight >= 0 { - s.Require().Equal(resp.Height, tc.expHeight) - } else { - // To avoid flakiness, just test that height is positive. - s.Require().Greater(resp.Height, int64(0)) - } - - // Check result. - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(resp.Result, tc.respType)) - s.Require().Equal(tc.expected.String(), tc.respType.String()) - }) - } -} - -func (s *IntegrationTestSuite) TestTotalSupplyHandlerFn() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - respType fmt.Stringer - expected fmt.Stringer - }{ - { - "total supply", - fmt.Sprintf("%s/bank/total?height=1", baseURL), - &types.QueryTotalSupplyResponse{}, - &types.QueryTotalSupplyResponse{ - Supply: sdk.NewCoins( - sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens), - sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))), - ), - Pagination: &query.PageResponse{Total: 2}, - }, - }, - { - "total supply of a specific denom", - fmt.Sprintf("%s/bank/total/%s?height=1", baseURL, s.cfg.BondDenom), - &sdk.Coin{}, - sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))), - }, - { - "total supply of a bogus denom", - fmt.Sprintf("%s/bank/total/foobar?height=1", baseURL), - &sdk.Coin{}, - sdk.NewCoin("foobar", sdk.ZeroInt()), - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - bz, err := rest.ParseResponseWithHeight(val.ClientCtx.LegacyAmino, resp) - s.Require().NoError(err) - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(bz, tc.respType)) - s.Require().Equal(tc.expected.String(), tc.respType.String()) - }) - } -} - -func TestIntegrationTestSuite(t *testing.T) { - suite.Run(t, new(IntegrationTestSuite)) -} diff --git a/x/bank/client/rest/tx_test.go b/x/bank/client/rest/tx_test.go index faeda7a0d48..b9b612c8cf4 100644 --- a/x/bank/client/rest/tx_test.go +++ b/x/bank/client/rest/tx_test.go @@ -3,106 +3,3 @@ package rest_test -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/testutil/network" - "github.com/cosmos/cosmos-sdk/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - bankrest "github.com/cosmos/cosmos-sdk/x/bank/client/rest" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -func (s *IntegrationTestSuite) TestCoinSend() { - val := s.network.Validators[0] - - account, err := getAccountInfo(val) - s.Require().NoError(err) - - sendReq := generateSendReq( - account, - types.Coins{types.NewCoin(s.cfg.BondDenom, types.TokensFromConsensusPower(1, sdk.DefaultPowerReduction))}, - ) - - stdTx, err := submitSendReq(val, sendReq) - s.Require().NoError(err) - - s.Require().Nil(stdTx.Signatures) - s.Require().Equal([]types.Msg{ - &banktypes.MsgSend{ - FromAddress: account.GetAddress().String(), - ToAddress: account.GetAddress().String(), - Amount: sendReq.Amount, - }, - }, stdTx.GetMsgs()) -} - -func submitSendReq(val *network.Validator, req bankrest.SendReq) (legacytx.StdTx, error) { - url := fmt.Sprintf("%s/bank/accounts/%s/transfers", val.APIAddress, val.Address) - - // NOTE: this uses amino explicitly, don't migrate it! - bz, err := val.ClientCtx.LegacyAmino.MarshalJSON(req) - if err != nil { - return legacytx.StdTx{}, errors.Wrap(err, "error encoding SendReq to json") - } - - res, err := rest.PostRequest(url, "application/json", bz) - if err != nil { - return legacytx.StdTx{}, err - } - - var tx legacytx.StdTx - // NOTE: this uses amino explicitly, don't migrate it! - err = val.ClientCtx.LegacyAmino.UnmarshalJSON(res, &tx) - if err != nil { - return legacytx.StdTx{}, errors.Wrap(err, "error unmarshaling to StdTx SendReq response") - } - - return tx, nil -} - -func generateSendReq(from authtypes.AccountI, amount types.Coins) bankrest.SendReq { - baseReq := rest.NewBaseReq( - from.GetAddress().String(), - "someMemo", - "some-id", - "10000", - fmt.Sprintf("%f", 1.0), - from.GetAccountNumber(), - from.GetSequence(), - types.NewCoins(), - nil, - false, - ) - - return bankrest.SendReq{ - BaseReq: baseReq, - Amount: amount, - } -} - -func getAccountInfo(val *network.Validator) (authtypes.AccountI, error) { - url := fmt.Sprintf("%s/auth/accounts/%s", val.APIAddress, val.Address) - - resp, err := rest.GetRequest(url) - if err != nil { - return nil, err - } - - bz, err := rest.ParseResponseWithHeight(val.ClientCtx.LegacyAmino, resp) - if err != nil { - return nil, err - } - - var acc authtypes.AccountI - err = val.ClientCtx.LegacyAmino.UnmarshalJSON(bz, &acc) - if err != nil { - return nil, err - } - - return acc, nil -} diff --git a/x/distribution/README.md b/x/distribution/README.md new file mode 100644 index 00000000000..2c542da7161 --- /dev/null +++ b/x/distribution/README.md @@ -0,0 +1,7 @@ + + +# Distribution + +* [Distribution](spec/README.md) - Fee distribution, and staking token provision distribution. diff --git a/x/distribution/client/cli/query.go b/x/distribution/client/cli/query.go index aa087f5f8b2..50629a0fcc3 100644 --- a/x/distribution/client/cli/query.go +++ b/x/distribution/client/cli/query.go @@ -12,6 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/distribution/types" + sdkdistr "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // GetQueryCmd returns the cli query commands for this module @@ -31,6 +32,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryValidatorSlashes(), GetCmdQueryDelegatorRewards(), GetCmdQueryCommunityPool(), + GetCmdQueryTokenizeShareRecordReward(), ) return distQueryCmd @@ -260,7 +262,7 @@ $ %s query distribution rewards %s1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p %s1ggh res, err := queryClient.DelegationRewards( ctx, - &types.QueryDelegationRewardsRequest{DelegatorAddress: delegatorAddr.String(), ValidatorAddress: validatorAddr.String()}, + &sdkdistr.QueryDelegationRewardsRequest{DelegatorAddress: delegatorAddr.String(), ValidatorAddress: validatorAddr.String()}, ) if err != nil { return err @@ -319,3 +321,48 @@ $ %s query distribution community-pool flags.AddQueryFlagsToCmd(cmd) return cmd } + +// GetCmdQueryTokenizeShareRecordReward implements the query tokenize share record rewards +func GetCmdQueryTokenizeShareRecordReward() *cobra.Command { + bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix() + + cmd := &cobra.Command{ + Use: "tokenize-share-record-rewards [owner]", + Args: cobra.ExactArgs(1), + Short: "Query distribution tokenize share record rewards", + Long: strings.TrimSpace( + fmt.Sprintf(`Query the query tokenize share record rewards. + +Example: +$ %s query distribution tokenize-share-record-rewards %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj +`, + version.AppName, bech32PrefixAccAddr, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + ownerAddr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + res, err := queryClient.TokenizeShareRecordReward( + cmd.Context(), + &types.QueryTokenizeShareRecordRewardRequest{OwnerAddress: ownerAddr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index 94fac599982..a2a95a566cf 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "strconv" "strings" "github.com/spf13/cobra" @@ -41,6 +42,8 @@ func NewTxCmd() *cobra.Command { NewWithdrawAllRewardsCmd(), NewSetWithdrawAddrCmd(), NewFundCommunityPoolCmd(), + NewWithdrawTokenizeShareRecordRewardCmd(), + NewWithdrawAllTokenizeShareRecordRewardCmd(), ) return distTxCmd @@ -169,14 +172,11 @@ $ %[1]s tx distribution withdraw-all-rewards --from mykey } msg := types.NewMsgWithdrawDelegatorReward(delAddr, val) - if err := msg.ValidateBasic(); err != nil { - return err - } msgs = append(msgs, msg) } chunkSize, _ := cmd.Flags().GetInt(FlagMaxMessagesPerTx) - if clientCtx.BroadcastMode != flags.BroadcastBlock && chunkSize > 0 { + if !clientCtx.GenerateOnly && clientCtx.BroadcastMode != flags.BroadcastBlock && chunkSize > 0 { return fmt.Errorf("cannot use broadcast mode %[1]s with %[2]s != 0", clientCtx.BroadcastMode, FlagMaxMessagesPerTx) } @@ -331,3 +331,72 @@ Where proposal.json contains: return cmd } + +// WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward for all owning TokenizeShareRecord +func NewWithdrawAllTokenizeShareRecordRewardCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "withdraw-all-tokenize-share-rewards", + Args: cobra.ExactArgs(0), + Short: "Withdraw reward for all owning TokenizeShareRecord", + Long: strings.TrimSpace( + fmt.Sprintf(`Withdraw reward for all owned TokenizeShareRecord + +Example: +$ %s tx distribution withdraw-tokenize-share-rewards --from mykey +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgWithdrawAllTokenizeShareRecordReward(clientCtx.GetFromAddress()) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// WithdrawTokenizeShareRecordReward defines a method to withdraw reward for an owning TokenizeShareRecord +func NewWithdrawTokenizeShareRecordRewardCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "withdraw-tokenize-share-rewards", + Args: cobra.ExactArgs(1), + Short: "Withdraw reward for an owning TokenizeShareRecord", + Long: strings.TrimSpace( + fmt.Sprintf(`Withdraw reward for an owned TokenizeShareRecord + +Example: +$ %s tx distribution withdraw-tokenize-share-rewards 1 --from mykey +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + recordID, err := strconv.Atoi(args[0]) + if err != nil { + return err + } + + msg := types.NewMsgWithdrawTokenizeShareRecordReward(clientCtx.GetFromAddress(), uint64(recordID)) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/distribution/client/common/common_test.go b/x/distribution/client/common/common_test.go index 6b3ecdd5cdf..ff9bb88d176 100644 --- a/x/distribution/client/common/common_test.go +++ b/x/distribution/client/common/common_test.go @@ -3,14 +3,15 @@ package common import ( "testing" + "github.com/cosmos/cosmos-sdk/codec/legacy" + "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/x/distribution/types" ) func TestQueryDelegationRewardsAddrValidation(t *testing.T) { - clientCtx := client.Context{}.WithLegacyAmino(types.ModuleCdc.LegacyAmino) + clientCtx := client.Context{}.WithLegacyAmino(legacy.Cdc) type args struct { delAddr string diff --git a/x/distribution/client/proposal_handler.go b/x/distribution/client/proposal_handler.go index 517f508bff6..6c5b0528e46 100644 --- a/x/distribution/client/proposal_handler.go +++ b/x/distribution/client/proposal_handler.go @@ -8,5 +8,6 @@ import ( // ProposalHandler is the community spend proposal handler. var ( + // ProposalHandler = govclient.NewProposalHandler(cli.GetCmdSubmitProposal) ProposalHandler = govclient.NewProposalHandler(cli.GetCmdSubmitProposal, rest.ProposalRESTHandler) ) diff --git a/x/distribution/client/testutil/cli_test.go b/x/distribution/client/testutil/cli_test.go index 1035ca75026..d7ab22d4152 100644 --- a/x/distribution/client/testutil/cli_test.go +++ b/x/distribution/client/testutil/cli_test.go @@ -1,18 +1,19 @@ -//go:build norace -// +build norace - package testutil import ( "testing" - "github.com/cosmos/cosmos-sdk/testutil/network" - "github.com/stretchr/testify/suite" ) func TestIntegrationTestSuite(t *testing.T) { - cfg := network.DefaultConfig() - cfg.NumValidators = 1 - suite.Run(t, NewIntegrationTestSuite(cfg)) + suite.Run(t, new(IntegrationTestSuite)) +} + +func TestGRPCQueryTestSuite(t *testing.T) { + suite.Run(t, new(GRPCQueryTestSuite)) +} + +func TestWithdrawAllSuite(t *testing.T) { + suite.Run(t, new(WithdrawAllTestSuite)) } diff --git a/x/distribution/client/testutil/grpc_query_suite.go b/x/distribution/client/testutil/grpc_query_suite.go new file mode 100644 index 00000000000..66e09133464 --- /dev/null +++ b/x/distribution/client/testutil/grpc_query_suite.go @@ -0,0 +1,467 @@ +package testutil + +import ( + "fmt" + + "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/suite" + + "github.com/cosmos/cosmos-sdk/testutil" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/cosmos/cosmos-sdk/types/rest" + "github.com/cosmos/cosmos-sdk/x/distribution/types" +) + +type GRPCQueryTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func (s *GRPCQueryTestSuite) SetupSuite() { + s.T().Log("setting up integration test suite") + + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + s.cfg = cfg + + var err error + s.network = network.New(s.T(), cfg) + s.Require().NoError(err) + + _, err = s.network.WaitForHeight(1) + s.Require().NoError(err) +} + +// TearDownSuite cleans up the curret test network after _each_ test. +func (s *GRPCQueryTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite1") + s.network.Cleanup() +} + +func (s *GRPCQueryTestSuite) TestQueryParamsGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + respType proto.Message + expected proto.Message + }{ + { + "gRPC request params", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/params", baseURL), + &types.QueryParamsResponse{}, + &types.QueryParamsResponse{ + Params: types.DefaultParams(), + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := rest.GetRequest(tc.url) + s.Run(tc.name, func() { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected, tc.respType) + }) + } +} + +func (s *GRPCQueryTestSuite) TestQueryOutstandingRewardsGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + rewards, err := sdk.ParseDecCoins("19.6stake") + s.Require().NoError(err) + + testCases := []struct { + name string + url string + headers map[string]string + expErr bool + respType proto.Message + expected proto.Message + }{ + { + "gRPC request params with wrong validator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/outstanding_rewards", baseURL, "wrongAddress"), + map[string]string{}, + true, + &types.QueryValidatorOutstandingRewardsResponse{}, + &types.QueryValidatorOutstandingRewardsResponse{}, + }, + { + "gRPC request params valid address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/outstanding_rewards", baseURL, val.ValAddress.String()), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "2", + }, + false, + &types.QueryValidatorOutstandingRewardsResponse{}, + &types.QueryValidatorOutstandingRewardsResponse{ + Rewards: types.ValidatorOutstandingRewards{ + Rewards: rewards, + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + s.Run(tc.name, func() { + if tc.expErr { + s.Require().Error(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + } else { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + } + }) + } +} + +func (s *GRPCQueryTestSuite) TestQueryValidatorCommissionGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + commission, err := sdk.ParseDecCoins("9.8stake") + s.Require().NoError(err) + + testCases := []struct { + name string + url string + headers map[string]string + expErr bool + respType proto.Message + expected proto.Message + }{ + { + "gRPC request params with wrong validator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/commission", baseURL, "wrongAddress"), + map[string]string{}, + true, + &types.QueryValidatorCommissionResponse{}, + &types.QueryValidatorCommissionResponse{}, + }, + { + "gRPC request params valid address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/commission", baseURL, val.ValAddress.String()), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "2", + }, + false, + &types.QueryValidatorCommissionResponse{}, + &types.QueryValidatorCommissionResponse{ + Commission: types.ValidatorAccumulatedCommission{ + Commission: commission, + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + s.Run(tc.name, func() { + if tc.expErr { + s.Require().Error(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + } else { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + } + }) + } +} + +func (s *GRPCQueryTestSuite) TestQuerySlashesGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + expErr bool + respType proto.Message + expected proto.Message + }{ + { + "invalid validator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/slashes", baseURL, ""), + true, + &types.QueryValidatorSlashesResponse{}, + nil, + }, + { + "invalid start height", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/slashes?starting_height=%s&ending_height=%s", baseURL, val.ValAddress.String(), "-1", "3"), + true, + &types.QueryValidatorSlashesResponse{}, + nil, + }, + { + "invalid start height", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/slashes?starting_height=%s&ending_height=%s", baseURL, val.ValAddress.String(), "1", "-3"), + true, + &types.QueryValidatorSlashesResponse{}, + nil, + }, + { + "valid request get slashes", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/validators/%s/slashes?starting_height=%s&ending_height=%s", baseURL, val.ValAddress.String(), "1", "3"), + false, + &types.QueryValidatorSlashesResponse{}, + &types.QueryValidatorSlashesResponse{ + Pagination: &query.PageResponse{}, + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := rest.GetRequest(tc.url) + + s.Run(tc.name, func() { + if tc.expErr { + s.Require().Error(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + } else { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + } + }) + } +} + +func (s *GRPCQueryTestSuite) TestQueryDelegatorRewardsGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + rewards, err := sdk.ParseDecCoins("9.8stake") + s.Require().NoError(err) + + testCases := []struct { + name string + url string + headers map[string]string + expErr bool + respType proto.Message + expected proto.Message + }{ + { + "wrong delegator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/rewards", baseURL, "wrongDelegatorAddress"), + map[string]string{}, + true, + &types.QueryDelegationTotalRewardsResponse{}, + nil, + }, + { + "valid request", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/rewards", baseURL, val.Address.String()), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "2", + }, + false, + &types.QueryDelegationTotalRewardsResponse{}, + &types.QueryDelegationTotalRewardsResponse{ + Rewards: []types.DelegationDelegatorReward{ + types.NewDelegationDelegatorReward(val.ValAddress, rewards), + }, + Total: rewards, + }, + }, + { + "wrong validator address(specific validator rewards)", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/rewards/%s", baseURL, val.Address.String(), "wrongValAddress"), + map[string]string{}, + true, + &types.QueryDelegationTotalRewardsResponse{}, + nil, + }, + { + "valid request(specific validator rewards)", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/rewards/%s", baseURL, val.Address.String(), val.ValAddress.String()), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "2", + }, + false, + &types.QueryDelegationRewardsResponse{}, + &types.QueryDelegationRewardsResponse{ + Rewards: rewards, + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + + s.Run(tc.name, func() { + if tc.expErr { + s.Require().Error(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + } else { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + } + }) + } +} + +func (s *GRPCQueryTestSuite) TestQueryDelegatorValidatorsGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + expErr bool + respType proto.Message + expected proto.Message + }{ + { + "empty delegator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/validators", baseURL, ""), + true, + &types.QueryDelegatorValidatorsResponse{}, + nil, + }, + { + "wrong delegator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/validators", baseURL, "wrongDelegatorAddress"), + true, + &types.QueryDelegatorValidatorsResponse{}, + nil, + }, + { + "valid request", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/validators", baseURL, val.Address.String()), + false, + &types.QueryDelegatorValidatorsResponse{}, + &types.QueryDelegatorValidatorsResponse{ + Validators: []string{val.ValAddress.String()}, + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := rest.GetRequest(tc.url) + + s.Run(tc.name, func() { + if tc.expErr { + s.Require().Error(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + } else { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + } + }) + } +} + +func (s *GRPCQueryTestSuite) TestQueryWithdrawAddressGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + expErr bool + respType proto.Message + expected proto.Message + }{ + { + "empty delegator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/withdraw_address", baseURL, ""), + true, + &types.QueryDelegatorWithdrawAddressResponse{}, + nil, + }, + { + "wrong delegator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/withdraw_address", baseURL, "wrongDelegatorAddress"), + true, + &types.QueryDelegatorWithdrawAddressResponse{}, + nil, + }, + { + "valid request", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/withdraw_address", baseURL, val.Address.String()), + false, + &types.QueryDelegatorWithdrawAddressResponse{}, + &types.QueryDelegatorWithdrawAddressResponse{ + WithdrawAddress: val.Address.String(), + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := rest.GetRequest(tc.url) + + s.Run(tc.name, func() { + if tc.expErr { + s.Require().Error(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + } else { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + } + }) + } +} + +func (s *GRPCQueryTestSuite) TestQueryValidatorCommunityPoolGRPC() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + communityPool, err := sdk.ParseDecCoins("0.4stake") + s.Require().NoError(err) + + testCases := []struct { + name string + url string + headers map[string]string + expErr bool + respType proto.Message + expected proto.Message + }{ + { + "gRPC request params with wrong validator address", + fmt.Sprintf("%s/cosmos/distribution/v1beta1/community_pool", baseURL), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "2", + }, + false, + &types.QueryCommunityPoolResponse{}, + &types.QueryCommunityPoolResponse{ + Pool: communityPool, + }, + }, + } + + for _, tc := range testCases { + tc := tc + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + + s.Run(tc.name, func() { + if tc.expErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + } + }) + } +} diff --git a/x/distribution/client/testutil/suite.go b/x/distribution/client/testutil/suite.go index 3dcfca70aa6..f799506835e 100644 --- a/x/distribution/client/testutil/suite.go +++ b/x/distribution/client/testutil/suite.go @@ -29,13 +29,17 @@ func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { return &IntegrationTestSuite{cfg: cfg} } -// SetupTest creates a new network for _each_ integration test. We create a new +// SetupSuite creates a new network for _each_ integration test. We create a new // network for each test because there are some state modifications that are // needed to be made in order to make useful queries. However, we don't want // these state changes to be present in other tests. -func (s *IntegrationTestSuite) SetupTest() { +func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + s.cfg = cfg + genesisState := s.cfg.GenesisState var mintData minttypes.GenesisState s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[minttypes.ModuleName], &mintData)) @@ -51,14 +55,15 @@ func (s *IntegrationTestSuite) SetupTest() { s.cfg.GenesisState = genesisState s.network = network.New(s.T(), s.cfg) + s.Require().NoError(err) _, err = s.network.WaitForHeight(1) s.Require().NoError(err) } -// TearDownTest cleans up the curret test network after _each_ test. -func (s *IntegrationTestSuite) TearDownTest() { - s.T().Log("tearing down integration test suite") +// TearDownSuite cleans up the curret test network after _each_ test. +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite1") s.network.Cleanup() } @@ -128,7 +133,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorOutstandingRewards() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - `{"rewards":[{"denom":"stake","amount":"1164.240000000000000000"}]}`, + `{"rewards":[{"denom":"stake","amount":"232.260000000000000000"}]}`, }, { "text output", @@ -139,7 +144,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorOutstandingRewards() { }, false, `rewards: -- amount: "1164.240000000000000000" +- amount: "232.260000000000000000" denom: stake`, }, } @@ -191,7 +196,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorCommission() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - `{"commission":[{"denom":"stake","amount":"464.520000000000000000"}]}`, + `{"commission":[{"denom":"stake","amount":"116.130000000000000000"}]}`, }, { "text output", @@ -202,7 +207,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorCommission() { }, false, `commission: -- amount: "464.520000000000000000" +- amount: "116.130000000000000000" denom: stake`, }, } @@ -344,7 +349,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegatorRewards() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - fmt.Sprintf(`{"rewards":[{"validator_address":"%s","reward":[{"denom":"stake","amount":"387.100000000000000000"}]}],"total":[{"denom":"stake","amount":"387.100000000000000000"}]}`, valAddr.String()), + fmt.Sprintf(`{"rewards":[{"validator_address":"%s","reward":[{"denom":"stake","amount":"193.550000000000000000"}]}],"total":[{"denom":"stake","amount":"193.550000000000000000"}]}`, valAddr.String()), }, { "json output (specific validator)", @@ -354,7 +359,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegatorRewards() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - `{"rewards":[{"denom":"stake","amount":"387.100000000000000000"}]}`, + `{"rewards":[{"denom":"stake","amount":"193.550000000000000000"}]}`, }, { "text output", @@ -366,11 +371,11 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegatorRewards() { false, fmt.Sprintf(`rewards: - reward: - - amount: "387.100000000000000000" + - amount: "193.550000000000000000" denom: stake validator_address: %s total: -- amount: "387.100000000000000000" +- amount: "193.550000000000000000" denom: stake`, valAddr.String()), }, { @@ -382,7 +387,7 @@ total: }, false, `rewards: -- amount: "387.100000000000000000" +- amount: "193.550000000000000000" denom: stake`, }, } @@ -684,7 +689,23 @@ func (s *IntegrationTestSuite) TestGetCmdSubmitProposal() { "deposit": -324foocoin }` + // fund some tokens to the community pool + args := []string{ + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5431))).String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + } + invalidPropFile := testutil.WriteToNewTempFile(s.T(), invalidProp) + cmd := cli.NewFundCommunityPoolCmd() + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) + s.Require().NoError(err) + + var txResp sdk.TxResponse + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) + s.Require().Equal(uint32(0), txResp.Code) validProp := fmt.Sprintf(`{ "title": "Community Pool Spend", @@ -708,7 +729,7 @@ func (s *IntegrationTestSuite) TestGetCmdSubmitProposal() { invalidPropFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -719,7 +740,7 @@ func (s *IntegrationTestSuite) TestGetCmdSubmitProposal() { validPropFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // sync mode as there are no funds yet + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -747,3 +768,46 @@ func (s *IntegrationTestSuite) TestGetCmdSubmitProposal() { }) } } + +func (s *IntegrationTestSuite) TestNewWithdrawAllTokenizeShareRecordRewardCmd() { + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + expectErr bool + expectedCode uint32 + respType proto.Message + }{ + { + "valid transaction of withdraw tokenize share record reward", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + }, + false, 0, &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.NewWithdrawAllTokenizeShareRecordRewardCmd() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err, out.String()) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + + txResp := tc.respType.(*sdk.TxResponse) + s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + } + }) + } +} diff --git a/x/distribution/client/testutil/withdraw_all_suite.go b/x/distribution/client/testutil/withdraw_all_suite.go new file mode 100644 index 00000000000..8562a353b5b --- /dev/null +++ b/x/distribution/client/testutil/withdraw_all_suite.go @@ -0,0 +1,121 @@ +package testutil + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" + "github.com/cosmos/cosmos-sdk/x/distribution/client/cli" + stakingcli "github.com/cosmos/cosmos-sdk/x/staking/client/cli" + "github.com/stretchr/testify/suite" +) + +type WithdrawAllTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func (s *WithdrawAllTestSuite) SetupSuite() { + cfg := network.DefaultConfig() + cfg.NumValidators = 2 + s.cfg = cfg + + s.T().Log("setting up integration test suite") + network := network.New(s.T(), s.cfg) + s.network = network + + _, err := s.network.WaitForHeight(1) + s.Require().NoError(err) +} + +// TearDownSuite cleans up the curret test network after _each_ test. +func (s *WithdrawAllTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} + +// This test requires multiple validators, if I add this test to `IntegrationTestSuite` by increasing +// `NumValidators` the existing tests are leading to non-determnism so created new suite for this test. +func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { + require := s.Require() + val := s.network.Validators[0] + val1 := s.network.Validators[1] + clientCtx := val.ClientCtx + + info, _, err := val.ClientCtx.Keyring.NewMnemonic("newAccount", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + require.NoError(err) + + pubkey := info.GetPubKey() + + newAddr := sdk.AccAddress(pubkey.Address()) + _, err = banktestutil.MsgSendExec( + val.ClientCtx, + val.Address, + newAddr, + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(2000))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + ) + require.NoError(err) + + // delegate 500 tokens to validator1 + args := []string{ + val.ValAddress.String(), + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(500)).String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + } + cmd := stakingcli.NewDelegateCmd() + _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + require.NoError(err) + + // delegate 500 tokens to validator2 + args = []string{ + val1.ValAddress.String(), + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(500)).String(), + fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + } + _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + require.NoError(err) + + args = []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), + fmt.Sprintf("--%s=1", cli.FlagMaxMessagesPerTx), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + } + cmd = cli.NewWithdrawAllRewardsCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + require.NoError(err) + // expect 2 transactions in the generated file when --max-msgs in a tx set 1. + s.Require().Equal(2, len(strings.Split(strings.Trim(out.String(), "\n"), "\n"))) + + args = []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), + fmt.Sprintf("--%s=2", cli.FlagMaxMessagesPerTx), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + } + cmd = cli.NewWithdrawAllRewardsCmd() + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + require.NoError(err) + // expect 1 transaction in the generated file when --max-msgs in a tx set 2, since there are only delegations. + s.Require().Equal(1, len(strings.Split(strings.Trim(out.String(), "\n"), "\n"))) +} diff --git a/x/distribution/handler.go b/x/distribution/handler.go index 279a6bf726d..7c870aae16b 100644 --- a/x/distribution/handler.go +++ b/x/distribution/handler.go @@ -1,6 +1,8 @@ package distribution import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/distribution/keeper" @@ -30,9 +32,14 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgFundCommunityPool: res, err := msgServer.FundCommunityPool(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - + case *types.MsgWithdrawTokenizeShareRecordReward: + res, err := msgServer.WithdrawTokenizeShareRecordReward(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgWithdrawAllTokenizeShareRecordReward: + res, err := msgServer.WithdrawAllTokenizeShareRecordReward(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized distribution message type: %T", msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized distribution message type: %T", msg) } } } @@ -44,7 +51,7 @@ func NewCommunityPoolSpendProposalHandler(k keeper.Keeper) govtypes.Handler { return keeper.HandleCommunityPoolSpendProposal(ctx, k, c) default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized distr proposal content type: %T", c) + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized distr proposal content type: %T", c) } } } diff --git a/x/distribution/handler_test.go b/x/distribution/handler_test.go new file mode 100644 index 00000000000..d4bb3faaf19 --- /dev/null +++ b/x/distribution/handler_test.go @@ -0,0 +1,27 @@ +package distribution_test + +import ( + "testing" + + simapp "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution" + "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +) + +// test msg registration +func TestWithdrawTokenizeShareRecordReward(t *testing.T) { + app := simapp.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + h := distribution.NewHandler(app.DistrKeeper) + delAddr1 = sdk.AccAddress(delPk1.Address()) + + res, err := h(ctx, &types.MsgWithdrawAllTokenizeShareRecordReward{ + OwnerAddress: delAddr1.String(), + }) + require.NoError(t, err) + require.NotNil(t, res) +} diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 02be99db4e6..5d5d7262d95 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" ) // AllocateTokens handles distribution of the collected fees @@ -81,22 +81,16 @@ func (k Keeper) AllocateTokens( // calculate fraction allocated to validators communityTax := k.GetCommunityTax(ctx) voteMultiplier := sdk.OneDec().Sub(proposerMultiplier).Sub(communityTax) - feeMultiplier := feesCollected.MulDecTruncate(voteMultiplier) // allocate tokens proportionally to voting power - // - // TODO: Consider parallelizing later - // - // Ref: https://github.com/cosmos/cosmos-sdk/pull/3099#discussion_r246276376 + // TODO consider parallelizing later, ref https://github.com/cosmos/cosmos-sdk/pull/3099#discussion_r246276376 for _, vote := range bondedVotes { validator := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) - // TODO: Consider micro-slashing for missing votes. - // - // Ref: https://github.com/cosmos/cosmos-sdk/issues/2525#issuecomment-430838701 + // TODO consider microslashing for missing votes. + // ref https://github.com/cosmos/cosmos-sdk/issues/2525#issuecomment-430838701 powerFraction := sdk.NewDec(vote.Validator.Power).QuoTruncate(sdk.NewDec(totalPreviousPower)) - reward := feeMultiplier.MulDecTruncate(powerFraction) - + reward := feesCollected.MulDecTruncate(voteMultiplier).MulDecTruncate(powerFraction) k.AllocateTokensToValidator(ctx, validator, reward) remaining = remaining.Sub(reward) } @@ -106,9 +100,8 @@ func (k Keeper) AllocateTokens( k.SetFeePool(ctx, feePool) } -// AllocateTokensToValidator allocate tokens to a particular validator, -// splitting according to commission. -func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) { +// AllocateTokensToValidator allocate tokens to a particular validator, splitting according to commission +func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val sdkstaking.ValidatorI, tokens sdk.DecCoins) { // split tokens between validator and delegators according to commission commission := tokens.MulDec(val.GetCommission()) shared := tokens.Sub(commission) @@ -138,7 +131,6 @@ func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val stakingtypes.Vali sdk.NewAttribute(types.AttributeKeyValidator, val.GetOperator().String()), ), ) - outstanding := k.GetValidatorOutstandingRewards(ctx, val.GetOperator()) outstanding.Rewards = outstanding.Rewards.Add(tokens...) k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), outstanding) diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index 5bcb8c1cff4..59d32a4386e 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -7,9 +7,11 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -47,6 +49,9 @@ func TestAllocateTokensToManyValidators(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + // reset fee pool + app.DistrKeeper.SetFeePool(ctx, distrtypes.InitialFeePool()) + addrs := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(1234)) valAddrs := simapp.ConvertAddrsToValAddrs(addrs) tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) @@ -83,7 +88,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) { require.NotNil(t, feeCollector) // fund fee collector - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, feeCollector.GetName(), fees)) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, feeCollector.GetName(), fees)) app.AccountKeeper.SetAccount(ctx, feeCollector) @@ -118,6 +123,9 @@ func TestAllocateTokensTruncation(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + // reset fee pool + app.DistrKeeper.SetFeePool(ctx, distrtypes.InitialFeePool()) + addrs := simapp.AddTestAddrs(app, ctx, 3, sdk.NewInt(1234)) valAddrs := simapp.ConvertAddrsToValAddrs(addrs) tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) @@ -163,7 +171,7 @@ func TestAllocateTokensTruncation(t *testing.T) { feeCollector := app.AccountKeeper.GetModuleAccount(ctx, types.FeeCollectorName) require.NotNil(t, feeCollector) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, feeCollector.GetName(), fees)) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, feeCollector.GetName(), fees)) app.AccountKeeper.SetAccount(ctx, feeCollector) diff --git a/x/distribution/keeper/common_test.go b/x/distribution/keeper/common_test.go index 807fd45c252..ffe1f0511bb 100644 --- a/x/distribution/keeper/common_test.go +++ b/x/distribution/keeper/common_test.go @@ -1,7 +1,7 @@ package keeper_test import ( - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index a9aa8b2520a..129f91d1508 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -4,8 +4,10 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + sdkdistr "github.com/cosmos/cosmos-sdk/x/distribution/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" ) // initialize starting info for a new delegation @@ -27,7 +29,7 @@ func (k Keeper) initializeDelegation(ctx sdk.Context, val sdk.ValAddress, del sd } // calculate the rewards accrued by a delegation between two periods -func (k Keeper) calculateDelegationRewardsBetween(ctx sdk.Context, val stakingtypes.ValidatorI, +func (k Keeper) calculateDelegationRewardsBetween(ctx sdk.Context, val sdkstaking.ValidatorI, startingPeriod, endingPeriod uint64, stake sdk.Dec, ) (rewards sdk.DecCoins) { // sanity check @@ -53,13 +55,13 @@ func (k Keeper) calculateDelegationRewardsBetween(ctx sdk.Context, val stakingty } // calculate the total rewards accrued by a delegation -func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val stakingtypes.ValidatorI, del stakingtypes.DelegationI, endingPeriod uint64) (rewards sdk.DecCoins) { +func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val sdkstaking.ValidatorI, del sdkstaking.DelegationI, endingPeriod uint64) (rewards sdk.DecCoins) { // fetch starting info for delegation startingInfo := k.GetDelegatorStartingInfo(ctx, del.GetValidatorAddr(), del.GetDelegatorAddr()) if startingInfo.Height == uint64(ctx.BlockHeight()) { // started this height, no rewards yet - return + return rewards } startingPeriod := startingInfo.PreviousPeriod @@ -136,10 +138,10 @@ func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val stakingtypes.Val return rewards } -func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val stakingtypes.ValidatorI, del stakingtypes.DelegationI) (sdk.Coins, error) { +func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val sdkstaking.ValidatorI, del sdkstaking.DelegationI) (sdk.Coins, error) { // check existence of delegator starting info if !k.HasDelegatorStartingInfo(ctx, del.GetValidatorAddr(), del.GetDelegatorAddr()) { - return nil, types.ErrEmptyDelegationDistInfo + return nil, sdkdistr.ErrEmptyDelegationDistInfo } // end current period and calculate rewards @@ -161,13 +163,13 @@ func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val stakingtypes.Vali ) } - // truncate reward dec coins, return remainder to community pool - finalRewards, remainder := rewards.TruncateDecimal() + // truncate coins, return remainder to community pool + coins, remainder := rewards.TruncateDecimal() // add coins to user account - if !finalRewards.IsZero() { + if !coins.IsZero() { withdrawAddr := k.GetDelegatorWithdrawAddr(ctx, del.GetDelegatorAddr()) - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, withdrawAddr, finalRewards) + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, withdrawAddr, coins) if err != nil { return nil, err } @@ -188,25 +190,5 @@ func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val stakingtypes.Vali // remove delegator starting info k.DeleteDelegatorStartingInfo(ctx, del.GetValidatorAddr(), del.GetDelegatorAddr()) - emittedRewards := finalRewards - if finalRewards.IsZero() { - baseDenom, _ := sdk.GetBaseDenom() - if baseDenom == "" { - baseDenom = sdk.DefaultBondDenom - } - - // Note, we do not call the NewCoins constructor as we do not want the zero - // coin removed for event emission. - emittedRewards = sdk.Coins{sdk.NewCoin(baseDenom, sdk.ZeroInt())} - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeWithdrawRewards, - sdk.NewAttribute(sdk.AttributeKeyAmount, emittedRewards.String()), - sdk.NewAttribute(types.AttributeKeyValidator, val.GetOperator().String()), - ), - ) - - return finalRewards, nil + return coins, nil } diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index 4678ecdc503..a805c1cde87 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -6,9 +6,13 @@ import ( "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -16,6 +20,9 @@ import ( func TestCalculateRewardsBasic(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(1000)) @@ -67,6 +74,123 @@ func TestCalculateRewardsBasic(t *testing.T) { require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, app.DistrKeeper.GetValidatorAccumulatedCommission(ctx, valAddrs[0]).Commission) } +func TestWithdrawTokenizeShareRecordReward(t *testing.T) { + app := simapp.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(100000000)) + valAddrs := simapp.ConvertAddrsToValAddrs(addr) + tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) + + // create validator with 50% commission + tstaking.Commission = stakingtypes.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) + valPower := int64(100) + tstaking.CreateValidatorWithValPower(valAddrs[0], valConsPk1, valPower, true) + + // end block to bond validator + staking.EndBlocker(ctx, app.StakingKeeper) + + // next block + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + + // fetch validator and delegation + val := app.StakingKeeper.Validator(ctx, valAddrs[0]) + del := app.StakingKeeper.Delegation(ctx, sdk.AccAddress(valAddrs[0]), valAddrs[0]) + + // end period + endingPeriod := app.DistrKeeper.IncrementValidatorPeriod(ctx, val) + + // calculate delegation rewards + rewards := app.DistrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod) + + // rewards should be zero + require.True(t, rewards.IsZero()) + + // start out block height + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) + + // retrieve validator + val = app.StakingKeeper.Validator(ctx, valAddrs[0]) + + // increase block height + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) + + // allocate some rewards + initial := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) + tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial)}} + app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) + + // end period + app.DistrKeeper.IncrementValidatorPeriod(ctx, val) + + coins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, initial)} + err := app.MintKeeper.MintCoins(ctx, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + require.NoError(t, err) + + // tokenize share amount + delTokens := sdk.NewInt(1000000) + msgServer := stakingkeeper.NewMsgServerImpl(app.StakingKeeper) + resp, err := msgServer.TokenizeShares(sdk.WrapSDKContext(ctx), &stakingtypes.MsgTokenizeShares{ + DelegatorAddress: sdk.AccAddress(valAddrs[0]).String(), + ValidatorAddress: valAddrs[0].String(), + TokenizedShareOwner: sdk.AccAddress(valAddrs[1]).String(), + Amount: sdk.NewCoin(sdk.DefaultBondDenom, delTokens), + }) + require.NoError(t, err) + + // try withdrawing rewards before no reward is allocated + coins, err = app.DistrKeeper.WithdrawAllTokenizeShareRecordReward(ctx, sdk.AccAddress(valAddrs[1])) + require.Nil(t, err) + require.Equal(t, coins, sdk.Coins{}) + + // assert tokenize share response + require.NoError(t, err) + require.Equal(t, resp.Amount.Amount, delTokens) + + // end block to bond validator + staking.EndBlocker(ctx, app.StakingKeeper) + // next block + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + // allocate some rewards + app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) + // end period + app.DistrKeeper.IncrementValidatorPeriod(ctx, val) + + beforeBalance := app.BankKeeper.GetBalance(ctx, sdk.AccAddress(valAddrs[1]), sdk.DefaultBondDenom) + + // withdraw rewards + coins, err = app.DistrKeeper.WithdrawAllTokenizeShareRecordReward(ctx, sdk.AccAddress(valAddrs[1])) + require.Nil(t, err) + + // check return value + require.Equal(t, coins.String(), "50000stake") + // check balance changes + midBalance := app.BankKeeper.GetBalance(ctx, sdk.AccAddress(valAddrs[1]), sdk.DefaultBondDenom) + require.Equal(t, beforeBalance.Amount.Add(coins.AmountOf(sdk.DefaultBondDenom)), midBalance.Amount) + + // allocate more rewards manually on module account and try full redeem + record, err := app.StakingKeeper.GetTokenizeShareRecord(ctx, 1) + require.NoError(t, err) + + err = app.MintKeeper.MintCoins(ctx, coins) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, record.GetModuleAddress(), coins) + require.NoError(t, err) + + shareTokenBalance := app.BankKeeper.GetBalance(ctx, sdk.AccAddress(valAddrs[0]), record.GetShareTokenDenom()) + + _, err = msgServer.RedeemTokens(sdk.WrapSDKContext(ctx), &stakingtypes.MsgRedeemTokensforShares{ + DelegatorAddress: sdk.AccAddress(valAddrs[0]).String(), + Amount: shareTokenBalance, + }) + require.NoError(t, err) + + finalBalance := app.BankKeeper.GetBalance(ctx, sdk.AccAddress(valAddrs[1]), sdk.DefaultBondDenom) + require.Equal(t, midBalance.Amount.Add(coins.AmountOf(sdk.DefaultBondDenom)), finalBalance.Amount) +} + func TestCalculateRewardsAfterSlash(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) @@ -113,7 +237,7 @@ func TestCalculateRewardsAfterSlash(t *testing.T) { // allocate some rewards initial := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.ToDec()}} + tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial)}} app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) // end period @@ -123,10 +247,10 @@ func TestCalculateRewardsAfterSlash(t *testing.T) { rewards = app.DistrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod) // rewards should be half the tokens - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.QuoRaw(2).ToDec()}}, rewards) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial.QuoRaw(2))}}, rewards) // commission should be the other half - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.QuoRaw(2).ToDec()}}, + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial.QuoRaw(2))}}, app.DistrKeeper.GetValidatorAccumulatedCommission(ctx, valAddrs[0]).Commission) } @@ -176,7 +300,7 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) { // allocate some rewards initial := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.ToDec()}} + tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial)}} app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) // slash the validator by 50% again @@ -198,10 +322,10 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) { rewards = app.DistrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod) // rewards should be half the tokens - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.ToDec()}}, rewards) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial)}}, rewards) // commission should be the other half - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.ToDec()}}, + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial)}}, app.DistrKeeper.GetValidatorAccumulatedCommission(ctx, valAddrs[0]).Commission) } @@ -272,6 +396,8 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + balancePower := int64(1000) balanceTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, balancePower) addr := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(1000000000)) @@ -280,7 +406,7 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) { // set module account coins distrAcc := app.DistrKeeper.GetDistributionAccount(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, balanceTokens)))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, balanceTokens)))) app.AccountKeeper.SetModuleAccount(ctx, distrAcc) // create validator with 50% commission @@ -330,33 +456,13 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) { // withdraw commission _, err = app.DistrKeeper.WithdrawValidatorCommission(ctx, valAddrs[0]) require.Nil(t, err) -} - -func TestWithdrawDelegationZeroRewards(t *testing.T) { - app := simapp.Setup(false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - - balancePower := int64(1000) - balanceTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, balancePower) - addr := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(1000000000)) - valAddrs := simapp.ConvertAddrsToValAddrs(addr) - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set module account coins - distrAcc := app.DistrKeeper.GetDistributionAccount(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, balanceTokens)))) - app.AccountKeeper.SetModuleAccount(ctx, distrAcc) - // create validator with 50% commission - power := int64(100) - tstaking.Commission = stakingtypes.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) - _ = tstaking.CreateValidatorWithValPower(valAddrs[0], valConsPk1, power, true) - - // withdraw rewards -- should be 0 - amount, err := app.DistrKeeper.WithdrawDelegationRewards(ctx, sdk.AccAddress(valAddrs[0]), valAddrs[0]) - require.NoError(t, err) - require.True(t, amount.IsZero(), "expected withdraw rewards to be zero") - require.True(t, amount.IsValid(), "expected returned coins to be valid") + // assert correct balance + exp = balanceTokens.Sub(valTokens).Add(initial) + require.Equal(t, + sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, exp)}, + app.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(valAddrs[0])), + ) } func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) { @@ -395,7 +501,7 @@ func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) { ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) // allocate some rewards - initial := app.StakingKeeper.TokensFromConsensusPower(ctx, 10).ToDec() + initial := sdk.NewDecFromInt(app.StakingKeeper.TokensFromConsensusPower(ctx, 10)) tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial}} app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) @@ -451,7 +557,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { del1 := app.StakingKeeper.Delegation(ctx, sdk.AccAddress(valAddrs[0]), valAddrs[0]) // allocate some rewards - initial := app.StakingKeeper.TokensFromConsensusPower(ctx, 30).ToDec() + initial := sdk.NewDecFromInt(app.StakingKeeper.TokensFromConsensusPower(ctx, 30)) tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial}} app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) @@ -505,6 +611,8 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(1000000000)) valAddrs := simapp.ConvertAddrsToValAddrs(addr) @@ -512,7 +620,7 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { // set module account coins distrAcc := app.DistrKeeper.GetDistributionAccount(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000))))) app.AccountKeeper.SetModuleAccount(ctx, distrAcc) tokens := sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdk.NewDec(initial))} @@ -645,3 +753,72 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { // commission should be zero require.True(t, app.DistrKeeper.GetValidatorAccumulatedCommission(ctx, valAddrs[0]).Commission.IsZero()) } + +func Test100PercentCommissionReward(t *testing.T) { + app := simapp.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) + addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(1000000000)) + valAddrs := simapp.ConvertAddrsToValAddrs(addr) + initial := int64(20) + + // set module account coins + distrAcc := app.DistrKeeper.GetDistributionAccount(ctx) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000))))) + app.AccountKeeper.SetModuleAccount(ctx, distrAcc) + + tokens := sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdk.NewDec(initial))} + + // create validator with 100% commission + tstaking.Commission = stakingtypes.NewCommissionRates(sdk.NewDecWithPrec(10, 1), sdk.NewDecWithPrec(10, 1), sdk.NewDec(0)) + tstaking.CreateValidator(valAddrs[0], valConsPk1, sdk.NewInt(100), true) + app.StakingKeeper.Delegation(ctx, sdk.AccAddress(valAddrs[0]), valAddrs[0]) + + // end block to bond validator + staking.EndBlocker(ctx, app.StakingKeeper) + // next block + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + + // fetch validator + val := app.StakingKeeper.Validator(ctx, valAddrs[0]) + + // allocate some rewards + app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) + + // end block + staking.EndBlocker(ctx, app.StakingKeeper) + + // next block + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + + // allocate some more rewards + app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) + + // next block + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + + // allocate some more rewards + app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) + + rewards, err := app.DistrKeeper.WithdrawDelegationRewards(ctx, sdk.AccAddress(valAddrs[0]), valAddrs[0]) + require.NoError(t, err) + + denom, _ := sdk.GetBaseDenom() + zeroRewards := sdk.Coins{ + sdk.Coin{ + Denom: denom, + Amount: sdk.ZeroInt(), + }, + } + require.True(t, rewards.IsEqual(zeroRewards)) + events := ctx.EventManager().Events() + lastEvent := events[len(events)-1] + hasValue := false + for _, attr := range lastEvent.Attributes { + if string(attr.Key) == "amount" && string(attr.Value) == "0" { + hasValue = true + } + } + require.True(t, hasValue) +} diff --git a/x/distribution/keeper/fee_pool.go b/x/distribution/keeper/fee_pool.go index a6047501355..58c982bcd7c 100644 --- a/x/distribution/keeper/fee_pool.go +++ b/x/distribution/keeper/fee_pool.go @@ -3,6 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" + sdkdistr "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // DistributeFromFeePool distributes funds from the distribution module account to @@ -15,7 +16,7 @@ func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receive // must be reduced separately from the SendCoinsFromModuleToAccount call newPool, negative := feePool.CommunityPool.SafeSub(sdk.NewDecCoinsFromCoins(amount...)) if negative { - return types.ErrBadDistribution + return sdkdistr.ErrBadDistribution } feePool.CommunityPool = newPool diff --git a/x/distribution/keeper/grpc_query.go b/x/distribution/keeper/grpc_query.go index 2779822293f..211ffeb8e81 100644 --- a/x/distribution/keeper/grpc_query.go +++ b/x/distribution/keeper/grpc_query.go @@ -3,21 +3,23 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" + "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + sdkdistr "github.com/cosmos/cosmos-sdk/x/distribution/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" ) var _ types.QueryServer = Keeper{} // Params queries params of distribution module -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) var params types.Params k.paramSpace.GetParamSet(ctx, ¶ms) @@ -114,7 +116,7 @@ func (k Keeper) ValidatorSlashes(c context.Context, req *types.QueryValidatorSla } // DelegationRewards the total rewards accrued by a delegation -func (k Keeper) DelegationRewards(c context.Context, req *types.QueryDelegationRewardsRequest) (*types.QueryDelegationRewardsResponse, error) { +func (k Keeper) DelegationRewards(c context.Context, req *sdkdistr.QueryDelegationRewardsRequest) (*sdkdistr.QueryDelegationRewardsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -136,7 +138,7 @@ func (k Keeper) DelegationRewards(c context.Context, req *types.QueryDelegationR val := k.stakingKeeper.Validator(ctx, valAdr) if val == nil { - return nil, sdkerrors.Wrap(types.ErrNoValidatorExists, req.ValidatorAddress) + return nil, errorsmod.Wrap(sdkdistr.ErrNoValidatorExists, req.ValidatorAddress) } delAdr, err := sdk.AccAddressFromBech32(req.DelegatorAddress) @@ -145,13 +147,13 @@ func (k Keeper) DelegationRewards(c context.Context, req *types.QueryDelegationR } del := k.stakingKeeper.Delegation(ctx, delAdr, valAdr) if del == nil { - return nil, types.ErrNoDelegationExists + return nil, sdkdistr.ErrNoDelegationExists } endingPeriod := k.IncrementValidatorPeriod(ctx, val) rewards := k.CalculateDelegationRewards(ctx, val, del, endingPeriod) - return &types.QueryDelegationRewardsResponse{Rewards: rewards}, nil + return &sdkdistr.QueryDelegationRewardsResponse{Rewards: rewards}, nil } // DelegationTotalRewards the total rewards accrued by a each validator @@ -176,7 +178,7 @@ func (k Keeper) DelegationTotalRewards(c context.Context, req *types.QueryDelega k.stakingKeeper.IterateDelegations( ctx, delAdr, - func(_ int64, del stakingtypes.DelegationI) (stop bool) { + func(_ int64, del sdkstaking.DelegationI) (stop bool) { valAddr := del.GetValidatorAddr() val := k.stakingKeeper.Validator(ctx, valAddr) endingPeriod := k.IncrementValidatorPeriod(ctx, val) @@ -210,7 +212,7 @@ func (k Keeper) DelegatorValidators(c context.Context, req *types.QueryDelegator k.stakingKeeper.IterateDelegations( ctx, delAdr, - func(_ int64, del stakingtypes.DelegationI) (stop bool) { + func(_ int64, del sdkstaking.DelegationI) (stop bool) { validators = append(validators, del.GetValidatorAddr().String()) return false }, @@ -240,9 +242,60 @@ func (k Keeper) DelegatorWithdrawAddress(c context.Context, req *types.QueryDele } // CommunityPool queries the community pool coins -func (k Keeper) CommunityPool(c context.Context, req *types.QueryCommunityPoolRequest) (*types.QueryCommunityPoolResponse, error) { +func (k Keeper) CommunityPool(c context.Context, _ *types.QueryCommunityPoolRequest) (*types.QueryCommunityPoolResponse, error) { ctx := sdk.UnwrapSDKContext(c) pool := k.GetFeePoolCommunityCoins(ctx) return &types.QueryCommunityPoolResponse{Pool: pool}, nil } + +// TokenizeShareRecordReward returns estimated amount of reward from tokenize share record ownership +func (k Keeper) TokenizeShareRecordReward(c context.Context, req *types.QueryTokenizeShareRecordRewardRequest) (*types.QueryTokenizeShareRecordRewardResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + totalRewards := sdk.DecCoins{} + rewards := []types.TokenizeShareRecordReward{} + + ownerAddr, err := sdk.AccAddressFromBech32(req.OwnerAddress) + if err != nil { + return nil, err + } + records := k.stakingKeeper.GetTokenizeShareRecordsByOwner(ctx, ownerAddr) + for _, record := range records { + valAddr, err := sdk.ValAddressFromBech32(record.Validator) + if err != nil { + return nil, err + } + + moduleAddr := record.GetModuleAddress() + moduleBalance := k.bankKeeper.GetAllBalances(ctx, moduleAddr) + moduleBalanceDecCoins := sdk.NewDecCoinsFromCoins(moduleBalance...) + + val := k.stakingKeeper.Validator(ctx, valAddr) + del := k.stakingKeeper.Delegation(ctx, moduleAddr, valAddr) + if val != nil && del != nil { + // withdraw rewards + endingPeriod := k.IncrementValidatorPeriod(ctx, val) + recordReward := k.CalculateDelegationRewards(ctx, val, del, endingPeriod) + + rewards = append(rewards, types.TokenizeShareRecordReward{ + RecordId: record.Id, + Reward: recordReward.Add(moduleBalanceDecCoins...), + }) + totalRewards = totalRewards.Add(recordReward...) + } + + if !moduleBalance.IsZero() { + rewards = append(rewards, types.TokenizeShareRecordReward{ + RecordId: record.Id, + Reward: moduleBalanceDecCoins, + }) + totalRewards = totalRewards.Add(moduleBalanceDecCoins...) + } + } + + return &types.QueryTokenizeShareRecordRewardResponse{ + Rewards: rewards, + Total: totalRewards, + }, nil +} diff --git a/x/distribution/keeper/grpc_query_test.go b/x/distribution/keeper/grpc_query_test.go index b8b716ddbc0..308bb16348f 100644 --- a/x/distribution/keeper/grpc_query_test.go +++ b/x/distribution/keeper/grpc_query_test.go @@ -9,11 +9,15 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/x/distribution/types" + sdkdistr "github.com/cosmos/cosmos-sdk/x/distribution/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -360,8 +364,8 @@ func (suite *KeeperTestSuite) TestGRPCDelegationRewards() { // test command delegation rewards grpc var ( - req *types.QueryDelegationRewardsRequest - expRes *types.QueryDelegationRewardsResponse + req *sdkdistr.QueryDelegationRewardsRequest + expRes *sdkdistr.QueryDelegationRewardsResponse ) testCases := []struct { @@ -372,14 +376,14 @@ func (suite *KeeperTestSuite) TestGRPCDelegationRewards() { { "empty request", func() { - req = &types.QueryDelegationRewardsRequest{} + req = &sdkdistr.QueryDelegationRewardsRequest{} }, false, }, { "empty delegator request", func() { - req = &types.QueryDelegationRewardsRequest{ + req = &sdkdistr.QueryDelegationRewardsRequest{ DelegatorAddress: "", ValidatorAddress: valAddrs[0].String(), } @@ -389,7 +393,7 @@ func (suite *KeeperTestSuite) TestGRPCDelegationRewards() { { "empty validator request", func() { - req = &types.QueryDelegationRewardsRequest{ + req = &sdkdistr.QueryDelegationRewardsRequest{ DelegatorAddress: addrs[1].String(), ValidatorAddress: "", } @@ -399,7 +403,7 @@ func (suite *KeeperTestSuite) TestGRPCDelegationRewards() { { "request with wrong delegator and validator", func() { - req = &types.QueryDelegationRewardsRequest{ + req = &sdkdistr.QueryDelegationRewardsRequest{ DelegatorAddress: addrs[1].String(), ValidatorAddress: valAddrs[1].String(), } @@ -409,12 +413,12 @@ func (suite *KeeperTestSuite) TestGRPCDelegationRewards() { { "valid request", func() { - req = &types.QueryDelegationRewardsRequest{ + req = &sdkdistr.QueryDelegationRewardsRequest{ DelegatorAddress: addrs[0].String(), ValidatorAddress: valAddrs[0].String(), } - expRes = &types.QueryDelegationRewardsResponse{ + expRes = &sdkdistr.QueryDelegationRewardsResponse{ Rewards: sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, } }, @@ -600,6 +604,8 @@ func (suite *KeeperTestSuite) TestGRPCDelegatorWithdrawAddress() { func (suite *KeeperTestSuite) TestGRPCCommunityPool() { app, ctx, queryClient, addrs := suite.app, suite.ctx, suite.queryClient, suite.addrs + // reset fee pool + app.DistrKeeper.SetFeePool(ctx, types.InitialFeePool()) var ( req *types.QueryCommunityPoolRequest @@ -623,7 +629,7 @@ func (suite *KeeperTestSuite) TestGRPCCommunityPool() { "valid request", func() { amount := sdk.NewCoins(sdk.NewInt64Coin("stake", 100)) - suite.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addrs[0], amount)) + suite.Require().NoError(simapp_test.FundAccount(app.BankKeeper, ctx, addrs[0], amount)) err := app.DistrKeeper.FundCommunityPool(ctx, amount, addrs[0]) suite.Require().Nil(err) @@ -652,6 +658,84 @@ func (suite *KeeperTestSuite) TestGRPCCommunityPool() { } } +func (suite *KeeperTestSuite) TestGRPCTokenizeShareRecordReward() { + app, ctx, queryClient, _ := suite.app, suite.ctx, suite.queryClient, suite.addrs + + addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(100000000)) + valAddrs := simapp.ConvertAddrsToValAddrs(addr) + tstaking := teststaking.NewHelper(suite.T(), ctx, app.StakingKeeper) + + // create validator with 50% commission + tstaking.Commission = stakingtypes.NewCommissionRates(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), sdk.NewDec(0)) + valPower := int64(100) + tstaking.CreateValidatorWithValPower(valAddrs[0], valConsPk1, valPower, true) + + // end block to bond validator + staking.EndBlocker(ctx, app.StakingKeeper) + + // next block + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + + // fetch validator and delegation + val := app.StakingKeeper.Validator(ctx, valAddrs[0]) + del := app.StakingKeeper.Delegation(ctx, sdk.AccAddress(valAddrs[0]), valAddrs[0]) + + // end period + endingPeriod := app.DistrKeeper.IncrementValidatorPeriod(ctx, val) + + // calculate delegation rewards + app.DistrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod) + + // start out block height + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) + val = app.StakingKeeper.Validator(ctx, valAddrs[0]) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) + + // allocate some rewards + initial := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) + tokens := sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecFromInt(initial)}} + app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) + + // end period + app.DistrKeeper.IncrementValidatorPeriod(ctx, val) + + coins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, initial)} + err := app.MintKeeper.MintCoins(ctx, coins) + suite.Require().NoError(err) + + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + suite.Require().NoError(err) + // tokenize share amount + delTokens := sdk.NewInt(1000000) + msgServer := stakingkeeper.NewMsgServerImpl(app.StakingKeeper) + _, err = msgServer.TokenizeShares(sdk.WrapSDKContext(ctx), &stakingtypes.MsgTokenizeShares{ + DelegatorAddress: sdk.AccAddress(valAddrs[0]).String(), + ValidatorAddress: valAddrs[0].String(), + TokenizedShareOwner: sdk.AccAddress(valAddrs[0]).String(), + Amount: sdk.NewCoin(sdk.DefaultBondDenom, delTokens), + }) + suite.Require().NoError(err) + + staking.EndBlocker(ctx, app.StakingKeeper) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + app.DistrKeeper.AllocateTokensToValidator(ctx, val, tokens) + app.DistrKeeper.IncrementValidatorPeriod(ctx, val) + + rewards, err := queryClient.TokenizeShareRecordReward(gocontext.Background(), &types.QueryTokenizeShareRecordRewardRequest{ + OwnerAddress: sdk.AccAddress(valAddrs[0]).String(), + }) + suite.Require().NoError(err) + suite.Require().Equal(&types.QueryTokenizeShareRecordRewardResponse{ + Rewards: []types.TokenizeShareRecordReward{ + { + RecordId: 1, + Reward: sdk.DecCoins{sdk.NewInt64DecCoin("stake", 50000)}, + }, + }, + Total: sdk.DecCoins{sdk.NewInt64DecCoin("stake", 50000)}, + }, rewards) +} + func TestDistributionTestSuite(t *testing.T) { suite.Run(t, new(KeeperTestSuite)) } diff --git a/x/distribution/keeper/hooks.go b/x/distribution/keeper/hooks.go index 4ca75691f51..ca32ec49c2d 100644 --- a/x/distribution/keeper/hooks.go +++ b/x/distribution/keeper/hooks.go @@ -17,13 +17,14 @@ var _ stakingtypes.StakingHooks = Hooks{} func (k Keeper) Hooks() Hooks { return Hooks{k} } // initialize validator distribution record -func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { +func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { val := h.k.stakingKeeper.Validator(ctx, valAddr) h.k.initializeValidator(ctx, val) + return nil } // AfterValidatorRemoved performs clean up after a validator is removed -func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) { +func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error { // fetch outstanding outstanding := h.k.GetValidatorOutstandingRewardsCoins(ctx, valAddr) @@ -47,7 +48,7 @@ func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr withdrawAddr := h.k.GetDelegatorWithdrawAddr(ctx, accAddr) if err := h.k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, withdrawAddr, coins); err != nil { - panic(err) + return err } } } @@ -73,38 +74,58 @@ func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr // clear current rewards h.k.DeleteValidatorCurrentRewards(ctx, valAddr) + + return nil +} + +func (h Hooks) BeforeTokenizeShareRecordRemoved(ctx sdk.Context, recordID uint64) error { + err := h.k.WithdrawSingleShareRecordReward(ctx, recordID) + if err != nil { + h.k.Logger(ctx).Error(err.Error()) + } + return err } // increment period -func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, _ sdk.AccAddress, valAddr sdk.ValAddress) error { val := h.k.stakingKeeper.Validator(ctx, valAddr) - h.k.IncrementValidatorPeriod(ctx, val) + _ = h.k.IncrementValidatorPeriod(ctx, val) + return nil } // withdraw delegation rewards (which also increments period) -func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { val := h.k.stakingKeeper.Validator(ctx, valAddr) del := h.k.stakingKeeper.Delegation(ctx, delAddr, valAddr) if _, err := h.k.withdrawDelegationRewards(ctx, val, del); err != nil { - panic(err) + return err } + + return nil } // create new delegation period record -func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { h.k.initializeDelegation(ctx, valAddr, delAddr) + return nil } // record the slash event -func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) { +func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { h.k.updateValidatorSlashFraction(ctx, valAddr, fraction) + return nil +} + +func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error { return nil } +func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { + return nil } -func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) {} -func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) {} -func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) {} -func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) {} -func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error { +func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { return nil } diff --git a/x/distribution/keeper/invariants.go b/x/distribution/keeper/invariants.go index 50300b97737..5db9f72bf05 100644 --- a/x/distribution/keeper/invariants.go +++ b/x/distribution/keeper/invariants.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" ) // register all distribution invariants @@ -76,7 +76,7 @@ func CanWithdrawInvariant(k Keeper) sdk.Invariant { } // iterate over all validators - k.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + k.stakingKeeper.IterateValidators(ctx, func(_ int64, val sdkstaking.ValidatorI) (stop bool) { _, _ = k.WithdrawValidatorCommission(ctx, val.GetOperator()) delegationAddrs, ok := valDelegationAddrs[val.GetOperator().String()] @@ -106,7 +106,7 @@ func CanWithdrawInvariant(k Keeper) sdk.Invariant { func ReferenceCountInvariant(k Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { valCount := uint64(0) - k.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + k.stakingKeeper.IterateValidators(ctx, func(_ int64, val sdkstaking.ValidatorI) (stop bool) { valCount++ return false }) diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 22e1a289440..f2098141e91 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -3,34 +3,36 @@ package keeper import ( "fmt" + errorsmod "cosmossdk.io/errors" + "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/distribution/types" + sdkdistr "github.com/cosmos/cosmos-sdk/x/distribution/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // Keeper of the distribution store type Keeper struct { - storeKey sdk.StoreKey + storeKey storetypes.StoreKey cdc codec.BinaryCodec paramSpace paramtypes.Subspace authKeeper types.AccountKeeper bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper - blockedAddrs map[string]bool - feeCollectorName string // name of the FeeCollector ModuleAccount } // NewKeeper creates a new distribution Keeper instance func NewKeeper( - cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, + cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, - feeCollectorName string, blockedAddrs map[string]bool, + feeCollectorName string, ) Keeper { // ensure distribution module account is set if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { @@ -50,7 +52,6 @@ func NewKeeper( bankKeeper: bk, stakingKeeper: sk, feeCollectorName: feeCollectorName, - blockedAddrs: blockedAddrs, } } @@ -61,12 +62,12 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // SetWithdrawAddr sets a new address that will receive the rewards upon withdrawal func (k Keeper) SetWithdrawAddr(ctx sdk.Context, delegatorAddr sdk.AccAddress, withdrawAddr sdk.AccAddress) error { - if k.blockedAddrs[withdrawAddr.String()] { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive external funds", withdrawAddr) + if k.bankKeeper.BlockedAddr(withdrawAddr) { + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive external funds", withdrawAddr) } if !k.GetWithdrawAddrEnabled(ctx) { - return types.ErrSetWithdrawAddrDisabled + return sdkdistr.ErrSetWithdrawAddrDisabled } ctx.EventManager().EmitEvent( @@ -84,12 +85,12 @@ func (k Keeper) SetWithdrawAddr(ctx sdk.Context, delegatorAddr sdk.AccAddress, w func (k Keeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error) { val := k.stakingKeeper.Validator(ctx, valAddr) if val == nil { - return nil, types.ErrNoValidatorDistInfo + return nil, sdkdistr.ErrNoValidatorDistInfo } del := k.stakingKeeper.Delegation(ctx, delAddr, valAddr) if del == nil { - return nil, types.ErrEmptyDelegationDistInfo + return nil, sdkdistr.ErrEmptyDelegationDistInfo } // withdraw rewards @@ -98,6 +99,22 @@ func (k Keeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddres return nil, err } + if rewards.IsZero() { + baseDenom, _ := sdk.GetBaseDenom() + rewards = sdk.Coins{sdk.Coin{ + Denom: baseDenom, + Amount: sdk.ZeroInt(), + }} + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeWithdrawRewards, + sdk.NewAttribute(sdk.AttributeKeyAmount, rewards.String()), + sdk.NewAttribute(types.AttributeKeyValidator, valAddr.String()), + ), + ) + // reinitialize the delegation k.initializeDelegation(ctx, valAddr, delAddr) return rewards, nil @@ -108,7 +125,7 @@ func (k Keeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.ValAddr // fetch validator accumulated commission accumCommission := k.GetValidatorAccumulatedCommission(ctx, valAddr) if accumCommission.Commission.IsZero() { - return nil, types.ErrNoValidatorCommission + return nil, sdkdistr.ErrNoValidatorCommission } commission, remainder := accumCommission.Commission.TruncateDecimal() @@ -164,3 +181,156 @@ func (k Keeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk. return nil } + +func (k Keeper) WithdrawSingleShareRecordReward(ctx sdk.Context, recordID uint64) error { + record, err := k.stakingKeeper.GetTokenizeShareRecord(ctx, recordID) + if err != nil { + return err + } + + owner, err := sdk.AccAddressFromBech32(record.Owner) + if err != nil { + return err + } + + valAddr, err := sdk.ValAddressFromBech32(record.Validator) + if err != nil { + return err + } + + val := k.stakingKeeper.Validator(ctx, valAddr) + del := k.stakingKeeper.Delegation(ctx, record.GetModuleAddress(), valAddr) + if val != nil && del != nil { + // withdraw rewards into reward module account and send it to reward owner + cacheCtx, write := ctx.CacheContext() + _, err = k.WithdrawDelegationRewards(cacheCtx, record.GetModuleAddress(), valAddr) + if err != nil { + return err + } + write() + } + + // apply changes when the module account has positive balance + balances := k.bankKeeper.GetAllBalances(ctx, record.GetModuleAddress()) + if !balances.Empty() { + err = k.bankKeeper.SendCoins(ctx, record.GetModuleAddress(), owner, balances) + if err != nil { + return err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeWithdrawTokenizeShareReward, + sdk.NewAttribute(types.AttributeKeyWithdrawAddress, owner.String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, balances.String()), + ), + ) + } + return nil +} + +// withdraw reward for owning TokenizeShareRecord +func (k Keeper) WithdrawTokenizeShareRecordReward(ctx sdk.Context, ownerAddr sdk.AccAddress, recordID uint64) (sdk.Coins, error) { + record, err := k.stakingKeeper.GetTokenizeShareRecord(ctx, recordID) + if err != nil { + return nil, err + } + + if record.Owner != ownerAddr.String() { + return nil, types.ErrNotTokenizeShareRecordOwner + } + + valAddr, err := sdk.ValAddressFromBech32(record.Validator) + if err != nil { + return nil, err + } + + val := k.stakingKeeper.Validator(ctx, valAddr) + if val == nil { + return nil, err + } + + del := k.stakingKeeper.Delegation(ctx, record.GetModuleAddress(), valAddr) + if del == nil { + return nil, err + } + + // withdraw rewards into reward module account and send it to reward owner + _, err = k.WithdrawDelegationRewards(ctx, record.GetModuleAddress(), valAddr) + if err != nil { + return nil, err + } + + // apply changes when the module account has positive balance + rewards := k.bankKeeper.GetAllBalances(ctx, record.GetModuleAddress()) + if !rewards.Empty() { + err = k.bankKeeper.SendCoins(ctx, record.GetModuleAddress(), ownerAddr, rewards) + if err != nil { + return nil, err + } + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeWithdrawTokenizeShareReward, + sdk.NewAttribute(types.AttributeKeyWithdrawAddress, ownerAddr.String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, rewards.String()), + ), + ) + + return rewards, nil +} + +// withdraw reward for all owning TokenizeShareRecord +func (k Keeper) WithdrawAllTokenizeShareRecordReward(ctx sdk.Context, ownerAddr sdk.AccAddress) (sdk.Coins, error) { + totalRewards := sdk.Coins{} + + records := k.stakingKeeper.GetTokenizeShareRecordsByOwner(ctx, ownerAddr) + + for _, record := range records { + valAddr, err := sdk.ValAddressFromBech32(record.Validator) + if err != nil { + return nil, err + } + + val := k.stakingKeeper.Validator(ctx, valAddr) + if val == nil { + continue + } + + del := k.stakingKeeper.Delegation(ctx, record.GetModuleAddress(), valAddr) + if del == nil { + continue + } + + // withdraw rewards into reward module account and send it to reward owner + cacheCtx, write := ctx.CacheContext() + _, err = k.WithdrawDelegationRewards(cacheCtx, record.GetModuleAddress(), valAddr) + if err != nil { + k.Logger(ctx).Error(err.Error()) + continue + } + + // apply changes when the module account has positive balance + balances := k.bankKeeper.GetAllBalances(cacheCtx, record.GetModuleAddress()) + if !balances.Empty() { + err = k.bankKeeper.SendCoins(cacheCtx, record.GetModuleAddress(), ownerAddr, balances) + if err != nil { + k.Logger(ctx).Error(err.Error()) + continue + } + write() + totalRewards = totalRewards.Add(balances...) + } + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeWithdrawTokenizeShareReward, + sdk.NewAttribute(types.AttributeKeyWithdrawAddress, ownerAddr.String()), + sdk.NewAttribute(sdk.AttributeKeyAmount, totalRewards.String()), + ), + ) + + return totalRewards, nil +} diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index 40d6dcd7364..4743930b283 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -7,7 +7,8 @@ import ( "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" ) @@ -49,7 +50,7 @@ func TestWithdrawValidatorCommission(t *testing.T) { // set module account coins distrAcc := app.DistrKeeper.GetDistributionAccount(ctx) coins := sdk.NewCoins(sdk.NewCoin("mytoken", sdk.NewInt(2)), sdk.NewCoin("stake", sdk.NewInt(2))) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), coins)) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, distrAcc.GetName(), coins)) app.AccountKeeper.SetModuleAccount(ctx, distrAcc) @@ -111,10 +112,13 @@ func TestFundCommunityPool(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + // reset fee pool + app.DistrKeeper.SetFeePool(ctx, types.InitialFeePool()) + addr := simapp.AddTestAddrs(app, ctx, 2, sdk.ZeroInt()) amount := sdk.NewCoins(sdk.NewInt64Coin("stake", 100)) - require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, addr[0], amount)) + require.NoError(t, simapp_test.FundAccount(app.BankKeeper, ctx, addr[0], amount)) initPool := app.DistrKeeper.GetFeePool(ctx) assert.Empty(t, initPool.CommunityPool) diff --git a/x/distribution/keeper/migrations.go b/x/distribution/keeper/migrations.go index 7f7273c650b..b55569d4a44 100644 --- a/x/distribution/keeper/migrations.go +++ b/x/distribution/keeper/migrations.go @@ -1,21 +1 @@ package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - v043 "github.com/cosmos/cosmos-sdk/x/distribution/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/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index bff869ee55d..cfcd5d4d706 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -122,14 +122,86 @@ func (k msgServer) WithdrawValidatorCommission(goCtx context.Context, msg *types return &types.MsgWithdrawValidatorCommissionResponse{}, nil } +// WithdrawTokenizeShareRecordReward defines a method to withdraw reward for owning TokenizeShareRecord +func (k msgServer) WithdrawTokenizeShareRecordReward(goCtx context.Context, msg *types.MsgWithdrawTokenizeShareRecordReward) (*types.MsgWithdrawTokenizeShareRecordRewardResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return nil, err + } + amount, err := k.Keeper.WithdrawTokenizeShareRecordReward(ctx, ownerAddr, msg.RecordId) + if err != nil { + return nil, err + } + + defer func() { + for _, a := range amount { + if a.Amount.IsInt64() { + telemetry.SetGaugeWithLabels( + []string{"tx", "msg", "withdraw_tokenize_share_reward"}, + float32(a.Amount.Int64()), + []metrics.Label{telemetry.NewLabel("denom", a.Denom)}, + ) + } + } + }() + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + ) + + return &types.MsgWithdrawTokenizeShareRecordRewardResponse{}, nil +} + +// WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward for owning TokenizeShareRecord +func (k msgServer) WithdrawAllTokenizeShareRecordReward(goCtx context.Context, msg *types.MsgWithdrawAllTokenizeShareRecordReward) (*types.MsgWithdrawAllTokenizeShareRecordRewardResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + ownerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + return nil, err + } + amount, err := k.Keeper.WithdrawAllTokenizeShareRecordReward(ctx, ownerAddr) + if err != nil { + return nil, err + } + + defer func() { + for _, a := range amount { + if a.Amount.IsInt64() { + telemetry.SetGaugeWithLabels( + []string{"tx", "msg", "withdraw_all_tokenize_share_reward"}, + float32(a.Amount.Int64()), + []metrics.Label{telemetry.NewLabel("denom", a.Denom)}, + ) + } + } + }() + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OwnerAddress), + ), + ) + + return &types.MsgWithdrawAllTokenizeShareRecordRewardResponse{}, nil +} + func (k msgServer) FundCommunityPool(goCtx context.Context, msg *types.MsgFundCommunityPool) (*types.MsgFundCommunityPoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - depositer, err := sdk.AccAddressFromBech32(msg.Depositor) + depositor, err := sdk.AccAddressFromBech32(msg.Depositor) if err != nil { return nil, err } - if err := k.Keeper.FundCommunityPool(ctx, msg.Amount, depositer); err != nil { + if err := k.Keeper.FundCommunityPool(ctx, msg.Amount, depositor); err != nil { return nil, err } diff --git a/x/distribution/keeper/proposal_handler.go b/x/distribution/keeper/proposal_handler.go index bb88552efec..26463be6cc5 100644 --- a/x/distribution/keeper/proposal_handler.go +++ b/x/distribution/keeper/proposal_handler.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -8,16 +9,17 @@ import ( // HandleCommunityPoolSpendProposal is a handler for executing a passed community spend proposal func HandleCommunityPoolSpendProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolSpendProposal) error { - if k.blockedAddrs[p.Recipient] { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive external funds", p.Recipient) + recipient, addrErr := sdk.AccAddressFromBech32(p.Recipient) + if addrErr != nil { + return addrErr } - recipient, err := sdk.AccAddressFromBech32(p.Recipient) - if err != nil { - return err + if k.bankKeeper.BlockedAddr(recipient) { + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive external funds", p.Recipient) } - if err := k.DistributeFromFeePool(ctx, p.Amount, recipient); err != nil { + err := k.DistributeFromFeePool(ctx, p.Amount, recipient) + if err != nil { return err } diff --git a/x/distribution/keeper/querier.go b/x/distribution/keeper/querier.go index 71370e24ba5..02597802046 100644 --- a/x/distribution/keeper/querier.go +++ b/x/distribution/keeper/querier.go @@ -3,13 +3,16 @@ package keeper import ( "encoding/json" + errorsmod "cosmossdk.io/errors" + abci "github.com/tendermint/tendermint/abci/types" "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/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + sdkdistr "github.com/cosmos/cosmos-sdk/x/distribution/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" ) func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { @@ -43,7 +46,7 @@ func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return queryCommunityPool(ctx, path[1:], req, k, legacyQuerierCdc) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0]) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0]) } } } @@ -53,7 +56,7 @@ func queryParams(ctx sdk.Context, _ []string, _ abci.RequestQuery, k Keeper, leg res, err := codec.MarshalJSONIndent(legacyQuerierCdc, params) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -63,7 +66,7 @@ func queryValidatorOutstandingRewards(ctx sdk.Context, _ []string, req abci.Requ var params types.QueryValidatorOutstandingRewardsParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } rewards := k.GetValidatorOutstandingRewards(ctx, params.ValidatorAddress) @@ -73,7 +76,7 @@ func queryValidatorOutstandingRewards(ctx sdk.Context, _ []string, req abci.Requ bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, rewards) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil @@ -83,7 +86,7 @@ func queryValidatorCommission(ctx sdk.Context, _ []string, req abci.RequestQuery var params types.QueryValidatorCommissionParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } commission := k.GetValidatorAccumulatedCommission(ctx, params.ValidatorAddress) @@ -93,7 +96,7 @@ func queryValidatorCommission(ctx sdk.Context, _ []string, req abci.RequestQuery bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, commission) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil @@ -103,7 +106,7 @@ func queryValidatorSlashes(ctx sdk.Context, _ []string, req abci.RequestQuery, k var params types.QueryValidatorSlashesParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } events := make([]types.ValidatorSlashEvent, 0) @@ -116,7 +119,7 @@ func queryValidatorSlashes(ctx sdk.Context, _ []string, req abci.RequestQuery, k bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, events) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil @@ -126,7 +129,7 @@ func queryDelegationRewards(ctx sdk.Context, _ []string, req abci.RequestQuery, var params types.QueryDelegationRewardsParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } // branch the context to isolate state changes @@ -134,12 +137,12 @@ func queryDelegationRewards(ctx sdk.Context, _ []string, req abci.RequestQuery, val := k.stakingKeeper.Validator(ctx, params.ValidatorAddress) if val == nil { - return nil, sdkerrors.Wrap(types.ErrNoValidatorExists, params.ValidatorAddress.String()) + return nil, errorsmod.Wrap(sdkdistr.ErrNoValidatorExists, params.ValidatorAddress.String()) } del := k.stakingKeeper.Delegation(ctx, params.DelegatorAddress, params.ValidatorAddress) if del == nil { - return nil, types.ErrNoDelegationExists + return nil, sdkdistr.ErrNoDelegationExists } endingPeriod := k.IncrementValidatorPeriod(ctx, val) @@ -150,7 +153,7 @@ func queryDelegationRewards(ctx sdk.Context, _ []string, req abci.RequestQuery, bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, rewards) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil @@ -160,7 +163,7 @@ func queryDelegatorTotalRewards(ctx sdk.Context, _ []string, req abci.RequestQue var params types.QueryDelegatorParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } // branch the context to isolate state changes @@ -172,7 +175,7 @@ func queryDelegatorTotalRewards(ctx sdk.Context, _ []string, req abci.RequestQue k.stakingKeeper.IterateDelegations( ctx, params.DelegatorAddress, - func(_ int64, del stakingtypes.DelegationI) (stop bool) { + func(_ int64, del sdkstaking.DelegationI) (stop bool) { valAddr := del.GetValidatorAddr() val := k.stakingKeeper.Validator(ctx, valAddr) endingPeriod := k.IncrementValidatorPeriod(ctx, val) @@ -188,7 +191,7 @@ func queryDelegatorTotalRewards(ctx sdk.Context, _ []string, req abci.RequestQue bz, err := json.Marshal(totalRewards) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil @@ -198,7 +201,7 @@ func queryDelegatorValidators(ctx sdk.Context, _ []string, req abci.RequestQuery var params types.QueryDelegatorParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } // branch the context to isolate state changes @@ -208,7 +211,7 @@ func queryDelegatorValidators(ctx sdk.Context, _ []string, req abci.RequestQuery k.stakingKeeper.IterateDelegations( ctx, params.DelegatorAddress, - func(_ int64, del stakingtypes.DelegationI) (stop bool) { + func(_ int64, del sdkstaking.DelegationI) (stop bool) { validators = append(validators, del.GetValidatorAddr()) return false }, @@ -216,7 +219,7 @@ func queryDelegatorValidators(ctx sdk.Context, _ []string, req abci.RequestQuery bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, validators) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil @@ -226,7 +229,7 @@ func queryDelegatorWithdrawAddress(ctx sdk.Context, _ []string, req abci.Request var params types.QueryDelegatorWithdrawAddrParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } // branch the context to isolate state changes @@ -235,7 +238,7 @@ func queryDelegatorWithdrawAddress(ctx sdk.Context, _ []string, req abci.Request bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, withdrawAddr) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil @@ -249,7 +252,7 @@ func queryCommunityPool(ctx sdk.Context, _ []string, _ abci.RequestQuery, k Keep bz, err := legacyQuerierCdc.MarshalJSON(pool) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil diff --git a/x/distribution/keeper/querier_test.go b/x/distribution/keeper/querier_test.go index 9a3da854ab5..e0fb60e1e4d 100644 --- a/x/distribution/keeper/querier_test.go +++ b/x/distribution/keeper/querier_test.go @@ -9,7 +9,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/distribution/keeper" @@ -119,6 +119,9 @@ func TestQueries(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + // reset fee pool + app.DistrKeeper.SetFeePool(ctx, types.InitialFeePool()) + addr := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(1000000000)) valAddrs := simapp.ConvertAddrsToValAddrs(addr) valOpAddr1 := valAddrs[0] diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index 3def35163f5..8be9aa3d754 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -24,7 +24,7 @@ func (k Keeper) SetDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr } // delete a delegator withdraw addr -func (k Keeper) DeleteDelegatorWithdrawAddr(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress) { +func (k Keeper) DeleteDelegatorWithdrawAddr(ctx sdk.Context, delAddr, _ sdk.AccAddress) { store := ctx.KVStore(k.storeKey) store.Delete(types.GetDelegatorWithdrawAddrKey(delAddr)) } diff --git a/x/distribution/keeper/validator.go b/x/distribution/keeper/validator.go index 3d1953c3b5f..42026192835 100644 --- a/x/distribution/keeper/validator.go +++ b/x/distribution/keeper/validator.go @@ -6,11 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" ) // initialize rewards for a new validator -func (k Keeper) initializeValidator(ctx sdk.Context, val stakingtypes.ValidatorI) { +func (k Keeper) initializeValidator(ctx sdk.Context, val sdkstaking.ValidatorI) { // set initial historical rewards (period 0) with reference count of 1 k.SetValidatorHistoricalRewards(ctx, val.GetOperator(), 0, types.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) @@ -25,7 +25,7 @@ func (k Keeper) initializeValidator(ctx sdk.Context, val stakingtypes.ValidatorI } // increment validator period, returning the period just ended -func (k Keeper) IncrementValidatorPeriod(ctx sdk.Context, val stakingtypes.ValidatorI) uint64 { +func (k Keeper) IncrementValidatorPeriod(ctx sdk.Context, val sdkstaking.ValidatorI) uint64 { // fetch current rewards rewards := k.GetValidatorCurrentRewards(ctx, val.GetOperator()) @@ -45,7 +45,7 @@ func (k Keeper) IncrementValidatorPeriod(ctx sdk.Context, val stakingtypes.Valid current = sdk.DecCoins{} } else { // note: necessary to truncate so we don't allow withdrawing more rewards than owed - current = rewards.Rewards.QuoDecTruncate(val.GetTokens().ToDec()) + current = rewards.Rewards.QuoDecTruncate(sdk.NewDecFromInt(val.GetTokens())) } // fetch historical rewards for last period diff --git a/x/distribution/legacy/v034/types.go b/x/distribution/legacy/v034/types.go deleted file mode 100644 index e32b92a5cf5..00000000000 --- a/x/distribution/legacy/v034/types.go +++ /dev/null @@ -1,100 +0,0 @@ -// Package v034 is used for legacy migration scripts. Actual migration scripts -// for v034 have been removed, but the v039->v042 migration script still -// references types from this file, so we're keeping it for now. -// DONTCOVER -package v034 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// ---------------------------------------------------------------------------- -// Types and Constants -// ---------------------------------------------------------------------------- - -const ( - ModuleName = "distr" -) - -type ( - ValidatorAccumulatedCommission = sdk.DecCoins - - DelegatorStartingInfo struct { - PreviousPeriod uint64 `json:"previous_period"` - Stake sdk.Dec `json:"stake"` - Height uint64 `json:"height"` - } - - DelegatorWithdrawInfo struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address"` - WithdrawAddress sdk.AccAddress `json:"withdraw_address"` - } - - ValidatorOutstandingRewardsRecord struct { - ValidatorAddress sdk.ValAddress `json:"validator_address"` - OutstandingRewards sdk.DecCoins `json:"outstanding_rewards"` - } - - ValidatorAccumulatedCommissionRecord struct { - ValidatorAddress sdk.ValAddress `json:"validator_address"` - Accumulated ValidatorAccumulatedCommission `json:"accumulated"` - } - - ValidatorHistoricalRewardsRecord struct { - ValidatorAddress sdk.ValAddress `json:"validator_address"` - Period uint64 `json:"period"` - Rewards ValidatorHistoricalRewards `json:"rewards"` - } - - ValidatorHistoricalRewards struct { - CumulativeRewardRatio sdk.DecCoins `json:"cumulative_reward_ratio"` - ReferenceCount uint16 `json:"reference_count"` - } - - ValidatorCurrentRewards struct { - Rewards sdk.DecCoins `json:"rewards"` - Period uint64 `json:"period"` - } - - ValidatorCurrentRewardsRecord struct { - ValidatorAddress sdk.ValAddress `json:"validator_address"` - Rewards ValidatorCurrentRewards `json:"rewards"` - } - - DelegatorStartingInfoRecord struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address"` - StartingInfo DelegatorStartingInfo `json:"starting_info"` - } - - ValidatorSlashEventRecord struct { - ValidatorAddress sdk.ValAddress `json:"validator_address"` - Height uint64 `json:"height"` - Event ValidatorSlashEvent `json:"validator_slash_event"` - } - - FeePool struct { - CommunityPool sdk.DecCoins `json:"community_pool"` - } - - ValidatorSlashEvent struct { - ValidatorPeriod uint64 `json:"validator_period"` - Fraction sdk.Dec `json:"fraction"` - } - - GenesisState struct { - FeePool FeePool `json:"fee_pool"` - CommunityTax sdk.Dec `json:"community_tax"` - BaseProposerReward sdk.Dec `json:"base_proposer_reward"` - BonusProposerReward sdk.Dec `json:"bonus_proposer_reward"` - WithdrawAddrEnabled bool `json:"withdraw_addr_enabled"` - DelegatorWithdrawInfos []DelegatorWithdrawInfo `json:"delegator_withdraw_infos"` - PreviousProposer sdk.ConsAddress `json:"previous_proposer"` - OutstandingRewards []ValidatorOutstandingRewardsRecord `json:"outstanding_rewards"` - ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions"` - ValidatorHistoricalRewards []ValidatorHistoricalRewardsRecord `json:"validator_historical_rewards"` - ValidatorCurrentRewards []ValidatorCurrentRewardsRecord `json:"validator_current_rewards"` - DelegatorStartingInfos []DelegatorStartingInfoRecord `json:"delegator_starting_infos"` - ValidatorSlashEvents []ValidatorSlashEventRecord `json:"validator_slash_events"` - } -) diff --git a/x/distribution/legacy/v036/types.go b/x/distribution/legacy/v036/types.go deleted file mode 100644 index ed363205f0f..00000000000 --- a/x/distribution/legacy/v036/types.go +++ /dev/null @@ -1,135 +0,0 @@ -// Package v036 is used for legacy migration scripts. Actual migration scripts -// for v036 have been removed, but the v039->v042 migration script still -// references types from this file, so we're keeping it for now. -// DONTCOVER -package v036 - -import ( - "fmt" - "strings" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - v034distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v034" - "github.com/cosmos/cosmos-sdk/x/distribution/types" - v036gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v036" -) - -// ---------------------------------------------------------------------------- -// Types and Constants -// ---------------------------------------------------------------------------- - -const ( - ModuleName = "distribution" - - // RouterKey is the message route for distribution - RouterKey = ModuleName - - // ProposalTypeCommunityPoolSpend defines the type for a CommunityPoolSpendProposal - ProposalTypeCommunityPoolSpend = "CommunityPoolSpend" -) - -type ( - ValidatorAccumulatedCommission = sdk.DecCoins - - ValidatorSlashEventRecord struct { - ValidatorAddress sdk.ValAddress `json:"validator_address"` - Height uint64 `json:"height"` - Period uint64 `json:"period"` - Event v034distr.ValidatorSlashEvent `json:"validator_slash_event"` - } - - GenesisState struct { - FeePool v034distr.FeePool `json:"fee_pool"` - CommunityTax sdk.Dec `json:"community_tax"` - BaseProposerReward sdk.Dec `json:"base_proposer_reward"` - BonusProposerReward sdk.Dec `json:"bonus_proposer_reward"` - WithdrawAddrEnabled bool `json:"withdraw_addr_enabled"` - DelegatorWithdrawInfos []v034distr.DelegatorWithdrawInfo `json:"delegator_withdraw_infos"` - PreviousProposer sdk.ConsAddress `json:"previous_proposer"` - OutstandingRewards []v034distr.ValidatorOutstandingRewardsRecord `json:"outstanding_rewards"` - ValidatorAccumulatedCommissions []v034distr.ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions"` - ValidatorHistoricalRewards []v034distr.ValidatorHistoricalRewardsRecord `json:"validator_historical_rewards"` - ValidatorCurrentRewards []v034distr.ValidatorCurrentRewardsRecord `json:"validator_current_rewards"` - DelegatorStartingInfos []v034distr.DelegatorStartingInfoRecord `json:"delegator_starting_infos"` - ValidatorSlashEvents []ValidatorSlashEventRecord `json:"validator_slash_events"` - } - - // CommunityPoolSpendProposal spends from the community pool - CommunityPoolSpendProposal struct { - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"` - Amount sdk.Coins `json:"amount" yaml:"amount"` - } -) - -func NewGenesisState( - feePool v034distr.FeePool, communityTax, baseProposerReward, bonusProposerReward sdk.Dec, - withdrawAddrEnabled bool, dwis []v034distr.DelegatorWithdrawInfo, pp sdk.ConsAddress, - r []v034distr.ValidatorOutstandingRewardsRecord, acc []v034distr.ValidatorAccumulatedCommissionRecord, - historical []v034distr.ValidatorHistoricalRewardsRecord, cur []v034distr.ValidatorCurrentRewardsRecord, - dels []v034distr.DelegatorStartingInfoRecord, slashes []ValidatorSlashEventRecord, -) GenesisState { - return GenesisState{ - FeePool: feePool, - CommunityTax: communityTax, - BaseProposerReward: baseProposerReward, - BonusProposerReward: bonusProposerReward, - WithdrawAddrEnabled: withdrawAddrEnabled, - DelegatorWithdrawInfos: dwis, - PreviousProposer: pp, - OutstandingRewards: r, - ValidatorAccumulatedCommissions: acc, - ValidatorHistoricalRewards: historical, - ValidatorCurrentRewards: cur, - DelegatorStartingInfos: dels, - ValidatorSlashEvents: slashes, - } -} - -var _ v036gov.Content = CommunityPoolSpendProposal{} - -// GetTitle returns the title of a community pool spend proposal. -func (csp CommunityPoolSpendProposal) GetTitle() string { return csp.Title } - -// GetDescription returns the description of a community pool spend proposal. -func (csp CommunityPoolSpendProposal) GetDescription() string { return csp.Description } - -// GetDescription returns the routing key of a community pool spend proposal. -func (csp CommunityPoolSpendProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a community pool spend proposal. -func (csp CommunityPoolSpendProposal) ProposalType() string { return ProposalTypeCommunityPoolSpend } - -// ValidateBasic runs basic stateless validity checks -func (csp CommunityPoolSpendProposal) ValidateBasic() error { - err := v036gov.ValidateAbstract(csp) - if err != nil { - return err - } - if !csp.Amount.IsValid() { - return types.ErrInvalidProposalAmount - } - if csp.Recipient.Empty() { - return types.ErrEmptyProposalRecipient - } - - return nil -} - -// String implements the Stringer interface. -func (csp CommunityPoolSpendProposal) String() string { - var b strings.Builder - b.WriteString(fmt.Sprintf(`Community Pool Spend Proposal: - Title: %s - Description: %s - Recipient: %s - Amount: %s -`, csp.Title, csp.Description, csp.Recipient, csp.Amount)) - return b.String() -} - -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) -} diff --git a/x/distribution/legacy/v038/types.go b/x/distribution/legacy/v038/types.go deleted file mode 100644 index be553428a93..00000000000 --- a/x/distribution/legacy/v038/types.go +++ /dev/null @@ -1,58 +0,0 @@ -// Package v038 is used for legacy migration scripts. Actual migration scripts -// for v038 have been removed, but the v039->v042 migration script still -// references types from this file, so we're keeping it for now. -package v038 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - v034distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v034" - v036distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v036" -) - -// DONTCOVER - -const ( - ModuleName = "distribution" -) - -type ( - GenesisState struct { - Params Params `json:"params" yaml:"params"` - FeePool v034distr.FeePool `json:"fee_pool"` - DelegatorWithdrawInfos []v034distr.DelegatorWithdrawInfo `json:"delegator_withdraw_infos"` - PreviousProposer sdk.ConsAddress `json:"previous_proposer" yaml:"previous_proposer"` - OutstandingRewards []v034distr.ValidatorOutstandingRewardsRecord `json:"outstanding_rewards"` - ValidatorAccumulatedCommissions []v034distr.ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions"` - ValidatorHistoricalRewards []v034distr.ValidatorHistoricalRewardsRecord `json:"validator_historical_rewards"` - ValidatorCurrentRewards []v034distr.ValidatorCurrentRewardsRecord `json:"validator_current_rewards"` - DelegatorStartingInfos []v034distr.DelegatorStartingInfoRecord `json:"delegator_starting_infos"` - ValidatorSlashEvents []v036distr.ValidatorSlashEventRecord `json:"validator_slash_events" yaml:"validator_slash_events"` - } - - Params struct { - CommunityTax sdk.Dec `json:"community_tax" yaml:"community_tax"` - BaseProposerReward sdk.Dec `json:"base_proposer_reward" yaml:"base_proposer_reward"` - BonusProposerReward sdk.Dec `json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"` - WithdrawAddrEnabled bool `json:"withdraw_addr_enabled" yaml:"withdraw_addr_enabled"` - } -) - -func NewGenesisState( - params Params, feePool v034distr.FeePool, dwis []v034distr.DelegatorWithdrawInfo, pp sdk.ConsAddress, - r []v034distr.ValidatorOutstandingRewardsRecord, acc []v034distr.ValidatorAccumulatedCommissionRecord, - historical []v034distr.ValidatorHistoricalRewardsRecord, cur []v034distr.ValidatorCurrentRewardsRecord, - dels []v034distr.DelegatorStartingInfoRecord, slashes []v036distr.ValidatorSlashEventRecord, -) GenesisState { - return GenesisState{ - FeePool: feePool, - Params: params, - DelegatorWithdrawInfos: dwis, - PreviousProposer: pp, - OutstandingRewards: r, - ValidatorAccumulatedCommissions: acc, - ValidatorHistoricalRewards: historical, - ValidatorCurrentRewards: cur, - DelegatorStartingInfos: dels, - ValidatorSlashEvents: slashes, - } -} diff --git a/x/distribution/legacy/v040/keys.go b/x/distribution/legacy/v040/keys.go deleted file mode 100644 index 8db36b7e078..00000000000 --- a/x/distribution/legacy/v040/keys.go +++ /dev/null @@ -1,187 +0,0 @@ -// Package v040 is copy-pasted from: -// https://github.com/cosmos/cosmos-sdk/blob/v0.41.0/x/distribution/types/keys.go -package v040 - -import ( - "encoding/binary" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" - v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" -) - -const ( - // ModuleName is the module name constant used in many places - ModuleName = "distribution" - - // StoreKey is the store key string for distribution - StoreKey = ModuleName - - // RouterKey is the message route for distribution - RouterKey = ModuleName - - // QuerierRoute is the querier route for distribution - QuerierRoute = ModuleName -) - -// Keys for distribution store -// Items are stored with the following key: values -// -// - 0x00: FeePol -// -// - 0x01: sdk.ConsAddress -// -// - 0x02: ValidatorOutstandingRewards -// -// - 0x03: sdk.AccAddress -// -// - 0x04: DelegatorStartingInfo -// -// - 0x05: ValidatorHistoricalRewards -// -// - 0x06: ValidatorCurrentRewards -// -// - 0x07: ValidatorCurrentRewards -// -// - 0x08: ValidatorSlashEvent -var ( - FeePoolKey = []byte{0x00} // key for global distribution state - ProposerKey = []byte{0x01} // key for the proposer operator address - ValidatorOutstandingRewardsPrefix = []byte{0x02} // key for outstanding rewards - - DelegatorWithdrawAddrPrefix = []byte{0x03} // key for delegator withdraw address - DelegatorStartingInfoPrefix = []byte{0x04} // key for delegator starting info - ValidatorHistoricalRewardsPrefix = []byte{0x05} // key for historical validators rewards / stake - ValidatorCurrentRewardsPrefix = []byte{0x06} // key for current validator rewards - ValidatorAccumulatedCommissionPrefix = []byte{0x07} // key for accumulated validator commission - ValidatorSlashEventPrefix = []byte{0x08} // key for validator slash fraction -) - -// gets an address from a validator's outstanding rewards key -func GetValidatorOutstandingRewardsAddress(key []byte) (valAddr sdk.ValAddress) { - kv.AssertKeyAtLeastLength(key, 2) - addr := key[1:] - kv.AssertKeyLength(addr, v040auth.AddrLen) - return sdk.ValAddress(addr) -} - -// gets an address from a delegator's withdraw info key -func GetDelegatorWithdrawInfoAddress(key []byte) (delAddr sdk.AccAddress) { - kv.AssertKeyAtLeastLength(key, 2) - addr := key[1:] - kv.AssertKeyLength(addr, v040auth.AddrLen) - return sdk.AccAddress(addr) -} - -// gets the addresses from a delegator starting info key -func GetDelegatorStartingInfoAddresses(key []byte) (valAddr sdk.ValAddress, delAddr sdk.AccAddress) { - kv.AssertKeyAtLeastLength(key, 2+v040auth.AddrLen) - addr := key[1 : 1+v040auth.AddrLen] - kv.AssertKeyLength(addr, v040auth.AddrLen) - valAddr = sdk.ValAddress(addr) - addr = key[1+v040auth.AddrLen:] - kv.AssertKeyLength(addr, v040auth.AddrLen) - delAddr = sdk.AccAddress(addr) - return -} - -// gets the address & period from a validator's historical rewards key -func GetValidatorHistoricalRewardsAddressPeriod(key []byte) (valAddr sdk.ValAddress, period uint64) { - kv.AssertKeyAtLeastLength(key, 2+v040auth.AddrLen) - addr := key[1 : 1+v040auth.AddrLen] - kv.AssertKeyLength(addr, v040auth.AddrLen) - valAddr = sdk.ValAddress(addr) - b := key[1+v040auth.AddrLen:] - kv.AssertKeyLength(addr, 8) - period = binary.LittleEndian.Uint64(b) - return -} - -// gets the address from a validator's current rewards key -func GetValidatorCurrentRewardsAddress(key []byte) (valAddr sdk.ValAddress) { - kv.AssertKeyAtLeastLength(key, 2) - addr := key[1:] - kv.AssertKeyLength(addr, v040auth.AddrLen) - return sdk.ValAddress(addr) -} - -// gets the address from a validator's accumulated commission key -func GetValidatorAccumulatedCommissionAddress(key []byte) (valAddr sdk.ValAddress) { - kv.AssertKeyAtLeastLength(key, 2) - addr := key[1:] - kv.AssertKeyLength(addr, v040auth.AddrLen) - return sdk.ValAddress(addr) -} - -// gets the height from a validator's slash event key -func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.ValAddress, height uint64) { - kv.AssertKeyAtLeastLength(key, 2+v040auth.AddrLen) - addr := key[1 : 1+v040auth.AddrLen] - kv.AssertKeyLength(addr, v040auth.AddrLen) - valAddr = sdk.ValAddress(addr) - startB := 1 + v040auth.AddrLen - kv.AssertKeyAtLeastLength(key, startB+9) - b := key[startB : startB+8] // the next 8 bytes represent the height - height = binary.BigEndian.Uint64(b) - return -} - -// gets the outstanding rewards key for a validator -func GetValidatorOutstandingRewardsKey(valAddr sdk.ValAddress) []byte { - return append(ValidatorOutstandingRewardsPrefix, valAddr.Bytes()...) -} - -// gets the key for a delegator's withdraw addr -func GetDelegatorWithdrawAddrKey(delAddr sdk.AccAddress) []byte { - return append(DelegatorWithdrawAddrPrefix, delAddr.Bytes()...) -} - -// gets the key for a delegator's starting info -func GetDelegatorStartingInfoKey(v sdk.ValAddress, d sdk.AccAddress) []byte { - return append(append(DelegatorStartingInfoPrefix, v.Bytes()...), d.Bytes()...) -} - -// gets the prefix key for a validator's historical rewards -func GetValidatorHistoricalRewardsPrefix(v sdk.ValAddress) []byte { - return append(ValidatorHistoricalRewardsPrefix, v.Bytes()...) -} - -// gets the key for a validator's historical rewards -func GetValidatorHistoricalRewardsKey(v sdk.ValAddress, k uint64) []byte { - b := make([]byte, 8) - binary.LittleEndian.PutUint64(b, k) - return append(append(ValidatorHistoricalRewardsPrefix, v.Bytes()...), b...) -} - -// gets the key for a validator's current rewards -func GetValidatorCurrentRewardsKey(v sdk.ValAddress) []byte { - return append(ValidatorCurrentRewardsPrefix, v.Bytes()...) -} - -// gets the key for a validator's current commission -func GetValidatorAccumulatedCommissionKey(v sdk.ValAddress) []byte { - return append(ValidatorAccumulatedCommissionPrefix, v.Bytes()...) -} - -// gets the prefix key for a validator's slash fractions -func GetValidatorSlashEventPrefix(v sdk.ValAddress) []byte { - return append(ValidatorSlashEventPrefix, v.Bytes()...) -} - -// gets the prefix key for a validator's slash fraction (ValidatorSlashEventPrefix + height) -func GetValidatorSlashEventKeyPrefix(v sdk.ValAddress, height uint64) []byte { - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, height) - return append( - ValidatorSlashEventPrefix, - append(v.Bytes(), heightBz...)..., - ) -} - -// gets the key for a validator's slash fraction -func GetValidatorSlashEventKey(v sdk.ValAddress, height, period uint64) []byte { - periodBz := make([]byte, 8) - binary.BigEndian.PutUint64(periodBz, period) - prefix := GetValidatorSlashEventKeyPrefix(v, height) - return append(prefix, periodBz...) -} diff --git a/x/distribution/legacy/v040/migrate.go b/x/distribution/legacy/v040/migrate.go deleted file mode 100644 index b0ba30bba86..00000000000 --- a/x/distribution/legacy/v040/migrate.go +++ /dev/null @@ -1,108 +0,0 @@ -package v040 - -import ( - v038distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v038" - v040distribution "github.com/cosmos/cosmos-sdk/x/distribution/types" -) - -// Migrate accepts exported x/distribution genesis state from v0.38 and migrates it -// to v0.40 x/distribution genesis state. The migration includes: -// -// - Convert addresses from bytes to bech32 strings. -// - Re-encode in v0.40 GenesisState. -func Migrate(oldDistributionState v038distribution.GenesisState) *v040distribution.GenesisState { - newDelegatorWithdrawInfos := make([]v040distribution.DelegatorWithdrawInfo, len(oldDistributionState.DelegatorWithdrawInfos)) - for i, oldDelegatorWithdrawInfo := range oldDistributionState.DelegatorWithdrawInfos { - newDelegatorWithdrawInfos[i] = v040distribution.DelegatorWithdrawInfo{ - DelegatorAddress: oldDelegatorWithdrawInfo.DelegatorAddress.String(), - WithdrawAddress: oldDelegatorWithdrawInfo.WithdrawAddress.String(), - } - } - - newValidatorOutstandingRewards := make([]v040distribution.ValidatorOutstandingRewardsRecord, len(oldDistributionState.OutstandingRewards)) - for i, oldValidatorOutstandingReward := range oldDistributionState.OutstandingRewards { - newValidatorOutstandingRewards[i] = v040distribution.ValidatorOutstandingRewardsRecord{ - ValidatorAddress: oldValidatorOutstandingReward.ValidatorAddress.String(), - OutstandingRewards: oldValidatorOutstandingReward.OutstandingRewards, - } - } - - newValidatorAccumulatedCommissions := make([]v040distribution.ValidatorAccumulatedCommissionRecord, len(oldDistributionState.ValidatorAccumulatedCommissions)) - for i, oldValidatorAccumulatedCommission := range oldDistributionState.ValidatorAccumulatedCommissions { - newValidatorAccumulatedCommissions[i] = v040distribution.ValidatorAccumulatedCommissionRecord{ - ValidatorAddress: oldValidatorAccumulatedCommission.ValidatorAddress.String(), - Accumulated: v040distribution.ValidatorAccumulatedCommission{ - Commission: oldValidatorAccumulatedCommission.Accumulated, - }, - } - } - - newValidatorHistoricalRewards := make([]v040distribution.ValidatorHistoricalRewardsRecord, len(oldDistributionState.ValidatorHistoricalRewards)) - for i, oldValidatorHistoricalReward := range oldDistributionState.ValidatorHistoricalRewards { - newValidatorHistoricalRewards[i] = v040distribution.ValidatorHistoricalRewardsRecord{ - ValidatorAddress: oldValidatorHistoricalReward.ValidatorAddress.String(), - Period: oldValidatorHistoricalReward.Period, - Rewards: v040distribution.ValidatorHistoricalRewards{ - CumulativeRewardRatio: oldValidatorHistoricalReward.Rewards.CumulativeRewardRatio, - ReferenceCount: uint32(oldValidatorHistoricalReward.Rewards.ReferenceCount), - }, - } - } - - newValidatorCurrentRewards := make([]v040distribution.ValidatorCurrentRewardsRecord, len(oldDistributionState.ValidatorCurrentRewards)) - for i, oldValidatorCurrentReward := range oldDistributionState.ValidatorCurrentRewards { - newValidatorCurrentRewards[i] = v040distribution.ValidatorCurrentRewardsRecord{ - ValidatorAddress: oldValidatorCurrentReward.ValidatorAddress.String(), - Rewards: v040distribution.ValidatorCurrentRewards{ - Rewards: oldValidatorCurrentReward.Rewards.Rewards, - Period: oldValidatorCurrentReward.Rewards.Period, - }, - } - } - - newDelegatorStartingInfos := make([]v040distribution.DelegatorStartingInfoRecord, len(oldDistributionState.DelegatorStartingInfos)) - for i, oldDelegatorStartingInfo := range oldDistributionState.DelegatorStartingInfos { - newDelegatorStartingInfos[i] = v040distribution.DelegatorStartingInfoRecord{ - DelegatorAddress: oldDelegatorStartingInfo.DelegatorAddress.String(), - ValidatorAddress: oldDelegatorStartingInfo.ValidatorAddress.String(), - StartingInfo: v040distribution.DelegatorStartingInfo{ - PreviousPeriod: oldDelegatorStartingInfo.StartingInfo.PreviousPeriod, - Stake: oldDelegatorStartingInfo.StartingInfo.Stake, - Height: oldDelegatorStartingInfo.StartingInfo.Height, - }, - } - } - - newValidatorSlashEvents := make([]v040distribution.ValidatorSlashEventRecord, len(oldDistributionState.ValidatorSlashEvents)) - for i, oldValidatorSlashEvent := range oldDistributionState.ValidatorSlashEvents { - newValidatorSlashEvents[i] = v040distribution.ValidatorSlashEventRecord{ - ValidatorAddress: oldValidatorSlashEvent.ValidatorAddress.String(), - Height: oldValidatorSlashEvent.Height, - Period: oldValidatorSlashEvent.Period, - ValidatorSlashEvent: v040distribution.ValidatorSlashEvent{ - ValidatorPeriod: oldValidatorSlashEvent.Event.ValidatorPeriod, - Fraction: oldValidatorSlashEvent.Event.Fraction, - }, - } - } - - return &v040distribution.GenesisState{ - Params: v040distribution.Params{ - CommunityTax: oldDistributionState.Params.CommunityTax, - BaseProposerReward: oldDistributionState.Params.BaseProposerReward, - BonusProposerReward: oldDistributionState.Params.BonusProposerReward, - WithdrawAddrEnabled: oldDistributionState.Params.WithdrawAddrEnabled, - }, - FeePool: v040distribution.FeePool{ - CommunityPool: oldDistributionState.FeePool.CommunityPool, - }, - DelegatorWithdrawInfos: newDelegatorWithdrawInfos, - PreviousProposer: oldDistributionState.PreviousProposer.String(), - OutstandingRewards: newValidatorOutstandingRewards, - ValidatorAccumulatedCommissions: newValidatorAccumulatedCommissions, - ValidatorHistoricalRewards: newValidatorHistoricalRewards, - ValidatorCurrentRewards: newValidatorCurrentRewards, - DelegatorStartingInfos: newDelegatorStartingInfos, - ValidatorSlashEvents: newValidatorSlashEvents, - } -} diff --git a/x/distribution/legacy/v043/helpers.go b/x/distribution/legacy/v043/helpers.go deleted file mode 100644 index 7be7e1e40be..00000000000 --- a/x/distribution/legacy/v043/helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -package v043 - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" - v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" -) - -// MigratePrefixAddress is a helper function that migrates all keys of format: -// prefix_bytes | address_bytes -// into format: -// prefix_bytes | address_len (1 byte) | address_bytes -func MigratePrefixAddress(store sdk.KVStore, prefixBz []byte) { - oldStore := prefix.NewStore(store, prefixBz) - - oldStoreIter := oldStore.Iterator(nil, nil) - defer oldStoreIter.Close() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - addr := oldStoreIter.Key() - newStoreKey := prefixBz - newStoreKey = append(newStoreKey, address.MustLengthPrefix(addr)...) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - oldStore.Delete(oldStoreIter.Key()) - } -} - -// MigratePrefixAddressBytes is a helper function that migrates all keys of format: -// prefix_bytes | address_bytes | arbitrary_bytes -// into format: -// prefix_bytes | address_len (1 byte) | address_bytes | arbitrary_bytes -func MigratePrefixAddressBytes(store sdk.KVStore, prefixBz []byte) { - oldStore := prefix.NewStore(store, prefixBz) - - oldStoreIter := oldStore.Iterator(nil, nil) - defer oldStoreIter.Close() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - addr := oldStoreIter.Key()[:v040auth.AddrLen] - endBz := oldStoreIter.Key()[v040auth.AddrLen:] - newStoreKey := append(append(prefixBz, address.MustLengthPrefix(addr)...), endBz...) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - oldStore.Delete(oldStoreIter.Key()) - } -} - -// MigratePrefixAddressAddress is a helper function that migrates all keys of format: -// prefix_bytes | address_1_bytes | address_2_bytes -// into format: -// prefix_bytes | address_1_len (1 byte) | address_1_bytes | address_2_len (1 byte) | address_2_bytes -func MigratePrefixAddressAddress(store sdk.KVStore, prefixBz []byte) { - oldStore := prefix.NewStore(store, prefixBz) - - oldStoreIter := oldStore.Iterator(nil, nil) - defer oldStoreIter.Close() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - addr1 := oldStoreIter.Key()[:v040auth.AddrLen] - addr2 := oldStoreIter.Key()[v040auth.AddrLen:] - newStoreKey := append(append(prefixBz, address.MustLengthPrefix(addr1)...), address.MustLengthPrefix(addr2)...) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - oldStore.Delete(oldStoreIter.Key()) - } -} diff --git a/x/distribution/legacy/v043/store.go b/x/distribution/legacy/v043/store.go deleted file mode 100644 index 4448c59b75f..00000000000 --- a/x/distribution/legacy/v043/store.go +++ /dev/null @@ -1,23 +0,0 @@ -package v043 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - v040distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v040" -) - -// MigrateStore performs in-place store migrations from v0.40 to v0.43. The -// migration includes: -// -// - Change addresses to be length-prefixed. -func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error { - store := ctx.KVStore(storeKey) - MigratePrefixAddress(store, v040distribution.ValidatorOutstandingRewardsPrefix) - MigratePrefixAddress(store, v040distribution.DelegatorWithdrawAddrPrefix) - MigratePrefixAddressAddress(store, v040distribution.DelegatorStartingInfoPrefix) - MigratePrefixAddressBytes(store, v040distribution.ValidatorHistoricalRewardsPrefix) - MigratePrefixAddress(store, v040distribution.ValidatorCurrentRewardsPrefix) - MigratePrefixAddress(store, v040distribution.ValidatorAccumulatedCommissionPrefix) - MigratePrefixAddressBytes(store, v040distribution.ValidatorSlashEventPrefix) - - return nil -} diff --git a/x/distribution/legacy/v043/store_test.go b/x/distribution/legacy/v043/store_test.go deleted file mode 100644 index c719d34ddb1..00000000000 --- a/x/distribution/legacy/v043/store_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package v043_test - -import ( - "bytes" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - v040distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v040" - v043distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" - "github.com/cosmos/cosmos-sdk/x/distribution/types" -) - -func TestStoreMigration(t *testing.T) { - distributionKey := sdk.NewKVStoreKey("distribution") - ctx := testutil.DefaultContext(distributionKey, sdk.NewTransientStoreKey("transient_test")) - store := ctx.KVStore(distributionKey) - - _, _, addr1 := testdata.KeyTestPubAddr() - valAddr := sdk.ValAddress(addr1) - _, _, addr2 := testdata.KeyTestPubAddr() - // Use dummy value for all keys. - value := []byte("foo") - - testCases := []struct { - name string - oldKey []byte - newKey []byte - }{ - { - "FeePoolKey", - v040distribution.FeePoolKey, - types.FeePoolKey, - }, - { - "ProposerKey", - v040distribution.ProposerKey, - types.ProposerKey, - }, - { - "ValidatorOutstandingRewards", - v040distribution.GetValidatorOutstandingRewardsKey(valAddr), - types.GetValidatorOutstandingRewardsKey(valAddr), - }, - { - "DelegatorWithdrawAddr", - v040distribution.GetDelegatorWithdrawAddrKey(addr2), - types.GetDelegatorWithdrawAddrKey(addr2), - }, - { - "DelegatorStartingInfo", - v040distribution.GetDelegatorStartingInfoKey(valAddr, addr2), - types.GetDelegatorStartingInfoKey(valAddr, addr2), - }, - { - "ValidatorHistoricalRewards", - v040distribution.GetValidatorHistoricalRewardsKey(valAddr, 6), - types.GetValidatorHistoricalRewardsKey(valAddr, 6), - }, - { - "ValidatorCurrentRewards", - v040distribution.GetValidatorCurrentRewardsKey(valAddr), - types.GetValidatorCurrentRewardsKey(valAddr), - }, - { - "ValidatorAccumulatedCommission", - v040distribution.GetValidatorAccumulatedCommissionKey(valAddr), - types.GetValidatorAccumulatedCommissionKey(valAddr), - }, - { - "ValidatorSlashEvent", - v040distribution.GetValidatorSlashEventKey(valAddr, 6, 8), - types.GetValidatorSlashEventKey(valAddr, 6, 8), - }, - } - - // Set all the old keys to the store - for _, tc := range testCases { - store.Set(tc.oldKey, value) - } - - // Run migrations. - err := v043distribution.MigrateStore(ctx, distributionKey) - require.NoError(t, err) - - // Make sure the new keys are set and old keys are deleted. - for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - if !bytes.Equal(tc.oldKey, tc.newKey) { - require.Nil(t, store.Get(tc.oldKey)) - } - require.Equal(t, value, store.Get(tc.newKey)) - }) - } -} diff --git a/x/distribution/module.go b/x/distribution/module.go index bb958b2c68a..6bcb35df6c4 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -6,9 +6,8 @@ import ( "fmt" "math/rand" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -19,10 +18,10 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/distribution/client/cli" - "github.com/cosmos/cosmos-sdk/x/distribution/client/rest" "github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/distribution/simulation" "github.com/cosmos/cosmos-sdk/x/distribution/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) var ( @@ -53,7 +52,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the distribution module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -63,13 +62,15 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEn } // RegisterRESTRoutes registers the REST routes for the distribution module. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx sdkclient.Context, rtr *mux.Router) { - rest.RegisterHandlers(clientCtx, rtr) -} +// Deprecated: RegisterRESTRoutes is deprecated. `x/distribution` legacy REST implementation +// has been removed from the SDK. +func (AppModuleBasic) RegisterRESTRoutes(_ sdkclient.Context, _ *mux.Router) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the distribution module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root tx command for the distribution module. @@ -94,13 +95,13 @@ type AppModule struct { keeper keeper.Keeper accountKeeper types.AccountKeeper bankKeeper types.BankKeeper - stakingKeeper types.StakingKeeper + stakingKeeper stakingkeeper.Keeper } // NewAppModule creates a new AppModule object func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, + bankKeeper types.BankKeeper, stakingKeeper stakingkeeper.Keeper, ) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, @@ -121,9 +122,9 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { keeper.RegisterInvariants(ir, am.keeper) } -// Route returns the message routing key for the distribution module. +// Deprecated: Route returns the message routing key for the distribution module. func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) + return sdk.Route{} } // QuerierRoute returns the distribution module's querier route name. @@ -140,9 +141,6 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - - m := keeper.NewMigrator(am.keeper) - cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) } // InitGenesis performs genesis initialization for the distribution module. It returns @@ -169,6 +167,12 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) } +// EndBlock returns the end blocker for the distribution module. It returns no validator +// updates. +func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} + // AppModuleSimulation functions // GenerateGenesisState creates a randomized GenState of the distribution module. @@ -178,7 +182,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // ProposalContents returns all the distribution content functions used to // simulate governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return simulation.ProposalContents(am.keeper) } diff --git a/x/distribution/module_test.go b/x/distribution/module_test.go index 113622d208e..64c2b720220 100644 --- a/x/distribution/module_test.go +++ b/x/distribution/module_test.go @@ -5,24 +5,33 @@ import ( "github.com/stretchr/testify/require" abcitypes "github.com/tendermint/tendermint/abci/types" + tmjson "github.com/tendermint/tendermint/libs/json" + "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" ) func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { - app := simapp.Setup(false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + db := dbm.NewMemDB() + encCdc := simapp.MakeTestEncodingConfig() + app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, encCdc, simapp.EmptyAppOptions{}) + + genesisState := simapp.GenesisStateWithSingleValidator(t, app) + stateBytes, err := tmjson.Marshal(genesisState) + require.NoError(t, err) app.InitChain( abcitypes.RequestInitChain{ - AppStateBytes: []byte("{}"), + AppStateBytes: stateBytes, ChainId: "test-chain-id", }, ) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) acc := app.AccountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.ModuleName)) require.NotNil(t, acc) } diff --git a/x/distribution/proposal_handler_test.go b/x/distribution/proposal_handler_test.go index a9b11b321df..f8527e98fef 100644 --- a/x/distribution/proposal_handler_test.go +++ b/x/distribution/proposal_handler_test.go @@ -7,7 +7,8 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution" "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -32,8 +33,8 @@ func TestProposalHandlerPassed(t *testing.T) { // add coins to the module account macc := app.DistrKeeper.GetDistributionAccount(ctx) - balances := app.BankKeeper.GetAllBalances(ctx, macc.GetAddress()) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, macc.GetName(), amount)) + _ = app.BankKeeper.GetAllBalances(ctx, macc.GetAddress()) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, macc.GetName(), amount)) app.AccountKeeper.SetModuleAccount(ctx, macc) @@ -49,7 +50,7 @@ func TestProposalHandlerPassed(t *testing.T) { hdlr := distribution.NewCommunityPoolSpendProposalHandler(app.DistrKeeper) require.NoError(t, hdlr(ctx, tp)) - balances = app.BankKeeper.GetAllBalances(ctx, recipient) + balances := app.BankKeeper.GetAllBalances(ctx, recipient) require.Equal(t, balances, amount) } @@ -57,6 +58,9 @@ func TestProposalHandlerFailed(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + // reset fee pool + app.DistrKeeper.SetFeePool(ctx, types.InitialFeePool()) + recipient := delAddr1 account := app.AccountKeeper.NewAccountWithAddress(ctx, recipient) diff --git a/x/distribution/simulation/decoder_test.go b/x/distribution/simulation/decoder_test.go index 69bb6b3b77a..744a3fd6097 100644 --- a/x/distribution/simulation/decoder_test.go +++ b/x/distribution/simulation/decoder_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/x/distribution/simulation" diff --git a/x/distribution/simulation/operations.go b/x/distribution/simulation/operations.go index 9d898d07f9c..6801def5b0d 100644 --- a/x/distribution/simulation/operations.go +++ b/x/distribution/simulation/operations.go @@ -15,12 +15,17 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) +const DefaultWeightMsgWithdrawAllTokenizeShareRecordReward int = 50 + // Simulation operation weights constants +// +//nolint:gosec // these are weights for simulation, not hard coded credentials const ( - OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" //nolint:gosec - OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" //nolint:gosec - OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" //nolint:gosec - OpWeightMsgFundCommunityPool = "op_weight_msg_fund_community_pool" //nolint:gosec + OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" + OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" + OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" + OpWeightMsgFundCommunityPool = "op_weight_msg_fund_community_pool" + OpWeightMsgWithdrawTokenizeShareRecordReward = "op_weight_msg_withdraw_tokenize_share_record_reward" ) // WeightedOperations returns all the operations from the module with their respective weights @@ -53,6 +58,13 @@ func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak ty }, ) + var weightMsgWithdrawTokenizeShareRecordReward int + appParams.GetOrGenerate(cdc, OpWeightMsgWithdrawTokenizeShareRecordReward, &weightMsgWithdrawTokenizeShareRecordReward, nil, + func(_ *rand.Rand) { + weightMsgWithdrawTokenizeShareRecordReward = DefaultWeightMsgWithdrawAllTokenizeShareRecordReward + }, + ) + stakeKeeper := sk.(stakingkeeper.Keeper) return simulation.WeightedOperations{ @@ -72,6 +84,10 @@ func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak ty weightMsgFundCommunityPool, SimulateMsgFundCommunityPool(ak, bk, k, stakeKeeper), ), + simulation.NewWeightedOperation( + weightMsgWithdrawTokenizeShareRecordReward, + SimulateMsgWithdrawTokenizeShareRecordReward(ak, bk, k, stakeKeeper), + ), } } @@ -112,7 +128,7 @@ func SimulateMsgSetWithdrawAddress(ak types.AccountKeeper, bk types.BankKeeper, } // SimulateMsgWithdrawDelegatorReward generates a MsgWithdrawDelegatorReward with random values. -func SimulateMsgWithdrawDelegatorReward(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper) simtypes.Operation { +func SimulateMsgWithdrawDelegatorReward(ak types.AccountKeeper, bk types.BankKeeper, _ keeper.Keeper, sk stakingkeeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -199,7 +215,7 @@ func SimulateMsgWithdrawValidatorCommission(ak types.AccountKeeper, bk types.Ban // SimulateMsgFundCommunityPool simulates MsgFundCommunityPool execution where // a random account sends a random amount of its funds to the community pool. -func SimulateMsgFundCommunityPool(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper) simtypes.Operation { +func SimulateMsgFundCommunityPool(ak types.AccountKeeper, bk types.BankKeeper, _ keeper.Keeper, _ stakingkeeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { @@ -244,3 +260,51 @@ func SimulateMsgFundCommunityPool(ak types.AccountKeeper, bk types.BankKeeper, k return simulation.GenAndDeliverTx(txCtx, fees) } } + +// SimulateMsgWithdrawTokenizeShareRecordReward simulates MsgWithdrawTokenizeShareRecordReward execution where +// a random account claim tokenize share record rewards. +func SimulateMsgWithdrawTokenizeShareRecordReward(ak types.AccountKeeper, bk types.BankKeeper, _ keeper.Keeper, sk stakingkeeper.Keeper) simtypes.Operation { + return func( + r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + rewardOwner, _ := simtypes.RandomAcc(r, accs) + + records := sk.GetAllTokenizeShareRecords(ctx) + if len(records) > 0 { + record := records[r.Intn(len(records))] + for _, acc := range accs { + if acc.Address.String() == record.Owner { + rewardOwner = acc + break + } + } + } + + // if simaccount.PrivKey == nil, delegation address does not exist in accs. Return error + if rewardOwner.PrivKey == nil { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgWithdrawTokenizeShareRecordReward, "account private key is nil"), nil, nil + } + + msg := types.NewMsgWithdrawAllTokenizeShareRecordReward(rewardOwner.Address) + + account := ak.GetAccount(ctx, rewardOwner.Address) + spendable := bk.SpendableCoins(ctx, account.GetAddress()) + + txCtx := simulation.OperationInput{ + R: r, + App: app, + TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + Cdc: nil, + Msg: msg, + MsgType: msg.Type(), + Context: ctx, + SimAccount: rewardOwner, + AccountKeeper: ak, + Bankkeeper: bk, + ModuleName: types.ModuleName, + CoinsSpentInMsg: spendable, + } + + return simulation.GenAndDeliverTxWithRandFees(txCtx) + } +} diff --git a/x/distribution/simulation/operations_test.go b/x/distribution/simulation/operations_test.go index 0e5dfdd4613..af1555ccf04 100644 --- a/x/distribution/simulation/operations_test.go +++ b/x/distribution/simulation/operations_test.go @@ -4,17 +4,19 @@ import ( "math/rand" "testing" + "github.com/cosmos/cosmos-sdk/codec/legacy" + "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/simapp" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + simapp "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/distribution/simulation" "github.com/cosmos/cosmos-sdk/x/distribution/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -41,6 +43,7 @@ func (suite *SimTestSuite) TestWeightedOperations() { {simappparams.DefaultWeightMsgWithdrawDelegationReward, types.ModuleName, types.TypeMsgWithdrawDelegatorReward}, {simappparams.DefaultWeightMsgWithdrawValidatorCommission, types.ModuleName, types.TypeMsgWithdrawValidatorCommission}, {simappparams.DefaultWeightMsgFundCommunityPool, types.ModuleName, types.TypeMsgFundCommunityPool}, + {simulation.DefaultWeightMsgWithdrawAllTokenizeShareRecordReward, types.ModuleName, types.TypeMsgWithdrawAllTokenizeShareRecordReward}, } for i, w := range weightesOps { @@ -71,7 +74,8 @@ func (suite *SimTestSuite) TestSimulateMsgSetWithdrawAddress() { suite.Require().NoError(err) var msg types.MsgSetWithdrawAddress - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) + err = legacy.Cdc.UnmarshalJSON(operationMsg.Msg, &msg) + suite.Require().NoError(err) suite.Require().True(operationMsg.OK) suite.Require().Equal("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.DelegatorAddress) @@ -97,9 +101,9 @@ func (suite *SimTestSuite) TestSimulateMsgWithdrawDelegatorReward() { delTokens := suite.app.StakingKeeper.TokensFromConsensusPower(suite.ctx, 2) validator0, issuedShares := validator0.AddTokensFromDel(delTokens) delegator := accounts[1] - delegation := stakingtypes.NewDelegation(delegator.Address, validator0.GetOperator(), issuedShares) + delegation := stakingtypes.NewDelegation(delegator.Address, validator0.GetOperator(), issuedShares, false) suite.app.StakingKeeper.SetDelegation(suite.ctx, delegation) - suite.app.DistrKeeper.SetDelegatorStartingInfo(suite.ctx, validator0.GetOperator(), delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200)) + suite.app.DistrKeeper.SetDelegatorStartingInfo(suite.ctx, validator0.GetOperator(), delegator.Address, types.NewDelegatorStartingInfo(2, sdk.OneDec(), 200)) suite.setupValidatorRewards(validator0.GetOperator()) @@ -112,7 +116,8 @@ func (suite *SimTestSuite) TestSimulateMsgWithdrawDelegatorReward() { suite.Require().NoError(err) var msg types.MsgWithdrawDelegatorReward - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) + err = legacy.Cdc.UnmarshalJSON(operationMsg.Msg, &msg) + suite.Require().NoError(err) suite.Require().True(operationMsg.OK) suite.Require().Equal("cosmosvaloper1l4s054098kk9hmr5753c6k3m2kw65h686d3mhr", msg.ValidatorAddress) @@ -142,7 +147,7 @@ func (suite *SimTestSuite) testSimulateMsgWithdrawValidatorCommission(tokenName // set module account coins distrAcc := suite.app.DistrKeeper.GetDistributionAccount(suite.ctx) - suite.Require().NoError(simapp.FundModuleAccount(suite.app.BankKeeper, suite.ctx, distrAcc.GetName(), sdk.NewCoins( + suite.Require().NoError(simapp_test.FundModuleAccount(suite.app.BankKeeper, suite.ctx, distrAcc.GetName(), sdk.NewCoins( sdk.NewCoin(tokenName, sdk.NewInt(10)), sdk.NewCoin("stake", sdk.NewInt(5)), ))) @@ -155,9 +160,11 @@ func (suite *SimTestSuite) testSimulateMsgWithdrawValidatorCommission(tokenName ) suite.app.DistrKeeper.SetValidatorOutstandingRewards(suite.ctx, validator0.GetOperator(), types.ValidatorOutstandingRewards{Rewards: valCommission}) + suite.app.DistrKeeper.SetValidatorOutstandingRewards(suite.ctx, suite.genesisVals[0].GetOperator(), types.ValidatorOutstandingRewards{Rewards: valCommission}) // setup validator accumulated commission suite.app.DistrKeeper.SetValidatorAccumulatedCommission(suite.ctx, validator0.GetOperator(), types.ValidatorAccumulatedCommission{Commission: valCommission}) + suite.app.DistrKeeper.SetValidatorAccumulatedCommission(suite.ctx, suite.genesisVals[0].GetOperator(), types.ValidatorAccumulatedCommission{Commission: valCommission}) // begin a new block suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) @@ -165,16 +172,21 @@ func (suite *SimTestSuite) testSimulateMsgWithdrawValidatorCommission(tokenName // execute operation op := simulation.SimulateMsgWithdrawValidatorCommission(suite.app.AccountKeeper, suite.app.BankKeeper, suite.app.DistrKeeper, suite.app.StakingKeeper) operationMsg, futureOperations, err := op(r, suite.app.BaseApp, suite.ctx, accounts, "") - suite.Require().NoError(err) - - var msg types.MsgWithdrawValidatorCommission - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - - suite.Require().True(operationMsg.OK) - suite.Require().Equal("cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress) - suite.Require().Equal(types.TypeMsgWithdrawValidatorCommission, msg.Type()) - suite.Require().Equal(types.ModuleName, msg.Route()) - suite.Require().Len(futureOperations, 0) + if !operationMsg.OK { + suite.Require().Equal("could not find account", operationMsg.Comment) + } else { + suite.Require().NoError(err) + + var msg types.MsgWithdrawValidatorCommission + err = legacy.Cdc.UnmarshalJSON(operationMsg.Msg, &msg) + suite.Require().NoError(err) + + suite.Require().True(operationMsg.OK) + suite.Require().Equal("cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress) + suite.Require().Equal(types.TypeMsgWithdrawValidatorCommission, msg.Type()) + suite.Require().Equal(types.ModuleName, msg.Route()) + suite.Require().Len(futureOperations, 0) + } } // TestSimulateMsgFundCommunityPool tests the normal scenario of a valid message of type TypeMsgFundCommunityPool. @@ -194,7 +206,8 @@ func (suite *SimTestSuite) TestSimulateMsgFundCommunityPool() { suite.Require().NoError(err) var msg types.MsgFundCommunityPool - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) + err = legacy.Cdc.UnmarshalJSON(operationMsg.Msg, &msg) + suite.Require().NoError(err) suite.Require().True(operationMsg.OK) suite.Require().Equal("4896096stake", msg.Amount.String()) @@ -207,18 +220,22 @@ func (suite *SimTestSuite) TestSimulateMsgFundCommunityPool() { type SimTestSuite struct { suite.Suite - ctx sdk.Context - app *simapp.SimApp + ctx sdk.Context + app *simapp.SimApp + genesisVals []stakingtypes.Validator } func (suite *SimTestSuite) SetupTest() { checkTx := false - app := simapp.Setup(checkTx) + app := simapp.SetupWithValSet(suite.T(), false) suite.app = app suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{}) + genesisVals := app.StakingKeeper.GetAllValidators(suite.ctx) + suite.Require().Len(genesisVals, 1) + suite.genesisVals = genesisVals } -func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Account { +func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Account { //nolint:unparam // n always receives 3, but it might be used differently in the future. accounts := simtypes.RandomAccounts(r, n) initAmt := suite.app.StakingKeeper.TokensFromConsensusPower(suite.ctx, 200) @@ -228,7 +245,7 @@ func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Ac for _, account := range accounts { acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, account.Address) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) - suite.Require().NoError(simapp.FundAccount(suite.app.BankKeeper, suite.ctx, account.Address, initCoins)) + suite.Require().NoError(simapp_test.FundAccount(suite.app.BankKeeper, suite.ctx, account.Address, initCoins)) } return accounts @@ -259,10 +276,10 @@ func (suite *SimTestSuite) getTestingValidator(accounts []simtypes.Account, comm func (suite *SimTestSuite) setupValidatorRewards(valAddress sdk.ValAddress) { decCoins := sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdk.OneDec())} - historicalRewards := distrtypes.NewValidatorHistoricalRewards(decCoins, 2) + historicalRewards := types.NewValidatorHistoricalRewards(decCoins, 2) suite.app.DistrKeeper.SetValidatorHistoricalRewards(suite.ctx, valAddress, 2, historicalRewards) // setup current revards - currentRewards := distrtypes.NewValidatorCurrentRewards(decCoins, 3) + currentRewards := types.NewValidatorCurrentRewards(decCoins, 3) suite.app.DistrKeeper.SetValidatorCurrentRewards(suite.ctx, valAddress, currentRewards) } diff --git a/x/distribution/simulation/params.go b/x/distribution/simulation/params.go index 98fcec342fd..826b95e3ee2 100644 --- a/x/distribution/simulation/params.go +++ b/x/distribution/simulation/params.go @@ -20,7 +20,7 @@ const ( // ParamChanges defines the parameters that can be modified by param change proposals // on the simulation -func ParamChanges(r *rand.Rand) []simtypes.ParamChange { +func ParamChanges(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ simulation.NewSimParamChange(types.ModuleName, keyCommunityTax, func(r *rand.Rand) string { diff --git a/x/distribution/simulation/proposals_test.go b/x/distribution/simulation/proposals_test.go index 6d5895ea8df..f1cebef0fc0 100644 --- a/x/distribution/simulation/proposals_test.go +++ b/x/distribution/simulation/proposals_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" diff --git a/x/distribution/spec/03_begin_block.md b/x/distribution/spec/03_begin_block.md index bf279759da7..0b68aa7963e 100644 --- a/x/distribution/spec/03_begin_block.md +++ b/x/distribution/spec/03_begin_block.md @@ -9,9 +9,9 @@ the distribution `ModuleAccount` account. When a delegator or validator withdraws their rewards, they are taken out of the `ModuleAccount`. During begin block, the different claims on the fees collected are updated as follows: -- The block proposer of the previous height and its delegators receive between 1% and 5% of fee rewards. -- The reserve community tax is charged. -- The remainder is distributed proportionally by voting power to all bonded validators +* The block proposer of the previous height and its delegators receive between 1% and 5% of fee rewards. +* The reserve community tax is charged. +* The remainder is distributed proportionally by voting power to all bonded validators To incentivize validators to wait and include additional pre-commits in the block, the block proposer reward is calculated from Tendermint pre-commit messages. @@ -45,7 +45,7 @@ only bonded validators can supply valid precommits) and is always larger than Any remaining fees are distributed among all the bonded validators, including the proposer, in proportion to their consensus power. -``` +```text powFrac = validator power / total bonded validator power proposerMul = baseproposerreward + bonusproposerreward * P voteMul = 1 - communitytax - proposerMul @@ -79,7 +79,7 @@ blocks. Then hold `(precommits included) / (total bonded validator power)` constant so that the amortized block reward for the validator is `( validator power / total bonded power) * (1 - community tax rate)` of the total rewards. Consequently, the reward for a single delegator is: -``` +```text (delegator proportion of the validator power / validator power) * (validator power / total bonded power) * (1 - community tax rate) * (1 - validator commision rate) = (delegator proportion of the validator power / total bonded power) * (1 - diff --git a/x/distribution/spec/04_messages.md b/x/distribution/spec/04_messages.md index 65fde1af039..2017a570018 100644 --- a/x/distribution/spec/04_messages.md +++ b/x/distribution/spec/04_messages.md @@ -47,7 +47,7 @@ Taking the slashes into account requires iteration. Let `F(X)` be the fraction a validator is to be slashed for a slashing event that happened at period `X`. If the validator was slashed at periods `P1, ..., PN`, where `A < P1`, `PN < B`, the distribution module calculates the individual delegator's rewards, `T(A, B)`, as follows: -``` +```go stake := initial stake rewards := 0 previous := A @@ -72,6 +72,14 @@ The commission is calculated in every block during `BeginBlock`, so no iteration The amount withdrawn is deducted from the `ValidatorOutstandingRewards` variable for the validator. Only integer amounts can be sent. If the accumulated awards have decimals, the amount is truncated before the withdrawal is sent, and the remainder is left to be withdrawn later. +## MsgWithdrawTokenizeShareRecordReward + +A `TokenizeShareRecords` owner can send the MsgWithdrawTokenizeShareRecordReward message to withraw their rewards allocated for tokenized amount of staking tokens. + +The middle account (1:1 assigned per tokenize share record) takes the role of a delegator. + +While executing the message, handler iterates all the tokenize share records, withdraw delegation reward from each record account and send the rewards to the record owner. + ## FundCommunityPool This message sends coins directly from the sender to the community pool. diff --git a/x/distribution/spec/08_client.md b/x/distribution/spec/08_client.md new file mode 100644 index 00000000000..8e547ba4692 --- /dev/null +++ b/x/distribution/spec/08_client.md @@ -0,0 +1,469 @@ + + +# Client + +## CLI + +A user can query and interact with the `distribution` module using the CLI. + +### Query + +The `query` commands allow users to query `distribution` state. + +```sh +simd query distribution --help +``` + +#### commission + +The `commission` command allows users to query validator commission rewards by address. + +```sh +simd query distribution commission [address] [flags] +``` + +Example: + +```sh +simd query distribution commission cosmosvaloper1.. +``` + +Example Output: + +```yml +commission: +- amount: "1000000.000000000000000000" + denom: stake +``` + +#### community-pool + +The `community-pool` command allows users to query all coin balances within the community pool. + +```sh +simd query distribution community-pool [flags] +``` + +Example: + +```sh +simd query distribution community-pool +``` + +Example Output: + +```yml +pool: +- amount: "1000000.000000000000000000" + denom: stake +``` + +#### params + +The `params` command allows users to query the parameters of the `distribution` module. + +```sh +simd query distribution params [flags] +``` + +Example: + +```sh +simd query distribution params +``` + +Example Output: + +```yml +base_proposer_reward: "0.010000000000000000" +bonus_proposer_reward: "0.040000000000000000" +community_tax: "0.020000000000000000" +withdraw_addr_enabled: true +``` + +#### rewards + +The `rewards` command allows users to query delegator rewards. Users can optionally include the validator address to query rewards earned from a specific validator. + +```sh +simd query distribution rewards [delegator-addr] [validator-addr] [flags] +``` + +Example: + +```sh +simd query distribution rewards cosmos1.. +``` + +Example Output: + +```yml +rewards: +- reward: + - amount: "1000000.000000000000000000" + denom: stake + validator_address: cosmosvaloper1.. +total: +- amount: "1000000.000000000000000000" + denom: stake +``` + +#### slashes + +The `slashes` command allows users to query all slashes for a given block range. + +```sh +simd query distribution slashes [validator] [start-height] [end-height] [flags] +``` + +Example: + +```sh +simd query distribution slashes cosmosvaloper1.. 1 1000 +``` + +Example Output: + +```yml +pagination: + next_key: null + total: "0" +slashes: +- validator_period: 20, + fraction: "0.009999999999999999" +``` + +#### validator-outstanding-rewards + +The `validator-outstanding-rewards` command allows users to query all outstanding (un-withdrawn) rewards for a validator and all their delegations. + +```sh +simd query distribution validator-outstanding-rewards [validator] [flags] +``` + +Example: + +```sh +simd query distribution validator-outstanding-rewards cosmosvaloper1.. +``` + +Example Output: + +```yml +rewards: +- amount: "1000000.000000000000000000" + denom: stake +``` + +### Transactions + +The `tx` commands allow users to interact with the `distribution` module. + +```sh +simd tx distribution --help +``` + +#### fund-community-pool + +The `fund-community-pool` command allows users to send funds to the community pool. + +```sh +simd tx distribution fund-community-pool [amount] [flags] +``` + +Example: + +```sh +simd tx distribution fund-community-pool 100stake --from cosmos1.. +``` + +#### set-withdraw-addr + +The `set-withdraw-addr` command allows users to set the withdraw address for rewards associated with a delegator address. + +```sh +simd tx distribution set-withdraw-addr [withdraw-addr] [flags] +``` + +Example: + +```sh +simd tx distribution set-withdraw-addr cosmos1.. --from cosmos1.. +``` + +#### withdraw-all-rewards + +The `withdraw-all-rewards` command allows users to withdraw all rewards for a delegator. + +```sh +simd tx distribution withdraw-all-rewards [flags] +``` + +Example: + +```sh +simd tx distribution withdraw-all-rewards --from cosmos1.. +``` + +#### withdraw-rewards + +The `withdraw-rewards` command allows users to withdraw all rewards from a given delegation address, +and optionally withdraw validator commission if the delegation address given is a validator operator and the user proves the `--commision` flag. + +```sh +simd tx distribution withdraw-rewards [validator-addr] [flags] +``` + +Example: + +```sh +simd tx distribution withdraw-rewards cosmosvaloper1.. --from cosmos1.. --commision +``` + +## gRPC + +A user can query the `distribution` module using gRPC endpoints. + +### Params + +The `Params` endpoint allows users to query parameters of the `distribution` module. + +Example: + +```sh +grpcurl -plaintext \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/Params +``` + +Example Output: + +```json +{ + "params": { + "communityTax": "20000000000000000", + "baseProposerReward": "10000000000000000", + "bonusProposerReward": "40000000000000000", + "withdrawAddrEnabled": true + } +} +``` + +### ValidatorOutstandingRewards + +The `ValidatorOutstandingRewards` endpoint allows users to query rewards of a validator address. + +Example: + +```sh +grpcurl -plaintext \ + -d '{"validator_address":"cosmosvalop1.."}' \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/ValidatorOutstandingRewards +``` + +Example Output: + +```json +{ + "rewards": { + "rewards": [ + { + "denom": "stake", + "amount": "1000000000000000" + } + ] + } +} +``` + +### ValidatorCommission + +The `ValidatorCommission` endpoint allows users to query accumulated commission for a validator. + +Example: + +```sh +grpcurl -plaintext \ + -d '{"validator_address":"cosmosvalop1.."}' \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/ValidatorCommission +``` + +Example Output: + +```json +{ + "commission": { + "commission": [ + { + "denom": "stake", + "amount": "1000000000000000" + } + ] + } +} +``` + +### ValidatorSlashes + +The `ValidatorSlashes` endpoint allows users to query slash events of a validator. + +Example: + +```sh +grpcurl -plaintext \ + -d '{"validator_address":"cosmosvalop1.."}' \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/ValidatorSlashes +``` + +Example Output: + +```json +{ + "slashes": [ + { + "validator_period": "20", + "fraction": "0.009999999999999999" + } + ], + "pagination": { + "total": "1" + } +} +``` + +### DelegationRewards + +The `DelegationRewards` endpoint allows users to query the total rewards accrued by a delegation. + +Example: + +```sh +grpcurl -plaintext \ + -d '{"delegator_address":"cosmos1..","validator_address":"cosmosvalop1.."}' \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/DelegationRewards +``` + +Example Output: + +```json +{ + "rewards": [ + { + "denom": "stake", + "amount": "1000000000000000" + } + ] +} +``` + +### DelegationTotalRewards + +The `DelegationTotalRewards` endpoint allows users to query the total rewards accrued by each validator. + +Example: + +```sh +grpcurl -plaintext \ + -d '{"delegator_address":"cosmos1.."}' \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/DelegationTotalRewards +``` + +Example Output: + +```json +{ + "rewards": [ + { + "validatorAddress": "cosmosvaloper1..", + "reward": [ + { + "denom": "stake", + "amount": "1000000000000000" + } + ] + } + ], + "total": [ + { + "denom": "stake", + "amount": "1000000000000000" + } + ] +} +``` + +### DelegatorValidators + +The `DelegatorValidators` endpoint allows users to query all validators for given delegator. + +Example: + +```sh +grpcurl -plaintext \ + -d '{"delegator_address":"cosmos1.."}' \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/DelegatorValidators +``` + +Example Output: + +```json +{ + "validators": [ + "cosmosvaloper1.." + ] +} +``` + +### DelegatorWithdrawAddress + +The `DelegatorWithdrawAddress` endpoint allows users to query the withdraw address of a delegator. + +Example: + +```sh +grpcurl -plaintext \ + -d '{"delegator_address":"cosmos1.."}' \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/DelegatorWithdrawAddress +``` + +Example Output: + +```json +{ + "withdrawAddress": "cosmos1.." +} +``` + +### CommunityPool + +The `CommunityPool` endpoint allows users to query the community pool coins. + +Example: + +```sh +grpcurl -plaintext \ + localhost:9090 \ + cosmos.distribution.v1beta1.Query/CommunityPool +``` + +Example Output: + +```json +{ + "pool": [ + { + "denom": "stake", + "amount": "1000000000000000000" + } + ] +} +``` diff --git a/x/distribution/spec/README.md b/x/distribution/spec/README.md index ea56f59e6f1..4a9565da92e 100644 --- a/x/distribution/spec/README.md +++ b/x/distribution/spec/README.md @@ -23,12 +23,12 @@ whenever changes to parameters which affect the rate of reward distribution occurs, withdrawal of rewards must also occur. - Whenever withdrawing, one must withdraw the maximum amount they are entitled - to, leaving nothing in the pool. + to, leaving nothing in the pool. - Whenever bonding, unbonding, or re-delegating tokens to an existing account, a - full withdrawal of the rewards must occur (as the rules for lazy accounting - change). + full withdrawal of the rewards must occur (as the rules for lazy accounting + change). - Whenever a validator chooses to change the commission on rewards, all accumulated - commission rewards must be simultaneously withdrawn. + commission rewards must be simultaneously withdrawn. The above scenarios are covered in `hooks.md`. @@ -85,19 +85,20 @@ to set up a script to periodically withdraw and rebond rewards. ## Contents 1. **[Concepts](01_concepts.md)** - - [Reference Counting in F1 Fee Distribution](01_concepts.md#reference-counting-in-f1-fee-distribution) + - [Reference Counting in F1 Fee Distribution](01_concepts.md#reference-counting-in-f1-fee-distribution) 2. **[State](02_state.md)** 3. **[Begin Block](03_begin_block.md)** 4. **[Messages](04_messages.md)** - - [MsgSetWithdrawAddress](04_messages.md#msgsetwithdrawaddress) - - [MsgWithdrawDelegatorReward](04_messages.md#msgwithdrawdelegatorreward) - - [Withdraw Validator Rewards All](04_messages.md#withdraw-validator-rewards-all) - - [Common calculations](04_messages.md#common-calculations-) + - [MsgSetWithdrawAddress](04_messages.md#msgsetwithdrawaddress) + - [MsgWithdrawDelegatorReward](04_messages.md#msgwithdrawdelegatorreward) + - [Withdraw Validator Rewards All](04_messages.md#withdraw-validator-rewards-all) + - [MsgWithdrawTokenizeShareRecordReward](04_messages.md#msgwithdrawtokenizesharerecordreward) + - [Common calculations](04_messages.md#common-calculations-) 5. **[Hooks](05_hooks.md)** - - [Create or modify delegation distribution](05_hooks.md#create-or-modify-delegation-distribution) - - [Commission rate change](05_hooks.md#commission-rate-change) - - [Change in Validator State](05_hooks.md#change-in-validator-state) + - [Create or modify delegation distribution](05_hooks.md#create-or-modify-delegation-distribution) + - [Commission rate change](05_hooks.md#commission-rate-change) + - [Change in Validator State](05_hooks.md#change-in-validator-state) 6. **[Events](06_events.md)** - - [BeginBlocker](06_events.md#beginblocker) - - [Handlers](06_events.md#handlers) + - [BeginBlocker](06_events.md#beginblocker) + - [Handlers](06_events.md#handlers) 7. **[Parameters](07_params.md)** diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 73aca45060e..e27d89b6375 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -2,8 +2,8 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" "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" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -12,11 +12,13 @@ import ( // RegisterLegacyAminoCodec registers the necessary x/distribution interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgWithdrawDelegatorReward{}, "cosmos-sdk/MsgWithdrawDelegationReward", nil) - cdc.RegisterConcrete(&MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValidatorCommission", nil) - cdc.RegisterConcrete(&MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress", nil) - cdc.RegisterConcrete(&MsgFundCommunityPool{}, "cosmos-sdk/MsgFundCommunityPool", nil) - cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) + // cdc.RegisterConcrete(&MsgWithdrawDelegatorReward{}, "cosmos-sdk/MsgWithdrawDelegationReward", nil) + // cdc.RegisterConcrete(&MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValidatorCommission", nil) + // cdc.RegisterConcrete(&MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress", nil) + // cdc.RegisterConcrete(&MsgFundCommunityPool{}, "cosmos-sdk/MsgFundCommunityPool", nil) + // cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) + cdc.RegisterConcrete(&MsgWithdrawTokenizeShareRecordReward{}, "cosmos-sdk/MsgWithdrawTokenizeShareRecordReward", nil) + cdc.RegisterConcrete(&MsgWithdrawAllTokenizeShareRecordReward{}, "cosmos-sdk/MsgWithdrawAllTokenizeShareRecordReward", nil) } func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -26,6 +28,8 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgWithdrawValidatorCommission{}, &MsgSetWithdrawAddress{}, &MsgFundCommunityPool{}, + &MsgWithdrawTokenizeShareRecordReward{}, + &MsgWithdrawAllTokenizeShareRecordReward{}, ) registry.RegisterImplementations( (*govtypes.Content)(nil), @@ -35,20 +39,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/distribution 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/distribution and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() + RegisterLegacyAminoCodec(legacy.Cdc) } diff --git a/x/distribution/types/common_test.go b/x/distribution/types/common_test.go index 4e6ef6b0123..fcba30f4b67 100644 --- a/x/distribution/types/common_test.go +++ b/x/distribution/types/common_test.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// nolint:deadcode,unused,varcheck +//nolint:deadcode,unused,varcheck var ( delPk1 = ed25519.GenPrivKey().PubKey() delPk2 = ed25519.GenPrivKey().PubKey() diff --git a/x/distribution/types/distribution.pb.go b/x/distribution/types/distribution.pb.go index 2657160a6ea..17701815cbf 100644 --- a/x/distribution/types/distribution.pb.go +++ b/x/distribution/types/distribution.pb.go @@ -1,13 +1,14 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/distribution/v1beta1/distribution.proto +// source: distribution/v1beta1/distribution.proto package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -27,16 +28,16 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the set of params for the distribution module. type Params struct { - CommunityTax github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=community_tax,json=communityTax,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_tax" yaml:"community_tax"` - BaseProposerReward github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=base_proposer_reward,json=baseProposerReward,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_proposer_reward" yaml:"base_proposer_reward"` - BonusProposerReward github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=bonus_proposer_reward,json=bonusProposerReward,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"` - WithdrawAddrEnabled bool `protobuf:"varint,4,opt,name=withdraw_addr_enabled,json=withdrawAddrEnabled,proto3" json:"withdraw_addr_enabled,omitempty" yaml:"withdraw_addr_enabled"` + CommunityTax github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=community_tax,json=communityTax,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_tax"` + BaseProposerReward github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=base_proposer_reward,json=baseProposerReward,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_proposer_reward"` + BonusProposerReward github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=bonus_proposer_reward,json=bonusProposerReward,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"bonus_proposer_reward"` + WithdrawAddrEnabled bool `protobuf:"varint,4,opt,name=withdraw_addr_enabled,json=withdrawAddrEnabled,proto3" json:"withdraw_addr_enabled,omitempty"` } func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{0} + return fileDescriptor_c3e6168184371676, []int{0} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -85,15 +86,15 @@ func (m *Params) GetWithdrawAddrEnabled() bool { // read that record) // + one per validator for the zeroeth period, set on initialization type ValidatorHistoricalRewards struct { - CumulativeRewardRatio github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=cumulative_reward_ratio,json=cumulativeRewardRatio,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"cumulative_reward_ratio" yaml:"cumulative_reward_ratio"` - ReferenceCount uint32 `protobuf:"varint,2,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty" yaml:"reference_count"` + CumulativeRewardRatio github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=cumulative_reward_ratio,json=cumulativeRewardRatio,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"cumulative_reward_ratio"` + ReferenceCount uint32 `protobuf:"varint,2,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty"` } func (m *ValidatorHistoricalRewards) Reset() { *m = ValidatorHistoricalRewards{} } func (m *ValidatorHistoricalRewards) String() string { return proto.CompactTextString(m) } func (*ValidatorHistoricalRewards) ProtoMessage() {} func (*ValidatorHistoricalRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{1} + return fileDescriptor_c3e6168184371676, []int{1} } func (m *ValidatorHistoricalRewards) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -148,7 +149,7 @@ func (m *ValidatorCurrentRewards) Reset() { *m = ValidatorCurrentRewards func (m *ValidatorCurrentRewards) String() string { return proto.CompactTextString(m) } func (*ValidatorCurrentRewards) ProtoMessage() {} func (*ValidatorCurrentRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{2} + return fileDescriptor_c3e6168184371676, []int{2} } func (m *ValidatorCurrentRewards) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -201,7 +202,7 @@ func (m *ValidatorAccumulatedCommission) Reset() { *m = ValidatorAccumul func (m *ValidatorAccumulatedCommission) String() string { return proto.CompactTextString(m) } func (*ValidatorAccumulatedCommission) ProtoMessage() {} func (*ValidatorAccumulatedCommission) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{3} + return fileDescriptor_c3e6168184371676, []int{3} } func (m *ValidatorAccumulatedCommission) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -240,14 +241,14 @@ func (m *ValidatorAccumulatedCommission) GetCommission() github_com_cosmos_cosmo // ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards // for a validator inexpensive to track, allows simple sanity checks. type ValidatorOutstandingRewards struct { - Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards" yaml:"rewards"` + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` } func (m *ValidatorOutstandingRewards) Reset() { *m = ValidatorOutstandingRewards{} } func (m *ValidatorOutstandingRewards) String() string { return proto.CompactTextString(m) } func (*ValidatorOutstandingRewards) ProtoMessage() {} func (*ValidatorOutstandingRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{4} + return fileDescriptor_c3e6168184371676, []int{4} } func (m *ValidatorOutstandingRewards) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -288,7 +289,7 @@ func (m *ValidatorOutstandingRewards) GetRewards() github_com_cosmos_cosmos_sdk_ // This is needed to calculate appropriate amount of staking tokens // for delegations which are withdrawn after a slash has occurred. type ValidatorSlashEvent struct { - ValidatorPeriod uint64 `protobuf:"varint,1,opt,name=validator_period,json=validatorPeriod,proto3" json:"validator_period,omitempty" yaml:"validator_period"` + ValidatorPeriod uint64 `protobuf:"varint,1,opt,name=validator_period,json=validatorPeriod,proto3" json:"validator_period,omitempty"` Fraction github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=fraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fraction"` } @@ -296,7 +297,7 @@ func (m *ValidatorSlashEvent) Reset() { *m = ValidatorSlashEvent{} } func (m *ValidatorSlashEvent) String() string { return proto.CompactTextString(m) } func (*ValidatorSlashEvent) ProtoMessage() {} func (*ValidatorSlashEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{5} + return fileDescriptor_c3e6168184371676, []int{5} } func (m *ValidatorSlashEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -334,13 +335,13 @@ func (m *ValidatorSlashEvent) GetValidatorPeriod() uint64 { // ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. type ValidatorSlashEvents struct { - ValidatorSlashEvents []ValidatorSlashEvent `protobuf:"bytes,1,rep,name=validator_slash_events,json=validatorSlashEvents,proto3" json:"validator_slash_events" yaml:"validator_slash_events"` + ValidatorSlashEvents []ValidatorSlashEvent `protobuf:"bytes,1,rep,name=validator_slash_events,json=validatorSlashEvents,proto3" json:"validator_slash_events"` } func (m *ValidatorSlashEvents) Reset() { *m = ValidatorSlashEvents{} } func (*ValidatorSlashEvents) ProtoMessage() {} func (*ValidatorSlashEvents) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{6} + return fileDescriptor_c3e6168184371676, []int{6} } func (m *ValidatorSlashEvents) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -378,14 +379,14 @@ func (m *ValidatorSlashEvents) GetValidatorSlashEvents() []ValidatorSlashEvent { // FeePool is the global fee pool for distribution. type FeePool struct { - CommunityPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"community_pool" yaml:"community_pool"` + CommunityPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"community_pool"` } func (m *FeePool) Reset() { *m = FeePool{} } func (m *FeePool) String() string { return proto.CompactTextString(m) } func (*FeePool) ProtoMessage() {} func (*FeePool) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{7} + return fileDescriptor_c3e6168184371676, []int{7} } func (m *FeePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -434,7 +435,7 @@ type CommunityPoolSpendProposal struct { func (m *CommunityPoolSpendProposal) Reset() { *m = CommunityPoolSpendProposal{} } func (*CommunityPoolSpendProposal) ProtoMessage() {} func (*CommunityPoolSpendProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{8} + return fileDescriptor_c3e6168184371676, []int{8} } func (m *CommunityPoolSpendProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -470,16 +471,16 @@ var xxx_messageInfo_CommunityPoolSpendProposal proto.InternalMessageInfo // the delegators within the validator may be left with less than a full token, // thus sdk.Dec is used. type DelegatorStartingInfo struct { - PreviousPeriod uint64 `protobuf:"varint,1,opt,name=previous_period,json=previousPeriod,proto3" json:"previous_period,omitempty" yaml:"previous_period"` - Stake github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=stake,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stake" yaml:"stake"` - Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"creation_height" yaml:"creation_height"` + PreviousPeriod uint64 `protobuf:"varint,1,opt,name=previous_period,json=previousPeriod,proto3" json:"previous_period,omitempty"` + Stake github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=stake,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stake"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"creation_height"` } func (m *DelegatorStartingInfo) Reset() { *m = DelegatorStartingInfo{} } func (m *DelegatorStartingInfo) String() string { return proto.CompactTextString(m) } func (*DelegatorStartingInfo) ProtoMessage() {} func (*DelegatorStartingInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{9} + return fileDescriptor_c3e6168184371676, []int{9} } func (m *DelegatorStartingInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -525,7 +526,7 @@ func (m *DelegatorStartingInfo) GetHeight() uint64 { // DelegationDelegatorReward represents the properties // of a delegator's delegation reward. type DelegationDelegatorReward struct { - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` Reward github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=reward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"reward"` } @@ -533,7 +534,7 @@ func (m *DelegationDelegatorReward) Reset() { *m = DelegationDelegatorRe func (m *DelegationDelegatorReward) String() string { return proto.CompactTextString(m) } func (*DelegationDelegatorReward) ProtoMessage() {} func (*DelegationDelegatorReward) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{10} + return fileDescriptor_c3e6168184371676, []int{10} } func (m *DelegationDelegatorReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -562,21 +563,60 @@ func (m *DelegationDelegatorReward) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationDelegatorReward proto.InternalMessageInfo +// TokenizeShareRecordReward represents the properties of tokenize share +type TokenizeShareRecordReward struct { + RecordId uint64 `protobuf:"varint,1,opt,name=recordId,proto3" json:"recordId,omitempty"` + Reward github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=reward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"reward"` +} + +func (m *TokenizeShareRecordReward) Reset() { *m = TokenizeShareRecordReward{} } +func (m *TokenizeShareRecordReward) String() string { return proto.CompactTextString(m) } +func (*TokenizeShareRecordReward) ProtoMessage() {} +func (*TokenizeShareRecordReward) Descriptor() ([]byte, []int) { + return fileDescriptor_c3e6168184371676, []int{11} +} +func (m *TokenizeShareRecordReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenizeShareRecordReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenizeShareRecordReward.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 *TokenizeShareRecordReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenizeShareRecordReward.Merge(m, src) +} +func (m *TokenizeShareRecordReward) XXX_Size() int { + return m.Size() +} +func (m *TokenizeShareRecordReward) XXX_DiscardUnknown() { + xxx_messageInfo_TokenizeShareRecordReward.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenizeShareRecordReward proto.InternalMessageInfo + // CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal // with a deposit type CommunityPoolSpendProposalWithDeposit struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` - Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty" yaml:"recipient"` - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty" yaml:"amount"` - Deposit string `protobuf:"bytes,5,opt,name=deposit,proto3" json:"deposit,omitempty" yaml:"deposit"` + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` + Deposit string `protobuf:"bytes,5,opt,name=deposit,proto3" json:"deposit,omitempty"` } func (m *CommunityPoolSpendProposalWithDeposit) Reset() { *m = CommunityPoolSpendProposalWithDeposit{} } func (m *CommunityPoolSpendProposalWithDeposit) String() string { return proto.CompactTextString(m) } func (*CommunityPoolSpendProposalWithDeposit) ProtoMessage() {} func (*CommunityPoolSpendProposalWithDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_cd78a31ea281a992, []int{11} + return fileDescriptor_c3e6168184371676, []int{12} } func (m *CommunityPoolSpendProposalWithDeposit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -617,84 +657,79 @@ func init() { proto.RegisterType((*CommunityPoolSpendProposal)(nil), "cosmos.distribution.v1beta1.CommunityPoolSpendProposal") proto.RegisterType((*DelegatorStartingInfo)(nil), "cosmos.distribution.v1beta1.DelegatorStartingInfo") proto.RegisterType((*DelegationDelegatorReward)(nil), "cosmos.distribution.v1beta1.DelegationDelegatorReward") + proto.RegisterType((*TokenizeShareRecordReward)(nil), "cosmos.distribution.v1beta1.TokenizeShareRecordReward") proto.RegisterType((*CommunityPoolSpendProposalWithDeposit)(nil), "cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit") } func init() { - proto.RegisterFile("cosmos/distribution/v1beta1/distribution.proto", fileDescriptor_cd78a31ea281a992) -} - -var fileDescriptor_cd78a31ea281a992 = []byte{ - // 1102 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x24, 0x8e, 0x93, 0x4e, 0xf3, 0xab, 0x13, 0x27, 0x71, 0x93, 0xe0, 0x8d, 0x46, 0x6a, - 0x15, 0x04, 0x75, 0x9a, 0xf6, 0x82, 0x72, 0x40, 0x8a, 0x9d, 0x44, 0x14, 0x01, 0x8d, 0xb6, 0x01, - 0x24, 0x2e, 0xd6, 0x78, 0x77, 0x62, 0x8f, 0x62, 0xef, 0x2c, 0x33, 0x63, 0x27, 0x39, 0x20, 0x24, - 0x4e, 0x5c, 0x10, 0x20, 0x2e, 0x1c, 0x00, 0xe5, 0xc8, 0xaf, 0x3f, 0xa4, 0xc7, 0xde, 0x40, 0x20, - 0x2d, 0x28, 0x11, 0x12, 0xe2, 0xe8, 0x1b, 0x37, 0xb4, 0x3b, 0xb3, 0xbb, 0xb6, 0x6b, 0xaa, 0xb8, - 0x52, 0x4f, 0xf6, 0x7e, 0xf3, 0xe6, 0xbd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8d, 0x6e, 0x60, 0xcd, 0xe8, 0x0b, 0x1a, 0xc7, 0xb1, 0xa4, 0xd1, - 0xab, 0x70, 0xd2, 0xd5, 0xb9, 0x14, 0x26, 0x22, 0x5b, 0x94, 0x2e, 0x01, 0x73, 0x80, 0xed, 0xd8, - 0x24, 0x2d, 0x51, 0xf9, 0xe1, 0xf7, 0x17, 0x45, 0xf0, 0xf8, 0xa2, 0x08, 0x9e, 0x5c, 0x14, 0xc1, - 0x9f, 0x17, 0x45, 0xf0, 0xc5, 0x65, 0x31, 0xf3, 0xe4, 0xb2, 0x98, 0xf9, 0xf5, 0xb2, 0x98, 0xf9, - 0x60, 0xeb, 0x99, 0xf5, 0x3f, 0xed, 0xff, 0xb4, 0x8e, 0xda, 0x51, 0xcb, 0x45, 0x5f, 0xbe, 0xf7, - 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x45, 0x1d, 0xb8, 0x42, 0x7e, 0x0b, 0x00, 0x00, + proto.RegisterFile("distribution/v1beta1/distribution.proto", fileDescriptor_c3e6168184371676) +} + +var fileDescriptor_c3e6168184371676 = []byte{ + // 1001 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xb4, 0x8e, 0x93, 0x4e, 0x69, 0x02, 0x13, 0x27, 0x75, 0xdc, 0xca, 0x8e, 0x56, 0xa2, + 0x0d, 0x54, 0xb6, 0xfb, 0x71, 0x8b, 0xb8, 0xe4, 0x0b, 0xd1, 0x13, 0xd1, 0xa6, 0x02, 0xc4, 0x65, + 0x35, 0xde, 0x7d, 0xb1, 0x47, 0xd9, 0x9d, 0xd9, 0xcc, 0xcc, 0x3a, 0x09, 0xd7, 0x1e, 0xf8, 0x38, + 0x21, 0x71, 0x41, 0x1c, 0x50, 0x8e, 0x08, 0x71, 0xcc, 0x3f, 0xc0, 0xad, 0xe2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5c, 0x0f, 0x05, 0xed, 0xe0, 0x49, 0x2b, 0x42, + 0x5d, 0x1c, 0xff, 0x21, 0x02, 0x99, 0xc7, 0x95, 0x14, 0x24, 0x13, 0xb6, 0xd5, 0xca, 0xbe, 0xb3, + 0xbc, 0x6f, 0x10, 0x6e, 0x14, 0x04, 0x57, 0x42, 0x27, 0x17, 0xa2, 0x35, 0x91, 0x24, 0x4c, 0x29, + 0x26, 0x38, 0xd9, 0xc5, 0x38, 0x2c, 0xac, 0x8b, 0xa3, 0x3a, 0x06, 0xe2, 0x7d, 0x85, 0xf0, 0x8d, + 0x82, 0xd5, 0x87, 0x99, 0x56, 0x9a, 0xf2, 0x88, 0xf1, 0xde, 0xeb, 0x28, 0x9d, 0xf7, 0x1d, 0xc2, + 0xb3, 0x05, 0x99, 0xad, 0x98, 0xaa, 0xfe, 0xc6, 0x00, 0xb8, 0x26, 0xef, 0xe0, 0x37, 0x07, 0x43, + 0x77, 0xe0, 0x8a, 0x8b, 0xf2, 0xe2, 0xce, 0x14, 0xfe, 0xcd, 0xdc, 0x4d, 0x3e, 0xc1, 0x53, 0xdb, + 0x92, 0x86, 0x66, 0x93, 0x9d, 0xcb, 0xa8, 0x17, 0xd9, 0x4c, 0xa5, 0xaa, 0x67, 0x90, 0x53, 0x24, + 0xc6, 0xf3, 0x23, 0x76, 0xca, 0x04, 0x02, 0xc8, 0x23, 0xae, 0x62, 0x77, 0xdb, 0x2f, 0x59, 0xb3, + 0xed, 0x33, 0x52, 0xae, 0x96, 0x0d, 0x65, 0xbf, 0x3a, 0x38, 0x03, 0xcd, 0x4d, 0xf0, 0x63, 0x84, + 0x27, 0xdf, 0x07, 0xd8, 0x14, 0x22, 0x26, 0xfb, 0x78, 0x7a, 0xb4, 0x4c, 0x53, 0x21, 0xe2, 0x8b, + 0xbb, 0xa9, 0xd1, 0xd6, 0x36, 0xc8, 0xde, 0xe3, 0x4b, 0xb8, 0xbe, 0x36, 0xee, 0xd9, 0x4a, 0x81, + 0x47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, 0xc1, 0x3f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xe5, 0xeb, 0x45, 0xe6, 0x02, 0x0b, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -999,6 +1034,38 @@ func (this *DelegationDelegatorReward) Equal(that interface{}) bool { } return true } +func (this *TokenizeShareRecordReward) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TokenizeShareRecordReward) + if !ok { + that2, ok := that.(TokenizeShareRecordReward) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.RecordId != that1.RecordId { + return false + } + if len(this.Reward) != len(that1.Reward) { + return false + } + for i := range this.Reward { + if !this.Reward[i].Equal(&that1.Reward[i]) { + return false + } + } + return true +} func (this *CommunityPoolSpendProposalWithDeposit) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1513,6 +1580,48 @@ func (m *DelegationDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *TokenizeShareRecordReward) 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 *TokenizeShareRecordReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenizeShareRecordReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Reward) > 0 { + for iNdEx := len(m.Reward) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Reward[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDistribution(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.RecordId != 0 { + i = encodeVarintDistribution(dAtA, i, uint64(m.RecordId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *CommunityPoolSpendProposalWithDeposit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1773,6 +1882,24 @@ func (m *DelegationDelegatorReward) Size() (n int) { return n } +func (m *TokenizeShareRecordReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RecordId != 0 { + n += 1 + sovDistribution(uint64(m.RecordId)) + } + if len(m.Reward) > 0 { + for _, e := range m.Reward { + l = e.Size() + n += 1 + l + sovDistribution(uint64(l)) + } + } + return n +} + func (m *CommunityPoolSpendProposalWithDeposit) Size() (n int) { if m == nil { return 0 @@ -3043,6 +3170,109 @@ func (m *DelegationDelegatorReward) Unmarshal(dAtA []byte) error { } return nil } +func (m *TokenizeShareRecordReward) 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 ErrIntOverflowDistribution + } + 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: TokenizeShareRecordReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenizeShareRecordReward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", wireType) + } + m.RecordId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDistribution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RecordId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reward", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDistribution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDistribution + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDistribution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reward = append(m.Reward, types.DecCoin{}) + if err := m.Reward[len(m.Reward)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDistribution(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDistribution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *CommunityPoolSpendProposalWithDeposit) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/distribution/types/errors.go b/x/distribution/types/errors.go index 147cfd32034..b253d52083f 100644 --- a/x/distribution/types/errors.go +++ b/x/distribution/types/errors.go @@ -1,21 +1,22 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/distribution module sentinel errors var ( - ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 2, "delegator address is empty") - ErrEmptyWithdrawAddr = sdkerrors.Register(ModuleName, 3, "withdraw address is empty") - ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 4, "validator address is empty") - ErrEmptyDelegationDistInfo = sdkerrors.Register(ModuleName, 5, "no delegation distribution info") - ErrNoValidatorDistInfo = sdkerrors.Register(ModuleName, 6, "no validator distribution info") - ErrNoValidatorCommission = sdkerrors.Register(ModuleName, 7, "no validator commission to withdraw") - ErrSetWithdrawAddrDisabled = sdkerrors.Register(ModuleName, 8, "set withdraw address disabled") - ErrBadDistribution = sdkerrors.Register(ModuleName, 9, "community pool does not have sufficient coins to distribute") - ErrInvalidProposalAmount = sdkerrors.Register(ModuleName, 10, "invalid community pool spend proposal amount") - ErrEmptyProposalRecipient = sdkerrors.Register(ModuleName, 11, "invalid community pool spend proposal recipient") - ErrNoValidatorExists = sdkerrors.Register(ModuleName, 12, "validator does not exist") - ErrNoDelegationExists = sdkerrors.Register(ModuleName, 13, "delegation does not exist") + ErrEmptyDelegatorAddr = errorsmod.Register(ModuleName, 2, "delegator address is empty") + ErrEmptyWithdrawAddr = errorsmod.Register(ModuleName, 3, "withdraw address is empty") + ErrEmptyValidatorAddr = errorsmod.Register(ModuleName, 4, "validator address is empty") + ErrEmptyDelegationDistInfo = errorsmod.Register(ModuleName, 5, "no delegation distribution info") + ErrNoValidatorDistInfo = errorsmod.Register(ModuleName, 6, "no validator distribution info") + ErrNoValidatorCommission = errorsmod.Register(ModuleName, 7, "no validator commission to withdraw") + ErrSetWithdrawAddrDisabled = errorsmod.Register(ModuleName, 8, "set withdraw address disabled") + ErrBadDistribution = errorsmod.Register(ModuleName, 9, "community pool does not have sufficient coins to distribute") + ErrInvalidProposalAmount = errorsmod.Register(ModuleName, 10, "invalid community pool spend proposal amount") + ErrEmptyProposalRecipient = errorsmod.Register(ModuleName, 11, "invalid community pool spend proposal recipient") + ErrNoValidatorExists = errorsmod.Register(ModuleName, 12, "validator does not exist") + ErrNoDelegationExists = errorsmod.Register(ModuleName, 13, "delegation does not exist") + ErrNotTokenizeShareRecordOwner = errorsmod.Register(ModuleName, 44, "not tokenize share record owner") ) diff --git a/x/distribution/types/events.go b/x/distribution/types/events.go index ce4c0ef62e3..a45d931c9b3 100644 --- a/x/distribution/types/events.go +++ b/x/distribution/types/events.go @@ -2,12 +2,13 @@ package types // distribution module event types const ( - EventTypeSetWithdrawAddress = "set_withdraw_address" - EventTypeRewards = "rewards" - EventTypeCommission = "commission" - EventTypeWithdrawRewards = "withdraw_rewards" - EventTypeWithdrawCommission = "withdraw_commission" - EventTypeProposerReward = "proposer_reward" + EventTypeSetWithdrawAddress = "set_withdraw_address" + EventTypeRewards = "rewards" + EventTypeCommission = "commission" + EventTypeWithdrawRewards = "withdraw_rewards" + EventTypeWithdrawCommission = "withdraw_commission" + EventTypeWithdrawTokenizeShareReward = "withdraw_tokenize_share_reward" + EventTypeProposerReward = "proposer_reward" AttributeKeyWithdrawAddress = "withdraw_address" AttributeKeyValidator = "validator" diff --git a/x/distribution/types/expected_keepers.go b/x/distribution/types/expected_keepers.go index 9b869c97273..c7b29677f26 100644 --- a/x/distribution/types/expected_keepers.go +++ b/x/distribution/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -27,44 +28,50 @@ type BankKeeper interface { SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + + BlockedAddr(addr sdk.AccAddress) bool } // StakingKeeper expected staking keeper (noalias) type StakingKeeper interface { // iterate through validators by operator address, execute func for each validator IterateValidators(sdk.Context, - func(index int64, validator stakingtypes.ValidatorI) (stop bool)) + func(index int64, validator sdkstaking.ValidatorI) (stop bool)) // iterate through bonded validators by operator address, execute func for each validator IterateBondedValidatorsByPower(sdk.Context, - func(index int64, validator stakingtypes.ValidatorI) (stop bool)) + func(index int64, validator sdkstaking.ValidatorI) (stop bool)) // iterate through the consensus validator set of the last block by operator address, execute func for each validator IterateLastValidators(sdk.Context, - func(index int64, validator stakingtypes.ValidatorI) (stop bool)) + func(index int64, validator sdkstaking.ValidatorI) (stop bool)) - Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI // get a particular validator by operator address - ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI // get a particular validator by consensus address + Validator(sdk.Context, sdk.ValAddress) sdkstaking.ValidatorI // get a particular validator by operator address + ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) sdkstaking.ValidatorI // get a particular validator by consensus address // slash the validator and delegators of the validator, specifying offence height, offence power, slash fraction and infraction type - Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, stakingtypes.InfractionType) + Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, sdkstaking.InfractionType) Jail(sdk.Context, sdk.ConsAddress) // jail a validator Unjail(sdk.Context, sdk.ConsAddress) // unjail a validator // Delegation allows for getting a particular delegation for a given validator // and delegator outside the scope of the staking module. - Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingtypes.DelegationI + Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) sdkstaking.DelegationI // MaxValidators returns the maximum amount of bonded validators MaxValidators(sdk.Context) uint32 IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress, - fn func(index int64, delegation stakingtypes.DelegationI) (stop bool)) + fn func(index int64, delegation sdkstaking.DelegationI) (stop bool)) GetLastTotalPower(ctx sdk.Context) sdk.Int GetLastValidatorPower(ctx sdk.Context, valAddr sdk.ValAddress) int64 GetAllSDKDelegations(ctx sdk.Context) []stakingtypes.Delegation + + GetTokenizeShareRecordsByOwner(ctx sdk.Context, owner sdk.AccAddress) (tokenizeShareRecords []stakingtypes.TokenizeShareRecord) + GetTokenizeShareRecord(ctx sdk.Context, id uint64) (tokenizeShareRecord stakingtypes.TokenizeShareRecord, err error) } // StakingHooks event hooks for staking validator object (noalias) diff --git a/x/distribution/types/genesis.pb.go b/x/distribution/types/genesis.pb.go index 5c94d4359ff..ce13335d823 100644 --- a/x/distribution/types/genesis.pb.go +++ b/x/distribution/types/genesis.pb.go @@ -1,13 +1,14 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/distribution/v1beta1/genesis.proto +// source: distribution/v1beta1/genesis.proto package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -30,16 +31,16 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // default withdraw addresses. type DelegatorWithdrawInfo struct { // delegator_address is the address of the delegator. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` // withdraw_address is the address to withdraw the delegation rewards to. - WithdrawAddress string `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty" yaml:"withdraw_address"` + WithdrawAddress string `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty"` } func (m *DelegatorWithdrawInfo) Reset() { *m = DelegatorWithdrawInfo{} } func (m *DelegatorWithdrawInfo) String() string { return proto.CompactTextString(m) } func (*DelegatorWithdrawInfo) ProtoMessage() {} func (*DelegatorWithdrawInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_76eed0f9489db580, []int{0} + return fileDescriptor_02ffc8100ab19bc0, []int{0} } func (m *DelegatorWithdrawInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -71,16 +72,16 @@ var xxx_messageInfo_DelegatorWithdrawInfo proto.InternalMessageInfo // ValidatorOutstandingRewardsRecord is used for import/export via genesis json. type ValidatorOutstandingRewardsRecord struct { // validator_address is the address of the validator. - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // outstanding_rewards represents the oustanding rewards of a validator. - OutstandingRewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=outstanding_rewards,json=outstandingRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"outstanding_rewards" yaml:"outstanding_rewards"` + OutstandingRewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=outstanding_rewards,json=outstandingRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"outstanding_rewards"` } func (m *ValidatorOutstandingRewardsRecord) Reset() { *m = ValidatorOutstandingRewardsRecord{} } func (m *ValidatorOutstandingRewardsRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorOutstandingRewardsRecord) ProtoMessage() {} func (*ValidatorOutstandingRewardsRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_76eed0f9489db580, []int{1} + return fileDescriptor_02ffc8100ab19bc0, []int{1} } func (m *ValidatorOutstandingRewardsRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,16 +114,16 @@ var xxx_messageInfo_ValidatorOutstandingRewardsRecord proto.InternalMessageInfo // json. type ValidatorAccumulatedCommissionRecord struct { // validator_address is the address of the validator. - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // accumulated is the accumulated commission of a validator. - Accumulated ValidatorAccumulatedCommission `protobuf:"bytes,2,opt,name=accumulated,proto3" json:"accumulated" yaml:"accumulated"` + Accumulated ValidatorAccumulatedCommission `protobuf:"bytes,2,opt,name=accumulated,proto3" json:"accumulated"` } func (m *ValidatorAccumulatedCommissionRecord) Reset() { *m = ValidatorAccumulatedCommissionRecord{} } func (m *ValidatorAccumulatedCommissionRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorAccumulatedCommissionRecord) ProtoMessage() {} func (*ValidatorAccumulatedCommissionRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_76eed0f9489db580, []int{2} + return fileDescriptor_02ffc8100ab19bc0, []int{2} } func (m *ValidatorAccumulatedCommissionRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -155,18 +156,18 @@ var xxx_messageInfo_ValidatorAccumulatedCommissionRecord proto.InternalMessageIn // json. type ValidatorHistoricalRewardsRecord struct { // validator_address is the address of the validator. - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // period defines the period the historical rewards apply to. Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty"` // rewards defines the historical rewards of a validator. - Rewards ValidatorHistoricalRewards `protobuf:"bytes,3,opt,name=rewards,proto3" json:"rewards" yaml:"rewards"` + Rewards ValidatorHistoricalRewards `protobuf:"bytes,3,opt,name=rewards,proto3" json:"rewards"` } func (m *ValidatorHistoricalRewardsRecord) Reset() { *m = ValidatorHistoricalRewardsRecord{} } func (m *ValidatorHistoricalRewardsRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorHistoricalRewardsRecord) ProtoMessage() {} func (*ValidatorHistoricalRewardsRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_76eed0f9489db580, []int{3} + return fileDescriptor_02ffc8100ab19bc0, []int{3} } func (m *ValidatorHistoricalRewardsRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -198,16 +199,16 @@ var xxx_messageInfo_ValidatorHistoricalRewardsRecord proto.InternalMessageInfo // ValidatorCurrentRewardsRecord is used for import / export via genesis json. type ValidatorCurrentRewardsRecord struct { // validator_address is the address of the validator. - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // rewards defines the current rewards of a validator. - Rewards ValidatorCurrentRewards `protobuf:"bytes,2,opt,name=rewards,proto3" json:"rewards" yaml:"rewards"` + Rewards ValidatorCurrentRewards `protobuf:"bytes,2,opt,name=rewards,proto3" json:"rewards"` } func (m *ValidatorCurrentRewardsRecord) Reset() { *m = ValidatorCurrentRewardsRecord{} } func (m *ValidatorCurrentRewardsRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorCurrentRewardsRecord) ProtoMessage() {} func (*ValidatorCurrentRewardsRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_76eed0f9489db580, []int{4} + return fileDescriptor_02ffc8100ab19bc0, []int{4} } func (m *ValidatorCurrentRewardsRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -239,18 +240,18 @@ var xxx_messageInfo_ValidatorCurrentRewardsRecord proto.InternalMessageInfo // DelegatorStartingInfoRecord used for import / export via genesis json. type DelegatorStartingInfoRecord struct { // delegator_address is the address of the delegator. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` // validator_address is the address of the validator. - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // starting_info defines the starting info of a delegator. - StartingInfo DelegatorStartingInfo `protobuf:"bytes,3,opt,name=starting_info,json=startingInfo,proto3" json:"starting_info" yaml:"starting_info"` + StartingInfo DelegatorStartingInfo `protobuf:"bytes,3,opt,name=starting_info,json=startingInfo,proto3" json:"starting_info"` } func (m *DelegatorStartingInfoRecord) Reset() { *m = DelegatorStartingInfoRecord{} } func (m *DelegatorStartingInfoRecord) String() string { return proto.CompactTextString(m) } func (*DelegatorStartingInfoRecord) ProtoMessage() {} func (*DelegatorStartingInfoRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_76eed0f9489db580, []int{5} + return fileDescriptor_02ffc8100ab19bc0, []int{5} } func (m *DelegatorStartingInfoRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -282,20 +283,20 @@ var xxx_messageInfo_DelegatorStartingInfoRecord proto.InternalMessageInfo // ValidatorSlashEventRecord is used for import / export via genesis json. type ValidatorSlashEventRecord struct { // validator_address is the address of the validator. - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // height defines the block height at which the slash event occured. Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` // period is the period of the slash event. Period uint64 `protobuf:"varint,3,opt,name=period,proto3" json:"period,omitempty"` // validator_slash_event describes the slash event. - ValidatorSlashEvent ValidatorSlashEvent `protobuf:"bytes,4,opt,name=validator_slash_event,json=validatorSlashEvent,proto3" json:"validator_slash_event" yaml:"event"` + ValidatorSlashEvent ValidatorSlashEvent `protobuf:"bytes,4,opt,name=validator_slash_event,json=validatorSlashEvent,proto3" json:"validator_slash_event"` } func (m *ValidatorSlashEventRecord) Reset() { *m = ValidatorSlashEventRecord{} } func (m *ValidatorSlashEventRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorSlashEventRecord) ProtoMessage() {} func (*ValidatorSlashEventRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_76eed0f9489db580, []int{6} + return fileDescriptor_02ffc8100ab19bc0, []int{6} } func (m *ValidatorSlashEventRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -327,32 +328,32 @@ var xxx_messageInfo_ValidatorSlashEventRecord proto.InternalMessageInfo // GenesisState defines the distribution module's genesis state. type GenesisState struct { // params defines all the paramaters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // fee_pool defines the fee pool at genesis. - FeePool FeePool `protobuf:"bytes,2,opt,name=fee_pool,json=feePool,proto3" json:"fee_pool" yaml:"fee_pool"` + FeePool FeePool `protobuf:"bytes,2,opt,name=fee_pool,json=feePool,proto3" json:"fee_pool"` // fee_pool defines the delegator withdraw infos at genesis. - DelegatorWithdrawInfos []DelegatorWithdrawInfo `protobuf:"bytes,3,rep,name=delegator_withdraw_infos,json=delegatorWithdrawInfos,proto3" json:"delegator_withdraw_infos" yaml:"delegator_withdraw_infos"` + DelegatorWithdrawInfos []DelegatorWithdrawInfo `protobuf:"bytes,3,rep,name=delegator_withdraw_infos,json=delegatorWithdrawInfos,proto3" json:"delegator_withdraw_infos"` // fee_pool defines the previous proposer at genesis. - PreviousProposer string `protobuf:"bytes,4,opt,name=previous_proposer,json=previousProposer,proto3" json:"previous_proposer,omitempty" yaml:"previous_proposer"` + PreviousProposer string `protobuf:"bytes,4,opt,name=previous_proposer,json=previousProposer,proto3" json:"previous_proposer,omitempty"` // fee_pool defines the outstanding rewards of all validators at genesis. - OutstandingRewards []ValidatorOutstandingRewardsRecord `protobuf:"bytes,5,rep,name=outstanding_rewards,json=outstandingRewards,proto3" json:"outstanding_rewards" yaml:"outstanding_rewards"` + OutstandingRewards []ValidatorOutstandingRewardsRecord `protobuf:"bytes,5,rep,name=outstanding_rewards,json=outstandingRewards,proto3" json:"outstanding_rewards"` // fee_pool defines the accumulated commisions of all validators at genesis. - ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `protobuf:"bytes,6,rep,name=validator_accumulated_commissions,json=validatorAccumulatedCommissions,proto3" json:"validator_accumulated_commissions" yaml:"validator_accumulated_commissions"` + ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `protobuf:"bytes,6,rep,name=validator_accumulated_commissions,json=validatorAccumulatedCommissions,proto3" json:"validator_accumulated_commissions"` // fee_pool defines the historical rewards of all validators at genesis. - ValidatorHistoricalRewards []ValidatorHistoricalRewardsRecord `protobuf:"bytes,7,rep,name=validator_historical_rewards,json=validatorHistoricalRewards,proto3" json:"validator_historical_rewards" yaml:"validator_historical_rewards"` + ValidatorHistoricalRewards []ValidatorHistoricalRewardsRecord `protobuf:"bytes,7,rep,name=validator_historical_rewards,json=validatorHistoricalRewards,proto3" json:"validator_historical_rewards"` // fee_pool defines the current rewards of all validators at genesis. - ValidatorCurrentRewards []ValidatorCurrentRewardsRecord `protobuf:"bytes,8,rep,name=validator_current_rewards,json=validatorCurrentRewards,proto3" json:"validator_current_rewards" yaml:"validator_current_rewards"` + ValidatorCurrentRewards []ValidatorCurrentRewardsRecord `protobuf:"bytes,8,rep,name=validator_current_rewards,json=validatorCurrentRewards,proto3" json:"validator_current_rewards"` // fee_pool defines the delegator starting infos at genesis. - DelegatorStartingInfos []DelegatorStartingInfoRecord `protobuf:"bytes,9,rep,name=delegator_starting_infos,json=delegatorStartingInfos,proto3" json:"delegator_starting_infos" yaml:"delegator_starting_infos"` + DelegatorStartingInfos []DelegatorStartingInfoRecord `protobuf:"bytes,9,rep,name=delegator_starting_infos,json=delegatorStartingInfos,proto3" json:"delegator_starting_infos"` // fee_pool defines the validator slash events at genesis. - ValidatorSlashEvents []ValidatorSlashEventRecord `protobuf:"bytes,10,rep,name=validator_slash_events,json=validatorSlashEvents,proto3" json:"validator_slash_events" yaml:"validator_slash_events"` + ValidatorSlashEvents []ValidatorSlashEventRecord `protobuf:"bytes,10,rep,name=validator_slash_events,json=validatorSlashEvents,proto3" json:"validator_slash_events"` } 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_76eed0f9489db580, []int{7} + return fileDescriptor_02ffc8100ab19bc0, []int{7} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -393,75 +394,69 @@ func init() { } func init() { - proto.RegisterFile("cosmos/distribution/v1beta1/genesis.proto", fileDescriptor_76eed0f9489db580) -} - -var fileDescriptor_76eed0f9489db580 = []byte{ - // 1024 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x1c, 0xf5, 0x3a, 0x25, 0x49, 0x27, 0x29, 0x0d, 0xdb, 0x7c, 0xb8, 0x4e, 0xea, 0x4d, 0xa7, 0x45, - 0x04, 0x55, 0xac, 0x9b, 0x80, 0x00, 0x05, 0x81, 0x94, 0x4d, 0x29, 0xf4, 0xd4, 0x30, 0x91, 0x00, - 0x71, 0xb1, 0xd6, 0xbb, 0x63, 0x7b, 0x84, 0xbd, 0x63, 0xcd, 0x8c, 0x1d, 0xc2, 0x3f, 0x00, 0x47, - 0x24, 0xc4, 0xa9, 0x1c, 0x72, 0x44, 0x88, 0x63, 0xef, 0x5c, 0x7b, 0xec, 0x91, 0x03, 0x0a, 0x28, - 0xb9, 0x70, 0xce, 0x81, 0x03, 0x27, 0xb4, 0x33, 0xb3, 0x5f, 0xf6, 0xda, 0x38, 0xa1, 0x39, 0x25, - 0x1e, 0xff, 0xf6, 0xbd, 0xf7, 0x7b, 0xf3, 0xfb, 0x58, 0x83, 0xd7, 0x3d, 0xca, 0x3b, 0x94, 0x57, - 0x7d, 0xc2, 0x05, 0x23, 0xf5, 0x9e, 0x20, 0x34, 0xa8,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x62, 0x83, 0x67, 0xa4, 0xf8, 0xf7, 0x2f, 0xb8, 0xb9, 0xb4, 0xf0, 0x7b, 0x5a, 0xf8, 0x9d, - 0x41, 0xe1, 0xc3, 0x84, 0x10, 0x95, 0xfb, 0x23, 0xe1, 0xc2, 0x17, 0xb0, 0x9b, 0xc9, 0xd3, 0x9e, - 0x5a, 0x23, 0xb1, 0xd6, 0x59, 0xa9, 0x75, 0xfb, 0x22, 0x3b, 0x48, 0x0b, 0xdd, 0xd0, 0x42, 0xd7, - 0x07, 0x85, 0x0e, 0x50, 0x41, 0xb4, 0xd2, 0xcf, 0x07, 0x32, 0x9f, 0x64, 0x9a, 0x31, 0x33, 0x9f, - 0x79, 0xe9, 0xaa, 0x54, 0xf8, 0xee, 0xf9, 0xe7, 0xbe, 0xd6, 0x37, 0xb2, 0x25, 0xb3, 0x3c, 0xe9, - 0x96, 0x4c, 0xa3, 0xf0, 0xb0, 0x8f, 0x96, 0x73, 0x07, 0x2e, 0x2f, 0x01, 0xa9, 0xed, 0xed, 0xf3, - 0x4e, 0x5c, 0xad, 0xec, 0x55, 0xad, 0xec, 0xd6, 0xa0, 0x73, 0x69, 0x0e, 0x88, 0x16, 0x73, 0x06, - 0x71, 0x6a, 0xbf, 0x3b, 0x8f, 0x7f, 0x3a, 0xa9, 0x18, 0xcf, 0x4e, 0x2a, 0xc6, 0xf3, 0x93, 0x8a, - 0xf1, 0xe7, 0x49, 0xc5, 0xf8, 0xee, 0xb4, 0x52, 0x78, 0x7e, 0x5a, 0x29, 0xfc, 0x76, 0x5a, 0x29, - 0x7c, 0xb1, 0x39, 0xf6, 0xed, 0xf8, 0xab, 0xec, 0xef, 0x1d, 0xf9, 0xb2, 0x5c, 0x9f, 0x96, 0xbf, - 0x70, 0xde, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xee, 0xfe, 0x4a, 0x91, 0x0d, 0x00, 0x00, + proto.RegisterFile("distribution/v1beta1/genesis.proto", fileDescriptor_02ffc8100ab19bc0) +} + +var fileDescriptor_02ffc8100ab19bc0 = []byte{ + // 924 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0x8e, 0x93, 0x92, 0xcd, 0x4e, 0x16, 0xb1, 0x78, 0xbb, 0xc5, 0xed, 0x2e, 0x4e, 0xb7, 0xac, + 0xc4, 0x4a, 0x28, 0x0e, 0x9b, 0x45, 0x80, 0x8a, 0x40, 0x4a, 0xd2, 0xf2, 0x71, 0xa2, 0x4a, 0x10, + 0x95, 0x90, 0x50, 0x34, 0xb1, 0x27, 0xce, 0x50, 0xc7, 0x93, 0xce, 0x8c, 0xdd, 0x56, 0xe2, 0x84, + 0x84, 0xd4, 0x23, 0x12, 0xfc, 0x80, 0x1e, 0x11, 0x12, 0x37, 0x7e, 0x03, 0xea, 0xb1, 0xe2, 0xc4, + 0x01, 0x15, 0x94, 0x72, 0xe0, 0x2f, 0x70, 0x43, 0x1e, 0x8f, 0xbf, 0x54, 0x37, 0xa4, 0xdd, 0xf6, + 0xd4, 0x8e, 0xe7, 0xfd, 0x78, 0x9e, 0xf7, 0x7d, 0xf2, 0xbe, 0x03, 0xd6, 0x2c, 0xcc, 0x38, 0xc5, + 0x03, 0x8f, 0x63, 0xe2, 0x36, 0xfc, 0xa7, 0x03, 0xc4, 0xe1, 0xd3, 0x86, 0x8d, 0x5c, 0xc4, 0x30, + 0x33, 0x26, 0x94, 0x70, 0xa2, 0x3e, 0x30, 0x09, 0x1b, 0x13, 0x66, 0xa4, 0x4d, 0x0d, 0x69, 0xba, + 0xb2, 0x68, 0x13, 0x9b, 0x08, 0xbb, 0x46, 0xf0, 0x5f, 0xe8, 0xb2, 0xa2, 0x87, 0x2e, 0x8d, 0x01, + 0x64, 0x28, 0x8e, 0x6a, 0x12, 0xec, 0xca, 0xfb, 0xd7, 0x73, 0xd3, 0x66,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, 0x5e, 0xfe, 0xa9, 0x33, 0x6b, 0xa7, 0xc1, 0x0f, 0x26, 0x88, 0x45, 0x3e, 0xac, 0xab, + 0x92, 0x73, 0x8c, 0x52, 0xdc, 0xff, 0x50, 0xc0, 0xe3, 0x98, 0x7b, 0xcb, 0x34, 0xbd, 0xb1, 0xe7, + 0x40, 0x8e, 0xac, 0x0e, 0x19, 0x8f, 0x31, 0x63, 0x98, 0xb8, 0xd7, 0x4b, 0xdf, 0x04, 0x55, 0x98, + 0x64, 0x11, 0x5d, 0xab, 0x36, 0xdf, 0x33, 0x66, 0x08, 0xd9, 0x98, 0x0d, 0xaf, 0xbd, 0x10, 0x14, + 0xa5, 0x9b, 0x8e, 0x9a, 0xa2, 0xf7, 0xb7, 0x02, 0x56, 0x63, 0xff, 0x8f, 0x31, 0xe3, 0x84, 0x62, + 0x13, 0x3a, 0x37, 0xd2, 0xd9, 0x25, 0x50, 0x9e, 0x20, 0x8a, 0x49, 0xc8, 0x6a, 0xa1, 0x2b, 0x4f, + 0xea, 0x36, 0xb8, 0x15, 0x35, 0xb9, 0x24, 0xe8, 0xbe, 0x33, 0x1f, 0xdd, 0x73, 0x70, 0x25, 0xd5, + 0x28, 0x5a, 0x8a, 0xe6, 0xaf, 0x0a, 0x78, 0x35, 0xf6, 0xeb, 0x78, 0x94, 0x22, 0x97, 0xdf, 0x08, + 0xc7, 0xcf, 0x12, 0x2e, 0x61, 0xeb, 0xde, 0x9a, 0x8f, 0x4b, 0x16, 0xd3, 0xc5, 0x44, 0x7e, 0x28, + 0x82, 0x07, 0xf1, 0xe8, 0xe8, 0x71, 0x48, 0x39, 0x76, 0xed, 0x60, 0x74, 0x24, 0x34, 0xae, 0x63, + 0x80, 0xe4, 0x56, 0xa3, 0x78, 0xe9, 0x6a, 0x7c, 0x09, 0x5e, 0x64, 0x12, 0x63, 0x1f, 0xbb, 0x43, + 0x22, 0xfb, 0xdb, 0x9c, 0x59, 0x93, 0x5c, 0x7a, 0xb2, 0x22, 0x77, 0x58, 0xea, 0x5b, 0xaa, 0x2c, + 0x87, 0x45, 0xb0, 0x1c, 0xd7, 0xb2, 0xe7, 0x40, 0x36, 0xda, 0xf4, 0x45, 0x39, 0xaf, 0x59, 0xbf, + 0x23, 0x84, 0xed, 0x11, 0x8f, 0xf4, 0x1b, 0x9e, 0x52, 0xba, 0x2e, 0x65, 0x74, 0xfd, 0x15, 0xb8, + 0x9f, 0xa4, 0x65, 0x01, 0xa8, 0x3e, 0x0a, 0x50, 0x69, 0x0b, 0xa2, 0x0a, 0x6f, 0xce, 0xa7, 0x8c, + 0x84, 0x8d, 0xac, 0xc1, 0x3d, 0xff, 0xfc, 0x55, 0xaa, 0x14, 0xa7, 0x15, 0x70, 0xe7, 0xa3, 0x70, + 0x0b, 0xf6, 0x38, 0xe4, 0x48, 0x6d, 0x81, 0xf2, 0x04, 0x52, 0x38, 0x0e, 0x29, 0x57, 0x9b, 0xaf, + 0xcd, 0xcc, 0xbb, 0x25, 0x4c, 0x65, 0x2a, 0xe9, 0xa8, 0x6e, 0x82, 0xca, 0x10, 0xa1, 0xfe, 0x84, + 0x10, 0x47, 0xca, 0xfa, 0xf1, 0xcc, 0x20, 0x1f, 0x22, 0xb4, 0x45, 0x88, 0x13, 0xc9, 0x78, 0x18, + 0x1e, 0x55, 0x0a, 0xb4, 0x44, 0x9c, 0xf1, 0x82, 0x0a, 0x84, 0x11, 0xfc, 0xf2, 0x4b, 0xf3, 0x2b, + 0x23, 0xbd, 0x33, 0x65, 0x92, 0x25, 0x2b, 0xef, 0x52, 0x28, 0x79, 0x42, 0x91, 0x8f, 0x89, 0x27, + 0x56, 0xf1, 0x84, 0x30, 0x44, 0x45, 0x03, 0x66, 0xf6, 0x3e, 0x72, 0xd9, 0x92, 0x1e, 0xaa, 0x97, + 0xbf, 0x94, 0x5e, 0x10, 0xa8, 0x3f, 0x98, 0xaf, 0x93, 0x17, 0x6d, 0x4e, 0xc9, 0x20, 0x67, 0x0f, + 0xa9, 0xdf, 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0x6c, 0x50, 0x16, 0x0f, 0xe5, 0x67, 0xff, 0x05, + 0x00, 0x00, 0xff, 0xff, 0x24, 0x50, 0xc2, 0x92, 0xe5, 0x0b, 0x00, 0x00, } func (m *DelegatorWithdrawInfo) Marshal() (dAtA []byte, err error) { diff --git a/x/distribution/types/msg.go b/x/distribution/types/msg.go index 09e9994c16a..fccacfc9509 100644 --- a/x/distribution/types/msg.go +++ b/x/distribution/types/msg.go @@ -1,20 +1,29 @@ package types import ( + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec/legacy" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // distribution message types const ( - TypeMsgSetWithdrawAddress = "set_withdraw_address" - TypeMsgWithdrawDelegatorReward = "withdraw_delegator_reward" - TypeMsgWithdrawValidatorCommission = "withdraw_validator_commission" - TypeMsgFundCommunityPool = "fund_community_pool" + TypeMsgSetWithdrawAddress = "set_withdraw_address" + TypeMsgWithdrawDelegatorReward = "withdraw_delegator_reward" + TypeMsgWithdrawValidatorCommission = "withdraw_validator_commission" + TypeMsgFundCommunityPool = "fund_community_pool" + TypeMsgWithdrawTokenizeShareRecordReward = "withdraw_tokenize_share_record_reward" + TypeMsgWithdrawAllTokenizeShareRecordReward = "withdraw_all_tokenize_share_record_reward" ) // Verify interface at compile time -var _, _, _ sdk.Msg = &MsgSetWithdrawAddress{}, &MsgWithdrawDelegatorReward{}, &MsgWithdrawValidatorCommission{} +var ( + _, _, _ sdk.Msg = &MsgSetWithdrawAddress{}, &MsgWithdrawDelegatorReward{}, &MsgWithdrawValidatorCommission{} + _ sdk.Msg = &MsgWithdrawTokenizeShareRecordReward{} + _ sdk.Msg = &MsgWithdrawAllTokenizeShareRecordReward{} +) func NewMsgSetWithdrawAddress(delAddr, withdrawAddr sdk.AccAddress) *MsgSetWithdrawAddress { return &MsgSetWithdrawAddress{ @@ -28,26 +37,26 @@ func (msg MsgSetWithdrawAddress) Type() string { return TypeMsgSetWithdrawAddre // Return address that must sign over msg.GetSignBytes() func (msg MsgSetWithdrawAddress) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { panic(err) } - return []sdk.AccAddress{delAddr} + return []sdk.AccAddress{delegator} } // get the bytes for the message signer to sign on func (msg MsgSetWithdrawAddress) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // quick validity check func (msg MsgSetWithdrawAddress) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return ErrEmptyDelegatorAddr + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } - if msg.WithdrawAddress == "" { - return ErrEmptyWithdrawAddr + if _, err := sdk.AccAddressFromBech32(msg.WithdrawAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid withdraw address: %s", err) } return nil @@ -65,26 +74,26 @@ func (msg MsgWithdrawDelegatorReward) Type() string { return TypeMsgWithdrawDel // Return address that must sign over msg.GetSignBytes() func (msg MsgWithdrawDelegatorReward) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { panic(err) } - return []sdk.AccAddress{delAddr} + return []sdk.AccAddress{delegator} } // get the bytes for the message signer to sign on func (msg MsgWithdrawDelegatorReward) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // quick validity check func (msg MsgWithdrawDelegatorReward) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return ErrEmptyDelegatorAddr + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } - if msg.ValidatorAddress == "" { - return ErrEmptyValidatorAddr + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) } return nil } @@ -100,23 +109,20 @@ func (msg MsgWithdrawValidatorCommission) Type() string { return TypeMsgWithdra // Return address that must sign over msg.GetSignBytes() func (msg MsgWithdrawValidatorCommission) GetSigners() []sdk.AccAddress { - valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{valAddr.Bytes()} + valAddr, _ := sdk.ValAddressFromBech32(msg.ValidatorAddress) + return []sdk.AccAddress{sdk.AccAddress(valAddr)} } // get the bytes for the message signer to sign on func (msg MsgWithdrawValidatorCommission) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // quick validity check func (msg MsgWithdrawValidatorCommission) ValidateBasic() error { - if msg.ValidatorAddress == "" { - return ErrEmptyValidatorAddr + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) } return nil } @@ -139,28 +145,96 @@ func (msg MsgFundCommunityPool) Type() string { return TypeMsgFundCommunityPool // GetSigners returns the signer addresses that are expected to sign the result // of GetSignBytes. func (msg MsgFundCommunityPool) GetSigners() []sdk.AccAddress { - depoAddr, err := sdk.AccAddressFromBech32(msg.Depositor) + depositor, err := sdk.AccAddressFromBech32(msg.Depositor) if err != nil { panic(err) } - return []sdk.AccAddress{depoAddr} + return []sdk.AccAddress{depositor} } // GetSignBytes returns the raw bytes for a MsgFundCommunityPool message that // the expected signer needs to sign. func (msg MsgFundCommunityPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic performs basic MsgFundCommunityPool message validation. func (msg MsgFundCommunityPool) ValidateBasic() error { if !msg.Amount.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + } + if _, err := sdk.AccAddressFromBech32(msg.Depositor); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid depositor address: %s", err) + } + return nil +} + +func NewMsgWithdrawTokenizeShareRecordReward(ownerAddr sdk.AccAddress, recordID uint64) *MsgWithdrawTokenizeShareRecordReward { + return &MsgWithdrawTokenizeShareRecordReward{ + OwnerAddress: ownerAddr.String(), + RecordId: recordID, + } +} + +func (msg MsgWithdrawTokenizeShareRecordReward) Route() string { return ModuleName } +func (msg MsgWithdrawTokenizeShareRecordReward) Type() string { + return TypeMsgWithdrawTokenizeShareRecordReward +} + +// Return address that must sign over msg.GetSignBytes() +func (msg MsgWithdrawTokenizeShareRecordReward) GetSigners() []sdk.AccAddress { + owner, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{owner} +} + +// get the bytes for the message signer to sign on +func (msg MsgWithdrawTokenizeShareRecordReward) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// quick validity check +func (msg MsgWithdrawTokenizeShareRecordReward) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.OwnerAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid owner address: %s", err) } - if msg.Depositor == "" { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Depositor) + return nil +} + +func NewMsgWithdrawAllTokenizeShareRecordReward(ownerAddr sdk.AccAddress) *MsgWithdrawAllTokenizeShareRecordReward { + return &MsgWithdrawAllTokenizeShareRecordReward{ + OwnerAddress: ownerAddr.String(), + } +} + +func (msg MsgWithdrawAllTokenizeShareRecordReward) Route() string { return ModuleName } +func (msg MsgWithdrawAllTokenizeShareRecordReward) Type() string { + return TypeMsgWithdrawAllTokenizeShareRecordReward +} + +// Return address that must sign over msg.GetSignBytes() +func (msg MsgWithdrawAllTokenizeShareRecordReward) GetSigners() []sdk.AccAddress { + owner, err := sdk.AccAddressFromBech32(msg.OwnerAddress) + if err != nil { + panic(err) } + return []sdk.AccAddress{owner} +} +// get the bytes for the message signer to sign on +func (msg MsgWithdrawAllTokenizeShareRecordReward) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// quick validity check +func (msg MsgWithdrawAllTokenizeShareRecordReward) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.OwnerAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid owner address: %s", err) + } return nil } diff --git a/x/distribution/types/proposal.go b/x/distribution/types/proposal.go index 2eed72a2e46..78aebd142c9 100644 --- a/x/distribution/types/proposal.go +++ b/x/distribution/types/proposal.go @@ -17,11 +17,12 @@ const ( var _ govtypes.Content = &CommunityPoolSpendProposal{} func init() { + // already registered in cosmos govtypes.RegisterProposalType(ProposalTypeCommunityPoolSpend) govtypes.RegisterProposalTypeCodec(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal") } -// NewCommunityPoolSpendProposal creates a new community pool spned proposal. +// NewCommunityPoolSpendProposal creates a new community pool spend proposal. // //nolint:interfacer func NewCommunityPoolSpendProposal(title, description string, recipient sdk.AccAddress, amount sdk.Coins) *CommunityPoolSpendProposal { diff --git a/x/distribution/types/query.pb.go b/x/distribution/types/query.pb.go index 47acd5e73c5..6d1c3dcfd93 100644 --- a/x/distribution/types/query.pb.go +++ b/x/distribution/types/query.pb.go @@ -1,15 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/distribution/v1beta1/query.proto +// source: distribution/v1beta1/query.proto package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" 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" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -40,7 +41,7 @@ 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_5efd02cbc06efdc9, []int{0} + return fileDescriptor_bee02899ef89b167, []int{0} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -79,7 +80,7 @@ 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_5efd02cbc06efdc9, []int{1} + return fileDescriptor_bee02899ef89b167, []int{1} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -128,7 +129,7 @@ func (m *QueryValidatorOutstandingRewardsRequest) Reset() { func (m *QueryValidatorOutstandingRewardsRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorOutstandingRewardsRequest) ProtoMessage() {} func (*QueryValidatorOutstandingRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{2} + return fileDescriptor_bee02899ef89b167, []int{2} } func (m *QueryValidatorOutstandingRewardsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -176,7 +177,7 @@ func (m *QueryValidatorOutstandingRewardsResponse) Reset() { func (m *QueryValidatorOutstandingRewardsResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorOutstandingRewardsResponse) ProtoMessage() {} func (*QueryValidatorOutstandingRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{3} + return fileDescriptor_bee02899ef89b167, []int{3} } func (m *QueryValidatorOutstandingRewardsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,7 +224,7 @@ func (m *QueryValidatorCommissionRequest) Reset() { *m = QueryValidatorC func (m *QueryValidatorCommissionRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorCommissionRequest) ProtoMessage() {} func (*QueryValidatorCommissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{4} + return fileDescriptor_bee02899ef89b167, []int{4} } func (m *QueryValidatorCommissionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -270,7 +271,7 @@ func (m *QueryValidatorCommissionResponse) Reset() { *m = QueryValidator func (m *QueryValidatorCommissionResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorCommissionResponse) ProtoMessage() {} func (*QueryValidatorCommissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{5} + return fileDescriptor_bee02899ef89b167, []int{5} } func (m *QueryValidatorCommissionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -323,7 +324,7 @@ func (m *QueryValidatorSlashesRequest) Reset() { *m = QueryValidatorSlas func (m *QueryValidatorSlashesRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorSlashesRequest) ProtoMessage() {} func (*QueryValidatorSlashesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{6} + return fileDescriptor_bee02899ef89b167, []int{6} } func (m *QueryValidatorSlashesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -365,7 +366,7 @@ func (m *QueryValidatorSlashesResponse) Reset() { *m = QueryValidatorSla func (m *QueryValidatorSlashesResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorSlashesResponse) ProtoMessage() {} func (*QueryValidatorSlashesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{7} + return fileDescriptor_bee02899ef89b167, []int{7} } func (m *QueryValidatorSlashesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -408,95 +409,6 @@ func (m *QueryValidatorSlashesResponse) GetPagination() *query.PageResponse { return nil } -// QueryDelegationRewardsRequest is the request type for the -// Query/DelegationRewards RPC method. -type QueryDelegationRewardsRequest struct { - // delegator_address defines the delegator address to query for. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - // validator_address defines the validator address to query for. - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` -} - -func (m *QueryDelegationRewardsRequest) Reset() { *m = QueryDelegationRewardsRequest{} } -func (m *QueryDelegationRewardsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDelegationRewardsRequest) ProtoMessage() {} -func (*QueryDelegationRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{8} -} -func (m *QueryDelegationRewardsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegationRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegationRewardsRequest.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 *QueryDelegationRewardsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegationRewardsRequest.Merge(m, src) -} -func (m *QueryDelegationRewardsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegationRewardsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegationRewardsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegationRewardsRequest proto.InternalMessageInfo - -// QueryDelegationRewardsResponse is the response type for the -// Query/DelegationRewards RPC method. -type QueryDelegationRewardsResponse struct { - // rewards defines the rewards accrued by a delegation. - Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` -} - -func (m *QueryDelegationRewardsResponse) Reset() { *m = QueryDelegationRewardsResponse{} } -func (m *QueryDelegationRewardsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDelegationRewardsResponse) ProtoMessage() {} -func (*QueryDelegationRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{9} -} -func (m *QueryDelegationRewardsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegationRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegationRewardsResponse.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 *QueryDelegationRewardsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegationRewardsResponse.Merge(m, src) -} -func (m *QueryDelegationRewardsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegationRewardsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegationRewardsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegationRewardsResponse proto.InternalMessageInfo - -func (m *QueryDelegationRewardsResponse) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { - if m != nil { - return m.Rewards - } - return nil -} - // QueryDelegationTotalRewardsRequest is the request type for the // Query/DelegationTotalRewards RPC method. type QueryDelegationTotalRewardsRequest struct { @@ -508,7 +420,7 @@ func (m *QueryDelegationTotalRewardsRequest) Reset() { *m = QueryDelegat func (m *QueryDelegationTotalRewardsRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegationTotalRewardsRequest) ProtoMessage() {} func (*QueryDelegationTotalRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{10} + return fileDescriptor_bee02899ef89b167, []int{8} } func (m *QueryDelegationTotalRewardsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -550,7 +462,7 @@ func (m *QueryDelegationTotalRewardsResponse) Reset() { *m = QueryDelega func (m *QueryDelegationTotalRewardsResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegationTotalRewardsResponse) ProtoMessage() {} func (*QueryDelegationTotalRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{11} + return fileDescriptor_bee02899ef89b167, []int{9} } func (m *QueryDelegationTotalRewardsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -604,7 +516,7 @@ func (m *QueryDelegatorValidatorsRequest) Reset() { *m = QueryDelegatorV func (m *QueryDelegatorValidatorsRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorValidatorsRequest) ProtoMessage() {} func (*QueryDelegatorValidatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{12} + return fileDescriptor_bee02899ef89b167, []int{10} } func (m *QueryDelegatorValidatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -644,7 +556,7 @@ func (m *QueryDelegatorValidatorsResponse) Reset() { *m = QueryDelegator func (m *QueryDelegatorValidatorsResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorValidatorsResponse) ProtoMessage() {} func (*QueryDelegatorValidatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{13} + return fileDescriptor_bee02899ef89b167, []int{11} } func (m *QueryDelegatorValidatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -684,7 +596,7 @@ func (m *QueryDelegatorWithdrawAddressRequest) Reset() { *m = QueryDeleg func (m *QueryDelegatorWithdrawAddressRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorWithdrawAddressRequest) ProtoMessage() {} func (*QueryDelegatorWithdrawAddressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{14} + return fileDescriptor_bee02899ef89b167, []int{12} } func (m *QueryDelegatorWithdrawAddressRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -724,7 +636,7 @@ func (m *QueryDelegatorWithdrawAddressResponse) Reset() { *m = QueryDele func (m *QueryDelegatorWithdrawAddressResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorWithdrawAddressResponse) ProtoMessage() {} func (*QueryDelegatorWithdrawAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{15} + return fileDescriptor_bee02899ef89b167, []int{13} } func (m *QueryDelegatorWithdrawAddressResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -762,7 +674,7 @@ func (m *QueryCommunityPoolRequest) Reset() { *m = QueryCommunityPoolReq func (m *QueryCommunityPoolRequest) String() string { return proto.CompactTextString(m) } func (*QueryCommunityPoolRequest) ProtoMessage() {} func (*QueryCommunityPoolRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{16} + return fileDescriptor_bee02899ef89b167, []int{14} } func (m *QueryCommunityPoolRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -802,7 +714,7 @@ func (m *QueryCommunityPoolResponse) Reset() { *m = QueryCommunityPoolRe func (m *QueryCommunityPoolResponse) String() string { return proto.CompactTextString(m) } func (*QueryCommunityPoolResponse) ProtoMessage() {} func (*QueryCommunityPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5efd02cbc06efdc9, []int{17} + return fileDescriptor_bee02899ef89b167, []int{15} } func (m *QueryCommunityPoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -838,6 +750,188 @@ func (m *QueryCommunityPoolResponse) GetPool() github_com_cosmos_cosmos_sdk_type return nil } +type QueryTokenizeShareRecordRewardRequest struct { + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` +} + +func (m *QueryTokenizeShareRecordRewardRequest) Reset() { *m = QueryTokenizeShareRecordRewardRequest{} } +func (m *QueryTokenizeShareRecordRewardRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordRewardRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordRewardRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_bee02899ef89b167, []int{16} +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordRewardRequest.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 *QueryTokenizeShareRecordRewardRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordRewardRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordRewardRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordRewardRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordRewardRequest proto.InternalMessageInfo + +type QueryTokenizeShareRecordRewardResponse struct { + // rewards defines all the rewards accrued by a delegator. + Rewards []TokenizeShareRecordReward `protobuf:"bytes,1,rep,name=rewards,proto3" json:"rewards"` + // total defines the sum of all the rewards. + Total github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=total,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"total"` +} + +func (m *QueryTokenizeShareRecordRewardResponse) Reset() { + *m = QueryTokenizeShareRecordRewardResponse{} +} +func (m *QueryTokenizeShareRecordRewardResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordRewardResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordRewardResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bee02899ef89b167, []int{17} +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordRewardResponse.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 *QueryTokenizeShareRecordRewardResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordRewardResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordRewardResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordRewardResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareRecordRewardResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordRewardResponse) GetRewards() []TokenizeShareRecordReward { + if m != nil { + return m.Rewards + } + return nil +} + +func (m *QueryTokenizeShareRecordRewardResponse) GetTotal() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Total + } + return nil +} + +// QueryDelegationRewardsRequest is the request type for the +// Query/DelegationRewards RPC method. +type QueryDelegationRewardsRequest struct { + // delegator_address defines the delegator address to query for. + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // validator_address defines the validator address to query for. + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` +} + +func (m *QueryDelegationRewardsRequest) Reset() { *m = QueryDelegationRewardsRequest{} } +func (m *QueryDelegationRewardsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegationRewardsRequest) ProtoMessage() {} +func (*QueryDelegationRewardsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_bee02899ef89b167, []int{18} +} +func (m *QueryDelegationRewardsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegationRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegationRewardsRequest.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 *QueryDelegationRewardsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegationRewardsRequest.Merge(m, src) +} +func (m *QueryDelegationRewardsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegationRewardsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegationRewardsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegationRewardsRequest proto.InternalMessageInfo + +// QueryDelegationRewardsResponse is the response type for the +// Query/DelegationRewards RPC method. +type QueryDelegationRewardsResponse struct { + // rewards defines the rewards accrued by a delegation. + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` +} + +func (m *QueryDelegationRewardsResponse) Reset() { *m = QueryDelegationRewardsResponse{} } +func (m *QueryDelegationRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegationRewardsResponse) ProtoMessage() {} +func (*QueryDelegationRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bee02899ef89b167, []int{19} +} +func (m *QueryDelegationRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegationRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegationRewardsResponse.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 *QueryDelegationRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegationRewardsResponse.Merge(m, src) +} +func (m *QueryDelegationRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegationRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegationRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegationRewardsResponse proto.InternalMessageInfo + +func (m *QueryDelegationRewardsResponse) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Rewards + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.distribution.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.distribution.v1beta1.QueryParamsResponse") @@ -847,8 +941,6 @@ func init() { proto.RegisterType((*QueryValidatorCommissionResponse)(nil), "cosmos.distribution.v1beta1.QueryValidatorCommissionResponse") proto.RegisterType((*QueryValidatorSlashesRequest)(nil), "cosmos.distribution.v1beta1.QueryValidatorSlashesRequest") proto.RegisterType((*QueryValidatorSlashesResponse)(nil), "cosmos.distribution.v1beta1.QueryValidatorSlashesResponse") - proto.RegisterType((*QueryDelegationRewardsRequest)(nil), "cosmos.distribution.v1beta1.QueryDelegationRewardsRequest") - proto.RegisterType((*QueryDelegationRewardsResponse)(nil), "cosmos.distribution.v1beta1.QueryDelegationRewardsResponse") proto.RegisterType((*QueryDelegationTotalRewardsRequest)(nil), "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest") proto.RegisterType((*QueryDelegationTotalRewardsResponse)(nil), "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse") proto.RegisterType((*QueryDelegatorValidatorsRequest)(nil), "cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest") @@ -857,83 +949,96 @@ func init() { proto.RegisterType((*QueryDelegatorWithdrawAddressResponse)(nil), "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse") proto.RegisterType((*QueryCommunityPoolRequest)(nil), "cosmos.distribution.v1beta1.QueryCommunityPoolRequest") proto.RegisterType((*QueryCommunityPoolResponse)(nil), "cosmos.distribution.v1beta1.QueryCommunityPoolResponse") + proto.RegisterType((*QueryTokenizeShareRecordRewardRequest)(nil), "cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardRequest") + proto.RegisterType((*QueryTokenizeShareRecordRewardResponse)(nil), "cosmos.distribution.v1beta1.QueryTokenizeShareRecordRewardResponse") + proto.RegisterType((*QueryDelegationRewardsRequest)(nil), "cosmos.distribution.v1beta1.QueryDelegationRewardsRequest") + proto.RegisterType((*QueryDelegationRewardsResponse)(nil), "cosmos.distribution.v1beta1.QueryDelegationRewardsResponse") } -func init() { - proto.RegisterFile("cosmos/distribution/v1beta1/query.proto", fileDescriptor_5efd02cbc06efdc9) -} - -var fileDescriptor_5efd02cbc06efdc9 = []byte{ - // 1101 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x98, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0x6e, 0xda, 0xd2, 0x57, 0x4a, 0xd2, 0x69, 0x85, 0xcc, 0x26, 0xd8, 0xd1, 0x86, - 0x92, 0x40, 0x54, 0x6f, 0x93, 0x48, 0x05, 0x5a, 0x10, 0xe4, 0x57, 0xa9, 0xd4, 0x2a, 0x4d, 0x4d, - 0x95, 0x84, 0x5f, 0x8a, 0x26, 0xde, 0xd1, 0x7a, 0x55, 0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b, 0x5e, 0x0a, 0xb3, 0x73, 0xfb, 0xed, 0xa5, 0x30, 0x13, 0x5a, 0x6c, - 0x8f, 0x85, 0xd9, 0x85, 0xb0, 0x79, 0xb7, 0xf1, 0x7f, 0x08, 0x32, 0x9d, 0xba, 0x24, 0x5e, 0xec, - 0x23, 0xd6, 0xf8, 0x06, 0x6e, 0x2c, 0x0d, 0x23, 0xa1, 0x99, 0xef, 0x49, 0xe6, 0x35, 0x7c, 0x7b, - 0x18, 0xe6, 0xd6, 0x36, 0x8f, 0x7f, 0x46, 0x70, 0x2e, 0xd2, 0xa3, 0xf1, 0xd5, 0xee, 0xb1, 0xc6, - 0xb5, 0x7c, 0xe3, 0x9d, 0xbe, 0xfd, 0x34, 0xd8, 0x82, 0x04, 0xbb, 0x8c, 0x67, 0x13, 0xc1, 0x8a, - 0x81, 0xef, 0x76, 0xbd, 0xb5, 0x2f, 0xdd, 0x7a, 0x72, 0x94, 0x45, 0x4f, 0x8f, 0xb2, 0xe8, 0xcf, - 0xa3, 0x2c, 0xfa, 0xe1, 0x38, 0x9b, 0x7a, 0x7a, 0x9c, 0x4d, 0x3d, 0x3b, 0xce, 0xa6, 0x3e, 0x9b, - 0x4b, 0x9c, 0x13, 0xbe, 0x8a, 0xaa, 0xcb, 0xb1, 0x61, 0xe7, 0x94, 0xfc, 0x27, 0xc3, 0xc2, 0xff, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x68, 0x0b, 0x91, 0xae, 0x5c, 0x11, 0x00, 0x00, +func init() { proto.RegisterFile("distribution/v1beta1/query.proto", fileDescriptor_bee02899ef89b167) } + +var fileDescriptor_bee02899ef89b167 = []byte{ + // 1280 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xb8, 0x69, 0x4b, 0xa7, 0x2d, 0x4d, 0xa6, 0x11, 0x72, 0x36, 0xc1, 0x8e, 0x36, 0xb4, + 0x89, 0x88, 0xe2, 0x6d, 0x13, 0xa9, 0x40, 0x4a, 0x05, 0xf9, 0x55, 0x2a, 0x88, 0xda, 0xd4, 0x89, + 0x9a, 0xc2, 0x01, 0x6b, 0xe3, 0x1d, 0xad, 0x47, 0x59, 0xef, 0x38, 0xbb, 0xb3, 0x31, 0x21, 0xca, + 0x85, 0x50, 0x89, 0x0b, 0x12, 0x12, 0x97, 0x1e, 0x73, 0xe6, 0x0c, 0x17, 0xfe, 0x82, 0x1e, 0x2b, + 0x2a, 0x21, 0x4e, 0x05, 0x25, 0x08, 0x95, 0x03, 0x17, 0x2e, 0x70, 0x44, 0x3b, 0x33, 0x6b, 0x7b, + 0xed, 0xf5, 0xda, 0x8e, 0x1b, 0x71, 0x6a, 0xfc, 0xe6, 0xbd, 0xef, 0xbd, 0xef, 0xcd, 0xbc, 0xb7, + 0x9f, 0x0a, 0x47, 0x0d, 0xe2, 0x32, 0x87, 0x6c, 0x78, 0x8c, 0x50, 0x5b, 0xdb, 0xbe, 0xbe, 0x81, + 0x99, 0x7e, 0x5d, 0xdb, 0xf2, 0xb0, 0xb3, 0x93, 0x2d, 0x3b, 0x94, 0x51, 0x34, 0x5c, 0xa0, 0x6e, + 0x89, 0xba, 0xd9, 0x7a, 0xc7, 0xac, 0x74, 0x54, 0xde, 0x14, 0x87, 0xda, 0x86, 0xee, 0x62, 0x11, + 0x55, 0xc5, 0x28, 0xeb, 0x26, 0xb1, 0x75, 0xee, 0xcd, 0x81, 0x94, 0x41, 0x93, 0x9a, 0x94, 0xff, + 0xa9, 0xf9, 0x7f, 0x49, 0xeb, 0x88, 0x49, 0xa9, 0x69, 0x61, 0x4d, 0x2f, 0x13, 0x4d, 0xb7, 0x6d, + 0xca, 0x78, 0x88, 0x2b, 0x4f, 0xd3, 0xf5, 0xf8, 0x01, 0x72, 0x81, 0x92, 0x00, 0x73, 0x3c, 0xb2, + 0xfc, 0x50, 0xa9, 0xc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, 0x80, 0x17, 0x43, 0xba, 0x10, 0xdd, 0x68, 0x5f, 0x6b, 0x94, 0xcc, 0x54, 0xde, 0xea, + 0x3a, 0x4e, 0x12, 0x9b, 0xe1, 0xc4, 0xa6, 0xd0, 0x64, 0x2c, 0xb1, 0x42, 0x10, 0x9b, 0xf7, 0xe5, + 0x24, 0xfa, 0x17, 0xc0, 0xa1, 0x96, 0x32, 0x0c, 0x75, 0xd0, 0xef, 0x76, 0x3a, 0x54, 0x59, 0xe8, + 0x09, 0x43, 0x72, 0xcb, 0x71, 0x6e, 0xcb, 0xe8, 0xc3, 0x58, 0x6e, 0xbb, 0x21, 0x45, 0xbb, 0xa7, + 0x31, 0x89, 0x9b, 0x77, 0x7d, 0xe0, 0xbc, 0xc3, 0x91, 0x83, 0x4f, 0xe5, 0xfc, 0xa7, 0x4f, 0x0e, + 0xd3, 0xe0, 0xe9, 0x61, 0x1a, 0xfc, 0x76, 0x98, 0x06, 0xdf, 0x1c, 0xa5, 0x13, 0x4f, 0x8f, 0xd2, + 0x89, 0x5f, 0x8e, 0xd2, 0x89, 0x4f, 0x16, 0xeb, 0x54, 0x12, 0xd9, 0xb2, 0x3c, 0xff, 0xa3, 0x43, + 0xec, 0x82, 0x66, 0x91, 0x2d, 0x8f, 0x18, 0x84, 0xed, 0x4c, 0xb9, 0x4c, 0xdf, 0x24, 0xb6, 0x39, + 0x55, 0xa2, 0x86, 0x67, 0x61, 0xed, 0xb3, 0x70, 0x3d, 0x5c, 0x47, 0x6d, 0x9c, 0xe1, 0xff, 0x0d, + 0x37, 0xf3, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xd8, 0x2c, 0x4b, 0x8b, 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -967,6 +1072,8 @@ type QueryClient interface { DelegatorWithdrawAddress(ctx context.Context, in *QueryDelegatorWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryDelegatorWithdrawAddressResponse, error) // CommunityPool queries the community pool coins. CommunityPool(ctx context.Context, in *QueryCommunityPoolRequest, opts ...grpc.CallOption) (*QueryCommunityPoolResponse, error) + // TokenizeShareRecordReward queries the tokenize share record rewards + TokenizeShareRecordReward(ctx context.Context, in *QueryTokenizeShareRecordRewardRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordRewardResponse, error) } type queryClient struct { @@ -1058,6 +1165,15 @@ func (c *queryClient) CommunityPool(ctx context.Context, in *QueryCommunityPoolR return out, nil } +func (c *queryClient) TokenizeShareRecordReward(ctx context.Context, in *QueryTokenizeShareRecordRewardRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordRewardResponse, error) { + out := new(QueryTokenizeShareRecordRewardResponse) + err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Query/TokenizeShareRecordReward", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Params queries params of the distribution module. @@ -1079,6 +1195,8 @@ type QueryServer interface { DelegatorWithdrawAddress(context.Context, *QueryDelegatorWithdrawAddressRequest) (*QueryDelegatorWithdrawAddressResponse, error) // CommunityPool queries the community pool coins. CommunityPool(context.Context, *QueryCommunityPoolRequest) (*QueryCommunityPoolResponse, error) + // TokenizeShareRecordReward queries the tokenize share record rewards + TokenizeShareRecordReward(context.Context, *QueryTokenizeShareRecordRewardRequest) (*QueryTokenizeShareRecordRewardResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1112,6 +1230,9 @@ func (*UnimplementedQueryServer) DelegatorWithdrawAddress(ctx context.Context, r func (*UnimplementedQueryServer) CommunityPool(ctx context.Context, req *QueryCommunityPoolRequest) (*QueryCommunityPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CommunityPool not implemented") } +func (*UnimplementedQueryServer) TokenizeShareRecordReward(ctx context.Context, req *QueryTokenizeShareRecordRewardRequest) (*QueryTokenizeShareRecordRewardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenizeShareRecordReward not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1279,18 +1400,36 @@ func _Query_CommunityPool_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.distribution.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "ValidatorOutstandingRewards", - Handler: _Query_ValidatorOutstandingRewards_Handler, - }, +func _Query_TokenizeShareRecordReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenizeShareRecordRewardRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TokenizeShareRecordReward(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.distribution.v1beta1.Query/TokenizeShareRecordReward", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenizeShareRecordReward(ctx, req.(*QueryTokenizeShareRecordRewardRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.distribution.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "ValidatorOutstandingRewards", + Handler: _Query_ValidatorOutstandingRewards_Handler, + }, { MethodName: "ValidatorCommission", Handler: _Query_ValidatorCommission_Handler, @@ -1319,9 +1458,13 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "CommunityPool", Handler: _Query_CommunityPool_Handler, }, + { + MethodName: "TokenizeShareRecordReward", + Handler: _Query_TokenizeShareRecordReward_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/distribution/v1beta1/query.proto", + Metadata: "distribution/v1beta1/query.proto", } func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { @@ -1607,80 +1750,6 @@ func (m *QueryValidatorSlashesResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryDelegationRewardsRequest) 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 *QueryDelegationRewardsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegationRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDelegationRewardsResponse) 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 *QueryDelegationRewardsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegationRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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 *QueryDelegationTotalRewardsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1944,6 +2013,161 @@ func (m *QueryCommunityPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *QueryTokenizeShareRecordRewardRequest) 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 *QueryTokenizeShareRecordRewardRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordRewardRequest) 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 = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordRewardResponse) 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 *QueryTokenizeShareRecordRewardResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Total) > 0 { + for iNdEx := len(m.Total) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Total[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + 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 *QueryDelegationRewardsRequest) 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 *QueryDelegationRewardsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegationRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegationRewardsResponse) 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 *QueryDelegationRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegationRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2065,7 +2289,7 @@ func (m *QueryValidatorSlashesResponse) Size() (n int) { return n } -func (m *QueryDelegationRewardsRequest) Size() (n int) { +func (m *QueryDelegationTotalRewardsRequest) Size() (n int) { if m == nil { return 0 } @@ -2075,42 +2299,10 @@ func (m *QueryDelegationRewardsRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } return n } -func (m *QueryDelegationRewardsResponse) 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)) - } - } - return n -} - -func (m *QueryDelegationTotalRewardsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegationTotalRewardsResponse) Size() (n int) { +func (m *QueryDelegationTotalRewardsResponse) Size() (n int) { if m == nil { return 0 } @@ -2209,6 +2401,72 @@ func (m *QueryCommunityPoolResponse) Size() (n int) { return n } +func (m *QueryTokenizeShareRecordRewardRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokenizeShareRecordRewardResponse) 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 len(m.Total) > 0 { + for _, e := range m.Total { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryDelegationRewardsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegationRewardsResponse) 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)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2954,7 +3212,7 @@ func (m *QueryValidatorSlashesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegationTotalRewardsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2977,10 +3235,10 @@ func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationRewardsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegationTotalRewardsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegationTotalRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3015,38 +3273,6 @@ func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { } m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3068,7 +3294,7 @@ func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegationTotalRewardsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3091,10 +3317,10 @@ func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationRewardsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegationTotalRewardsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegationTotalRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3126,11 +3352,45 @@ func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Rewards = append(m.Rewards, types.DecCoin{}) + m.Rewards = append(m.Rewards, DelegationDelegatorReward{}) if err := m.Rewards[len(m.Rewards)-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 Total", 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.Total = append(m.Total, types.DecCoin{}) + if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3152,7 +3412,7 @@ func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegationTotalRewardsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3175,10 +3435,10 @@ func (m *QueryDelegationTotalRewardsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationTotalRewardsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationTotalRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3234,7 +3494,7 @@ func (m *QueryDelegationTotalRewardsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegationTotalRewardsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3257,17 +3517,17 @@ func (m *QueryDelegationTotalRewardsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationTotalRewardsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationTotalRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3277,31 +3537,79 @@ func (m *QueryDelegationTotalRewardsResponse) 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 } - m.Rewards = append(m.Rewards, DelegationDelegatorReward{}) - if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Validators = append(m.Validators, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { return err } - iNdEx = postIndex - case 2: + 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 *QueryDelegatorWithdrawAddressRequest) 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: QueryDelegatorWithdrawAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorWithdrawAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3311,25 +3619,23 @@ func (m *QueryDelegationTotalRewardsResponse) 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 } - m.Total = append(m.Total, types.DecCoin{}) - if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3352,7 +3658,7 @@ func (m *QueryDelegationTotalRewardsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorWithdrawAddressResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3375,15 +3681,15 @@ func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorWithdrawAddressResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorWithdrawAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3411,7 +3717,7 @@ func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + m.WithdrawAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3434,7 +3740,7 @@ func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryCommunityPoolRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3457,17 +3763,67 @@ func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCommunityPoolRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCommunityPoolRequest: 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 *QueryCommunityPoolResponse) 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: QueryCommunityPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCommunityPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3477,23 +3833,25 @@ func (m *QueryDelegatorValidatorsResponse) 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.Validators = append(m.Validators, string(dAtA[iNdEx:postIndex])) + m.Pool = append(m.Pool, types.DecCoin{}) + if err := m.Pool[len(m.Pool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3516,7 +3874,7 @@ func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorWithdrawAddressRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareRecordRewardRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3539,15 +3897,15 @@ func (m *QueryDelegatorWithdrawAddressRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorWithdrawAddressRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorWithdrawAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3575,7 +3933,7 @@ func (m *QueryDelegatorWithdrawAddressRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3598,7 +3956,7 @@ func (m *QueryDelegatorWithdrawAddressRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorWithdrawAddressResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareRecordRewardResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3621,17 +3979,17 @@ func (m *QueryDelegatorWithdrawAddressResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorWithdrawAddressResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorWithdrawAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareRecordRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3641,23 +3999,59 @@ func (m *QueryDelegatorWithdrawAddressResponse) 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.WithdrawAddress = string(dAtA[iNdEx:postIndex]) + m.Rewards = append(m.Rewards, TokenizeShareRecordReward{}) + if err := m.Rewards[len(m.Rewards)-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 Total", 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.Total = append(m.Total, types.DecCoin{}) + if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3680,7 +4074,7 @@ func (m *QueryDelegatorWithdrawAddressResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCommunityPoolRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3703,12 +4097,76 @@ func (m *QueryCommunityPoolRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCommunityPoolRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegationRewardsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCommunityPoolRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegationRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3730,7 +4188,7 @@ func (m *QueryCommunityPoolRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCommunityPoolResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3753,15 +4211,15 @@ func (m *QueryCommunityPoolResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCommunityPoolResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegationRewardsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCommunityPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegationRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3788,8 +4246,8 @@ func (m *QueryCommunityPoolResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Pool = append(m.Pool, types.DecCoin{}) - if err := m.Pool[len(m.Pool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Rewards = append(m.Rewards, types.DecCoin{}) + if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/distribution/types/query.pb.gw.go b/x/distribution/types/query.pb.gw.go index 2e8f1cde3ff..09b002edc31 100644 --- a/x/distribution/types/query.pb.gw.go +++ b/x/distribution/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cosmos/distribution/v1beta1/query.proto +// source: distribution/v1beta1/query.proto /* Package types is a reverse proxy. @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -485,15 +487,71 @@ func local_request_Query_CommunityPool_0(ctx context.Context, marshaler runtime. } +func request_Query_TokenizeShareRecordReward_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenizeShareRecordRewardRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + msg, err := client.TokenizeShareRecordReward(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TokenizeShareRecordReward_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenizeShareRecordRewardRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + msg, err := server.TokenizeShareRecordReward(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. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -501,6 +559,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -514,6 +573,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ValidatorOutstandingRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -521,6 +582,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ValidatorOutstandingRewards_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -534,6 +596,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ValidatorCommission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -541,6 +605,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ValidatorCommission_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -554,6 +619,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ValidatorSlashes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -561,6 +628,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ValidatorSlashes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -574,6 +642,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegationRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -581,6 +651,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegationRewards_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -594,6 +665,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegationTotalRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -601,6 +674,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegationTotalRewards_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -614,6 +688,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegatorValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -621,6 +697,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegatorValidators_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -634,6 +711,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegatorWithdrawAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -641,6 +720,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegatorWithdrawAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -654,6 +734,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_CommunityPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -661,6 +743,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_CommunityPool_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -671,6 +754,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_TokenizeShareRecordReward_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TokenizeShareRecordReward_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TokenizeShareRecordReward_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -892,6 +998,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_TokenizeShareRecordReward_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_TokenizeShareRecordReward_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_TokenizeShareRecordReward_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -913,6 +1039,8 @@ var ( pattern_Query_DelegatorWithdrawAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "distribution", "v1beta1", "delegators", "delegator_address", "withdraw_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_CommunityPool_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "distribution", "v1beta1", "community_pool"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TokenizeShareRecordReward_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"cosmos", "distribution", "v1beta1", "owner_address", "tokenize_share_record_rewards"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -933,4 +1061,6 @@ var ( forward_Query_DelegatorWithdrawAddress_0 = runtime.ForwardResponseMessage forward_Query_CommunityPool_0 = runtime.ForwardResponseMessage + + forward_Query_TokenizeShareRecordReward_0 = runtime.ForwardResponseMessage ) diff --git a/x/distribution/types/tx.pb.go b/x/distribution/types/tx.pb.go index 55cfce4e78f..948b22b9804 100644 --- a/x/distribution/types/tx.pb.go +++ b/x/distribution/types/tx.pb.go @@ -1,14 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/distribution/v1beta1/tx.proto +// source: distribution/v1beta1/tx.proto package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" @@ -33,15 +35,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgSetWithdrawAddress sets the withdraw address for // a delegator (or validator self-delegation). type MsgSetWithdrawAddress struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - WithdrawAddress string `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty" yaml:"withdraw_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + WithdrawAddress string `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty"` } func (m *MsgSetWithdrawAddress) Reset() { *m = MsgSetWithdrawAddress{} } func (m *MsgSetWithdrawAddress) String() string { return proto.CompactTextString(m) } func (*MsgSetWithdrawAddress) ProtoMessage() {} func (*MsgSetWithdrawAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{0} + return fileDescriptor_f0452d52deb0ca76, []int{0} } func (m *MsgSetWithdrawAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -78,7 +80,7 @@ func (m *MsgSetWithdrawAddressResponse) Reset() { *m = MsgSetWithdrawAdd func (m *MsgSetWithdrawAddressResponse) String() string { return proto.CompactTextString(m) } func (*MsgSetWithdrawAddressResponse) ProtoMessage() {} func (*MsgSetWithdrawAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{1} + return fileDescriptor_f0452d52deb0ca76, []int{1} } func (m *MsgSetWithdrawAddressResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -110,15 +112,15 @@ var xxx_messageInfo_MsgSetWithdrawAddressResponse proto.InternalMessageInfo // MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator // from a single validator. type MsgWithdrawDelegatorReward struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } func (m *MsgWithdrawDelegatorReward) Reset() { *m = MsgWithdrawDelegatorReward{} } func (m *MsgWithdrawDelegatorReward) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawDelegatorReward) ProtoMessage() {} func (*MsgWithdrawDelegatorReward) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{2} + return fileDescriptor_f0452d52deb0ca76, []int{2} } func (m *MsgWithdrawDelegatorReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -149,13 +151,15 @@ var xxx_messageInfo_MsgWithdrawDelegatorReward proto.InternalMessageInfo // MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. type MsgWithdrawDelegatorRewardResponse struct { + // Since: cosmos-sdk 0.46 + 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"` } func (m *MsgWithdrawDelegatorRewardResponse) Reset() { *m = MsgWithdrawDelegatorRewardResponse{} } func (m *MsgWithdrawDelegatorRewardResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawDelegatorRewardResponse) ProtoMessage() {} func (*MsgWithdrawDelegatorRewardResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{3} + return fileDescriptor_f0452d52deb0ca76, []int{3} } func (m *MsgWithdrawDelegatorRewardResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -184,17 +188,24 @@ func (m *MsgWithdrawDelegatorRewardResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawDelegatorRewardResponse proto.InternalMessageInfo +func (m *MsgWithdrawDelegatorRewardResponse) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + // MsgWithdrawValidatorCommission withdraws the full commission to the validator // address. type MsgWithdrawValidatorCommission struct { - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } func (m *MsgWithdrawValidatorCommission) Reset() { *m = MsgWithdrawValidatorCommission{} } func (m *MsgWithdrawValidatorCommission) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawValidatorCommission) ProtoMessage() {} func (*MsgWithdrawValidatorCommission) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{4} + return fileDescriptor_f0452d52deb0ca76, []int{4} } func (m *MsgWithdrawValidatorCommission) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -225,6 +236,8 @@ var xxx_messageInfo_MsgWithdrawValidatorCommission proto.InternalMessageInfo // MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. type MsgWithdrawValidatorCommissionResponse struct { + // Since: cosmos-sdk 0.46 + 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"` } func (m *MsgWithdrawValidatorCommissionResponse) Reset() { @@ -233,7 +246,7 @@ func (m *MsgWithdrawValidatorCommissionResponse) Reset() { func (m *MsgWithdrawValidatorCommissionResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawValidatorCommissionResponse) ProtoMessage() {} func (*MsgWithdrawValidatorCommissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{5} + return fileDescriptor_f0452d52deb0ca76, []int{5} } func (m *MsgWithdrawValidatorCommissionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -262,6 +275,175 @@ func (m *MsgWithdrawValidatorCommissionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawValidatorCommissionResponse proto.InternalMessageInfo +func (m *MsgWithdrawValidatorCommissionResponse) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +// MsgWithdrawTokenizeShareRecordReward withdraws tokenize share rewards for a specific record +type MsgWithdrawTokenizeShareRecordReward struct { + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` + RecordId uint64 `protobuf:"varint,2,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty"` +} + +func (m *MsgWithdrawTokenizeShareRecordReward) Reset() { *m = MsgWithdrawTokenizeShareRecordReward{} } +func (m *MsgWithdrawTokenizeShareRecordReward) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawTokenizeShareRecordReward) ProtoMessage() {} +func (*MsgWithdrawTokenizeShareRecordReward) Descriptor() ([]byte, []int) { + return fileDescriptor_f0452d52deb0ca76, []int{6} +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward.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 *MsgWithdrawTokenizeShareRecordReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward.Merge(m, src) +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawTokenizeShareRecordReward) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawTokenizeShareRecordReward proto.InternalMessageInfo + +// MsgWithdrawTokenizeShareRecordReward defines the Msg/WithdrawTokenizeShareRecordReward response type. +type MsgWithdrawTokenizeShareRecordRewardResponse struct { +} + +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) Reset() { + *m = MsgWithdrawTokenizeShareRecordRewardResponse{} +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) String() string { + return proto.CompactTextString(m) +} +func (*MsgWithdrawTokenizeShareRecordRewardResponse) ProtoMessage() {} +func (*MsgWithdrawTokenizeShareRecordRewardResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f0452d52deb0ca76, []int{7} +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse.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 *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse.Merge(m, src) +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawTokenizeShareRecordRewardResponse proto.InternalMessageInfo + +// MsgWithdrawAllTokenizeShareRecordReward withdraws tokenize share rewards or all +// records owned by the designated owner +type MsgWithdrawAllTokenizeShareRecordReward struct { + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" yaml:"owner_address"` +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) Reset() { + *m = MsgWithdrawAllTokenizeShareRecordReward{} +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawAllTokenizeShareRecordReward) ProtoMessage() {} +func (*MsgWithdrawAllTokenizeShareRecordReward) Descriptor() ([]byte, []int) { + return fileDescriptor_f0452d52deb0ca76, []int{8} +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward.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 *MsgWithdrawAllTokenizeShareRecordReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward.Merge(m, src) +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawAllTokenizeShareRecordReward) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordReward proto.InternalMessageInfo + +// MsgWithdrawAllTokenizeShareRecordRewardResponse defines the Msg/WithdrawTokenizeShareRecordReward response type. +type MsgWithdrawAllTokenizeShareRecordRewardResponse struct { +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) Reset() { + *m = MsgWithdrawAllTokenizeShareRecordRewardResponse{} +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) String() string { + return proto.CompactTextString(m) +} +func (*MsgWithdrawAllTokenizeShareRecordRewardResponse) ProtoMessage() {} +func (*MsgWithdrawAllTokenizeShareRecordRewardResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f0452d52deb0ca76, []int{9} +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse.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 *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse.Merge(m, src) +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawAllTokenizeShareRecordRewardResponse proto.InternalMessageInfo + // MsgFundCommunityPool allows an account to directly // fund the community pool. type MsgFundCommunityPool struct { @@ -273,7 +455,7 @@ func (m *MsgFundCommunityPool) Reset() { *m = MsgFundCommunityPool{} } func (m *MsgFundCommunityPool) String() string { return proto.CompactTextString(m) } func (*MsgFundCommunityPool) ProtoMessage() {} func (*MsgFundCommunityPool) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{6} + return fileDescriptor_f0452d52deb0ca76, []int{10} } func (m *MsgFundCommunityPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -310,7 +492,7 @@ func (m *MsgFundCommunityPoolResponse) Reset() { *m = MsgFundCommunityPo func (m *MsgFundCommunityPoolResponse) String() string { return proto.CompactTextString(m) } func (*MsgFundCommunityPoolResponse) ProtoMessage() {} func (*MsgFundCommunityPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ed4f433d965e58ca, []int{7} + return fileDescriptor_f0452d52deb0ca76, []int{11} } func (m *MsgFundCommunityPoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -346,51 +528,66 @@ func init() { proto.RegisterType((*MsgWithdrawDelegatorRewardResponse)(nil), "cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse") proto.RegisterType((*MsgWithdrawValidatorCommission)(nil), "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission") proto.RegisterType((*MsgWithdrawValidatorCommissionResponse)(nil), "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse") + proto.RegisterType((*MsgWithdrawTokenizeShareRecordReward)(nil), "cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordReward") + proto.RegisterType((*MsgWithdrawTokenizeShareRecordRewardResponse)(nil), "cosmos.distribution.v1beta1.MsgWithdrawTokenizeShareRecordRewardResponse") + proto.RegisterType((*MsgWithdrawAllTokenizeShareRecordReward)(nil), "cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordReward") + proto.RegisterType((*MsgWithdrawAllTokenizeShareRecordRewardResponse)(nil), "cosmos.distribution.v1beta1.MsgWithdrawAllTokenizeShareRecordRewardResponse") proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos.distribution.v1beta1.MsgFundCommunityPool") proto.RegisterType((*MsgFundCommunityPoolResponse)(nil), "cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse") } -func init() { - proto.RegisterFile("cosmos/distribution/v1beta1/tx.proto", fileDescriptor_ed4f433d965e58ca) -} - -var fileDescriptor_ed4f433d965e58ca = []byte{ - // 558 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x3f, 0x6f, 0xd3, 0x40, - 0x18, 0xc6, 0x7d, 0x2d, 0xaa, 0xe8, 0x31, 0x90, 0x58, 0x45, 0x0d, 0x4e, 0x38, 0x57, 0x56, 0x85, - 0xb2, 0x60, 0x93, 0x30, 0x20, 0xc2, 0x80, 0x48, 0x50, 0xa5, 0x0e, 0x11, 0xc8, 0x48, 0x20, 0xb1, - 0x20, 0x3b, 0x77, 0x72, 0x4f, 0xc4, 0xbe, 0xc8, 0x77, 0x6e, 0x9a, 0x11, 0x89, 0x81, 0x11, 0x89, - 0x0f, 0x40, 0x25, 0x16, 0xc4, 0xcc, 0xc8, 0x07, 0xc8, 0xd8, 0x91, 0x29, 0xa0, 0x64, 0x61, 0xee, - 0x27, 0x40, 0xf1, 0x3f, 0x92, 0xda, 0x49, 0x29, 0xe9, 0x94, 0xe8, 0xbd, 0xe7, 0xf9, 0xf9, 0x79, - 0x95, 0xe7, 0x62, 0xb8, 0xdb, 0x61, 0xdc, 0x65, 0xdc, 0xc0, 0x94, 0x0b, 0x9f, 0xda, 0x81, 0xa0, - 0xcc, 0x33, 0x0e, 0x6b, 0x36, 0x11, 0x56, 0xcd, 0x10, 0x47, 0x7a, 0xcf, 0x67, 0x82, 0xc9, 0xe5, - 0x48, 0xa5, 0xcf, 0xaa, 0xf4, 0x58, 0xa5, 0x6c, 0x39, 0xcc, 0x61, 0xa1, 0xce, 0x98, 0x7e, 0x8b, - 0x2c, 0x0a, 0x8a, 0xc1, 0xb6, 0xc5, 0x49, 0x0a, 0xec, 0x30, 0xea, 0x45, 0xe7, 0xda, 0x37, 0x00, - 0x6f, 0xb4, 0xb9, 0xf3, 0x9c, 0x88, 0x97, 0x54, 0x1c, 0x60, 0xdf, 0xea, 0x3f, 0xc6, 0xd8, 0x27,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0x6f, 0x84, 0x7f, 0xe3, 0xf7, - 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x18, 0x71, 0xb0, 0x41, 0x06, 0x00, 0x00, +func init() { proto.RegisterFile("distribution/v1beta1/tx.proto", fileDescriptor_f0452d52deb0ca76) } + +var fileDescriptor_f0452d52deb0ca76 = []byte{ + // 757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0x58, 0xa9, 0xed, 0xa8, 0xd8, 0x86, 0x68, 0xdb, 0xad, 0xdd, 0xd4, 0xa5, 0x68, 0x11, + 0xb3, 0x6b, 0x2a, 0x28, 0x46, 0x44, 0xda, 0xb4, 0x42, 0xc1, 0x80, 0x6c, 0x45, 0xc1, 0x4b, 0xd9, + 0x64, 0x86, 0xed, 0xd0, 0xdd, 0x9d, 0x74, 0x67, 0xb6, 0x69, 0xbc, 0x29, 0x82, 0x0a, 0x0a, 0x82, + 0x7f, 0x80, 0x3d, 0x8a, 0x27, 0x05, 0x2f, 0x7a, 0xf5, 0x52, 0xf4, 0x52, 0x3c, 0x79, 0xaa, 0x92, + 0x1e, 0xf4, 0xec, 0x5f, 0x20, 0xd9, 0x5f, 0xdd, 0x90, 0x5f, 0x5b, 0x5b, 0x7b, 0xda, 0x64, 0xde, + 0xfb, 0xbe, 0xf7, 0x7d, 0x33, 0x6f, 0xde, 0x2e, 0x1c, 0x43, 0x84, 0x71, 0x9b, 0x14, 0x1d, 0x4e, + 0xa8, 0xa5, 0xac, 0x66, 0x8b, 0x98, 0x6b, 0x59, 0x85, 0xaf, 0xc9, 0x65, 0x9b, 0x72, 0x9a, 0x1c, + 0x2d, 0x51, 0x66, 0x52, 0x26, 0x47, 0xb3, 0x64, 0x3f, 0x4b, 0x48, 0xe9, 0x54, 0xa7, 0x6e, 0x9e, + 0x52, 0xff, 0xe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e, 0x8b, 0x89, 0xef, 0xdb, 0x62, 0xe2, 0xfe, 0x6c, 0x64, 0xf6, 0x90, + 0x15, 0xc3, 0xa9, 0xf7, 0x0b, 0xb1, 0x4a, 0x8a, 0x41, 0x56, 0x1c, 0x82, 0x08, 0xaf, 0x66, 0x18, + 0xd7, 0x96, 0x89, 0xa5, 0x67, 0x4c, 0x8a, 0x1c, 0x03, 0x2b, 0x6b, 0x4a, 0xc3, 0xf7, 0xa5, 0x3b, + 0x9d, 0x8a, 0xbd, 0xee, 0x47, 0xdd, 0xa5, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf6, 0xe2, 0x23, + 0x14, 0x7c, 0x0a, 0x00, 0x00, } func (this *MsgSetWithdrawAddressResponse) Equal(that interface{}) bool { @@ -433,6 +630,14 @@ func (this *MsgWithdrawDelegatorRewardResponse) Equal(that interface{}) bool { } else if this == nil { return false } + if len(this.Amount) != len(that1.Amount) { + return false + } + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } return true } func (this *MsgWithdrawValidatorCommissionResponse) Equal(that interface{}) bool { @@ -454,6 +659,56 @@ func (this *MsgWithdrawValidatorCommissionResponse) Equal(that interface{}) bool } else if this == nil { return false } + if len(this.Amount) != len(that1.Amount) { + return false + } + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + return true +} +func (this *MsgWithdrawTokenizeShareRecordRewardResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgWithdrawTokenizeShareRecordRewardResponse) + if !ok { + that2, ok := that.(MsgWithdrawTokenizeShareRecordRewardResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *MsgWithdrawAllTokenizeShareRecordRewardResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgWithdrawAllTokenizeShareRecordRewardResponse) + if !ok { + that2, ok := that.(MsgWithdrawAllTokenizeShareRecordRewardResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } return true } func (this *MsgFundCommunityPoolResponse) Equal(that interface{}) bool { @@ -499,6 +754,10 @@ type MsgClient interface { // WithdrawValidatorCommission defines a method to withdraw the // full commission to the validator address. WithdrawValidatorCommission(ctx context.Context, in *MsgWithdrawValidatorCommission, opts ...grpc.CallOption) (*MsgWithdrawValidatorCommissionResponse, error) + // WithdrawTokenizeShareRecordReward defines a method to withdraw reward for an owning TokenizeShareRecord + WithdrawTokenizeShareRecordReward(ctx context.Context, in *MsgWithdrawTokenizeShareRecordReward, opts ...grpc.CallOption) (*MsgWithdrawTokenizeShareRecordRewardResponse, error) + // WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward for all owning TokenizeShareRecord + WithdrawAllTokenizeShareRecordReward(ctx context.Context, in *MsgWithdrawAllTokenizeShareRecordReward, opts ...grpc.CallOption) (*MsgWithdrawAllTokenizeShareRecordRewardResponse, error) // FundCommunityPool defines a method to allow an account to directly // fund the community pool. FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error) @@ -539,6 +798,24 @@ func (c *msgClient) WithdrawValidatorCommission(ctx context.Context, in *MsgWith return out, nil } +func (c *msgClient) WithdrawTokenizeShareRecordReward(ctx context.Context, in *MsgWithdrawTokenizeShareRecordReward, opts ...grpc.CallOption) (*MsgWithdrawTokenizeShareRecordRewardResponse, error) { + out := new(MsgWithdrawTokenizeShareRecordRewardResponse) + err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/WithdrawTokenizeShareRecordReward", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) WithdrawAllTokenizeShareRecordReward(ctx context.Context, in *MsgWithdrawAllTokenizeShareRecordReward, opts ...grpc.CallOption) (*MsgWithdrawAllTokenizeShareRecordRewardResponse, error) { + out := new(MsgWithdrawAllTokenizeShareRecordRewardResponse) + err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/WithdrawAllTokenizeShareRecordReward", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error) { out := new(MsgFundCommunityPoolResponse) err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/FundCommunityPool", in, out, opts...) @@ -559,6 +836,10 @@ type MsgServer interface { // WithdrawValidatorCommission defines a method to withdraw the // full commission to the validator address. WithdrawValidatorCommission(context.Context, *MsgWithdrawValidatorCommission) (*MsgWithdrawValidatorCommissionResponse, error) + // WithdrawTokenizeShareRecordReward defines a method to withdraw reward for an owning TokenizeShareRecord + WithdrawTokenizeShareRecordReward(context.Context, *MsgWithdrawTokenizeShareRecordReward) (*MsgWithdrawTokenizeShareRecordRewardResponse, error) + // WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward for all owning TokenizeShareRecord + WithdrawAllTokenizeShareRecordReward(context.Context, *MsgWithdrawAllTokenizeShareRecordReward) (*MsgWithdrawAllTokenizeShareRecordRewardResponse, error) // FundCommunityPool defines a method to allow an account to directly // fund the community pool. FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) @@ -577,6 +858,12 @@ func (*UnimplementedMsgServer) WithdrawDelegatorReward(ctx context.Context, req func (*UnimplementedMsgServer) WithdrawValidatorCommission(ctx context.Context, req *MsgWithdrawValidatorCommission) (*MsgWithdrawValidatorCommissionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawValidatorCommission not implemented") } +func (*UnimplementedMsgServer) WithdrawTokenizeShareRecordReward(ctx context.Context, req *MsgWithdrawTokenizeShareRecordReward) (*MsgWithdrawTokenizeShareRecordRewardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawTokenizeShareRecordReward not implemented") +} +func (*UnimplementedMsgServer) WithdrawAllTokenizeShareRecordReward(ctx context.Context, req *MsgWithdrawAllTokenizeShareRecordReward) (*MsgWithdrawAllTokenizeShareRecordRewardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawAllTokenizeShareRecordReward not implemented") +} func (*UnimplementedMsgServer) FundCommunityPool(ctx context.Context, req *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FundCommunityPool not implemented") } @@ -639,6 +926,42 @@ func _Msg_WithdrawValidatorCommission_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _Msg_WithdrawTokenizeShareRecordReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawTokenizeShareRecordReward) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawTokenizeShareRecordReward(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.distribution.v1beta1.Msg/WithdrawTokenizeShareRecordReward", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawTokenizeShareRecordReward(ctx, req.(*MsgWithdrawTokenizeShareRecordReward)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_WithdrawAllTokenizeShareRecordReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawAllTokenizeShareRecordReward) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawAllTokenizeShareRecordReward(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.distribution.v1beta1.Msg/WithdrawAllTokenizeShareRecordReward", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawAllTokenizeShareRecordReward(ctx, req.(*MsgWithdrawAllTokenizeShareRecordReward)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_FundCommunityPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgFundCommunityPool) if err := dec(in); err != nil { @@ -673,13 +996,21 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "WithdrawValidatorCommission", Handler: _Msg_WithdrawValidatorCommission_Handler, }, + { + MethodName: "WithdrawTokenizeShareRecordReward", + Handler: _Msg_WithdrawTokenizeShareRecordReward_Handler, + }, + { + MethodName: "WithdrawAllTokenizeShareRecordReward", + Handler: _Msg_WithdrawAllTokenizeShareRecordReward_Handler, + }, { MethodName: "FundCommunityPool", Handler: _Msg_FundCommunityPool_Handler, }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/distribution/v1beta1/tx.proto", + Metadata: "distribution/v1beta1/tx.proto", } func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { @@ -799,6 +1130,20 @@ func (m *MsgWithdrawDelegatorRewardResponse) MarshalToSizedBuffer(dAtA []byte) ( _ = i var l int _ = l + 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 } @@ -852,10 +1197,24 @@ func (m *MsgWithdrawValidatorCommissionResponse) MarshalToSizedBuffer(dAtA []byt _ = i var l int _ = l + 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 *MsgFundCommunityPool) Marshal() (dAtA []byte, err error) { +func (m *MsgWithdrawTokenizeShareRecordReward) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -865,41 +1224,32 @@ func (m *MsgFundCommunityPool) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgFundCommunityPool) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgWithdrawTokenizeShareRecordReward) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgWithdrawTokenizeShareRecordReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + if m.RecordId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RecordId)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - 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 - } + 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] = 0xa } return len(dAtA) - i, nil } -func (m *MsgFundCommunityPoolResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -909,12 +1259,12 @@ func (m *MsgFundCommunityPoolResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgFundCommunityPoolResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgFundCommunityPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -922,16 +1272,136 @@ func (m *MsgFundCommunityPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, e 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++ +func (m *MsgWithdrawAllTokenizeShareRecordReward) 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 *MsgWithdrawAllTokenizeShareRecordReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) 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 *MsgWithdrawAllTokenizeShareRecordRewardResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgFundCommunityPool) 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 *MsgFundCommunityPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + 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 *MsgFundCommunityPoolResponse) 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 *MsgFundCommunityPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFundCommunityPoolResponse) 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 *MsgSetWithdrawAddress) Size() (n int) { if m == nil { @@ -982,6 +1452,12 @@ func (m *MsgWithdrawDelegatorRewardResponse) Size() (n int) { } var l int _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } return n } @@ -999,6 +1475,59 @@ func (m *MsgWithdrawValidatorCommission) Size() (n int) { } func (m *MsgWithdrawValidatorCommissionResponse) 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)) + } + } + return n +} + +func (m *MsgWithdrawTokenizeShareRecordReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.RecordId != 0 { + n += 1 + sovTx(uint64(m.RecordId)) + } + return n +} + +func (m *MsgWithdrawTokenizeShareRecordRewardResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdrawAllTokenizeShareRecordReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgWithdrawAllTokenizeShareRecordRewardResponse) Size() (n int) { if m == nil { return 0 } @@ -1348,6 +1877,40 @@ func (m *MsgWithdrawDelegatorRewardResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgWithdrawDelegatorRewardResponse: 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 default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1480,6 +2043,323 @@ func (m *MsgWithdrawValidatorCommissionResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgWithdrawValidatorCommissionResponse: 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 + 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 *MsgWithdrawTokenizeShareRecordReward) 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: MsgWithdrawTokenizeShareRecordReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawTokenizeShareRecordReward: 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) + } + 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 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", wireType) + } + m.RecordId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RecordId |= 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 (m *MsgWithdrawTokenizeShareRecordRewardResponse) 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: MsgWithdrawTokenizeShareRecordRewardResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawTokenizeShareRecordRewardResponse: 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 *MsgWithdrawAllTokenizeShareRecordReward) 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: MsgWithdrawAllTokenizeShareRecordReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawAllTokenizeShareRecordReward: 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) + } + 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 *MsgWithdrawAllTokenizeShareRecordRewardResponse) 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: MsgWithdrawAllTokenizeShareRecordRewardResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawAllTokenizeShareRecordRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index 6dce3c31539..8f8b3787549 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -56,7 +56,7 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o ), RunE: func(cmd *cobra.Command, args []string) error { serverCtx := server.GetServerContextFromCmd(cmd) - clientCtx, err := client.GetClientQueryContext(cmd) + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } @@ -120,8 +120,9 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o if err != nil { return errors.Wrap(err, "failed to parse coins") } + addr := key.GetAddress() - err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, key.GetAddress(), coins, cdc) + err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, addr, coins, cdc) if err != nil { return errors.Wrap(err, "failed to validate account in genesis") } @@ -130,8 +131,9 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o if err != nil { return errors.Wrap(err, "error creating tx builder") } + pub := key.GetAddress() - clientCtx = clientCtx.WithInput(inBuf).WithFromAddress(key.GetAddress()) + clientCtx = clientCtx.WithInput(inBuf).WithFromAddress(pub) // The following line comes from a discrepancy between the `gentx` // and `create-validator` commands: @@ -154,18 +156,14 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o if key.GetType() == keyring.TypeOffline || key.GetType() == keyring.TypeMulti { cmd.PrintErrln("Offline key passed in. Use `tx sign` command to sign.") - return authclient.PrintUnsignedStdTx(txBldr, clientCtx, []sdk.Msg{msg}) + return txBldr.PrintUnsignedTx(clientCtx, msg) } // write the unsigned transaction to the buffer w := bytes.NewBuffer([]byte{}) clientCtx = clientCtx.WithOutput(w) - if err = msg.ValidateBasic(); err != nil { - return err - } - - if err = authclient.PrintUnsignedStdTx(txBldr, clientCtx, []sdk.Msg{msg}); err != nil { + if err = txBldr.PrintUnsignedTx(clientCtx, msg); err != nil { return errors.Wrap(err, "failed to print unsigned std tx") } diff --git a/x/genutil/client/cli/init.go b/x/genutil/client/cli/init.go index 5d26085aa79..b12f6d7a01a 100644 --- a/x/genutil/client/cli/init.go +++ b/x/genutil/client/cli/init.go @@ -23,6 +23,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/genutil" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) const ( @@ -31,6 +32,9 @@ const ( // FlagSeed defines a flag to initialize the private validator key from a specific seed. FlagRecover = "recover" + + // FlagStakingBondDenom defines a flag to specify the staking token in the genesis file. + FlagStakingBondDenom = "staking-bond-denom" ) type printInfo struct { @@ -57,7 +61,7 @@ func displayInfo(info printInfo) error { return err } - _, err = fmt.Fprintf(os.Stderr, "%s\n", string(sdk.MustSortJSON(out))) + _, err = fmt.Fprintf(os.Stderr, "%s\n", sdk.MustSortJSON(out)) return err } @@ -79,14 +83,18 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { config.SetRoot(clientCtx.HomeDir) chainID, _ := cmd.Flags().GetString(flags.FlagChainID) - if chainID == "" { + switch { + case chainID != "": + case clientCtx.ChainID != "": + chainID = clientCtx.ChainID + default: chainID = fmt.Sprintf("test-chain-%v", tmrand.Str(6)) } // Get bip39 mnemonic var mnemonic string - recover, _ := cmd.Flags().GetBool(FlagRecover) - if recover { + myRecover, _ := cmd.Flags().GetBool(FlagRecover) + if myRecover { inBuf := bufio.NewReader(cmd.InOrStdin()) value, err := input.GetString("Enter your bip39 mnemonic", inBuf) if err != nil { @@ -108,14 +116,35 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { genFile := config.GenesisFile() overwrite, _ := cmd.Flags().GetBool(FlagOverwrite) + stakingBondDenom, _ := cmd.Flags().GetString(FlagStakingBondDenom) if !overwrite && tmos.FileExists(genFile) { return fmt.Errorf("genesis.json file already exists: %v", genFile) } - appState, err := json.MarshalIndent(mbm.DefaultGenesis(cdc), "", " ") + appGenState := mbm.DefaultGenesis(cdc) + + if stakingBondDenom != "" { + var stakingGenesis stakingtypes.GenesisState + + stakingRaw := appGenState[stakingtypes.ModuleName] + err := clientCtx.Codec.UnmarshalJSON(stakingRaw, &stakingGenesis) + if err != nil { + return err + } + + stakingGenesis.Params.BondDenom = stakingBondDenom + modifiedStakingStr, err := clientCtx.Codec.MarshalJSON(&stakingGenesis) + if err != nil { + return err + } + + appGenState[stakingtypes.ModuleName] = modifiedStakingStr + } + + appState, err := json.MarshalIndent(appGenState, "", " ") if err != nil { - return errors.Wrap(err, "Failed to marshall default genesis state") + return errors.Wrap(err, "Failed to marshal default genesis state") } genDoc := &types.GenesisDoc{} @@ -135,7 +164,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { genDoc.AppState = appState if err = genutil.ExportGenesisFile(genDoc, genFile); err != nil { - return errors.Wrap(err, "Failed to export gensis file") + return errors.Wrap(err, "Failed to export genesis file") } toPrint := newPrintInfo(config.Moniker, chainID, nodeID, "", appState) @@ -149,6 +178,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { cmd.Flags().BoolP(FlagOverwrite, "o", false, "overwrite the genesis.json file") cmd.Flags().Bool(FlagRecover, false, "provide seed phrase to recover existing key instead of creating") cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") + cmd.Flags().String(FlagStakingBondDenom, "", "genesis file staking bond denomination, if left blank default value is 'stake'") return cmd } diff --git a/x/genutil/client/cli/init_test.go b/x/genutil/client/cli/init_test.go index cd11491414a..f113c5f1ad3 100644 --- a/x/genutil/client/cli/init_test.go +++ b/x/genutil/client/cli/init_test.go @@ -27,9 +27,13 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" + "github.com/cosmos/cosmos-sdk/x/staking" ) -var testMbm = module.NewBasicManager(genutil.AppModuleBasic{}) +var testMbm = module.NewBasicManager( + staking.AppModuleBasic{}, + genutil.AppModuleBasic{}, +) func TestInitCmd(t *testing.T) { tests := []struct { @@ -116,6 +120,34 @@ func TestInitRecover(t *testing.T) { require.NoError(t, cmd.ExecuteContext(ctx)) } +func TestInitStakingBondDenom(t *testing.T) { + home := t.TempDir() + logger := log.NewNopLogger() + cfg, err := genutiltest.CreateDefaultTendermintConfig(home) + require.NoError(t, err) + + serverCtx := server.NewContext(viper.New(), cfg, logger) + interfaceRegistry := types.NewInterfaceRegistry() + marshaler := codec.NewProtoCodec(interfaceRegistry) + clientCtx := client.Context{}. + WithCodec(marshaler). + WithLegacyAmino(makeCodec()). + WithHomeDir(home) + + ctx := context.Background() + ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx) + ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx) + + cmd := genutilcli.InitCmd(testMbm, home) + + cmd.SetArgs([]string{ + "appnode-test", + fmt.Sprintf("--%s=%s", cli.HomeFlag, home), + fmt.Sprintf("--%s=testtoken", genutilcli.FlagStakingBondDenom), + }) + require.NoError(t, cmd.ExecuteContext(ctx)) +} + func TestEmptyState(t *testing.T) { home := t.TempDir() logger := log.NewNopLogger() @@ -150,7 +182,8 @@ func TestEmptyState(t *testing.T) { outC := make(chan string) go func() { var buf bytes.Buffer - io.Copy(&buf, r) + _, err := io.Copy(&buf, r) + require.NoError(t, err) outC <- buf.String() }() @@ -197,13 +230,61 @@ func TestStartStandAlone(t *testing.T) { func TestInitNodeValidatorFiles(t *testing.T) { home := t.TempDir() cfg, err := genutiltest.CreateDefaultTendermintConfig(home) + require.NoError(t, err) + nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(cfg) + require.NoError(t, err) - require.Nil(t, err) require.NotEqual(t, "", nodeID) require.NotEqual(t, 0, len(valPubKey.Bytes())) } +func TestInitConfig(t *testing.T) { + home := t.TempDir() + logger := log.NewNopLogger() + cfg, err := genutiltest.CreateDefaultTendermintConfig(home) + require.NoError(t, err) + + serverCtx := server.NewContext(viper.New(), cfg, logger) + interfaceRegistry := types.NewInterfaceRegistry() + marshaler := codec.NewProtoCodec(interfaceRegistry) + clientCtx := client.Context{}. + WithCodec(marshaler). + WithLegacyAmino(makeCodec()). + WithChainID("foo"). // add chain-id to clientCtx + WithHomeDir(home) + + ctx := context.Background() + ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx) + ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx) + + cmd := genutilcli.InitCmd(testMbm, home) + cmd.SetArgs([]string{"testnode"}) + + require.NoError(t, cmd.ExecuteContext(ctx)) + + old := os.Stdout + r, w, _ := os.Pipe() + os.Stdout = w + + cmd = server.ExportCmd(nil, home) + require.NoError(t, cmd.ExecuteContext(ctx)) + + outC := make(chan string) + go func() { + var buf bytes.Buffer + _, err := io.Copy(&buf, r) + require.NoError(t, err) + outC <- buf.String() + }() + + w.Close() + os.Stdout = old + out := <-outC + + require.Contains(t, out, "\"chain_id\": \"foo\"") +} + // custom tx codec func makeCodec() *codec.LegacyAmino { cdc := codec.NewLegacyAmino() diff --git a/x/genutil/client/cli/migrate.go b/x/genutil/client/cli/migrate.go index 37e42ac4f70..7f1e458cd3a 100644 --- a/x/genutil/client/cli/migrate.go +++ b/x/genutil/client/cli/migrate.go @@ -1,139 +1 @@ package cli - -import ( - "encoding/json" - "fmt" - "sort" - "time" - - "github.com/pkg/errors" - "github.com/spf13/cobra" - tmjson "github.com/tendermint/tendermint/libs/json" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - v040 "github.com/cosmos/cosmos-sdk/x/genutil/legacy/v040" - v043 "github.com/cosmos/cosmos-sdk/x/genutil/legacy/v043" - "github.com/cosmos/cosmos-sdk/x/genutil/types" -) - -const flagGenesisTime = "genesis-time" - -// Allow applications to extend and modify the migration process. -// -// Ref: https://github.com/cosmos/cosmos-sdk/issues/5041 -var migrationMap = types.MigrationMap{ - "v0.42": v040.Migrate, // NOTE: v0.40, v0.41 and v0.42 are genesis compatible. - "v0.43": v043.Migrate, -} - -// GetMigrationCallback returns a MigrationCallback for a given version. -func GetMigrationCallback(version string) types.MigrationCallback { - return migrationMap[version] -} - -// GetMigrationVersions get all migration version in a sorted slice. -func GetMigrationVersions() []string { - versions := make([]string, len(migrationMap)) - - var i int - - for version := range migrationMap { - versions[i] = version - i++ - } - - sort.Strings(versions) - - return versions -} - -// MigrateGenesisCmd returns a command to execute genesis state migration. -func MigrateGenesisCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "migrate [target-version] [genesis-file]", - Short: "Migrate genesis to a specified target version", - Long: fmt.Sprintf(`Migrate the source genesis into the target version and print to STDOUT. - -Example: -$ %s migrate v0.36 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2019-04-22T17:00:00Z -`, version.AppName), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - var err error - - target := args[0] - importGenesis := args[1] - - genDoc, err := validateGenDoc(importGenesis) - if err != nil { - return err - } - - // Since some default values are valid values, we just print to - // make sure the user didn't forget to update these values. - if genDoc.ConsensusParams.Evidence.MaxBytes == 0 { - fmt.Printf("Warning: consensus_params.evidence.max_bytes is set to 0. If this is"+ - " deliberate, feel free to ignore this warning. If not, please have a look at the chain"+ - " upgrade guide at %s.\n", chainUpgradeGuide) - } - - var initialState types.AppMap - if err := json.Unmarshal(genDoc.AppState, &initialState); err != nil { - return errors.Wrap(err, "failed to JSON unmarshal initial genesis state") - } - - migrationFunc := GetMigrationCallback(target) - if migrationFunc == nil { - return fmt.Errorf("unknown migration function for version: %s", target) - } - - // TODO: handler error from migrationFunc call - newGenState := migrationFunc(initialState, clientCtx) - - genDoc.AppState, err = json.Marshal(newGenState) - if err != nil { - return errors.Wrap(err, "failed to JSON marshal migrated genesis state") - } - - genesisTime, _ := cmd.Flags().GetString(flagGenesisTime) - if genesisTime != "" { - var t time.Time - - err := t.UnmarshalText([]byte(genesisTime)) - if err != nil { - return errors.Wrap(err, "failed to unmarshal genesis time") - } - - genDoc.GenesisTime = t - } - - chainID, _ := cmd.Flags().GetString(flags.FlagChainID) - if chainID != "" { - genDoc.ChainID = chainID - } - - bz, err := tmjson.Marshal(genDoc) - if err != nil { - return errors.Wrap(err, "failed to marshal genesis doc") - } - - sortedBz, err := sdk.SortJSON(bz) - if err != nil { - return errors.Wrap(err, "failed to sort JSON genesis doc") - } - - cmd.Println(string(sortedBz)) - return nil - }, - } - - cmd.Flags().String(flagGenesisTime, "", "override genesis_time with this flag") - cmd.Flags().String(flags.FlagChainID, "", "override chain_id with this flag") - - return cmd -} diff --git a/x/genutil/client/rest/query.go b/x/genutil/client/rest/query.go deleted file mode 100644 index 5d3812ca31a..00000000000 --- a/x/genutil/client/rest/query.go +++ /dev/null @@ -1,49 +0,0 @@ -package rest - -import ( - "context" - "fmt" - "net/http" - - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/genutil/types" -) - -// QueryGenesisTxs writes the genesis transactions to the response if no error -// occurs. -func QueryGenesisTxs(clientCtx client.Context, w http.ResponseWriter) { - resultGenesis, err := clientCtx.Client.Genesis(context.Background()) - if err != nil { - rest.WriteErrorResponse( - w, http.StatusInternalServerError, - fmt.Sprintf("failed to retrieve genesis from client: %s", err), - ) - return - } - - appState, err := types.GenesisStateFromGenDoc(*resultGenesis.Genesis) - if err != nil { - rest.WriteErrorResponse( - w, http.StatusInternalServerError, - fmt.Sprintf("failed to decode genesis doc: %s", err), - ) - return - } - - genState := types.GetGenesisStateFromAppState(clientCtx.Codec, appState) - genTxs := make([]sdk.Tx, len(genState.GenTxs)) - for i, tx := range genState.GenTxs { - err := clientCtx.LegacyAmino.UnmarshalJSON(tx, &genTxs[i]) - if err != nil { - rest.WriteErrorResponse( - w, http.StatusInternalServerError, - fmt.Sprintf("failed to decode genesis transaction: %s", err), - ) - return - } - } - - rest.PostProcessResponseBare(w, clientCtx, genTxs) -} diff --git a/x/genutil/client/testutil/migrate.go b/x/genutil/client/testutil/migrate.go index e5dd0f2d13b..110b2e6a797 100644 --- a/x/genutil/client/testutil/migrate.go +++ b/x/genutil/client/testutil/migrate.go @@ -1,61 +1 @@ package testutil - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" -) - -func TestGetMigrationCallback(t *testing.T) { - for _, version := range cli.GetMigrationVersions() { - require.NotNil(t, cli.GetMigrationCallback(version)) - } -} - -func (s *IntegrationTestSuite) TestMigrateGenesis() { - val0 := s.network.Validators[0] - - testCases := []struct { - name string - genesis string - target string - expErr bool - expErrMsg string - check func(jsonOut string) - }{ - { - "migrate 0.37 to 0.42", - v037Exported, - "v0.42", - true, "Make sure that you have correctly migrated all Tendermint consensus params", func(_ string) {}, - }, - { - "migrate 0.42 to 0.43", - v040Valid, - "v0.43", - false, "", - func(jsonOut string) { - // Make sure the json output contains the ADR-037 gov weighted votes. - s.Require().Contains(jsonOut, "\"weight\":\"1.000000000000000000\"") - }, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - genesisFile := testutil.WriteToNewTempFile(s.T(), tc.genesis) - jsonOutput, err := clitestutil.ExecTestCLICmd(val0.ClientCtx, cli.MigrateGenesisCmd(), []string{tc.target, genesisFile.Name()}) - if tc.expErr { - s.Require().Contains(err.Error(), tc.expErrMsg) - } else { - s.Require().NoError(err) - tc.check(jsonOutput.String()) - } - }) - } -} diff --git a/x/genutil/client/testutil/suite.go b/x/genutil/client/testutil/suite.go index 5ef4d7ca2c5..83620274309 100644 --- a/x/genutil/client/testutil/suite.go +++ b/x/genutil/client/testutil/suite.go @@ -1,6 +1,7 @@ package testutil import ( + "context" "fmt" "io" "os" @@ -8,9 +9,10 @@ import ( "github.com/stretchr/testify/suite" + simapp "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/simapp" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -33,9 +35,10 @@ func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") + var err error s.network = network.New(s.T(), s.cfg) - _, err := s.network.WaitForHeight(1) + _, err = s.network.WaitForHeight(1) s.Require().NoError(err) } @@ -46,97 +49,84 @@ func (s *IntegrationTestSuite) TearDownSuite() { func (s *IntegrationTestSuite) TestGenTxCmd() { val := s.network.Validators[0] - clientCtx := val.ClientCtx + dir := s.T().TempDir() + + cmd := cli.GenTxCmd( + simapp.ModuleBasics, + val.ClientCtx.TxConfig, banktypes.GenesisBalancesIterator{}, val.ClientCtx.HomeDir) + + _, out := testutil.ApplyMockIO(cmd) + clientCtx := val.ClientCtx.WithOutput(out) + + ctx := context.Background() + ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx) + amount := sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(12)) + genTxFile := filepath.Join(dir, "myTx") + cmd.SetArgs([]string{ + fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), + fmt.Sprintf("--%s=%s", flags.FlagOutputDocument, genTxFile), + val.Moniker, + amount.String(), + }) + + err := cmd.ExecuteContext(ctx) + s.Require().NoError(err) + + // validate generated transaction. + open, err := os.Open(genTxFile) + s.Require().NoError(err) + + all, err := io.ReadAll(open) + s.Require().NoError(err) + + tx, err := val.ClientCtx.TxConfig.TxJSONDecoder()(all) + s.Require().NoError(err) + + msgs := tx.GetMsgs() + s.Require().Len(msgs, 1) + + s.Require().Equal(sdk.MsgTypeURL(&types.MsgCreateValidator{}), sdk.MsgTypeURL(msgs[0])) + s.Require().True(val.Address.Equals(msgs[0].GetSigners()[0])) + s.Require().Equal(amount, msgs[0].(*types.MsgCreateValidator).Value) + s.Require().NoError(tx.ValidateBasic()) +} + +func (s *IntegrationTestSuite) TestGenTxCmdPubkey() { + val := s.network.Validators[0] + dir := s.T().TempDir() + + cmd := cli.GenTxCmd( + simapp.ModuleBasics, + val.ClientCtx.TxConfig, + banktypes.GenesisBalancesIterator{}, + val.ClientCtx.HomeDir, + ) + + _, out := testutil.ApplyMockIO(cmd) + clientCtx := val.ClientCtx.WithOutput(out) - tests := []struct { - name string - args []string - expError bool - }{ - { - name: "invalid commission rate returns error", - args: []string{ - fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), - fmt.Sprintf("--%s=1", stakingcli.FlagCommissionRate), - val.Moniker, - amount.String(), - }, - expError: true, - }, - { - name: "valid gentx", - args: []string{ - fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), - val.Moniker, - amount.String(), - }, - expError: false, - }, - { - name: "invalid pubkey", - args: []string{ - fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), - fmt.Sprintf("--%s={\"key\":\"BOIkjkFruMpfOFC9oNPhiJGfmY2pHF/gwHdLDLnrnS0=\"}", stakingcli.FlagPubKey), - val.Moniker, - amount.String(), - }, - expError: true, - }, - { - name: "valid pubkey flag", - args: []string{ - fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), - fmt.Sprintf("--%s={\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"BOIkjkFruMpfOFC9oNPhiJGfmY2pHF/gwHdLDLnrnS0=\"}", stakingcli.FlagPubKey), - val.Moniker, - amount.String(), - }, - expError: false, - }, - } - - for _, tc := range tests { - tc := tc - - dir := s.T().TempDir() - genTxFile := filepath.Join(dir, "myTx") - tc.args = append(tc.args, fmt.Sprintf("--%s=%s", flags.FlagOutputDocument, genTxFile)) - - s.Run(tc.name, func() { - cmd := cli.GenTxCmd( - simapp.ModuleBasics, - val.ClientCtx.TxConfig, - banktypes.GenesisBalancesIterator{}, - val.ClientCtx.HomeDir) - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - - if tc.expError { - s.Require().Error(err) - - _, err = os.Open(genTxFile) - s.Require().Error(err) - } else { - s.Require().NoError(err, "test: %s\noutput: %s", tc.name, out.String()) - - // validate generated transaction. - open, err := os.Open(genTxFile) - s.Require().NoError(err) - - all, err := io.ReadAll(open) - s.Require().NoError(err) - - tx, err := val.ClientCtx.TxConfig.TxJSONDecoder()(all) - s.Require().NoError(err) - - msgs := tx.GetMsgs() - s.Require().Len(msgs, 1) - - s.Require().Equal(sdk.MsgTypeURL(&types.MsgCreateValidator{}), sdk.MsgTypeURL(msgs[0])) - s.Require().True(val.Address.Equals(msgs[0].GetSigners()[0])) - s.Require().Equal(amount, msgs[0].(*types.MsgCreateValidator).Value) - s.Require().NoError(tx.ValidateBasic()) - } - }) - } + ctx := context.Background() + ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx) + + amount := sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(12)) + genTxFile := filepath.Join(dir, "myTx") + + cmd.SetArgs([]string{ + fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), + fmt.Sprintf("--%s=%s", flags.FlagOutputDocument, genTxFile), + fmt.Sprintf("--%s={\"key\":\"BOIkjkFruMpfOFC9oNPhiJGfmY2pHF/gwHdLDLnrnS0=\"}", stakingcli.FlagPubKey), + val.Moniker, + amount.String(), + }) + s.Require().Error(cmd.ExecuteContext(ctx)) + + cmd.SetArgs([]string{ + fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), + fmt.Sprintf("--%s=%s", flags.FlagOutputDocument, genTxFile), + fmt.Sprintf("--%s={\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"BOIkjkFruMpfOFC9oNPhiJGfmY2pHF/gwHdLDLnrnS0=\"}", stakingcli.FlagPubKey), + val.Moniker, + amount.String(), + }) + s.Require().NoError(cmd.ExecuteContext(ctx)) } diff --git a/x/genutil/client/testutil/validate_genesis.go b/x/genutil/client/testutil/validate_genesis.go deleted file mode 100644 index c537dbf9dcf..00000000000 --- a/x/genutil/client/testutil/validate_genesis.go +++ /dev/null @@ -1,101 +0,0 @@ -package testutil - -import ( - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" -) - -// An example exported genesis file from a 0.37 chain. Note that evidence -// parameters only contains `max_age`. -var v037Exported = `{ - "app_hash": "", - "app_state": {}, - "chain_id": "test", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "-1", - "time_iota_ms": "1000" - }, - "evidence": { "max_age": "100000" }, - "validator": { "pub_key_types": ["ed25519"] } - }, - "genesis_time": "2020-09-29T20:16:29.172362037Z", - "validators": [] -}` - -// An example exported genesis file that's 0.40 compatible. -// We added the following app_state: -// -// - x/gov: added votes to test ADR-037 split votes migration. -var v040Valid = `{ - "app_hash": "", - "app_state": { - "gov": { - "starting_proposal_id": "0", - "deposits": [], - "votes": [ - { - "proposal_id": "5", - "voter": "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", - "option": "VOTE_OPTION_YES" - } - ], - "proposals": [], - "deposit_params": { "min_deposit": [], "max_deposit_period": "0s" }, - "voting_params": { "voting_period": "0s" }, - "tally_params": { "quorum": "0", "threshold": "0", "veto_threshold": "0" } - } - }, - "chain_id": "test", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "-1", - "time_iota_ms": "1000" - }, - "evidence": { - "max_age_num_blocks": "100000", - "max_age_duration": "172800000000000", - "max_bytes": "0" - }, - "validator": { "pub_key_types": ["ed25519"] } - }, - "genesis_time": "2020-09-29T20:16:29.172362037Z", - "validators": [] -}` - -func (s *IntegrationTestSuite) TestValidateGenesis() { - val0 := s.network.Validators[0] - - testCases := []struct { - name string - genesis string - expErr bool - }{ - { - "exported 0.37 genesis file", - v037Exported, - true, - }, - { - "valid 0.40 genesis file", - v040Valid, - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - genesisFile := testutil.WriteToNewTempFile(s.T(), tc.genesis) - _, err := clitestutil.ExecTestCLICmd(val0.ClientCtx, cli.ValidateGenesisCmd(nil), []string{genesisFile.Name()}) - if tc.expErr { - s.Require().Contains(err.Error(), "Make sure that you have correctly migrated all Tendermint consensus params") - } else { - s.Require().NoError(err) - } - }) - } -} diff --git a/x/genutil/collect.go b/x/genutil/collect.go index 0018f0c0d9c..5ee2685159b 100644 --- a/x/genutil/collect.go +++ b/x/genutil/collect.go @@ -77,7 +77,8 @@ func CollectTxs(cdc codec.JSONCodec, txJSONDecoder sdk.TxDecoder, moniker, genTx return appGenTxs, persistentPeers, err } - fos, err := os.ReadDir(genTxsDir) + var fos []os.DirEntry + fos, err = os.ReadDir(genTxsDir) if err != nil { return appGenTxs, persistentPeers, err } @@ -109,8 +110,8 @@ func CollectTxs(cdc codec.JSONCodec, txJSONDecoder sdk.TxDecoder, moniker, genTx return appGenTxs, persistentPeers, err } - var genTx sdk.Tx - if genTx, err = txJSONDecoder(jsonRawTx); err != nil { + genTx, err := types.ValidateAndGetGenTx(jsonRawTx, txJSONDecoder) + if err != nil { return appGenTxs, persistentPeers, err } diff --git a/x/genutil/gentx.go b/x/genutil/gentx.go index d7b0ec2799d..f7e4250def1 100644 --- a/x/genutil/gentx.go +++ b/x/genutil/gentx.go @@ -97,17 +97,17 @@ func DeliverGenTxs( for _, genTx := range genTxs { tx, err := txEncodingConfig.TxJSONDecoder()(genTx) if err != nil { - panic(err) + return nil, fmt.Errorf("failed to decode GenTx '%s': %s", genTx, err) } bz, err := txEncodingConfig.TxEncoder()(tx) if err != nil { - panic(err) + return nil, fmt.Errorf("failed to encode GenTx '%s': %s", genTx, err) } res := deliverTx(abci.RequestDeliverTx{Tx: bz}) if !res.IsOK() { - panic(res.Log) + return nil, fmt.Errorf("failed to execute DelverTx for '%s': %s", genTx, res.Log) } } diff --git a/x/genutil/gentx_test.go b/x/genutil/gentx_test.go index 1fc964afc36..f8f6ae47009 100644 --- a/x/genutil/gentx_test.go +++ b/x/genutil/gentx_test.go @@ -10,15 +10,15 @@ import ( "github.com/stretchr/testify/suite" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + simapp "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/simapp/helpers" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -46,19 +46,18 @@ type GenTxTestSuite struct { func (suite *GenTxTestSuite) SetupTest() { checkTx := false - app := simapp.Setup(checkTx) + app := simapp.SetupWithValSet(suite.T(), checkTx) suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{}) suite.app = app suite.encodingConfig = simapp.MakeTestEncodingConfig() var err error amount := sdk.NewInt64Coin(sdk.DefaultBondDenom, 50) - one := sdk.OneInt() suite.msg1, err = stakingtypes.NewMsgCreateValidator( - sdk.ValAddress(pk1.Address()), pk1, amount, desc, comm, one) + sdk.ValAddress(pk1.Address()), pk1, amount, desc, comm) suite.NoError(err) suite.msg2, err = stakingtypes.NewMsgCreateValidator( - sdk.ValAddress(pk2.Address()), pk1, amount, desc, comm, one) + sdk.ValAddress(pk2.Address()), pk1, amount, desc, comm) suite.NoError(err) } @@ -66,7 +65,7 @@ func (suite *GenTxTestSuite) setAccountBalance(addr sdk.AccAddress, amount int64 acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) - err := simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, amount)}) + err := simapp_test.FundAccount(suite.app.BankKeeper, suite.ctx, addr, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, amount)}) suite.Require().NoError(err) bankGenesisState := suite.app.BankKeeper.ExportGenesis(suite.ctx) @@ -182,7 +181,7 @@ func (suite *GenTxTestSuite) TestValidateAccountInGenesis() { cdc := suite.encodingConfig.Marshaler suite.app.StakingKeeper.SetParams(suite.ctx, stakingtypes.DefaultParams()) - stakingGenesisState := staking.ExportGenesis(suite.ctx, suite.app.StakingKeeper) + stakingGenesisState := suite.app.StakingKeeper.ExportGenesis(suite.ctx) suite.Require().Equal(stakingGenesisState.Params, stakingtypes.DefaultParams()) stakingGenesis, err := cdc.MarshalJSON(stakingGenesisState) // TODO switch this to use Marshaler suite.Require().NoError(err) @@ -233,15 +232,16 @@ func (suite *GenTxTestSuite) TestDeliverGenTxs() { _ = suite.setAccountBalance(addr1, 50) _ = suite.setAccountBalance(addr2, 1) + r := rand.New(rand.NewSource(time.Now().UnixNano())) msg := banktypes.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 1)}) tx, err := helpers.GenSignedMockTx( - rand.New(rand.NewSource(time.Now().UnixNano())), + r, suite.encodingConfig.TxConfig, []sdk.Msg{msg}, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10)}, helpers.DefaultGenTxGas, suite.ctx.ChainID(), - []uint64{0}, + []uint64{7}, []uint64{0}, priv1, ) @@ -264,18 +264,19 @@ func (suite *GenTxTestSuite) TestDeliverGenTxs() { if tc.expPass { suite.Require().NotPanics(func() { - genutil.DeliverGenTxs( + _, err := genutil.DeliverGenTxs( suite.ctx, genTxs, suite.app.StakingKeeper, suite.app.BaseApp.DeliverTx, suite.encodingConfig.TxConfig, ) + suite.Require().NoError(err) }) } else { - suite.Require().Panics(func() { - genutil.DeliverGenTxs( - suite.ctx, genTxs, suite.app.StakingKeeper, suite.app.BaseApp.DeliverTx, - suite.encodingConfig.TxConfig, - ) - }) + _, err := genutil.DeliverGenTxs( + suite.ctx, genTxs, suite.app.StakingKeeper, suite.app.BaseApp.DeliverTx, + suite.encodingConfig.TxConfig, + ) + + suite.Require().Error(err) } }) } diff --git a/x/genutil/legacy/v039/types.go b/x/genutil/legacy/v039/types.go deleted file mode 100644 index 12d082d1bc8..00000000000 --- a/x/genutil/legacy/v039/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package v039 - -import "encoding/json" - -const ( - ModuleName = "genutil" -) - -// GenesisState defines the raw genesis transaction in JSON -type GenesisState struct { - GenTxs []json.RawMessage `json:"gentxs" yaml:"gentxs"` -} diff --git a/x/genutil/legacy/v040/migrate.go b/x/genutil/legacy/v040/migrate.go deleted file mode 100644 index a022d9fcf98..00000000000 --- a/x/genutil/legacy/v040/migrate.go +++ /dev/null @@ -1,200 +0,0 @@ -package v040 - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - v039auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v039" - v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" - v036supply "github.com/cosmos/cosmos-sdk/x/bank/legacy/v036" - v038bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v038" - v040bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v040" - v039crisis "github.com/cosmos/cosmos-sdk/x/crisis/legacy/v039" - v040crisis "github.com/cosmos/cosmos-sdk/x/crisis/legacy/v040" - v036distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v036" - v038distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v038" - v040distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v040" - v038evidence "github.com/cosmos/cosmos-sdk/x/evidence/legacy/v038" - v040evidence "github.com/cosmos/cosmos-sdk/x/evidence/legacy/v040" - v039genutil "github.com/cosmos/cosmos-sdk/x/genutil/legacy/v039" - "github.com/cosmos/cosmos-sdk/x/genutil/types" - v036gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v036" - v040gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v040" - v039mint "github.com/cosmos/cosmos-sdk/x/mint/legacy/v039" - v040mint "github.com/cosmos/cosmos-sdk/x/mint/legacy/v040" - v036params "github.com/cosmos/cosmos-sdk/x/params/legacy/v036" - v039slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v039" - v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v040" - v038staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v038" - v040staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v040" - v038upgrade "github.com/cosmos/cosmos-sdk/x/upgrade/legacy/v038" -) - -func migrateGenutil(oldGenState v039genutil.GenesisState) *types.GenesisState { - return &types.GenesisState{ - GenTxs: oldGenState.GenTxs, - } -} - -// Migrate migrates exported state from v0.39 to a v0.40 genesis state. -func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap { - v039Codec := codec.NewLegacyAmino() - v039auth.RegisterLegacyAminoCodec(v039Codec) - v036gov.RegisterLegacyAminoCodec(v039Codec) - v036distr.RegisterLegacyAminoCodec(v039Codec) - v036params.RegisterLegacyAminoCodec(v039Codec) - v038upgrade.RegisterLegacyAminoCodec(v039Codec) - - v040Codec := clientCtx.Codec - - if appState[v038bank.ModuleName] != nil { - // unmarshal relative source genesis application state - var bankGenState v038bank.GenesisState - v039Codec.MustUnmarshalJSON(appState[v038bank.ModuleName], &bankGenState) - - // unmarshal x/auth genesis state to retrieve all account balances - var authGenState v039auth.GenesisState - v039Codec.MustUnmarshalJSON(appState[v039auth.ModuleName], &authGenState) - - // unmarshal x/supply genesis state to retrieve total supply - var supplyGenState v036supply.GenesisState - v039Codec.MustUnmarshalJSON(appState[v036supply.ModuleName], &supplyGenState) - - // delete deprecated x/bank genesis state - delete(appState, v038bank.ModuleName) - - // delete deprecated x/supply genesis state - delete(appState, v036supply.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040bank.ModuleName] = v040Codec.MustMarshalJSON(v040bank.Migrate(bankGenState, authGenState, supplyGenState)) - } - - // remove balances from existing accounts - if appState[v039auth.ModuleName] != nil { - // unmarshal relative source genesis application state - var authGenState v039auth.GenesisState - v039Codec.MustUnmarshalJSON(appState[v039auth.ModuleName], &authGenState) - - // delete deprecated x/auth genesis state - delete(appState, v039auth.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040auth.ModuleName] = v040Codec.MustMarshalJSON(v040auth.Migrate(authGenState)) - } - - // Migrate x/crisis. - if appState[v039crisis.ModuleName] != nil { - // unmarshal relative source genesis application state - var crisisGenState v039crisis.GenesisState - v039Codec.MustUnmarshalJSON(appState[v039crisis.ModuleName], &crisisGenState) - - // delete deprecated x/crisis genesis state - delete(appState, v039crisis.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040crisis.ModuleName] = v040Codec.MustMarshalJSON(v040crisis.Migrate(crisisGenState)) - } - - // Migrate x/distribution. - if appState[v038distr.ModuleName] != nil { - // unmarshal relative source genesis application state - var distributionGenState v038distr.GenesisState - v039Codec.MustUnmarshalJSON(appState[v038distr.ModuleName], &distributionGenState) - - // delete deprecated x/distribution genesis state - delete(appState, v038distr.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040distr.ModuleName] = v040Codec.MustMarshalJSON(v040distr.Migrate(distributionGenState)) - } - - // Migrate x/evidence. - if appState[v038evidence.ModuleName] != nil { - // unmarshal relative source genesis application state - var evidenceGenState v038evidence.GenesisState - v039Codec.MustUnmarshalJSON(appState[v038bank.ModuleName], &evidenceGenState) - - // delete deprecated x/evidence genesis state - delete(appState, v038evidence.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040evidence.ModuleName] = v040Codec.MustMarshalJSON(v040evidence.Migrate(evidenceGenState)) - } - - // Migrate x/gov. - if appState[v036gov.ModuleName] != nil { - // unmarshal relative source genesis application state - var govGenState v036gov.GenesisState - v039Codec.MustUnmarshalJSON(appState[v036gov.ModuleName], &govGenState) - - // delete deprecated x/gov genesis state - delete(appState, v036gov.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040gov.ModuleName] = v040Codec.MustMarshalJSON(v040gov.Migrate(govGenState)) - } - - // Migrate x/mint. - if appState[v039mint.ModuleName] != nil { - // unmarshal relative source genesis application state - var mintGenState v039mint.GenesisState - v039Codec.MustUnmarshalJSON(appState[v039mint.ModuleName], &mintGenState) - - // delete deprecated x/mint genesis state - delete(appState, v039mint.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040mint.ModuleName] = v040Codec.MustMarshalJSON(v040mint.Migrate(mintGenState)) - } - - // Migrate x/slashing. - if appState[v039slashing.ModuleName] != nil { - // unmarshal relative source genesis application state - var slashingGenState v039slashing.GenesisState - v039Codec.MustUnmarshalJSON(appState[v039slashing.ModuleName], &slashingGenState) - - // delete deprecated x/slashing genesis state - delete(appState, v039slashing.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040slashing.ModuleName] = v040Codec.MustMarshalJSON(v040slashing.Migrate(slashingGenState)) - } - - // Migrate x/staking. - if appState[v038staking.ModuleName] != nil { - // unmarshal relative source genesis application state - var stakingGenState v038staking.GenesisState - v039Codec.MustUnmarshalJSON(appState[v038staking.ModuleName], &stakingGenState) - - // delete deprecated x/staking genesis state - delete(appState, v038staking.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v040staking.ModuleName] = v040Codec.MustMarshalJSON(v040staking.Migrate(stakingGenState)) - } - - // Migrate x/genutil - if appState[v039genutil.ModuleName] != nil { - // unmarshal relative source genesis application state - var genutilGenState v039genutil.GenesisState - v039Codec.MustUnmarshalJSON(appState[v039genutil.ModuleName], &genutilGenState) - - // delete deprecated x/staking genesis state - delete(appState, v039genutil.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[ModuleName] = v040Codec.MustMarshalJSON(migrateGenutil(genutilGenState)) - } - - return appState -} diff --git a/x/genutil/legacy/v040/types.go b/x/genutil/legacy/v040/types.go deleted file mode 100644 index f641dbff51e..00000000000 --- a/x/genutil/legacy/v040/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package v040 - -const ( - ModuleName = "genutil" -) diff --git a/x/genutil/legacy/v043/migrate.go b/x/genutil/legacy/v043/migrate.go deleted file mode 100644 index 3314c987e41..00000000000 --- a/x/genutil/legacy/v043/migrate.go +++ /dev/null @@ -1,44 +0,0 @@ -package v043 - -import ( - "github.com/cosmos/cosmos-sdk/client" - v040bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v040" - v043bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v043" - bank "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil/types" - v040gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v040" - v043gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v043" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -// Migrate migrates exported state from v0.40 to a v0.43 genesis state. -func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap { - // Migrate x/gov. - if appState[v040gov.ModuleName] != nil { - // unmarshal relative source genesis application state - var oldGovState gov.GenesisState - clientCtx.Codec.MustUnmarshalJSON(appState[v040gov.ModuleName], &oldGovState) - - // delete deprecated x/gov genesis state - delete(appState, v040gov.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v043gov.ModuleName] = clientCtx.Codec.MustMarshalJSON(v043gov.MigrateJSON(&oldGovState)) - } - - if appState[v040bank.ModuleName] != nil { - // unmarshal relative source genesis application state - var oldBankState bank.GenesisState - clientCtx.Codec.MustUnmarshalJSON(appState[v040bank.ModuleName], &oldBankState) - - // delete deprecated x/bank genesis state - delete(appState, v040bank.ModuleName) - - // Migrate relative source genesis application state and marshal it into - // the respective key. - appState[v043bank.ModuleName] = clientCtx.Codec.MustMarshalJSON(v043bank.MigrateJSON(&oldBankState)) - } - - return appState -} diff --git a/x/genutil/migrations/v046/migrate.go b/x/genutil/migrations/v046/migrate.go new file mode 100644 index 00000000000..c7bd4f0e1fa --- /dev/null +++ b/x/genutil/migrations/v046/migrate.go @@ -0,0 +1 @@ +package v046 diff --git a/x/genutil/module.go b/x/genutil/module.go index b7bbbdb8496..9360805f656 100644 --- a/x/genutil/module.go +++ b/x/genutil/module.go @@ -32,7 +32,7 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec registers the genutil module's types on the given LegacyAmino codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {} @@ -54,6 +54,7 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, txEncodingConfig cl } // RegisterRESTRoutes registers the REST routes for the genutil module. +// Deprecated: RegisterRESTRoutes is deprecated. func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the genutil module. diff --git a/x/genutil/types/genesis.pb.go b/x/genutil/types/genesis.pb.go index 369cd0edfaf..58a2f17824e 100644 --- a/x/genutil/types/genesis.pb.go +++ b/x/genutil/types/genesis.pb.go @@ -27,7 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the raw genesis transaction in JSON. type GenesisState struct { // gen_txs defines the genesis transactions. - GenTxs []encoding_json.RawMessage `protobuf:"bytes,1,rep,name=gen_txs,json=genTxs,proto3,casttype=encoding/json.RawMessage" json:"gentxs" yaml:"gentxs"` + GenTxs []encoding_json.RawMessage `protobuf:"bytes,1,rep,name=gen_txs,json=genTxs,proto3,casttype=encoding/json.RawMessage" json:"gentxs"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -71,7 +71,7 @@ func (m *GenesisState) GetGenTxs() []encoding_json.RawMessage { } func init() { - proto.RegisterType((*GenesisState)(nil), "cosmos.genutil.v1beta1.GenesisState") + // proto.RegisterType((*GenesisState)(nil), "cosmos.genutil.v1beta1.GenesisState") } func init() { @@ -79,22 +79,21 @@ func init() { } var fileDescriptor_31771d25e8d8f90f = []byte{ - // 234 bytes of a gzipped FileDescriptorProto + // 221 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x4f, 0xcd, 0x2b, 0x2d, 0xc9, 0xcc, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0x04, 0xf1, 0x53, 0x8b, 0x33, 0x8b, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xc4, 0x20, 0xaa, 0xf4, 0xa0, 0xaa, 0xf4, 0xa0, 0xaa, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4a, - 0xf4, 0x41, 0x2c, 0x88, 0x6a, 0xa5, 0x04, 0x2e, 0x1e, 0x77, 0x88, 0xf6, 0xe0, 0x92, 0xc4, 0x92, - 0x54, 0xa1, 0x00, 0x2e, 0xf6, 0xf4, 0xd4, 0xbc, 0xf8, 0x92, 0x8a, 0x62, 0x09, 0x46, 0x05, 0x66, - 0x0d, 0x1e, 0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x8a, 0x7f, 0xdd, + 0x93, 0x97, 0x48, 0xcd, 0x4b, 0xce, 0x4f, 0xc9, 0xcc, 0x4b, 0xd7, 0xcf, 0x2a, 0xce, 0xcf, 0xd3, + 0x0b, 0x4a, 0x2c, 0xf7, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x0d, 0x02, 0xa9, 0x09, 0xa9, 0x28, + 0x76, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, + 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, 0xcc, + 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x4f, 0x20, 0x94, 0x6e, 0x71, 0x4a, + 0xb6, 0x7e, 0x05, 0xdc, 0x5b, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xf7, 0x19, 0x03, + 0x02, 0x00, 0x00, 0xff, 0xff, 0xc5, 0xe1, 0x3b, 0x15, 0xf5, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/genutil/types/genesis_state.go b/x/genutil/types/genesis_state.go index cce9444e464..9a71d50aae6 100644 --- a/x/genutil/types/genesis_state.go +++ b/x/genutil/types/genesis_state.go @@ -2,7 +2,6 @@ package types import ( "encoding/json" - "errors" "fmt" tmos "github.com/tendermint/tendermint/libs/os" @@ -95,24 +94,36 @@ func GenesisStateFromGenFile(genFile string) (genesisState map[string]json.RawMe // ValidateGenesis validates GenTx transactions func ValidateGenesis(genesisState *GenesisState, txJSONDecoder sdk.TxDecoder) error { - for i, genTx := range genesisState.GenTxs { - var tx sdk.Tx - tx, err := txJSONDecoder(genTx) + for _, genTx := range genesisState.GenTxs { + _, err := ValidateAndGetGenTx(genTx, txJSONDecoder) if err != nil { return err } + } + return nil +} - msgs := tx.GetMsgs() - if len(msgs) != 1 { - return errors.New( - "must provide genesis Tx with exactly 1 CreateValidator message") - } +// ValidateAndGetGenTx validates the genesis transaction and returns GenTx if valid +// it cannot verify the signature as it is stateless validation +func ValidateAndGetGenTx(genTx json.RawMessage, txJSONDecoder sdk.TxDecoder) (sdk.Tx, error) { + tx, err := txJSONDecoder(genTx) + if err != nil { + return tx, fmt.Errorf("failed to decode gentx: %s, error: %s", genTx, err) + } - // TODO: abstract back to staking - if _, ok := msgs[0].(*stakingtypes.MsgCreateValidator); !ok { - return fmt.Errorf( - "genesis transaction %v does not contain a MsgCreateValidator", i) - } + msgs := tx.GetMsgs() + if len(msgs) != 1 { + return tx, fmt.Errorf("unexpected number of GenTx messages; got: %d, expected: 1", len(msgs)) } - return nil + + // TODO: abstract back to staking + if _, ok := msgs[0].(*stakingtypes.MsgCreateValidator); !ok { + return tx, fmt.Errorf("unexpected GenTx message type; expected: MsgCreateValidator, got: %T", msgs[0]) + } + + if err := msgs[0].ValidateBasic(); err != nil { + return tx, fmt.Errorf("invalid GenTx '%s': %s", msgs[0], err) + } + + return tx, nil } diff --git a/x/genutil/types/genesis_state_test.go b/x/genutil/types/genesis_state_test.go index 9c225fd3f7c..0f7b0bc618f 100644 --- a/x/genutil/types/genesis_state_test.go +++ b/x/genutil/types/genesis_state_test.go @@ -7,11 +7,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/codec" + simapp "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -38,11 +36,11 @@ func TestValidateGenesisMultipleMessages(t *testing.T) { comm := stakingtypes.CommissionRates{} msg1, err := stakingtypes.NewMsgCreateValidator(sdk.ValAddress(pk1.Address()), pk1, - sdk.NewInt64Coin(sdk.DefaultBondDenom, 50), desc, comm, sdk.OneInt()) + sdk.NewInt64Coin(sdk.DefaultBondDenom, 50), desc, comm) require.NoError(t, err) msg2, err := stakingtypes.NewMsgCreateValidator(sdk.ValAddress(pk2.Address()), pk2, - sdk.NewInt64Coin(sdk.DefaultBondDenom, 50), desc, comm, sdk.OneInt()) + sdk.NewInt64Coin(sdk.DefaultBondDenom, 50), desc, comm) require.NoError(t, err) txGen := simapp.MakeTestEncodingConfig().TxConfig @@ -59,7 +57,7 @@ func TestValidateGenesisMultipleMessages(t *testing.T) { func TestValidateGenesisBadMessage(t *testing.T) { desc := stakingtypes.NewDescription("testname", "", "", "", "") - msg1 := stakingtypes.NewMsgEditValidator(sdk.ValAddress(pk1.Address()), desc, nil, nil) + msg1 := stakingtypes.NewMsgEditValidator(sdk.ValAddress(pk1.Address()), desc, nil) txGen := simapp.MakeTestEncodingConfig().TxConfig txBuilder := txGen.NewTxBuilder() @@ -72,23 +70,3 @@ func TestValidateGenesisBadMessage(t *testing.T) { err = types.ValidateGenesis(genesisState, simapp.MakeTestEncodingConfig().TxConfig.TxJSONDecoder()) require.Error(t, err) } - -func TestGenesisStateFromGenFile(t *testing.T) { - cdc := codec.NewLegacyAmino() - - genFile := "../../../tests/fixtures/adr-024-coin-metadata_genesis.json" - genesisState, _, err := types.GenesisStateFromGenFile(genFile) - require.NoError(t, err) - - var bankGenesis banktypes.GenesisState - cdc.MustUnmarshalJSON(genesisState[banktypes.ModuleName], &bankGenesis) - - require.True(t, bankGenesis.Params.DefaultSendEnabled) - require.Equal(t, "1000nametoken,100000000stake", bankGenesis.Balances[0].GetCoins().String()) - require.Equal(t, "cosmos106vrzv5xkheqhjm023pxcxlqmcjvuhtfyachz4", bankGenesis.Balances[0].GetAddress().String()) - require.Equal(t, "The native staking token of the Cosmos Hub.", bankGenesis.DenomMetadata[0].GetDescription()) - require.Equal(t, "uatom", bankGenesis.DenomMetadata[0].GetBase()) - require.Equal(t, "matom", bankGenesis.DenomMetadata[0].GetDenomUnits()[1].GetDenom()) - require.Equal(t, []string{"milliatom"}, bankGenesis.DenomMetadata[0].GetDenomUnits()[1].GetAliases()) - require.Equal(t, uint32(3), bankGenesis.DenomMetadata[0].GetDenomUnits()[1].GetExponent()) -} diff --git a/x/genutil/utils.go b/x/genutil/utils.go index 1ca0fd9bcbb..7fbdc668d8f 100644 --- a/x/genutil/utils.go +++ b/x/genutil/utils.go @@ -53,13 +53,12 @@ func InitializeNodeValidatorFiles(config *cfg.Config) (nodeID string, valPubKey return InitializeNodeValidatorFilesFromMnemonic(config, "") } -// InitializeNodeValidatorFiles creates private validator and p2p configuration files using the given mnemonic. +// InitializeNodeValidatorFilesFromMnemonic creates private validator and p2p configuration files using the given mnemonic. // If no valid mnemonic is given, a random one will be used instead. func InitializeNodeValidatorFilesFromMnemonic(config *cfg.Config, mnemonic string) (nodeID string, valPubKey cryptotypes.PubKey, err error) { if len(mnemonic) > 0 && !bip39.IsMnemonicValid(mnemonic) { return "", nil, fmt.Errorf("invalid mnemonic") } - nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile()) if err != nil { return "", nil, err @@ -83,6 +82,7 @@ func InitializeNodeValidatorFilesFromMnemonic(config *cfg.Config, mnemonic strin } else { privKey := tmed25519.GenPrivKeyFromSecret([]byte(mnemonic)) filePV = privval.NewFilePV(privKey, pvKeyFile, pvStateFile) + filePV.Save() } tmValPubKey, err := filePV.GetPubKey() diff --git a/x/genutil/utils_test.go b/x/genutil/utils_test.go index b406ed3e98c..14e50d48c10 100644 --- a/x/genutil/utils_test.go +++ b/x/genutil/utils_test.go @@ -1,63 +1 @@ package genutil - -import ( - "encoding/json" - "os" - "path/filepath" - "testing" - "time" - - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/config" -) - -func TestExportGenesisFileWithTime(t *testing.T) { - t.Parallel() - - fname := filepath.Join(t.TempDir(), "genesis.json") - - require.NoError(t, ExportGenesisFileWithTime(fname, "test", nil, json.RawMessage(`{"account_owner": "Bob"}`), time.Now())) -} - -func TestInitializeNodeValidatorFilesFromMnemonic(t *testing.T) { - t.Parallel() - - cfg := config.TestConfig() - cfg.RootDir = t.TempDir() - require.NoError(t, os.MkdirAll(filepath.Join(cfg.RootDir, "config"), 0o755)) - - tests := []struct { - name string - mnemonic string - expError bool - }{ - { - name: "invalid mnemonic returns error", - mnemonic: "side video kiss hotel essence", - expError: true, - }, - { - name: "empty mnemonic does not return error", - mnemonic: "", - expError: false, - }, - { - name: "valid mnemonic does not return error", - mnemonic: "side video kiss hotel essence door angle student degree during vague adjust submit trick globe muscle frozen vacuum artwork million shield bind useful wave", - expError: false, - }, - } - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - _, _, err := InitializeNodeValidatorFilesFromMnemonic(cfg, tt.mnemonic) - - if tt.expError { - require.Error(t, err) - } else { - require.NoError(t, err) - } - }) - } -} diff --git a/x/gov/client/rest/rest_test.go b/x/gov/client/rest/rest_test.go index 91fb8e0e636..5e840afe2f7 100644 --- a/x/gov/client/rest/rest_test.go +++ b/x/gov/client/rest/rest_test.go @@ -1,168 +1,4 @@ //go:build norace // +build norace -package rest_test - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -func (s *IntegrationTestSuite) TestLegacyGetAllProposals() { - val := s.network.Validators[0] - - testCases := []struct { - name string - url string - numProposals int - expErr bool - expErrMsg string - }{ - { - "get all existing proposals", - fmt.Sprintf("%s/gov/proposals", val.APIAddress), - 3, false, "", - }, - { - "get proposals in deposit period", - fmt.Sprintf("%s/gov/proposals?status=deposit_period", val.APIAddress), - 1, false, "", - }, - { - "get proposals in voting period", - fmt.Sprintf("%s/gov/proposals?status=voting_period", val.APIAddress), - 2, false, "", - }, - { - "wrong status parameter", - fmt.Sprintf("%s/gov/proposals?status=invalidstatus", val.APIAddress), - 0, true, "'invalidstatus' is not a valid proposal status", - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - respJSON, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - if tc.expErr { - var errResp rest.ErrorResponse - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &errResp)) - s.Require().Equal(errResp.Error, tc.expErrMsg) - } else { - resp := rest.ResponseWithHeight{} - err = val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &resp) - s.Require().NoError(err) - - // Check results. - var proposals types.Proposals - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(resp.Result, &proposals)) - s.Require().Equal(tc.numProposals, len(proposals)) - } - }) - } -} - -func (s *IntegrationTestSuite) TestLegacyGetVote() { - val := s.network.Validators[0] - voterAddressBech32 := val.Address.String() - - testCases := []struct { - name string - url string - expErr bool - expErrMsg string - }{ - { - "get non existing proposal", - fmt.Sprintf("%s/gov/proposals/%s/votes/%s", val.APIAddress, "10", voterAddressBech32), - true, "proposalID 10 does not exist", - }, - { - "get proposal with wrong voter address", - fmt.Sprintf("%s/gov/proposals/%s/votes/%s", val.APIAddress, "1", "wrongVoterAddress"), - true, "decoding bech32 failed: string not all lowercase or all uppercase", - }, - { - "get proposal with id", - fmt.Sprintf("%s/gov/proposals/%s/votes/%s", val.APIAddress, "1", voterAddressBech32), - false, "", - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - respJSON, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - if tc.expErr { - var errResp rest.ErrorResponse - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &errResp)) - - s.Require().Equal(errResp.Error, tc.expErrMsg) - } else { - resp := rest.ResponseWithHeight{} - err = val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &resp) - s.Require().NoError(err) - - // Check result is not empty. - var vote types.Vote - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(resp.Result, &vote)) - s.Require().Equal(val.Address.String(), vote.Voter) - // Note that option is now an int. - s.Require().Equal([]types.WeightedVoteOption{{types.VoteOption(1), sdk.NewDec(1)}}, vote.Options) - } - }) - } -} - -func (s *IntegrationTestSuite) TestLegacyGetVotes() { - val := s.network.Validators[0] - - testCases := []struct { - name string - url string - expErr bool - expErrMsg string - }{ - { - "votes with empty proposal id", - fmt.Sprintf("%s/gov/proposals/%s/votes", val.APIAddress, ""), - true, "'votes' is not a valid uint64", - }, - { - "get votes with valid id", - fmt.Sprintf("%s/gov/proposals/%s/votes", val.APIAddress, "1"), - false, "", - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - respJSON, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - if tc.expErr { - var errResp rest.ErrorResponse - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &errResp)) - - s.Require().Equal(errResp.Error, tc.expErrMsg) - } else { - resp := rest.ResponseWithHeight{} - err = val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &resp) - s.Require().NoError(err) - - // Check result is not empty. - var votes []types.Vote - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(resp.Result, &votes)) - s.Require().Greater(len(votes), 0) - } - }) - } -} +package rest_test \ No newline at end of file diff --git a/x/gov/common_test.go b/x/gov/common_test.go index cc759d4e961..b3a4389eb73 100644 --- a/x/gov/common_test.go +++ b/x/gov/common_test.go @@ -83,7 +83,7 @@ func createValidators(t *testing.T, stakingHandler sdk.Handler, ctx sdk.Context, valTokens := sdk.TokensFromConsensusPower(powerAmt[i], sdk.DefaultPowerReduction) valCreateMsg, err := stakingtypes.NewMsgCreateValidator( addrs[i], pubkeys[i], sdk.NewCoin(sdk.DefaultBondDenom, valTokens), - TestDescription, TestCommissionRates, sdk.OneInt(), + TestDescription, TestCommissionRates, ) require.NoError(t, err) handleAndCheck(t, stakingHandler, ctx, valCreateMsg) diff --git a/x/gov/legacy/v040/migrate.go b/x/gov/legacy/v040/migrate.go index 3adedde5093..f95b240a337 100644 --- a/x/gov/legacy/v040/migrate.go +++ b/x/gov/legacy/v040/migrate.go @@ -1,208 +1,2 @@ package v040 -import ( - "fmt" - - proto "github.com/gogo/protobuf/proto" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - v036distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v036" - v040distr "github.com/cosmos/cosmos-sdk/x/distribution/types" - v034gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v034" - v036gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v036" - v040gov "github.com/cosmos/cosmos-sdk/x/gov/types" - v036params "github.com/cosmos/cosmos-sdk/x/params/legacy/v036" - v040params "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - v038upgrade "github.com/cosmos/cosmos-sdk/x/upgrade/legacy/v038" - v040upgrade "github.com/cosmos/cosmos-sdk/x/upgrade/types" -) - -func migrateVoteOption(oldVoteOption v034gov.VoteOption) v040gov.VoteOption { - switch oldVoteOption { - case v034gov.OptionEmpty: - return v040gov.OptionEmpty - - case v034gov.OptionYes: - return v040gov.OptionYes - - case v034gov.OptionAbstain: - return v040gov.OptionAbstain - - case v034gov.OptionNo: - return v040gov.OptionNo - - case v034gov.OptionNoWithVeto: - return v040gov.OptionNoWithVeto - - default: - panic(fmt.Errorf("'%s' is not a valid vote option", oldVoteOption)) - } -} - -func migrateProposalStatus(oldProposalStatus v034gov.ProposalStatus) v040gov.ProposalStatus { - switch oldProposalStatus { - - case v034gov.StatusNil: - return v040gov.StatusNil - - case v034gov.StatusDepositPeriod: - return v040gov.StatusDepositPeriod - - case v034gov.StatusVotingPeriod: - return v040gov.StatusVotingPeriod - - case v034gov.StatusPassed: - return v040gov.StatusPassed - - case v034gov.StatusRejected: - return v040gov.StatusRejected - - case v034gov.StatusFailed: - return v040gov.StatusFailed - - default: - panic(fmt.Errorf("'%s' is not a valid proposal status", oldProposalStatus)) - } -} - -func migrateContent(oldContent v036gov.Content) *codectypes.Any { - var protoProposal proto.Message - - switch oldContent := oldContent.(type) { - case v036gov.TextProposal: - { - protoProposal = &v040gov.TextProposal{ - Title: oldContent.Title, - Description: oldContent.Description, - } - // Convert the content into Any. - contentAny, err := codectypes.NewAnyWithValue(protoProposal) - if err != nil { - panic(err) - } - - return contentAny - } - case v036distr.CommunityPoolSpendProposal: - { - protoProposal = &v040distr.CommunityPoolSpendProposal{ - Title: oldContent.Title, - Description: oldContent.Description, - Recipient: oldContent.Recipient.String(), - Amount: oldContent.Amount, - } - } - case v038upgrade.CancelSoftwareUpgradeProposal: - { - protoProposal = &v040upgrade.CancelSoftwareUpgradeProposal{ - Description: oldContent.Description, - Title: oldContent.Title, - } - } - case v038upgrade.SoftwareUpgradeProposal: - { - protoProposal = &v040upgrade.SoftwareUpgradeProposal{ - Description: oldContent.Description, - Title: oldContent.Title, - Plan: v040upgrade.Plan{ - Name: oldContent.Plan.Name, - Height: oldContent.Plan.Height, - Info: oldContent.Plan.Info, - }, - } - } - case v036params.ParameterChangeProposal: - { - newChanges := make([]v040params.ParamChange, len(oldContent.Changes)) - for i, oldChange := range oldContent.Changes { - newChanges[i] = v040params.ParamChange{ - Subspace: oldChange.Subspace, - Key: oldChange.Key, - Value: oldChange.Value, - } - } - - protoProposal = &v040params.ParameterChangeProposal{ - Description: oldContent.Description, - Title: oldContent.Title, - Changes: newChanges, - } - } - default: - panic(fmt.Errorf("%T is not a valid proposal content type", oldContent)) - } - - // Convert the content into Any. - contentAny, err := codectypes.NewAnyWithValue(protoProposal) - if err != nil { - panic(err) - } - - return contentAny -} - -// Migrate accepts exported v0.36 x/gov genesis state and migrates it to -// v0.40 x/gov genesis state. The migration includes: -// -// - Convert vote option & proposal status from byte to enum. -// - Migrate proposal content to Any. -// - Convert addresses from bytes to bech32 strings. -// - Re-encode in v0.40 GenesisState. -func Migrate(oldGovState v036gov.GenesisState) *v040gov.GenesisState { - newDeposits := make([]v040gov.Deposit, len(oldGovState.Deposits)) - for i, oldDeposit := range oldGovState.Deposits { - newDeposits[i] = v040gov.Deposit{ - ProposalId: oldDeposit.ProposalID, - Depositor: oldDeposit.Depositor.String(), - Amount: oldDeposit.Amount, - } - } - - newVotes := make([]v040gov.Vote, len(oldGovState.Votes)) - for i, oldVote := range oldGovState.Votes { - newVotes[i] = v040gov.Vote{ - ProposalId: oldVote.ProposalID, - Voter: oldVote.Voter.String(), - Option: migrateVoteOption(oldVote.Option), - } - } - - newProposals := make([]v040gov.Proposal, len(oldGovState.Proposals)) - for i, oldProposal := range oldGovState.Proposals { - newProposals[i] = v040gov.Proposal{ - ProposalId: oldProposal.ProposalID, - Content: migrateContent(oldProposal.Content), - Status: migrateProposalStatus(oldProposal.Status), - FinalTallyResult: v040gov.TallyResult{ - Yes: oldProposal.FinalTallyResult.Yes, - Abstain: oldProposal.FinalTallyResult.Abstain, - No: oldProposal.FinalTallyResult.No, - NoWithVeto: oldProposal.FinalTallyResult.NoWithVeto, - }, - SubmitTime: oldProposal.SubmitTime, - DepositEndTime: oldProposal.DepositEndTime, - TotalDeposit: oldProposal.TotalDeposit, - VotingStartTime: oldProposal.VotingStartTime, - VotingEndTime: oldProposal.VotingEndTime, - } - } - - return &v040gov.GenesisState{ - StartingProposalId: oldGovState.StartingProposalID, - Deposits: newDeposits, - Votes: newVotes, - Proposals: newProposals, - DepositParams: v040gov.DepositParams{ - MinDeposit: oldGovState.DepositParams.MinDeposit, - MaxDepositPeriod: oldGovState.DepositParams.MaxDepositPeriod, - }, - VotingParams: v040gov.VotingParams{ - VotingPeriod: oldGovState.VotingParams.VotingPeriod, - }, - TallyParams: v040gov.TallyParams{ - Quorum: oldGovState.TallyParams.Quorum, - Threshold: oldGovState.TallyParams.Threshold, - VetoThreshold: oldGovState.TallyParams.Veto, - }, - } -} diff --git a/x/gov/legacy/v040/migrate_test.go b/x/gov/legacy/v040/migrate_test.go index 664696bf296..b13f7abda2a 100644 --- a/x/gov/legacy/v040/migrate_test.go +++ b/x/gov/legacy/v040/migrate_test.go @@ -1,239 +1,2 @@ package v040_test -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - v036distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v036" - v036gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v036" - v040gov "github.com/cosmos/cosmos-sdk/x/gov/legacy/v040" - v036params "github.com/cosmos/cosmos-sdk/x/params/legacy/v036" - v038upgrade "github.com/cosmos/cosmos-sdk/x/upgrade/legacy/v038" -) - -func TestMigrate(t *testing.T) { - encodingConfig := simapp.MakeTestEncodingConfig() - clientCtx := client.Context{}. - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithJSONCodec(encodingConfig.Marshaler) - - recipient, err := sdk.AccAddressFromBech32("cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh") - require.NoError(t, err) - govGenState := v036gov.GenesisState{ - Proposals: []v036gov.Proposal{ - { - Content: v036gov.TextProposal{ - Title: "foo_text", - Description: "bar_text", - }, - }, - { - Content: v036distr.CommunityPoolSpendProposal{ - Title: "foo_community", - Description: "bar_community", - Recipient: recipient, - Amount: sdk.NewCoins(sdk.NewCoin("footoken", sdk.NewInt(2))), - }, - }, - { - Content: v038upgrade.CancelSoftwareUpgradeProposal{ - Title: "foo_cancel_upgrade", - Description: "bar_cancel_upgrade", - }, - }, - { - Content: v038upgrade.SoftwareUpgradeProposal{ - Title: "foo_software_upgrade", - Description: "bar_software_upgrade", - Plan: v038upgrade.Plan{ - Name: "foo_upgrade_name", - Height: 123, - Info: "foo_upgrade_info", - }, - }, - }, - { - Content: v036params.ParameterChangeProposal{ - Title: "foo_param_change", - Description: "bar_param_change", - Changes: []v036params.ParamChange{ - { - Subspace: "foo_param_change_subspace", - Key: "foo_param_change_key", - Subkey: "foo_param_change_subkey", - Value: "foo_param_change_value", - }, - }, - }, - }, - }, - } - - migrated := v040gov.Migrate(govGenState) - - bz, err := clientCtx.Codec.MarshalJSON(migrated) - require.NoError(t, err) - - // Indent the JSON bz correctly. - var jsonObj map[string]interface{} - err = json.Unmarshal(bz, &jsonObj) - require.NoError(t, err) - indentedBz, err := json.MarshalIndent(jsonObj, "", "\t") - require.NoError(t, err) - - // Make sure about: - // - TextProposal has correct JSON. - // - CommunityPoolSpendProposal has correct JSON. - // - CancelSoftwareUpgradeProposal has correct JSON. - // - SoftwareUpgradeProposal has correct JSON. - // - ParameterChangeProposal has correct JSON. - expected := `{ - "deposit_params": { - "max_deposit_period": "0s", - "min_deposit": [] - }, - "deposits": [], - "proposals": [ - { - "content": { - "@type": "/cosmos.gov.v1beta1.TextProposal", - "description": "bar_text", - "title": "foo_text" - }, - "deposit_end_time": "0001-01-01T00:00:00Z", - "final_tally_result": { - "abstain": "0", - "no": "0", - "no_with_veto": "0", - "yes": "0" - }, - "proposal_id": "0", - "status": "PROPOSAL_STATUS_UNSPECIFIED", - "submit_time": "0001-01-01T00:00:00Z", - "total_deposit": [], - "voting_end_time": "0001-01-01T00:00:00Z", - "voting_start_time": "0001-01-01T00:00:00Z" - }, - { - "content": { - "@type": "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", - "amount": [ - { - "amount": "2", - "denom": "footoken" - } - ], - "description": "bar_community", - "recipient": "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", - "title": "foo_community" - }, - "deposit_end_time": "0001-01-01T00:00:00Z", - "final_tally_result": { - "abstain": "0", - "no": "0", - "no_with_veto": "0", - "yes": "0" - }, - "proposal_id": "0", - "status": "PROPOSAL_STATUS_UNSPECIFIED", - "submit_time": "0001-01-01T00:00:00Z", - "total_deposit": [], - "voting_end_time": "0001-01-01T00:00:00Z", - "voting_start_time": "0001-01-01T00:00:00Z" - }, - { - "content": { - "@type": "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", - "description": "bar_cancel_upgrade", - "title": "foo_cancel_upgrade" - }, - "deposit_end_time": "0001-01-01T00:00:00Z", - "final_tally_result": { - "abstain": "0", - "no": "0", - "no_with_veto": "0", - "yes": "0" - }, - "proposal_id": "0", - "status": "PROPOSAL_STATUS_UNSPECIFIED", - "submit_time": "0001-01-01T00:00:00Z", - "total_deposit": [], - "voting_end_time": "0001-01-01T00:00:00Z", - "voting_start_time": "0001-01-01T00:00:00Z" - }, - { - "content": { - "@type": "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - "description": "bar_software_upgrade", - "plan": { - "height": "123", - "info": "foo_upgrade_info", - "name": "foo_upgrade_name", - "time": "0001-01-01T00:00:00Z", - "upgraded_client_state": null - }, - "title": "foo_software_upgrade" - }, - "deposit_end_time": "0001-01-01T00:00:00Z", - "final_tally_result": { - "abstain": "0", - "no": "0", - "no_with_veto": "0", - "yes": "0" - }, - "proposal_id": "0", - "status": "PROPOSAL_STATUS_UNSPECIFIED", - "submit_time": "0001-01-01T00:00:00Z", - "total_deposit": [], - "voting_end_time": "0001-01-01T00:00:00Z", - "voting_start_time": "0001-01-01T00:00:00Z" - }, - { - "content": { - "@type": "/cosmos.params.v1beta1.ParameterChangeProposal", - "changes": [ - { - "key": "foo_param_change_key", - "subspace": "foo_param_change_subspace", - "value": "foo_param_change_value" - } - ], - "description": "bar_param_change", - "title": "foo_param_change" - }, - "deposit_end_time": "0001-01-01T00:00:00Z", - "final_tally_result": { - "abstain": "0", - "no": "0", - "no_with_veto": "0", - "yes": "0" - }, - "proposal_id": "0", - "status": "PROPOSAL_STATUS_UNSPECIFIED", - "submit_time": "0001-01-01T00:00:00Z", - "total_deposit": [], - "voting_end_time": "0001-01-01T00:00:00Z", - "voting_start_time": "0001-01-01T00:00:00Z" - } - ], - "starting_proposal_id": "0", - "tally_params": { - "quorum": "0", - "threshold": "0", - "veto_threshold": "0" - }, - "votes": [], - "voting_params": { - "voting_period": "0s" - } -}` - - require.Equal(t, expected, string(indentedBz)) -} diff --git a/x/slashing/app_test.go b/x/slashing/app_test.go index 028d4175560..a3868c66bda 100644 --- a/x/slashing/app_test.go +++ b/x/slashing/app_test.go @@ -64,7 +64,7 @@ func TestSlashingMsgs(t *testing.T) { commission := stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) createValidatorMsg, err := stakingtypes.NewMsgCreateValidator( - sdk.ValAddress(addr1), valKey.PubKey(), bondCoin, description, commission, sdk.OneInt(), + sdk.ValAddress(addr1), valKey.PubKey(), bondCoin, description, commission, ) require.NoError(t, err) diff --git a/x/slashing/client/rest/grpc_query_test.go b/x/slashing/client/rest/grpc_query_test.go deleted file mode 100644 index 39daf06f69c..00000000000 --- a/x/slashing/client/rest/grpc_query_test.go +++ /dev/null @@ -1,134 +0,0 @@ -package rest_test - -import ( - "fmt" - "testing" - "time" - - "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/network" - sdk "github.com/cosmos/cosmos-sdk/types" - grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/cosmos/cosmos-sdk/x/slashing/types" -) - -type IntegrationTestSuite struct { - suite.Suite - - cfg network.Config - network *network.Network -} - -func (s *IntegrationTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - - cfg := network.DefaultConfig() - cfg.NumValidators = 1 - - s.cfg = cfg - s.network = network.New(s.T(), cfg) - - _, err := s.network.WaitForHeight(1) - s.Require().NoError(err) -} - -func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - s.network.Cleanup() -} - -func (s *IntegrationTestSuite) TestGRPCQueries() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - consAddr := sdk.ConsAddress(val.PubKey.Address()).String() - - testCases := []struct { - name string - url string - headers map[string]string - expErr bool - respType proto.Message - expected proto.Message - }{ - { - "get signing infos (height specific)", - fmt.Sprintf("%s/cosmos/slashing/v1beta1/signing_infos", baseURL), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - false, - &types.QuerySigningInfosResponse{}, - &types.QuerySigningInfosResponse{ - Info: []types.ValidatorSigningInfo{ - { - Address: sdk.ConsAddress(val.PubKey.Address()).String(), - JailedUntil: time.Unix(0, 0), - }, - }, - Pagination: &query.PageResponse{ - Total: uint64(1), - }, - }, - }, - { - "get signing info (height specific)", - fmt.Sprintf("%s/cosmos/slashing/v1beta1/signing_infos/%s", baseURL, consAddr), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - false, - &types.QuerySigningInfoResponse{}, - &types.QuerySigningInfoResponse{ - ValSigningInfo: types.ValidatorSigningInfo{ - Address: sdk.ConsAddress(val.PubKey.Address()).String(), - JailedUntil: time.Unix(0, 0), - }, - }, - }, - { - "get signing info wrong address", - fmt.Sprintf("%s/cosmos/slashing/v1beta1/signing_infos/%s", baseURL, "wrongAddress"), - map[string]string{}, - true, - &types.QuerySigningInfoResponse{}, - nil, - }, - { - "params", - fmt.Sprintf("%s/cosmos/slashing/v1beta1/params", baseURL), - map[string]string{}, - false, - &types.QueryParamsResponse{}, - &types.QueryParamsResponse{ - Params: types.DefaultParams(), - }, - }, - } - - for _, tc := range testCases { - tc := tc - - s.Run(tc.name, func() { - resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) - s.Require().NoError(err) - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType) - - if tc.expErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Equal(tc.expected.String(), tc.respType.String()) - } - }) - } -} - -func TestIntegrationTestSuite(t *testing.T) { - suite.Run(t, new(IntegrationTestSuite)) -} diff --git a/x/slashing/client/rest/query.go b/x/slashing/client/rest/query.go deleted file mode 100644 index d5d4a3a187f..00000000000 --- a/x/slashing/client/rest/query.go +++ /dev/null @@ -1,111 +0,0 @@ -package rest - -import ( - "fmt" - "net/http" - - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" //nolint:staticcheck - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/slashing/types" -) - -func registerQueryRoutes(clientCtx client.Context, r *mux.Router) { - r.HandleFunc( - "/slashing/validators/{validatorPubKey}/signing_info", - signingInfoHandlerFn(clientCtx), - ).Methods("GET") - - r.HandleFunc( - "/slashing/signing_infos", - signingInfoHandlerListFn(clientCtx), - ).Methods("GET") - - r.HandleFunc( - "/slashing/parameters", - queryParamsHandlerFn(clientCtx), - ).Methods("GET") -} - -// Deprecated: http request handler to query signing info -func signingInfoHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - pk, err := legacybech32.UnmarshalPubKey(legacybech32.ConsPK, vars["validatorPubKey"]) - if rest.CheckBadRequestError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - params := types.QuerySigningInfoRequest{ConsAddress: pk.Address().String()} - - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckBadRequestError(w, err) { - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QuerySigningInfo) - res, height, err := clientCtx.QueryWithData(route, bz) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -// http request handler to query signing info -func signingInfoHandlerListFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if rest.CheckBadRequestError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - params := types.NewQuerySigningInfosParams(page, limit) - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckInternalServerError(w, err) { - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QuerySigningInfos) - res, height, err := clientCtx.QueryWithData(route, bz) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -func queryParamsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/parameters", types.QuerierRoute) - - res, height, err := clientCtx.QueryWithData(route, nil) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} diff --git a/x/slashing/client/rest/rest.go b/x/slashing/client/rest/rest.go deleted file mode 100644 index 059cb17c6bd..00000000000 --- a/x/slashing/client/rest/rest.go +++ /dev/null @@ -1,15 +0,0 @@ -package rest - -import ( - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/rest" -) - -func RegisterHandlers(clientCtx client.Context, rtr *mux.Router) { - r := rest.WithHTTPDeprecationHeaders(rtr) - - registerQueryRoutes(clientCtx, r) - registerTxHandlers(clientCtx, r) -} diff --git a/x/slashing/client/rest/tx.go b/x/slashing/client/rest/tx.go deleted file mode 100644 index eaac614fa1c..00000000000 --- a/x/slashing/client/rest/tx.go +++ /dev/null @@ -1,63 +0,0 @@ -package rest - -import ( - "bytes" - "net/http" - - "github.com/gorilla/mux" - - "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/slashing/types" -) - -func registerTxHandlers(clientCtx client.Context, r *mux.Router) { - r.HandleFunc("/slashing/validators/{validatorAddr}/unjail", NewUnjailRequestHandlerFn(clientCtx)).Methods("POST") -} - -// Unjail TX body -type UnjailReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` -} - -// NewUnjailRequestHandlerFn returns an HTTP REST handler for creating a MsgUnjail -// transaction. -func NewUnjailRequestHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - bech32Validator := vars["validatorAddr"] - - var req UnjailReq - if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if rest.CheckBadRequestError(w, err) { - return - } - - valAddr, err := sdk.ValAddressFromBech32(bech32Validator) - if rest.CheckInternalServerError(w, err) { - return - } - - if !bytes.Equal(fromAddr, valAddr) { - rest.WriteErrorResponse(w, http.StatusUnauthorized, "must use own validator address") - return - } - - msg := types.NewMsgUnjail(valAddr) - if rest.CheckBadRequestError(w, msg.ValidateBasic()) { - return - } - tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) - } -} diff --git a/x/slashing/handler_test.go b/x/slashing/handler_test.go deleted file mode 100644 index 25fed487ba7..00000000000 --- a/x/slashing/handler_test.go +++ /dev/null @@ -1,295 +0,0 @@ -package slashing_test - -import ( - "errors" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/slashing" - "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - "github.com/cosmos/cosmos-sdk/x/slashing/testslashing" - "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/staking/teststaking" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func TestCannotUnjailUnlessJailed(t *testing.T) { - // initial setup - app := simapp.Setup(false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - pks := simapp.CreateTestPubKeys(1) - simapp.AddTestAddrsFromPubKeys(app, ctx, pks, app.StakingKeeper.TokensFromConsensusPower(ctx, 200)) - - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - slh := slashing.NewHandler(app.SlashingKeeper) - addr, val := sdk.ValAddress(pks[0].Address()), pks[0] - - amt := tstaking.CreateValidatorWithValPower(addr, val, 100, true) - staking.EndBlocker(ctx, app.StakingKeeper) - require.Equal( - t, app.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr)), - sdk.Coins{sdk.NewCoin(app.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))}, - ) - require.Equal(t, amt, app.StakingKeeper.Validator(ctx, addr).GetBondedTokens()) - - // assert non-jailed validator can't be unjailed - res, err := slh(ctx, types.NewMsgUnjail(addr)) - require.Error(t, err) - require.Nil(t, res) - require.True(t, errors.Is(types.ErrValidatorNotJailed, err)) -} - -func TestCannotUnjailUnlessMeetMinSelfDelegation(t *testing.T) { - // initial setup - app := simapp.Setup(false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - pks := simapp.CreateTestPubKeys(1) - simapp.AddTestAddrsFromPubKeys(app, ctx, pks, app.StakingKeeper.TokensFromConsensusPower(ctx, 200)) - - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - slh := slashing.NewHandler(app.SlashingKeeper) - addr, val := sdk.ValAddress(pks[0].Address()), pks[0] - amt := app.StakingKeeper.TokensFromConsensusPower(ctx, 100) - msg := tstaking.CreateValidatorMsg(addr, val, amt) - msg.MinSelfDelegation = amt - tstaking.Handle(msg, true) - - staking.EndBlocker(ctx, app.StakingKeeper) - require.Equal( - t, app.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr)), - sdk.Coins{sdk.NewCoin(app.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))}, - ) - - tstaking.Undelegate(sdk.AccAddress(addr), addr, sdk.OneInt(), true) - require.True(t, app.StakingKeeper.Validator(ctx, addr).IsJailed()) - - // assert non-jailed validator can't be unjailed - res, err := slh(ctx, types.NewMsgUnjail(addr)) - require.Error(t, err) - require.Nil(t, res) - require.True(t, errors.Is(types.ErrSelfDelegationTooLowToUnjail, err)) -} - -func TestJailedValidatorDelegations(t *testing.T) { - // initial setup - app := simapp.Setup(false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{Time: time.Unix(0, 0)}) - pks := simapp.CreateTestPubKeys(3) - - simapp.AddTestAddrsFromPubKeys(app, ctx, pks, app.StakingKeeper.TokensFromConsensusPower(ctx, 20)) - app.SlashingKeeper.SetParams(ctx, testslashing.TestParams()) - - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - stakingParams := app.StakingKeeper.GetParams(ctx) - app.StakingKeeper.SetParams(ctx, stakingParams) - valAddr, consAddr := sdk.ValAddress(pks[1].Address()), sdk.ConsAddress(pks[0].Address()) - - amt := tstaking.CreateValidatorWithValPower(valAddr, pks[1], 10, true) - staking.EndBlocker(ctx, app.StakingKeeper) - - // set dummy signing info - newInfo := types.NewValidatorSigningInfo(consAddr, 0, 0, time.Unix(0, 0), false, 0) - app.SlashingKeeper.SetValidatorSigningInfo(ctx, consAddr, newInfo) - - // delegate tokens to the validator - delAddr := sdk.AccAddress(pks[2].Address()) - tstaking.Delegate(delAddr, valAddr, amt) - - // unbond validator total self-delegations (which should jail the validator) - valAcc := sdk.AccAddress(valAddr) - tstaking.Undelegate(valAcc, valAddr, amt, true) - _, err := app.StakingKeeper.CompleteUnbonding(ctx, sdk.AccAddress(valAddr), valAddr) - require.Nil(t, err, "expected complete unbonding validator to be ok, got: %v", err) - - // verify validator still exists and is jailed - validator, found := app.StakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) - require.True(t, validator.IsJailed()) - - // verify the validator cannot unjail itself - res, err := slashing.NewHandler(app.SlashingKeeper)(ctx, types.NewMsgUnjail(valAddr)) - require.Error(t, err) - require.Nil(t, res) - - // self-delegate to validator - tstaking.Delegate(valAcc, valAddr, amt) - - // verify the validator can now unjail itself - res, err = slashing.NewHandler(app.SlashingKeeper)(ctx, types.NewMsgUnjail(valAddr)) - require.NoError(t, err) - require.NotNil(t, res) -} - -func TestInvalidMsg(t *testing.T) { - k := keeper.Keeper{} - h := slashing.NewHandler(k) - - res, err := h(sdk.NewContext(nil, tmproto.Header{}, false, nil), testdata.NewTestMsg()) - require.Error(t, err) - require.Nil(t, res) - require.True(t, strings.Contains(err.Error(), "unrecognized slashing message type")) -} - -// Test a validator through uptime, downtime, revocation, -// unrevocation, starting height reset, and revocation again -func TestHandleAbsentValidator(t *testing.T) { - // initial setup - app := simapp.Setup(false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{Time: time.Unix(0, 0)}) - pks := simapp.CreateTestPubKeys(1) - simapp.AddTestAddrsFromPubKeys(app, ctx, pks, app.StakingKeeper.TokensFromConsensusPower(ctx, 200)) - app.SlashingKeeper.SetParams(ctx, testslashing.TestParams()) - - power := int64(100) - addr, val := sdk.ValAddress(pks[0].Address()), pks[0] - slh := slashing.NewHandler(app.SlashingKeeper) - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - amt := tstaking.CreateValidatorWithValPower(addr, val, power, true) - staking.EndBlocker(ctx, app.StakingKeeper) - - require.Equal( - t, app.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr)), - sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))), - ) - require.Equal(t, amt, app.StakingKeeper.Validator(ctx, addr).GetBondedTokens()) - - // will exist since the validator has been bonded - info, found := app.SlashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(val.Address())) - require.True(t, found) - require.Equal(t, int64(0), info.StartHeight) - require.Equal(t, int64(0), info.IndexOffset) - require.Equal(t, int64(0), info.MissedBlocksCounter) - require.Equal(t, time.Unix(0, 0).UTC(), info.JailedUntil) - height := int64(0) - - // 1000 first blocks OK - for ; height < app.SlashingKeeper.SignedBlocksWindow(ctx); height++ { - ctx = ctx.WithBlockHeight(height) - app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), power, true) - } - info, found = app.SlashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(val.Address())) - require.True(t, found) - require.Equal(t, int64(0), info.StartHeight) - require.Equal(t, int64(0), info.MissedBlocksCounter) - - // 500 blocks missed - for ; height < app.SlashingKeeper.SignedBlocksWindow(ctx)+(app.SlashingKeeper.SignedBlocksWindow(ctx)-app.SlashingKeeper.MinSignedPerWindow(ctx)); height++ { - ctx = ctx.WithBlockHeight(height) - app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), power, false) - } - info, found = app.SlashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(val.Address())) - require.True(t, found) - require.Equal(t, int64(0), info.StartHeight) - require.Equal(t, app.SlashingKeeper.SignedBlocksWindow(ctx)-app.SlashingKeeper.MinSignedPerWindow(ctx), info.MissedBlocksCounter) - - // validator should be bonded still - validator, _ := app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(val)) - require.Equal(t, stakingtypes.Bonded, validator.GetStatus()) - - bondPool := app.StakingKeeper.GetBondedPool(ctx) - require.True(sdk.IntEq(t, amt, app.BankKeeper.GetBalance(ctx, bondPool.GetAddress(), app.StakingKeeper.BondDenom(ctx)).Amount)) - - // 501st block missed - ctx = ctx.WithBlockHeight(height) - app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), power, false) - info, found = app.SlashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(val.Address())) - require.True(t, found) - require.Equal(t, int64(0), info.StartHeight) - // counter now reset to zero - require.Equal(t, int64(0), info.MissedBlocksCounter) - - // end block - staking.EndBlocker(ctx, app.StakingKeeper) - - // validator should have been jailed - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(val)) - require.Equal(t, stakingtypes.Unbonding, validator.GetStatus()) - - slashAmt := amt.ToDec().Mul(app.SlashingKeeper.SlashFractionDowntime(ctx)).RoundInt() - - // validator should have been slashed - require.True(t, amt.Sub(slashAmt).Equal(validator.GetTokens())) - - height++ - ctx = ctx.WithBlockHeight(height) - app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), power, false) - info, found = app.SlashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(val.Address())) - require.True(t, found) - require.Equal(t, int64(0), info.StartHeight) - // validator missed block should not be incremented since it is jailed (#11425) - require.Equal(t, int64(0), info.MissedBlocksCounter) - - // end block - staking.EndBlocker(ctx, app.StakingKeeper) - - // validator should not have been slashed any more, since it was already jailed - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(val)) - require.True(t, amt.Sub(slashAmt).Equal(validator.GetTokens())) - - // unrevocation should fail prior to jail expiration - res, err := slh(ctx, types.NewMsgUnjail(addr)) - require.Error(t, err) - require.Nil(t, res) - - // unrevocation should succeed after jail expiration - ctx = ctx.WithBlockHeader(tmproto.Header{Time: time.Unix(1, 0).Add(app.SlashingKeeper.DowntimeJailDuration(ctx))}) - res, err = slh(ctx, types.NewMsgUnjail(addr)) - require.NoError(t, err) - require.NotNil(t, res) - - // end block - staking.EndBlocker(ctx, app.StakingKeeper) - - // validator should be rebonded now - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(val)) - require.Equal(t, stakingtypes.Bonded, validator.GetStatus()) - - // validator should have been slashed - require.True(t, amt.Sub(slashAmt).Equal(app.BankKeeper.GetBalance(ctx, bondPool.GetAddress(), app.StakingKeeper.BondDenom(ctx)).Amount)) - - // Validator start height should not have been changed - info, found = app.SlashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(val.Address())) - require.True(t, found) - require.Equal(t, int64(0), info.StartHeight) - // validator missed block should not have been changed - require.Equal(t, int64(0), info.MissedBlocksCounter) - - // validator should not be immediately jailed again - height++ - ctx = ctx.WithBlockHeight(height) - app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), power, false) - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(val)) - require.Equal(t, stakingtypes.Bonded, validator.GetStatus()) - - // 500 signed blocks - nextHeight := height + app.SlashingKeeper.MinSignedPerWindow(ctx) + 1 - for ; height < nextHeight; height++ { - ctx = ctx.WithBlockHeight(height) - app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), power, false) - } - - // end block - staking.EndBlocker(ctx, app.StakingKeeper) - - // validator should be jailed again after 500 unsigned blocks - nextHeight = height + app.SlashingKeeper.MinSignedPerWindow(ctx) + 1 - for ; height <= nextHeight; height++ { - ctx = ctx.WithBlockHeight(height) - app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), power, false) - } - - // end block - staking.EndBlocker(ctx, app.StakingKeeper) - - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(val)) - require.Equal(t, stakingtypes.Unbonding, validator.GetStatus()) -} diff --git a/x/slashing/keeper/genesis.go b/x/slashing/keeper/genesis.go new file mode 100644 index 00000000000..480a3b31a11 --- /dev/null +++ b/x/slashing/keeper/genesis.go @@ -0,0 +1,72 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/cosmos-sdk/x/slashing/types" +) + +// InitGenesis initialize default parameters +// and the keeper's address to pubkey map +func (keeper Keeper) InitGenesis(ctx sdk.Context, stakingKeeper types.StakingKeeper, data *types.GenesisState) { + stakingKeeper.IterateValidators(ctx, + func(index int64, validator sdkstaking.ValidatorI) bool { + consPk, err := validator.ConsPubKey() + if err != nil { + panic(err) + } + err = keeper.AddPubkey(ctx, consPk) + if err != nil { + panic(err) + } + return false + }, + ) + + for _, info := range data.SigningInfos { + address, err := sdk.ConsAddressFromBech32(info.Address) + if err != nil { + panic(err) + } + keeper.SetValidatorSigningInfo(ctx, address, info.ValidatorSigningInfo) + } + + for _, array := range data.MissedBlocks { + address, err := sdk.ConsAddressFromBech32(array.Address) + if err != nil { + panic(err) + } + for _, missed := range array.MissedBlocks { + keeper.SetValidatorMissedBlockBitArray(ctx, address, missed.Index, missed.Missed) + } + } + + keeper.SetParams(ctx, data.Params) +} + +// ExportGenesis writes the current store values +// to a genesis file, which can be imported again +// with InitGenesis +func (keeper Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState) { + params := keeper.GetParams(ctx) + signingInfos := make([]types.SigningInfo, 0) + missedBlocks := make([]types.ValidatorMissedBlocks, 0) + keeper.IterateValidatorSigningInfos(ctx, func(address sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool) { + bechAddr := address.String() + signingInfos = append(signingInfos, types.SigningInfo{ + Address: bechAddr, + ValidatorSigningInfo: info, + }) + + localMissedBlocks := keeper.GetValidatorMissedBlocks(ctx, address) + + missedBlocks = append(missedBlocks, types.ValidatorMissedBlocks{ + Address: bechAddr, + MissedBlocks: localMissedBlocks, + }) + + return false + }) + + return types.NewGenesisState(params, signingInfos, missedBlocks) +} diff --git a/x/slashing/keeper/hooks.go b/x/slashing/keeper/hooks.go index fdcc7814adf..e6cc3cbecc4 100644 --- a/x/slashing/keeper/hooks.go +++ b/x/slashing/keeper/hooks.go @@ -9,11 +9,13 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing/types" ) -func (k Keeper) AfterValidatorBonded(ctx sdk.Context, address sdk.ConsAddress, _ sdk.ValAddress) { +func (k Keeper) AfterValidatorBonded(ctx sdk.Context, address sdk.ConsAddress, _ sdk.ValAddress) error { // Update the signing info start height or create a new signing info - _, found := k.GetValidatorSigningInfo(ctx, address) - if !found { - signingInfo := types.NewValidatorSigningInfo( + signingInfo, found := k.GetValidatorSigningInfo(ctx, address) + if found { + signingInfo.StartHeight = ctx.BlockHeight() + } else { + signingInfo = types.NewValidatorSigningInfo( address, ctx.BlockHeight(), 0, @@ -21,8 +23,11 @@ func (k Keeper) AfterValidatorBonded(ctx sdk.Context, address sdk.ConsAddress, _ false, 0, ) - k.SetValidatorSigningInfo(ctx, address, signingInfo) } + + k.SetValidatorSigningInfo(ctx, address, signingInfo) + + return nil } // AfterValidatorCreated adds the address-pubkey relation when a validator is created. @@ -32,14 +37,14 @@ func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) e if err != nil { return err } - k.AddPubkey(ctx, consPk) - return nil + return k.AddPubkey(ctx, consPk) } // AfterValidatorRemoved deletes the address-pubkey relation when a validator is removed, -func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, address sdk.ConsAddress) { +func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, address sdk.ConsAddress) error { k.deleteAddrPubkeyRelation(ctx, crypto.Address(address)) + return nil } // Hooks wrapper struct for slashing keeper @@ -47,7 +52,6 @@ type Hooks struct { k Keeper } -// Implements StakingHooks interface var _ types.StakingHooks = Hooks{} // Return the wrapper struct @@ -56,27 +60,49 @@ func (k Keeper) Hooks() Hooks { } // Implements sdk.ValidatorHooks -func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { - h.k.AfterValidatorBonded(ctx, consAddr, valAddr) +func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return h.k.AfterValidatorBonded(ctx, consAddr, valAddr) } // Implements sdk.ValidatorHooks -func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, _ sdk.ValAddress) { - h.k.AfterValidatorRemoved(ctx, consAddr) +func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, _ sdk.ValAddress) error { + return h.k.AfterValidatorRemoved(ctx, consAddr) } // Implements sdk.ValidatorHooks -func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { - h.k.AfterValidatorCreated(ctx, valAddr) -} - -func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) {} -func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) {} -func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) {} -func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) {} -func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) {} -func (h Hooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) {} -func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ sdk.Dec) {} -func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error { +func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { + return h.k.AfterValidatorCreated(ctx, valAddr) +} + +// Implements sdk.ValidatorHooks - just addition to fulfill the staking hook interface +func (h Hooks) BeforeTokenizeShareRecordRemoved(_ sdk.Context, _ uint64) error { + return nil +} + +func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ sdk.Dec) error { return nil } diff --git a/x/slashing/keeper/infractions.go b/x/slashing/keeper/infractions.go index 509448b3550..a31696f66da 100644 --- a/x/slashing/keeper/infractions.go +++ b/x/slashing/keeper/infractions.go @@ -5,23 +5,21 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // HandleValidatorSignature handles a validator signature, must be called once per validator per block. func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Address, power int64, signed bool) { + logger := k.Logger(ctx) + height := ctx.BlockHeight() + // fetch the validator public key consAddr := sdk.ConsAddress(addr) - - // don't update missed blocks when validator's jailed - if k.sk.IsValidatorJailed(ctx, consAddr) { - return + if _, err := k.GetPubkey(ctx, addr); err != nil { + panic(fmt.Sprintf("Validator consensus-address %s not found", consAddr)) } - logger := k.Logger(ctx) - height := ctx.BlockHeight() - // fetch signing info signInfo, found := k.GetValidatorSigningInfo(ctx, consAddr) if !found { @@ -38,7 +36,6 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre // That way we avoid needing to read/write the whole array each time previous := k.GetValidatorMissedBlockBitArray(ctx, consAddr, index) missed := !signed - switch { case !previous && missed: // Array value has changed from not missed to missed, increment counter @@ -79,7 +76,7 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre // if we are past the minimum height and the validator has missed too many blocks, punish them if height > minHeight && signInfo.MissedBlocksCounter > maxMissed { validator := k.sk.ValidatorByConsAddr(ctx, consAddr) - if validator != nil { + if validator != nil && !validator.IsJailed() { // Downtime confirmed: slash and jail the validator // We need to retrieve the stake distribution which signed the block, so we subtract ValidatorUpdateDelay from the evidence height, // and subtract an additional 1 since this is the LastCommit. @@ -87,6 +84,7 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre // i.e. at the end of the pre-genesis block (none) = at the beginning of the genesis block. // That's fine since this is just used to filter unbonding delegations & redelegations. distributionHeight := height - sdk.ValidatorUpdateDelay - 1 + ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeSlash, @@ -96,7 +94,8 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre sdk.NewAttribute(types.AttributeKeyJailed, consAddr.String()), ), ) - k.sk.Slash(ctx, consAddr, distributionHeight, power, k.SlashFractionDowntime(ctx), stakingtypes.Downtime) + k.sk.Slash(ctx, consAddr, distributionHeight, power, k.SlashFractionDowntime(ctx), sdkstaking.Downtime) + k.sk.Jail(ctx, consAddr) signInfo.JailedUntil = ctx.BlockHeader().Time.Add(k.DowntimeJailDuration(ctx)) diff --git a/x/slashing/keeper/keeper_test.go b/x/slashing/keeper/keeper_test.go index 2e7e727a269..7e7193dac78 100644 --- a/x/slashing/keeper/keeper_test.go +++ b/x/slashing/keeper/keeper_test.go @@ -15,67 +15,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -func TestUnJailNotBonded(t *testing.T) { - app := simapp.Setup(false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - - p := app.StakingKeeper.GetParams(ctx) - p.MaxValidators = 5 - app.StakingKeeper.SetParams(ctx, p) - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 6, app.StakingKeeper.TokensFromConsensusPower(ctx, 200)) - valAddrs := simapp.ConvertAddrsToValAddrs(addrDels) - pks := simapp.CreateTestPubKeys(6) - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // create max (5) validators all with the same power - for i := uint32(0); i < p.MaxValidators; i++ { - addr, val := valAddrs[i], pks[i] - tstaking.CreateValidatorWithValPower(addr, val, 100, true) - } - - staking.EndBlocker(ctx, app.StakingKeeper) - ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - - // create a 6th validator with less power than the cliff validator (won't be bonded) - addr, val := valAddrs[5], pks[5] - amt := app.StakingKeeper.TokensFromConsensusPower(ctx, 50) - msg := tstaking.CreateValidatorMsg(addr, val, amt) - msg.MinSelfDelegation = amt - tstaking.Handle(msg, true) - - staking.EndBlocker(ctx, app.StakingKeeper) - ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - - tstaking.CheckValidator(addr, stakingtypes.Unbonded, false) - - // unbond below minimum self-delegation - require.Equal(t, p.BondDenom, tstaking.Denom) - tstaking.Undelegate(sdk.AccAddress(addr), addr, app.StakingKeeper.TokensFromConsensusPower(ctx, 1), true) - - staking.EndBlocker(ctx, app.StakingKeeper) - ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - - // verify that validator is jailed - tstaking.CheckValidator(addr, -1, true) - - // verify we cannot unjail (yet) - require.Error(t, app.SlashingKeeper.Unjail(ctx, addr)) - - staking.EndBlocker(ctx, app.StakingKeeper) - ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - // bond to meet minimum self-delegation - tstaking.DelegateWithPower(sdk.AccAddress(addr), addr, 1) - - staking.EndBlocker(ctx, app.StakingKeeper) - ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - - // verify we can immediately unjail - require.NoError(t, app.SlashingKeeper.Unjail(ctx, addr)) - - tstaking.CheckValidator(addr, -1, false) -} - // Test a new validator entering the validator set // Ensure that SigningInfo.StartHeight is set correctly // and that they are not immediately jailed @@ -177,7 +116,7 @@ func TestHandleAlreadyJailed(t *testing.T) { func TestValidatorDippingInAndOut(t *testing.T) { // initial setup // TestParams set the SignedBlocksWindow to 1000 and MaxMissedBlocksPerWindow to 500 - app := simapp.Setup(false) + app := simapp.SetupWithValSet(t, false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) app.SlashingKeeper.SetParams(ctx, testslashing.TestParams()) @@ -195,7 +134,9 @@ func TestValidatorDippingInAndOut(t *testing.T) { valAddr := sdk.ValAddress(addr) tstaking.CreateValidatorWithValPower(valAddr, val, power, true) - staking.EndBlocker(ctx, app.StakingKeeper) + validatorUpdates := staking.EndBlocker(ctx, app.StakingKeeper) + require.Equal(t, 2, len(validatorUpdates)) + tstaking.CheckValidator(valAddr, stakingtypes.Bonded, false) // 100 first blocks OK height := int64(0) @@ -205,22 +146,23 @@ func TestValidatorDippingInAndOut(t *testing.T) { } // kick first validator out of validator set - tstaking.CreateValidatorWithValPower(sdk.ValAddress(pks[1].Address()), pks[1], 101, true) - validatorUpdates := staking.EndBlocker(ctx, app.StakingKeeper) + tstaking.CreateValidatorWithValPower(sdk.ValAddress(pks[1].Address()), pks[1], power+1, true) + validatorUpdates = staking.EndBlocker(ctx, app.StakingKeeper) require.Equal(t, 2, len(validatorUpdates)) + tstaking.CheckValidator(sdk.ValAddress(pks[1].Address()), stakingtypes.Bonded, false) tstaking.CheckValidator(valAddr, stakingtypes.Unbonding, false) // 600 more blocks happened - height = 700 + height += 600 ctx = ctx.WithBlockHeight(height) // validator added back in - tstaking.DelegateWithPower(sdk.AccAddress(pks[2].Address()), sdk.ValAddress(pks[0].Address()), 50) + tstaking.DelegateWithPower(sdk.AccAddress(pks[2].Address()), valAddr, 50) validatorUpdates = staking.EndBlocker(ctx, app.StakingKeeper) require.Equal(t, 2, len(validatorUpdates)) tstaking.CheckValidator(valAddr, stakingtypes.Bonded, false) - newPower := int64(150) + newPower := power + 50 // validator misses a block app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), newPower, false) @@ -229,9 +171,9 @@ func TestValidatorDippingInAndOut(t *testing.T) { // shouldn't be jailed/kicked yet tstaking.CheckValidator(valAddr, stakingtypes.Bonded, false) - // validator misses 500 more blocks, 501 total - latest := height - for ; height < latest+500; height++ { + // validator misses an additional 500 more blocks, after the cooling off period of SignedBlockWindow (here 1000 blocks). + latest := app.SlashingKeeper.SignedBlocksWindow(ctx) + height + for ; height < latest+app.SlashingKeeper.MinSignedPerWindow(ctx); height++ { ctx = ctx.WithBlockHeight(height) app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), newPower, false) } @@ -243,14 +185,9 @@ func TestValidatorDippingInAndOut(t *testing.T) { // check all the signing information signInfo, found := app.SlashingKeeper.GetValidatorSigningInfo(ctx, consAddr) require.True(t, found) - require.Equal(t, int64(0), signInfo.MissedBlocksCounter) - require.Equal(t, int64(0), signInfo.IndexOffset) - - // array should be cleared - for offset := int64(0); offset < app.SlashingKeeper.SignedBlocksWindow(ctx); offset++ { - missed := app.SlashingKeeper.GetValidatorMissedBlockBitArray(ctx, consAddr, offset) - require.False(t, missed) - } + require.Equal(t, int64(700), signInfo.StartHeight) + require.Equal(t, int64(499), signInfo.MissedBlocksCounter) + require.Equal(t, int64(499), signInfo.IndexOffset) // some blocks pass height = int64(5000) @@ -258,16 +195,21 @@ func TestValidatorDippingInAndOut(t *testing.T) { // validator rejoins and starts signing again app.StakingKeeper.Unjail(ctx, consAddr) + app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), newPower, true) - height++ // validator should not be kicked since we reset counter/array when it was jailed staking.EndBlocker(ctx, app.StakingKeeper) tstaking.CheckValidator(valAddr, stakingtypes.Bonded, false) - // validator misses 501 blocks - latest = height - for ; height < latest+501; height++ { + // check start height is correctly set + signInfo, found = app.SlashingKeeper.GetValidatorSigningInfo(ctx, consAddr) + require.True(t, found) + require.Equal(t, height, signInfo.StartHeight) + + // validator misses 501 blocks after SignedBlockWindow period (1000 blocks) + latest = app.SlashingKeeper.SignedBlocksWindow(ctx) + height + for ; height < latest+app.SlashingKeeper.MinSignedPerWindow(ctx); height++ { ctx = ctx.WithBlockHeight(height) app.SlashingKeeper.HandleValidatorSignature(ctx, val.Address(), newPower, false) } diff --git a/x/slashing/keeper/migrations.go b/x/slashing/keeper/migrations.go index 84f19c01ab7..ea1dba047b7 100644 --- a/x/slashing/keeper/migrations.go +++ b/x/slashing/keeper/migrations.go @@ -2,7 +2,6 @@ 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. @@ -16,6 +15,6 @@ func NewMigrator(keeper Keeper) Migrator { } // Migrate1to2 migrates from version 1 to 2. -func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v043.MigrateStore(ctx, m.keeper.storeKey) +func (m Migrator) Migrate1to2(_ sdk.Context) error { + return nil } diff --git a/x/slashing/legacy/v039/types.go b/x/slashing/legacy/v039/types.go deleted file mode 100644 index 1261861e81a..00000000000 --- a/x/slashing/legacy/v039/types.go +++ /dev/null @@ -1,78 +0,0 @@ -package v039 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - ModuleName = "slashing" -) - -// Default parameter namespace -const ( - DefaultParamspace = ModuleName - DefaultSignedBlocksWindow = int64(100) - DefaultDowntimeJailDuration = 60 * 10 * time.Second -) - -var ( - DefaultMinSignedPerWindow = sdk.NewDecWithPrec(5, 1) - DefaultSlashFractionDoubleSign = sdk.NewDec(1).Quo(sdk.NewDec(20)) - DefaultSlashFractionDowntime = sdk.NewDec(1).Quo(sdk.NewDec(100)) -) - -// Params - used for initializing default parameter for slashing at genesis -type Params struct { - SignedBlocksWindow int64 `json:"signed_blocks_window" yaml:"signed_blocks_window"` - MinSignedPerWindow sdk.Dec `json:"min_signed_per_window" yaml:"min_signed_per_window"` - DowntimeJailDuration time.Duration `json:"downtime_jail_duration" yaml:"downtime_jail_duration"` - SlashFractionDoubleSign sdk.Dec `json:"slash_fraction_double_sign" yaml:"slash_fraction_double_sign"` - SlashFractionDowntime sdk.Dec `json:"slash_fraction_downtime" yaml:"slash_fraction_downtime"` -} - -// NewParams creates a new Params object -func NewParams( - signedBlocksWindow int64, minSignedPerWindow sdk.Dec, downtimeJailDuration time.Duration, - slashFractionDoubleSign, slashFractionDowntime sdk.Dec, -) Params { - return Params{ - SignedBlocksWindow: signedBlocksWindow, - MinSignedPerWindow: minSignedPerWindow, - DowntimeJailDuration: downtimeJailDuration, - SlashFractionDoubleSign: slashFractionDoubleSign, - SlashFractionDowntime: slashFractionDowntime, - } -} - -// DefaultParams defines the parameters for this module -func DefaultParams() Params { - return NewParams( - DefaultSignedBlocksWindow, DefaultMinSignedPerWindow, DefaultDowntimeJailDuration, - DefaultSlashFractionDoubleSign, DefaultSlashFractionDowntime, - ) -} - -// ValidatorSigningInfo defines the signing info for a validator -type ValidatorSigningInfo struct { - Address sdk.ConsAddress `json:"address" yaml:"address"` // validator consensus address - StartHeight int64 `json:"start_height" yaml:"start_height"` // height at which validator was first a candidate OR was unjailed - IndexOffset int64 `json:"index_offset" yaml:"index_offset"` // index offset into signed block bit array - JailedUntil time.Time `json:"jailed_until" yaml:"jailed_until"` // timestamp validator cannot be unjailed until - Tombstoned bool `json:"tombstoned" yaml:"tombstoned"` // whether or not a validator has been tombstoned (killed out of validator set) - MissedBlocksCounter int64 `json:"missed_blocks_counter" yaml:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time) -} - -// MissedBlock -type MissedBlock struct { - Index int64 `json:"index" yaml:"index"` - Missed bool `json:"missed" yaml:"missed"` -} - -// GenesisState - all slashing state that must be provided at genesis -type GenesisState struct { - Params Params `json:"params" yaml:"params"` - SigningInfos map[string]ValidatorSigningInfo `json:"signing_infos" yaml:"signing_infos"` - MissedBlocks map[string][]MissedBlock `json:"missed_blocks" yaml:"missed_blocks"` -} diff --git a/x/slashing/legacy/v040/keys.go b/x/slashing/legacy/v040/keys.go deleted file mode 100644 index e440f438172..00000000000 --- a/x/slashing/legacy/v040/keys.go +++ /dev/null @@ -1,69 +0,0 @@ -// Package v040 is copy-pasted from: -// https://github.com/cosmos/cosmos-sdk/blob/v0.41.0/x/slashing/types/keys.go -package v040 - -import ( - "encoding/binary" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" - v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" -) - -const ( - // ModuleName is the name of the module - ModuleName = "slashing" - - // StoreKey is the store key string for slashing - StoreKey = ModuleName - - // RouterKey is the message route for slashing - RouterKey = ModuleName - - // QuerierRoute is the querier route for slashing - QuerierRoute = ModuleName -) - -// Keys for slashing store -// Items are stored with the following key: values -// -// - 0x01: ValidatorSigningInfo -// -// - 0x02: bool -// -// - 0x03: crypto.PubKey -var ( - ValidatorSigningInfoKeyPrefix = []byte{0x01} // Prefix for signing info - ValidatorMissedBlockBitArrayKeyPrefix = []byte{0x02} // Prefix for missed block bit array - AddrPubkeyRelationKeyPrefix = []byte{0x03} // Prefix for address-pubkey relation -) - -// ValidatorSigningInfoKey - stored by *Consensus* address (not operator address) -func ValidatorSigningInfoKey(v sdk.ConsAddress) []byte { - return append(ValidatorSigningInfoKeyPrefix, v.Bytes()...) -} - -// ValidatorSigningInfoAddress - extract the address from a validator signing info key -func ValidatorSigningInfoAddress(key []byte) (v sdk.ConsAddress) { - kv.AssertKeyAtLeastLength(key, 2) - addr := key[1:] - kv.AssertKeyLength(addr, v040auth.AddrLen) - return sdk.ConsAddress(addr) -} - -// ValidatorMissedBlockBitArrayPrefixKey - stored by *Consensus* address (not operator address) -func ValidatorMissedBlockBitArrayPrefixKey(v sdk.ConsAddress) []byte { - return append(ValidatorMissedBlockBitArrayKeyPrefix, v.Bytes()...) -} - -// ValidatorMissedBlockBitArrayKey - stored by *Consensus* address (not operator address) -func ValidatorMissedBlockBitArrayKey(v sdk.ConsAddress, i int64) []byte { - b := make([]byte, 8) - binary.LittleEndian.PutUint64(b, uint64(i)) - return append(ValidatorMissedBlockBitArrayPrefixKey(v), b...) -} - -// AddrPubkeyRelationKey gets pubkey relation key used to get the pubkey from the address -func AddrPubkeyRelationKey(address []byte) []byte { - return append(AddrPubkeyRelationKeyPrefix, address...) -} diff --git a/x/slashing/legacy/v040/migrate.go b/x/slashing/legacy/v040/migrate.go deleted file mode 100644 index d8a4c124e2e..00000000000 --- a/x/slashing/legacy/v040/migrate.go +++ /dev/null @@ -1,64 +0,0 @@ -package v040 - -import ( - "sort" - - v039slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v039" - v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/types" -) - -// Migrate accepts exported x/slashing genesis state from v0.39 and migrates it -// to v0.40 x/slashing genesis state. The migration includes: -// -// - Chaning SigningInfos and MissedBlocks from map to array. -// - Convert addresses from bytes to bech32 strings. -// - Re-encode in v0.40 GenesisState. -func Migrate(oldGenState v039slashing.GenesisState) *v040slashing.GenesisState { - // Note that the two following `for` loop over a map's keys, so are not - // deterministic. - newSigningInfos := make([]v040slashing.SigningInfo, 0, len(oldGenState.SigningInfos)) - for address, signingInfo := range oldGenState.SigningInfos { - newSigningInfos = append(newSigningInfos, v040slashing.SigningInfo{ - Address: address, - ValidatorSigningInfo: v040slashing.ValidatorSigningInfo{ - Address: signingInfo.Address.String(), - StartHeight: signingInfo.StartHeight, - IndexOffset: signingInfo.IndexOffset, - JailedUntil: signingInfo.JailedUntil, - Tombstoned: signingInfo.Tombstoned, - MissedBlocksCounter: signingInfo.MissedBlocksCounter, - }, - }) - } - newValidatorMissedBlocks := make([]v040slashing.ValidatorMissedBlocks, 0, len(oldGenState.MissedBlocks)) - for address, validatorMissedBlocks := range oldGenState.MissedBlocks { - newMissedBlocks := make([]v040slashing.MissedBlock, len(validatorMissedBlocks)) - for i, missedBlock := range validatorMissedBlocks { - newMissedBlocks[i] = v040slashing.MissedBlock{ - Index: missedBlock.Index, - Missed: missedBlock.Missed, - } - } - - newValidatorMissedBlocks = append(newValidatorMissedBlocks, v040slashing.ValidatorMissedBlocks{ - Address: address, - MissedBlocks: newMissedBlocks, - }) - } - - // We sort these two arrays by address, so that we get determinstic states. - sort.Slice(newSigningInfos, func(i, j int) bool { return newSigningInfos[i].Address < newSigningInfos[j].Address }) - sort.Slice(newValidatorMissedBlocks, func(i, j int) bool { return newValidatorMissedBlocks[i].Address < newValidatorMissedBlocks[j].Address }) - - return &v040slashing.GenesisState{ - Params: v040slashing.Params{ - SignedBlocksWindow: oldGenState.Params.SignedBlocksWindow, - MinSignedPerWindow: oldGenState.Params.MinSignedPerWindow, - DowntimeJailDuration: oldGenState.Params.DowntimeJailDuration, - SlashFractionDoubleSign: oldGenState.Params.SlashFractionDoubleSign, - SlashFractionDowntime: oldGenState.Params.SlashFractionDowntime, - }, - SigningInfos: newSigningInfos, - MissedBlocks: newValidatorMissedBlocks, - } -} diff --git a/x/slashing/legacy/v040/migrate_test.go b/x/slashing/legacy/v040/migrate_test.go deleted file mode 100644 index f11d2e9d26e..00000000000 --- a/x/slashing/legacy/v040/migrate_test.go +++ /dev/null @@ -1,140 +0,0 @@ -package v040_test - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - v039slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v039" - v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v040" -) - -func TestMigrate(t *testing.T) { - encodingConfig := simapp.MakeTestEncodingConfig() - clientCtx := client.Context{}. - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithJSONCodec(encodingConfig.Marshaler) - - addr1, err := sdk.ConsAddressFromBech32("cosmosvalcons104cjmxkrg8y8lmrp25de02e4zf00zle4mzs685") - require.NoError(t, err) - addr2, err := sdk.ConsAddressFromBech32("cosmosvalcons10e4c5p6qk0sycy9u6u43t7csmlx9fyadr9yxph") - require.NoError(t, err) - - gs := v039slashing.GenesisState{ - Params: v039slashing.DefaultParams(), - SigningInfos: map[string]v039slashing.ValidatorSigningInfo{ - "cosmosvalcons10e4c5p6qk0sycy9u6u43t7csmlx9fyadr9yxph": { - Address: addr2, - IndexOffset: 615501, - MissedBlocksCounter: 1, - Tombstoned: false, - }, - "cosmosvalcons104cjmxkrg8y8lmrp25de02e4zf00zle4mzs685": { - Address: addr1, - IndexOffset: 2, - MissedBlocksCounter: 2, - Tombstoned: false, - }, - }, - MissedBlocks: map[string][]v039slashing.MissedBlock{ - "cosmosvalcons10e4c5p6qk0sycy9u6u43t7csmlx9fyadr9yxph": { - { - Index: 2, - Missed: true, - }, - }, - "cosmosvalcons104cjmxkrg8y8lmrp25de02e4zf00zle4mzs685": { - { - Index: 3, - Missed: true, - }, - { - Index: 4, - Missed: true, - }, - }, - }, - } - - migrated := v040slashing.Migrate(gs) - // Check that in `signing_infos` and `missed_blocks`, the address - // cosmosvalcons104cjmxkrg8y8lmrp25de02e4zf00zle4mzs685 - // should always come before the address - // cosmosvalcons10e4c5p6qk0sycy9u6u43t7csmlx9fyadr9yxph - // (in alphabetic order, basically). - expected := `{ - "missed_blocks": [ - { - "address": "cosmosvalcons104cjmxkrg8y8lmrp25de02e4zf00zle4mzs685", - "missed_blocks": [ - { - "index": "3", - "missed": true - }, - { - "index": "4", - "missed": true - } - ] - }, - { - "address": "cosmosvalcons10e4c5p6qk0sycy9u6u43t7csmlx9fyadr9yxph", - "missed_blocks": [ - { - "index": "2", - "missed": true - } - ] - } - ], - "params": { - "downtime_jail_duration": "600s", - "min_signed_per_window": "0.500000000000000000", - "signed_blocks_window": "100", - "slash_fraction_double_sign": "0.050000000000000000", - "slash_fraction_downtime": "0.010000000000000000" - }, - "signing_infos": [ - { - "address": "cosmosvalcons104cjmxkrg8y8lmrp25de02e4zf00zle4mzs685", - "validator_signing_info": { - "address": "cosmosvalcons104cjmxkrg8y8lmrp25de02e4zf00zle4mzs685", - "index_offset": "2", - "jailed_until": "0001-01-01T00:00:00Z", - "missed_blocks_counter": "2", - "start_height": "0", - "tombstoned": false - } - }, - { - "address": "cosmosvalcons10e4c5p6qk0sycy9u6u43t7csmlx9fyadr9yxph", - "validator_signing_info": { - "address": "cosmosvalcons10e4c5p6qk0sycy9u6u43t7csmlx9fyadr9yxph", - "index_offset": "615501", - "jailed_until": "0001-01-01T00:00:00Z", - "missed_blocks_counter": "1", - "start_height": "0", - "tombstoned": false - } - } - ] -}` - - bz, err := clientCtx.Codec.MarshalJSON(migrated) - require.NoError(t, err) - - // Indent the JSON bz correctly. - var jsonObj map[string]interface{} - err = json.Unmarshal(bz, &jsonObj) - require.NoError(t, err) - indentedBz, err := json.MarshalIndent(jsonObj, "", " ") - require.NoError(t, err) - - require.Equal(t, expected, string(indentedBz)) -} diff --git a/x/slashing/legacy/v043/store.go b/x/slashing/legacy/v043/store.go deleted file mode 100644 index daee1d3fc15..00000000000 --- a/x/slashing/legacy/v043/store.go +++ /dev/null @@ -1,20 +0,0 @@ -package v043 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - v043distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" - v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v040" -) - -// MigrateStore performs in-place store migrations from v0.40 to v0.43. The -// migration includes: -// -// - Change addresses to be length-prefixed. -func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error { - store := ctx.KVStore(storeKey) - v043distribution.MigratePrefixAddress(store, v040slashing.ValidatorSigningInfoKeyPrefix) - v043distribution.MigratePrefixAddressBytes(store, v040slashing.ValidatorMissedBlockBitArrayKeyPrefix) - v043distribution.MigratePrefixAddress(store, v040slashing.AddrPubkeyRelationKeyPrefix) - - return nil -} diff --git a/x/slashing/legacy/v043/store_test.go b/x/slashing/legacy/v043/store_test.go deleted file mode 100644 index a31b1cd65b3..00000000000 --- a/x/slashing/legacy/v043/store_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package v043_test - -import ( - "bytes" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v040" - v043slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v043" - "github.com/cosmos/cosmos-sdk/x/slashing/types" -) - -func TestStoreMigration(t *testing.T) { - slashingKey := sdk.NewKVStoreKey("slashing") - ctx := testutil.DefaultContext(slashingKey, sdk.NewTransientStoreKey("transient_test")) - store := ctx.KVStore(slashingKey) - - _, _, addr1 := testdata.KeyTestPubAddr() - consAddr := sdk.ConsAddress(addr1) - // Use dummy value for all keys. - value := []byte("foo") - - testCases := []struct { - name string - oldKey []byte - newKey []byte - }{ - { - "ValidatorSigningInfoKey", - v040slashing.ValidatorSigningInfoKey(consAddr), - types.ValidatorSigningInfoKey(consAddr), - }, - { - "ValidatorMissedBlockBitArrayKey", - v040slashing.ValidatorMissedBlockBitArrayKey(consAddr, 2), - types.ValidatorMissedBlockBitArrayKey(consAddr, 2), - }, - { - "AddrPubkeyRelationKey", - v040slashing.AddrPubkeyRelationKey(consAddr), - types.AddrPubkeyRelationKey(consAddr), - }, - } - - // Set all the old keys to the store - for _, tc := range testCases { - store.Set(tc.oldKey, value) - } - - // Run migrations. - err := v043slashing.MigrateStore(ctx, slashingKey) - require.NoError(t, err) - - // Make sure the new keys are set and old keys are deleted. - for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - if !bytes.Equal(tc.oldKey, tc.newKey) { - require.Nil(t, store.Get(tc.oldKey)) - } - require.Equal(t, value, store.Get(tc.newKey)) - }) - } -} diff --git a/x/slashing/module.go b/x/slashing/module.go index 22c57dddf39..7c238b9bb73 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -6,11 +6,9 @@ import ( "fmt" "math/rand" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "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" @@ -20,10 +18,10 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" - "github.com/cosmos/cosmos-sdk/x/slashing/client/rest" "github.com/cosmos/cosmos-sdk/x/slashing/keeper" "github.com/cosmos/cosmos-sdk/x/slashing/simulation" "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) var ( @@ -61,7 +59,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the slashing module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -71,13 +69,15 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the REST routes for the slashing module. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterHandlers(clientCtx, rtr) -} +// Deprecated: RegisterRESTRoutes is deprecated. `x/slashing` legacy REST implementation +// has been removed from the SDK. +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the slashig module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root tx command for the slashing module. @@ -97,11 +97,11 @@ type AppModule struct { keeper keeper.Keeper accountKeeper types.AccountKeeper bankKeeper types.BankKeeper - stakingKeeper types.StakingKeeper + stakingKeeper stakingkeeper.Keeper } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper) AppModule { +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, sk stakingkeeper.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, @@ -119,9 +119,9 @@ func (AppModule) Name() string { // RegisterInvariants registers the slashing module invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// Route returns the message routing key for the slashing module. +// Deprecated: Route returns the message routing key for the slashing module. func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) + return sdk.Route{} } // QuerierRoute returns the slashing module's querier route name. @@ -140,7 +140,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := keeper.NewMigrator(am.keeper) - cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + if err != nil { + panic(err) + } } // InitGenesis performs genesis initialization for the slashing module. It returns @@ -148,14 +151,14 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { 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.stakingKeeper, &genesisState) + am.keeper.InitGenesis(ctx, am.stakingKeeper, &genesisState) return []abci.ValidatorUpdate{} } // ExportGenesis returns the exported genesis state as raw bytes for the slashing // module. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := ExportGenesis(ctx, am.keeper) + gs := am.keeper.ExportGenesis(ctx) return cdc.MustMarshalJSON(gs) } @@ -167,6 +170,12 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, req, am.keeper) } +// EndBlock returns the end blocker for the slashing module. It returns no validator +// updates. +func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} + // AppModuleSimulation functions // GenerateGenesisState creates a randomized GenState of the slashing module. @@ -175,7 +184,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return nil } diff --git a/x/slashing/simulation/operations_test.go b/x/slashing/simulation/operations_test.go index ea58a6e67c8..20b23a5a4ae 100644 --- a/x/slashing/simulation/operations_test.go +++ b/x/slashing/simulation/operations_test.go @@ -81,7 +81,7 @@ func TestSimulateMsgUnjail(t *testing.T) { validator0, issuedShares := validator0.AddTokensFromDel(delTokens) val0AccAddress, err := sdk.ValAddressFromBech32(validator0.OperatorAddress) require.NoError(t, err) - selfDelegation := stakingtypes.NewDelegation(val0AccAddress.Bytes(), validator0.GetOperator(), issuedShares) + selfDelegation := stakingtypes.NewDelegation(val0AccAddress.Bytes(), validator0.GetOperator(), issuedShares, false) app.StakingKeeper.SetDelegation(ctx, selfDelegation) app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator0.GetOperator(), val0AccAddress.Bytes(), distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200)) diff --git a/x/slashing/types/expected_keepers.go b/x/slashing/types/expected_keepers.go index 18023db66db..2ad537278e7 100644 --- a/x/slashing/types/expected_keepers.go +++ b/x/slashing/types/expected_keepers.go @@ -53,14 +53,12 @@ type StakingKeeper interface { // MaxValidators returns the maximum amount of bonded validators MaxValidators(sdk.Context) uint32 - // return if the validator is jailed - IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool } // StakingHooks event hooks for staking validator object (noalias) type StakingHooks interface { - AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator is created - AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is deleted + AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error // Must be called when a validator is created + AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator is deleted - AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is bonded + AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator is bonded } diff --git a/x/staking/abci.go b/x/staking/abci.go index 28253b5bd3f..a843fffb01d 100644 --- a/x/staking/abci.go +++ b/x/staking/abci.go @@ -17,6 +17,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) k.TrackHistoricalInfo(ctx) + k.RemoveExpiredTokenizeShareLocks(ctx, ctx.BlockTime()) } // Called every block, update validator set diff --git a/x/staking/app_test.go b/x/staking/app_test.go index a011186ca71..e9c38d19194 100644 --- a/x/staking/app_test.go +++ b/x/staking/app_test.go @@ -65,7 +65,7 @@ func TestStakingMsgs(t *testing.T) { // create validator description := types.NewDescription("foo_moniker", "", "", "", "") createValidatorMsg, err := types.NewMsgCreateValidator( - sdk.ValAddress(addr1), valKey.PubKey(), bondCoin, description, commissionRates, sdk.OneInt(), + sdk.ValAddress(addr1), valKey.PubKey(), bondCoin, description, commissionRates, ) require.NoError(t, err) @@ -88,7 +88,7 @@ func TestStakingMsgs(t *testing.T) { // edit the validator description = types.NewDescription("bar_moniker", "", "", "", "") - editValidatorMsg := types.NewMsgEditValidator(sdk.ValAddress(addr1), description, nil, nil) + editValidatorMsg := types.NewMsgEditValidator(sdk.ValAddress(addr1), description, nil) header = tmproto.Header{Height: app.LastBlockHeight() + 1} _, _, err = simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, []sdk.Msg{editValidatorMsg}, "", []uint64{0}, []uint64{1}, true, true, priv1) diff --git a/x/staking/client/cli/tx.go b/x/staking/client/cli/tx.go index 1cd0b70172b..65785f8fee9 100644 --- a/x/staking/client/cli/tx.go +++ b/x/staking/client/cli/tx.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" 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/version" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -117,19 +116,7 @@ func NewEditValidatorCmd() *cobra.Command { newRate = &rate } - var newMinSelfDelegation *sdk.Int - - minSelfDelegationString, _ := cmd.Flags().GetString(FlagMinSelfDelegation) - if minSelfDelegationString != "" { - msb, ok := sdk.NewIntFromString(minSelfDelegationString) - if !ok { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") - } - - newMinSelfDelegation = &msb - } - - msg := types.NewMsgEditValidator(sdk.ValAddress(valAddr), description, newRate, newMinSelfDelegation) + msg := types.NewMsgEditValidator(sdk.ValAddress(valAddr), description, newRate) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, @@ -318,16 +305,8 @@ func newBuildCreateValidatorMsg(clientCtx client.Context, txf tx.Factory, fs *fl return txf, nil, err } - // get the initial validator min self delegation - msbStr, _ := fs.GetString(FlagMinSelfDelegation) - - minSelfDelegation, ok := sdk.NewIntFromString(msbStr) - if !ok { - return txf, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") - } - msg, err := types.NewMsgCreateValidator( - sdk.ValAddress(valAddr), pk, amount, description, commissionRates, minSelfDelegation, + sdk.ValAddress(valAddr), pk, amount, description, commissionRates, ) if err != nil { return txf, nil, err @@ -519,16 +498,8 @@ func BuildCreateValidatorMsg(clientCtx client.Context, config TxCreateValidatorC return txBldr, nil, err } - // get the initial validator min self delegation - msbStr := config.MinSelfDelegation - minSelfDelegation, ok := sdk.NewIntFromString(msbStr) - - if !ok { - return txBldr, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") - } - msg, err := types.NewMsgCreateValidator( - sdk.ValAddress(valAddr), config.PubKey, amount, description, commissionRates, minSelfDelegation, + sdk.ValAddress(valAddr), config.PubKey, amount, description, commissionRates, ) if err != nil { return txBldr, msg, err diff --git a/x/staking/client/rest/grpc_query_test.go b/x/staking/client/rest/grpc_query_test.go deleted file mode 100644 index c53635128ae..00000000000 --- a/x/staking/client/rest/grpc_query_test.go +++ /dev/null @@ -1,828 +0,0 @@ -//go:build norace -// +build norace - -package rest_test - -import ( - "fmt" - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/network" - sdk "github.com/cosmos/cosmos-sdk/types" - grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/staking/client/cli" - stakingtestutil "github.com/cosmos/cosmos-sdk/x/staking/client/testutil" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -type IntegrationTestSuite struct { - suite.Suite - - cfg network.Config - network *network.Network -} - -func (s *IntegrationTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - - cfg := network.DefaultConfig() - cfg.NumValidators = 2 - - s.cfg = cfg - s.network = network.New(s.T(), cfg) - - _, err := s.network.WaitForHeight(1) - s.Require().NoError(err) - - unbond, err := sdk.ParseCoinNormalized("10stake") - s.Require().NoError(err) - - val := s.network.Validators[0] - val2 := s.network.Validators[1] - - // redelegate - _, err = stakingtestutil.MsgRedelegateExec( - val.ClientCtx, - val.Address, - val.ValAddress, - val2.ValAddress, - unbond, - fmt.Sprintf("--%s=%d", flags.FlagGas, 254000), - ) // expected gas is 202987 - - s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) - - // unbonding - _, err = stakingtestutil.MsgUnbondExec(val.ClientCtx, val.Address, val.ValAddress, unbond) - s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) -} - -func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - s.network.Cleanup() -} - -func (s *IntegrationTestSuite) TestQueryValidatorsGRPCHandler() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "test query validators gRPC route with invalid status", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators?status=active", baseURL), - true, - }, - { - "test query validators gRPC route without status query param", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators", baseURL), - false, - }, - { - "test query validators gRPC route with valid status", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators?status=%s", baseURL, types.Bonded.String()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var valRes types.QueryValidatorsResponse - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &valRes) - - if tc.error { - s.Require().Error(err) - s.Require().Nil(valRes.Validators) - s.Require().Equal(0, len(valRes.Validators)) - } else { - s.Require().NoError(err) - s.Require().NotNil(valRes.Validators) - s.Require().Equal(len(s.network.Validators), len(valRes.Validators)) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryValidatorGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s", baseURL, "wrongValidatorAddress"), - true, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s", baseURL, ""), - true, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s", baseURL, val.ValAddress.String()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var validator types.QueryValidatorResponse - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &validator) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().NotNil(validator.Validator) - s.Require().Equal(s.network.Validators[0].ValAddress.String(), validator.Validator.OperatorAddress) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryValidatorDelegationsGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - headers map[string]string - error bool - respType proto.Message - expectedResp proto.Message - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations", baseURL, "wrongValAddress"), - map[string]string{}, - true, - &types.QueryValidatorDelegationsResponse{}, - nil, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations", baseURL, ""), - map[string]string{}, - true, - &types.QueryValidatorDelegationsResponse{}, - nil, - }, - { - "valid request(height specific)", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations", baseURL, val.ValAddress.String()), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - false, - &types.QueryValidatorDelegationsResponse{}, - &types.QueryValidatorDelegationsResponse{ - DelegationResponses: types.DelegationResponses{ - types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)), - }, - Pagination: &query.PageResponse{Total: 1}, - }, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) - s.Require().NoError(err) - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Equal(tc.expectedResp.String(), tc.respType.String()) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryValidatorUnbondingDelegationsGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/unbonding_delegations", baseURL, "wrongValAddress"), - true, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/unbonding_delegations", baseURL, ""), - true, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/unbonding_delegations", baseURL, val.ValAddress.String()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var ubds types.QueryValidatorUnbondingDelegationsResponse - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &ubds) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Len(ubds.UnbondingResponses, 1) - s.Require().Equal(ubds.UnbondingResponses[0].ValidatorAddress, val.ValAddress.String()) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryDelegationGRPC() { - val := s.network.Validators[0] - val2 := s.network.Validators[1] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - respType proto.Message - expectedResp proto.Message - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s", baseURL, "wrongValAddress", val.Address.String()), - true, - &types.QueryDelegationResponse{}, - nil, - }, - { - "wrong account address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s", baseURL, val.ValAddress.String(), "wrongAccAddress"), - true, - &types.QueryDelegationResponse{}, - nil, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s", baseURL, "", val.Address.String()), - true, - &types.QueryDelegationResponse{}, - nil, - }, - { - "with no account address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s", baseURL, val.ValAddress.String(), ""), - true, - &types.QueryDelegationResponse{}, - nil, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s", baseURL, val2.ValAddress.String(), val.Address.String()), - false, - &types.QueryDelegationResponse{}, - &types.QueryDelegationResponse{ - DelegationResponse: &types.DelegationResponse{ - Delegation: types.Delegation{ - DelegatorAddress: val.Address.String(), - ValidatorAddress: val2.ValAddress.String(), - Shares: sdk.NewDec(10), - }, - Balance: sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)), - }, - }, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - s.T().Logf("%s", resp) - err = val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Equal(tc.expectedResp.String(), tc.respType.String()) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryUnbondingDelegationGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s/unbonding_delegation", baseURL, "wrongValAddress", val.Address.String()), - true, - }, - { - "wrong account address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s/unbonding_delegation", baseURL, val.ValAddress.String(), "wrongAccAddress"), - true, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s/unbonding_delegation", baseURL, "", val.Address.String()), - true, - }, - { - "with no account address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s/unbonding_delegation", baseURL, val.ValAddress.String(), ""), - true, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s/unbonding_delegation", baseURL, val.ValAddress.String(), val.Address.String()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var ubd types.QueryUnbondingDelegationResponse - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &ubd) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Equal(ubd.Unbond.DelegatorAddress, val.Address.String()) - s.Require().Equal(ubd.Unbond.ValidatorAddress, val.ValAddress.String()) - s.Require().Len(ubd.Unbond.Entries, 1) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryDelegatorDelegationsGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - // Create new account in the keyring for address without delegations. - info, _, err := val.ClientCtx.Keyring.NewMnemonic("test", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) - s.Require().NoError(err) - newAddr := sdk.AccAddress(info.GetPubKey().Address()) - - testCases := []struct { - name string - url string - headers map[string]string - error bool - respType proto.Message - expectedResp proto.Message - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegations/%s", baseURL, "wrongValAddress"), - map[string]string{}, - true, - &types.QueryDelegatorDelegationsResponse{}, - nil, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegations/%s", baseURL, ""), - map[string]string{}, - true, - &types.QueryDelegatorDelegationsResponse{}, - nil, - }, - { - "valid request (height specific)", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegations/%s", baseURL, val.Address.String()), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - false, - &types.QueryDelegatorDelegationsResponse{}, - &types.QueryDelegatorDelegationsResponse{ - DelegationResponses: types.DelegationResponses{ - types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)), - }, - Pagination: &query.PageResponse{Total: 1}, - }, - }, - { - "address without delegations", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegations/%s", baseURL, newAddr.String()), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - false, - &types.QueryDelegatorDelegationsResponse{}, - &types.QueryDelegatorDelegationsResponse{ - DelegationResponses: types.DelegationResponses{}, - Pagination: &query.PageResponse{Total: 0}, - }, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) - s.Require().NoError(err) - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Equal(tc.expectedResp.String(), tc.respType.String()) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryDelegatorUnbondingDelegationsGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - ubdsLength int - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/unbonding_delegations", baseURL, "wrongValAddress"), - true, - 0, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/unbonding_delegations", baseURL, ""), - true, - 0, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/unbonding_delegations", baseURL, val.Address.String()), - false, - 1, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var ubds types.QueryDelegatorUnbondingDelegationsResponse - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &ubds) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Len(ubds.UnbondingResponses, tc.ubdsLength) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryRedelegationsGRPC() { - val := s.network.Validators[0] - val2 := s.network.Validators[1] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/redelegations", baseURL, "wrongValAddress"), - true, - }, - { - "with no validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/redelegations", baseURL, ""), - true, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/redelegations", baseURL, val.Address.String()), - false, - }, - { - "valid request with src address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/redelegations?src_validator_addr=%s", baseURL, val.Address.String(), val.ValAddress.String()), - false, - }, - { - "valid request with dst address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/redelegations?dst_validator_addr=%s", baseURL, val.Address.String(), val2.ValAddress.String()), - false, - }, - { - "valid request with dst address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/redelegations?src_validator_addr=%s&dst_validator_addr=%s", baseURL, val.Address.String(), val.ValAddress.String(), val2.ValAddress.String()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - var redelegations types.QueryRedelegationsResponse - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &redelegations) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - - s.Require().Len(redelegations.RedelegationResponses, 1) - s.Require().Equal(redelegations.RedelegationResponses[0].Redelegation.DelegatorAddress, val.Address.String()) - s.Require().Equal(redelegations.RedelegationResponses[0].Redelegation.ValidatorSrcAddress, val.ValAddress.String()) - s.Require().Equal(redelegations.RedelegationResponses[0].Redelegation.ValidatorDstAddress, val2.ValAddress.String()) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryDelegatorValidatorsGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "wrong delegator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators", baseURL, "wrongDelAddress"), - true, - }, - { - "with no delegator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators", baseURL, ""), - true, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators", baseURL, val.Address.String()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var validators types.QueryDelegatorValidatorsResponse - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &validators) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().Len(validators.Validators, len(s.network.Validators)) - s.Require().Equal(int(validators.Pagination.Total), len(s.network.Validators)) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryDelegatorValidatorGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "wrong delegator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators/%s", baseURL, "wrongAccAddress", val.ValAddress.String()), - true, - }, - { - "wrong validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators/%s", baseURL, val.Address.String(), "wrongValAddress"), - true, - }, - { - "with empty delegator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators/%s", baseURL, "", val.ValAddress.String()), - true, - }, - { - "with empty validator address", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators/%s", baseURL, val.Address.String(), ""), - true, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/delegators/%s/validators/%s", baseURL, val.Address.String(), val.ValAddress.String()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var validator types.QueryDelegatorValidatorResponse - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &validator) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().NotNil(validator) - s.Require().Equal(validator.Validator.OperatorAddress, val.ValAddress.String()) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryHistoricalInfoGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - error bool - }{ - { - "wrong height", - fmt.Sprintf("%s/cosmos/staking/v1beta1/historical_info/%s", baseURL, "-1"), - true, - }, - { - "with no height", - fmt.Sprintf("%s/cosmos/staking/v1beta1/historical_info/%s", baseURL, ""), - true, - }, - { - "valid request", - fmt.Sprintf("%s/cosmos/staking/v1beta1/historical_info/%s", baseURL, "2"), - false, - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - resp, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - var historicalInfo types.QueryHistoricalInfoResponse - - err = val.ClientCtx.Codec.UnmarshalJSON(resp, &historicalInfo) - - if tc.error { - s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().NotNil(historicalInfo) - } - }) - } -} - -func (s *IntegrationTestSuite) TestQueryParamsGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - respType proto.Message - expected proto.Message - }{ - { - "gRPC request params", - fmt.Sprintf("%s/cosmos/staking/v1beta1/params", baseURL), - &types.QueryParamsResponse{}, - &types.QueryParamsResponse{ - Params: types.DefaultParams(), - }, - }, - } - - for _, tc := range testCases { - tc := tc - resp, err := rest.GetRequest(tc.url) - s.Run(tc.name, func() { - s.Require().NoError(err) - s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) - s.Require().Equal(tc.expected, tc.respType) - }) - } -} - -func (s *IntegrationTestSuite) TestQueryPoolGRPC() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - respType proto.Message - expected proto.Message - }{ - { - "gRPC request params", - fmt.Sprintf("%s/cosmos/staking/v1beta1/pool", baseURL), - &types.QueryPoolResponse{}, - &types.QueryPoolResponse{ - Pool: types.Pool{ - NotBondedTokens: sdk.NewInt(10), - BondedTokens: cli.DefaultTokens.Mul(sdk.NewInt(2)).Sub(sdk.NewInt(10)), - }, - }, - }, - } - - for _, tc := range testCases { - tc := tc - resp, err := rest.GetRequest(tc.url) - s.Run(tc.name, func() { - s.Require().NoError(err) - s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) - s.Require().Equal(tc.expected, tc.respType) - }) - } -} - -func TestIntegrationTestSuite(t *testing.T) { - suite.Run(t, new(IntegrationTestSuite)) -} diff --git a/x/staking/client/rest/query.go b/x/staking/client/rest/query.go deleted file mode 100644 index b833766c2f9..00000000000 --- a/x/staking/client/rest/query.go +++ /dev/null @@ -1,400 +0,0 @@ -package rest - -import ( - "fmt" - "net/http" - "strconv" - "strings" - - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - clientrest "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/staking/types" -) - -func registerQueryRoutes(clientCtx client.Context, r *mux.Router) { - // Get all delegations from a delegator - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/delegations", - delegatorDelegationsHandlerFn(clientCtx), - ).Methods("GET") - - // Get all unbonding delegations from a delegator - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/unbonding_delegations", - delegatorUnbondingDelegationsHandlerFn(clientCtx), - ).Methods("GET") - - // Get all staking txs (i.e msgs) from a delegator - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/txs", - delegatorTxsHandlerFn(clientCtx), - ).Methods("GET") - - // Query all validators that a delegator is bonded to - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/validators", - delegatorValidatorsHandlerFn(clientCtx), - ).Methods("GET") - - // Query a validator that a delegator is bonded to - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/validators/{validatorAddr}", - delegatorValidatorHandlerFn(clientCtx), - ).Methods("GET") - - // Query a delegation between a delegator and a validator - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/delegations/{validatorAddr}", - delegationHandlerFn(clientCtx), - ).Methods("GET") - - // Query all unbonding delegations between a delegator and a validator - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/unbonding_delegations/{validatorAddr}", - unbondingDelegationHandlerFn(clientCtx), - ).Methods("GET") - - // Query redelegations (filters in query params) - r.HandleFunc( - "/staking/redelegations", - redelegationsHandlerFn(clientCtx), - ).Methods("GET") - - // Get all validators - r.HandleFunc( - "/staking/validators", - validatorsHandlerFn(clientCtx), - ).Methods("GET") - - // Get a single validator info - r.HandleFunc( - "/staking/validators/{validatorAddr}", - validatorHandlerFn(clientCtx), - ).Methods("GET") - - // Get all delegations to a validator - r.HandleFunc( - "/staking/validators/{validatorAddr}/delegations", - validatorDelegationsHandlerFn(clientCtx), - ).Methods("GET") - - // Get all unbonding delegations from a validator - r.HandleFunc( - "/staking/validators/{validatorAddr}/unbonding_delegations", - validatorUnbondingDelegationsHandlerFn(clientCtx), - ).Methods("GET") - - // Get HistoricalInfo at a given height - r.HandleFunc( - "/staking/historical_info/{height}", - historicalInfoHandlerFn(clientCtx), - ).Methods("GET") - - // Get the current state of the staking pool - r.HandleFunc( - "/staking/pool", - poolHandlerFn(clientCtx), - ).Methods("GET") - - // Get the current staking parameter values - r.HandleFunc( - "/staking/parameters", - paramsHandlerFn(clientCtx), - ).Methods("GET") -} - -// HTTP request handler to query a delegator delegations -func delegatorDelegationsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return queryDelegator(clientCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryDelegatorDelegations)) -} - -// HTTP request handler to query a delegator unbonding delegations -func delegatorUnbondingDelegationsHandlerFn(cliCtx client.Context) http.HandlerFunc { - return queryDelegator(cliCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryDelegatorUnbondingDelegations)) -} - -// HTTP request handler to query all staking txs (msgs) from a delegator -func delegatorTxsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var typesQuerySlice []string - - vars := mux.Vars(r) - delegatorAddr := vars["delegatorAddr"] - - if _, err := sdk.AccAddressFromBech32(delegatorAddr); rest.CheckBadRequestError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - typesQuery := r.URL.Query().Get("type") - trimmedQuery := strings.TrimSpace(typesQuery) - - if len(trimmedQuery) != 0 { - typesQuerySlice = strings.Split(trimmedQuery, " ") - } - - noQuery := len(typesQuerySlice) == 0 - isBondTx := contains(typesQuerySlice, "bond") - isUnbondTx := contains(typesQuerySlice, "unbond") - isRedTx := contains(typesQuerySlice, "redelegate") - - var ( - txs []*sdk.SearchTxsResult - actions []string - ) - - // For each case, we search txs for both: - // - legacy messages: their Type() is a custom string, e.g. "delegate" - // - service Msgs: their Type() is their FQ method name, e.g. "/cosmos.staking.v1beta1.MsgDelegate" - // and we combine the results. - switch { - case isBondTx: - actions = append(actions, types.TypeMsgDelegate) - - case isUnbondTx: - actions = append(actions, types.TypeMsgUndelegate) - - case isRedTx: - actions = append(actions, types.TypeMsgBeginRedelegate) - - case noQuery: - actions = append(actions, types.TypeMsgDelegate) - actions = append(actions, types.TypeMsgUndelegate) - actions = append(actions, types.TypeMsgBeginRedelegate) - - default: - w.WriteHeader(http.StatusNoContent) - return - } - - for _, action := range actions { - foundTxs, errQuery := queryTxs(clientCtx, action, delegatorAddr) - if rest.CheckInternalServerError(w, errQuery) { - return - } - - txs = append(txs, foundTxs) - } - - res, err := clientCtx.LegacyAmino.MarshalJSON(txs) - if rest.CheckInternalServerError(w, err) { - return - } - - rest.PostProcessResponseBare(w, clientCtx, res) - } -} - -// HTTP request handler to query an unbonding-delegation -func unbondingDelegationHandlerFn(cliCtx client.Context) http.HandlerFunc { - return queryBonds(cliCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryUnbondingDelegation)) -} - -// HTTP request handler to query redelegations -func redelegationsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var params types.QueryRedelegationParams - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - bechDelegatorAddr := r.URL.Query().Get("delegator") - bechSrcValidatorAddr := r.URL.Query().Get("validator_from") - bechDstValidatorAddr := r.URL.Query().Get("validator_to") - - if len(bechDelegatorAddr) != 0 { - delegatorAddr, err := sdk.AccAddressFromBech32(bechDelegatorAddr) - if rest.CheckBadRequestError(w, err) { - return - } - - params.DelegatorAddr = delegatorAddr - } - - if len(bechSrcValidatorAddr) != 0 { - srcValidatorAddr, err := sdk.ValAddressFromBech32(bechSrcValidatorAddr) - if rest.CheckBadRequestError(w, err) { - return - } - - params.SrcValidatorAddr = srcValidatorAddr - } - - if len(bechDstValidatorAddr) != 0 { - dstValidatorAddr, err := sdk.ValAddressFromBech32(bechDstValidatorAddr) - if rest.CheckBadRequestError(w, err) { - return - } - - params.DstValidatorAddr = dstValidatorAddr - } - - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckBadRequestError(w, err) { - return - } - - res, height, err := clientCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryRedelegations), bz) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -// HTTP request handler to query a delegation -func delegationHandlerFn(clientCtx client.Context) http.HandlerFunc { - return queryBonds(clientCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryDelegation)) -} - -// HTTP request handler to query all delegator bonded validators -func delegatorValidatorsHandlerFn(cliCtx client.Context) http.HandlerFunc { - return queryDelegator(cliCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryDelegatorValidators)) -} - -// HTTP request handler to get information from a currently bonded validator -func delegatorValidatorHandlerFn(cliCtx client.Context) http.HandlerFunc { - return queryBonds(cliCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryDelegatorValidator)) -} - -// HTTP request handler to query list of validators -func validatorsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if rest.CheckBadRequestError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - status := r.FormValue("status") - // These are query params that were available in =<0.39. We show a nice - // error message for this breaking change. - if status == "bonded" || status == "unbonding" || status == "unbonded" { - err := fmt.Errorf("cosmos sdk v0.40 introduces a breaking change on this endpoint:"+ - " instead of querying using `?status=%s`, please use `status=BOND_STATUS_%s`. For more"+ - " info, please see our REST endpoint migration guide at %s", status, strings.ToUpper(status), clientrest.DeprecationURL) - - if rest.CheckBadRequestError(w, err) { - return - } - - } - - if status == "" { - status = types.BondStatusBonded - } - - params := types.NewQueryValidatorsParams(page, limit, status) - - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckBadRequestError(w, err) { - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryValidators) - - res, height, err := clientCtx.QueryWithData(route, bz) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -// HTTP request handler to query the validator information from a given validator address -func validatorHandlerFn(cliCtx client.Context) http.HandlerFunc { - return queryValidator(cliCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryValidator)) -} - -// HTTP request handler to query all unbonding delegations from a validator -func validatorDelegationsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return queryValidator(clientCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryValidatorDelegations)) -} - -// HTTP request handler to query all unbonding delegations from a validator -func validatorUnbondingDelegationsHandlerFn(cliCtx client.Context) http.HandlerFunc { - return queryValidator(cliCtx, fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryValidatorUnbondingDelegations)) -} - -// HTTP request handler to query historical info at a given height -func historicalInfoHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - heightStr := vars["height"] - - height, err := strconv.ParseInt(heightStr, 10, 64) - if err != nil || height < 0 { - rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("Must provide non-negative integer for height: %v", err)) - return - } - - params := types.QueryHistoricalInfoRequest{Height: height} - - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckInternalServerError(w, err) { - return - } - - res, height, err := clientCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryHistoricalInfo), bz) - if rest.CheckBadRequestError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -// HTTP request handler to query the pool information -func poolHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - res, height, err := clientCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryPool), nil) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -// HTTP request handler to query the staking params values -func paramsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - res, height, err := clientCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParameters), nil) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} diff --git a/x/staking/client/rest/rest.go b/x/staking/client/rest/rest.go deleted file mode 100644 index 6f9b7e1e2a6..00000000000 --- a/x/staking/client/rest/rest.go +++ /dev/null @@ -1,14 +0,0 @@ -package rest - -import ( - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/rest" -) - -func RegisterHandlers(clientCtx client.Context, rtr *mux.Router) { - r := rest.WithHTTPDeprecationHeaders(rtr) - registerQueryRoutes(clientCtx, r) - registerTxHandlers(clientCtx, r) -} diff --git a/x/staking/client/rest/rest_test.go b/x/staking/client/rest/rest_test.go deleted file mode 100644 index d78906ff831..00000000000 --- a/x/staking/client/rest/rest_test.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build norace -// +build norace - -package rest_test - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func (s *IntegrationTestSuite) TestLegacyGetValidators() { - val := s.network.Validators[0] - baseURL := val.APIAddress - - testCases := []struct { - name string - url string - expErr bool - expErrMsg string - }{ - { - "old status should show error message", - fmt.Sprintf("%s/staking/validators?status=bonded", baseURL), - true, "cosmos sdk v0.40 introduces a breaking change on this endpoint: instead of" + - " querying using `?status=bonded`, please use `status=BOND_STATUS_BONDED`. For more" + - " info, please see our REST endpoint migration guide at https://docs.cosmos.network/master/migrations/rest.html", - }, - { - "new status should work", - fmt.Sprintf("%s/staking/validators?status=BOND_STATUS_BONDED", baseURL), - false, "", - }, - } - - for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - respJSON, err := rest.GetRequest(tc.url) - s.Require().NoError(err) - - if tc.expErr { - var errResp rest.ErrorResponse - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &errResp)) - - s.Require().Equal(errResp.Error, tc.expErrMsg) - } else { - resp := rest.ResponseWithHeight{} - err = val.ClientCtx.LegacyAmino.UnmarshalJSON(respJSON, &resp) - s.Require().NoError(err) - - // Check result is not empty. - var validators []types.Validator - s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(resp.Result, &validators)) - s.Require().Greater(len(validators), 0) - // While we're at it, also check that the consensus_pubkey is - // an Any, and not bech32 anymore. - s.Require().Contains(string(resp.Result), "\"consensus_pubkey\": {\n \"type\": \"tendermint/PubKeyEd25519\",") - } - }) - } -} diff --git a/x/staking/client/rest/tx.go b/x/staking/client/rest/tx.go deleted file mode 100644 index 26e859c41a0..00000000000 --- a/x/staking/client/rest/tx.go +++ /dev/null @@ -1,149 +0,0 @@ -package rest - -import ( - "bytes" - "net/http" - - "github.com/gorilla/mux" - - "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/staking/types" -) - -func registerTxHandlers(clientCtx client.Context, r *mux.Router) { - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/delegations", - newPostDelegationsHandlerFn(clientCtx), - ).Methods("POST") - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/unbonding_delegations", - newPostUnbondingDelegationsHandlerFn(clientCtx), - ).Methods("POST") - r.HandleFunc( - "/staking/delegators/{delegatorAddr}/redelegations", - newPostRedelegationsHandlerFn(clientCtx), - ).Methods("POST") -} - -type ( - // DelegateRequest defines the properties of a delegation request's body. - DelegateRequest struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // in bech32 - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` // in bech32 - Amount sdk.Coin `json:"amount" yaml:"amount"` - } - - // RedelegateRequest defines the properties of a redelegate request's body. - RedelegateRequest struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // in bech32 - ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"` // in bech32 - ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"` // in bech32 - Amount sdk.Coin `json:"amount" yaml:"amount"` - } - - // UndelegateRequest defines the properties of a undelegate request's body. - UndelegateRequest struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // in bech32 - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` // in bech32 - Amount sdk.Coin `json:"amount" yaml:"amount"` - } -) - -func newPostDelegationsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req DelegateRequest - if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - msg := types.NewMsgDelegate(req.DelegatorAddress, req.ValidatorAddress, req.Amount) - if rest.CheckBadRequestError(w, msg.ValidateBasic()) { - return - } - - fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if rest.CheckBadRequestError(w, err) { - return - } - - if !bytes.Equal(fromAddr, req.DelegatorAddress) { - rest.WriteErrorResponse(w, http.StatusUnauthorized, "must use own delegator address") - return - } - - tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) - } -} - -func newPostRedelegationsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req RedelegateRequest - if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - msg := types.NewMsgBeginRedelegate(req.DelegatorAddress, req.ValidatorSrcAddress, req.ValidatorDstAddress, req.Amount) - if rest.CheckBadRequestError(w, msg.ValidateBasic()) { - return - } - - fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if rest.CheckBadRequestError(w, err) { - return - } - - if !bytes.Equal(fromAddr, req.DelegatorAddress) { - rest.WriteErrorResponse(w, http.StatusUnauthorized, "must use own delegator address") - return - } - - tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) - } -} - -func newPostUnbondingDelegationsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req UndelegateRequest - if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - msg := types.NewMsgUndelegate(req.DelegatorAddress, req.ValidatorAddress, req.Amount) - if rest.CheckBadRequestError(w, msg.ValidateBasic()) { - return - } - - fromAddr, err := sdk.AccAddressFromBech32(req.BaseReq.From) - if rest.CheckBadRequestError(w, err) { - return - } - - if !bytes.Equal(fromAddr, req.DelegatorAddress) { - rest.WriteErrorResponse(w, http.StatusUnauthorized, "must use own delegator address") - return - } - - tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) - } -} diff --git a/x/staking/client/rest/utils.go b/x/staking/client/rest/utils.go deleted file mode 100644 index f8c6fe11325..00000000000 --- a/x/staking/client/rest/utils.go +++ /dev/null @@ -1,144 +0,0 @@ -package rest - -import ( - "fmt" - "net/http" - - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// contains checks if the a given query contains one of the tx types -func contains(stringSlice []string, txType string) bool { - for _, word := range stringSlice { - if word == txType { - return true - } - } - - return false -} - -// queries staking txs -func queryTxs(clientCtx client.Context, action string, delegatorAddr string) (*sdk.SearchTxsResult, error) { - page := 1 - limit := 100 - events := []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, action), - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, delegatorAddr), - } - - return authtx.QueryTxsByEvents(clientCtx, events, page, limit, "") -} - -func queryBonds(clientCtx client.Context, endpoint string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - bech32delegator := vars["delegatorAddr"] - bech32validator := vars["validatorAddr"] - - delegatorAddr, err := sdk.AccAddressFromBech32(bech32delegator) - if rest.CheckBadRequestError(w, err) { - return - } - - validatorAddr, err := sdk.ValAddressFromBech32(bech32validator) - if rest.CheckBadRequestError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - params := types.QueryDelegatorValidatorRequest{DelegatorAddr: delegatorAddr.String(), ValidatorAddr: validatorAddr.String()} - - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckBadRequestError(w, err) { - return - } - - res, height, err := clientCtx.QueryWithData(endpoint, bz) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -func queryDelegator(clientCtx client.Context, endpoint string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - bech32delegator := vars["delegatorAddr"] - - delegatorAddr, err := sdk.AccAddressFromBech32(bech32delegator) - if rest.CheckBadRequestError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - params := types.NewQueryDelegatorParams(delegatorAddr) - - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckBadRequestError(w, err) { - return - } - - res, height, err := clientCtx.QueryWithData(endpoint, bz) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -func queryValidator(clientCtx client.Context, endpoint string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - bech32validatorAddr := vars["validatorAddr"] - - _, page, limit, err := rest.ParseHTTPArgsWithLimit(r, 0) - if rest.CheckBadRequestError(w, err) { - return - } - - validatorAddr, err := sdk.ValAddressFromBech32(bech32validatorAddr) - if rest.CheckBadRequestError(w, err) { - return - } - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - params := types.NewQueryValidatorParams(validatorAddr, page, limit) - - bz, err := clientCtx.LegacyAmino.MarshalJSON(params) - if rest.CheckBadRequestError(w, err) { - return - } - - res, height, err := clientCtx.QueryWithData(endpoint, bz) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} diff --git a/x/staking/client/testutil/suite.go b/x/staking/client/testutil/suite.go index a0ef083d47f..3dae15da506 100644 --- a/x/staking/client/testutil/suite.go +++ b/x/staking/client/testutil/suite.go @@ -399,7 +399,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegations() { &types.QueryDelegatorDelegationsResponse{}, &types.QueryDelegatorDelegationsResponse{ DelegationResponses: types.DelegationResponses{ - types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)), + types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), false, sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)), }, Pagination: &query.PageResponse{}, }, @@ -455,7 +455,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorDelegations() { &types.QueryValidatorDelegationsResponse{}, &types.QueryValidatorDelegationsResponse{ DelegationResponses: types.DelegationResponses{ - types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)), + types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), false, sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)), }, Pagination: &query.PageResponse{}, }, @@ -873,15 +873,19 @@ func (s *IntegrationTestSuite) TestGetCmdQueryParams() { "with text output", []string{fmt.Sprintf("--%s=text", tmcli.OutputFlag)}, `bond_denom: stake +global_liquid_staking_cap: "1.000000000000000000" historical_entries: 10000 max_entries: 7 max_validators: 100 -unbonding_time: 1814400s`, +min_commission_rate: "0.000000000000000000" +unbonding_time: 1814400s +validator_bond_factor: "-1.000000000000000000" +validator_liquid_staking_cap: "1.000000000000000000"`, }, { "with json output", []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, - `{"unbonding_time":"1814400s","max_validators":100,"max_entries":7,"historical_entries":10000,"bond_denom":"stake"}`, + `{"unbonding_time":"1814400s","max_validators":100,"max_entries":7,"historical_entries":10000,"bond_denom":"stake","min_commission_rate":"0.000000000000000000","validator_bond_factor":"-1.000000000000000000","global_liquid_staking_cap":"1.000000000000000000","validator_liquid_staking_cap":"1.000000000000000000"}`, }, } for _, tc := range testCases { @@ -1178,7 +1182,7 @@ func (s *IntegrationTestSuite) TestNewRedelegateCmd() { fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, - false, 31, &sdk.TxResponse{}, + false, 3, &sdk.TxResponse{}, }, { "valid transaction of delegate", diff --git a/x/staking/common_test.go b/x/staking/common_test.go index 5d8897b1c0a..4e81f125659 100644 --- a/x/staking/common_test.go +++ b/x/staking/common_test.go @@ -2,14 +2,15 @@ package staking_test import ( "math/big" + "testing" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + simapp "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -18,7 +19,7 @@ func init() { sdk.DefaultPowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)) } -// nolint:deadcode,unused,varcheck +//nolint:deadcode,unused,varcheck var ( priv1 = secp256k1.GenPrivKey() addr1 = sdk.AccAddress(priv1.PubKey().Address()) @@ -35,8 +36,8 @@ var ( // getBaseSimappWithCustomKeeper Returns a simapp with custom StakingKeeper // to avoid messing with the hooks. -func getBaseSimappWithCustomKeeper() (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) { - app := simapp.Setup(false) +func getBaseSimappWithCustomKeeper(t *testing.T) (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) { + app := simapp.SetupWithValSet(t, false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) appCodec := app.AppCodec() diff --git a/x/staking/genesis.go b/x/staking/genesis.go index 51ae11a25f2..5b94b8adf48 100644 --- a/x/staking/genesis.go +++ b/x/staking/genesis.go @@ -2,9 +2,7 @@ package staking import ( "fmt" - "log" - abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -13,183 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking/types" ) -// InitGenesis sets the pool and parameters for the provided keeper. For each -// validator in data, it sets that validator in the keeper along with manually -// setting the indexes. In addition, it also sets any delegations found in -// data. Finally, it updates the bonded validators. -// Returns final validator set after applying all declaration and delegations -func InitGenesis( - ctx sdk.Context, keeper keeper.Keeper, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, data *types.GenesisState, -) (res []abci.ValidatorUpdate) { - bondedTokens := sdk.ZeroInt() - notBondedTokens := sdk.ZeroInt() - - // We need to pretend to be "n blocks before genesis", where "n" is the - // validator update delay, so that e.g. slashing periods are correctly - // initialized for the validator set e.g. with a one-block offset - the - // first TM block is at height 1, so state updates applied from - // genesis.json are in block 0. - ctx = ctx.WithBlockHeight(1 - sdk.ValidatorUpdateDelay) - - keeper.SetParams(ctx, data.Params) - keeper.SetLastTotalPower(ctx, data.LastTotalPower) - - for _, validator := range data.Validators { - keeper.SetValidator(ctx, validator) - - // Manually set indices for the first time - keeper.SetValidatorByConsAddr(ctx, validator) - keeper.SetValidatorByPowerIndex(ctx, validator) - - // Call the creation hook if not exported - if !data.Exported { - keeper.AfterValidatorCreated(ctx, validator.GetOperator()) - } - - // update timeslice if necessary - if validator.IsUnbonding() { - keeper.InsertUnbondingValidatorQueue(ctx, validator) - } - - switch validator.GetStatus() { - case types.Bonded: - bondedTokens = bondedTokens.Add(validator.GetTokens()) - case types.Unbonding, types.Unbonded: - notBondedTokens = notBondedTokens.Add(validator.GetTokens()) - default: - panic("invalid validator status") - } - } - - for _, delegation := range data.Delegations { - delegatorAddress := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) - - // Call the before-creation hook if not exported - if !data.Exported { - keeper.BeforeDelegationCreated(ctx, delegatorAddress, delegation.GetValidatorAddr()) - } - - keeper.SetDelegation(ctx, delegation) - // Call the after-modification hook if not exported - if !data.Exported { - keeper.AfterDelegationModified(ctx, delegatorAddress, delegation.GetValidatorAddr()) - } - } - - for _, ubd := range data.UnbondingDelegations { - keeper.SetUnbondingDelegation(ctx, ubd) - - for _, entry := range ubd.Entries { - keeper.InsertUBDQueue(ctx, ubd, entry.CompletionTime) - notBondedTokens = notBondedTokens.Add(entry.Balance) - } - } - - for _, red := range data.Redelegations { - keeper.SetRedelegation(ctx, red) - - for _, entry := range red.Entries { - keeper.InsertRedelegationQueue(ctx, red, entry.CompletionTime) - } - } - - bondedCoins := sdk.NewCoins(sdk.NewCoin(data.Params.BondDenom, bondedTokens)) - notBondedCoins := sdk.NewCoins(sdk.NewCoin(data.Params.BondDenom, notBondedTokens)) - - // check if the unbonded and bonded pools accounts exists - bondedPool := keeper.GetBondedPool(ctx) - if bondedPool == nil { - panic(fmt.Sprintf("%s module account has not been set", types.BondedPoolName)) - } - // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 - bondedBalance := bankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - if bondedBalance.IsZero() { - accountKeeper.SetModuleAccount(ctx, bondedPool) - } - // if balance is different from bonded coins panic because genesis is most likely malformed - if !bondedBalance.IsEqual(bondedCoins) { - panic(fmt.Sprintf("bonded pool balance is different from bonded coins: %s <-> %s", bondedBalance, bondedCoins)) - } - notBondedPool := keeper.GetNotBondedPool(ctx) - if notBondedPool == nil { - panic(fmt.Sprintf("%s module account has not been set", types.NotBondedPoolName)) - } - - notBondedBalance := bankKeeper.GetAllBalances(ctx, notBondedPool.GetAddress()) - if notBondedBalance.IsZero() { - accountKeeper.SetModuleAccount(ctx, notBondedPool) - } - // if balance is different from non bonded coins panic because genesis is most likely malformed - if !notBondedBalance.IsEqual(notBondedCoins) { - panic(fmt.Sprintf("not bonded pool balance is different from not bonded coins: %s <-> %s", notBondedBalance, notBondedCoins)) - } - // don't need to run Tendermint updates if we exported - if data.Exported { - for _, lv := range data.LastValidatorPowers { - valAddr, err := sdk.ValAddressFromBech32(lv.Address) - if err != nil { - panic(err) - } - keeper.SetLastValidatorPower(ctx, valAddr, lv.Power) - validator, found := keeper.GetValidator(ctx, valAddr) - - if !found { - panic(fmt.Sprintf("validator %s not found", lv.Address)) - } - - update := validator.ABCIValidatorUpdate(keeper.PowerReduction(ctx)) - update.Power = lv.Power // keep the next-val-set offset, use the last power for the first block - res = append(res, update) - } - } else { - var err error - res, err = keeper.ApplyAndReturnValidatorSetUpdates(ctx) - if err != nil { - log.Fatal(err) - } - } - - return res -} - -// ExportGenesis returns a GenesisState for a given context and keeper. The -// GenesisState will contain the pool, params, validators, and bonds found in -// the keeper. -func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { - var unbondingDelegations []types.UnbondingDelegation - - keeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd types.UnbondingDelegation) (stop bool) { - unbondingDelegations = append(unbondingDelegations, ubd) - return false - }) - - var redelegations []types.Redelegation - - keeper.IterateRedelegations(ctx, func(_ int64, red types.Redelegation) (stop bool) { - redelegations = append(redelegations, red) - return false - }) - - var lastValidatorPowers []types.LastValidatorPower - - keeper.IterateLastValidatorPowers(ctx, func(addr sdk.ValAddress, power int64) (stop bool) { - lastValidatorPowers = append(lastValidatorPowers, types.LastValidatorPower{Address: addr.String(), Power: power}) - return false - }) - - return &types.GenesisState{ - Params: keeper.GetParams(ctx), - LastTotalPower: keeper.GetLastTotalPower(ctx), - LastValidatorPowers: lastValidatorPowers, - Validators: keeper.GetAllValidators(ctx), - Delegations: keeper.GetAllDelegations(ctx), - UnbondingDelegations: unbondingDelegations, - Redelegations: redelegations, - Exported: true, - } -} - // WriteValidators returns a slice of bonded genesis validators. func WriteValidators(ctx sdk.Context, keeper keeper.Keeper) (vals []tmtypes.GenesisValidator, err error) { keeper.IterateLastValidators(ctx, func(_ int64, validator types.ValidatorI) (stop bool) { diff --git a/x/staking/genesis_test.go b/x/staking/genesis_test.go index 0c686e2d998..a59d16efcc4 100644 --- a/x/staking/genesis_test.go +++ b/x/staking/genesis_test.go @@ -1,205 +1,18 @@ package staking_test import ( - "fmt" - "log" "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" "github.com/cosmos/cosmos-sdk/x/staking/types" ) -func bootstrapGenesisTest(numAddrs int) (*simapp.SimApp, sdk.Context, []sdk.AccAddress) { - _, app, ctx := getBaseSimappWithCustomKeeper() - - addrDels, _ := generateAddresses(app, ctx, numAddrs, sdk.NewInt(10000)) - return app, ctx, addrDels -} - -func TestInitGenesis(t *testing.T) { - app, ctx, addrs := bootstrapGenesisTest(10) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 1) - - params := app.StakingKeeper.GetParams(ctx) - validators := app.StakingKeeper.GetAllValidators(ctx) - var delegations []types.Delegation - - pk0, err := codectypes.NewAnyWithValue(PKs[0]) - require.NoError(t, err) - - pk1, err := codectypes.NewAnyWithValue(PKs[1]) - require.NoError(t, err) - - // initialize the validators - bondedVal1 := types.Validator{ - OperatorAddress: sdk.ValAddress(addrs[0]).String(), - ConsensusPubkey: pk0, - Status: types.Bonded, - Tokens: valTokens, - DelegatorShares: valTokens.ToDec(), - Description: types.NewDescription("hoop", "", "", "", ""), - } - bondedVal2 := types.Validator{ - OperatorAddress: sdk.ValAddress(addrs[1]).String(), - ConsensusPubkey: pk1, - Status: types.Bonded, - Tokens: valTokens, - DelegatorShares: valTokens.ToDec(), - Description: types.NewDescription("bloop", "", "", "", ""), - } - - // append new bonded validators to the list - validators = append(validators, bondedVal1, bondedVal2) - log.Printf("%#v", len(validators)) - // mint coins in the bonded pool representing the validators coins - require.NoError(t, - simapp.FundModuleAccount( - app.BankKeeper, - ctx, - types.BondedPoolName, - sdk.NewCoins( - sdk.NewCoin(params.BondDenom, valTokens.MulRaw((int64)(len(validators)))), - ), - ), - ) - genesisState := types.NewGenesisState(params, validators, delegations) - vals := staking.InitGenesis(ctx, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, genesisState) - - actualGenesis := staking.ExportGenesis(ctx, app.StakingKeeper) - require.Equal(t, genesisState.Params, actualGenesis.Params) - require.Equal(t, genesisState.Delegations, actualGenesis.Delegations) - require.EqualValues(t, app.StakingKeeper.GetAllValidators(ctx), actualGenesis.Validators) - - // Ensure validators have addresses. - vals2, err := staking.WriteValidators(ctx, app.StakingKeeper) - require.NoError(t, err) - for _, val := range vals2 { - require.NotEmpty(t, val.Address) - } - - // now make sure the validators are bonded and intra-tx counters are correct - resVal, found := app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[0])) - require.True(t, found) - require.Equal(t, types.Bonded, resVal.Status) - - resVal, found = app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[1])) - require.True(t, found) - require.Equal(t, types.Bonded, resVal.Status) - - abcivals := make([]abci.ValidatorUpdate, len(vals)) - for i, val := range validators { - abcivals[i] = val.ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)) - } - - require.Equal(t, abcivals, vals) -} - -func TestInitGenesis_PoolsBalanceMismatch(t *testing.T) { - app := simapp.Setup(false) - ctx := app.NewContext(false, tmproto.Header{}) - - consPub, err := codectypes.NewAnyWithValue(PKs[0]) - require.NoError(t, err) - - // create mock validator - validator := types.Validator{ - OperatorAddress: sdk.ValAddress("12345678901234567890").String(), - ConsensusPubkey: consPub, - Jailed: false, - Tokens: sdk.NewInt(10), - DelegatorShares: sdk.NewInt(10).ToDec(), - Description: types.NewDescription("bloop", "", "", "", ""), - } - // valid params - params := types.Params{ - UnbondingTime: 10000, - MaxValidators: 1, - MaxEntries: 10, - BondDenom: "stake", - } - - // test - - require.Panics(t, func() { - // setting validator status to bonded so the balance counts towards bonded pool - validator.Status = types.Bonded - staking.InitGenesis(ctx, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, &types.GenesisState{ - Params: params, - Validators: []types.Validator{validator}, - }) - }, "should panic because bonded pool balance is different from bonded pool coins") - - require.Panics(t, func() { - // setting validator status to unbonded so the balance counts towards not bonded pool - validator.Status = types.Unbonded - staking.InitGenesis(ctx, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, &types.GenesisState{ - Params: params, - Validators: []types.Validator{validator}, - }) - }, "should panic because not bonded pool balance is different from not bonded pool coins") -} - -func TestInitGenesisLargeValidatorSet(t *testing.T) { - size := 200 - require.True(t, size > 100) - - app, ctx, addrs := bootstrapGenesisTest(200) - - params := app.StakingKeeper.GetParams(ctx) - delegations := []types.Delegation{} - validators := make([]types.Validator, size) - var err error - - bondedPoolAmt := sdk.ZeroInt() - for i := range validators { - validators[i], err = types.NewValidator(sdk.ValAddress(addrs[i]), - PKs[i], types.NewDescription(fmt.Sprintf("#%d", i), "", "", "", "")) - require.NoError(t, err) - validators[i].Status = types.Bonded - - tokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 1) - if i < 100 { - tokens = app.StakingKeeper.TokensFromConsensusPower(ctx, 2) - } - validators[i].Tokens = tokens - validators[i].DelegatorShares = tokens.ToDec() - // add bonded coins - bondedPoolAmt = bondedPoolAmt.Add(tokens) - } - - genesisState := types.NewGenesisState(params, validators, delegations) - - // mint coins in the bonded pool representing the validators coins - require.NoError(t, - simapp.FundModuleAccount( - app.BankKeeper, - ctx, - types.BondedPoolName, - sdk.NewCoins(sdk.NewCoin(params.BondDenom, bondedPoolAmt)), - ), - ) - - vals := staking.InitGenesis(ctx, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, genesisState) - - abcivals := make([]abci.ValidatorUpdate, 100) - for i, val := range validators[:100] { - abcivals[i] = val.ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)) - } - - require.Equal(t, abcivals, vals) -} - func TestValidateGenesis(t *testing.T) { genValidators1 := make([]types.Validator, 1, 5) pk := ed25519.GenPrivKey().PubKey() @@ -225,7 +38,7 @@ func TestValidateGenesis(t *testing.T) { {"jailed and bonded validator", func(data *types.GenesisState) { data.Validators = genValidators1 data.Validators[0].Jailed = true - data.Validators[0].Status = types.Bonded + data.Validators[0].Status = sdkstaking.Bonded }, true}, } diff --git a/x/staking/handler.go b/x/staking/handler.go index 6d89c7a29c5..e0497aa7e71 100644 --- a/x/staking/handler.go +++ b/x/staking/handler.go @@ -1,7 +1,9 @@ package staking import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -34,8 +36,32 @@ func NewHandler(k keeper.Keeper) sdk.Handler { res, err := msgServer.Undelegate(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUnbondValidator: + res, err := msgServer.UnbondValidator(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + case *types.MsgTokenizeShares: + res, err := msgServer.TokenizeShares(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + case *types.MsgRedeemTokensforShares: + res, err := msgServer.RedeemTokens(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + case *types.MsgTransferTokenizeShareRecord: + res, err := msgServer.TransferTokenizeShareRecord(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + case *types.MsgDisableTokenizeShares: + res, err := msgServer.DisableTokenizeShares(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + case *types.MsgEnableTokenizeShares: + res, err := msgServer.EnableTokenizeShares(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/x/staking/handler_test.go b/x/staking/handler_test.go index d23a13f94f0..67fed75d134 100644 --- a/x/staking/handler_test.go +++ b/x/staking/handler_test.go @@ -1,33 +1,19 @@ package staking_test import ( - "strings" "testing" - "time" - "github.com/stretchr/testify/assert" "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/golang/protobuf/proto" - - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/testutil/testdata" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/staking/keeper" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" + simapp "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" - "github.com/cosmos/cosmos-sdk/x/staking/types" ) func bootstrapHandlerGenesisTest(t *testing.T, power int64, numAddrs int, accAmount sdk.Int) (*simapp.SimApp, sdk.Context, []sdk.AccAddress, []sdk.ValAddress) { - _, app, ctx := getBaseSimappWithCustomKeeper() + _, app, ctx := getBaseSimappWithCustomKeeper(t) addrDels, addrVals := generateAddresses(app, ctx, numAddrs, accAmount) @@ -38,1180 +24,221 @@ func bootstrapHandlerGenesisTest(t *testing.T, power int64, numAddrs int, accAmo // set non bonded pool balance app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply)) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply)) return app, ctx, addrDels, addrVals } -func TestValidatorByPowerIndex(t *testing.T) { - initPower := int64(1000000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 10, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr, validatorAddr3 := valAddrs[0], valAddrs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // create validator - initBond := tstaking.CreateValidatorWithValPower(validatorAddr, PKs[0], initPower, true) - - // must end-block - updates, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 1, len(updates)) - - // verify the self-delegation exists - bond, found := app.StakingKeeper.GetDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.True(t, found) - gotBond := bond.Shares.RoundInt() - require.Equal(t, initBond, gotBond) - - // verify that the by power index exists - validator, found := app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - power := types.GetValidatorsByPowerIndexKey(validator, app.StakingKeeper.PowerReduction(ctx)) - require.True(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power)) - - // create a second validator keep it bonded - tstaking.CreateValidatorWithValPower(validatorAddr3, PKs[2], initPower, true) - - // must end-block - updates, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 1, len(updates)) - - // slash and jail the first validator - consAddr0 := sdk.ConsAddress(PKs[0].Address()) - app.StakingKeeper.Slash(ctx, consAddr0, 0, initPower, sdk.NewDecWithPrec(5, 1), 0) - app.StakingKeeper.Jail(ctx, consAddr0) - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - - validator, found = app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - require.Equal(t, types.Unbonding, validator.Status) // ensure is unbonding - require.Equal(t, initBond.QuoRaw(2), validator.Tokens) // ensure tokens slashed - app.StakingKeeper.Unjail(ctx, consAddr0) - - // the old power record should have been deleted as the power changed - require.False(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power)) - - // but the new power record should have been created - validator, found = app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - power2 := types.GetValidatorsByPowerIndexKey(validator, app.StakingKeeper.PowerReduction(ctx)) - require.True(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power2)) - - // now the new record power index should be the same as the original record - power3 := types.GetValidatorsByPowerIndexKey(validator, app.StakingKeeper.PowerReduction(ctx)) - require.Equal(t, power2, power3) - - // unbond self-delegation - totalBond := validator.TokensFromShares(bond.GetShares()).TruncateInt() - res := tstaking.Undelegate(sdk.AccAddress(validatorAddr), validatorAddr, totalBond, true) - - var resData types.MsgUndelegateResponse - err = proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - - ctx = ctx.WithBlockTime(resData.CompletionTime) - staking.EndBlocker(ctx, app.StakingKeeper) - staking.EndBlocker(ctx, app.StakingKeeper) - - // verify that by power key nolonger exists - _, found = app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.False(t, found) - require.False(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power3)) -} - -func TestDuplicatesMsgCreateValidator(t *testing.T) { - initPower := int64(1000000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 10, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - - addr1, addr2 := valAddrs[0], valAddrs[1] - pk1, pk2 := PKs[0], PKs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - valTokens := tstaking.CreateValidatorWithValPower(addr1, pk1, 10, true) - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - - validator := tstaking.CheckValidator(addr1, types.Bonded, false) - assert.Equal(t, addr1.String(), validator.OperatorAddress) - consKey, err := validator.TmConsPublicKey() - require.NoError(t, err) - tmPk1, err := cryptocodec.ToTmProtoPublicKey(pk1) - require.NoError(t, err) - assert.Equal(t, tmPk1, consKey) - assert.Equal(t, valTokens, validator.BondedTokens()) - assert.Equal(t, valTokens.ToDec(), validator.DelegatorShares) - assert.Equal(t, types.Description{}, validator.Description) - - // two validators can't have the same operator address - tstaking.CreateValidator(addr1, pk2, valTokens, false) - - // two validators can't have the same pubkey - tstaking.CreateValidator(addr2, pk1, valTokens, false) - - // must have different pubkey and operator - tstaking.CreateValidator(addr2, pk2, valTokens, true) - - // must end-block - updates, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 1, len(updates)) - - validator = tstaking.CheckValidator(addr2, types.Bonded, false) - assert.Equal(t, addr2.String(), validator.OperatorAddress) - consPk, err := validator.TmConsPublicKey() - require.NoError(t, err) - tmPk2, err := cryptocodec.ToTmProtoPublicKey(pk2) - require.NoError(t, err) - assert.Equal(t, tmPk2, consPk) - assert.True(sdk.IntEq(t, valTokens, validator.Tokens)) - assert.True(sdk.DecEq(t, valTokens.ToDec(), validator.DelegatorShares)) - assert.Equal(t, types.Description{}, validator.Description) -} - -func TestInvalidPubKeyTypeMsgCreateValidator(t *testing.T) { +func TestTokenizeShares(t *testing.T) { initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 1, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - ctx = ctx.WithConsensusParams(&abci.ConsensusParams{ - Validator: &tmproto.ValidatorParams{PubKeyTypes: []string{tmtypes.ABCIPubKeyTypeEd25519}}, - }) - - addr := valAddrs[0] - invalidPk := secp256k1.GenPrivKey().PubKey() - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // invalid pukKey type should not be allowed - tstaking.CreateValidator(addr, invalidPk, sdk.NewInt(10), false) -} - -func TestBothPubKeyTypesMsgCreateValidator(t *testing.T) { - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, 1000, 2, sdk.NewInt(1000)) - ctx = ctx.WithConsensusParams(&abci.ConsensusParams{ - Validator: &tmproto.ValidatorParams{PubKeyTypes: []string{tmtypes.ABCIPubKeyTypeEd25519, tmtypes.ABCIPubKeyTypeSecp256k1}}, - }) - - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) testCases := []struct { - name string - addr sdk.ValAddress - pk cryptotypes.PubKey + name string + delIndex int64 + valIndex int64 + amount sdk.Int + isSuccess bool + expStatus sdkstaking.BondStatus + expJailed bool }{ { - "can create a validator with ed25519 pubkey", - valAddrs[0], - ed25519.GenPrivKey().PubKey(), + "tokenize shares for less than self delegation", + 0, 0, + sdk.NewInt(10000), + true, + sdkstaking.Bonded, + false, + }, + { + "tokenize shares for more than self delegation", + 0, 0, + sdk.TokensFromConsensusPower(initPower+1, sdk.DefaultPowerReduction), + false, + sdkstaking.Bonded, + false, + }, + { + "tokenize share for full self delegation", + 0, 0, + sdk.TokensFromConsensusPower(50, sdk.DefaultPowerReduction), + true, + sdkstaking.Bonded, + false, + }, + { + "tokenize shares for less than delegation", + 1, 0, + sdk.NewInt(1000), + true, + sdkstaking.Bonded, + false, }, { - "can create a validator with secp256k1 pubkey", - valAddrs[1], - secp256k1.GenPrivKey().PubKey(), + "tokenize shares for more than delegation", + 1, 0, + sdk.NewInt(20000), + false, + sdkstaking.Bonded, + false, }, } for _, tc := range testCases { t.Run(tc.name, func(*testing.T) { - tstaking.CreateValidator(tc.addr, tc.pk, sdk.NewInt(10), true) - }) - } -} - -func TestLegacyValidatorDelegations(t *testing.T) { - initPower := int64(1000) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - valAddr := valAddrs[0] - valConsPubKey, valConsAddr := PKs[0], sdk.ConsAddress(PKs[0].Address()) - delAddr := delAddrs[1] - - // create validator - bondAmount := tstaking.CreateValidatorWithValPower(valAddr, valConsPubKey, 10, true) - - // must end-block - updates, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 1, len(updates)) - - // verify the validator exists and has the correct attributes - validator := tstaking.CheckValidator(valAddr, types.Bonded, false) - require.Equal(t, bondAmount, validator.DelegatorShares.RoundInt()) - require.Equal(t, bondAmount, validator.BondedTokens()) - - // delegate tokens to the validator - tstaking.Delegate(delAddr, valAddr, bondAmount) - - // verify validator bonded shares - validator = tstaking.CheckValidator(valAddr, types.Bonded, false) - require.Equal(t, bondAmount.MulRaw(2), validator.DelegatorShares.RoundInt()) - require.Equal(t, bondAmount.MulRaw(2), validator.BondedTokens()) - - // unbond validator total self-delegations (which should jail the validator) - res := tstaking.Undelegate(sdk.AccAddress(valAddr), valAddr, bondAmount, true) - - var resData types.MsgUndelegateResponse - err = proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - - ctx = ctx.WithBlockTime(resData.CompletionTime) - tstaking.Ctx = ctx - staking.EndBlocker(ctx, app.StakingKeeper) - - // verify the validator record still exists, is jailed, and has correct tokens - validator = tstaking.CheckValidator(valAddr, -1, true) - require.Equal(t, bondAmount, validator.Tokens) - - // verify delegation still exists - bond, found := app.StakingKeeper.GetDelegation(ctx, delAddr, valAddr) - require.True(t, found) - require.Equal(t, bondAmount, bond.Shares.RoundInt()) - require.Equal(t, bondAmount, validator.DelegatorShares.RoundInt()) - - // verify the validator can still self-delegate - tstaking.Delegate(sdk.AccAddress(valAddr), valAddr, bondAmount) - - // verify validator bonded shares - validator, found = app.StakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) - require.Equal(t, bondAmount.MulRaw(2), validator.DelegatorShares.RoundInt()) - require.Equal(t, bondAmount.MulRaw(2), validator.Tokens) + app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) + val1 := valAddrs[0] + del2 := delAddrs[1] + tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - // unjail the validator now that is has non-zero self-delegated shares - app.StakingKeeper.Unjail(ctx, valConsAddr) + // set staking params + params := app.StakingKeeper.GetParams(ctx) + params.MaxValidators = 2 + app.StakingKeeper.SetParams(ctx, params) - // verify the validator can now accept delegations - tstaking.Delegate(delAddr, valAddr, bondAmount) - - // verify validator bonded shares - validator, found = app.StakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) - require.Equal(t, bondAmount.MulRaw(3), validator.DelegatorShares.RoundInt()) - require.Equal(t, bondAmount.MulRaw(3), validator.Tokens) - - // verify new delegation - bond, found = app.StakingKeeper.GetDelegation(ctx, delAddr, valAddr) - require.True(t, found) - require.Equal(t, bondAmount.MulRaw(2), bond.Shares.RoundInt()) - require.Equal(t, bondAmount.MulRaw(3), validator.DelegatorShares.RoundInt()) -} - -func TestIncrementsMsgDelegate(t *testing.T) { - initPower := int64(1000) - initBond := sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - - params := app.StakingKeeper.GetParams(ctx) - validatorAddr, delegatorAddr := valAddrs[0], delAddrs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // first create validator - bondAmount := tstaking.CreateValidatorWithValPower(validatorAddr, PKs[0], 10, true) - - // apply TM updates - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - - validator := tstaking.CheckValidator(validatorAddr, types.Bonded, false) - require.Equal(t, bondAmount, validator.DelegatorShares.RoundInt()) - require.Equal(t, bondAmount, validator.BondedTokens(), "validator: %v", validator) - - tstaking.CheckDelegator(delegatorAddr, validatorAddr, false) - - bond, found := app.StakingKeeper.GetDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.True(t, found) - require.Equal(t, bondAmount, bond.Shares.RoundInt()) - - bondedTokens := app.StakingKeeper.TotalBondedTokens(ctx) - require.Equal(t, bondAmount, bondedTokens) - - for i := int64(0); i < 5; i++ { - ctx = ctx.WithBlockHeight(i) - tstaking.Ctx = ctx - tstaking.Delegate(delegatorAddr, validatorAddr, bondAmount) - - // Check that the accounts and the bond account have the appropriate values - validator, found := app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - bond, found := app.StakingKeeper.GetDelegation(ctx, delegatorAddr, validatorAddr) - require.True(t, found) - - expBond := bondAmount.MulRaw(i + 1) - expDelegatorShares := bondAmount.MulRaw(i + 2) // (1 self delegation) - expDelegatorAcc := initBond.Sub(expBond) - - gotBond := bond.Shares.RoundInt() - gotDelegatorShares := validator.DelegatorShares.RoundInt() - gotDelegatorAcc := app.BankKeeper.GetBalance(ctx, delegatorAddr, params.BondDenom).Amount - - require.Equal(t, expBond, gotBond, - "i: %v\nexpBond: %v\ngotBond: %v\nvalidator: %v\nbond: %v\n", - i, expBond, gotBond, validator, bond) - require.Equal(t, expDelegatorShares, gotDelegatorShares, - "i: %v\nexpDelegatorShares: %v\ngotDelegatorShares: %v\nvalidator: %v\nbond: %v\n", - i, expDelegatorShares, gotDelegatorShares, validator, bond) - require.Equal(t, expDelegatorAcc, gotDelegatorAcc, - "i: %v\nexpDelegatorAcc: %v\ngotDelegatorAcc: %v\nvalidator: %v\nbond: %v\n", - i, expDelegatorAcc, gotDelegatorAcc, validator, bond) - } -} + // add validators + tstaking.CreateValidatorWithValPower(val1, PKs[0], 50, true) -func TestEditValidatorDecreaseMinSelfDelegation(t *testing.T) { - initPower := int64(100) - initBond := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 1, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) + // call it to update validator status to bonded + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + require.NoError(t, err) - validatorAddr := valAddrs[0] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) + // delegate tokens to the validator + tstaking.Delegate(del2, val1, sdk.NewInt(10000)) - // create validator - msgCreateValidator := tstaking.CreateValidatorMsg(validatorAddr, PKs[0], initBond) - msgCreateValidator.MinSelfDelegation = sdk.NewInt(2) - tstaking.Handle(msgCreateValidator, true) + del := delAddrs[tc.delIndex] + val := valAddrs[tc.valIndex] - // must end-block - updates, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 1, len(updates)) + tstaking.TokenizeShares(del, val, sdk.NewCoin(sdk.DefaultBondDenom, tc.amount), del, tc.isSuccess) - // verify the self-delegation exists - bond, found := app.StakingKeeper.GetDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.True(t, found) - gotBond := bond.Shares.RoundInt() - require.Equal(t, initBond, gotBond, - "initBond: %v\ngotBond: %v\nbond: %v\n", - initBond, gotBond, bond) + if tc.isSuccess { + // call it to update validator status automatically + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + require.NoError(t, err) - newMinSelfDelegation := sdk.OneInt() - msgEditValidator := types.NewMsgEditValidator(validatorAddr, types.Description{}, nil, &newMinSelfDelegation) - tstaking.Handle(msgEditValidator, false) -} - -func TestEditValidatorIncreaseMinSelfDelegationBeyondCurrentBond(t *testing.T) { - initPower := int64(100) - initBond := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) - - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr := valAddrs[0] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // create validator - msgCreateValidator := tstaking.CreateValidatorMsg(validatorAddr, PKs[0], initBond) - msgCreateValidator.MinSelfDelegation = sdk.NewInt(2) - tstaking.Handle(msgCreateValidator, true) - - // must end-block - updates, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 1, len(updates)) - - // verify the self-delegation exists - bond, found := app.StakingKeeper.GetDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.True(t, found) - gotBond := bond.Shares.RoundInt() - require.Equal(t, initBond, gotBond, - "initBond: %v\ngotBond: %v\nbond: %v\n", - initBond, gotBond, bond) - - newMinSelfDelegation := initBond.Add(sdk.OneInt()) - msgEditValidator := types.NewMsgEditValidator(validatorAddr, types.Description{}, nil, &newMinSelfDelegation) - tstaking.Handle(msgEditValidator, false) -} - -func TestIncrementsMsgUnbond(t *testing.T) { - initPower := int64(1000) - - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - params := app.StakingKeeper.GetParams(ctx) - denom := params.BondDenom - - // create validator, delegate - validatorAddr, delegatorAddr := valAddrs[0], delAddrs[1] - initBond := tstaking.CreateValidatorWithValPower(validatorAddr, PKs[0], initPower, true) - - // initial balance - amt1 := app.BankKeeper.GetBalance(ctx, delegatorAddr, denom).Amount - - tstaking.Delegate(delegatorAddr, validatorAddr, initBond) - - // balance should have been subtracted after delegation - amt2 := app.BankKeeper.GetBalance(ctx, delegatorAddr, denom).Amount - require.True(sdk.IntEq(t, amt1.Sub(initBond), amt2)) - - // apply TM updates - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - - validator, found := app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - require.Equal(t, initBond.MulRaw(2), validator.DelegatorShares.RoundInt()) - require.Equal(t, initBond.MulRaw(2), validator.BondedTokens()) - - // just send the same msgUnbond multiple times - // TODO use decimals here - unbondAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)) - msgUndelegate := types.NewMsgUndelegate(delegatorAddr, validatorAddr, unbondAmt) - numUnbonds := int64(5) - - for i := int64(0); i < numUnbonds; i++ { - res := tstaking.Handle(msgUndelegate, true) - - var resData types.MsgUndelegateResponse - err := proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - - ctx = ctx.WithBlockTime(resData.CompletionTime) - tstaking.Ctx = ctx - staking.EndBlocker(ctx, app.StakingKeeper) - - // check that the accounts and the bond account have the appropriate values - validator, found = app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - bond, found := app.StakingKeeper.GetDelegation(ctx, delegatorAddr, validatorAddr) - require.True(t, found) - - expBond := initBond.Sub(unbondAmt.Amount.Mul(sdk.NewInt(i + 1))) - expDelegatorShares := initBond.MulRaw(2).Sub(unbondAmt.Amount.Mul(sdk.NewInt(i + 1))) - expDelegatorAcc := initBond.Sub(expBond) - - gotBond := bond.Shares.RoundInt() - gotDelegatorShares := validator.DelegatorShares.RoundInt() - gotDelegatorAcc := app.BankKeeper.GetBalance(ctx, delegatorAddr, params.BondDenom).Amount - - require.Equal(t, expBond, gotBond, - "i: %v\nexpBond: %v\ngotBond: %v\nvalidator: %v\nbond: %v\n", - i, expBond, gotBond, validator, bond) - require.Equal(t, expDelegatorShares, gotDelegatorShares, - "i: %v\nexpDelegatorShares: %v\ngotDelegatorShares: %v\nvalidator: %v\nbond: %v\n", - i, expDelegatorShares, gotDelegatorShares, validator, bond) - require.Equal(t, expDelegatorAcc, gotDelegatorAcc, - "i: %v\nexpDelegatorAcc: %v\ngotDelegatorAcc: %v\nvalidator: %v\nbond: %v\n", - i, expDelegatorAcc, gotDelegatorAcc, validator, bond) - } - - // these are more than we have bonded now - errorCases := []sdk.Int{ - // 1<<64 - 1, // more than int64 power - // 1<<63 + 1, // more than int64 power - app.StakingKeeper.TokensFromConsensusPower(ctx, 1<<63-1), - app.StakingKeeper.TokensFromConsensusPower(ctx, 1<<31), - initBond, - } - - for _, c := range errorCases { - tstaking.Undelegate(delegatorAddr, validatorAddr, c, false) + tstaking.CheckValidator(val, tc.expStatus, tc.expJailed) + } + }) } - - // should be able to unbond remaining - leftBonded := initBond.Sub(unbondAmt.Amount.Mul(sdk.NewInt(numUnbonds))) - tstaking.Undelegate(delegatorAddr, validatorAddr, leftBonded, true) } -func TestMultipleMsgCreateValidator(t *testing.T) { +func TestRedeemTokensforShares(t *testing.T) { initPower := int64(1000) - initTokens := sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - - params := app.StakingKeeper.GetParams(ctx) - blockTime := time.Now().UTC() - ctx = ctx.WithBlockTime(blockTime) - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - validatorAddrs := []sdk.ValAddress{ - valAddrs[0], - valAddrs[1], - valAddrs[2], - } - delegatorAddrs := []sdk.AccAddress{ - delAddrs[0], - delAddrs[1], - delAddrs[2], - } - - // bond them all - amt := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - for i, validatorAddr := range validatorAddrs { - tstaking.CreateValidator(validatorAddr, PKs[i], amt, true) - // verify that the account is bonded - validators := app.StakingKeeper.GetValidators(ctx, 100) - require.Equal(t, (i + 1), len(validators)) - - val := validators[i] - balanceExpd := initTokens.Sub(amt) - balanceGot := app.BankKeeper.GetBalance(ctx, delegatorAddrs[i], params.BondDenom).Amount - - require.Equal(t, i+1, len(validators), "expected %d validators got %d, validators: %v", i+1, len(validators), validators) - require.Equal(t, amt, val.DelegatorShares.RoundInt(), "expected %d shares, got %d", amt, val.DelegatorShares) - require.Equal(t, balanceExpd, balanceGot, "expected account to have %d, got %d", balanceExpd, balanceGot) + testCases := []struct { + name string + amount sdk.Int + isSuccess bool + }{ + { + "redeem full shares", + sdk.NewInt(10000), + true, + }, + { + "redeem partial shares", + sdk.NewInt(1000), + true, + }, + { + "redeem zero shares", + sdk.NewInt(0), + false, + }, + { + "redeem more than shares", + sdk.NewInt(20000), + false, + }, } + for _, tc := range testCases { + t.Run(tc.name, func(*testing.T) { + app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) + val1 := valAddrs[0] + del2 := delAddrs[1] + tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - staking.EndBlocker(ctx, app.StakingKeeper) - - // unbond them all by removing delegation - for i, validatorAddr := range validatorAddrs { - _, found := app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - - res := tstaking.Undelegate(delegatorAddrs[i], validatorAddr, amt, true) + // set staking params + params := app.StakingKeeper.GetParams(ctx) + params.MaxValidators = 2 + app.StakingKeeper.SetParams(ctx, params) - var resData types.MsgUndelegateResponse - err := proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) + // add validators + tstaking.CreateValidatorWithValPower(val1, PKs[0], 50, true) - // adds validator into unbonding queue - staking.EndBlocker(ctx, app.StakingKeeper) + // call it to update validator status to bonded + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + require.NoError(t, err) - // removes validator from queue and set - staking.EndBlocker(ctx.WithBlockTime(blockTime.Add(params.UnbondingTime)), app.StakingKeeper) + // delegate tokens to the validator + tstaking.Delegate(del2, val1, sdk.NewInt(10000)) - // Check that the validator is deleted from state - validators := app.StakingKeeper.GetValidators(ctx, 100) - require.Equal(t, len(validatorAddrs)-(i+1), len(validators), - "expected %d validators got %d", len(validatorAddrs)-(i+1), len(validators)) + // tokenize shares + tstaking.TokenizeShares(del2, val1, sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000), del2, true) - _, found = app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.False(t, found) + // get tokenize share record + record, err := app.StakingKeeper.GetTokenizeShareRecord(ctx, 1) + require.NoError(t, err) - gotBalance := app.BankKeeper.GetBalance(ctx, delegatorAddrs[i], params.BondDenom).Amount - require.Equal(t, initTokens, gotBalance, "expected account to have %d, got %d", initTokens, gotBalance) + // redeem share + tstaking.RedeemTokensForShares(del2, sdk.NewCoin(record.GetShareTokenDenom(), tc.amount), tc.isSuccess) + }) } } -func TestMultipleMsgDelegate(t *testing.T) { +func TransferTokenizeShareRecord(t *testing.T) { initPower := int64(1000) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 50, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr, delegatorAddrs := valAddrs[0], delAddrs[1:] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - var amount int64 = 10 - - // first make a validator - tstaking.CreateValidator(validatorAddr, PKs[0], sdk.NewInt(amount), true) - - // delegate multiple parties - for _, delegatorAddr := range delegatorAddrs { - tstaking.Delegate(delegatorAddr, validatorAddr, sdk.NewInt(10)) - tstaking.CheckDelegator(delegatorAddr, validatorAddr, true) - } - - // unbond them all - for _, delegatorAddr := range delegatorAddrs { - res := tstaking.Undelegate(delegatorAddr, validatorAddr, sdk.NewInt(amount), true) - - var resData types.MsgUndelegateResponse - err := proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - ctx = ctx.WithBlockTime(resData.CompletionTime) - staking.EndBlocker(ctx, app.StakingKeeper) - tstaking.Ctx = ctx - - // check that the account is unbonded - _, found := app.StakingKeeper.GetDelegation(ctx, delegatorAddr, validatorAddr) - require.False(t, found) + testCases := []struct { + name string + recordID uint64 + oldOwner int64 + newOwner int64 + isSuccess bool + }{ + { + "transfer to other", + 1, + 2, 1, + true, + }, + { + "self transfer", + 1, + 2, 2, + true, + }, + { + "transfer non-existent", + 2, + 2, 2, + false, + }, } -} - -func TestJailValidator(t *testing.T) { - initPower := int64(1000) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr, delegatorAddr := valAddrs[0], delAddrs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - var amt int64 = 10 - - // create the validator and delegate - tstaking.CreateValidator(validatorAddr, PKs[0], sdk.NewInt(amt), true) - tstaking.Delegate(delegatorAddr, validatorAddr, sdk.NewInt(amt)) - - // unbond the validators bond portion - unamt := sdk.NewInt(amt) - res := tstaking.Undelegate(sdk.AccAddress(validatorAddr), validatorAddr, unamt, true) - - var resData types.MsgUndelegateResponse - err := proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - - ctx = ctx.WithBlockTime(resData.CompletionTime) - staking.EndBlocker(ctx, app.StakingKeeper) - tstaking.Ctx = ctx - - tstaking.CheckValidator(validatorAddr, -1, true) - - // test that the delegator can still withdraw their bonds - tstaking.Undelegate(delegatorAddr, validatorAddr, unamt, true) - - err = proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - - ctx = ctx.WithBlockTime(resData.CompletionTime) - staking.EndBlocker(ctx, app.StakingKeeper) - tstaking.Ctx = ctx - - // verify that the pubkey can now be reused - tstaking.CreateValidator(validatorAddr, PKs[0], sdk.NewInt(amt), true) -} - -func TestValidatorQueue(t *testing.T) { - initPower := int64(1000) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr, delegatorAddr := valAddrs[0], delAddrs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.UnbondingTime = 7 * time.Second - app.StakingKeeper.SetParams(ctx, params) - - // create the validator and make a bond - amt := tstaking.CreateValidatorWithValPower(validatorAddr, PKs[0], 10, true) - tstaking.Delegate(delegatorAddr, validatorAddr, amt) - staking.EndBlocker(ctx, app.StakingKeeper) - - // unbond the all self-delegation to put validator in unbonding state - res := tstaking.Undelegate(sdk.AccAddress(validatorAddr), validatorAddr, amt, true) - - var resData types.MsgUndelegateResponse - err := proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - - finishTime := resData.CompletionTime - - ctx = tstaking.TurnBlock(finishTime) - origHeader := ctx.BlockHeader() - - validator, found := app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - require.True(t, validator.IsUnbonding(), "%v", validator) - - // should still be unbonding at time 6 seconds later - ctx = tstaking.TurnBlock(origHeader.Time.Add(time.Second * 6)) - - validator, found = app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - require.True(t, validator.IsUnbonding(), "%v", validator) - - // should be in unbonded state at time 7 seconds later - ctx = tstaking.TurnBlock(origHeader.Time.Add(time.Second * 7)) - - validator, found = app.StakingKeeper.GetValidator(ctx, validatorAddr) - require.True(t, found) - require.True(t, validator.IsUnbonded(), "%v", validator) -} - -func TestUnbondingPeriod(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 1, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr := valAddrs[0] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.UnbondingTime = 7 * time.Second - app.StakingKeeper.SetParams(ctx, params) - - // create the validator - amt := tstaking.CreateValidatorWithValPower(validatorAddr, PKs[0], 10, true) - staking.EndBlocker(ctx, app.StakingKeeper) - - // begin unbonding - tstaking.Undelegate(sdk.AccAddress(validatorAddr), validatorAddr, amt, true) - - origHeader := ctx.BlockHeader() - - _, found := app.StakingKeeper.GetUnbondingDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.True(t, found, "should not have unbonded") - - // cannot complete unbonding at same time - staking.EndBlocker(ctx, app.StakingKeeper) - _, found = app.StakingKeeper.GetUnbondingDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.True(t, found, "should not have unbonded") - - // cannot complete unbonding at time 6 seconds later - ctx = tstaking.TurnBlock(origHeader.Time.Add(time.Second * 6)) - _, found = app.StakingKeeper.GetUnbondingDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.True(t, found, "should not have unbonded") - - // can complete unbonding at time 7 seconds later - ctx = tstaking.TurnBlock(origHeader.Time.Add(time.Second * 7)) - _, found = app.StakingKeeper.GetUnbondingDelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr) - require.False(t, found, "should have unbonded") -} - -func TestUnbondingFromUnbondingValidator(t *testing.T) { - initPower := int64(1000) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr, delegatorAddr := valAddrs[0], delAddrs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // create the validator and delegate - tstaking.CreateValidator(validatorAddr, PKs[0], sdk.NewInt(10), true) - tstaking.Delegate(delegatorAddr, validatorAddr, sdk.NewInt(10)) - - // unbond the validators bond portion - unbondAmt := sdk.NewInt(10) - res := tstaking.Undelegate(sdk.AccAddress(validatorAddr), validatorAddr, unbondAmt, true) - - // change the ctx to Block Time one second before the validator would have unbonded - var resData types.MsgUndelegateResponse - err := proto.Unmarshal(res.Data, &resData) - require.NoError(t, err) - - ctx = ctx.WithBlockTime(resData.CompletionTime.Add(time.Second * -1)) - - // unbond the delegator from the validator - res = tstaking.Undelegate(delegatorAddr, validatorAddr, unbondAmt, true) - - ctx = tstaking.TurnBlockTimeDiff(app.StakingKeeper.UnbondingTime(ctx)) - tstaking.Ctx = ctx - - // Check to make sure that the unbonding delegation is no longer in state - // (meaning it was deleted in the above EndBlocker) - _, found := app.StakingKeeper.GetUnbondingDelegation(ctx, delegatorAddr, validatorAddr) - require.False(t, found, "should be removed from state") -} - -func TestRedelegationPeriod(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - validatorAddr, validatorAddr2 := valAddrs[0], valAddrs[1] - denom := app.StakingKeeper.GetParams(ctx).BondDenom - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.UnbondingTime = 7 * time.Second - app.StakingKeeper.SetParams(ctx, params) - // initial balance - amt1 := app.BankKeeper.GetBalance(ctx, sdk.AccAddress(validatorAddr), denom).Amount - - // create the validators - tstaking.CreateValidator(validatorAddr, PKs[0], sdk.NewInt(10), true) - - // balance should have been subtracted after creation - amt2 := app.BankKeeper.GetBalance(ctx, sdk.AccAddress(validatorAddr), denom).Amount - require.Equal(t, amt1.Sub(sdk.NewInt(10)), amt2, "expected coins to be subtracted") - - tstaking.CreateValidator(validatorAddr2, PKs[1], sdk.NewInt(10), true) - bal1 := app.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(validatorAddr)) - - // begin redelegate - redAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)) - msgBeginRedelegate := types.NewMsgBeginRedelegate(sdk.AccAddress(validatorAddr), validatorAddr, validatorAddr2, redAmt) - tstaking.Handle(msgBeginRedelegate, true) - - // origin account should not lose tokens as with a regular delegation - bal2 := app.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(validatorAddr)) - require.Equal(t, bal1, bal2) - - origHeader := ctx.BlockHeader() - - // cannot complete redelegation at same time - staking.EndBlocker(ctx, app.StakingKeeper) - _, found := app.StakingKeeper.GetRedelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr, validatorAddr2) - require.True(t, found, "should not have unbonded") - - // cannot complete redelegation at time 6 seconds later - ctx = tstaking.TurnBlock(origHeader.Time.Add(time.Second * 6)) - _, found = app.StakingKeeper.GetRedelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr, validatorAddr2) - require.True(t, found, "should not have unbonded") - - // can complete redelegation at time 7 seconds later - ctx = tstaking.TurnBlock(origHeader.Time.Add(time.Second * 7)) - _, found = app.StakingKeeper.GetRedelegation(ctx, sdk.AccAddress(validatorAddr), validatorAddr, validatorAddr2) - require.False(t, found, "should have unbonded") -} - -func TestTransitiveRedelegation(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - - val1, val2, val3 := valAddrs[0], valAddrs[1], valAddrs[2] - blockTime := time.Now().UTC() - ctx = ctx.WithBlockTime(blockTime) - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // create the validators - tstaking.CreateValidator(val1, PKs[0], sdk.NewInt(10), true) - tstaking.CreateValidator(val2, PKs[1], sdk.NewInt(10), true) - tstaking.CreateValidator(val3, PKs[2], sdk.NewInt(10), true) - - // begin redelegate - redAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)) - msgBeginRedelegate := types.NewMsgBeginRedelegate(sdk.AccAddress(val1), val1, val2, redAmt) - tstaking.Handle(msgBeginRedelegate, true) - - // cannot redelegation to next validator while first delegation exists - msgBeginRedelegate = types.NewMsgBeginRedelegate(sdk.AccAddress(val1), val2, val3, redAmt) - tstaking.Handle(msgBeginRedelegate, false) - - params := app.StakingKeeper.GetParams(ctx) - ctx = ctx.WithBlockTime(blockTime.Add(params.UnbondingTime)) - tstaking.Ctx = ctx - - // complete first redelegation - staking.EndBlocker(ctx, app.StakingKeeper) - - // now should be able to redelegate from the second validator to the third - tstaking.Handle(msgBeginRedelegate, true) -} - -func TestMultipleRedelegationAtSameTime(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - valAddr := valAddrs[0] - valAddr2 := valAddrs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.UnbondingTime = 1 * time.Second - app.StakingKeeper.SetParams(ctx, params) - - // create the validators - valTokens := tstaking.CreateValidatorWithValPower(valAddr, PKs[0], 10, true) - tstaking.CreateValidator(valAddr2, PKs[1], valTokens, true) - - // end block to bond them - staking.EndBlocker(ctx, app.StakingKeeper) - - // begin a redelegate - selfDelAddr := sdk.AccAddress(valAddr) // (the validator is it's own delegator) - redAmt := sdk.NewCoin(sdk.DefaultBondDenom, valTokens.QuoRaw(2)) - msgBeginRedelegate := types.NewMsgBeginRedelegate(selfDelAddr, valAddr, valAddr2, redAmt) - tstaking.Handle(msgBeginRedelegate, true) - - // there should only be one entry in the redelegation object - rd, found := app.StakingKeeper.GetRedelegation(ctx, selfDelAddr, valAddr, valAddr2) - require.True(t, found) - require.Len(t, rd.Entries, 1) - - // start a second redelegation at this same time as the first - tstaking.Handle(msgBeginRedelegate, true) - - // now there should be two entries - rd, found = app.StakingKeeper.GetRedelegation(ctx, selfDelAddr, valAddr, valAddr2) - require.True(t, found) - require.Len(t, rd.Entries, 2) - - // move forward in time, should complete both redelegations - ctx = tstaking.TurnBlockTimeDiff(1 * time.Second) - rd, found = app.StakingKeeper.GetRedelegation(ctx, selfDelAddr, valAddr, valAddr2) - require.False(t, found) -} - -func TestMultipleRedelegationAtUniqueTimes(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 2, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - valAddr := valAddrs[0] - valAddr2 := valAddrs[1] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.UnbondingTime = 10 * time.Second - app.StakingKeeper.SetParams(ctx, params) - - // create the validators - valTokens := tstaking.CreateValidatorWithValPower(valAddr, PKs[0], 10, true) - tstaking.CreateValidator(valAddr2, PKs[1], valTokens, true) - - // end block to bond them - staking.EndBlocker(ctx, app.StakingKeeper) - - // begin a redelegate - selfDelAddr := sdk.AccAddress(valAddr) // (the validator is it's own delegator) - redAmt := sdk.NewCoin(sdk.DefaultBondDenom, valTokens.QuoRaw(2)) - msgBeginRedelegate := types.NewMsgBeginRedelegate(selfDelAddr, valAddr, valAddr2, redAmt) - tstaking.Handle(msgBeginRedelegate, true) - - // move forward in time and start a second redelegation - ctx = ctx.WithBlockTime(ctx.BlockHeader().Time.Add(5 * time.Second)) - tstaking.Ctx = ctx - tstaking.Handle(msgBeginRedelegate, true) - - // now there should be two entries - rd, found := app.StakingKeeper.GetRedelegation(ctx, selfDelAddr, valAddr, valAddr2) - require.True(t, found) - require.Len(t, rd.Entries, 2) - - // move forward in time, should complete the first redelegation, but not the second - ctx = tstaking.TurnBlockTimeDiff(5 * time.Second) - rd, found = app.StakingKeeper.GetRedelegation(ctx, selfDelAddr, valAddr, valAddr2) - require.True(t, found) - require.Len(t, rd.Entries, 1) - - // move forward in time, should complete the second redelegation - ctx = tstaking.TurnBlockTimeDiff(5 * time.Second) - rd, found = app.StakingKeeper.GetRedelegation(ctx, selfDelAddr, valAddr, valAddr2) - require.False(t, found) -} - -func TestMultipleUnbondingDelegationAtSameTime(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 1, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - valAddr := valAddrs[0] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.UnbondingTime = 1 * time.Second - app.StakingKeeper.SetParams(ctx, params) - - // create the validators - valTokens := tstaking.CreateValidatorWithValPower(valAddr, PKs[0], 10, true) - - // end block to bond - staking.EndBlocker(ctx, app.StakingKeeper) - - // begin an unbonding delegation - selfDelAddr := sdk.AccAddress(valAddr) // (the validator is it's own delegator) - tstaking.Undelegate(selfDelAddr, valAddr, valTokens.QuoRaw(2), true) - - // there should only be one entry in the ubd object - ubd, found := app.StakingKeeper.GetUnbondingDelegation(ctx, selfDelAddr, valAddr) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // start a second ubd at this same time as the first - tstaking.Undelegate(selfDelAddr, valAddr, valTokens.QuoRaw(2), true) - - // now there should be two entries - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, selfDelAddr, valAddr) - require.True(t, found) - require.Len(t, ubd.Entries, 2) - - // move forwaubd in time, should complete both ubds - ctx = tstaking.TurnBlockTimeDiff(1 * time.Second) - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, selfDelAddr, valAddr) - require.False(t, found) -} - -func TestMultipleUnbondingDelegationAtUniqueTimes(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 1, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - valAddr := valAddrs[0] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.UnbondingTime = 10 * time.Second - app.StakingKeeper.SetParams(ctx, params) - - // create the validator - valTokens := tstaking.CreateValidatorWithValPower(valAddr, PKs[0], 10, true) - - // end block to bond - staking.EndBlocker(ctx, app.StakingKeeper) - - // begin an unbonding delegation - selfDelAddr := sdk.AccAddress(valAddr) // (the validator is it's own delegator) - tstaking.Undelegate(selfDelAddr, valAddr, valTokens.QuoRaw(2), true) - - // there should only be one entry in the ubd object - ubd, found := app.StakingKeeper.GetUnbondingDelegation(ctx, selfDelAddr, valAddr) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // move forwaubd in time and start a second redelegation - ctx = ctx.WithBlockTime(ctx.BlockHeader().Time.Add(5 * time.Second)) - tstaking.Ctx = ctx - tstaking.Undelegate(selfDelAddr, valAddr, valTokens.QuoRaw(2), true) - - // now there should be two entries - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, selfDelAddr, valAddr) - require.True(t, found) - require.Len(t, ubd.Entries, 2) - - // move forwaubd in time, should complete the first redelegation, but not the second - ctx = tstaking.TurnBlockTimeDiff(5 * time.Second) - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, selfDelAddr, valAddr) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // move forwaubd in time, should complete the second redelegation - ctx = tstaking.TurnBlockTimeDiff(5 * time.Second) - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, selfDelAddr, valAddr) - require.False(t, found) -} - -func TestUnbondingWhenExcessValidators(t *testing.T) { - initPower := int64(1000) - app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - val1 := valAddrs[0] - val2 := valAddrs[1] - val3 := valAddrs[2] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - // set the unbonding time - params := app.StakingKeeper.GetParams(ctx) - params.MaxValidators = 2 - app.StakingKeeper.SetParams(ctx, params) - - // add three validators - tstaking.CreateValidatorWithValPower(val1, PKs[0], 50, true) - // apply TM updates - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.Equal(t, 1, len(app.StakingKeeper.GetLastValidators(ctx))) - - valTokens2 := tstaking.CreateValidatorWithValPower(val2, PKs[1], 30, true) - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.Equal(t, 2, len(app.StakingKeeper.GetLastValidators(ctx))) - - tstaking.CreateValidatorWithValPower(val3, PKs[2], 10, true) - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.Equal(t, 2, len(app.StakingKeeper.GetLastValidators(ctx))) - - // unbond the validator-2 - tstaking.Undelegate(sdk.AccAddress(val2), val2, valTokens2, true) - // apply TM updates - app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - - // because there are extra validators waiting to get in, the queued - // validator (aka. validator-1) should make it into the bonded group, thus - // the total number of validators should stay the same - vals := app.StakingKeeper.GetLastValidators(ctx) - require.Equal(t, 2, len(vals), "vals %v", vals) - tstaking.CheckValidator(val1, types.Bonded, false) -} - -func TestBondUnbondRedelegateSlashTwice(t *testing.T) { - initPower := int64(1000) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - valA, valB, del := valAddrs[0], valAddrs[1], delAddrs[2] - consAddr0 := sdk.ConsAddress(PKs[0].Address()) - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - valTokens := tstaking.CreateValidatorWithValPower(valA, PKs[0], 10, true) - tstaking.CreateValidator(valB, PKs[1], valTokens, true) - - // delegate 10 stake - tstaking.Delegate(del, valA, valTokens) - - // apply Tendermint updates - updates, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 2, len(updates)) - - // a block passes - ctx = ctx.WithBlockHeight(1) - tstaking.Ctx = ctx - - // begin unbonding 4 stake - unbondAmt := app.StakingKeeper.TokensFromConsensusPower(ctx, 4) - tstaking.Undelegate(del, valA, unbondAmt, true) - - // begin redelegate 6 stake - redAmt := sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 6)) - msgBeginRedelegate := types.NewMsgBeginRedelegate(del, valA, valB, redAmt) - tstaking.Handle(msgBeginRedelegate, true) - - // destination delegation should have 6 shares - delegation, found := app.StakingKeeper.GetDelegation(ctx, del, valB) - require.True(t, found) - require.Equal(t, sdk.NewDecFromInt(redAmt.Amount), delegation.Shares) - - // must apply validator updates - updates, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - require.NoError(t, err) - require.Equal(t, 2, len(updates)) - - // slash the validator by half - app.StakingKeeper.Slash(ctx, consAddr0, 0, 20, sdk.NewDecWithPrec(5, 1), 0) - - // unbonding delegation should have been slashed by half - ubd, found := app.StakingKeeper.GetUnbondingDelegation(ctx, del, valA) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - require.Equal(t, unbondAmt.QuoRaw(2), ubd.Entries[0].Balance) - - // redelegation should have been slashed by half - redelegation, found := app.StakingKeeper.GetRedelegation(ctx, del, valA, valB) - require.True(t, found) - require.Len(t, redelegation.Entries, 1) - - // destination delegation should have been slashed by half - delegation, found = app.StakingKeeper.GetDelegation(ctx, del, valB) - require.True(t, found) - require.Equal(t, sdk.NewDecFromInt(redAmt.Amount.QuoRaw(2)), delegation.Shares) - - // validator power should have been reduced by half - validator, found := app.StakingKeeper.GetValidator(ctx, valA) - require.True(t, found) - require.Equal(t, valTokens.QuoRaw(2), validator.GetBondedTokens()) - - // slash the validator for an infraction committed after the unbonding and redelegation begin - ctx = ctx.WithBlockHeight(3) - app.StakingKeeper.Slash(ctx, consAddr0, 2, 10, sdk.NewDecWithPrec(5, 1), 0) - tstaking.Ctx = ctx - - // unbonding delegation should be unchanged - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, del, valA) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - require.Equal(t, unbondAmt.QuoRaw(2), ubd.Entries[0].Balance) - - // redelegation should be unchanged - redelegation, found = app.StakingKeeper.GetRedelegation(ctx, del, valA, valB) - require.True(t, found) - require.Len(t, redelegation.Entries, 1) - - // destination delegation should be unchanged - delegation, found = app.StakingKeeper.GetDelegation(ctx, del, valB) - require.True(t, found) - require.Equal(t, sdk.NewDecFromInt(redAmt.Amount.QuoRaw(2)), delegation.Shares) - - // end blocker - staking.EndBlocker(ctx, app.StakingKeeper) - - // validator power should have been reduced to zero - // validator should be in unbonding state - validator, _ = app.StakingKeeper.GetValidator(ctx, valA) - require.Equal(t, validator.GetStatus(), types.Unbonding) -} - -func TestInvalidMsg(t *testing.T) { - k := keeper.Keeper{} - h := staking.NewHandler(k) - - res, err := h(sdk.NewContext(nil, tmproto.Header{}, false, nil), testdata.NewTestMsg()) - require.Error(t, err) - require.Nil(t, res) - require.True(t, strings.Contains(err.Error(), "unrecognized staking message type")) -} - -func TestInvalidCoinDenom(t *testing.T) { - initPower := int64(1000) - app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) - valA, valB, delAddr := valAddrs[0], valAddrs[1], delAddrs[2] - tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 100) - invalidCoin := sdk.NewCoin("churros", valTokens) - validCoin := sdk.NewCoin(sdk.DefaultBondDenom, valTokens) - oneCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()) - - commission := types.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.ZeroDec()) - msgCreate, err := types.NewMsgCreateValidator(valA, PKs[0], invalidCoin, types.Description{}, commission, sdk.OneInt()) - require.NoError(t, err) - tstaking.Handle(msgCreate, false) - - msgCreate, err = types.NewMsgCreateValidator(valA, PKs[0], validCoin, types.Description{}, commission, sdk.OneInt()) - require.NoError(t, err) - tstaking.Handle(msgCreate, true) - - msgCreate, err = types.NewMsgCreateValidator(valB, PKs[1], validCoin, types.Description{}, commission, sdk.OneInt()) - require.NoError(t, err) - tstaking.Handle(msgCreate, true) + for _, tc := range testCases { + t.Run(tc.name, func(*testing.T) { + app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, initPower, 3, sdk.TokensFromConsensusPower(initPower, sdk.DefaultPowerReduction)) + val1 := valAddrs[0] + del2 := delAddrs[1] + tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper) - msgDelegate := types.NewMsgDelegate(delAddr, valA, invalidCoin) - tstaking.Handle(msgDelegate, false) + // set staking params + params := app.StakingKeeper.GetParams(ctx) + params.MaxValidators = 2 + app.StakingKeeper.SetParams(ctx, params) - msgDelegate = types.NewMsgDelegate(delAddr, valA, validCoin) - tstaking.Handle(msgDelegate, true) + // add validators + tstaking.CreateValidatorWithValPower(val1, PKs[0], 50, true) - msgUndelegate := types.NewMsgUndelegate(delAddr, valA, invalidCoin) - tstaking.Handle(msgUndelegate, false) + // call it to update validator status to bonded + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + require.NoError(t, err) - msgUndelegate = types.NewMsgUndelegate(delAddr, valA, oneCoin) - tstaking.Handle(msgUndelegate, true) + // delegate tokens to the validator + tstaking.Delegate(del2, val1, sdk.NewInt(10000)) - msgRedelegate := types.NewMsgBeginRedelegate(delAddr, valA, valB, invalidCoin) - tstaking.Handle(msgRedelegate, false) + // tokenize shares + tstaking.TokenizeShares(del2, val1, sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000), del2, true) - msgRedelegate = types.NewMsgBeginRedelegate(delAddr, valA, valB, oneCoin) - tstaking.Handle(msgRedelegate, true) + // redeem share + tstaking.TranserTokenizeShareRecord(tc.recordID, delAddrs[tc.oldOwner], delAddrs[tc.newOwner], tc.isSuccess) + }) + } } diff --git a/x/staking/keeper/alias_functions.go b/x/staking/keeper/alias_functions.go index 59c4d23be2e..03942f2abcf 100644 --- a/x/staking/keeper/alias_functions.go +++ b/x/staking/keeper/alias_functions.go @@ -5,12 +5,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" ) // Validator Set // iterate through the validator set and perform the provided function -func (k Keeper) IterateValidators(ctx sdk.Context, fn func(index int64, validator types.ValidatorI) (stop bool)) { +func (k Keeper) IterateValidators(ctx sdk.Context, fn func(index int64, validator sdkstaking.ValidatorI) (stop bool)) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ValidatorsKey) @@ -30,7 +31,7 @@ func (k Keeper) IterateValidators(ctx sdk.Context, fn func(index int64, validato } // iterate through the bonded validator set and perform the provided function -func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index int64, validator types.ValidatorI) (stop bool)) { +func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index int64, validator sdkstaking.ValidatorI) (stop bool)) { store := ctx.KVStore(k.storeKey) maxValidators := k.MaxValidators(ctx) @@ -40,7 +41,7 @@ func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index in i := int64(0) for ; iterator.Valid() && i < int64(maxValidators); iterator.Next() { address := iterator.Value() - validator := k.mustGetValidator(ctx, address) + validator := k.mustGetLiquidValidator(ctx, address) if validator.IsBonded() { stop := fn(i, validator) // XXX is this safe will the validator unexposed fields be able to get written to? @@ -53,7 +54,7 @@ func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index in } // iterate through the active validator set and perform the provided function -func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, validator types.ValidatorI) (stop bool)) { +func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, validator sdkstaking.ValidatorI) (stop bool)) { iterator := k.LastValidatorsIterator(ctx) defer iterator.Close() @@ -62,7 +63,7 @@ func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, vali for ; iterator.Valid(); iterator.Next() { address := types.AddressFromLastValidatorPowerKey(iterator.Key()) - validator, found := k.GetValidator(ctx, address) + validator, found := k.GetLiquidValidator(ctx, address) if !found { panic(fmt.Sprintf("validator record not found for address: %v\n", address)) } @@ -76,8 +77,8 @@ func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, vali } // Validator gets the Validator interface for a particular address -func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) types.ValidatorI { - val, found := k.GetValidator(ctx, address) +func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) sdkstaking.ValidatorI { + val, found := k.GetLiquidValidator(ctx, address) if !found { return nil } @@ -86,7 +87,7 @@ func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) types.Validat } // ValidatorByConsAddr gets the validator interface for a particular pubkey -func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) types.ValidatorI { +func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) sdkstaking.ValidatorI { val, found := k.GetValidatorByConsAddr(ctx, addr) if !found { return nil @@ -103,8 +104,8 @@ func (k Keeper) GetValidatorSet() types.ValidatorSet { } // Delegation get the delegation interface for a particular set of delegator and validator addresses -func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) types.DelegationI { - bond, ok := k.GetDelegation(ctx, addrDel, addrVal) +func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) sdkstaking.DelegationI { + bond, ok := k.GetLiquidDelegation(ctx, addrDel, addrVal) if !ok { return nil } @@ -114,10 +115,10 @@ func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk. // iterate through all of the delegations from a delegator func (k Keeper) IterateDelegations(ctx sdk.Context, delAddr sdk.AccAddress, - fn func(index int64, del types.DelegationI) (stop bool), + fn func(index int64, del sdkstaking.DelegationI) (stop bool), ) { store := ctx.KVStore(k.storeKey) - delegatorPrefixKey := types.GetDelegationsKey(delAddr) + delegatorPrefixKey := types.GetLiquidDelegationsKey(delAddr) iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) // smallest to largest defer iterator.Close() diff --git a/x/staking/keeper/common_test.go b/x/staking/keeper/common_test.go index 99c3d2b27a7..c441e0afc18 100644 --- a/x/staking/keeper/common_test.go +++ b/x/staking/keeper/common_test.go @@ -7,7 +7,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -21,8 +21,8 @@ func init() { // createTestInput Returns a simapp with custom StakingKeeper // to avoid messing with the hooks. -func createTestInput() (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) { - app := simapp.Setup(false) +func createTestInput(t *testing.T) (*codec.LegacyAmino, *simapp.SimApp, sdk.Context) { + app := simapp.SetupWithValSet(t, false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) app.StakingKeeper = keeper.NewKeeper( @@ -47,3 +47,12 @@ func generateAddresses(app *simapp.SimApp, ctx sdk.Context, numAddrs int) ([]sdk return addrDels, addrVals } + +func delegateCoinsFromAccount(ctx sdk.Context, app *simapp.SimApp, addr sdk.AccAddress, amount sdk.Int, val types.Validator) error { + // bondDenom := app.StakingKeeper.BondDenom(ctx) + // coins := sdk.Coins{sdk.NewCoin(bondDenom, amount)} + // app.BankKeeper.DelegateCoinsFromAccountToModule(ctx, addr, types.EpochDelegationPoolName, coins) + _, err := app.StakingKeeper.Delegate(ctx, addr, amount, types.Unbonded, val, true) + + return err +} diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index e204f71c152..ba92802a21f 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -5,17 +5,32 @@ import ( "fmt" "time" + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/staking/types" ) -// return a specific delegation -func (k Keeper) GetDelegation(ctx sdk.Context, - delAddr sdk.AccAddress, valAddr sdk.ValAddress, -) (delegation types.Delegation, found bool) { +// GetLiquidDelegation returns a specific delegation. +func (k Keeper) GetLiquidDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation types.Delegation, found bool) { + store := ctx.KVStore(k.storeKey) + key := types.GetLiquidDelegationKey(delAddr, valAddr) + + value := store.Get(key) + if value == nil { + return delegation, false + } + + delegation = types.MustUnmarshalDelegation(k.cdc, value) + + return delegation, true +} + +// GetLiquidDelegation returns a specific delegation. +func (k Keeper) GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation types.Delegation, found bool) { store := ctx.KVStore(k.storeKey) - key := types.GetDelegationKey(delAddr, valAddr) + key := types.GetLiquidDelegationKey(delAddr, valAddr) value := store.Get(key) if value == nil { @@ -72,12 +87,10 @@ func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) // GetDelegatorDelegations returns a given amount of all the delegations from a // delegator. -func (k Keeper) GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, - maxRetrieve uint16, -) (delegations []types.Delegation) { +func (k Keeper) GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []types.Delegation) { delegations = make([]types.Delegation, maxRetrieve) store := ctx.KVStore(k.storeKey) - delegatorPrefixKey := types.GetDelegationsKey(delegator) + delegatorPrefixKey := types.GetLiquidDelegationsKey(delegator) iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) defer iterator.Close() @@ -98,22 +111,25 @@ func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation) { store := ctx.KVStore(k.storeKey) b := types.MustMarshalDelegation(k.cdc, delegation) - store.Set(types.GetDelegationKey(delegatorAddress, delegation.GetValidatorAddr()), b) + store.Set(types.GetLiquidDelegationKey(delegatorAddress, delegation.GetValidatorAddr()), b) } -// RemoveDelegation removes a delegation. -func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation) { +// RemoveDelegation removes a delegation +func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation) error { delegatorAddress := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) - k.BeforeDelegationRemoved(ctx, delegatorAddress, delegation.GetValidatorAddr()) + // TODO: Consider calling hooks outside of the store wrapper functions, it's unobvious. + if err := k.BeforeDelegationRemoved(ctx, delegatorAddress, delegation.GetValidatorAddr()); err != nil { + return err + } + store := ctx.KVStore(k.storeKey) - store.Delete(types.GetDelegationKey(delegatorAddress, delegation.GetValidatorAddr())) + store.Delete(types.GetLiquidDelegationKey(delegatorAddress, delegation.GetValidatorAddr())) + return nil } // GetUnbondingDelegations returns a given amount of all the delegator unbonding-delegations. -func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, - maxRetrieve uint16, -) (unbondingDelegations []types.UnbondingDelegation) { +func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (unbondingDelegations []types.UnbondingDelegation) { unbondingDelegations = make([]types.UnbondingDelegation, maxRetrieve) store := ctx.KVStore(k.storeKey) @@ -133,9 +149,7 @@ func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddres } // GetUnbondingDelegation returns a unbonding delegation. -func (k Keeper) GetUnbondingDelegation( - ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, -) (ubd types.UnbondingDelegation, found bool) { +func (k Keeper) GetUnbondingDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, found bool) { store := ctx.KVStore(k.storeKey) key := types.GetUBDKey(delAddr, valAddr) value := store.Get(key) @@ -149,7 +163,8 @@ func (k Keeper) GetUnbondingDelegation( return ubd, true } -// return all unbonding delegations from a particular validator +// GetUnbondingDelegationsFromValidator returns all unbonding delegations from a +// particular validator. func (k Keeper) GetUnbondingDelegationsFromValidator(ctx sdk.Context, valAddr sdk.ValAddress) (ubds []types.UnbondingDelegation) { store := ctx.KVStore(k.storeKey) @@ -218,7 +233,7 @@ func (k Keeper) GetDelegatorBonded(ctx sdk.Context, delegator sdk.AccAddress) sd if err != nil { panic(err) // shouldn't happen } - validator, found := k.GetValidator(ctx, validatorAddr) + validator, found := k.GetLiquidValidator(ctx, validatorAddr) if found { shares := delegation.Shares tokens := validator.TokensFromSharesTruncated(shares) @@ -232,7 +247,7 @@ func (k Keeper) GetDelegatorBonded(ctx sdk.Context, delegator sdk.AccAddress) sd // IterateDelegatorDelegations iterates through one delegator's delegations. func (k Keeper) IterateDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(delegation types.Delegation) (stop bool)) { store := ctx.KVStore(k.storeKey) - delegatorPrefixKey := types.GetDelegationsKey(delegator) + delegatorPrefixKey := types.GetLiquidDelegationsKey(delegator) iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) defer iterator.Close() @@ -261,9 +276,7 @@ func (k Keeper) IterateDelegatorRedelegations(ctx sdk.Context, delegator sdk.Acc } // HasMaxUnbondingDelegationEntries - check if unbonding delegation has maximum number of entries. -func (k Keeper) HasMaxUnbondingDelegationEntries(ctx sdk.Context, - delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, -) bool { +func (k Keeper) HasMaxUnbondingDelegationEntries(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) bool { ubd, found := k.GetUnbondingDelegation(ctx, delegatorAddr, validatorAddr) if !found { return false @@ -308,22 +321,14 @@ func (k Keeper) SetUnbondingDelegationEntry( creationHeight int64, minTime time.Time, balance sdk.Int, ) types.UnbondingDelegation { ubd, found := k.GetUnbondingDelegation(ctx, delegatorAddr, validatorAddr) - id := k.IncrementUnbondingID(ctx) if found { - ubd.AddEntry(creationHeight, minTime, balance, id) + ubd.AddEntry(creationHeight, minTime, balance) } else { - ubd = types.NewUnbondingDelegation(delegatorAddr, validatorAddr, creationHeight, minTime, balance, id) + ubd = types.NewUnbondingDelegation(delegatorAddr, validatorAddr, creationHeight, minTime, balance) } k.SetUnbondingDelegation(ctx, ubd) - // Add to the UBDByUnbondingOp index to look up the UBD by the UBDE ID - k.SetUnbondingDelegationByUnbondingID(ctx, ubd, id) - - if err := k.AfterUnbondingInitiated(ctx, id); err != nil { - k.Logger(ctx).Error("failed to call after unbonding initiated hook", "error", err) - } - return ubd } @@ -355,9 +360,7 @@ func (k Keeper) SetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys // InsertUBDQueue inserts an unbonding delegation to the appropriate timeslice // in the unbonding queue. -func (k Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.UnbondingDelegation, - completionTime time.Time, -) { +func (k Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.UnbondingDelegation, completionTime time.Time) { dvPair := types.DVPair{DelegatorAddress: ubd.DelegatorAddress, ValidatorAddress: ubd.ValidatorAddress} timeSlice := k.GetUBDQueueTimeSlice(ctx, completionTime) @@ -382,7 +385,7 @@ func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (m store := ctx.KVStore(k.storeKey) // gets an iterator for all timeslices from time 0 until the current Blockheader time - unbondingTimesliceIterator := k.UBDQueueIterator(ctx, ctx.BlockHeader().Time) + unbondingTimesliceIterator := k.UBDQueueIterator(ctx, currTime) defer unbondingTimesliceIterator.Close() for ; unbondingTimesliceIterator.Valid(); unbondingTimesliceIterator.Next() { @@ -399,9 +402,7 @@ func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (m } // GetRedelegations returns a given amount of all the delegator redelegations. -func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress, - maxRetrieve uint16, -) (redelegations []types.Redelegation) { +func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []types.Redelegation) { redelegations = make([]types.Redelegation, maxRetrieve) store := ctx.KVStore(k.storeKey) @@ -421,9 +422,7 @@ func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress, } // GetRedelegation returns a redelegation. -func (k Keeper) GetRedelegation(ctx sdk.Context, - delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, -) (red types.Redelegation, found bool) { +func (k Keeper) GetRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) (red types.Redelegation, found bool) { store := ctx.KVStore(k.storeKey) key := types.GetREDKey(delAddr, valSrcAddr, valDstAddr) @@ -456,9 +455,7 @@ func (k Keeper) GetRedelegationsFromSrcValidator(ctx sdk.Context, valAddr sdk.Va } // HasReceivingRedelegation checks if validator is receiving a redelegation. -func (k Keeper) HasReceivingRedelegation(ctx sdk.Context, - delAddr sdk.AccAddress, valDstAddr sdk.ValAddress, -) bool { +func (k Keeper) HasReceivingRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool { store := ctx.KVStore(k.storeKey) prefix := types.GetREDsByDelToValDstIndexKey(delAddr, valDstAddr) @@ -469,10 +466,7 @@ func (k Keeper) HasReceivingRedelegation(ctx sdk.Context, } // HasMaxRedelegationEntries checks if redelegation has maximum number of entries. -func (k Keeper) HasMaxRedelegationEntries(ctx sdk.Context, - delegatorAddr sdk.AccAddress, validatorSrcAddr, - validatorDstAddr sdk.ValAddress, -) bool { +func (k Keeper) HasMaxRedelegationEntries(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress) bool { red, found := k.GetRedelegation(ctx, delegatorAddr, validatorSrcAddr, validatorDstAddr) if !found { return false @@ -501,32 +495,24 @@ func (k Keeper) SetRedelegation(ctx sdk.Context, red types.Redelegation) { store.Set(types.GetREDByValDstIndexKey(delegatorAddress, valSrcAddr, valDestAddr), []byte{}) } -// SetRedelegationEntry adds an entry to the redelegation at -// the given addresses. It creates the redelegation if it does not exist +// SetRedelegationEntry adds an entry to the unbonding delegation at the given +// addresses. It creates the unbonding delegation if it does not exist. func (k Keeper) SetRedelegationEntry(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, creationHeight int64, minTime time.Time, balance sdk.Int, - sharesSrc, sharesDst sdk.Dec, + _, sharesDst sdk.Dec, ) types.Redelegation { red, found := k.GetRedelegation(ctx, delegatorAddr, validatorSrcAddr, validatorDstAddr) - id := k.IncrementUnbondingID(ctx) if found { - red.AddEntry(creationHeight, minTime, balance, sharesDst, id) + red.AddEntry(creationHeight, minTime, balance, sharesDst) } else { red = types.NewRedelegation(delegatorAddr, validatorSrcAddr, - validatorDstAddr, creationHeight, minTime, balance, sharesDst, id) + validatorDstAddr, creationHeight, minTime, balance, sharesDst) } k.SetRedelegation(ctx, red) - // Add to the UBDByEntry index to look up the UBD by the UBDE ID - k.SetRedelegationByUnbondingID(ctx, red, id) - - if err := k.AfterUnbondingInitiated(ctx, id); err != nil { - k.Logger(ctx).Error("failed to call after unbonding initiated hook", "error", err) - } - return red } @@ -593,9 +579,7 @@ func (k Keeper) SetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Ti // InsertRedelegationQueue insert an redelegation delegation to the appropriate // timeslice in the redelegation queue. -func (k Keeper) InsertRedelegationQueue(ctx sdk.Context, red types.Redelegation, - completionTime time.Time, -) { +func (k Keeper) InsertRedelegationQueue(ctx sdk.Context, red types.Redelegation, completionTime time.Time) { timeSlice := k.GetRedelegationQueueTimeSlice(ctx, completionTime) dvvTriplet := types.DVVTriplet{ DelegatorAddress: red.DelegatorAddress, @@ -621,7 +605,7 @@ func (k Keeper) RedelegationQueueIterator(ctx sdk.Context, endTime time.Time) sd // DequeueAllMatureRedelegationQueue returns a concatenated list of all the // timeslices inclusively previous to currTime, and deletes the timeslices from // the queue. -func (k Keeper) DequeueAllMatureRedelegationQueue(ctx sdk.Context, currTime time.Time) (matureRedelegations []types.DVVTriplet) { +func (k Keeper) DequeueAllMatureRedelegationQueue(ctx sdk.Context, _ time.Time) (matureRedelegations []types.DVVTriplet) { store := ctx.KVStore(k.storeKey) // gets an iterator for all timeslices from time 0 until the current Blockheader time @@ -655,16 +639,20 @@ func (k Keeper) Delegate( } // Get or create the delegation object - delegation, found := k.GetDelegation(ctx, delAddr, validator.GetOperator()) + delegation, found := k.GetLiquidDelegation(ctx, delAddr, validator.GetOperator()) if !found { - delegation = types.NewDelegation(delAddr, validator.GetOperator(), sdk.ZeroDec()) + delegation = types.NewDelegation(delAddr, validator.GetOperator(), sdk.ZeroDec(), false) } // call the appropriate hook if present if found { - k.BeforeDelegationSharesModified(ctx, delAddr, validator.GetOperator()) + err = k.BeforeDelegationSharesModified(ctx, delAddr, validator.GetOperator()) } else { - k.BeforeDelegationCreated(ctx, delAddr, validator.GetOperator()) + err = k.BeforeDelegationCreated(ctx, delAddr, validator.GetOperator()) + } + + if err != nil { + return sdk.ZeroDec(), err } delegatorAddress := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) @@ -717,7 +705,9 @@ func (k Keeper) Delegate( k.SetDelegation(ctx, delegation) // Call the after-modification hook - k.AfterDelegationModified(ctx, delegatorAddress, delegation.GetValidatorAddr()) + if err := k.AfterDelegationModified(ctx, delegatorAddress, delegation.GetValidatorAddr()); err != nil { + return newShares, err + } return newShares, nil } @@ -727,21 +717,23 @@ func (k Keeper) Unbond( ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdk.Dec, ) (amount sdk.Int, err error) { // check if a delegation object exists in the store - delegation, found := k.GetDelegation(ctx, delAddr, valAddr) + delegation, found := k.GetLiquidDelegation(ctx, delAddr, valAddr) if !found { return amount, types.ErrNoDelegatorForAddress } // call the before-delegation-modified hook - k.BeforeDelegationSharesModified(ctx, delAddr, valAddr) + if err := k.BeforeDelegationSharesModified(ctx, delAddr, valAddr); err != nil { + return amount, err + } // ensure that we have enough shares to remove if delegation.Shares.LT(shares) { - return amount, sdkerrors.Wrap(types.ErrNotEnoughDelegationShares, delegation.Shares.String()) + return amount, errorsmod.Wrap(types.ErrNotEnoughDelegationShares, delegation.Shares.String()) } // get validator - validator, found := k.GetValidator(ctx, valAddr) + validator, found := k.GetLiquidValidator(ctx, valAddr) if !found { return amount, types.ErrNoValidatorFound } @@ -754,29 +746,21 @@ func (k Keeper) Unbond( return amount, err } - isValidatorOperator := delegatorAddress.Equals(validator.GetOperator()) - - // If the delegation is the operator of the validator and undelegating will decrease the validator's - // self-delegation below their minimum, we jail the validator. - if isValidatorOperator && !validator.Jailed && - validator.TokensFromShares(delegation.Shares).TruncateInt().LT(validator.MinSelfDelegation) { - k.jailValidator(ctx, validator) - validator = k.mustGetValidator(ctx, validator.GetOperator()) - } - - // remove the delegation if delegation.Shares.IsZero() { - k.RemoveDelegation(ctx, delegation) + err = k.RemoveDelegation(ctx, delegation) } else { k.SetDelegation(ctx, delegation) // call the after delegation modification hook - k.AfterDelegationModified(ctx, delegatorAddress, delegation.GetValidatorAddr()) + err = k.AfterDelegationModified(ctx, delegatorAddress, delegation.GetValidatorAddr()) + } + + if err != nil { + return amount, err } // remove the shares and coins from the validator // NOTE that the amount is later (in keeper.Delegation) moved between staking module pools validator, amount = k.RemoveValidatorTokensAndShares(ctx, validator, shares) - if validator.DelegatorShares.IsZero() && validator.IsUnbonded() { // if not unbonded, we must instead remove validator in EndBlocker once it finishes its unbonding period k.RemoveValidator(ctx, validator.GetOperator()) @@ -791,7 +775,7 @@ func (k Keeper) Unbond( func (k Keeper) getBeginInfo( ctx sdk.Context, valSrcAddr sdk.ValAddress, ) (completionTime time.Time, height int64, completeNow bool) { - validator, found := k.GetValidator(ctx, valSrcAddr) + validator, found := k.GetLiquidValidator(ctx, valSrcAddr) // TODO: When would the validator not be found? switch { @@ -821,7 +805,7 @@ func (k Keeper) getBeginInfo( func (k Keeper) Undelegate( ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec, ) (time.Time, error) { - validator, found := k.GetValidator(ctx, valAddr) + validator, found := k.GetLiquidValidator(ctx, valAddr) if !found { return time.Time{}, types.ErrNoDelegatorForAddress } @@ -865,14 +849,12 @@ func (k Keeper) CompleteUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAd return nil, err } - // loop through all the entries and try to complete unbonding mature entries + // loop through all the entries and complete unbonding mature entries for i := 0; i < len(ubd.Entries); i++ { entry := ubd.Entries[i] - if entry.IsMature(ctxTime) && !entry.OnHold() { - // Proceed with unbonding + if entry.IsMature(ctxTime) { ubd.RemoveEntry(int64(i)) i-- - k.DeleteUnbondingIndex(ctx, entry.UnbondingId) // track undelegation only when remaining or truncated shares are non-zero if !entry.Balance.IsZero() { @@ -898,7 +880,8 @@ func (k Keeper) CompleteUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAd return balances, nil } -// begin unbonding / redelegation; create a redelegation record +// BeginRedelegation begins unbonding / redelegation and creates a redelegation +// record. func (k Keeper) BeginRedelegation( ctx sdk.Context, delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, sharesAmount sdk.Dec, ) (completionTime time.Time, err error) { @@ -906,12 +889,12 @@ func (k Keeper) BeginRedelegation( return time.Time{}, types.ErrSelfRedelegation } - dstValidator, found := k.GetValidator(ctx, valDstAddr) + dstValidator, found := k.GetLiquidValidator(ctx, valDstAddr) if !found { return time.Time{}, types.ErrBadRedelegationDst } - srcValidator, found := k.GetValidator(ctx, valSrcAddr) + srcValidator, found := k.GetLiquidValidator(ctx, valSrcAddr) if !found { return time.Time{}, types.ErrBadRedelegationDst } @@ -970,13 +953,12 @@ func (k Keeper) CompleteRedelegation( balances := sdk.NewCoins() ctxTime := ctx.BlockHeader().Time - // loop through all the entries and try to complete mature redelegation entries + // loop through all the entries and complete mature redelegation entries for i := 0; i < len(red.Entries); i++ { entry := red.Entries[i] - if entry.IsMature(ctxTime) && !entry.OnHold() { + if entry.IsMature(ctxTime) { red.RemoveEntry(int64(i)) i-- - k.DeleteUnbondingIndex(ctx, entry.UnbondingId) if !entry.InitialBalance.IsZero() { balances = balances.Add(sdk.NewCoin(bondDenom, entry.InitialBalance)) @@ -1000,12 +982,12 @@ func (k Keeper) CompleteRedelegation( func (k Keeper) ValidateUnbondAmount( ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Int, ) (shares sdk.Dec, err error) { - validator, found := k.GetValidator(ctx, valAddr) + validator, found := k.GetLiquidValidator(ctx, valAddr) if !found { return shares, types.ErrNoValidatorFound } - del, found := k.GetDelegation(ctx, delAddr, valAddr) + del, found := k.GetLiquidDelegation(ctx, delAddr, valAddr) if !found { return shares, types.ErrNoDelegation } @@ -1022,7 +1004,7 @@ func (k Keeper) ValidateUnbondAmount( delShares := del.GetShares() if sharesTruncated.GT(delShares) { - return shares, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid shares amount") + return shares, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid shares amount") } // Cap the shares at the delegation's shares. Shares being greater could occur diff --git a/x/staking/keeper/delegation_test.go b/x/staking/keeper/delegation_test.go index a3364bae970..12e4d49709a 100644 --- a/x/staking/keeper/delegation_test.go +++ b/x/staking/keeper/delegation_test.go @@ -1,993 +1,3 @@ package keeper_test -import ( - "testing" - "time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/cosmos-sdk/x/staking/teststaking" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// tests GetDelegation, GetDelegatorDelegations, SetDelegation, RemoveDelegation, GetDelegatorDelegations -func TestDelegation(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 3, sdk.NewInt(10000)) - valAddrs := simapp.ConvertAddrsToValAddrs(addrDels) - - // construct the validators - amts := []sdk.Int{sdk.NewInt(9), sdk.NewInt(8), sdk.NewInt(7)} - var validators [3]types.Validator - for i, amt := range amts { - validators[i] = teststaking.NewValidator(t, valAddrs[i], PKs[i]) - validators[i], _ = validators[i].AddTokensFromDel(amt) - } - - validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], true) - validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], true) - validators[2] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[2], true) - - // first add a validators[0] to delegate too - bond1to1 := types.NewDelegation(addrDels[0], valAddrs[0], sdk.NewDec(9)) - - // check the empty keeper first - _, found := app.StakingKeeper.GetDelegation(ctx, addrDels[0], valAddrs[0]) - require.False(t, found) - - // set and retrieve a record - app.StakingKeeper.SetDelegation(ctx, bond1to1) - resBond, found := app.StakingKeeper.GetDelegation(ctx, addrDels[0], valAddrs[0]) - require.True(t, found) - require.Equal(t, bond1to1, resBond) - - // modify a records, save, and retrieve - bond1to1.Shares = sdk.NewDec(99) - app.StakingKeeper.SetDelegation(ctx, bond1to1) - resBond, found = app.StakingKeeper.GetDelegation(ctx, addrDels[0], valAddrs[0]) - require.True(t, found) - require.Equal(t, bond1to1, resBond) - - // add some more records - bond1to2 := types.NewDelegation(addrDels[0], valAddrs[1], sdk.NewDec(9)) - bond1to3 := types.NewDelegation(addrDels[0], valAddrs[2], sdk.NewDec(9)) - bond2to1 := types.NewDelegation(addrDels[1], valAddrs[0], sdk.NewDec(9)) - bond2to2 := types.NewDelegation(addrDels[1], valAddrs[1], sdk.NewDec(9)) - bond2to3 := types.NewDelegation(addrDels[1], valAddrs[2], sdk.NewDec(9)) - app.StakingKeeper.SetDelegation(ctx, bond1to2) - app.StakingKeeper.SetDelegation(ctx, bond1to3) - app.StakingKeeper.SetDelegation(ctx, bond2to1) - app.StakingKeeper.SetDelegation(ctx, bond2to2) - app.StakingKeeper.SetDelegation(ctx, bond2to3) - - // test all bond retrieve capabilities - resBonds := app.StakingKeeper.GetDelegatorDelegations(ctx, addrDels[0], 5) - require.Equal(t, 3, len(resBonds)) - require.Equal(t, bond1to1, resBonds[0]) - require.Equal(t, bond1to2, resBonds[1]) - require.Equal(t, bond1to3, resBonds[2]) - resBonds = app.StakingKeeper.GetAllDelegatorDelegations(ctx, addrDels[0]) - require.Equal(t, 3, len(resBonds)) - resBonds = app.StakingKeeper.GetDelegatorDelegations(ctx, addrDels[0], 2) - require.Equal(t, 2, len(resBonds)) - resBonds = app.StakingKeeper.GetDelegatorDelegations(ctx, addrDels[1], 5) - require.Equal(t, 3, len(resBonds)) - require.Equal(t, bond2to1, resBonds[0]) - require.Equal(t, bond2to2, resBonds[1]) - require.Equal(t, bond2to3, resBonds[2]) - allBonds := app.StakingKeeper.GetAllDelegations(ctx) - require.Equal(t, 6, len(allBonds)) - require.Equal(t, bond1to1, allBonds[0]) - require.Equal(t, bond1to2, allBonds[1]) - require.Equal(t, bond1to3, allBonds[2]) - require.Equal(t, bond2to1, allBonds[3]) - require.Equal(t, bond2to2, allBonds[4]) - require.Equal(t, bond2to3, allBonds[5]) - - resVals := app.StakingKeeper.GetDelegatorValidators(ctx, addrDels[0], 3) - require.Equal(t, 3, len(resVals)) - resVals = app.StakingKeeper.GetDelegatorValidators(ctx, addrDels[1], 4) - require.Equal(t, 3, len(resVals)) - - for i := 0; i < 3; i++ { - resVal, err := app.StakingKeeper.GetDelegatorValidator(ctx, addrDels[0], valAddrs[i]) - require.Nil(t, err) - require.Equal(t, valAddrs[i], resVal.GetOperator()) - - resVal, err = app.StakingKeeper.GetDelegatorValidator(ctx, addrDels[1], valAddrs[i]) - require.Nil(t, err) - require.Equal(t, valAddrs[i], resVal.GetOperator()) - - resDels := app.StakingKeeper.GetValidatorDelegations(ctx, valAddrs[i]) - require.Len(t, resDels, 2) - } - - // test total bonded for single delegator - expBonded := bond1to1.Shares.Add(bond2to1.Shares).Add(bond1to3.Shares) - resDelBond := app.StakingKeeper.GetDelegatorBonded(ctx, addrDels[0]) - require.Equal(t, expBonded, sdk.NewDecFromInt(resDelBond)) - - // delete a record - app.StakingKeeper.RemoveDelegation(ctx, bond2to3) - _, found = app.StakingKeeper.GetDelegation(ctx, addrDels[1], valAddrs[2]) - require.False(t, found) - resBonds = app.StakingKeeper.GetDelegatorDelegations(ctx, addrDels[1], 5) - require.Equal(t, 2, len(resBonds)) - require.Equal(t, bond2to1, resBonds[0]) - require.Equal(t, bond2to2, resBonds[1]) - - resBonds = app.StakingKeeper.GetAllDelegatorDelegations(ctx, addrDels[1]) - require.Equal(t, 2, len(resBonds)) - - // delete all the records from delegator 2 - app.StakingKeeper.RemoveDelegation(ctx, bond2to1) - app.StakingKeeper.RemoveDelegation(ctx, bond2to2) - _, found = app.StakingKeeper.GetDelegation(ctx, addrDels[1], valAddrs[0]) - require.False(t, found) - _, found = app.StakingKeeper.GetDelegation(ctx, addrDels[1], valAddrs[1]) - require.False(t, found) - resBonds = app.StakingKeeper.GetDelegatorDelegations(ctx, addrDels[1], 5) - require.Equal(t, 0, len(resBonds)) -} - -// tests Get/Set/Remove UnbondingDelegation -func TestUnbondingDelegation(t *testing.T) { - _, app, ctx := createTestInput() - - delAddrs := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(10000)) - valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs) - - ubd := types.NewUnbondingDelegation( - delAddrs[0], - valAddrs[0], - 0, - time.Unix(0, 0).UTC(), - sdk.NewInt(5), - 0, - ) - - // set and retrieve a record - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - resUnbond, found := app.StakingKeeper.GetUnbondingDelegation(ctx, delAddrs[0], valAddrs[0]) - require.True(t, found) - require.Equal(t, ubd, resUnbond) - - // modify a records, save, and retrieve - expUnbond := sdk.NewInt(21) - ubd.Entries[0].Balance = expUnbond - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - - resUnbonds := app.StakingKeeper.GetUnbondingDelegations(ctx, delAddrs[0], 5) - require.Equal(t, 1, len(resUnbonds)) - - resUnbonds = app.StakingKeeper.GetAllUnbondingDelegations(ctx, delAddrs[0]) - require.Equal(t, 1, len(resUnbonds)) - - resUnbond, found = app.StakingKeeper.GetUnbondingDelegation(ctx, delAddrs[0], valAddrs[0]) - require.True(t, found) - require.Equal(t, ubd, resUnbond) - - resDelUnbond := app.StakingKeeper.GetDelegatorUnbonding(ctx, delAddrs[0]) - require.Equal(t, expUnbond, resDelUnbond) - - // delete a record - app.StakingKeeper.RemoveUnbondingDelegation(ctx, ubd) - _, found = app.StakingKeeper.GetUnbondingDelegation(ctx, delAddrs[0], valAddrs[0]) - require.False(t, found) - - resUnbonds = app.StakingKeeper.GetUnbondingDelegations(ctx, delAddrs[0], 5) - require.Equal(t, 0, len(resUnbonds)) - - resUnbonds = app.StakingKeeper.GetAllUnbondingDelegations(ctx, delAddrs[0]) - require.Equal(t, 0, len(resUnbonds)) -} - -func TestUnbondDelegation(t *testing.T) { - _, app, ctx := createTestInput() - - delAddrs := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000)) - valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs) - - startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens)))) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator and a delegator to that validator - // note this validator starts not-bonded - validator := teststaking.NewValidator(t, valAddrs[0], PKs[0]) - - validator, issuedShares := validator.AddTokensFromDel(startTokens) - require.Equal(t, startTokens, issuedShares.RoundInt()) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - - delegation := types.NewDelegation(delAddrs[0], valAddrs[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - bondTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6) - amount, err := app.StakingKeeper.Unbond(ctx, delAddrs[0], valAddrs[0], bondTokens.ToDec()) - require.NoError(t, err) - require.Equal(t, bondTokens, amount) // shares to be added to an unbonding delegation - - delegation, found := app.StakingKeeper.GetDelegation(ctx, delAddrs[0], valAddrs[0]) - require.True(t, found) - validator, found = app.StakingKeeper.GetValidator(ctx, valAddrs[0]) - require.True(t, found) - - remainingTokens := startTokens.Sub(bondTokens) - require.Equal(t, remainingTokens, delegation.Shares.RoundInt()) - require.Equal(t, remainingTokens, validator.BondedTokens()) -} - -func TestUnbondingDelegationsMaxEntries(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - - bondDenom := app.StakingKeeper.BondDenom(ctx) - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(bondDenom, startTokens)))) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator and a delegator to that validator - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - - validator, issuedShares := validator.AddTokensFromDel(startTokens) - require.Equal(t, startTokens, issuedShares.RoundInt()) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - require.True(sdk.IntEq(t, startTokens, validator.BondedTokens())) - require.True(t, validator.IsBonded()) - - delegation := types.NewDelegation(addrDels[0], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - maxEntries := app.StakingKeeper.MaxEntries(ctx) - - oldBonded := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - oldNotBonded := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - // should all pass - var completionTime time.Time - for i := uint32(0); i < maxEntries; i++ { - var err error - completionTime, err = app.StakingKeeper.Undelegate(ctx, addrDels[0], addrVals[0], sdk.NewDec(1)) - require.NoError(t, err) - } - - newBonded := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - newNotBonded := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, newBonded, oldBonded.SubRaw(int64(maxEntries)))) - require.True(sdk.IntEq(t, newNotBonded, oldNotBonded.AddRaw(int64(maxEntries)))) - - oldBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - oldNotBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - // an additional unbond should fail due to max entries - _, err := app.StakingKeeper.Undelegate(ctx, addrDels[0], addrVals[0], sdk.NewDec(1)) - require.Error(t, err) - - newBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - newNotBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - require.True(sdk.IntEq(t, newBonded, oldBonded)) - require.True(sdk.IntEq(t, newNotBonded, oldNotBonded)) - - // mature unbonding delegations - ctx = ctx.WithBlockTime(completionTime) - _, err = app.StakingKeeper.CompleteUnbonding(ctx, addrDels[0], addrVals[0]) - require.NoError(t, err) - - newBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - newNotBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, newBonded, oldBonded)) - require.True(sdk.IntEq(t, newNotBonded, oldNotBonded.SubRaw(int64(maxEntries)))) - - oldNotBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - // unbonding should work again - _, err = app.StakingKeeper.Undelegate(ctx, addrDels[0], addrVals[0], sdk.NewDec(1)) - require.NoError(t, err) - - newBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - newNotBonded = app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, newBonded, oldBonded.SubRaw(1))) - require.True(sdk.IntEq(t, newNotBonded, oldNotBonded.AddRaw(1))) -} - -// test undelegating self delegation from a validator pushing it below MinSelfDelegation -// shift it from the bonded to unbonding state and jailed -func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens)) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - - validator.MinSelfDelegation = delTokens - validator, issuedShares := validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - require.True(t, validator.IsBonded()) - - selfDelegation := types.NewDelegation(sdk.AccAddress(addrVals[0].Bytes()), addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // add bonded tokens to pool for delegations - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - // create a second delegation to this validator - app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator) - validator, issuedShares = validator.AddTokensFromDel(delTokens) - require.True(t, validator.IsBonded()) - require.Equal(t, delTokens, issuedShares.RoundInt()) - - // add bonded tokens to pool for delegations - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - delegation := types.NewDelegation(addrDels[0], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - val0AccAddr := sdk.AccAddress(addrVals[0].Bytes()) - _, err := app.StakingKeeper.Undelegate(ctx, val0AccAddr, addrVals[0], app.StakingKeeper.TokensFromConsensusPower(ctx, 6).ToDec()) - require.NoError(t, err) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 14), validator.Tokens) - require.Equal(t, types.Unbonding, validator.Status) - require.True(t, validator.Jailed) -} - -func TestUndelegateFromUnbondingValidator(t *testing.T) { - _, app, ctx := createTestInput() - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens)) - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - - validator, issuedShares := validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - require.True(t, validator.IsBonded()) - - selfDelegation := types.NewDelegation(addrVals[0].Bytes(), addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // add bonded tokens to pool for delegations - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - // create a second delegation to this validator - app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator) - - validator, issuedShares = validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - delegation := types.NewDelegation(addrDels[1], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - header := ctx.BlockHeader() - blockHeight := int64(10) - header.Height = blockHeight - blockTime := time.Unix(333, 0) - header.Time = blockTime - ctx = ctx.WithBlockHeader(header) - - // unbond the all self-delegation to put validator in unbonding state - val0AccAddr := sdk.AccAddress(addrVals[0]) - _, err := app.StakingKeeper.Undelegate(ctx, val0AccAddr, addrVals[0], delTokens.ToDec()) - require.NoError(t, err) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, blockHeight, validator.UnbondingHeight) - params := app.StakingKeeper.GetParams(ctx) - require.True(t, blockTime.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) - - blockHeight2 := int64(20) - blockTime2 := time.Unix(444, 0).UTC() - ctx = ctx.WithBlockHeight(blockHeight2) - ctx = ctx.WithBlockTime(blockTime2) - - // unbond some of the other delegation's shares - _, err = app.StakingKeeper.Undelegate(ctx, addrDels[1], addrVals[0], sdk.NewDec(6)) - require.NoError(t, err) - - // retrieve the unbonding delegation - ubd, found := app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[1], addrVals[0]) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - require.True(t, ubd.Entries[0].Balance.Equal(sdk.NewInt(6))) - assert.Equal(t, blockHeight2, ubd.Entries[0].CreationHeight) - assert.True(t, blockTime2.Add(params.UnbondingTime).Equal(ubd.Entries[0].CompletionTime)) -} - -func TestUndelegateFromUnbondedValidator(t *testing.T) { - _, app, ctx := createTestInput() - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens)) - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares := validator.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - require.True(t, validator.IsBonded()) - - val0AccAddr := sdk.AccAddress(addrVals[0]) - selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // add bonded tokens to pool for delegations - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - // create a second delegation to this validator - app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator) - validator, issuedShares = validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - require.True(t, validator.IsBonded()) - delegation := types.NewDelegation(addrDels[1], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - ctx = ctx.WithBlockHeight(10) - ctx = ctx.WithBlockTime(time.Unix(333, 0)) - - // unbond the all self-delegation to put validator in unbonding state - _, err := app.StakingKeeper.Undelegate(ctx, val0AccAddr, addrVals[0], valTokens.ToDec()) - require.NoError(t, err) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, ctx.BlockHeight(), validator.UnbondingHeight) - params := app.StakingKeeper.GetParams(ctx) - require.True(t, ctx.BlockHeader().Time.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) - - // unbond the validator - ctx = ctx.WithBlockTime(validator.UnbondingTime) - app.StakingKeeper.UnbondAllMatureValidators(ctx) - - // Make sure validator is still in state because there is still an outstanding delegation - validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, validator.Status, types.Unbonded) - - // unbond some of the other delegation's shares - unbondTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6) - _, err = app.StakingKeeper.Undelegate(ctx, addrDels[1], addrVals[0], unbondTokens.ToDec()) - require.NoError(t, err) - - // unbond rest of the other delegation's shares - remainingTokens := delTokens.Sub(unbondTokens) - _, err = app.StakingKeeper.Undelegate(ctx, addrDels[1], addrVals[0], remainingTokens.ToDec()) - require.NoError(t, err) - - // now validator should be deleted from state - validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.False(t, found, "%v", validator) -} - -func TestUnbondingAllDelegationFromValidator(t *testing.T) { - _, app, ctx := createTestInput() - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens)) - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares := validator.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - require.True(t, validator.IsBonded()) - val0AccAddr := sdk.AccAddress(addrVals[0].Bytes()) - - selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // create a second delegation to this validator - app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator) - validator, issuedShares = validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - - // add bonded tokens to pool for delegations - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), delCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - require.True(t, validator.IsBonded()) - - delegation := types.NewDelegation(addrDels[1], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - ctx = ctx.WithBlockHeight(10) - ctx = ctx.WithBlockTime(time.Unix(333, 0)) - - // unbond the all self-delegation to put validator in unbonding state - _, err := app.StakingKeeper.Undelegate(ctx, val0AccAddr, addrVals[0], valTokens.ToDec()) - require.NoError(t, err) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - // unbond all the remaining delegation - _, err = app.StakingKeeper.Undelegate(ctx, addrDels[1], addrVals[0], delTokens.ToDec()) - require.NoError(t, err) - - // validator should still be in state and still be in unbonding state - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, validator.Status, types.Unbonding) - - // unbond the validator - ctx = ctx.WithBlockTime(validator.UnbondingTime) - app.StakingKeeper.UnbondAllMatureValidators(ctx) - - // validator should now be deleted from state - _, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.False(t, found) -} - -// Make sure that that the retrieving the delegations doesn't affect the state -func TestGetRedelegationsFromSrcValidator(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 0, - time.Unix(0, 0), sdk.NewInt(5), - sdk.NewDec(5), 0) - - // set and retrieve a record - app.StakingKeeper.SetRedelegation(ctx, rd) - resBond, found := app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - - // get the redelegations one time - redelegations := app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, redelegations[0], resBond) - - // get the redelegations a second time, should be exactly the same - redelegations = app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, redelegations[0], resBond) -} - -// tests Get/Set/Remove/Has UnbondingDelegation -func TestRedelegation(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 0, - time.Unix(0, 0).UTC(), sdk.NewInt(5), - sdk.NewDec(5), 0) - - // test shouldn't have and redelegations - has := app.StakingKeeper.HasReceivingRedelegation(ctx, addrDels[0], addrVals[1]) - require.False(t, has) - - // set and retrieve a record - app.StakingKeeper.SetRedelegation(ctx, rd) - resRed, found := app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - - redelegations := app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, redelegations[0], resRed) - - redelegations = app.StakingKeeper.GetRedelegations(ctx, addrDels[0], 5) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, redelegations[0], resRed) - - redelegations = app.StakingKeeper.GetAllRedelegations(ctx, addrDels[0], nil, nil) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, redelegations[0], resRed) - - // check if has the redelegation - has = app.StakingKeeper.HasReceivingRedelegation(ctx, addrDels[0], addrVals[1]) - require.True(t, has) - - // modify a records, save, and retrieve - rd.Entries[0].SharesDst = sdk.NewDec(21) - app.StakingKeeper.SetRedelegation(ctx, rd) - - resRed, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - require.Equal(t, rd, resRed) - - redelegations = app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, redelegations[0], resRed) - - redelegations = app.StakingKeeper.GetRedelegations(ctx, addrDels[0], 5) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, redelegations[0], resRed) - - // delete a record - app.StakingKeeper.RemoveRedelegation(ctx, rd) - _, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.False(t, found) - - redelegations = app.StakingKeeper.GetRedelegations(ctx, addrDels[0], 5) - require.Equal(t, 0, len(redelegations)) - - redelegations = app.StakingKeeper.GetAllRedelegations(ctx, addrDels[0], nil, nil) - require.Equal(t, 0, len(redelegations)) -} - -func TestRedelegateToSameValidator(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - startCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), valTokens)) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - validator, issuedShares := validator.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - require.True(t, validator.IsBonded()) - - val0AccAddr := sdk.AccAddress(addrVals[0].Bytes()) - selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - _, err := app.StakingKeeper.BeginRedelegation(ctx, val0AccAddr, addrVals[0], addrVals[0], sdk.NewDec(5)) - require.Error(t, err) -} - -func TestRedelegationMaxEntries(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 20) - startCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens)) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares := validator.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - val0AccAddr := sdk.AccAddress(addrVals[0].Bytes()) - selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // create a second validator - validator2 := teststaking.NewValidator(t, addrVals[1], PKs[1]) - validator2, issuedShares = validator2.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - - validator2 = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator2, true) - require.Equal(t, types.Bonded, validator2.Status) - - maxEntries := app.StakingKeeper.MaxEntries(ctx) - - // redelegations should pass - var completionTime time.Time - for i := uint32(0); i < maxEntries; i++ { - var err error - completionTime, err = app.StakingKeeper.BeginRedelegation(ctx, val0AccAddr, addrVals[0], addrVals[1], sdk.NewDec(1)) - require.NoError(t, err) - } - - // an additional redelegation should fail due to max entries - _, err := app.StakingKeeper.BeginRedelegation(ctx, val0AccAddr, addrVals[0], addrVals[1], sdk.NewDec(1)) - require.Error(t, err) - - // mature redelegations - ctx = ctx.WithBlockTime(completionTime) - _, err = app.StakingKeeper.CompleteRedelegation(ctx, val0AccAddr, addrVals[0], addrVals[1]) - require.NoError(t, err) - - // redelegation should work again - _, err = app.StakingKeeper.BeginRedelegation(ctx, val0AccAddr, addrVals[0], addrVals[1], sdk.NewDec(1)) - require.NoError(t, err) -} - -func TestRedelegateSelfDelegation(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 30) - startCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens)) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares := validator.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - - val0AccAddr := sdk.AccAddress(addrVals[0]) - selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // create a second validator - validator2 := teststaking.NewValidator(t, addrVals[1], PKs[1]) - validator2, issuedShares = validator2.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator2 = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator2, true) - require.Equal(t, types.Bonded, validator2.Status) - - // create a second delegation to validator 1 - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares = validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - - delegation := types.NewDelegation(addrDels[0], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - _, err := app.StakingKeeper.BeginRedelegation(ctx, val0AccAddr, addrVals[0], addrVals[1], delTokens.ToDec()) - require.NoError(t, err) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 2) - - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, valTokens, validator.Tokens) - require.Equal(t, types.Unbonding, validator.Status) -} - -func TestRedelegateFromUnbondingValidator(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 30) - startCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens)) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares := validator.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - val0AccAddr := sdk.AccAddress(addrVals[0].Bytes()) - selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // create a second delegation to this validator - app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator) - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares = validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - delegation := types.NewDelegation(addrDels[1], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - // create a second validator - validator2 := teststaking.NewValidator(t, addrVals[1], PKs[1]) - validator2, issuedShares = validator2.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator2 = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator2, true) - - header := ctx.BlockHeader() - blockHeight := int64(10) - header.Height = blockHeight - blockTime := time.Unix(333, 0) - header.Time = blockTime - ctx = ctx.WithBlockHeader(header) - - // unbond the all self-delegation to put validator in unbonding state - _, err := app.StakingKeeper.Undelegate(ctx, val0AccAddr, addrVals[0], delTokens.ToDec()) - require.NoError(t, err) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, blockHeight, validator.UnbondingHeight) - params := app.StakingKeeper.GetParams(ctx) - require.True(t, blockTime.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) - - // change the context - header = ctx.BlockHeader() - blockHeight2 := int64(20) - header.Height = blockHeight2 - blockTime2 := time.Unix(444, 0) - header.Time = blockTime2 - ctx = ctx.WithBlockHeader(header) - - // unbond some of the other delegation's shares - redelegateTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6) - _, err = app.StakingKeeper.BeginRedelegation(ctx, addrDels[1], addrVals[0], addrVals[1], redelegateTokens.ToDec()) - require.NoError(t, err) - - // retrieve the unbonding delegation - ubd, found := app.StakingKeeper.GetRedelegation(ctx, addrDels[1], addrVals[0], addrVals[1]) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - assert.Equal(t, blockHeight, ubd.Entries[0].CreationHeight) - assert.True(t, blockTime.Add(params.UnbondingTime).Equal(ubd.Entries[0].CompletionTime)) -} - -func TestRedelegateFromUnbondedValidator(t *testing.T) { - _, app, ctx := createTestInput() - - addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(0)) - addrVals := simapp.ConvertAddrsToValAddrs(addrDels) - - startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 30) - startCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), startTokens)) - - // add bonded tokens to pool for delegations - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), startCoins)) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // create a validator with a self-delegation - validator := teststaking.NewValidator(t, addrVals[0], PKs[0]) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares := validator.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - val0AccAddr := sdk.AccAddress(addrVals[0].Bytes()) - selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, selfDelegation) - - // create a second delegation to this validator - app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator) - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validator, issuedShares = validator.AddTokensFromDel(delTokens) - require.Equal(t, delTokens, issuedShares.RoundInt()) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - delegation := types.NewDelegation(addrDels[1], addrVals[0], issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - - // create a second validator - validator2 := teststaking.NewValidator(t, addrVals[1], PKs[1]) - validator2, issuedShares = validator2.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares.RoundInt()) - validator2 = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator2, true) - require.Equal(t, types.Bonded, validator2.Status) - - ctx = ctx.WithBlockHeight(10) - ctx = ctx.WithBlockTime(time.Unix(333, 0)) - - // unbond the all self-delegation to put validator in unbonding state - _, err := app.StakingKeeper.Undelegate(ctx, val0AccAddr, addrVals[0], delTokens.ToDec()) - require.NoError(t, err) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, ctx.BlockHeight(), validator.UnbondingHeight) - params := app.StakingKeeper.GetParams(ctx) - require.True(t, ctx.BlockHeader().Time.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) - - // unbond the validator - app.StakingKeeper.UnbondingToUnbonded(ctx, validator) - - // redelegate some of the delegation's shares - redelegationTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6) - _, err = app.StakingKeeper.BeginRedelegation(ctx, addrDels[1], addrVals[0], addrVals[1], redelegationTokens.ToDec()) - require.NoError(t, err) - - // no red should have been found - red, found := app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.False(t, found, "%v", red) -} diff --git a/x/staking/keeper/genesis.go b/x/staking/keeper/genesis.go new file mode 100644 index 00000000000..ea13f93d039 --- /dev/null +++ b/x/staking/keeper/genesis.go @@ -0,0 +1,205 @@ +package keeper + +import ( + "fmt" + + abci "github.com/tendermint/tendermint/abci/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// InitGenesis sets the pool and parameters for the provided keeper. For each +// validator in data, it sets that validator in the keeper along with manually +// setting the indexes. In addition, it also sets any delegations found in +// data. Finally, it updates the bonded validators. +// Returns final validator set after applying all declaration and delegations +func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) (res []abci.ValidatorUpdate) { + bondedTokens := sdk.ZeroInt() + notBondedTokens := sdk.ZeroInt() + + // We need to pretend to be "n blocks before genesis", where "n" is the + // validator update delay, so that e.g. slashing periods are correctly + // initialized for the validator set e.g. with a one-block offset - the + // first TM block is at height 1, so state updates applied from + // genesis.json are in block 0. + ctx = ctx.WithBlockHeight(1 - sdk.ValidatorUpdateDelay) + + k.SetParams(ctx, data.Params) + k.SetLastTotalPower(ctx, data.LastTotalPower) + + for _, validator := range data.Validators { + k.SetValidator(ctx, validator) + + // Manually set indices for the first time + err := k.SetValidatorByConsAddr(ctx, validator) + if err != nil { + panic(err) + } + + k.SetValidatorByPowerIndex(ctx, validator) + + // Call the creation hook if not exported + if !data.Exported { + if err := k.AfterValidatorCreated(ctx, validator.GetOperator()); err != nil { + panic(err) + } + } + + // update timeslice if necessary + if validator.IsUnbonding() { + k.InsertUnbondingValidatorQueue(ctx, validator) + } + + switch validator.GetStatus() { + case types.Bonded: + bondedTokens = bondedTokens.Add(validator.GetTokens()) + + case types.Unbonding, types.Unbonded: + notBondedTokens = notBondedTokens.Add(validator.GetTokens()) + + default: + panic("invalid validator status") + } + } + + for _, delegation := range data.Delegations { + delegatorAddress := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + + // Call the before-creation hook if not exported + if !data.Exported { + if err := k.BeforeDelegationCreated(ctx, delegatorAddress, delegation.GetValidatorAddr()); err != nil { + panic(err) + } + } + + k.SetDelegation(ctx, delegation) + + // Call the after-modification hook if not exported + if !data.Exported { + if err := k.AfterDelegationModified(ctx, delegatorAddress, delegation.GetValidatorAddr()); err != nil { + panic(err) + } + } + } + + for _, ubd := range data.UnbondingDelegations { + k.SetUnbondingDelegation(ctx, ubd) + + for _, entry := range ubd.Entries { + k.InsertUBDQueue(ctx, ubd, entry.CompletionTime) + notBondedTokens = notBondedTokens.Add(entry.Balance) + } + } + + for _, red := range data.Redelegations { + k.SetRedelegation(ctx, red) + + for _, entry := range red.Entries { + k.InsertRedelegationQueue(ctx, red, entry.CompletionTime) + } + } + + bondedCoins := sdk.NewCoins(sdk.NewCoin(data.Params.BondDenom, bondedTokens)) + notBondedCoins := sdk.NewCoins(sdk.NewCoin(data.Params.BondDenom, notBondedTokens)) + + // check if the unbonded and bonded pools accounts exists + bondedPool := k.GetBondedPool(ctx) + if bondedPool == nil { + panic(fmt.Sprintf("%s module account has not been set", types.BondedPoolName)) + } + + // TODO: remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 + bondedBalance := k.bankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) + if bondedBalance.IsZero() { + k.authKeeper.SetModuleAccount(ctx, bondedPool) + } + + // if balance is different from bonded coins panic because genesis is most likely malformed + if !bondedBalance.IsEqual(bondedCoins) { + panic(fmt.Sprintf("bonded pool balance is different from bonded coins: %s <-> %s", bondedBalance, bondedCoins)) + } + + notBondedPool := k.GetNotBondedPool(ctx) + if notBondedPool == nil { + panic(fmt.Sprintf("%s module account has not been set", types.NotBondedPoolName)) + } + + notBondedBalance := k.bankKeeper.GetAllBalances(ctx, notBondedPool.GetAddress()) + if notBondedBalance.IsZero() { + k.authKeeper.SetModuleAccount(ctx, notBondedPool) + } + + // If balance is different from non bonded coins panic because genesis is most + // likely malformed. + if !notBondedBalance.IsEqual(notBondedCoins) { + panic(fmt.Sprintf("not bonded pool balance is different from not bonded coins: %s <-> %s", notBondedBalance, notBondedCoins)) + } + + // don't need to run Tendermint updates if we exported + if data.Exported { + for _, lv := range data.LastValidatorPowers { + valAddr, err := sdk.ValAddressFromBech32(lv.Address) + if err != nil { + panic(err) + } + + k.SetLastValidatorPower(ctx, valAddr, lv.Power) + validator, found := k.GetLiquidValidator(ctx, valAddr) + + if !found { + panic(fmt.Sprintf("validator %s not found", lv.Address)) + } + + update := validator.ABCIValidatorUpdate(k.PowerReduction(ctx)) + update.Power = lv.Power // keep the next-val-set offset, use the last power for the first block + res = append(res, update) + } + } else { + var err error + + res, err = k.ApplyAndReturnValidatorSetUpdates(ctx) + if err != nil { + panic(err) + } + } + + return res +} + +// ExportGenesis returns a GenesisState for a given context and keeper. The +// GenesisState will contain the pool, params, validators, and bonds found in +// the keeper. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + var unbondingDelegations []types.UnbondingDelegation + + k.IterateUnbondingDelegations(ctx, func(_ int64, ubd types.UnbondingDelegation) (stop bool) { + unbondingDelegations = append(unbondingDelegations, ubd) + return false + }) + + var redelegations []types.Redelegation + + k.IterateRedelegations(ctx, func(_ int64, red types.Redelegation) (stop bool) { + redelegations = append(redelegations, red) + return false + }) + + var lastValidatorPowers []types.LastValidatorPower + + k.IterateLastValidatorPowers(ctx, func(addr sdk.ValAddress, power int64) (stop bool) { + lastValidatorPowers = append(lastValidatorPowers, types.LastValidatorPower{Address: addr.String(), Power: power}) + return false + }) + + return &types.GenesisState{ + Params: k.GetParams(ctx), + LastTotalPower: k.GetLastTotalPower(ctx), + LastValidatorPowers: lastValidatorPowers, + Validators: k.GetAllValidators(ctx), + Delegations: k.GetAllDelegations(ctx), + UnbondingDelegations: unbondingDelegations, + Redelegations: redelegations, + Exported: true, + } +} diff --git a/x/staking/keeper/grpc_query.go b/x/staking/keeper/grpc_query.go index 79f9542adf2..89d403aafd0 100644 --- a/x/staking/keeper/grpc_query.go +++ b/x/staking/keeper/grpc_query.go @@ -76,7 +76,7 @@ func (k Querier) Validator(c context.Context, req *types.QueryValidatorRequest) } ctx := sdk.UnwrapSDKContext(c) - validator, found := k.GetValidator(ctx, valAddr) + validator, found := k.GetLiquidValidator(ctx, valAddr) if !found { return nil, status.Errorf(codes.NotFound, "validator %s not found", req.ValidatorAddr) } @@ -198,7 +198,7 @@ func (k Querier) Delegation(c context.Context, req *types.QueryDelegationRequest return nil, err } - delegation, found := k.GetDelegation(ctx, delAddr, valAddr) + delegation, found := k.GetLiquidDelegation(ctx, delAddr, valAddr) if !found { return nil, status.Errorf( codes.NotFound, @@ -268,7 +268,7 @@ func (k Querier) DelegatorDelegations(c context.Context, req *types.QueryDelegat } store := ctx.KVStore(k.storeKey) - delStore := prefix.NewStore(store, types.GetDelegationsKey(delAddr)) + delStore := prefix.NewStore(store, types.GetLiquidDelegationsKey(delAddr)) pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { delegation, err := types.UnmarshalDelegation(k.cdc, value) if err != nil { @@ -367,7 +367,7 @@ func (k Querier) HistoricalInfo(c context.Context, req *types.QueryHistoricalInf return nil, status.Error(codes.InvalidArgument, "height cannot be negative") } ctx := sdk.UnwrapSDKContext(c) - hi, found := k.GetHistoricalInfo(ctx, req.Height) + hi, found := k.GetLiquidStakingHistoricalInfo(ctx, req.Height) if !found { return nil, status.Errorf(codes.NotFound, "historical info for height %d not found", req.Height) } @@ -424,14 +424,14 @@ func (k Querier) DelegatorValidators(c context.Context, req *types.QueryDelegato return nil, err } - delStore := prefix.NewStore(store, types.GetDelegationsKey(delAddr)) + delStore := prefix.NewStore(store, types.GetLiquidDelegationsKey(delAddr)) pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { delegation, err := types.UnmarshalDelegation(k.cdc, value) if err != nil { return err } - validator, found := k.GetValidator(ctx, delegation.GetValidatorAddr()) + validator, found := k.GetLiquidValidator(ctx, delegation.GetValidatorAddr()) if !found { return types.ErrNoValidatorFound } @@ -537,3 +537,149 @@ func queryAllRedelegations(store sdk.KVStore, k Querier, req *types.QueryRedeleg return redels, res, err } + +// Query for individual tokenize share record information by share by id +func (k Querier) TokenizeShareRecordById(c context.Context, req *types.QueryTokenizeShareRecordByIdRequest) (*types.QueryTokenizeShareRecordByIdResponse, error) { //nolint:revive // fixing this would require changing the .proto files, so we might as well leave it alone + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + record, err := k.GetTokenizeShareRecord(ctx, req.Id) + if err != nil { + return nil, err + } + + return &types.QueryTokenizeShareRecordByIdResponse{ + Record: record, + }, nil +} + +// Query for individual tokenize share record information by share denom +func (k Querier) TokenizeShareRecordByDenom(c context.Context, req *types.QueryTokenizeShareRecordByDenomRequest) (*types.QueryTokenizeShareRecordByDenomResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + record, err := k.GetTokenizeShareRecordByDenom(ctx, req.Denom) + if err != nil { + return nil, err + } + + return &types.QueryTokenizeShareRecordByDenomResponse{ + Record: record, + }, nil +} + +// Query tokenize share records by address +func (k Querier) TokenizeShareRecordsOwned(c context.Context, req *types.QueryTokenizeShareRecordsOwnedRequest) (*types.QueryTokenizeShareRecordsOwnedResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + owner, err := sdk.AccAddressFromBech32(req.Owner) + if err != nil { + return nil, err + } + records := k.GetTokenizeShareRecordsByOwner(ctx, owner) + + return &types.QueryTokenizeShareRecordsOwnedResponse{ + Records: records, + }, nil +} + +// Query for all tokenize share records +func (k Querier) AllTokenizeShareRecords(c context.Context, req *types.QueryAllTokenizeShareRecordsRequest) (*types.QueryAllTokenizeShareRecordsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(c) + records := k.GetAllTokenizeShareRecords(ctx) + + return &types.QueryAllTokenizeShareRecordsResponse{ + Records: records, + }, nil +} + +// Query for last tokenize share record id +func (k Querier) LastTokenizeShareRecordId(c context.Context, req *types.QueryLastTokenizeShareRecordIdRequest) (*types.QueryLastTokenizeShareRecordIdResponse, error) { //nolint:revive // fixing this would require changing the .proto files, so we might as well leave it alone + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + return &types.QueryLastTokenizeShareRecordIdResponse{ + Id: k.GetLastTokenizeShareRecordID(ctx), + }, nil +} + +// Query for total tokenized staked assets +func (k Querier) TotalTokenizeSharedAssets(c context.Context, req *types.QueryTotalTokenizeSharedAssetsRequest) (*types.QueryTotalTokenizeSharedAssetsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(c) + records := k.GetAllTokenizeShareRecords(ctx) + totalTokenizeShared := sdk.ZeroInt() + + for _, record := range records { + moduleAcc := record.GetModuleAddress() + valAddr, err := sdk.ValAddressFromBech32(record.Validator) + if err != nil { + return nil, err + } + + validator, found := k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + delegation, found := k.GetLiquidDelegation(ctx, moduleAcc, valAddr) + if !found { + return nil, types.ErrNoDelegation + } + + tokens := validator.TokensFromShares(delegation.Shares) + totalTokenizeShared = totalTokenizeShared.Add(tokens.RoundInt()) + } + return &types.QueryTotalTokenizeSharedAssetsResponse{ + Value: sdk.NewCoin(k.BondDenom(ctx), totalTokenizeShared), + }, nil +} + +// Query for total tokenized staked tokens +// Liquid staked tokens are either tokenized delegations or delegations +// owned by a module account +func (k Querier) TotalLiquidStaked(c context.Context, req *types.QueryTotalLiquidStaked) (*types.QueryTotalLiquidStakedResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(c) + totalLiquidStaked := k.GetTotalLiquidStakedTokens(ctx) + return &types.QueryTotalLiquidStakedResponse{ + Tokens: totalLiquidStaked, + }, nil +} + +// Query status of an account's tokenize share lock +func (k Querier) TokenizeShareLockInfo(c context.Context, req *types.QueryTokenizeShareLockInfo) (*types.QueryTokenizeShareLockInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(c) + + address := sdk.MustAccAddressFromBech32(req.Address) + status, completionTime := k.GetTokenizeSharesLock(ctx, address) + + timeString := "" + if !completionTime.IsZero() { + timeString = completionTime.String() + } + + return &types.QueryTokenizeShareLockInfoResponse{ + Status: status.String(), + ExpirationTime: timeString, + }, nil +} diff --git a/x/staking/keeper/historical_info.go b/x/staking/keeper/historical_info.go index 243612d3874..02e0a0e5d4e 100644 --- a/x/staking/keeper/historical_info.go +++ b/x/staking/keeper/historical_info.go @@ -5,6 +5,18 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking/types" ) +func (k Keeper) GetLiquidStakingHistoricalInfo(ctx sdk.Context, height int64) (types.HistoricalInfo, bool) { + store := ctx.KVStore(k.storeKey) + key := types.GetHistoricalInfoKey(height) + + value := store.Get(key) + if value == nil { + return types.HistoricalInfo{}, false + } + + return types.MustUnmarshalHistoricalInfo(k.cdc, value), true +} + // GetHistoricalInfo gets the historical info at a given height func (k Keeper) GetHistoricalInfo(ctx sdk.Context, height int64) (types.HistoricalInfo, bool) { store := ctx.KVStore(k.storeKey) diff --git a/x/staking/keeper/historical_info_test.go b/x/staking/keeper/historical_info_test.go index db6c6a6b47a..40414c2cae8 100644 --- a/x/staking/keeper/historical_info_test.go +++ b/x/staking/keeper/historical_info_test.go @@ -6,8 +6,9 @@ import ( "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" + simapp "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -24,7 +25,7 @@ func IsValSetSorted(data []types.Validator, powerReduction sdk.Int) bool { } func TestHistoricalInfo(t *testing.T) { - _, app, ctx := createTestInput() + _, app, ctx := createTestInput(t) addrDels := simapp.AddTestAddrsIncremental(app, ctx, 50, sdk.NewInt(0)) addrVals := simapp.ConvertAddrsToValAddrs(addrDels) @@ -38,20 +39,20 @@ func TestHistoricalInfo(t *testing.T) { hi := types.NewHistoricalInfo(ctx.BlockHeader(), validators, app.StakingKeeper.PowerReduction(ctx)) app.StakingKeeper.SetHistoricalInfo(ctx, 2, &hi) - recv, found := app.StakingKeeper.GetHistoricalInfo(ctx, 2) + recv, found := app.StakingKeeper.GetLiquidStakingHistoricalInfo(ctx, 2) require.True(t, found, "HistoricalInfo not found after set") require.Equal(t, hi, recv, "HistoricalInfo not equal") require.True(t, IsValSetSorted(recv.Valset, app.StakingKeeper.PowerReduction(ctx)), "HistoricalInfo validators is not sorted") app.StakingKeeper.DeleteHistoricalInfo(ctx, 2) - recv, found = app.StakingKeeper.GetHistoricalInfo(ctx, 2) + recv, found = app.StakingKeeper.GetLiquidStakingHistoricalInfo(ctx, 2) require.False(t, found, "HistoricalInfo found after delete") require.Equal(t, types.HistoricalInfo{}, recv, "HistoricalInfo is not empty") } func TestTrackHistoricalInfo(t *testing.T) { - _, app, ctx := createTestInput() + _, app, ctx := createTestInput(t) addrDels := simapp.AddTestAddrsIncremental(app, ctx, 50, sdk.NewInt(0)) addrVals := simapp.ConvertAddrsToValAddrs(addrDels) @@ -79,27 +80,31 @@ func TestTrackHistoricalInfo(t *testing.T) { hi5 := types.NewHistoricalInfo(h5, valSet, app.StakingKeeper.PowerReduction(ctx)) app.StakingKeeper.SetHistoricalInfo(ctx, 4, &hi4) app.StakingKeeper.SetHistoricalInfo(ctx, 5, &hi5) - recv, found := app.StakingKeeper.GetHistoricalInfo(ctx, 4) + recv, found := app.StakingKeeper.GetLiquidStakingHistoricalInfo(ctx, 4) require.True(t, found) require.Equal(t, hi4, recv) - recv, found = app.StakingKeeper.GetHistoricalInfo(ctx, 5) + recv, found = app.StakingKeeper.GetLiquidStakingHistoricalInfo(ctx, 5) require.True(t, found) require.Equal(t, hi5, recv) + // genesis validator + genesisVals := app.StakingKeeper.GetAllValidators(ctx) + require.Len(t, genesisVals, 1) + // Set bonded validators in keeper val1 := teststaking.NewValidator(t, addrVals[2], PKs[2]) - val1.Status = types.Bonded // when not bonded, consensus power is Zero + val1.Status = sdkstaking.Bonded // when not bonded, consensus power is Zero val1.Tokens = app.StakingKeeper.TokensFromConsensusPower(ctx, 10) app.StakingKeeper.SetValidator(ctx, val1) app.StakingKeeper.SetLastValidatorPower(ctx, val1.GetOperator(), 10) val2 := teststaking.NewValidator(t, addrVals[3], PKs[3]) - val1.Status = types.Bonded + val1.Status = sdkstaking.Bonded val2.Tokens = app.StakingKeeper.TokensFromConsensusPower(ctx, 80) app.StakingKeeper.SetValidator(ctx, val2) app.StakingKeeper.SetLastValidatorPower(ctx, val2.GetOperator(), 80) - vals := []types.Validator{val1, val2} - IsValSetSorted(vals, app.StakingKeeper.PowerReduction(ctx)) + vals := []types.Validator{val1, genesisVals[0], val2} + require.True(t, IsValSetSorted(vals, app.StakingKeeper.PowerReduction(ctx))) // Set Header for BeginBlock context header := tmproto.Header{ @@ -115,21 +120,25 @@ func TestTrackHistoricalInfo(t *testing.T) { Header: header, Valset: vals, } - recv, found = app.StakingKeeper.GetHistoricalInfo(ctx, 10) + recv, found = app.StakingKeeper.GetLiquidStakingHistoricalInfo(ctx, 10) require.True(t, found, "GetHistoricalInfo failed after BeginBlock") require.Equal(t, expected, recv, "GetHistoricalInfo returned unexpected result") // Check HistoricalInfo at height 5, 4 is pruned - recv, found = app.StakingKeeper.GetHistoricalInfo(ctx, 4) + recv, found = app.StakingKeeper.GetLiquidStakingHistoricalInfo(ctx, 4) require.False(t, found, "GetHistoricalInfo did not prune earlier height") require.Equal(t, types.HistoricalInfo{}, recv, "GetHistoricalInfo at height 4 is not empty after prune") - recv, found = app.StakingKeeper.GetHistoricalInfo(ctx, 5) + recv, found = app.StakingKeeper.GetLiquidStakingHistoricalInfo(ctx, 5) require.False(t, found, "GetHistoricalInfo did not prune first prune height") require.Equal(t, types.HistoricalInfo{}, recv, "GetHistoricalInfo at height 5 is not empty after prune") } func TestGetAllHistoricalInfo(t *testing.T) { - _, app, ctx := createTestInput() + _, app, ctx := createTestInput(t) + // clear historical info + infos := app.StakingKeeper.GetAllHistoricalInfo(ctx) + require.Len(t, infos, 1) + app.StakingKeeper.DeleteHistoricalInfo(ctx, infos[0].Header.Height) addrDels := simapp.AddTestAddrsIncremental(app, ctx, 50, sdk.NewInt(0)) addrVals := simapp.ConvertAddrsToValAddrs(addrDels) @@ -150,9 +159,10 @@ func TestGetAllHistoricalInfo(t *testing.T) { expHistInfos := []types.HistoricalInfo{hist1, hist2, hist3} for i, hi := range expHistInfos { - app.StakingKeeper.SetHistoricalInfo(ctx, int64(10+i), &hi) + hihi := hi + app.StakingKeeper.SetHistoricalInfo(ctx, int64(10+i), &hihi) } - infos := app.StakingKeeper.GetAllHistoricalInfo(ctx) + infos = app.StakingKeeper.GetAllHistoricalInfo(ctx) require.Equal(t, expHistInfos, infos) } diff --git a/x/staking/keeper/hooks.go b/x/staking/keeper/hooks.go index 314daaf1bf2..642cdf99da0 100644 --- a/x/staking/keeper/hooks.go +++ b/x/staking/keeper/hooks.go @@ -9,79 +9,88 @@ import ( var _ types.StakingHooks = Keeper{} // AfterValidatorCreated - call hook if registered -func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { +func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.AfterValidatorCreated(ctx, valAddr) + return k.hooks.AfterValidatorCreated(ctx, valAddr) } + return nil } // BeforeValidatorModified - call hook if registered -func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) { +func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.BeforeValidatorModified(ctx, valAddr) + return k.hooks.BeforeValidatorModified(ctx, valAddr) } + return nil } // AfterValidatorRemoved - call hook if registered -func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { +func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.AfterValidatorRemoved(ctx, consAddr, valAddr) + return k.hooks.AfterValidatorRemoved(ctx, consAddr, valAddr) } + return nil +} + +func (k Keeper) BeforeTokenizeShareRecordRemoved(ctx sdk.Context, recordID uint64) error { + if k.hooks != nil { + return k.hooks.BeforeTokenizeShareRecordRemoved(ctx, recordID) + } + return nil } // AfterValidatorBonded - call hook if registered -func (k Keeper) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { +func (k Keeper) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.AfterValidatorBonded(ctx, consAddr, valAddr) + return k.hooks.AfterValidatorBonded(ctx, consAddr, valAddr) } + return nil } // AfterValidatorBeginUnbonding - call hook if registered -func (k Keeper) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { +func (k Keeper) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.AfterValidatorBeginUnbonding(ctx, consAddr, valAddr) + return k.hooks.AfterValidatorBeginUnbonding(ctx, consAddr, valAddr) } + return nil } // BeforeDelegationCreated - call hook if registered -func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.BeforeDelegationCreated(ctx, delAddr, valAddr) + return k.hooks.BeforeDelegationCreated(ctx, delAddr, valAddr) } + return nil } // BeforeDelegationSharesModified - call hook if registered -func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.BeforeDelegationSharesModified(ctx, delAddr, valAddr) + return k.hooks.BeforeDelegationSharesModified(ctx, delAddr, valAddr) } + return nil } // BeforeDelegationRemoved - call hook if registered -func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.BeforeDelegationRemoved(ctx, delAddr, valAddr) + return k.hooks.BeforeDelegationRemoved(ctx, delAddr, valAddr) } + return nil } // AfterDelegationModified - call hook if registered -func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { if k.hooks != nil { - k.hooks.AfterDelegationModified(ctx, delAddr, valAddr) + return k.hooks.AfterDelegationModified(ctx, delAddr, valAddr) } + return nil } // BeforeValidatorSlashed - call hook if registered -func (k Keeper) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) { - if k.hooks != nil { - k.hooks.BeforeValidatorSlashed(ctx, valAddr, fraction) - } -} - -// This is called when an UnbondingDelegationEntry is first created -func (k Keeper) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error { +func (k Keeper) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { if k.hooks != nil { - return k.hooks.AfterUnbondingInitiated(ctx, id) + return k.hooks.BeforeValidatorSlashed(ctx, valAddr, fraction) } return nil } diff --git a/x/staking/keeper/invariants.go b/x/staking/keeper/invariants.go index 52a45504dbf..639eaad1b37 100644 --- a/x/staking/keeper/invariants.go +++ b/x/staking/keeper/invariants.go @@ -100,7 +100,7 @@ func NonNegativePowerInvariant(k Keeper) sdk.Invariant { iterator := k.ValidatorsPowerStoreIterator(ctx) for ; iterator.Valid(); iterator.Next() { - validator, found := k.GetValidator(ctx, iterator.Value()) + validator, found := k.GetLiquidValidator(ctx, iterator.Value()) if !found { panic(fmt.Sprintf("validator record not found for address: %X\n", iterator.Value())) } @@ -137,13 +137,11 @@ func PositiveDelegationInvariant(k Keeper) sdk.Invariant { for _, delegation := range delegations { if delegation.Shares.IsNegative() { count++ - msg += fmt.Sprintf("\tdelegation with negative shares: %+v\n", delegation) } if delegation.Shares.IsZero() { count++ - msg += fmt.Sprintf("\tdelegation with zero shares: %+v\n", delegation) } } diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index 7f120af196f..45cd7528805 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" - abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -20,7 +20,7 @@ var _ types.DelegationSet = Keeper{} // keeper of the staking store type Keeper struct { - storeKey sdk.StoreKey + storeKey storetypes.StoreKey cdc codec.BinaryCodec authKeeper types.AccountKeeper bankKeeper types.BankKeeper @@ -30,7 +30,7 @@ type Keeper struct { // NewKeeper creates a new staking Keeper instance func NewKeeper( - cdc codec.BinaryCodec, key sdk.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, + cdc codec.BinaryCodec, key storetypes.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, ps paramtypes.Subspace, ) Keeper { // set KeyTable if it has not already been set @@ -94,19 +94,3 @@ func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdk.Int) { bz := k.cdc.MustMarshal(&sdk.IntProto{Int: power}) store.Set(types.LastTotalPowerKey, bz) } - -// SetValidatorUpdates sets the ABCI validator power updates for the current block. -func (k Keeper) SetValidatorUpdates(ctx sdk.Context, valUpdates []abci.ValidatorUpdate) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&types.ValidatorUpdates{Updates: valUpdates}) - store.Set(types.ValidatorUpdatesKey, bz) -} - -// GetValidatorUpdates returns the ABCI validator power updates within the current block. -func (k Keeper) GetValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ValidatorUpdatesKey) - var valUpdates types.ValidatorUpdates - k.cdc.MustUnmarshal(bz, &valUpdates) - return valUpdates.Updates -} diff --git a/x/staking/keeper/liquid_stake.go b/x/staking/keeper/liquid_stake.go new file mode 100644 index 00000000000..54e6db04b7f --- /dev/null +++ b/x/staking/keeper/liquid_stake.go @@ -0,0 +1,316 @@ +package keeper + +import ( + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// SetTotalLiquidStakedTokens stores the total outstanding tokens owned by a liquid staking provider +func (k Keeper) SetTotalLiquidStakedTokens(ctx sdk.Context, tokens sdk.Int) { + store := ctx.KVStore(k.storeKey) + + tokensBz, err := tokens.Marshal() + if err != nil { + panic(err) + } + + store.Set(types.TotalLiquidStakedTokensKey, tokensBz) +} + +// GetTotalLiquidStakedTokens returns the total outstanding tokens owned by a liquid staking provider +// Returns zero if the total liquid stake amount has not been initialized +func (k Keeper) GetTotalLiquidStakedTokens(ctx sdk.Context) sdk.Int { + store := ctx.KVStore(k.storeKey) + tokensBz := store.Get(types.TotalLiquidStakedTokensKey) + + if tokensBz == nil { + return sdk.ZeroInt() + } + + var tokens sdk.Int + if err := tokens.Unmarshal(tokensBz); err != nil { + panic(err) + } + + return tokens +} + +// Check if an account is a owned by a liquid staking provider +// This is determined by checking if the account is a 32-length module account +func (k Keeper) AccountIsLiquidStakingProvider(ctx sdk.Context, address sdk.AccAddress) bool { + account := k.authKeeper.GetAccount(ctx, address) + _, isModuleAccount := account.(*authtypes.ModuleAccount) + return isModuleAccount && len(address) == 32 +} + +// CheckExceedsGlobalLiquidStakingCap checks if a liquid delegation would cause the +// global liquid staking cap to be exceeded +// A liquid delegation is defined as either tokenized shares, or a delegation from an ICA Account +// The total stake is determined by the balance of the bonded pool +// Returns true if the cap is exceeded +func (k Keeper) CheckExceedsGlobalLiquidStakingCap(ctx sdk.Context, tokens sdk.Int, tokenizingShares bool) bool { + liquidStakingCap := k.GlobalLiquidStakingCap(ctx) + liquidStakedAmount := k.GetTotalLiquidStakedTokens(ctx) + + // Determine the total stake from the balance of the bonded pool + // If this is not a tokenized delegation, we need to add the tokens to the pool balance since + // they would not have been counted yet + // If this is for a tokenized delegation, the tokens are already included in the pool balance + totalStakedAmount := k.TotalBondedTokens(ctx) + if !tokenizingShares { + totalStakedAmount = totalStakedAmount.Add(tokens) + } + + // Calculate the percentage of stake that is liquid + updatedLiquidStaked := liquidStakedAmount.Add(tokens).ToDec() + liquidStakePercent := updatedLiquidStaked.Quo(totalStakedAmount.ToDec()) + + return liquidStakePercent.GT(liquidStakingCap) +} + +// CheckExceedsValidatorBondCap checks if a liquid delegation to a validator would cause +// the liquid shares to exceed the validator bond factor +// A liquid delegation is defined as either tokenized shares, or a delegation from an ICA Account +// Returns true if the cap is exceeded +func (k Keeper) CheckExceedsValidatorBondCap(ctx sdk.Context, validator types.Validator, shares sdk.Dec) bool { + validatorBondFactor := k.ValidatorBondFactor(ctx) + if validatorBondFactor.Equal(sdk.NewDec(-1)) { + return false + } + maxValLiquidShares := validator.TotalValidatorBondShares.Mul(validatorBondFactor) + return validator.TotalLiquidShares.Add(shares).GT(maxValLiquidShares) +} + +// CheckExceedsValidatorLiquidStakingCap checks if a liquid delegation could cause the +// total liuquid shares to exceed the liquid staking cap +// A liquid delegation is defined as either tokenized shares, or a delegation from an ICA Account +// Returns true if the cap is exceeded +func (k Keeper) CheckExceedsValidatorLiquidStakingCap(ctx sdk.Context, validator types.Validator, shares sdk.Dec) bool { + updatedLiquidShares := validator.TotalLiquidShares.Add(shares) + updatedTotalShares := validator.DelegatorShares.Add(shares) + + liquidStakePercent := updatedLiquidShares.Quo(updatedTotalShares) + liquidStakingCap := k.ValidatorLiquidStakingCap(ctx) + + return liquidStakePercent.GT(liquidStakingCap) +} + +// SafelyIncreaseTotalLiquidStakedTokens increments the total liquid staked tokens +// if the global cap is not surpassed by this delegation +func (k Keeper) SafelyIncreaseTotalLiquidStakedTokens(ctx sdk.Context, amount sdk.Int, tokenizingShares bool) error { + if k.CheckExceedsGlobalLiquidStakingCap(ctx, amount, tokenizingShares) { + return types.ErrGlobalLiquidStakingCapExceeded + } + + k.SetTotalLiquidStakedTokens(ctx, k.GetTotalLiquidStakedTokens(ctx).Add(amount)) + return nil +} + +// DecreaseTotalLiquidStakedTokens decrements the total liquid staked tokens +func (k Keeper) DecreaseTotalLiquidStakedTokens(ctx sdk.Context, amount sdk.Int) { + k.SetTotalLiquidStakedTokens(ctx, k.GetTotalLiquidStakedTokens(ctx).Sub(amount)) +} + +// SafelyIncreaseValidatorTotalLiquidShares increments the total liquid shares on a validator, if: +// the validator bond factor and validator liquid staking cap will not be exceeded by this delegation +func (k Keeper) SafelyIncreaseValidatorTotalLiquidShares(ctx sdk.Context, validator types.Validator, shares sdk.Dec) error { + // Confirm the validator bond factor and validator liquid staking cap will be not exceeded + if k.CheckExceedsValidatorBondCap(ctx, validator, shares) { + return types.ErrInsufficientValidatorBondShares + } + if k.CheckExceedsValidatorLiquidStakingCap(ctx, validator, shares) { + return types.ErrValidatorLiquidStakingCapExceeded + } + + // Increment the validator's total liquid shares + validator.TotalLiquidShares = validator.TotalLiquidShares.Add(shares) + k.SetValidator(ctx, validator) + + return nil +} + +// DecreaseValidatorTotalLiquidShares decrements the total liquid shares on a validator +func (k Keeper) DecreaseValidatorTotalLiquidShares(ctx sdk.Context, validator types.Validator, shares sdk.Dec) { + validator.TotalLiquidShares = validator.TotalLiquidShares.Sub(shares) + k.SetValidator(ctx, validator) +} + +// SafelyDecreaseValidatorBond decrements the total validator's self bond +// so long as it will not cause the current delegations to exceed the threshold +// set by validator bond factor +func (k Keeper) SafelyDecreaseValidatorBond(ctx sdk.Context, validator types.Validator, shares sdk.Dec) error { + // Check if the decreased self bond will cause the validator bond threshold to be exceeded + validatorBondFactor := k.ValidatorBondFactor(ctx) + maxValTotalShare := validator.TotalValidatorBondShares.Sub(shares).Mul(validatorBondFactor) + if validator.TotalLiquidShares.GT(maxValTotalShare) { + return types.ErrInsufficientValidatorBondShares + } + + // Decrement the validator's total self bond + validator.TotalValidatorBondShares = validator.TotalValidatorBondShares.Sub(shares) + k.SetValidator(ctx, validator) + + return nil +} + +// Adds a lock that prevents tokenizing shares for an account +// The tokenize share lock store is implemented by keying on the account address +// and storing a timestamp as the value. The timestamp is empty when the lock is +// set and gets populated with the unlock completion time once the unlock has started +func (k Keeper) AddTokenizeSharesLock(ctx sdk.Context, address sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) + key := types.GetTokenizeSharesLockKey(address) + store.Set(key, sdk.FormatTimeBytes(time.Time{})) +} + +// Removes the tokenize share lock for an account to enable tokenizing shares +func (k Keeper) RemoveTokenizeSharesLock(ctx sdk.Context, address sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) + key := types.GetTokenizeSharesLockKey(address) + store.Delete(key) +} + +// Updates the timestamp associated with a lock to the time at which the lock expires +func (k Keeper) SetTokenizeSharesUnlockTime(ctx sdk.Context, address sdk.AccAddress, completionTime time.Time) { + store := ctx.KVStore(k.storeKey) + key := types.GetTokenizeSharesLockKey(address) + store.Set(key, sdk.FormatTimeBytes(completionTime)) +} + +// Checks if there is currently a tokenize share lock for a given account +// Returns the status indicating whether the account is locked, unlocked, +// or as a lock expiring. If the lock is expiring, the expiration time is returned +func (k Keeper) GetTokenizeSharesLock(ctx sdk.Context, address sdk.AccAddress) (status types.TokenizeShareLockStatus, unlockTime time.Time) { + store := ctx.KVStore(k.storeKey) + key := types.GetTokenizeSharesLockKey(address) + bz := store.Get(key) + if len(bz) == 0 { + return types.TokenizeShareLockStatus_UNLOCKED, time.Time{} + } + unlockTime, err := sdk.ParseTimeBytes(bz) + if err != nil { + panic(err) + } + if unlockTime.IsZero() { + return types.TokenizeShareLockStatus_LOCKED, time.Time{} + } + return types.TokenizeShareLockStatus_LOCK_EXPIRING, unlockTime +} + +// Stores a list of addresses pending tokenize share unlocking at the same time +func (k Keeper) SetPendingTokenizeShareAuthorizations(ctx sdk.Context, completionTime time.Time, authorizations types.PendingTokenizeShareAuthorizations) { + store := ctx.KVStore(k.storeKey) + timeKey := types.GetTokenizeShareAuthorizationTimeKey(completionTime) + bz := k.cdc.MustMarshal(&authorizations) + store.Set(timeKey, bz) +} + +// Returns a list of addresses pending tokenize share unlocking at the same time +func (k Keeper) GetPendingTokenizeShareAuthorizations(ctx sdk.Context, completionTime time.Time) types.PendingTokenizeShareAuthorizations { + store := ctx.KVStore(k.storeKey) + + timeKey := types.GetTokenizeShareAuthorizationTimeKey(completionTime) + bz := store.Get(timeKey) + + authorizations := types.PendingTokenizeShareAuthorizations{Addresses: []string{}} + if len(bz) == 0 { + return authorizations + } + k.cdc.MustUnmarshal(bz, &authorizations) + + return authorizations +} + +// Inserts the address into a queue where it will sit for 1 unbonding period +// before the tokenize share lock is removed +// Returns the completion time +func (k Keeper) QueueTokenizeSharesAuthorization(ctx sdk.Context, address sdk.AccAddress) time.Time { + params := k.GetParams(ctx) + completionTime := ctx.BlockTime().Add(params.UnbondingTime) + + // Append the address to the list of addresses that also unlock at this time + authorizations := k.GetPendingTokenizeShareAuthorizations(ctx, completionTime) + authorizations.Addresses = append(authorizations.Addresses, address.String()) + + k.SetPendingTokenizeShareAuthorizations(ctx, completionTime, authorizations) + k.SetTokenizeSharesUnlockTime(ctx, address, completionTime) + + return completionTime +} + +// Unlocks all queued tokenize share authorizations that have matured +// (i.e. have waited the full unbonding period) +func (k Keeper) RemoveExpiredTokenizeShareLocks(ctx sdk.Context, blockTime time.Time) (unlockedAddresses []string) { + store := ctx.KVStore(k.storeKey) + + // iterators all time slices from time 0 until the current block time + prefixEnd := sdk.InclusiveEndBytes(types.GetTokenizeShareAuthorizationTimeKey(blockTime)) + iterator := store.Iterator(types.TokenizeSharesUnlockQueueKey, prefixEnd) + defer iterator.Close() + + unlockedAddresses = []string{} + for ; iterator.Valid(); iterator.Next() { + authorizations := types.PendingTokenizeShareAuthorizations{} + k.cdc.MustUnmarshal(iterator.Value(), &authorizations) + + for _, addressString := range authorizations.Addresses { + k.RemoveTokenizeSharesLock(ctx, sdk.MustAccAddressFromBech32(addressString)) + unlockedAddresses = append(unlockedAddresses, addressString) + } + store.Delete(iterator.Key()) + } + + return unlockedAddresses +} + +// Calculates and sets the global liquid staked tokens and total liquid shares by validator +// The totals are determined by looping each delegation record and summing the stake +// if the delegator is a module account. Checking for a module account will capture +// ICA accounts, as well as tokenized delegationswhich are owned by module accounts +// under the hood +// This function must be called in the upgrade handler which onboards LSM, as +// well as any time the liquid staking cap is re-enabled +func (k Keeper) RefreshTotalLiquidStaked(ctx sdk.Context) error { + // First reset each validator's liquid shares to 0 + for _, validator := range k.GetAllValidators(ctx) { + validator.TotalLiquidShares = sdk.ZeroDec() + k.SetValidator(ctx, validator) + } + + // Sum up the total liquid tokens and increment each validator's total liquid shares + totalLiquidStakedTokens := sdk.ZeroInt() + for _, delegation := range k.GetAllDelegations(ctx) { + delegatorAddress, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) + if err != nil { + return err + } + validatorAddress, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + return err + } + + validator, found := k.GetLiquidValidator(ctx, validatorAddress) + if !found { + return types.ErrNoValidatorFound + } + + // If the account is a liquid staking provider, increment the global number + // of liquid staked tokens, and the total liquid shares on the validator + if k.AccountIsLiquidStakingProvider(ctx, delegatorAddress) { + liquidShares := delegation.Shares + liquidTokens := validator.TokensFromShares(liquidShares).TruncateInt() + + validator.TotalLiquidShares = validator.TotalLiquidShares.Add(liquidShares) + k.SetValidator(ctx, validator) + + totalLiquidStakedTokens = totalLiquidStakedTokens.Add(liquidTokens) + } + } + + k.SetTotalLiquidStakedTokens(ctx, totalLiquidStakedTokens) + + return nil +} diff --git a/x/staking/keeper/migrations.go b/x/staking/keeper/migrations.go index 101ca195b39..b55569d4a44 100644 --- a/x/staking/keeper/migrations.go +++ b/x/staking/keeper/migrations.go @@ -1,21 +1 @@ package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - v043 "github.com/cosmos/cosmos-sdk/x/staking/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/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index 3642cef1e5a..dc684a63b19 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -2,15 +2,23 @@ package keeper import ( "context" + "errors" + "fmt" + "strconv" "time" + errorsmod "cosmossdk.io/errors" + metrics "github.com/armon/go-metrics" - tmstrings "github.com/tendermint/tendermint/libs/strings" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -35,14 +43,18 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa return nil, err } + if msg.Commission.Rate.LT(k.MinCommissionRate(ctx)) { + return nil, errorsmod.Wrapf(errors.New("commission cannot be less than min rate"), "cannot set validator commission to less than minimum rate of %s", k.MinCommissionRate(ctx)) + } + // check to see if the pubkey or sender has been registered before - if _, found := k.GetValidator(ctx, valAddr); found { + if _, found := k.GetLiquidValidator(ctx, valAddr); found { return nil, types.ErrValidatorOwnerExists } pk, ok := msg.Pubkey.GetCachedValue().(cryptotypes.PubKey) if !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "Expecting cryptotypes.PubKey, got %T", pk) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidType, "Expecting cryptotypes.PubKey, got %T", pk) } if _, found := k.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(pk)); found { @@ -51,7 +63,7 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa bondDenom := k.BondDenom(ctx) if msg.Value.Denom != bondDenom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Value.Denom, bondDenom, ) } @@ -62,8 +74,16 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa cp := ctx.ConsensusParams() if cp != nil && cp.Validator != nil { - if !tmstrings.StringInSlice(pk.Type(), cp.Validator.PubKeyTypes) { - return nil, sdkerrors.Wrapf( + pkType := pk.Type() + hasKeyType := false + for _, keyType := range cp.Validator.PubKeyTypes { + if pkType == keyType { + hasKeyType = true + break + } + } + if !hasKeyType { + return nil, errorsmod.Wrapf( types.ErrValidatorPubKeyTypeNotSupported, "got: %s, expected: %s", pk.Type(), cp.Validator.PubKeyTypes, ) @@ -74,6 +94,7 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa if err != nil { return nil, err } + commission := types.NewCommissionWithTime( msg.Commission.Rate, msg.Commission.MaxRate, msg.Commission.MaxChangeRate, ctx.BlockHeader().Time, @@ -89,14 +110,17 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa return nil, err } - validator.MinSelfDelegation = msg.MinSelfDelegation - k.SetValidator(ctx, validator) - k.SetValidatorByConsAddr(ctx, validator) + err = k.SetValidatorByConsAddr(ctx, validator) + if err != nil { + return nil, err + } k.SetNewValidatorByPowerIndex(ctx, validator) // call the after-creation hook - k.AfterValidatorCreated(ctx, validator.GetOperator()) + if err := k.AfterValidatorCreated(ctx, validator.GetOperator()); err != nil { + return nil, err + } // move coins from the msg.Address account to a (self-delegation) delegator account // the validator account and global shares are updated within here @@ -130,7 +154,7 @@ func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValida return nil, err } // validator must already be registered - validator, found := k.GetValidator(ctx, valAddr) + validator, found := k.GetLiquidValidator(ctx, valAddr) if !found { return nil, types.ErrNoValidatorFound } @@ -150,21 +174,11 @@ func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValida } // call the before-modification hook since we're about to update the commission - k.BeforeValidatorModified(ctx, valAddr) - - validator.Commission = commission - } - - if msg.MinSelfDelegation != nil { - if !msg.MinSelfDelegation.GT(validator.MinSelfDelegation) { - return nil, types.ErrMinSelfDelegationDecreased - } - - if msg.MinSelfDelegation.GT(validator.Tokens) { - return nil, types.ErrSelfDelegationBelowMinimum + if err := k.BeforeValidatorModified(ctx, valAddr); err != nil { + return nil, err } - validator.MinSelfDelegation = (*msg.MinSelfDelegation) + validator.Commission = commission } k.SetValidator(ctx, validator) @@ -173,7 +187,6 @@ func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValida sdk.NewEvent( types.EventTypeEditValidator, sdk.NewAttribute(types.AttributeKeyCommissionRate, validator.Commission.String()), - sdk.NewAttribute(types.AttributeKeyMinSelfDelegation, validator.MinSelfDelegation.String()), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -193,7 +206,7 @@ func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*typ return nil, valErr } - validator, found := k.GetValidator(ctx, valAddr) + validator, found := k.GetLiquidValidator(ctx, valAddr) if !found { return nil, types.ErrNoValidatorFound } @@ -205,23 +218,40 @@ func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*typ bondDenom := k.BondDenom(ctx) if msg.Amount.Denom != bondDenom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, ) } + tokens := msg.Amount.Amount + shares, err := validator.SharesFromTokens(tokens) + if err != nil { + return nil, err + } + + // if this delegation is from a liquid staking provider, it cannot exceed + // the global or validator bond cap + if k.AccountIsLiquidStakingProvider(ctx, delegatorAddress) { + if err := k.SafelyIncreaseTotalLiquidStakedTokens(ctx, tokens, false); err != nil { + return nil, err + } + if err := k.SafelyIncreaseValidatorTotalLiquidShares(ctx, validator, shares); err != nil { + return nil, err + } + } + // NOTE: source funds are always unbonded - newShares, err := k.Keeper.Delegate(ctx, delegatorAddress, msg.Amount.Amount, types.Unbonded, validator, true) + newShares, err := k.Keeper.Delegate(ctx, delegatorAddress, tokens, types.Unbonded, validator, true) if err != nil { return nil, err } - if msg.Amount.Amount.IsInt64() { + if tokens.IsInt64() { defer func() { telemetry.IncrCounter(1, types.ModuleName, "delegate") telemetry.SetGaugeWithLabels( []string{"tx", "msg", msg.Type()}, - float32(msg.Amount.Amount.Int64()), + float32(tokens.Int64()), []metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)}, ) }() @@ -247,14 +277,39 @@ func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*typ // BeginRedelegate defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator func (k msgServer) BeginRedelegate(goCtx context.Context, msg *types.MsgBeginRedelegate) (*types.MsgBeginRedelegateResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + valSrcAddr, err := sdk.ValAddressFromBech32(msg.ValidatorSrcAddress) if err != nil { return nil, err } + valDstAddr, err := sdk.ValAddressFromBech32(msg.ValidatorDstAddress) + if err != nil { + return nil, err + } + + srcValidator, found := k.GetLiquidValidator(ctx, valSrcAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + dstValidator, found := k.GetLiquidValidator(ctx, valDstAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { return nil, err } + + delegation, found := k.GetLiquidDelegation(ctx, delegatorAddress, valSrcAddr) + if !found { + return nil, status.Errorf( + codes.NotFound, + "delegation with delegator %s not found for validator %s", + msg.DelegatorAddress, msg.ValidatorSrcAddress, + ) + } + shares, err := k.ValidateUnbondAmount( ctx, delegatorAddress, valSrcAddr, msg.Amount.Amount, ) @@ -262,18 +317,30 @@ func (k msgServer) BeginRedelegate(goCtx context.Context, msg *types.MsgBeginRed return nil, err } + // if this is a validator self-bond, the new liquid delegation cannot fall below the self-bond * bond factor + if delegation.ValidatorBond { + if err := k.SafelyDecreaseValidatorBond(ctx, srcValidator, shares); err != nil { + return nil, err + } + } + + // If this delegation is from a liquid staking provider, the delegation on the new validator + // cannot exceed that validator's self-bond cap + // The liquid shares from the source validator should get moved to the destination validator + if k.AccountIsLiquidStakingProvider(ctx, delegatorAddress) { + if err := k.SafelyIncreaseValidatorTotalLiquidShares(ctx, dstValidator, shares); err != nil { + return nil, err + } + k.DecreaseValidatorTotalLiquidShares(ctx, srcValidator, shares) + } + bondDenom := k.BondDenom(ctx) if msg.Amount.Denom != bondDenom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, ) } - valDstAddr, err := sdk.ValAddressFromBech32(msg.ValidatorDstAddress) - if err != nil { - return nil, err - } - completionTime, err := k.BeginRedelegation( ctx, delegatorAddress, valSrcAddr, valDstAddr, shares, ) @@ -324,16 +391,46 @@ func (k msgServer) Undelegate(goCtx context.Context, msg *types.MsgUndelegate) ( if err != nil { return nil, err } + + tokens := msg.Amount.Amount shares, err := k.ValidateUnbondAmount( - ctx, delegatorAddress, addr, msg.Amount.Amount, + ctx, delegatorAddress, addr, tokens, ) if err != nil { return nil, err } + validator, found := k.GetLiquidValidator(ctx, addr) + if !found { + return nil, types.ErrNoValidatorFound + } + + delegation, found := k.GetLiquidDelegation(ctx, delegatorAddress, addr) + if !found { + return nil, status.Errorf( + codes.NotFound, + "delegation with delegator %s not found for validator %s", + msg.DelegatorAddress, msg.ValidatorAddress, + ) + } + + // if this is a validator self-bond, the new liquid delegation cannot fall below the self-bond * bond factor + if delegation.ValidatorBond { + if err := k.SafelyDecreaseValidatorBond(ctx, validator, shares); err != nil { + return nil, err + } + } + + // if this undelegation is from a liquid staking provider, the global and validator + // liquid counts should be decremented + if k.AccountIsLiquidStakingProvider(ctx, delegatorAddress) { + k.DecreaseTotalLiquidStakedTokens(ctx, tokens) + k.DecreaseValidatorTotalLiquidShares(ctx, validator, shares) + } + bondDenom := k.BondDenom(ctx) if msg.Amount.Denom != bondDenom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, ) } @@ -343,12 +440,12 @@ func (k msgServer) Undelegate(goCtx context.Context, msg *types.MsgUndelegate) ( return nil, err } - if msg.Amount.Amount.IsInt64() { + if tokens.IsInt64() { defer func() { telemetry.IncrCounter(1, types.ModuleName, "undelegate") telemetry.SetGaugeWithLabels( []string{"tx", "msg", msg.Type()}, - float32(msg.Amount.Amount.Int64()), + float32(tokens.Int64()), []metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)}, ) }() @@ -372,3 +469,525 @@ func (k msgServer) Undelegate(goCtx context.Context, msg *types.MsgUndelegate) ( CompletionTime: completionTime, }, nil } + +// CancelUnbondingDelegation defines a method for canceling the unbonding delegation +// and delegate back to the validator. +func (k msgServer) CancelUnbondingDelegation(goCtx context.Context, msg *types.MsgCancelUnbondingDelegation) (*types.MsgCancelUnbondingDelegationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return nil, err + } + + delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return nil, err + } + + bondDenom := k.BondDenom(ctx) + if msg.Amount.Denom != bondDenom { + return nil, errorsmod.Wrapf( + sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, + ) + } + + validator, found := k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + // In some situations, the exchange rate becomes invalid, e.g. if + // Validator loses all tokens due to slashing. In this case, + // make all future delegations invalid. + if validator.InvalidExRate() { + return nil, types.ErrDelegatorShareExRateInvalid + } + + if validator.IsJailed() { + return nil, types.ErrValidatorJailed + } + + ubd, found := k.GetUnbondingDelegation(ctx, delegatorAddress, valAddr) + if !found { + return nil, status.Errorf( + codes.NotFound, + "unbonding delegation with delegator %s not found for validator %s", + msg.DelegatorAddress, msg.ValidatorAddress, + ) + } + + var ( + unbondEntry types.UnbondingDelegationEntry + unbondEntryIndex int64 = -1 + ) + + for i, entry := range ubd.Entries { + if entry.CreationHeight == msg.CreationHeight { + unbondEntry = entry + unbondEntryIndex = int64(i) + break + } + } + if unbondEntryIndex == -1 { + return nil, sdkerrors.ErrNotFound.Wrapf("unbonding delegation entry is not found at block height %d", msg.CreationHeight) + } + + if unbondEntry.Balance.LT(msg.Amount.Amount) { + return nil, sdkerrors.ErrInvalidRequest.Wrap("amount is greater than the unbonding delegation entry balance") + } + + if unbondEntry.CompletionTime.Before(ctx.BlockTime()) { + return nil, sdkerrors.ErrInvalidRequest.Wrap("unbonding delegation is already processed") + } + + // delegate back the unbonding delegation amount to the validator + _, err = k.Keeper.Delegate(ctx, delegatorAddress, msg.Amount.Amount, types.Unbonding, validator, false) + if err != nil { + return nil, err + } + + amount := unbondEntry.Balance.Sub(msg.Amount.Amount) + if amount.IsZero() { + ubd.RemoveEntry(unbondEntryIndex) + } else { + // update the unbondingDelegationEntryBalance and InitialBalance for ubd entry + unbondEntry.Balance = amount + unbondEntry.InitialBalance = unbondEntry.InitialBalance.Sub(msg.Amount.Amount) + ubd.Entries[unbondEntryIndex] = unbondEntry + } + + // set the unbonding delegation or remove it if there are no more entries + if len(ubd.Entries) == 0 { + k.RemoveUnbondingDelegation(ctx, ubd) + } else { + k.SetUnbondingDelegation(ctx, ubd) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + "cancel_unbonding_delegation", + sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()), + sdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress), + sdk.NewAttribute(types.AttributeKeyDelegator, msg.DelegatorAddress), + sdk.NewAttribute("creation_height", strconv.FormatInt(msg.CreationHeight, 10)), + ), + ) + + return &types.MsgCancelUnbondingDelegationResponse{}, nil +} + +// UnbondValidator defines a method for performing the status transition for +// a validator from bonded to unbonded +func (k msgServer) UnbondValidator(goCtx context.Context, msg *types.MsgUnbondValidator) (*types.MsgUnbondValidatorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return nil, err + } + // validator must already be registered + validator, found := k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + // jail the validator. + k.jailValidator(ctx, validator) + return &types.MsgUnbondValidatorResponse{}, nil +} + +func (k msgServer) TokenizeShares(goCtx context.Context, msg *types.MsgTokenizeShares) (*types.MsgTokenizeSharesResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + valAddr, valErr := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if valErr != nil { + return nil, valErr + } + validator, found := k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return nil, err + } + + // Check if the delegator has disabled tokenization + lockStatus, unlockTime := k.GetTokenizeSharesLock(ctx, delegatorAddress) + if lockStatus == types.TokenizeShareLockStatus_LOCKED { + return nil, types.ErrTokenizeSharesDisabledForAccount + } + if lockStatus == types.TokenizeShareLockStatus_LOCK_EXPIRING { + return nil, types.ErrTokenizeSharesDisabledForAccount.Wrapf("tokenization will be allowed at %s", unlockTime) + } + + delegation, found := k.GetLiquidDelegation(ctx, delegatorAddress, valAddr) + if !found { + return nil, types.ErrNoDelegatorForAddress + } + + if delegation.ValidatorBond { + return nil, types.ErrValidatorBondNotAllowedForTokenizeShare + } + + if msg.Amount.Denom != k.BondDenom(ctx) { + return nil, types.ErrOnlyBondDenomAllowdForTokenize + } + + delegationAmount := sdk.NewDecFromInt(validator.Tokens).Mul(delegation.GetShares()).Quo(validator.DelegatorShares) + if sdk.NewDecFromInt(msg.Amount.Amount).GT(delegationAmount) { + return nil, types.ErrNotEnoughDelegationShares + } + + acc := k.authKeeper.GetAccount(ctx, delegatorAddress) + if acc != nil { + acc, ok := acc.(vesting.VestingAccount) + if ok { + // if account is a vesting account, it checks if free delegation (non-vesting delegation) is not exceeding + // the tokenize share amount and execute further tokenize share process + // tokenize share is reducing unlocked tokens delegation from the vesting account and further process + // is not causing issues + delFree := acc.GetDelegatedFree().AmountOf(msg.Amount.Denom) + if delFree.LT(msg.Amount.Amount) { + return nil, types.ErrExceedingFreeVestingDelegations + } + } + } + + shares, err := k.ValidateUnbondAmount( + ctx, delegatorAddress, valAddr, msg.Amount.Amount, + ) + if err != nil { + return nil, err + } + + // If this tokenization is NOT from a liquid staking provider, + // confirm it does not exceed the global and validator liquid staking cap + // If the tokenization is from a liquid staking provider, + // the shares are already considered liquid and there's no need to increment the totals + if !k.AccountIsLiquidStakingProvider(ctx, delegatorAddress) { + if err := k.SafelyIncreaseTotalLiquidStakedTokens(ctx, msg.Amount.Amount, true); err != nil { + return nil, err + } + if err := k.SafelyIncreaseValidatorTotalLiquidShares(ctx, validator, shares); err != nil { + return nil, err + } + } + + recordID := k.GetLastTokenizeShareRecordID(ctx) + 1 + k.SetLastTokenizeShareRecordID(ctx, recordID) + + record := types.TokenizeShareRecord{ + Id: recordID, + Owner: msg.TokenizedShareOwner, + ModuleAccount: fmt.Sprintf("%s%d", types.TokenizeShareModuleAccountPrefix, recordID), + Validator: msg.ValidatorAddress, + } + + shareToken := sdk.NewCoin(record.GetShareTokenDenom(), msg.Amount.Amount) + + err = k.bankKeeper.MintCoins(ctx, minttypes.ModuleName, sdk.Coins{shareToken}) + if err != nil { + return nil, err + } + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, delegatorAddress, sdk.Coins{shareToken}) + if err != nil { + return nil, err + } + + returnAmount, err := k.Unbond(ctx, delegatorAddress, valAddr, shares) + if err != nil { + return nil, err + } + + if validator.IsBonded() { + k.bondedTokensToNotBonded(ctx, returnAmount) + } + + // Note: UndelegateCoinsFromModuleToAccount is internally calling TrackUndelegation for vesting account + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.NotBondedPoolName, delegatorAddress, sdk.Coins{msg.Amount}) + if err != nil { + return nil, err + } + + // create reward ownership record + err = k.AddTokenizeShareRecord(ctx, record) + if err != nil { + return nil, err + } + // send coins to module account + err = k.bankKeeper.SendCoins(ctx, delegatorAddress, record.GetModuleAddress(), sdk.Coins{msg.Amount}) + if err != nil { + return nil, err + } + + // Note: it is needed to get latest validator object to get Keeper.Delegate function work properly + validator, found = k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + // delegate from module account + _, err = k.Keeper.Delegate(ctx, record.GetModuleAddress(), msg.Amount.Amount, types.Unbonded, validator, true) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeTokenizeShares, + sdk.NewAttribute(types.AttributeKeyDelegator, msg.DelegatorAddress), + sdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress), + sdk.NewAttribute(types.AttributeKeyShareOwner, msg.TokenizedShareOwner), + sdk.NewAttribute(types.AttributeKeyShareRecordID, fmt.Sprintf("%d", record.Id)), + sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), + ), + ) + + return &types.MsgTokenizeSharesResponse{ + Amount: shareToken, + }, nil +} + +func (k msgServer) RedeemTokens(goCtx context.Context, msg *types.MsgRedeemTokensforShares) (*types.MsgRedeemTokensforSharesResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return nil, err + } + + balance := k.bankKeeper.GetBalance(ctx, delegatorAddress, msg.Amount.Denom) + if balance.Amount.LT(msg.Amount.Amount) { + return nil, types.ErrNotEnoughBalance + } + + record, err := k.GetTokenizeShareRecordByDenom(ctx, msg.Amount.Denom) + if err != nil { + return nil, err + } + + valAddr, valErr := sdk.ValAddressFromBech32(record.Validator) + if valErr != nil { + return nil, valErr + } + + validator, found := k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + // calculate the ratio between shares and redeem amount + // moduleAccountTotalDelegation * redeemAmount / totalIssue + delegation, found := k.GetLiquidDelegation(ctx, record.GetModuleAddress(), valAddr) + if !found { + return nil, types.ErrNoUnbondingDelegation + } + shareDenomSupply := k.bankKeeper.GetSupply(ctx, msg.Amount.Denom) + shares := delegation.Shares.Mul(sdk.NewDecFromInt(msg.Amount.Amount)).QuoInt(shareDenomSupply.Amount) + tokens := validator.TokensFromShares(shares).TruncateInt() + + // If this redemption is NOT from a liquid staking provider, decrement the total liquid staked + // If the redemption was from a liquid staking provider, the shares are still considered + // liquid, even in their non-tokenized form (since they are owned by a liquid staking provider) + if !k.AccountIsLiquidStakingProvider(ctx, delegatorAddress) { + k.DecreaseTotalLiquidStakedTokens(ctx, tokens) + k.DecreaseValidatorTotalLiquidShares(ctx, validator, shares) + } + + returnAmount, err := k.Unbond(ctx, record.GetModuleAddress(), valAddr, shares) + if err != nil { + return nil, err + } + + if validator.IsBonded() { + k.bondedTokensToNotBonded(ctx, returnAmount) + } + + // Note: since delegation object has been changed from unbond call, it gets latest delegation + _, found = k.GetLiquidDelegation(ctx, record.GetModuleAddress(), valAddr) + if !found { + if k.hooks != nil { + return nil, k.hooks.BeforeTokenizeShareRecordRemoved(ctx, record.Id) + } + + err = k.DeleteTokenizeShareRecord(ctx, record.Id) + if err != nil { + return nil, err + } + } + + // send share tokens to NotBondedPool and burn + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, delegatorAddress, types.NotBondedPoolName, sdk.Coins{msg.Amount}) + if err != nil { + return nil, err + } + err = k.bankKeeper.BurnCoins(ctx, types.NotBondedPoolName, sdk.Coins{msg.Amount}) + if err != nil { + return nil, err + } + + // send equivalent amount of tokens to the delegator + returnCoin := sdk.NewCoin(k.BondDenom(ctx), returnAmount) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.NotBondedPoolName, delegatorAddress, sdk.Coins{returnCoin}) + if err != nil { + return nil, err + } + + // Note: it is needed to get latest validator object to get Keeper.Delegate function work properly + validator, found = k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + // convert the share tokens to delegated status + // Note: Delegate(substractAccount => true) -> DelegateCoinsFromAccountToModule -> TrackDelegation for vesting account + _, err = k.Keeper.Delegate(ctx, delegatorAddress, returnAmount, types.Unbonded, validator, true) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeRedeemShares, + sdk.NewAttribute(types.AttributeKeyDelegator, msg.DelegatorAddress), + sdk.NewAttribute(types.AttributeKeyValidator, validator.OperatorAddress), + sdk.NewAttribute(types.AttributeKeyAmount, msg.Amount.String()), + ), + ) + + return &types.MsgRedeemTokensforSharesResponse{ + Amount: returnCoin, + }, nil +} + +func (k msgServer) TransferTokenizeShareRecord(goCtx context.Context, msg *types.MsgTransferTokenizeShareRecord) (*types.MsgTransferTokenizeShareRecordResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + record, err := k.GetTokenizeShareRecord(ctx, msg.TokenizeShareRecordId) + if err != nil { + return nil, types.ErrTokenizeShareRecordNotExists + } + + if record.Owner != msg.Sender { + return nil, types.ErrNotTokenizeShareRecordOwner + } + + // Remove old account reference + oldOwner, err := sdk.AccAddressFromBech32(record.Owner) + if err != nil { + return nil, sdkerrors.ErrInvalidAddress + } + k.deleteTokenizeShareRecordWithOwner(ctx, oldOwner, record.Id) + + record.Owner = msg.NewOwner + k.setTokenizeShareRecord(ctx, record) + + // Set new account reference + newOwner, err := sdk.AccAddressFromBech32(record.Owner) + if err != nil { + return nil, sdkerrors.ErrInvalidAddress + } + k.setTokenizeShareRecordWithOwner(ctx, newOwner, record.Id) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeTransferTokenizeShareRecord, + sdk.NewAttribute(types.AttributeKeyShareRecordID, fmt.Sprintf("%d", msg.TokenizeShareRecordId)), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + sdk.NewAttribute(types.AttributeKeyShareOwner, msg.NewOwner), + ), + ) + + return &types.MsgTransferTokenizeShareRecordResponse{}, nil +} + +// DisableTokenizeShares prevents an address from tokenizing any of their delegations +func (k msgServer) DisableTokenizeShares(goCtx context.Context, msg *types.MsgDisableTokenizeShares) (*types.MsgDisableTokenizeSharesResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delegator := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + + // If tokenized shares is already disabled, alert the user + lockStatus, _ := k.GetTokenizeSharesLock(ctx, delegator) + if lockStatus == types.TokenizeShareLockStatus_LOCKED { + return nil, types.ErrTokenizeSharesAlreadyDisabledForAccount + } + + // Otherwise, create a new tokenization lock for the user + // Note: if there is a lock expiration in progress, this will override the expiration + k.AddTokenizeSharesLock(ctx, delegator) + + return &types.MsgDisableTokenizeSharesResponse{}, nil +} + +// EnableTokenizeShares begins the countdown after which tokenizing shares by the +// sender address is re-allowed, which will complete after the unbonding period +func (k msgServer) EnableTokenizeShares(goCtx context.Context, msg *types.MsgEnableTokenizeShares) (*types.MsgEnableTokenizeSharesResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delegator := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + + // If tokenized shares aren't current disabled, alert the user + lockStatus, unlockTime := k.GetTokenizeSharesLock(ctx, delegator) + if lockStatus == types.TokenizeShareLockStatus_UNLOCKED { + return nil, types.ErrTokenizeSharesAlreadyEnabledForAccount + } + if lockStatus == types.TokenizeShareLockStatus_LOCK_EXPIRING { + return nil, types.ErrTokenizeSharesAlreadyEnabledForAccount.Wrapf( + "tokenize shares re-enablement already in progress, ending at %s", unlockTime) + } + + // Otherwise queue the unlock + completionTime := k.QueueTokenizeSharesAuthorization(ctx, delegator) + + return &types.MsgEnableTokenizeSharesResponse{CompletionTime: completionTime}, nil +} + +func (k msgServer) ValidatorBond(goCtx context.Context, msg *types.MsgValidatorBond) (*types.MsgValidatorBondResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return nil, err + } + + valAddr, valErr := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if valErr != nil { + return nil, valErr + } + + validator, found := k.GetLiquidValidator(ctx, valAddr) + if !found { + return nil, types.ErrNoValidatorFound + } + + delegation, found := k.GetLiquidDelegation(ctx, delAddr, valAddr) + if !found { + return nil, types.ErrNoDelegation + } + + // liquid staking providers should not be able to validator bond + if k.AccountIsLiquidStakingProvider(ctx, delAddr) { + return nil, types.ErrValidatorBondNotAllowedFromModuleAccount + } + + if !delegation.ValidatorBond { + delegation.ValidatorBond = true + k.SetDelegation(ctx, delegation) + validator.TotalValidatorBondShares = validator.TotalValidatorBondShares.Add(delegation.Shares) + k.SetValidator(ctx, validator) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeValidatorBondDelegation, + sdk.NewAttribute(types.AttributeKeyDelegator, msg.DelegatorAddress), + sdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress), + ), + ) + } + + return &types.MsgValidatorBondResponse{}, nil +} diff --git a/x/staking/keeper/params.go b/x/staking/keeper/params.go index 10a8b7e8f03..04e9eaeb266 100644 --- a/x/staking/keeper/params.go +++ b/x/staking/keeper/params.go @@ -43,11 +43,35 @@ func (k Keeper) BondDenom(ctx sdk.Context) (res string) { // Currently, this returns a global variable that the app developer can tweak. // TODO: we might turn this into an on-chain param: // https://github.com/cosmos/cosmos-sdk/issues/8365 -func (k Keeper) PowerReduction(ctx sdk.Context) sdk.Int { +func (k Keeper) PowerReduction(_ sdk.Context) sdk.Int { return sdk.DefaultPowerReduction } -// Get all parameteras as types.Params +// MinCommissionRate - Minimum validator commission rate +func (k Keeper) MinCommissionRate(ctx sdk.Context) (res sdk.Dec) { + k.paramstore.Get(ctx, types.KeyMinCommissionRate, &res) + return +} + +// Validator bond factor for all validators +func (k Keeper) ValidatorBondFactor(ctx sdk.Context) (res sdk.Dec) { + k.paramstore.Get(ctx, types.KeyValidatorBondFactor, &res) + return +} + +// Global liquid staking cap across all liquid staking providers +func (k Keeper) GlobalLiquidStakingCap(ctx sdk.Context) (res sdk.Dec) { + k.paramstore.Get(ctx, types.KeyGlobalLiquidStakingCap, &res) + return +} + +// Liquid staking cap for each validator +func (k Keeper) ValidatorLiquidStakingCap(ctx sdk.Context) (res sdk.Dec) { + k.paramstore.Get(ctx, types.KeyValidatorLiquidStakingCap, &res) + return +} + +// Get all parameters as types.Params func (k Keeper) GetParams(ctx sdk.Context) types.Params { return types.NewParams( k.UnbondingTime(ctx), @@ -55,6 +79,10 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { k.MaxEntries(ctx), k.HistoricalEntries(ctx), k.BondDenom(ctx), + k.MinCommissionRate(ctx), + k.ValidatorBondFactor(ctx), + k.GlobalLiquidStakingCap(ctx), + k.ValidatorLiquidStakingCap(ctx), ) } diff --git a/x/staking/keeper/pool.go b/x/staking/keeper/pool.go index c24c8763235..b281b45784d 100644 --- a/x/staking/keeper/pool.go +++ b/x/staking/keeper/pool.go @@ -71,7 +71,7 @@ func (k Keeper) StakingTokenSupply(ctx sdk.Context) sdk.Int { func (k Keeper) BondedRatio(ctx sdk.Context) sdk.Dec { stakeSupply := k.StakingTokenSupply(ctx) if stakeSupply.IsPositive() { - return k.TotalBondedTokens(ctx).ToDec().QuoInt(stakeSupply) + return sdk.NewDecFromInt(k.TotalBondedTokens(ctx)).QuoInt(stakeSupply) } return sdk.ZeroDec() diff --git a/x/staking/keeper/querier.go b/x/staking/keeper/querier.go index 5c276e145ae..495ce011d93 100644 --- a/x/staking/keeper/querier.go +++ b/x/staking/keeper/querier.go @@ -4,6 +4,8 @@ import ( "errors" "strings" + errorsmod "cosmossdk.io/errors" + abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/client" @@ -60,7 +62,7 @@ func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return queryParameters(ctx, k, legacyQuerierCdc) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown %s query endpoint: %s", types.ModuleName, path[0]) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unknown %s query endpoint: %s", types.ModuleName, path[0]) } } } @@ -70,7 +72,7 @@ func queryValidators(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQue err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } validators := k.GetAllValidators(ctx) @@ -91,7 +93,7 @@ func queryValidators(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQue res, err := codec.MarshalJSONIndent(legacyQuerierCdc, filteredVals) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -102,17 +104,17 @@ func queryValidator(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuer err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - validator, found := k.GetValidator(ctx, params.ValidatorAddr) + validator, found := k.GetLiquidValidator(ctx, params.ValidatorAddr) if !found { return nil, types.ErrNoValidatorFound } res, err := codec.MarshalJSONIndent(legacyQuerierCdc, validator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -123,7 +125,7 @@ func queryValidatorDelegations(ctx sdk.Context, req abci.RequestQuery, k Keeper, err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } delegations := k.GetValidatorDelegations(ctx, params.ValidatorAddr) @@ -146,7 +148,7 @@ func queryValidatorDelegations(ctx sdk.Context, req abci.RequestQuery, k Keeper, res, err := codec.MarshalJSONIndent(legacyQuerierCdc, delegationResps) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -157,7 +159,7 @@ func queryValidatorUnbondingDelegations(ctx sdk.Context, req abci.RequestQuery, err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } unbonds := k.GetUnbondingDelegationsFromValidator(ctx, params.ValidatorAddr) @@ -174,7 +176,7 @@ func queryValidatorUnbondingDelegations(ctx sdk.Context, req abci.RequestQuery, res, err := codec.MarshalJSONIndent(legacyQuerierCdc, unbonds) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -185,10 +187,10 @@ func queryDelegatorDelegations(ctx sdk.Context, req abci.RequestQuery, k Keeper, err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - delegations := k.GetAllDelegatorDelegations(ctx, params.DelegatorAddr) + delegations := k.GetAllLiquidDelegatorDelegations(ctx, params.DelegatorAddr) delegationResps, err := DelegationsToDelegationResponses(ctx, k, delegations) if err != nil { return nil, err @@ -200,7 +202,7 @@ func queryDelegatorDelegations(ctx sdk.Context, req abci.RequestQuery, k Keeper, res, err := codec.MarshalJSONIndent(legacyQuerierCdc, delegationResps) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -211,7 +213,7 @@ func queryDelegatorUnbondingDelegations(ctx sdk.Context, req abci.RequestQuery, err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } unbondingDelegations := k.GetAllUnbondingDelegations(ctx, params.DelegatorAddr) @@ -221,7 +223,7 @@ func queryDelegatorUnbondingDelegations(ctx sdk.Context, req abci.RequestQuery, res, err := codec.MarshalJSONIndent(legacyQuerierCdc, unbondingDelegations) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -234,7 +236,7 @@ func queryDelegatorValidators(ctx sdk.Context, req abci.RequestQuery, k Keeper, err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } validators := k.GetDelegatorValidators(ctx, params.DelegatorAddr, stakingParams.MaxValidators) @@ -244,7 +246,7 @@ func queryDelegatorValidators(ctx sdk.Context, req abci.RequestQuery, k Keeper, res, err := codec.MarshalJSONIndent(legacyQuerierCdc, validators) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -255,7 +257,7 @@ func queryDelegatorValidator(ctx sdk.Context, req abci.RequestQuery, k Keeper, l err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } delAddr, err := sdk.AccAddressFromBech32(params.DelegatorAddr) @@ -275,7 +277,7 @@ func queryDelegatorValidator(ctx sdk.Context, req abci.RequestQuery, k Keeper, l res, err := codec.MarshalJSONIndent(legacyQuerierCdc, validator) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -286,7 +288,7 @@ func queryDelegation(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQue err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } delAddr, err := sdk.AccAddressFromBech32(params.DelegatorAddr) @@ -299,7 +301,7 @@ func queryDelegation(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQue return nil, err } - delegation, found := k.GetDelegation(ctx, delAddr, valAddr) + delegation, found := k.GetLiquidDelegation(ctx, delAddr, valAddr) if !found { return nil, types.ErrNoDelegation } @@ -311,7 +313,7 @@ func queryDelegation(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQue res, err := codec.MarshalJSONIndent(legacyQuerierCdc, delegationResp) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -322,7 +324,7 @@ func queryUnbondingDelegation(ctx sdk.Context, req abci.RequestQuery, k Keeper, err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } delAddr, err := sdk.AccAddressFromBech32(params.DelegatorAddr) @@ -342,7 +344,7 @@ func queryUnbondingDelegation(ctx sdk.Context, req abci.RequestQuery, k Keeper, res, err := codec.MarshalJSONIndent(legacyQuerierCdc, unbond) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -353,7 +355,7 @@ func queryRedelegations(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacy err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } var redels []types.Redelegation @@ -383,7 +385,7 @@ func queryRedelegations(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacy res, err := codec.MarshalJSONIndent(legacyQuerierCdc, redelResponses) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -394,17 +396,17 @@ func queryHistoricalInfo(ctx sdk.Context, req abci.RequestQuery, k Keeper, legac err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - hi, found := k.GetHistoricalInfo(ctx, params.Height) + hi, found := k.GetLiquidStakingHistoricalInfo(ctx, params.Height) if !found { return nil, types.ErrNoHistoricalInfo } res, err := codec.MarshalJSONIndent(legacyQuerierCdc, hi) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -426,7 +428,7 @@ func queryPool(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ( res, err := codec.MarshalJSONIndent(legacyQuerierCdc, pool) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -437,7 +439,7 @@ func queryParameters(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAm res, err := codec.MarshalJSONIndent(legacyQuerierCdc, params) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return res, nil @@ -446,7 +448,7 @@ func queryParameters(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAm // util func DelegationToDelegationResponse(ctx sdk.Context, k Keeper, del types.Delegation) (types.DelegationResponse, error) { - val, found := k.GetValidator(ctx, del.GetValidatorAddr()) + val, found := k.GetLiquidValidator(ctx, del.GetValidatorAddr()) if !found { return types.DelegationResponse{}, types.ErrNoValidatorFound } @@ -460,6 +462,7 @@ func DelegationToDelegationResponse(ctx sdk.Context, k Keeper, del types.Delegat delegatorAddress, del.GetValidatorAddr(), del.Shares, + del.ValidatorBond, sdk.NewCoin(k.BondDenom(ctx), val.TokensFromShares(del.Shares).TruncateInt()), ), nil } @@ -498,7 +501,7 @@ func RedelegationsToRedelegationResponses( delegatorAddress := sdk.MustAccAddressFromBech32(redel.DelegatorAddress) - val, found := k.GetValidator(ctx, valDstAddr) + val, found := k.GetLiquidValidator(ctx, valDstAddr) if !found { return nil, types.ErrNoValidatorFound } @@ -511,7 +514,6 @@ func RedelegationsToRedelegationResponses( entry.SharesDst, entry.InitialBalance, val.TokensFromShares(entry.SharesDst).TruncateInt(), - entry.UnbondingId, ) } diff --git a/x/staking/keeper/querier_test.go b/x/staking/keeper/querier_test.go index 6abe7d53cdd..0c09ff53c66 100644 --- a/x/staking/keeper/querier_test.go +++ b/x/staking/keeper/querier_test.go @@ -17,7 +17,7 @@ import ( ) func TestNewQuerier(t *testing.T) { - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) addrs := simapp.AddTestAddrs(app, ctx, 500, sdk.NewInt(10000)) _, addrAcc2 := addrs[0], addrs[1] @@ -109,7 +109,7 @@ func TestNewQuerier(t *testing.T) { } func TestQueryParametersPool(t *testing.T) { - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino) @@ -135,7 +135,7 @@ func TestQueryParametersPool(t *testing.T) { } func TestQueryValidators(t *testing.T) { - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) params := app.StakingKeeper.GetParams(ctx) legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino) @@ -143,9 +143,9 @@ func TestQueryValidators(t *testing.T) { addrs := simapp.AddTestAddrs(app, ctx, 500, app.StakingKeeper.TokensFromConsensusPower(ctx, 10000)) // Create Validators - amts := []sdk.Int{sdk.NewInt(9), sdk.NewInt(8), sdk.NewInt(7)} - status := []types.BondStatus{types.Bonded, types.Unbonded, types.Unbonding} - var validators [3]types.Validator + amts := []sdk.Int{sdk.NewInt(8), sdk.NewInt(7)} + status := []types.BondStatus{types.Unbonded, types.Unbonding} + var validators [2]types.Validator for i, amt := range amts { validators[i] = teststaking.NewValidator(t, sdk.ValAddress(addrs[i]), PKs[i]) validators[i], _ = validators[i].AddTokensFromDel(amt) @@ -154,7 +154,6 @@ func TestQueryValidators(t *testing.T) { app.StakingKeeper.SetValidator(ctx, validators[0]) app.StakingKeeper.SetValidator(ctx, validators[1]) - app.StakingKeeper.SetValidator(ctx, validators[2]) // Query Validators queriedValidators := app.StakingKeeper.GetValidators(ctx, params.MaxValidators) @@ -203,7 +202,7 @@ func TestQueryValidators(t *testing.T) { } func TestQueryDelegation(t *testing.T) { - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) params := app.StakingKeeper.GetParams(ctx) legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino) @@ -290,7 +289,7 @@ func TestQueryDelegation(t *testing.T) { Data: bz, } - delegation, found := app.StakingKeeper.GetDelegation(ctx, addrAcc2, addrVal1) + delegation, found := app.StakingKeeper.GetLiquidDelegation(ctx, addrAcc2, addrVal1) require.True(t, found) res, err = querier(ctx, []string{types.QueryDelegation}, query) @@ -305,6 +304,9 @@ func TestQueryDelegation(t *testing.T) { require.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, delegation.Shares.TruncateInt()), delegationRes.Balance) // Query Delegator Delegations + bz, errRes = cdc.MarshalJSON(queryParams) + require.NoError(t, errRes) + query = abci.RequestQuery{ Path: "/custom/staking/delegatorDelegations", Data: bz, @@ -349,7 +351,7 @@ func TestQueryDelegation(t *testing.T) { // Query unbonding delegation unbondingTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - _, err = app.StakingKeeper.Undelegate(ctx, addrAcc2, val1.GetOperator(), unbondingTokens.ToDec()) + _, err = app.StakingKeeper.Undelegate(ctx, addrAcc2, val1.GetOperator(), sdk.NewDecFromInt(unbondingTokens)) require.NoError(t, err) queryBondParams = types.QueryDelegatorValidatorRequest{DelegatorAddr: addrAcc2.String(), ValidatorAddr: addrVal1.String()} @@ -403,7 +405,7 @@ func TestQueryDelegation(t *testing.T) { // Query redelegation redelegationTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) _, err = app.StakingKeeper.BeginRedelegation(ctx, addrAcc2, val1.GetOperator(), - val2.GetOperator(), redelegationTokens.ToDec()) + val2.GetOperator(), sdk.NewDecFromInt(redelegationTokens)) require.NoError(t, err) redel, found := app.StakingKeeper.GetRedelegation(ctx, addrAcc2, val1.GetOperator(), val2.GetOperator()) require.True(t, found) @@ -452,7 +454,7 @@ func TestQueryValidatorDelegations_Pagination(t *testing.T) { }, } - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino) @@ -537,7 +539,7 @@ func TestQueryValidatorDelegations_Pagination(t *testing.T) { } func TestQueryRedelegations(t *testing.T) { - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino) @@ -609,7 +611,7 @@ func TestQueryRedelegations(t *testing.T) { } func TestQueryUnbondingDelegation(t *testing.T) { - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino) @@ -705,7 +707,7 @@ func TestQueryUnbondingDelegation(t *testing.T) { } func TestQueryHistoricalInfo(t *testing.T) { - cdc, app, ctx := createTestInput() + cdc, app, ctx := createTestInput(t) legacyQuerierCdc := codec.NewAminoCodec(cdc) querier := keeper.NewQuerier(app.StakingKeeper, legacyQuerierCdc.LegacyAmino) diff --git a/x/staking/keeper/query_utils.go b/x/staking/keeper/query_utils.go index d757522f6dd..fd568af4bdd 100644 --- a/x/staking/keeper/query_utils.go +++ b/x/staking/keeper/query_utils.go @@ -12,7 +12,7 @@ func (k Keeper) GetDelegatorValidators( validators := make([]types.Validator, maxRetrieve) store := ctx.KVStore(k.storeKey) - delegatorPrefixKey := types.GetDelegationsKey(delegatorAddr) + delegatorPrefixKey := types.GetLiquidDelegationsKey(delegatorAddr) iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) // smallest to largest defer iterator.Close() @@ -21,7 +21,7 @@ func (k Keeper) GetDelegatorValidators( for ; iterator.Valid() && i < int(maxRetrieve); iterator.Next() { delegation := types.MustUnmarshalDelegation(k.cdc, iterator.Value()) - validator, found := k.GetValidator(ctx, delegation.GetValidatorAddr()) + validator, found := k.GetLiquidValidator(ctx, delegation.GetValidatorAddr()) if !found { panic(types.ErrNoValidatorFound) } @@ -37,12 +37,12 @@ func (k Keeper) GetDelegatorValidators( func (k Keeper) GetDelegatorValidator( ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, ) (validator types.Validator, err error) { - delegation, found := k.GetDelegation(ctx, delegatorAddr, validatorAddr) + delegation, found := k.GetLiquidDelegation(ctx, delegatorAddr, validatorAddr) if !found { return validator, types.ErrNoDelegation } - validator, found = k.GetValidator(ctx, delegation.GetValidatorAddr()) + validator, found = k.GetLiquidValidator(ctx, delegation.GetValidatorAddr()) if !found { panic(types.ErrNoValidatorFound) } @@ -50,12 +50,33 @@ func (k Keeper) GetDelegatorValidator( return validator, nil } +// return all delegations for a delegator +func (k Keeper) GetAllLiquidDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.Delegation { + delegations := make([]types.Delegation, 0) + + store := ctx.KVStore(k.storeKey) + delegatorPrefixKey := types.GetLiquidDelegationsKey(delegator) + + iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) // smallest to largest + defer iterator.Close() + + i := 0 + + for ; iterator.Valid(); iterator.Next() { + delegation := types.MustUnmarshalDelegation(k.cdc, iterator.Value()) + delegations = append(delegations, delegation) + i++ + } + + return delegations +} + // return all delegations for a delegator func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.Delegation { delegations := make([]types.Delegation, 0) store := ctx.KVStore(k.storeKey) - delegatorPrefixKey := types.GetDelegationsKey(delegator) + delegatorPrefixKey := types.GetLiquidDelegationsKey(delegator) iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) // smallest to largest defer iterator.Close() diff --git a/x/staking/keeper/slash.go b/x/staking/keeper/slash.go index 9d55fefd8d8..e82a4a5fa7a 100644 --- a/x/staking/keeper/slash.go +++ b/x/staking/keeper/slash.go @@ -26,11 +26,8 @@ import ( // // CONTRACT: // -// Infraction was committed at the current height or at a past height, -// not at a height in the future -// --- -// -// Slash implementation doesn't require the infraction (types.Infraction) to work but the IS one does. It is here to have IS satisfy the Slash signature. +// Infraction was committed at the current height or at a past height, +// not at a height in the future func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, slashFactor sdk.Dec, _ types.InfractionType) { logger := k.Logger(ctx) @@ -40,7 +37,7 @@ func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeigh // Amount of slashing = slash slashFactor * power at time of infraction amount := k.TokensFromConsensusPower(ctx, power) - slashAmountDec := amount.ToDec().Mul(slashFactor) + slashAmountDec := sdk.NewDecFromInt(amount).Mul(slashFactor) slashAmount := slashAmountDec.TruncateInt() // ref https://github.com/cosmos/cosmos-sdk/issues/1348 @@ -66,7 +63,10 @@ func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeigh operatorAddress := validator.GetOperator() // call the before-modification hook - k.BeforeValidatorModified(ctx, operatorAddress) + err := k.BeforeValidatorModified(ctx, operatorAddress) + if err != nil { + panic(err) + } // Track remaining slash amount for the validator // This will decrease when we slash unbondings and @@ -118,19 +118,27 @@ func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeigh // we need to calculate the *effective* slash fraction for distribution if validator.Tokens.IsPositive() { - effectiveFraction := tokensToBurn.ToDec().QuoRoundUp(validator.Tokens.ToDec()) + effectiveFraction := sdk.NewDecFromInt(tokensToBurn).QuoRoundUp(sdk.NewDecFromInt(validator.Tokens)) // possible if power has changed if effectiveFraction.GT(sdk.OneDec()) { effectiveFraction = sdk.OneDec() } // call the before-slashed hook - k.BeforeValidatorSlashed(ctx, operatorAddress, effectiveFraction) + err := k.BeforeValidatorSlashed(ctx, operatorAddress, effectiveFraction) + if err != nil { + panic(err) + } } // Deduct from validator's bonded tokens and update the validator. // Burn the slashed tokens from the pool account and decrease the total supply. validator = k.RemoveValidatorTokens(ctx, validator, tokensToBurn) + // Proportionally deduct any liquid tokens from the global total + validatorLiquidRatio := validator.TotalLiquidShares.Quo(validator.DelegatorShares) + slashedLiquidTokens := validatorLiquidRatio.Mul(sdk.NewDecFromInt(slashAmount)).TruncateInt() + k.DecreaseTotalLiquidStakedTokens(ctx, slashedLiquidTokens) + switch validator.GetStatus() { case types.Bonded: if err := k.burnBondedTokens(ctx, tokensToBurn); err != nil { @@ -187,7 +195,7 @@ func (k Keeper) SlashUnbondingDelegation(ctx sdk.Context, unbondingDelegation ty continue } - if entry.IsMature(now) && !entry.OnHold() { + if entry.IsMature(now) { // Unbonding delegation no longer eligible for slashing, skip it continue } @@ -227,7 +235,7 @@ func (k Keeper) SlashUnbondingDelegation(ctx sdk.Context, unbondingDelegation ty // (the amount actually slashed may be less if there's // insufficient stake remaining) // NOTE this is only slashing for prior infractions from the source validator -func (k Keeper) SlashRedelegation(ctx sdk.Context, srcValidator types.Validator, redelegation types.Redelegation, +func (k Keeper) SlashRedelegation(ctx sdk.Context, _ types.Validator, redelegation types.Redelegation, infractionHeight int64, slashFactor sdk.Dec, ) (totalSlashAmount sdk.Int) { now := ctx.BlockHeader().Time @@ -241,7 +249,7 @@ func (k Keeper) SlashRedelegation(ctx sdk.Context, srcValidator types.Validator, continue } - if entry.IsMature(now) && !entry.OnHold() { + if entry.IsMature(now) { // Redelegation no longer eligible for slashing, skip it continue } @@ -264,7 +272,7 @@ func (k Keeper) SlashRedelegation(ctx sdk.Context, srcValidator types.Validator, delegatorAddress := sdk.MustAccAddressFromBech32(redelegation.DelegatorAddress) - delegation, found := k.GetDelegation(ctx, delegatorAddress, valDstAddr) + delegation, found := k.GetLiquidDelegation(ctx, delegatorAddress, valDstAddr) if !found { // If deleted, delegation has zero shares, and we can't unbond any more continue @@ -279,7 +287,7 @@ func (k Keeper) SlashRedelegation(ctx sdk.Context, srcValidator types.Validator, panic(fmt.Errorf("error unbonding delegator: %v", err)) } - dstValidator, found := k.GetValidator(ctx, valDstAddr) + dstValidator, found := k.GetLiquidValidator(ctx, valDstAddr) if !found { panic("destination validator not found") } diff --git a/x/staking/keeper/slash_test.go b/x/staking/keeper/slash_test.go index 66ee7228c76..284b4149595 100644 --- a/x/staking/keeper/slash_test.go +++ b/x/staking/keeper/slash_test.go @@ -1,606 +1,2 @@ package keeper_test -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/cosmos-sdk/x/staking/teststaking" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// bootstrapSlashTest creates 3 validators and bootstrap the app. -func bootstrapSlashTest(t *testing.T, power int64) (*simapp.SimApp, sdk.Context, []sdk.AccAddress, []sdk.ValAddress) { - _, app, ctx := createTestInput() - - addrDels, addrVals := generateAddresses(app, ctx, 100) - - amt := app.StakingKeeper.TokensFromConsensusPower(ctx, power) - totalSupply := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), amt.MulRaw(int64(len(addrDels))))) - - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply)) - - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - numVals := int64(3) - bondedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), amt.MulRaw(numVals))) - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - - // set bonded pool balance - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), bondedCoins)) - - for i := int64(0); i < numVals; i++ { - validator := teststaking.NewValidator(t, addrVals[i], PKs[i]) - validator, _ = validator.AddTokensFromDel(amt) - validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) - } - - return app, ctx, addrDels, addrVals -} - -// tests Jail, Unjail -func TestRevocation(t *testing.T) { - app, ctx, _, addrVals := bootstrapSlashTest(t, 5) - - consAddr := sdk.ConsAddress(PKs[0].Address()) - - // initial state - val, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.False(t, val.IsJailed()) - - // test jail - app.StakingKeeper.Jail(ctx, consAddr) - val, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.True(t, val.IsJailed()) - - // test unjail - app.StakingKeeper.Unjail(ctx, consAddr) - val, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.False(t, val.IsJailed()) -} - -// tests slashUnbondingDelegation -func TestSlashUnbondingDelegation(t *testing.T) { - app, ctx, addrDels, addrVals := bootstrapSlashTest(t, 10) - - fraction := sdk.NewDecWithPrec(5, 1) - - // set an unbonding delegation with expiration timestamp (beyond which the - // unbonding delegation shouldn't be slashed) - ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 0, - time.Unix(5, 0), sdk.NewInt(10), 0) - - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - - // unbonding started prior to the infraction height, stakw didn't contribute - slashAmount := app.StakingKeeper.SlashUnbondingDelegation(ctx, ubd, 1, fraction) - require.True(t, slashAmount.Equal(sdk.NewInt(0))) - - // after the expiration time, no longer eligible for slashing - ctx = ctx.WithBlockHeader(tmproto.Header{Time: time.Unix(10, 0)}) - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - slashAmount = app.StakingKeeper.SlashUnbondingDelegation(ctx, ubd, 0, fraction) - require.True(t, slashAmount.Equal(sdk.NewInt(0))) - - // test valid slash, before expiration timestamp and to which stake contributed - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - oldUnbondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, notBondedPool.GetAddress()) - ctx = ctx.WithBlockHeader(tmproto.Header{Time: time.Unix(0, 0)}) - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - slashAmount = app.StakingKeeper.SlashUnbondingDelegation(ctx, ubd, 0, fraction) - require.True(t, slashAmount.Equal(sdk.NewInt(5))) - ubd, found := app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0]) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // initial balance unchanged - require.Equal(t, sdk.NewInt(10), ubd.Entries[0].InitialBalance) - - // balance decreased - require.Equal(t, sdk.NewInt(5), ubd.Entries[0].Balance) - newUnbondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, notBondedPool.GetAddress()) - diffTokens := oldUnbondedPoolBalances.Sub(newUnbondedPoolBalances) - require.True(t, diffTokens.AmountOf(app.StakingKeeper.BondDenom(ctx)).Equal(sdk.NewInt(5))) -} - -// tests slashRedelegation -func TestSlashRedelegation(t *testing.T) { - app, ctx, addrDels, addrVals := bootstrapSlashTest(t, 10) - fraction := sdk.NewDecWithPrec(5, 1) - - // add bonded tokens to pool for (re)delegations - startCoins := sdk.NewCoins(sdk.NewInt64Coin(app.StakingKeeper.BondDenom(ctx), 15)) - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - balances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), startCoins)) - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - // set a redelegation with an expiration timestamp beyond which the - // redelegation shouldn't be slashed - rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 0, - time.Unix(5, 0), sdk.NewInt(10), sdk.NewDec(10), 0) - - app.StakingKeeper.SetRedelegation(ctx, rd) - - // set the associated delegation - del := types.NewDelegation(addrDels[0], addrVals[1], sdk.NewDec(10)) - app.StakingKeeper.SetDelegation(ctx, del) - - // started redelegating prior to the current height, stake didn't contribute to infraction - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[1]) - require.True(t, found) - slashAmount := app.StakingKeeper.SlashRedelegation(ctx, validator, rd, 1, fraction) - require.True(t, slashAmount.Equal(sdk.NewInt(0))) - - // after the expiration time, no longer eligible for slashing - ctx = ctx.WithBlockHeader(tmproto.Header{Time: time.Unix(10, 0)}) - app.StakingKeeper.SetRedelegation(ctx, rd) - validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[1]) - require.True(t, found) - slashAmount = app.StakingKeeper.SlashRedelegation(ctx, validator, rd, 0, fraction) - require.True(t, slashAmount.Equal(sdk.NewInt(0))) - - balances = app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - - // test valid slash, before expiration timestamp and to which stake contributed - ctx = ctx.WithBlockHeader(tmproto.Header{Time: time.Unix(0, 0)}) - app.StakingKeeper.SetRedelegation(ctx, rd) - validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[1]) - require.True(t, found) - slashAmount = app.StakingKeeper.SlashRedelegation(ctx, validator, rd, 0, fraction) - require.True(t, slashAmount.Equal(sdk.NewInt(5))) - rd, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - require.Len(t, rd.Entries, 1) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - // initialbalance unchanged - require.Equal(t, sdk.NewInt(10), rd.Entries[0].InitialBalance) - - // shares decreased - del, found = app.StakingKeeper.GetDelegation(ctx, addrDels[0], addrVals[1]) - require.True(t, found) - require.Equal(t, int64(5), del.Shares.RoundInt64()) - - // pool bonded tokens should decrease - burnedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), slashAmount)) - require.Equal(t, balances.Sub(burnedCoins), app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress())) -} - -// tests Slash at a future height (must panic) -func TestSlashAtFutureHeight(t *testing.T) { - app, ctx, _, _ := bootstrapSlashTest(t, 10) - - consAddr := sdk.ConsAddress(PKs[0].Address()) - fraction := sdk.NewDecWithPrec(5, 1) - require.Panics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 1, 10, fraction, 0) }) -} - -// test slash at a negative height -// this just represents pre-genesis and should have the same effect as slashing at height 0 -func TestSlashAtNegativeHeight(t *testing.T) { - app, ctx, _, _ := bootstrapSlashTest(t, 10) - consAddr := sdk.ConsAddress(PKs[0].Address()) - fraction := sdk.NewDecWithPrec(5, 1) - - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - oldBondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - - validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - app.StakingKeeper.Slash(ctx, consAddr, -2, 10, fraction, 0) - - // read updated state - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - validator, found = app.StakingKeeper.GetValidator(ctx, validator.GetOperator()) - require.True(t, found) - // power decreased - require.Equal(t, int64(5), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) - - // pool bonded shares decreased - newBondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - diffTokens := oldBondedPoolBalances.Sub(newBondedPoolBalances).AmountOf(app.StakingKeeper.BondDenom(ctx)) - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 5).String(), diffTokens.String()) -} - -// tests Slash at the current height -func TestSlashValidatorAtCurrentHeight(t *testing.T) { - app, ctx, _, _ := bootstrapSlashTest(t, 10) - consAddr := sdk.ConsAddress(PKs[0].Address()) - fraction := sdk.NewDecWithPrec(5, 1) - - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - oldBondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - - validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - app.StakingKeeper.Slash(ctx, consAddr, ctx.BlockHeight(), 10, fraction, 0) - - // read updated state - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - validator, found = app.StakingKeeper.GetValidator(ctx, validator.GetOperator()) - assert.True(t, found) - // power decreased - require.Equal(t, int64(5), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) - - // pool bonded shares decreased - newBondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - diffTokens := oldBondedPoolBalances.Sub(newBondedPoolBalances).AmountOf(app.StakingKeeper.BondDenom(ctx)) - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 5).String(), diffTokens.String()) -} - -// tests Slash at a previous height with an unbonding delegation -func TestSlashWithUnbondingDelegation(t *testing.T) { - app, ctx, addrDels, addrVals := bootstrapSlashTest(t, 10) - - consAddr := sdk.ConsAddress(PKs[0].Address()) - fraction := sdk.NewDecWithPrec(5, 1) - - // set an unbonding delegation with expiration timestamp beyond which the - // unbonding delegation shouldn't be slashed - ubdTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 4) - ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11, time.Unix(0, 0), ubdTokens, 0) - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - - // slash validator for the first time - ctx = ctx.WithBlockHeight(12) - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - oldBondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - - validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - app.StakingKeeper.Slash(ctx, consAddr, 10, 10, fraction, 0) - - // end block - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - - // read updating unbonding delegation - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0]) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // balance decreased - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 2), ubd.Entries[0].Balance) - - // bonded tokens burned - newBondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - diffTokens := oldBondedPoolBalances.Sub(newBondedPoolBalances).AmountOf(app.StakingKeeper.BondDenom(ctx)) - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 3), diffTokens) - - // read updated validator - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - // power decreased by 3 - 6 stake originally bonded at the time of infraction - // was still bonded at the time of discovery and was slashed by half, 4 stake - // bonded at the time of discovery hadn't been bonded at the time of infraction - // and wasn't slashed - require.Equal(t, int64(7), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) - - // slash validator again - ctx = ctx.WithBlockHeight(13) - app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction, 0) - - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0]) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // balance decreased again - require.Equal(t, sdk.NewInt(0), ubd.Entries[0].Balance) - - // bonded tokens burned again - newBondedPoolBalances = app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - diffTokens = oldBondedPoolBalances.Sub(newBondedPoolBalances).AmountOf(app.StakingKeeper.BondDenom(ctx)) - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 6), diffTokens) - - // read updated validator - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - // power decreased by 3 again - require.Equal(t, int64(4), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) - - // slash validator again - // all originally bonded stake has been slashed, so this will have no effect - // on the unbonding delegation, but it will slash stake bonded since the infraction - // this may not be the desirable behaviour, ref https://github.com/cosmos/cosmos-sdk/issues/1440 - ctx = ctx.WithBlockHeight(13) - app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction, 0) - - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0]) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // balance unchanged - require.Equal(t, sdk.NewInt(0), ubd.Entries[0].Balance) - - // bonded tokens burned again - newBondedPoolBalances = app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - diffTokens = oldBondedPoolBalances.Sub(newBondedPoolBalances).AmountOf(app.StakingKeeper.BondDenom(ctx)) - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 9), diffTokens) - - // read updated validator - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - // power decreased by 3 again - require.Equal(t, int64(1), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) - - // slash validator again - // all originally bonded stake has been slashed, so this will have no effect - // on the unbonding delegation, but it will slash stake bonded since the infraction - // this may not be the desirable behaviour, ref https://github.com/cosmos/cosmos-sdk/issues/1440 - ctx = ctx.WithBlockHeight(13) - app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction, 0) - - ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0]) - require.True(t, found) - require.Len(t, ubd.Entries, 1) - - // balance unchanged - require.Equal(t, sdk.NewInt(0), ubd.Entries[0].Balance) - - // just 1 bonded token burned again since that's all the validator now has - newBondedPoolBalances = app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) - diffTokens = oldBondedPoolBalances.Sub(newBondedPoolBalances).AmountOf(app.StakingKeeper.BondDenom(ctx)) - require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 10), diffTokens) - - // apply TM updates - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, -1) - - // read updated validator - // power decreased by 1 again, validator is out of stake - // validator should be in unbonding period - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.Equal(t, validator.GetStatus(), types.Unbonding) -} - -// tests Slash at a previous height with a redelegation -func TestSlashWithRedelegation(t *testing.T) { - app, ctx, addrDels, addrVals := bootstrapSlashTest(t, 10) - consAddr := sdk.ConsAddress(PKs[0].Address()) - fraction := sdk.NewDecWithPrec(5, 1) - bondDenom := app.StakingKeeper.BondDenom(ctx) - - // set a redelegation - rdTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6) - rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, - time.Unix(0, 0), rdTokens, rdTokens.ToDec(), 0) - app.StakingKeeper.SetRedelegation(ctx, rd) - - // set the associated delegation - del := types.NewDelegation(addrDels[0], addrVals[1], rdTokens.ToDec()) - app.StakingKeeper.SetDelegation(ctx, del) - - // update bonded tokens - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - rdCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdTokens.MulRaw(2))) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), rdCoins)) - - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - - oldBonded := app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - oldNotBonded := app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount - - // slash validator - ctx = ctx.WithBlockHeight(12) - validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, fraction, 0) }) - burnAmount := app.StakingKeeper.TokensFromConsensusPower(ctx, 10).ToDec().Mul(fraction).TruncateInt() - - bondedPool = app.StakingKeeper.GetBondedPool(ctx) - notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) - - // burn bonded tokens from only from delegations - bondedPoolBalance := app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldBonded.Sub(burnAmount), bondedPoolBalance)) - - notBondedPoolBalance := app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldNotBonded, notBondedPoolBalance)) - oldBonded = app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - - // read updating redelegation - rd, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - require.Len(t, rd.Entries, 1) - // read updated validator - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - // power decreased by 2 - 4 stake originally bonded at the time of infraction - // was still bonded at the time of discovery and was slashed by half, 4 stake - // bonded at the time of discovery hadn't been bonded at the time of infraction - // and wasn't slashed - require.Equal(t, int64(8), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) - - // slash the validator again - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, sdk.OneDec(), 0) }) - burnAmount = app.StakingKeeper.TokensFromConsensusPower(ctx, 7) - - // read updated pool - bondedPool = app.StakingKeeper.GetBondedPool(ctx) - notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) - - // seven bonded tokens burned - bondedPoolBalance = app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldBonded.Sub(burnAmount), bondedPoolBalance)) - require.True(sdk.IntEq(t, oldNotBonded, notBondedPoolBalance)) - - bondedPoolBalance = app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldBonded.Sub(burnAmount), bondedPoolBalance)) - - notBondedPoolBalance = app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldNotBonded, notBondedPoolBalance)) - oldBonded = app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - - // read updating redelegation - rd, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - require.Len(t, rd.Entries, 1) - // read updated validator - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - // power decreased by 4 - require.Equal(t, int64(4), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) - - // slash the validator again, by 100% - ctx = ctx.WithBlockHeight(12) - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.True(t, found) - - require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, sdk.OneDec(), 0) }) - - burnAmount = app.StakingKeeper.TokensFromConsensusPower(ctx, 10).ToDec().Mul(sdk.OneDec()).TruncateInt() - burnAmount = burnAmount.Sub(sdk.OneDec().MulInt(rdTokens).TruncateInt()) - - // read updated pool - bondedPool = app.StakingKeeper.GetBondedPool(ctx) - notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) - - bondedPoolBalance = app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldBonded.Sub(burnAmount), bondedPoolBalance)) - notBondedPoolBalance = app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldNotBonded, notBondedPoolBalance)) - oldBonded = app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - - // read updating redelegation - rd, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - require.Len(t, rd.Entries, 1) - // apply TM updates - applyValidatorSetUpdates(t, ctx, app.StakingKeeper, -1) - // read updated validator - // validator decreased to zero power, should be in unbonding period - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.Equal(t, validator.GetStatus(), types.Unbonding) - - // slash the validator again, by 100% - // no stake remains to be slashed - ctx = ctx.WithBlockHeight(12) - // validator still in unbonding period - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.Equal(t, validator.GetStatus(), types.Unbonding) - - require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, sdk.OneDec(), 0) }) - - // read updated pool - bondedPool = app.StakingKeeper.GetBondedPool(ctx) - notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) - - bondedPoolBalance = app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldBonded, bondedPoolBalance)) - notBondedPoolBalance = app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldNotBonded, notBondedPoolBalance)) - - // read updating redelegation - rd, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - require.Len(t, rd.Entries, 1) - // read updated validator - // power still zero, still in unbonding period - validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - require.Equal(t, validator.GetStatus(), types.Unbonding) -} - -// tests Slash at a previous height with both an unbonding delegation and a redelegation -func TestSlashBoth(t *testing.T) { - app, ctx, addrDels, addrVals := bootstrapSlashTest(t, 10) - fraction := sdk.NewDecWithPrec(5, 1) - bondDenom := app.StakingKeeper.BondDenom(ctx) - - // set a redelegation with expiration timestamp beyond which the - // redelegation shouldn't be slashed - rdATokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6) - rdA := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, - time.Unix(0, 0), rdATokens, - rdATokens.ToDec(), 0) - app.StakingKeeper.SetRedelegation(ctx, rdA) - - // set the associated delegation - delA := types.NewDelegation(addrDels[0], addrVals[1], rdATokens.ToDec()) - app.StakingKeeper.SetDelegation(ctx, delA) - - // set an unbonding delegation with expiration timestamp (beyond which the - // unbonding delegation shouldn't be slashed) - ubdATokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 4) - ubdA := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11, - time.Unix(0, 0), ubdATokens, 0) - app.StakingKeeper.SetUnbondingDelegation(ctx, ubdA) - - bondedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdATokens.MulRaw(2))) - notBondedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, ubdATokens)) - - // update bonded tokens - bondedPool := app.StakingKeeper.GetBondedPool(ctx) - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), bondedCoins)) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), notBondedCoins)) - - app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - oldBonded := app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - oldNotBonded := app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount - // slash validator - ctx = ctx.WithBlockHeight(12) - validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(PKs[0])) - require.True(t, found) - consAddr0 := sdk.ConsAddress(PKs[0].Address()) - app.StakingKeeper.Slash(ctx, consAddr0, 10, 10, fraction, 0) - - burnedNotBondedAmount := fraction.MulInt(ubdATokens).TruncateInt() - burnedBondAmount := app.StakingKeeper.TokensFromConsensusPower(ctx, 10).ToDec().Mul(fraction).TruncateInt() - burnedBondAmount = burnedBondAmount.Sub(burnedNotBondedAmount) - - // read updated pool - bondedPool = app.StakingKeeper.GetBondedPool(ctx) - notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) - - bondedPoolBalance := app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldBonded.Sub(burnedBondAmount), bondedPoolBalance)) - - notBondedPoolBalance := app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount - require.True(sdk.IntEq(t, oldNotBonded.Sub(burnedNotBondedAmount), notBondedPoolBalance)) - - // read updating redelegation - rdA, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.True(t, found) - require.Len(t, rdA.Entries, 1) - // read updated validator - validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(PKs[0])) - require.True(t, found) - // power not decreased, all stake was bonded since - require.Equal(t, int64(10), validator.GetConsensusPower(app.StakingKeeper.PowerReduction(ctx))) -} diff --git a/x/staking/keeper/tokenize_share_record.go b/x/staking/keeper/tokenize_share_record.go new file mode 100644 index 00000000000..b98d9693f0e --- /dev/null +++ b/x/staking/keeper/tokenize_share_record.go @@ -0,0 +1,151 @@ +package keeper + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + gogotypes "github.com/gogo/protobuf/types" + + "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +func (k Keeper) GetLastTokenizeShareRecordID(ctx sdk.Context) uint64 { + store := ctx.KVStore(k.storeKey) + bytes := store.Get(types.LastTokenizeShareRecordIDKey) + if bytes == nil { + return 0 + } + return sdk.BigEndianToUint64(bytes) +} + +func (k Keeper) SetLastTokenizeShareRecordID(ctx sdk.Context, id uint64) { + store := ctx.KVStore(k.storeKey) + store.Set(types.LastTokenizeShareRecordIDKey, sdk.Uint64ToBigEndian(id)) +} + +func (k Keeper) GetTokenizeShareRecord(ctx sdk.Context, id uint64) (tokenizeShareRecord types.TokenizeShareRecord, err error) { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(types.GetTokenizeShareRecordByIndexKey(id)) + if bz == nil { + return tokenizeShareRecord, errorsmod.Wrap(types.ErrTokenizeShareRecordNotExists, fmt.Sprintf("tokenizeShareRecord %d does not exist", id)) + } + + k.cdc.MustUnmarshal(bz, &tokenizeShareRecord) + return tokenizeShareRecord, nil +} + +func (k Keeper) GetTokenizeShareRecordsByOwner(ctx sdk.Context, owner sdk.AccAddress) (tokenizeShareRecords []types.TokenizeShareRecord) { + store := ctx.KVStore(k.storeKey) + + it := sdk.KVStorePrefixIterator(store, types.GetTokenizeShareRecordIdsByOwnerPrefix(owner)) + defer it.Close() + + for ; it.Valid(); it.Next() { + var id gogotypes.UInt64Value + k.cdc.MustUnmarshal(it.Value(), &id) + + tokenizeShareRecord, err := k.GetTokenizeShareRecord(ctx, id.Value) + if err != nil { + continue + } + tokenizeShareRecords = append(tokenizeShareRecords, tokenizeShareRecord) + } + return +} + +func (k Keeper) GetTokenizeShareRecordByDenom(ctx sdk.Context, denom string) (types.TokenizeShareRecord, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.GetTokenizeShareRecordIDByDenomKey(denom)) + if bz == nil { + return types.TokenizeShareRecord{}, fmt.Errorf("tokenize share record not found from denom: %s", denom) + } + + var id gogotypes.UInt64Value + k.cdc.MustUnmarshal(bz, &id) + + return k.GetTokenizeShareRecord(ctx, id.Value) +} + +func (k Keeper) GetAllTokenizeShareRecords(ctx sdk.Context) (tokenizeShareRecords []types.TokenizeShareRecord) { + store := ctx.KVStore(k.storeKey) + + it := sdk.KVStorePrefixIterator(store, types.TokenizeShareRecordPrefix) + defer it.Close() + + for ; it.Valid(); it.Next() { + var tokenizeShareRecord types.TokenizeShareRecord + k.cdc.MustUnmarshal(it.Value(), &tokenizeShareRecord) + + tokenizeShareRecords = append(tokenizeShareRecords, tokenizeShareRecord) + } + return +} + +func (k Keeper) AddTokenizeShareRecord(ctx sdk.Context, tokenizeShareRecord types.TokenizeShareRecord) error { + if k.hasTokenizeShareRecord(ctx, tokenizeShareRecord.Id) { + return errorsmod.Wrapf(types.ErrTokenizeShareRecordAlreadyExists, "TokenizeShareRecord already exists: %d", tokenizeShareRecord.Id) + } + + k.setTokenizeShareRecord(ctx, tokenizeShareRecord) + + owner, err := sdk.AccAddressFromBech32(tokenizeShareRecord.Owner) + if err != nil { + return err + } + + k.setTokenizeShareRecordWithOwner(ctx, owner, tokenizeShareRecord.Id) + k.setTokenizeShareRecordWithDenom(ctx, tokenizeShareRecord.GetShareTokenDenom(), tokenizeShareRecord.Id) + + return nil +} + +func (k Keeper) DeleteTokenizeShareRecord(ctx sdk.Context, recordID uint64) error { + record, err := k.GetTokenizeShareRecord(ctx, recordID) + if err != nil { + return err + } + owner, err := sdk.AccAddressFromBech32(record.Owner) + if err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + store.Delete(types.GetTokenizeShareRecordByIndexKey(recordID)) + store.Delete(types.GetTokenizeShareRecordIDByOwnerAndIDKey(owner, recordID)) + store.Delete(types.GetTokenizeShareRecordIDByDenomKey(record.GetShareTokenDenom())) + return nil +} + +func (k Keeper) hasTokenizeShareRecord(ctx sdk.Context, id uint64) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(types.GetTokenizeShareRecordByIndexKey(id)) +} + +func (k Keeper) setTokenizeShareRecord(ctx sdk.Context, tokenizeShareRecord types.TokenizeShareRecord) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&tokenizeShareRecord) + + store.Set(types.GetTokenizeShareRecordByIndexKey(tokenizeShareRecord.Id), bz) +} + +func (k Keeper) setTokenizeShareRecordWithOwner(ctx sdk.Context, owner sdk.AccAddress, id uint64) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&gogotypes.UInt64Value{Value: id}) + + store.Set(types.GetTokenizeShareRecordIDByOwnerAndIDKey(owner, id), bz) +} + +func (k Keeper) deleteTokenizeShareRecordWithOwner(ctx sdk.Context, owner sdk.AccAddress, id uint64) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.GetTokenizeShareRecordIDByOwnerAndIDKey(owner, id)) +} + +func (k Keeper) setTokenizeShareRecordWithDenom(ctx sdk.Context, denom string, id uint64) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&gogotypes.UInt64Value{Value: id}) + + store.Set(types.GetTokenizeShareRecordIDByDenomKey(denom), bz) +} diff --git a/x/staking/keeper/unbonding.go b/x/staking/keeper/unbonding.go deleted file mode 100644 index 3df977c3d32..00000000000 --- a/x/staking/keeper/unbonding.go +++ /dev/null @@ -1,434 +0,0 @@ -package keeper - -import ( - "encoding/binary" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// Increments and returns a unique ID for an unbonding operation -func (k Keeper) IncrementUnbondingID(ctx sdk.Context) (unbondingID uint64) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.UnbondingIdKey) - if bz != nil { - unbondingID = binary.BigEndian.Uint64(bz) - } - - unbondingID++ - - // Convert back into bytes for storage - bz = make([]byte, 8) - binary.BigEndian.PutUint64(bz, unbondingID) - - store.Set(types.UnbondingIdKey, bz) - - return unbondingID -} - -// Remove a mapping from UnbondingId to unbonding operation -func (k Keeper) DeleteUnbondingIndex(ctx sdk.Context, id uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetUnbondingIndexKey(id)) -} - -func (k Keeper) GetUnbondingType(ctx sdk.Context, id uint64) (unbondingType types.UnbondingType, found bool) { - store := ctx.KVStore(k.storeKey) - - bz := store.Get(types.GetUnbondingTypeKey(id)) - if bz == nil { - return unbondingType, false - } - - return types.UnbondingType(binary.BigEndian.Uint64(bz)), true -} - -func (k Keeper) SetUnbondingType(ctx sdk.Context, id uint64, unbondingType types.UnbondingType) { - store := ctx.KVStore(k.storeKey) - - // Convert into bytes for storage - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, uint64(unbondingType)) - - store.Set(types.GetUnbondingTypeKey(id), bz) -} - -// return a unbonding delegation that has an unbonding delegation entry with a certain ID -func (k Keeper) GetUnbondingDelegationByUnbondingID( - ctx sdk.Context, id uint64, -) (ubd types.UnbondingDelegation, found bool) { - store := ctx.KVStore(k.storeKey) - - ubdeKey := store.Get(types.GetUnbondingIndexKey(id)) - if ubdeKey == nil { - return types.UnbondingDelegation{}, false - } - - value := store.Get(ubdeKey) - if value == nil { - return types.UnbondingDelegation{}, false - } - - ubd, err := types.UnmarshalUBD(k.cdc, value) - // An error here means that what we got wasn't the right type - if err != nil { - return types.UnbondingDelegation{}, false - } - - return ubd, true -} - -// return a unbonding delegation that has an unbonding delegation entry with a certain ID -func (k Keeper) GetRedelegationByUnbondingID( - ctx sdk.Context, id uint64, -) (red types.Redelegation, found bool) { - store := ctx.KVStore(k.storeKey) - - redKey := store.Get(types.GetUnbondingIndexKey(id)) - if redKey == nil { - return types.Redelegation{}, false - } - - value := store.Get(redKey) - if value == nil { - return types.Redelegation{}, false - } - - red, err := types.UnmarshalRED(k.cdc, value) - // An error here means that what we got wasn't the right type - if err != nil { - return types.Redelegation{}, false - } - - return red, true -} - -// return the validator that is unbonding with a certain unbonding op ID -func (k Keeper) GetValidatorByUnbondingID( - ctx sdk.Context, id uint64, -) (val types.Validator, found bool) { - store := ctx.KVStore(k.storeKey) - - valKey := store.Get(types.GetUnbondingIndexKey(id)) - if valKey == nil { - return types.Validator{}, false - } - - value := store.Get(valKey) - if value == nil { - return types.Validator{}, false - } - - val, err := types.UnmarshalValidator(k.cdc, value) - // An error here means that what we got wasn't the right type - if err != nil { - return types.Validator{}, false - } - - return val, true -} - -// SetUnbondingDelegationByUnbondingID sets an index to look up an UnbondingDelegation by the unbondingID of an UnbondingDelegationEntry that it contains -// Note, it does not set the unbonding delegation itself, use SetUnbondingDelegation(ctx, ubd) for that -func (k Keeper) SetUnbondingDelegationByUnbondingID(ctx sdk.Context, ubd types.UnbondingDelegation, id uint64) { - store := ctx.KVStore(k.storeKey) - delAddr := sdk.MustAccAddressFromBech32(ubd.DelegatorAddress) - valAddr, err := sdk.ValAddressFromBech32(ubd.ValidatorAddress) - if err != nil { - panic(err) - } - - ubdKey := types.GetUBDKey(delAddr, valAddr) - store.Set(types.GetUnbondingIndexKey(id), ubdKey) - - // Set unbonding type so that we know how to deserialize it later - k.SetUnbondingType(ctx, id, types.UnbondingType_UnbondingDelegation) -} - -// SetRedelegationByUnbondingID sets an index to look up an Redelegation by the unbondingID of an RedelegationEntry that it contains -// Note, it does not set the redelegation itself, use SetRedelegation(ctx, red) for that -func (k Keeper) SetRedelegationByUnbondingID(ctx sdk.Context, red types.Redelegation, id uint64) { - store := ctx.KVStore(k.storeKey) - - delAddr := sdk.MustAccAddressFromBech32(red.DelegatorAddress) - - valSrcAddr, err := sdk.ValAddressFromBech32(red.ValidatorSrcAddress) - if err != nil { - panic(err) - } - - valDstAddr, err := sdk.ValAddressFromBech32(red.ValidatorDstAddress) - if err != nil { - panic(err) - } - - redKey := types.GetREDKey(delAddr, valSrcAddr, valDstAddr) - store.Set(types.GetUnbondingIndexKey(id), redKey) - - // Set unbonding type so that we know how to deserialize it later - k.SetUnbondingType(ctx, id, types.UnbondingType_Redelegation) -} - -// SetValidatorByUnbondingID sets an index to look up a Validator by the unbondingID corresponding to its current unbonding -// Note, it does not set the validator itself, use SetValidator(ctx, val) for that -func (k Keeper) SetValidatorByUnbondingID(ctx sdk.Context, val types.Validator, id uint64) { - store := ctx.KVStore(k.storeKey) - - valAddr, err := sdk.ValAddressFromBech32(val.OperatorAddress) - if err != nil { - panic(err) - } - - valKey := types.GetValidatorKey(valAddr) - store.Set(types.GetUnbondingIndexKey(id), valKey) - - // Set unbonding type so that we know how to deserialize it later - k.SetUnbondingType(ctx, id, types.UnbondingType_ValidatorUnbonding) -} - -// unbondingDelegationEntryArrayIndex and redelegationEntryArrayIndex are utilities to find -// at which position in the Entries array the entry with a given id is -func unbondingDelegationEntryArrayIndex(ubd types.UnbondingDelegation, id uint64) (index int, found bool) { - for i, entry := range ubd.Entries { - // we find the entry with the right ID - if entry.UnbondingId == id { - return i, true - } - } - - return 0, false -} - -func redelegationEntryArrayIndex(red types.Redelegation, id uint64) (index int, found bool) { - for i, entry := range red.Entries { - // we find the entry with the right ID - if entry.UnbondingId == id { - return i, true - } - } - - return 0, false -} - -// UnbondingCanComplete allows a stopped unbonding operation, such as an -// unbonding delegation, a redelegation, or a validator unbonding to complete. -// In order for the unbonding operation with `id` to eventually complete, every call -// to PutUnbondingOnHold(id) must be matched by a call to UnbondingCanComplete(id). -func (k Keeper) UnbondingCanComplete(ctx sdk.Context, id uint64) error { - unbondingType, found := k.GetUnbondingType(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - - switch unbondingType { - case types.UnbondingType_UnbondingDelegation: - if err := k.unbondingDelegationEntryCanComplete(ctx, id); err != nil { - return err - } - case types.UnbondingType_Redelegation: - if err := k.redelegationEntryCanComplete(ctx, id); err != nil { - return err - } - case types.UnbondingType_ValidatorUnbonding: - if err := k.validatorUnbondingCanComplete(ctx, id); err != nil { - return err - } - default: - return types.ErrUnbondingNotFound - } - - return nil -} - -func (k Keeper) unbondingDelegationEntryCanComplete(ctx sdk.Context, id uint64) error { - ubd, found := k.GetUnbondingDelegationByUnbondingID(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - - i, found := unbondingDelegationEntryArrayIndex(ubd, id) - if !found { - return types.ErrUnbondingNotFound - } - - // The entry must be on hold - if !ubd.Entries[i].OnHold() { - return sdkerrors.Wrapf( - types.ErrUnbondingOnHoldRefCountNegative, - "undelegation unbondingID(%d), expecting UnbondingOnHoldRefCount > 0, got %T", - id, ubd.Entries[i].UnbondingOnHoldRefCount, - ) - } - ubd.Entries[i].UnbondingOnHoldRefCount-- - - // Check if entry is matured. - if !ubd.Entries[i].OnHold() && ubd.Entries[i].IsMature(ctx.BlockHeader().Time) { - // If matured, complete it. - delegatorAddress, err := sdk.AccAddressFromBech32(ubd.DelegatorAddress) - if err != nil { - return err - } - - bondDenom := k.GetParams(ctx).BondDenom - - // track undelegation only when remaining or truncated shares are non-zero - if !ubd.Entries[i].Balance.IsZero() { - amt := sdk.NewCoin(bondDenom, ubd.Entries[i].Balance) - if err := k.bankKeeper.UndelegateCoinsFromModuleToAccount( - ctx, types.NotBondedPoolName, delegatorAddress, sdk.NewCoins(amt), - ); err != nil { - return err - } - } - - // Remove entry - ubd.RemoveEntry(int64(i)) - // Remove from the UnbondingIndex - k.DeleteUnbondingIndex(ctx, id) - } - - // set the unbonding delegation or remove it if there are no more entries - if len(ubd.Entries) == 0 { - k.RemoveUnbondingDelegation(ctx, ubd) - } else { - k.SetUnbondingDelegation(ctx, ubd) - } - - // Successfully completed unbonding - return nil -} - -func (k Keeper) redelegationEntryCanComplete(ctx sdk.Context, id uint64) error { - red, found := k.GetRedelegationByUnbondingID(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - - i, found := redelegationEntryArrayIndex(red, id) - if !found { - return types.ErrUnbondingNotFound - } - - // The entry must be on hold - if !red.Entries[i].OnHold() { - return sdkerrors.Wrapf( - types.ErrUnbondingOnHoldRefCountNegative, - "redelegation unbondingID(%d), expecting UnbondingOnHoldRefCount > 0, got %T", - id, red.Entries[i].UnbondingOnHoldRefCount, - ) - } - red.Entries[i].UnbondingOnHoldRefCount-- - - if !red.Entries[i].OnHold() && red.Entries[i].IsMature(ctx.BlockHeader().Time) { - // If matured, complete it. - // Remove entry - red.RemoveEntry(int64(i)) - // Remove from the Unbonding index - k.DeleteUnbondingIndex(ctx, id) - } - - // set the redelegation or remove it if there are no more entries - if len(red.Entries) == 0 { - k.RemoveRedelegation(ctx, red) - } else { - k.SetRedelegation(ctx, red) - } - - // Successfully completed unbonding - return nil -} - -func (k Keeper) validatorUnbondingCanComplete(ctx sdk.Context, id uint64) error { - val, found := k.GetValidatorByUnbondingID(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - - if val.UnbondingOnHoldRefCount <= 0 { - return sdkerrors.Wrapf( - types.ErrUnbondingOnHoldRefCountNegative, - "val(%s), expecting UnbondingOnHoldRefCount > 0, got %T", - val.OperatorAddress, val.UnbondingOnHoldRefCount, - ) - } - val.UnbondingOnHoldRefCount-- - k.SetValidator(ctx, val) - - return nil -} - -// PutUnbondingOnHold allows an external module to stop an unbonding operation, -// such as an unbonding delegation, a redelegation, or a validator unbonding. -// In order for the unbonding operation with `id` to eventually complete, every call -// to PutUnbondingOnHold(id) must be matched by a call to UnbondingCanComplete(id). -func (k Keeper) PutUnbondingOnHold(ctx sdk.Context, id uint64) error { - unbondingType, found := k.GetUnbondingType(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - switch unbondingType { - case types.UnbondingType_UnbondingDelegation: - if err := k.putUnbondingDelegationEntryOnHold(ctx, id); err != nil { - return err - } - case types.UnbondingType_Redelegation: - if err := k.putRedelegationEntryOnHold(ctx, id); err != nil { - return err - } - case types.UnbondingType_ValidatorUnbonding: - if err := k.putValidatorOnHold(ctx, id); err != nil { - return err - } - default: - return types.ErrUnbondingNotFound - } - - return nil -} - -func (k Keeper) putUnbondingDelegationEntryOnHold(ctx sdk.Context, id uint64) error { - ubd, found := k.GetUnbondingDelegationByUnbondingID(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - - i, found := unbondingDelegationEntryArrayIndex(ubd, id) - if !found { - return types.ErrUnbondingNotFound - } - - ubd.Entries[i].UnbondingOnHoldRefCount++ - k.SetUnbondingDelegation(ctx, ubd) - - return nil -} - -func (k Keeper) putRedelegationEntryOnHold(ctx sdk.Context, id uint64) error { - red, found := k.GetRedelegationByUnbondingID(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - - i, found := redelegationEntryArrayIndex(red, id) - if !found { - return types.ErrUnbondingNotFound - } - - red.Entries[i].UnbondingOnHoldRefCount++ - k.SetRedelegation(ctx, red) - - return nil -} - -func (k Keeper) putValidatorOnHold(ctx sdk.Context, id uint64) error { - val, found := k.GetValidatorByUnbondingID(ctx, id) - if !found { - return types.ErrUnbondingNotFound - } - - val.UnbondingOnHoldRefCount++ - k.SetValidator(ctx, val) - - return nil -} diff --git a/x/staking/keeper/unbonding_test.go b/x/staking/keeper/unbonding_test.go index 9eff9ec9b53..949def9c993 100644 --- a/x/staking/keeper/unbonding_test.go +++ b/x/staking/keeper/unbonding_test.go @@ -1,386 +1 @@ -package keeper_test - -import ( - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/cosmos-sdk/x/staking/teststaking" - "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" -) - -type MockStakingHooks struct { - types.StakingHooksTemplate - afterUnbondingInitiated func(uint64) error -} - -func (h MockStakingHooks) AfterUnbondingInitiated(_ sdk.Context, id uint64) error { - return h.afterUnbondingInitiated(id) -} - -func setup(t *testing.T, hookCalled *bool, ubdeID *uint64) ( - app *simapp.SimApp, ctx sdk.Context, bondDenom string, addrDels []sdk.AccAddress, addrVals []sdk.ValAddress, -) { - _, app, ctx = createTestInput() - - stakingKeeper := keeper.NewKeeper( - app.AppCodec(), - app.GetKey(types.StoreKey), - app.AccountKeeper, - app.BankKeeper, - app.GetSubspace(types.ModuleName), - ) - - myHooks := MockStakingHooks{ - afterUnbondingInitiated: func(id uint64) error { - *hookCalled = true - // save id - *ubdeID = id - // call back to stop unbonding - err := app.StakingKeeper.PutUnbondingOnHold(ctx, id) - require.NoError(t, err) - return nil - }, - } - - stakingKeeper.SetHooks( - types.NewMultiStakingHooks(myHooks), - ) - - app.StakingKeeper = stakingKeeper - - addrDels = simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(10000)) - addrVals = simapp.ConvertAddrsToValAddrs(addrDels) - - valTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - startTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 20) - - bondDenom = app.StakingKeeper.BondDenom(ctx) - notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(bondDenom, startTokens)))) - app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - - // Create a validator - validator1 := teststaking.NewValidator(t, addrVals[0], PKs[0]) - validator1, issuedShares1 := validator1.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares1.RoundInt()) - - validator1 = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator1, true) - require.True(sdk.IntEq(t, valTokens, validator1.BondedTokens())) - require.True(t, validator1.IsBonded()) - - // Create a delegator - delegation := types.NewDelegation(addrDels[0], addrVals[0], issuedShares1) - app.StakingKeeper.SetDelegation(ctx, delegation) - - // Create a validator to redelegate to - validator2 := teststaking.NewValidator(t, addrVals[1], PKs[1]) - validator2, issuedShares2 := validator2.AddTokensFromDel(valTokens) - require.Equal(t, valTokens, issuedShares2.RoundInt()) - - validator2 = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator2, true) - require.Equal(t, types.Bonded, validator2.Status) - require.True(t, validator2.IsBonded()) - - return -} - -func doUnbondingDelegation( - t *testing.T, app *simapp.SimApp, ctx sdk.Context, bondDenom string, addrDels []sdk.AccAddress, addrVals []sdk.ValAddress, hookCalled *bool, -) (completionTime time.Time, bondedAmt sdk.Int, notBondedAmt sdk.Int) { - // UNDELEGATE - // Save original bonded and unbonded amounts - bondedAmt1 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - notBondedAmt1 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - var err error - completionTime, err = app.StakingKeeper.Undelegate(ctx, addrDels[0], addrVals[0], sdk.NewDec(1)) - require.NoError(t, err) - - // check that the unbonding actually happened - bondedAmt2 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - notBondedAmt2 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - // Bonded amount is less - require.True(sdk.IntEq(t, bondedAmt1.SubRaw(1), bondedAmt2)) - // Unbonded amount is more - require.True(sdk.IntEq(t, notBondedAmt1.AddRaw(1), notBondedAmt2)) - - // Check that the unbonding happened- we look up the entry and see that it has the correct number of shares - unbondingDelegations := app.StakingKeeper.GetUnbondingDelegationsFromValidator(ctx, addrVals[0]) - require.Equal(t, sdk.NewInt(1), unbondingDelegations[0].Entries[0].Balance) - - // check that our hook was called - require.True(t, *hookCalled) - - return completionTime, bondedAmt2, notBondedAmt2 -} - -func doRedelegation( - t *testing.T, app *simapp.SimApp, ctx sdk.Context, addrDels []sdk.AccAddress, addrVals []sdk.ValAddress, hookCalled *bool, -) (completionTime time.Time) { - var err error - completionTime, err = app.StakingKeeper.BeginRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1], sdk.NewDec(1)) - require.NoError(t, err) - - // Check that the redelegation happened- we look up the entry and see that it has the correct number of shares - redelegations := app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 1, len(redelegations)) - require.Equal(t, sdk.NewDec(1), redelegations[0].Entries[0].SharesDst) - - // check that our hook was called - require.True(t, *hookCalled) - - return completionTime -} - -func doValidatorUnbonding( - t *testing.T, app *simapp.SimApp, ctx sdk.Context, addrVal sdk.ValAddress, hookCalled *bool, -) (validator types.Validator) { - validator, found := app.StakingKeeper.GetValidator(ctx, addrVal) - require.True(t, found) - // Check that status is bonded - require.Equal(t, types.BondStatus(3), validator.Status) - - validator, err := app.StakingKeeper.BeginUnbondingValidator(ctx, validator) - require.NoError(t, err) - - // Check that status is unbonding - require.Equal(t, types.BondStatus(2), validator.Status) - - // check that our hook was called - require.True(t, *hookCalled) - - return validator -} - -func TestValidatorUnbondingOnHold1(t *testing.T) { - var hookCalled bool - var ubdeID uint64 - - app, ctx, _, _, addrVals := setup(t, &hookCalled, &ubdeID) - - // Start unbonding first validator - validator := doValidatorUnbonding(t, app, ctx, addrVals[0], &hookCalled) - - completionTime := validator.UnbondingTime - completionHeight := validator.UnbondingHeight - - // CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE - err := app.StakingKeeper.UnbondingCanComplete(ctx, ubdeID) - require.NoError(t, err) - - // Try to unbond validator - app.StakingKeeper.UnbondAllMatureValidators(ctx) - - // Check that validator unbonding is not complete (is not mature yet) - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, types.Unbonding, validator.Status) - unbondingVals := app.StakingKeeper.GetUnbondingValidators(ctx, completionTime, completionHeight) - require.Equal(t, 1, len(unbondingVals)) - require.Equal(t, validator.OperatorAddress, unbondingVals[0]) - - // PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE - ctx = ctx.WithBlockTime(completionTime.Add(time.Duration(1))) - ctx = ctx.WithBlockHeight(completionHeight + 1) - app.StakingKeeper.UnbondAllMatureValidators(ctx) - - // Check that validator unbonding is complete - validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, types.Unbonded, validator.Status) - unbondingVals = app.StakingKeeper.GetUnbondingValidators(ctx, completionTime, completionHeight) - require.Equal(t, 0, len(unbondingVals)) -} - -func TestValidatorUnbondingOnHold2(t *testing.T) { - var hookCalled bool - var ubdeID uint64 - var ubdeIDs []uint64 - app, ctx, _, _, addrVals := setup(t, &hookCalled, &ubdeID) - - // Start unbonding first validator - validator1 := doValidatorUnbonding(t, app, ctx, addrVals[0], &hookCalled) - ubdeIDs = append(ubdeIDs, ubdeID) - - // Reset hookCalled flag - hookCalled = false - - // Start unbonding second validator - validator2 := doValidatorUnbonding(t, app, ctx, addrVals[1], &hookCalled) - ubdeIDs = append(ubdeIDs, ubdeID) - - // Check that there are two unbonding operations - require.Equal(t, 2, len(ubdeIDs)) - - // Check that both validators have same unbonding time - require.Equal(t, validator1.UnbondingTime, validator2.UnbondingTime) - - completionTime := validator1.UnbondingTime - completionHeight := validator1.UnbondingHeight - - // PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE - ctx = ctx.WithBlockTime(completionTime.Add(time.Duration(1))) - ctx = ctx.WithBlockHeight(completionHeight + 1) - app.StakingKeeper.UnbondAllMatureValidators(ctx) - - // Check that unbonding is not complete for both validators - validator1, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, types.Unbonding, validator1.Status) - validator2, found = app.StakingKeeper.GetValidator(ctx, addrVals[1]) - require.True(t, found) - require.Equal(t, types.Unbonding, validator2.Status) - unbondingVals := app.StakingKeeper.GetUnbondingValidators(ctx, completionTime, completionHeight) - require.Equal(t, 2, len(unbondingVals)) - require.Equal(t, validator1.OperatorAddress, unbondingVals[0]) - require.Equal(t, validator2.OperatorAddress, unbondingVals[1]) - - // CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE - err := app.StakingKeeper.UnbondingCanComplete(ctx, ubdeIDs[0]) - require.NoError(t, err) - - // Try again to unbond validators - app.StakingKeeper.UnbondAllMatureValidators(ctx) - - // Check that unbonding is complete for validator1, but not for validator2 - validator1, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) - require.True(t, found) - require.Equal(t, types.Unbonded, validator1.Status) - validator2, found = app.StakingKeeper.GetValidator(ctx, addrVals[1]) - require.True(t, found) - require.Equal(t, types.Unbonding, validator2.Status) - unbondingVals = app.StakingKeeper.GetUnbondingValidators(ctx, completionTime, completionHeight) - require.Equal(t, 1, len(unbondingVals)) - require.Equal(t, validator2.OperatorAddress, unbondingVals[0]) - - // Unbonding for validator2 can complete - err = app.StakingKeeper.UnbondingCanComplete(ctx, ubdeIDs[1]) - require.NoError(t, err) - - // Try again to unbond validators - app.StakingKeeper.UnbondAllMatureValidators(ctx) - - // Check that unbonding is complete for validator2 - validator2, found = app.StakingKeeper.GetValidator(ctx, addrVals[1]) - require.True(t, found) - require.Equal(t, types.Unbonded, validator2.Status) - unbondingVals = app.StakingKeeper.GetUnbondingValidators(ctx, completionTime, completionHeight) - require.Equal(t, 0, len(unbondingVals)) -} - -func TestRedelegationOnHold1(t *testing.T) { - var hookCalled bool - var ubdeID uint64 - app, ctx, _, addrDels, addrVals := setup(t, &hookCalled, &ubdeID) - completionTime := doRedelegation(t, app, ctx, addrDels, addrVals, &hookCalled) - - // CONSUMER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE - err := app.StakingKeeper.UnbondingCanComplete(ctx, ubdeID) - require.NoError(t, err) - - // Redelegation is not complete - still exists - redelegations := app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 1, len(redelegations)) - - // PROVIDER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE - ctx = ctx.WithBlockTime(completionTime) - _, err = app.StakingKeeper.CompleteRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.NoError(t, err) - - // Redelegation is complete and record is gone - redelegations = app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 0, len(redelegations)) -} - -func TestRedelegationOnHold2(t *testing.T) { - var hookCalled bool - var ubdeID uint64 - app, ctx, _, addrDels, addrVals := setup(t, &hookCalled, &ubdeID) - completionTime := doRedelegation(t, app, ctx, addrDels, addrVals, &hookCalled) - - // PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE - ctx = ctx.WithBlockTime(completionTime) - _, err := app.StakingKeeper.CompleteRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) - require.NoError(t, err) - - // Redelegation is not complete - still exists - redelegations := app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 1, len(redelegations)) - - // CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE - err = app.StakingKeeper.UnbondingCanComplete(ctx, ubdeID) - require.NoError(t, err) - - // Redelegation is complete and record is gone - redelegations = app.StakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0]) - require.Equal(t, 0, len(redelegations)) -} - -func TestUnbondingDelegationOnHold1(t *testing.T) { - var hookCalled bool - var ubdeID uint64 - app, ctx, bondDenom, addrDels, addrVals := setup(t, &hookCalled, &ubdeID) - completionTime, bondedAmt1, notBondedAmt1 := doUnbondingDelegation(t, app, ctx, bondDenom, addrDels, addrVals, &hookCalled) - - // CONSUMER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE - err := app.StakingKeeper.UnbondingCanComplete(ctx, ubdeID) - require.NoError(t, err) - - bondedAmt3 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - notBondedAmt3 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - // Bonded and unbonded amounts are the same as before because the completionTime has not yet passed and so the - // unbondingDelegation has not completed - require.True(sdk.IntEq(t, bondedAmt1, bondedAmt3)) - require.True(sdk.IntEq(t, notBondedAmt1, notBondedAmt3)) - - // PROVIDER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE - ctx = ctx.WithBlockTime(completionTime) - _, err = app.StakingKeeper.CompleteUnbonding(ctx, addrDels[0], addrVals[0]) - require.NoError(t, err) - - // Check that the unbonding was finally completed - bondedAmt5 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - notBondedAmt5 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - require.True(sdk.IntEq(t, bondedAmt1, bondedAmt5)) - // Not bonded amount back to what it was originaly - require.True(sdk.IntEq(t, notBondedAmt1.SubRaw(1), notBondedAmt5)) -} - -func TestUnbondingDelegationOnHold2(t *testing.T) { - var hookCalled bool - var ubdeID uint64 - app, ctx, bondDenom, addrDels, addrVals := setup(t, &hookCalled, &ubdeID) - completionTime, bondedAmt1, notBondedAmt1 := doUnbondingDelegation(t, app, ctx, bondDenom, addrDels, addrVals, &hookCalled) - - // PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE - ctx = ctx.WithBlockTime(completionTime) - _, err := app.StakingKeeper.CompleteUnbonding(ctx, addrDels[0], addrVals[0]) - require.NoError(t, err) - - bondedAmt3 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - notBondedAmt3 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - // Bonded and unbonded amounts are the same as before because the completionTime has not yet passed and so the - // unbondingDelegation has not completed - require.True(sdk.IntEq(t, bondedAmt1, bondedAmt3)) - require.True(sdk.IntEq(t, notBondedAmt1, notBondedAmt3)) - - // CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE - err = app.StakingKeeper.UnbondingCanComplete(ctx, ubdeID) - require.NoError(t, err) - - // Check that the unbonding was finally completed - bondedAmt5 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount - notBondedAmt5 := app.BankKeeper.GetBalance(ctx, app.StakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount - - require.True(sdk.IntEq(t, bondedAmt1, bondedAmt5)) - // Not bonded amount back to what it was originaly - require.True(sdk.IntEq(t, notBondedAmt1.SubRaw(1), notBondedAmt5)) -} +package keeper_test \ No newline at end of file diff --git a/x/staking/keeper/unbonding_type_accessors_test.go b/x/staking/keeper/unbonding_type_accessors_test.go deleted file mode 100644 index 6c2d53d2522..00000000000 --- a/x/staking/keeper/unbonding_type_accessors_test.go +++ /dev/null @@ -1,342 +0,0 @@ -package keeper_test - -import ( - "time" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func (s *KeeperTestSuite) TestIncrementUnbondingID() { - for i := 1; i < 10; i++ { - s.Require().Equal(uint64(i), s.app.StakingKeeper.IncrementUnbondingID(s.ctx)) - } -} - -func (s *KeeperTestSuite) TestUnbondingTypeAccessors() { - cases := []struct { - exists bool - name string - expected types.UnbondingType - }{ - { - name: "existing 1", - exists: true, - expected: types.UnbondingType_UnbondingDelegation, - }, - { - name: "existing 2", - exists: true, - expected: types.UnbondingType_Redelegation, - }, - { - name: "not existing", - exists: false, - }, - } - - for i, tc := range cases { - s.Run(tc.name, func() { - if tc.exists { - s.app.StakingKeeper.SetUnbondingType(s.ctx, uint64(i), tc.expected) - } - - unbondingType, found := s.app.StakingKeeper.GetUnbondingType(s.ctx, uint64(i)) - if tc.exists { - s.Require().True(found) - s.Require().Equal(tc.expected, unbondingType) - } else { - s.Require().False(found) - } - }) - } -} - -func (s *KeeperTestSuite) TestUnbondingDelegationByUnbondingIDAccessors() { - delAddrs := simapp.AddTestAddrsIncremental(s.app, s.ctx, 2, sdk.NewInt(10000)) - valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs) - - type exists struct { - setUnbondingDelegation bool - setUnbondingDelegationByUnbondingID bool - } - - cases := []struct { - exists exists - name string - expected types.UnbondingDelegation - }{ - { - name: "existing 1", - exists: exists{true, true}, - expected: types.NewUnbondingDelegation( - delAddrs[0], - valAddrs[0], - 0, - time.Unix(0, 0).UTC(), - sdk.NewInt(5), - 0, - ), - }, - { - name: "not existing 1", - exists: exists{false, true}, - expected: types.NewUnbondingDelegation( - delAddrs[1], - valAddrs[1], - 0, - time.Unix(0, 0).UTC(), - sdk.NewInt(5), - 0, - ), - }, - { - name: "not existing 2", - exists: exists{false, false}, - expected: types.NewUnbondingDelegation( - delAddrs[0], - valAddrs[0], - 0, - time.Unix(0, 0).UTC(), - sdk.NewInt(5), - 0, - ), - }, - } - - for i, tc := range cases { - s.Run(tc.name, func() { - if tc.exists.setUnbondingDelegation { - s.app.StakingKeeper.SetUnbondingDelegation(s.ctx, tc.expected) - } - - if tc.exists.setUnbondingDelegationByUnbondingID { - s.app.StakingKeeper.SetUnbondingDelegationByUnbondingID(s.ctx, tc.expected, uint64(i)) - } - - ubd, found := s.app.StakingKeeper.GetUnbondingDelegationByUnbondingID(s.ctx, uint64(i)) - if tc.exists.setUnbondingDelegation && tc.exists.setUnbondingDelegationByUnbondingID { - s.Require().True(found) - s.Require().Equal(tc.expected, ubd) - } else { - s.Require().False(found) - } - }) - } -} - -func (s *KeeperTestSuite) TestRedelegationByUnbondingIDAccessors() { - delAddrs := simapp.AddTestAddrsIncremental(s.app, s.ctx, 2, sdk.NewInt(10000)) - valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs) - - type exists struct { - setRedelegation bool - setRedelegationByUnbondingID bool - } - - cases := []struct { - exists exists - name string - expected types.Redelegation - }{ - { - name: "existing 1", - exists: exists{true, true}, - expected: types.NewRedelegation( - delAddrs[0], - valAddrs[0], - valAddrs[1], - 0, - time.Unix(5, 0).UTC(), - sdk.NewInt(10), - sdk.NewDec(10), - 0, - ), - }, - { - name: "not existing 1", - exists: exists{false, true}, - expected: types.NewRedelegation( - delAddrs[1], - valAddrs[0], - valAddrs[1], - 0, - time.Unix(5, 0).UTC(), - sdk.NewInt(10), - sdk.NewDec(10), - 0, - ), - }, - { - name: "not existing 2", - exists: exists{false, false}, - expected: types.NewRedelegation( - delAddrs[1], - valAddrs[1], - valAddrs[0], - 0, - time.Unix(5, 0).UTC(), - sdk.NewInt(10), - sdk.NewDec(10), - 0, - ), - }, - } - - for i, tc := range cases { - s.Run(tc.name, func() { - if tc.exists.setRedelegation { - s.app.StakingKeeper.SetRedelegation(s.ctx, tc.expected) - } - - if tc.exists.setRedelegationByUnbondingID { - s.app.StakingKeeper.SetRedelegationByUnbondingID(s.ctx, tc.expected, uint64(i)) - } - - red, found := s.app.StakingKeeper.GetRedelegationByUnbondingID(s.ctx, uint64(i)) - if tc.exists.setRedelegation && tc.exists.setRedelegationByUnbondingID { - s.Require().True(found) - s.Require().Equal(tc.expected, red) - } else { - s.Require().False(found) - } - }) - } -} - -func (s *KeeperTestSuite) TestValidatorByUnbondingIDAccessors() { - delAddrs := simapp.AddTestAddrsIncremental(s.app, s.ctx, 3, sdk.NewInt(10000)) - valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs) - - type exists struct { - setValidator bool - setValidatorByUnbondingID bool - } - - newVal := func(valAddr sdk.ValAddress, pk cryptotypes.PubKey) types.Validator { - val, err := types.NewValidator(valAddr, pk, types.Description{}) - s.Require().NoError(err) - return val - } - - cases := []struct { - exists exists - name string - validator types.Validator - }{ - { - name: "existing 1", - exists: exists{true, true}, - validator: newVal(valAddrs[0], PKs[0]), - }, - { - name: "not existing 1", - exists: exists{false, true}, - validator: newVal(valAddrs[2], PKs[0]), - }, - { - name: "not existing 2", - exists: exists{false, false}, - validator: newVal(valAddrs[2], PKs[0]), - }, - } - - for i, tc := range cases { - s.Run(tc.name, func() { - if tc.exists.setValidator { - s.app.StakingKeeper.SetValidator(s.ctx, tc.validator) - } - - if tc.exists.setValidatorByUnbondingID { - s.app.StakingKeeper.SetValidatorByUnbondingID(s.ctx, tc.validator, uint64(i)) - } - - val, found := s.app.StakingKeeper.GetValidatorByUnbondingID(s.ctx, uint64(i)) - if tc.exists.setValidator && tc.exists.setValidatorByUnbondingID { - s.Require().True(found) - s.Require().Equal(tc.validator, val) - } else { - s.Require().False(found) - } - }) - } -} - -func (s *KeeperTestSuite) TestUnbondingCanComplete() { - delAddrs := simapp.AddTestAddrsIncremental(s.app, s.ctx, 3, sdk.NewInt(10000)) - valAddrs := simapp.ConvertAddrsToValAddrs(delAddrs) - unbondingID := uint64(1) - - // no unbondingID set - err := s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().ErrorIs(err, types.ErrUnbondingNotFound) - - // unbonding delegation - s.app.StakingKeeper.SetUnbondingType(s.ctx, unbondingID, types.UnbondingType_UnbondingDelegation) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().ErrorIs(err, types.ErrUnbondingNotFound) - - ubd := types.NewUnbondingDelegation( - delAddrs[0], - valAddrs[0], - 0, - time.Unix(0, 0).UTC(), - sdk.NewInt(5), - unbondingID, - ) - s.app.StakingKeeper.SetUnbondingDelegation(s.ctx, ubd) - s.app.StakingKeeper.SetUnbondingDelegationByUnbondingID(s.ctx, ubd, unbondingID) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().ErrorIs(err, types.ErrUnbondingOnHoldRefCountNegative) - - err = s.app.StakingKeeper.PutUnbondingOnHold(s.ctx, unbondingID) - s.Require().NoError(err) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().NoError(err) - - // redelegation - unbondingID++ - s.app.StakingKeeper.SetUnbondingType(s.ctx, unbondingID, types.UnbondingType_Redelegation) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().ErrorIs(err, types.ErrUnbondingNotFound) - - red := types.NewRedelegation( - delAddrs[0], - valAddrs[0], - valAddrs[1], - 0, - time.Unix(5, 0).UTC(), - sdk.NewInt(10), - sdk.NewDec(10), - unbondingID, - ) - s.app.StakingKeeper.SetRedelegation(s.ctx, red) - s.app.StakingKeeper.SetRedelegationByUnbondingID(s.ctx, red, unbondingID) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().ErrorIs(err, types.ErrUnbondingOnHoldRefCountNegative) - - err = s.app.StakingKeeper.PutUnbondingOnHold(s.ctx, unbondingID) - s.Require().NoError(err) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().NoError(err) - - // validator unbonding - unbondingID++ - s.app.StakingKeeper.SetUnbondingType(s.ctx, unbondingID, types.UnbondingType_ValidatorUnbonding) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().ErrorIs(err, types.ErrUnbondingNotFound) - - val, err := types.NewValidator(valAddrs[0], PKs[0], types.Description{}) - s.Require().NoError(err) - s.app.StakingKeeper.SetValidator(s.ctx, val) - s.app.StakingKeeper.SetValidatorByUnbondingID(s.ctx, val, unbondingID) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().ErrorIs(err, types.ErrUnbondingOnHoldRefCountNegative) - - err = s.app.StakingKeeper.PutUnbondingOnHold(s.ctx, unbondingID) - s.Require().NoError(err) - err = s.app.StakingKeeper.UnbondingCanComplete(s.ctx, unbondingID) - s.Require().NoError(err) -} diff --git a/x/staking/keeper/val_state_change.go b/x/staking/keeper/val_state_change.go index 363ae1b5a09..eb5b75c643a 100644 --- a/x/staking/keeper/val_state_change.go +++ b/x/staking/keeper/val_state_change.go @@ -9,6 +9,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkstaking "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -128,7 +129,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab // everything that is iterated in this loop is becoming or already a // part of the bonded validator set valAddr := sdk.ValAddress(iterator.Value()) - validator := k.mustGetValidator(ctx, valAddr) + validator := k.mustGetLiquidValidator(ctx, valAddr) if validator.Jailed { panic("should never retrieve a jailed validator from the power store") @@ -165,7 +166,6 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab if err != nil { return nil, err } - oldPowerBytes, found := last[valAddrStr] newPower := validator.ConsensusPower(powerReduction) newPowerBytes := k.cdc.MustMarshal(&gogotypes.Int64Value{Value: newPower}) @@ -173,7 +173,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab // update the validator set if power has changed if !found || !bytes.Equal(oldPowerBytes, newPowerBytes) { updates = append(updates, validator.ABCIValidatorUpdate(powerReduction)) - // set the validator update and power + k.SetLastValidatorPower(ctx, valAddr, newPower) } @@ -189,16 +189,14 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab } for _, valAddrBytes := range noLongerBonded { - validator := k.mustGetValidator(ctx, sdk.ValAddress(valAddrBytes)) + validator := k.mustGetLiquidValidator(ctx, sdk.ValAddress(valAddrBytes)) validator, err = k.bondedToUnbonding(ctx, validator) if err != nil { return nil, err } - amtFromBondedToNotBonded = amtFromBondedToNotBonded.Add(validator.GetTokens()) k.DeleteLastValidatorPower(ctx, validator.GetOperator()) - update := validator.ABCIValidatorUpdateZero() - updates = append(updates, update) + updates = append(updates, validator.ABCIValidatorUpdateZero()) } // Update the pools based on the recent updates in the validator set: @@ -221,10 +219,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab k.SetLastTotalPower(ctx, totalPower) } - // set the list of validator updates - k.SetValidatorUpdates(ctx, updates) - - return updates, nil + return updates, err } // Validator state transitions @@ -234,7 +229,7 @@ func (k Keeper) bondedToUnbonding(ctx sdk.Context, validator types.Validator) (t panic(fmt.Sprintf("bad state transition bondedToUnbonding, validator: %v\n", validator)) } - return k.BeginUnbondingValidator(ctx, validator) + return k.beginUnbondingValidator(ctx, validator) } func (k Keeper) unbondingToBonded(ctx sdk.Context, validator types.Validator) (types.Validator, error) { @@ -289,7 +284,7 @@ func (k Keeper) bondValidator(ctx sdk.Context, validator types.Validator) (types // delete the validator by power index, as the key will change k.DeleteValidatorByPowerIndex(ctx, validator) - validator = validator.UpdateStatus(types.Bonded) + validator = validator.UpdateStatus(sdkstaking.Bonded) // save the now bonded validator record to the two referenced stores k.SetValidator(ctx, validator) @@ -303,33 +298,31 @@ func (k Keeper) bondValidator(ctx sdk.Context, validator types.Validator) (types if err != nil { return validator, err } - k.AfterValidatorBonded(ctx, consAddr, validator.GetOperator()) - + err = k.AfterValidatorBonded(ctx, consAddr, validator.GetOperator()) + if err != nil { + return validator, err + } return validator, err } // perform all the store operations for when a validator begins unbonding -func (k Keeper) BeginUnbondingValidator(ctx sdk.Context, validator types.Validator) (types.Validator, error) { +func (k Keeper) beginUnbondingValidator(ctx sdk.Context, validator types.Validator) (types.Validator, error) { params := k.GetParams(ctx) // delete the validator by power index, as the key will change k.DeleteValidatorByPowerIndex(ctx, validator) // sanity check - if validator.Status != types.Bonded { + if validator.Status != sdkstaking.Bonded { panic(fmt.Sprintf("should not already be unbonded or unbonding, validator: %v\n", validator)) } - id := k.IncrementUnbondingID(ctx) - - validator = validator.UpdateStatus(types.Unbonding) + validator = validator.UpdateStatus(sdkstaking.Unbonding) // set the unbonding completion time and completion height appropriately validator.UnbondingTime = ctx.BlockHeader().Time.Add(params.UnbondingTime) validator.UnbondingHeight = ctx.BlockHeader().Height - validator.UnbondingIds = append(validator.UnbondingIds, id) - // save the now unbonded validator record and power index k.SetValidator(ctx, validator) k.SetValidatorByPowerIndex(ctx, validator) @@ -342,20 +335,16 @@ func (k Keeper) BeginUnbondingValidator(ctx sdk.Context, validator types.Validat if err != nil { return validator, err } - k.AfterValidatorBeginUnbonding(ctx, consAddr, validator.GetOperator()) - - k.SetValidatorByUnbondingID(ctx, validator, id) - - if err := k.AfterUnbondingInitiated(ctx, id); err != nil { + err = k.AfterValidatorBeginUnbonding(ctx, consAddr, validator.GetOperator()) + if err != nil { return validator, err } - return validator, nil } // perform all the store operations for when a validator status becomes unbonded func (k Keeper) completeUnbondingValidator(ctx sdk.Context, validator types.Validator) types.Validator { - validator = validator.UpdateStatus(types.Unbonded) + validator = validator.UpdateStatus(sdkstaking.Unbonded) k.SetValidator(ctx, validator) return validator diff --git a/x/staking/keeper/validator.go b/x/staking/keeper/validator.go index 52860851c46..bc9c0f43671 100644 --- a/x/staking/keeper/validator.go +++ b/x/staking/keeper/validator.go @@ -11,6 +11,19 @@ import ( ) // get a single validator +func (k Keeper) GetLiquidValidator(ctx sdk.Context, addr sdk.ValAddress) (validator types.Validator, found bool) { + store := ctx.KVStore(k.storeKey) + + value := store.Get(types.GetValidatorKey(addr)) + if value == nil { + return validator, false + } + + validator = types.MustUnmarshalValidator(k.cdc, value) + return validator, true +} + +// get a single validator as sdktypes for other module use func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator types.Validator, found bool) { store := ctx.KVStore(k.storeKey) @@ -23,8 +36,8 @@ func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator ty return validator, true } -func (k Keeper) mustGetValidator(ctx sdk.Context, addr sdk.ValAddress) types.Validator { - validator, found := k.GetValidator(ctx, addr) +func (k Keeper) mustGetLiquidValidator(ctx sdk.Context, addr sdk.ValAddress) types.Validator { + validator, found := k.GetLiquidValidator(ctx, addr) if !found { panic(fmt.Sprintf("validator record not found for address: %X\n", addr)) } @@ -41,7 +54,7 @@ func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress return validator, false } - return k.GetValidator(ctx, opAddr) + return k.GetLiquidValidator(ctx, opAddr) } func (k Keeper) mustGetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) types.Validator { @@ -142,6 +155,10 @@ func (k Keeper) UpdateValidatorCommission(ctx sdk.Context, return commission, err } + if newRate.LT(k.MinCommissionRate(ctx)) { + return commission, fmt.Errorf("cannot set validator commission to less than minimum rate of %s", k.MinCommissionRate(ctx)) + } + commission.Rate = newRate commission.UpdateTime = blockTime @@ -153,7 +170,7 @@ func (k Keeper) UpdateValidatorCommission(ctx sdk.Context, // TODO, this function panics, and it's not good. func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress) { // first retrieve the old validator record - validator, found := k.GetValidator(ctx, address) + validator, found := k.GetLiquidValidator(ctx, address) if !found { return } @@ -177,7 +194,11 @@ func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress) { store.Delete(types.GetValidatorByConsAddrKey(valConsAddr)) store.Delete(types.GetValidatorsByPowerIndexKey(validator, k.PowerReduction(ctx))) - k.AfterValidatorRemoved(ctx, valConsAddr, validator.GetOperator()) + // call hooks + err = k.AfterValidatorRemoved(ctx, valConsAddr, validator.GetOperator()) + if err != nil { + panic(err) + } } // get groups of validators @@ -215,6 +236,28 @@ func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint32) (validators [ return validators[:i] // trim if the array length < maxRetrieve } +// get the current group of bonded validators sorted by power-rank +func (k Keeper) GetLiquidBondedValidatorsByPower(ctx sdk.Context) []types.Validator { + maxValidators := k.MaxValidators(ctx) + validators := make([]types.Validator, maxValidators) + + iterator := k.ValidatorsPowerStoreIterator(ctx) + defer iterator.Close() + + i := 0 + for ; iterator.Valid() && i < int(maxValidators); iterator.Next() { + address := iterator.Value() + validator := k.mustGetLiquidValidator(ctx, address) + + if validator.IsBonded() { + validators[i] = validator + i++ + } + } + + return validators[:i] // trim +} + // get the current group of bonded validators sorted by power-rank func (k Keeper) GetBondedValidatorsByPower(ctx sdk.Context) []types.Validator { maxValidators := k.MaxValidators(ctx) @@ -226,8 +269,14 @@ func (k Keeper) GetBondedValidatorsByPower(ctx sdk.Context) []types.Validator { i := 0 for ; iterator.Valid() && i < int(maxValidators); iterator.Next() { address := iterator.Value() - validator := k.mustGetValidator(ctx, address) + store := ctx.KVStore(k.storeKey) + + value := store.Get(types.GetValidatorKey(address)) + if value == nil { + return nil + } + validator := types.MustUnmarshalValidator(k.cdc, value) if validator.IsBonded() { validators[i] = validator i++ @@ -320,7 +369,7 @@ func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator } address := types.AddressFromLastValidatorPowerKey(iterator.Key()) - validator := k.mustGetValidator(ctx, address) + validator := k.mustGetLiquidValidator(ctx, address) validators[i] = validator i++ @@ -397,6 +446,8 @@ func (k Keeper) ValidatorQueueIterator(ctx sdk.Context, endTime time.Time, endHe // UnbondAllMatureValidators unbonds all the mature unbonding validators that // have finished their unbonding period. func (k Keeper) UnbondAllMatureValidators(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + blockTime := ctx.BlockTime() blockHeight := ctx.BlockHeight() @@ -427,7 +478,7 @@ func (k Keeper) UnbondAllMatureValidators(ctx sdk.Context) { if err != nil { panic(err) } - val, found := k.GetValidator(ctx, addr) + val, found := k.GetLiquidValidator(ctx, addr) if !found { panic("validator in the unbonding queue was not found") } @@ -435,32 +486,14 @@ func (k Keeper) UnbondAllMatureValidators(ctx sdk.Context) { if !val.IsUnbonding() { panic("unexpected validator in unbonding queue; status was not unbonding") } - if val.UnbondingOnHoldRefCount == 0 { - for _, id := range val.UnbondingIds { - k.DeleteUnbondingIndex(ctx, id) - } - - val = k.UnbondingToUnbonded(ctx, val) - - if val.GetDelegatorShares().IsZero() { - k.RemoveValidator(ctx, val.GetOperator()) - } else { - // remove unbonding ids - val.UnbondingIds = []uint64{} - } - // remove validator from queue - k.DeleteValidatorQueue(ctx, val) + + val = k.UnbondingToUnbonded(ctx, val) + if val.GetDelegatorShares().IsZero() { + k.RemoveValidator(ctx, val.GetOperator()) } } - } - } -} -func (k Keeper) IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool { - v, f := k.GetValidatorByConsAddr(ctx, addr) - if !f { - return false + store.Delete(key) + } } - - return v.Jailed } diff --git a/x/staking/keeper/validator_bench_test.go b/x/staking/keeper/validator_bench_test.go index ea727b72457..38f7441561b 100644 --- a/x/staking/keeper/validator_bench_test.go +++ b/x/staking/keeper/validator_bench_test.go @@ -14,7 +14,7 @@ func BenchmarkGetValidator(b *testing.B) { totalPower += int64(i) } - app, ctx, _, valAddrs, vals := initValidators(b, totalPower, len(powers), powers) + app, ctx, valAddrs, vals := initValidators(b, totalPower, len(powers), powers) for _, validator := range vals { app.StakingKeeper.SetValidator(ctx, validator) diff --git a/x/staking/keeper/validator_test.go b/x/staking/keeper/validator_test.go index a39d9ca799d..f0f3fc73e63 100644 --- a/x/staking/keeper/validator_test.go +++ b/x/staking/keeper/validator_test.go @@ -11,8 +11,10 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" + simapp "github.com/cosmos/cosmos-sdk/simapp" + simapp_test "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -25,7 +27,7 @@ func newMonikerValidator(t testing.TB, operator sdk.ValAddress, pubKey cryptotyp } func bootstrapValidatorTest(t testing.TB, power int64, numAddrs int) (*simapp.SimApp, sdk.Context, []sdk.AccAddress, []sdk.ValAddress) { - _, app, ctx := createTestInput() + _, app, ctx := createTestInput(&testing.T{}) addrDels, addrVals := generateAddresses(app, ctx, numAddrs) @@ -36,12 +38,27 @@ func bootstrapValidatorTest(t testing.TB, power int64, numAddrs int) (*simapp.Si // set bonded pool supply app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply)) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), totalSupply)) + + // unbond genesis validator delegations + delegations := app.StakingKeeper.GetAllDelegations(ctx) + fmt.Println("delegations", delegations) + require.Len(t, delegations, 1) + delegation := delegations[0] + + _, err := app.StakingKeeper.Undelegate(ctx, delegation.GetDelegatorAddr(), delegation.GetValidatorAddr(), delegation.Shares) + require.NoError(t, err) + + // end block to unbond genesis validator + staking.EndBlocker(ctx, app.StakingKeeper) + + after := app.StakingKeeper.GetAllValidators(ctx) + fmt.Println("afterrrrr end block", after[0].Status) return app, ctx, addrDels, addrVals } -func initValidators(t testing.TB, power int64, numAddrs int, powers []int64) (*simapp.SimApp, sdk.Context, []sdk.AccAddress, []sdk.ValAddress, []types.Validator) { +func initValidators(t testing.TB, power int64, numAddrs int, powers []int64) (*simapp.SimApp, sdk.Context, []sdk.ValAddress, []types.Validator) { app, ctx, addrs, valAddrs := bootstrapValidatorTest(t, power, numAddrs) pks := simapp.CreateTestPubKeys(numAddrs) @@ -51,7 +68,7 @@ func initValidators(t testing.TB, power int64, numAddrs int, powers []int64) (*s tokens := app.StakingKeeper.TokensFromConsensusPower(ctx, power) vs[i], _ = vs[i].AddTokensFromDel(tokens) } - return app, ctx, addrs, valAddrs, vs + return app, ctx, valAddrs, vs } func TestSetValidator(t *testing.T) { @@ -72,7 +89,7 @@ func TestSetValidator(t *testing.T) { // ensure update updates := applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - validator, found := app.StakingKeeper.GetValidator(ctx, valAddr) + validator, found := app.StakingKeeper.GetLiquidValidator(ctx, valAddr) require.True(t, found) require.Equal(t, validator.ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) @@ -82,7 +99,7 @@ func TestSetValidator(t *testing.T) { assert.Equal(t, valTokens, validator.DelegatorShares.RoundInt()) // Check each store for being saved - resVal, found := app.StakingKeeper.GetValidator(ctx, valAddr) + resVal, found := app.StakingKeeper.GetLiquidValidator(ctx, valAddr) assert.True(ValEq(t, validator, resVal)) require.True(t, found) @@ -90,20 +107,18 @@ func TestSetValidator(t *testing.T) { require.Equal(t, 1, len(resVals)) assert.True(ValEq(t, validator, resVals[0])) - resVals = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resVals = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, 1, len(resVals)) require.True(ValEq(t, validator, resVals[0])) resVals = app.StakingKeeper.GetValidators(ctx, 1) require.Equal(t, 1, len(resVals)) - require.True(ValEq(t, validator, resVals[0])) resVals = app.StakingKeeper.GetValidators(ctx, 10) - require.Equal(t, 1, len(resVals)) - require.True(ValEq(t, validator, resVals[0])) + require.Equal(t, 2, len(resVals)) allVals := app.StakingKeeper.GetAllValidators(ctx) - require.Equal(t, 1, len(allVals)) + require.Equal(t, 2, len(allVals)) } func TestUpdateValidatorByPowerIndex(t *testing.T) { @@ -113,8 +128,8 @@ func TestUpdateValidatorByPowerIndex(t *testing.T) { bondedPool := app.StakingKeeper.GetBondedPool(ctx) notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234))))) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000))))) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) @@ -125,7 +140,7 @@ func TestUpdateValidatorByPowerIndex(t *testing.T) { require.Equal(t, types.Unbonded, validator.Status) require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 100), validator.Tokens) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) - validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) + validator, found := app.StakingKeeper.GetLiquidValidator(ctx, addrVals[0]) require.True(t, found) require.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 100), validator.Tokens) @@ -139,7 +154,7 @@ func TestUpdateValidatorByPowerIndex(t *testing.T) { keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) // update the validator, possibly kicking it out require.False(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power)) - validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) + validator, found = app.StakingKeeper.GetLiquidValidator(ctx, addrVals[0]) require.True(t, found) power = types.GetValidatorsByPowerIndexKey(validator, app.StakingKeeper.PowerReduction(ctx)) @@ -162,8 +177,8 @@ func TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) { app.StakingKeeper.SetParams(ctx, params) // create a random pool - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234))))) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 1234))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 10000))))) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) @@ -185,8 +200,8 @@ func TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) { // validator and next in line cliff validator app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, nextCliffVal) shares := app.StakingKeeper.TokensFromConsensusPower(ctx, 21) - nextCliffVal, _ = nextCliffVal.RemoveDelShares(shares.ToDec()) - nextCliffVal = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, nextCliffVal, true) + nextCliffVal, _ = nextCliffVal.RemoveDelShares(sdk.NewDecFromInt(shares)) + _ = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, nextCliffVal, true) expectedValStatus := map[int]types.BondStatus{ 9: types.Bonded, 8: types.Bonded, 7: types.Bonded, 5: types.Bonded, 4: types.Bonded, @@ -198,7 +213,7 @@ func TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) { valAddr := validators[valIdx].OperatorAddress addr, err := sdk.ValAddressFromBech32(valAddr) assert.NoError(t, err) - val, _ := app.StakingKeeper.GetValidator(ctx, addr) + val, _ := app.StakingKeeper.GetLiquidValidator(ctx, addr) assert.Equal( t, status, val.GetStatus(), @@ -217,14 +232,15 @@ func TestSlashToZeroPowerRemoved(t *testing.T) { bondedPool := app.StakingKeeper.GetBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), valTokens)))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), valTokens)))) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) validator, _ = validator.AddTokensFromDel(valTokens) require.Equal(t, types.Unbonded, validator.Status) require.Equal(t, valTokens, validator.Tokens) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) + err := app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) + require.NoError(t, err) validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) require.Equal(t, valTokens, validator.Tokens, "\nvalidator %v\npool %v", validator, valTokens) @@ -233,7 +249,7 @@ func TestSlashToZeroPowerRemoved(t *testing.T) { // apply TM updates applyValidatorSetUpdates(t, ctx, app.StakingKeeper, -1) // validator should be unbonding - validator, _ = app.StakingKeeper.GetValidator(ctx, addrVals[0]) + validator, _ = app.StakingKeeper.GetLiquidValidator(ctx, addrVals[0]) require.Equal(t, validator.GetStatus(), types.Unbonding) } @@ -257,18 +273,19 @@ func TestValidatorBasics(t *testing.T) { assert.Equal(t, app.StakingKeeper.TokensFromConsensusPower(ctx, 7), validators[2].Tokens) // check the empty keeper first - _, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) + _, found := app.StakingKeeper.GetLiquidValidator(ctx, addrVals[0]) require.False(t, found) resVals := app.StakingKeeper.GetLastValidators(ctx) require.Zero(t, len(resVals)) resVals = app.StakingKeeper.GetValidators(ctx, 2) - require.Zero(t, len(resVals)) + require.Len(t, resVals, 1) // set and retrieve a record validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], true) - app.StakingKeeper.SetValidatorByConsAddr(ctx, validators[0]) - resVal, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) + err := app.StakingKeeper.SetValidatorByConsAddr(ctx, validators[0]) + require.NoError(t, err) + resVal, found := app.StakingKeeper.GetLiquidValidator(ctx, addrVals[0]) require.True(t, found) assert.True(ValEq(t, validators[0], resVal)) @@ -289,9 +306,9 @@ func TestValidatorBasics(t *testing.T) { // modify a records, save, and retrieve validators[0].Status = types.Bonded validators[0].Tokens = app.StakingKeeper.TokensFromConsensusPower(ctx, 10) - validators[0].DelegatorShares = validators[0].Tokens.ToDec() + validators[0].DelegatorShares = sdk.NewDecFromInt(validators[0].Tokens) validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], true) - resVal, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) + resVal, found = app.StakingKeeper.GetLiquidValidator(ctx, addrVals[0]) require.True(t, found) assert.True(ValEq(t, validators[0], resVal)) @@ -302,10 +319,10 @@ func TestValidatorBasics(t *testing.T) { // add other validators validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], true) validators[2] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[2], true) - resVal, found = app.StakingKeeper.GetValidator(ctx, addrVals[1]) + resVal, found = app.StakingKeeper.GetLiquidValidator(ctx, addrVals[1]) require.True(t, found) assert.True(ValEq(t, validators[1], resVal)) - resVal, found = app.StakingKeeper.GetValidator(ctx, addrVals[2]) + resVal, found = app.StakingKeeper.GetLiquidValidator(ctx, addrVals[2]) require.True(t, found) assert.True(ValEq(t, validators[2], resVal)) @@ -332,11 +349,11 @@ func TestValidatorBasics(t *testing.T) { validators[1].Tokens = sdk.ZeroInt() // ...remove all tokens app.StakingKeeper.SetValidator(ctx, validators[1]) // ...set the validator app.StakingKeeper.RemoveValidator(ctx, validators[1].GetOperator()) // Now it can be removed. - _, found = app.StakingKeeper.GetValidator(ctx, addrVals[1]) + _, found = app.StakingKeeper.GetLiquidValidator(ctx, addrVals[1]) require.False(t, found) } -// test how the validators are sorted, tests GetBondedValidatorsByPower +// test how the validators are sorted, tests GetLiquidBondedValidatorsByPower func TestGetValidatorSortingUnmixed(t *testing.T) { app, ctx, addrs, _ := bootstrapValidatorTest(t, 1000, 20) @@ -359,7 +376,7 @@ func TestGetValidatorSortingUnmixed(t *testing.T) { } // first make sure everything made it in to the gotValidator group - resValidators := app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators := app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) assert.Equal(t, n, len(resValidators)) assert.Equal(t, sdk.NewInt(400).Mul(app.StakingKeeper.PowerReduction(ctx)), resValidators[0].BondedTokens(), "%v", resValidators) assert.Equal(t, sdk.NewInt(200).Mul(app.StakingKeeper.PowerReduction(ctx)), resValidators[1].BondedTokens(), "%v", resValidators) @@ -375,14 +392,14 @@ func TestGetValidatorSortingUnmixed(t *testing.T) { // test a basic increase in voting power validators[3].Tokens = sdk.NewInt(500).Mul(app.StakingKeeper.PowerReduction(ctx)) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) // test a decrease in voting power validators[3].Tokens = sdk.NewInt(300).Mul(app.StakingKeeper.PowerReduction(ctx)) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) @@ -391,7 +408,7 @@ func TestGetValidatorSortingUnmixed(t *testing.T) { validators[3].Tokens = sdk.NewInt(200).Mul(app.StakingKeeper.PowerReduction(ctx)) ctx = ctx.WithBlockHeight(10) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) @@ -399,7 +416,7 @@ func TestGetValidatorSortingUnmixed(t *testing.T) { // no change in voting power - no change in sort ctx = ctx.WithBlockHeight(20) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[4], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) @@ -408,11 +425,11 @@ func TestGetValidatorSortingUnmixed(t *testing.T) { validators[3].Tokens = sdk.NewInt(300).Mul(app.StakingKeeper.PowerReduction(ctx)) validators[4].Tokens = sdk.NewInt(300).Mul(app.StakingKeeper.PowerReduction(ctx)) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) ctx = ctx.WithBlockHeight(30) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[4], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n, "%v", resValidators) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) @@ -423,8 +440,8 @@ func TestGetValidatorSortingMixed(t *testing.T) { bondedPool := app.StakingKeeper.GetBondedPool(ctx) notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 501))))) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 0))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 501))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), app.StakingKeeper.TokensFromConsensusPower(ctx, 0))))) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) @@ -452,15 +469,15 @@ func TestGetValidatorSortingMixed(t *testing.T) { keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[i], true) } - val0, found := app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[0])) + val0, found := app.StakingKeeper.GetLiquidValidator(ctx, sdk.ValAddress(addrs[0])) require.True(t, found) - val1, found := app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[1])) + val1, found := app.StakingKeeper.GetLiquidValidator(ctx, sdk.ValAddress(addrs[1])) require.True(t, found) - val2, found := app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[2])) + val2, found := app.StakingKeeper.GetLiquidValidator(ctx, sdk.ValAddress(addrs[2])) require.True(t, found) - val3, found := app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[3])) + val3, found := app.StakingKeeper.GetLiquidValidator(ctx, sdk.ValAddress(addrs[3])) require.True(t, found) - val4, found := app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[4])) + val4, found := app.StakingKeeper.GetLiquidValidator(ctx, sdk.ValAddress(addrs[4])) require.True(t, found) require.Equal(t, types.Bonded, val0.Status) require.Equal(t, types.Unbonding, val1.Status) @@ -469,7 +486,7 @@ func TestGetValidatorSortingMixed(t *testing.T) { require.Equal(t, types.Bonded, val4.Status) // first make sure everything made it in to the gotValidator group - resValidators := app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators := app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) // The validators returned should match the max validators assert.Equal(t, 2, len(resValidators)) assert.Equal(t, sdk.NewInt(400).Mul(app.StakingKeeper.PowerReduction(ctx)), resValidators[0].BondedTokens(), "%v", resValidators) @@ -499,13 +516,13 @@ func TestGetValidatorsEdgeCases(t *testing.T) { validators[i], _ = validators[i].AddTokensFromDel(tokens) notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, tokens)))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, tokens)))) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) validators[i] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[i], true) } // ensure that the first two bonded validators are the largest validators - resValidators := app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators := app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[2], resValidators[0])) assert.True(ValEq(t, validators[3], resValidators[1])) @@ -518,14 +535,14 @@ func TestGetValidatorsEdgeCases(t *testing.T) { newTokens := sdk.NewCoins() - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), newTokens)) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), newTokens)) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) // test that the two largest validators are // a) validator 0 with 500 tokens // b) validator 2 with 400 tokens (delegated before validator 3) validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) @@ -543,18 +560,18 @@ func TestGetValidatorsEdgeCases(t *testing.T) { ctx = ctx.WithBlockHeight(40) var found bool - validators[3], found = app.StakingKeeper.GetValidator(ctx, validators[3].GetOperator()) + validators[3], found = app.StakingKeeper.GetLiquidValidator(ctx, validators[3].GetOperator()) assert.True(t, found) app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validators[3]) validators[3], _ = validators[3].AddTokensFromDel(app.StakingKeeper.TokensFromConsensusPower(ctx, 1)) notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) newTokens = sdk.NewCoins(sdk.NewCoin(params.BondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 1))) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), newTokens)) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), newTokens)) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) validators[3] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[3], resValidators[1])) @@ -565,11 +582,11 @@ func TestGetValidatorsEdgeCases(t *testing.T) { validators[3], _ = validators[3].RemoveDelShares(sdk.NewDec(201)) bondedPool := app.StakingKeeper.GetBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, rmTokens)))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, bondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, rmTokens)))) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) validators[3] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) @@ -579,15 +596,15 @@ func TestGetValidatorsEdgeCases(t *testing.T) { validators[3], _ = validators[3].AddTokensFromDel(sdk.NewInt(200)) notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) - require.NoError(t, simapp.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.NewInt(200))))) + require.NoError(t, simapp_test.FundModuleAccount(app.BankKeeper, ctx, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.NewInt(200))))) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) validators[3] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) - _, exists := app.StakingKeeper.GetValidator(ctx, validators[3].GetOperator()) + _, exists := app.StakingKeeper.GetLiquidValidator(ctx, validators[3].GetOperator()) require.True(t, exists) } @@ -620,7 +637,7 @@ func TestValidatorBondHeight(t *testing.T) { validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], true) validators[2] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[2], true) - resValidators := app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators := app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, uint32(len(resValidators)), params.MaxValidators) assert.True(ValEq(t, validators[0], resValidators[0])) @@ -631,7 +648,7 @@ func TestValidatorBondHeight(t *testing.T) { validators[1], _ = validators[1].AddTokensFromDel(delTokens) validators[2], _ = validators[2].AddTokensFromDel(delTokens) validators[2] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[2], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) require.Equal(t, params.MaxValidators, uint32(len(resValidators))) validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], true) assert.True(ValEq(t, validators[0], resValidators[0])) @@ -656,7 +673,7 @@ func TestFullValidatorSetPowerChange(t *testing.T) { } for i := range powers { var found bool - validators[i], found = app.StakingKeeper.GetValidator(ctx, validators[i].GetOperator()) + validators[i], found = app.StakingKeeper.GetLiquidValidator(ctx, validators[i].GetOperator()) require.True(t, found) } assert.Equal(t, types.Unbonded, validators[0].Status) @@ -664,7 +681,7 @@ func TestFullValidatorSetPowerChange(t *testing.T) { assert.Equal(t, types.Bonded, validators[2].Status) assert.Equal(t, types.Bonded, validators[3].Status) assert.Equal(t, types.Unbonded, validators[4].Status) - resValidators := app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators := app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) assert.Equal(t, max, len(resValidators)) assert.True(ValEq(t, validators[2], resValidators[0])) // in the order of txs assert.True(ValEq(t, validators[3], resValidators[1])) @@ -674,7 +691,7 @@ func TestFullValidatorSetPowerChange(t *testing.T) { tokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 600) validators[0], _ = validators[0].AddTokensFromDel(tokens) validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], true) - resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) + resValidators = app.StakingKeeper.GetLiquidBondedValidatorsByPower(ctx) assert.Equal(t, max, len(resValidators)) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) @@ -703,8 +720,8 @@ func TestApplyAndReturnValidatorSetUpdatesAllNone(t *testing.T) { app.StakingKeeper.SetValidatorByPowerIndex(ctx, validators[1]) updates := applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 2) - validators[0], _ = app.StakingKeeper.GetValidator(ctx, validators[0].GetOperator()) - validators[1], _ = app.StakingKeeper.GetValidator(ctx, validators[1].GetOperator()) + validators[0], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[0].GetOperator()) + validators[1], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[1].GetOperator()) assert.Equal(t, validators[0].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[1]) assert.Equal(t, validators[1].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) } @@ -761,7 +778,7 @@ func TestApplyAndReturnValidatorSetUpdatesSingleValueChange(t *testing.T) { func TestApplyAndReturnValidatorSetUpdatesMultipleValueChange(t *testing.T) { powers := []int64{10, 20} // TODO: use it in other places - app, ctx, _, _, validators := initValidators(t, 1000, 20, powers) + app, ctx, _, validators := initValidators(t, 1000, 20, powers) validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], false) validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], false) @@ -783,7 +800,7 @@ func TestApplyAndReturnValidatorSetUpdatesMultipleValueChange(t *testing.T) { func TestApplyAndReturnValidatorSetUpdatesInserted(t *testing.T) { powers := []int64{10, 20, 5, 15, 25} - app, ctx, _, _, validators := initValidators(t, 1000, 20, powers) + app, ctx, _, validators := initValidators(t, 1000, 20, powers) validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], false) validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], false) @@ -794,7 +811,7 @@ func TestApplyAndReturnValidatorSetUpdatesInserted(t *testing.T) { app.StakingKeeper.SetValidator(ctx, validators[2]) app.StakingKeeper.SetValidatorByPowerIndex(ctx, validators[2]) updates := applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - validators[2], _ = app.StakingKeeper.GetValidator(ctx, validators[2].GetOperator()) + validators[2], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[2].GetOperator()) require.Equal(t, validators[2].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) // test validtor added at the beginning @@ -802,7 +819,7 @@ func TestApplyAndReturnValidatorSetUpdatesInserted(t *testing.T) { app.StakingKeeper.SetValidator(ctx, validators[3]) app.StakingKeeper.SetValidatorByPowerIndex(ctx, validators[3]) updates = applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - validators[3], _ = app.StakingKeeper.GetValidator(ctx, validators[3].GetOperator()) + validators[3], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[3].GetOperator()) require.Equal(t, validators[3].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) // test validtor added at the end @@ -810,7 +827,7 @@ func TestApplyAndReturnValidatorSetUpdatesInserted(t *testing.T) { app.StakingKeeper.SetValidator(ctx, validators[4]) app.StakingKeeper.SetValidatorByPowerIndex(ctx, validators[4]) updates = applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1) - validators[4], _ = app.StakingKeeper.GetValidator(ctx, validators[4].GetOperator()) + validators[4], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[4].GetOperator()) require.Equal(t, validators[4].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) } @@ -845,7 +862,7 @@ func TestApplyAndReturnValidatorSetUpdatesWithCliffValidator(t *testing.T) { app.StakingKeeper.SetValidator(ctx, validators[2]) app.StakingKeeper.SetValidatorByPowerIndex(ctx, validators[2]) updates := applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 2) - validators[2], _ = app.StakingKeeper.GetValidator(ctx, validators[2].GetOperator()) + validators[2], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[2].GetOperator()) require.Equal(t, validators[0].ABCIValidatorUpdateZero(), updates[1]) require.Equal(t, validators[2].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) } @@ -872,8 +889,8 @@ func TestApplyAndReturnValidatorSetUpdatesPowerDecrease(t *testing.T) { // tendermintUpdate set: {c1, c3} -> {c1', c3'} delTokens1 := app.StakingKeeper.TokensFromConsensusPower(ctx, 20) delTokens2 := app.StakingKeeper.TokensFromConsensusPower(ctx, 30) - validators[0], _ = validators[0].RemoveDelShares(delTokens1.ToDec()) - validators[1], _ = validators[1].RemoveDelShares(delTokens2.ToDec()) + validators[0], _ = validators[0].RemoveDelShares(sdk.NewDecFromInt(delTokens1)) + validators[1], _ = validators[1].RemoveDelShares(sdk.NewDecFromInt(delTokens2)) validators[0] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[0], false) validators[1] = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[1], false) @@ -912,8 +929,8 @@ func TestApplyAndReturnValidatorSetUpdatesNewValidator(t *testing.T) { // verify initial Tendermint updates are correct updates := applyValidatorSetUpdates(t, ctx, app.StakingKeeper, len(validators)) - validators[0], _ = app.StakingKeeper.GetValidator(ctx, validators[0].GetOperator()) - validators[1], _ = app.StakingKeeper.GetValidator(ctx, validators[1].GetOperator()) + validators[0], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[0].GetOperator()) + validators[1], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[1].GetOperator()) require.Equal(t, validators[0].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) require.Equal(t, validators[1].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[1]) @@ -941,7 +958,7 @@ func TestApplyAndReturnValidatorSetUpdatesNewValidator(t *testing.T) { app.StakingKeeper.SetValidator(ctx, validator) - validator, _ = validator.RemoveDelShares(amt.ToDec()) + validator, _ = validator.RemoveDelShares(sdk.NewDecFromInt(amt)) app.StakingKeeper.SetValidator(ctx, validator) app.StakingKeeper.SetValidatorByPowerIndex(ctx, validator) @@ -957,9 +974,9 @@ func TestApplyAndReturnValidatorSetUpdatesNewValidator(t *testing.T) { // verify initial Tendermint updates are correct updates = applyValidatorSetUpdates(t, ctx, app.StakingKeeper, len(validators)+1) - validator, _ = app.StakingKeeper.GetValidator(ctx, validator.GetOperator()) - validators[0], _ = app.StakingKeeper.GetValidator(ctx, validators[0].GetOperator()) - validators[1], _ = app.StakingKeeper.GetValidator(ctx, validators[1].GetOperator()) + validator, _ = app.StakingKeeper.GetLiquidValidator(ctx, validator.GetOperator()) + validators[0], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[0].GetOperator()) + validators[1], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[1].GetOperator()) require.Equal(t, validator.ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) require.Equal(t, validators[0].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[1]) require.Equal(t, validators[1].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[2]) @@ -990,8 +1007,8 @@ func TestApplyAndReturnValidatorSetUpdatesBondTransition(t *testing.T) { // verify initial Tendermint updates are correct updates := applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 2) - validators[2], _ = app.StakingKeeper.GetValidator(ctx, validators[2].GetOperator()) - validators[1], _ = app.StakingKeeper.GetValidator(ctx, validators[1].GetOperator()) + validators[2], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[2].GetOperator()) + validators[1], _ = app.StakingKeeper.GetLiquidValidator(ctx, validators[1].GetOperator()) require.Equal(t, validators[2].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[0]) require.Equal(t, validators[1].ABCIValidatorUpdate(app.StakingKeeper.PowerReduction(ctx)), updates[1]) @@ -1001,7 +1018,7 @@ func TestApplyAndReturnValidatorSetUpdatesBondTransition(t *testing.T) { ctx = ctx.WithBlockHeight(1) var found bool - validators[0], found = app.StakingKeeper.GetValidator(ctx, validators[0].GetOperator()) + validators[0], found = app.StakingKeeper.GetLiquidValidator(ctx, validators[0].GetOperator()) require.True(t, found) app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validators[0]) @@ -1017,7 +1034,7 @@ func TestApplyAndReturnValidatorSetUpdatesBondTransition(t *testing.T) { // lowest power in a single block context (height) ctx = ctx.WithBlockHeight(2) - validators[1], found = app.StakingKeeper.GetValidator(ctx, validators[1].GetOperator()) + validators[1], found = app.StakingKeeper.GetLiquidValidator(ctx, validators[1].GetOperator()) require.True(t, found) app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validators[0]) @@ -1043,6 +1060,11 @@ func TestUpdateValidatorCommission(t *testing.T) { app, ctx, _, addrVals := bootstrapValidatorTest(t, 1000, 20) ctx = ctx.WithBlockHeader(tmproto.Header{Time: time.Now().UTC()}) + // Set MinCommissionRate to 0.05 + params := app.StakingKeeper.GetParams(ctx) + params.MinCommissionRate = sdk.NewDecWithPrec(5, 2) + app.StakingKeeper.SetParams(ctx, params) + commission1 := types.NewCommissionWithTime( sdk.NewDecWithPrec(1, 1), sdk.NewDecWithPrec(3, 1), sdk.NewDecWithPrec(1, 1), time.Now().UTC().Add(time.Duration(-1)*time.Hour), @@ -1067,6 +1089,7 @@ func TestUpdateValidatorCommission(t *testing.T) { {val2, sdk.NewDecWithPrec(-1, 1), true}, {val2, sdk.NewDecWithPrec(4, 1), true}, {val2, sdk.NewDecWithPrec(3, 1), true}, + {val2, sdk.NewDecWithPrec(1, 2), true}, {val2, sdk.NewDecWithPrec(2, 1), false}, } @@ -1078,7 +1101,7 @@ func TestUpdateValidatorCommission(t *testing.T) { } else { tc.validator.Commission = commission app.StakingKeeper.SetValidator(ctx, tc.validator) - val, found := app.StakingKeeper.GetValidator(ctx, tc.validator.GetOperator()) + val, found := app.StakingKeeper.GetLiquidValidator(ctx, tc.validator.GetOperator()) require.True(t, found, "expected to find validator for test case #%d with rate: %s", i, tc.newRate, diff --git a/x/staking/legacy/v034/types.go b/x/staking/legacy/v034/types.go deleted file mode 100644 index 789731819c0..00000000000 --- a/x/staking/legacy/v034/types.go +++ /dev/null @@ -1,190 +0,0 @@ -// Package v034 is used for legacy migration scripts. Actual migration scripts -// for v034 have been removed, but the v039->v042 migration script still -// references types from this file, so we're keeping it for now. -// DONTCOVER -package v034 - -import ( - "time" - - "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/legacybech32" //nolint:staticcheck -) - -const ( - ModuleName = "staking" -) - -// staking constants -const ( - Unbonded BondStatus = 0x00 - Unbonding BondStatus = 0x01 - Bonded BondStatus = 0x02 - - BondStatusUnbonded = "Unbonded" - BondStatusUnbonding = "Unbonding" - BondStatusBonded = "Bonded" -) - -type ( - // BondStatus is the status of a validator - BondStatus byte - - Pool struct { - NotBondedTokens sdk.Int `json:"not_bonded_tokens"` - BondedTokens sdk.Int `json:"bonded_tokens"` - } - - Params struct { - UnbondingTime time.Duration `json:"unbonding_time"` - MaxValidators uint16 `json:"max_validators"` - MaxEntries uint16 `json:"max_entries"` - BondDenom string `json:"bond_denom"` - } - - LastValidatorPower struct { - Address sdk.ValAddress - Power int64 - } - - Description struct { - Moniker string `json:"moniker"` - Identity string `json:"identity"` - Website string `json:"website"` - Details string `json:"details"` - } - - Commission struct { - Rate sdk.Dec `json:"rate"` - MaxRate sdk.Dec `json:"max_rate"` - MaxChangeRate sdk.Dec `json:"max_change_rate"` - UpdateTime time.Time `json:"update_time"` - } - - bechValidator struct { - OperatorAddress sdk.ValAddress `json:"operator_address"` // the bech32 address of the validator's operator - ConsPubKey string `json:"consensus_pubkey"` // the bech32 consensus public key of the validator - Jailed bool `json:"jailed"` // has the validator been jailed from bonded status? - Status BondStatus `json:"status"` // validator status (bonded/unbonding/unbonded) - Tokens sdk.Int `json:"tokens"` // delegated tokens (incl. self-delegation) - DelegatorShares sdk.Dec `json:"delegator_shares"` // total shares issued to a validator's delegators - Description Description `json:"description"` // description terms for the validator - UnbondingHeight int64 `json:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding - UnbondingCompletionTime time.Time `json:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding - Commission Commission `json:"commission"` // commission parameters - MinSelfDelegation sdk.Int `json:"min_self_delegation"` // minimum self delegation - } - - Validator struct { - OperatorAddress sdk.ValAddress `json:"operator_address"` - ConsPubKey cryptotypes.PubKey `json:"consensus_pubkey"` - Jailed bool `json:"jailed"` - Status BondStatus `json:"status"` - Tokens sdk.Int `json:"tokens"` - DelegatorShares sdk.Dec `json:"delegator_shares"` - Description Description `json:"description"` - UnbondingHeight int64 `json:"unbonding_height"` - UnbondingCompletionTime time.Time `json:"unbonding_time"` - Commission Commission `json:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation"` - } - - Validators []Validator - - Delegation struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address"` - Shares sdk.Dec `json:"shares"` - } - - Delegations []Delegation - - UnbondingDelegationEntry struct { - CreationHeight int64 `json:"creation_height"` - CompletionTime time.Time `json:"completion_time"` - InitialBalance sdk.Int `json:"initial_balance"` - Balance sdk.Int `json:"balance"` - } - - UnbondingDelegation struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address"` - Entries []UnbondingDelegationEntry `json:"entries"` - } - - RedelegationEntry struct { - CreationHeight int64 `json:"creation_height"` - CompletionTime time.Time `json:"completion_time"` - InitialBalance sdk.Int `json:"initial_balance"` - SharesDst sdk.Dec `json:"shares_dst"` - } - - Redelegation struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address"` - ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address"` - ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address"` - Entries []RedelegationEntry `json:"entries"` - } - - GenesisState struct { - Pool Pool `json:"pool"` - Params Params `json:"params"` - LastTotalPower sdk.Int `json:"last_total_power"` - LastValidatorPowers []LastValidatorPower `json:"last_validator_powers"` - Validators Validators `json:"validators"` - Delegations Delegations `json:"delegations"` - UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations"` - Redelegations []Redelegation `json:"redelegations"` - Exported bool `json:"exported"` - } -) - -func (v Validator) MarshalJSON() ([]byte, error) { - bechConsPubKey, err := legacybech32.MarshalPubKey(legacybech32.ConsPK, v.ConsPubKey) //nolint:staticcheck - if err != nil { - return nil, err - } - - return legacy.Cdc.MarshalJSON(bechValidator{ - OperatorAddress: v.OperatorAddress, - ConsPubKey: bechConsPubKey, - Jailed: v.Jailed, - Status: v.Status, - Tokens: v.Tokens, - DelegatorShares: v.DelegatorShares, - Description: v.Description, - UnbondingHeight: v.UnbondingHeight, - UnbondingCompletionTime: v.UnbondingCompletionTime, - MinSelfDelegation: v.MinSelfDelegation, - Commission: v.Commission, - }) -} - -// UnmarshalJSON unmarshals the validator from JSON using Bech32 -func (v *Validator) UnmarshalJSON(data []byte) error { - bv := &bechValidator{} - if err := legacy.Cdc.UnmarshalJSON(data, bv); err != nil { - return err - } - consPubKey, err := legacybech32.UnmarshalPubKey(legacybech32.ConsPK, bv.ConsPubKey) //nolint:staticcheck - if err != nil { - return err - } - - *v = Validator{ - OperatorAddress: bv.OperatorAddress, - ConsPubKey: consPubKey, - Jailed: bv.Jailed, - Tokens: bv.Tokens, - Status: bv.Status, - DelegatorShares: bv.DelegatorShares, - Description: bv.Description, - UnbondingHeight: bv.UnbondingHeight, - UnbondingCompletionTime: bv.UnbondingCompletionTime, - Commission: bv.Commission, - MinSelfDelegation: bv.MinSelfDelegation, - } - return nil -} diff --git a/x/staking/legacy/v036/types.go b/x/staking/legacy/v036/types.go deleted file mode 100644 index bb423c75207..00000000000 --- a/x/staking/legacy/v036/types.go +++ /dev/null @@ -1,136 +0,0 @@ -// Package v036 is used for legacy migration scripts. Actual migration scripts -// for v036 have been removed, but the v039->v042 migration script still -// references types from this file, so we're keeping it for now. -// DONTCOVER -package v036 - -import ( - "time" - - "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/legacybech32" //nolint:staticcheck - v034staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v034" -) - -const ( - ModuleName = "staking" -) - -type ( - Commission struct { - CommissionRates `json:"commission_rates" yaml:"commission_rates"` - UpdateTime time.Time `json:"update_time" yaml:"update_time"` - } - - CommissionRates struct { - Rate sdk.Dec `json:"rate" yaml:"rate"` - MaxRate sdk.Dec `json:"max_rate" yaml:"max_rate"` - MaxChangeRate sdk.Dec `json:"max_change_rate" yaml:"max_change_rate"` - } - - Validator struct { - OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` - ConsPubKey cryptotypes.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` - Jailed bool `json:"jailed" yaml:"jailed"` - Status v034staking.BondStatus `json:"status" yaml:"status"` - Tokens sdk.Int `json:"tokens" yaml:"tokens"` - DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` - Description v034staking.Description `json:"description" yaml:"description"` - UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` - UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` - Commission Commission `json:"commission" yaml:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` - } - - bechValidator struct { - OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` - ConsPubKey string `json:"consensus_pubkey" yaml:"consensus_pubkey"` - Jailed bool `json:"jailed" yaml:"jailed"` - Status v034staking.BondStatus `json:"status" yaml:"status"` - Tokens sdk.Int `json:"tokens" yaml:"tokens"` - DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` - Description v034staking.Description `json:"description" yaml:"description"` - UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` - UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` - Commission Commission `json:"commission" yaml:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` - } - - Validators []Validator - - GenesisState struct { - Params v034staking.Params `json:"params"` - LastTotalPower sdk.Int `json:"last_total_power"` - LastValidatorPowers []v034staking.LastValidatorPower `json:"last_validator_powers"` - Validators Validators `json:"validators"` - Delegations v034staking.Delegations `json:"delegations"` - UnbondingDelegations []v034staking.UnbondingDelegation `json:"unbonding_delegations"` - Redelegations []v034staking.Redelegation `json:"redelegations"` - Exported bool `json:"exported"` - } -) - -func NewGenesisState( - params v034staking.Params, lastTotalPower sdk.Int, lastValPowers []v034staking.LastValidatorPower, - validators Validators, delegations v034staking.Delegations, - ubds []v034staking.UnbondingDelegation, reds []v034staking.Redelegation, exported bool, -) GenesisState { - return GenesisState{ - Params: params, - LastTotalPower: lastTotalPower, - LastValidatorPowers: lastValPowers, - Validators: validators, - Delegations: delegations, - UnbondingDelegations: ubds, - Redelegations: reds, - Exported: exported, - } -} - -func (v Validator) MarshalJSON() ([]byte, error) { - bechConsPubKey, err := legacybech32.MarshalPubKey(legacybech32.ConsPK, v.ConsPubKey) //nolint:staticcheck - if err != nil { - return nil, err - } - - return legacy.Cdc.MarshalJSON(bechValidator{ - OperatorAddress: v.OperatorAddress, - ConsPubKey: bechConsPubKey, - Jailed: v.Jailed, - Status: v.Status, - Tokens: v.Tokens, - DelegatorShares: v.DelegatorShares, - Description: v.Description, - UnbondingHeight: v.UnbondingHeight, - UnbondingCompletionTime: v.UnbondingCompletionTime, - MinSelfDelegation: v.MinSelfDelegation, - Commission: v.Commission, - }) -} - -func (v *Validator) UnmarshalJSON(data []byte) error { - bv := &bechValidator{} - if err := legacy.Cdc.UnmarshalJSON(data, bv); err != nil { - return err - } - consPubKey, err := legacybech32.UnmarshalPubKey(legacybech32.ConsPK, bv.ConsPubKey) //nolint:staticcheck - if err != nil { - return err - } - *v = Validator{ - OperatorAddress: bv.OperatorAddress, - ConsPubKey: consPubKey, - Jailed: bv.Jailed, - Tokens: bv.Tokens, - Status: bv.Status, - DelegatorShares: bv.DelegatorShares, - Description: bv.Description, - UnbondingHeight: bv.UnbondingHeight, - UnbondingCompletionTime: bv.UnbondingCompletionTime, - Commission: bv.Commission, - MinSelfDelegation: bv.MinSelfDelegation, - } - return nil -} diff --git a/x/staking/legacy/v038/types.go b/x/staking/legacy/v038/types.go deleted file mode 100644 index f8559d330b6..00000000000 --- a/x/staking/legacy/v038/types.go +++ /dev/null @@ -1,162 +0,0 @@ -// Package v038 is used for legacy migration scripts. Actual migration scripts -// for v038 have been removed, but the v039->v042 migration script still -// references types from this file, so we're keeping it for now. -// DONTCOVER -package v038 - -import ( - "time" - - "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/legacybech32" //nolint:staticcheck - v034staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v034" - v036staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v036" -) - -const ( - ModuleName = "staking" -) - -type ( - Description struct { - Moniker string `json:"moniker" yaml:"moniker"` - Identity string `json:"identity" yaml:"identity"` - Website string `json:"website" yaml:"website"` - SecurityContact string `json:"security_contact" yaml:"security_contact"` - Details string `json:"details" yaml:"details"` - } - - Validator struct { - OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` - ConsPubKey cryptotypes.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` - Jailed bool `json:"jailed" yaml:"jailed"` - Status v034staking.BondStatus `json:"status" yaml:"status"` - Tokens sdk.Int `json:"tokens" yaml:"tokens"` - DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` - Description Description `json:"description" yaml:"description"` - UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` - UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` - Commission v036staking.Commission `json:"commission" yaml:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` - } - - bechValidator struct { - OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` - ConsPubKey string `json:"consensus_pubkey" yaml:"consensus_pubkey"` - Jailed bool `json:"jailed" yaml:"jailed"` - Status v034staking.BondStatus `json:"status" yaml:"status"` - Tokens sdk.Int `json:"tokens" yaml:"tokens"` - DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` - Description Description `json:"description" yaml:"description"` - UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` - UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` - Commission v036staking.Commission `json:"commission" yaml:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` - } - - Validators []Validator - - Params struct { - UnbondingTime time.Duration `json:"unbonding_time" yaml:"unbonding_time"` // time duration of unbonding - MaxValidators uint16 `json:"max_validators" yaml:"max_validators"` // maximum number of validators (max uint16 = 65535) - MaxEntries uint16 `json:"max_entries" yaml:"max_entries"` // max entries for either unbonding delegation or redelegation (per pair/trio) - HistoricalEntries uint16 `json:"historical_entries" yaml:"historical_entries"` // number of historical entries to persist - BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination - } - - GenesisState struct { - Params Params `json:"params"` - LastTotalPower sdk.Int `json:"last_total_power"` - LastValidatorPowers []v034staking.LastValidatorPower `json:"last_validator_powers"` - Validators Validators `json:"validators"` - Delegations v034staking.Delegations `json:"delegations"` - UnbondingDelegations []v034staking.UnbondingDelegation `json:"unbonding_delegations"` - Redelegations []v034staking.Redelegation `json:"redelegations"` - Exported bool `json:"exported"` - } -) - -// NewDescription creates a new Description object -func NewDescription(moniker, identity, website, securityContact, details string) Description { - return Description{ - Moniker: moniker, - Identity: identity, - Website: website, - SecurityContact: securityContact, - Details: details, - } -} - -// NewGenesisState creates a new GenesisState object -func NewGenesisState( - params v034staking.Params, lastTotalPower sdk.Int, lastValPowers []v034staking.LastValidatorPower, - validators Validators, delegations v034staking.Delegations, - ubds []v034staking.UnbondingDelegation, reds []v034staking.Redelegation, exported bool, -) GenesisState { - return GenesisState{ - Params: Params{ - UnbondingTime: params.UnbondingTime, - MaxValidators: params.MaxValidators, - MaxEntries: params.MaxEntries, - BondDenom: params.BondDenom, - HistoricalEntries: 0, - }, - LastTotalPower: lastTotalPower, - LastValidatorPowers: lastValPowers, - Validators: validators, - Delegations: delegations, - UnbondingDelegations: ubds, - Redelegations: reds, - Exported: exported, - } -} - -// MarshalJSON marshals the validator to JSON using Bech32 -func (v Validator) MarshalJSON() ([]byte, error) { - bechConsPubKey, err := legacybech32.MarshalPubKey(legacybech32.ConsPK, v.ConsPubKey) //nolint:staticcheck - if err != nil { - return nil, err - } - - return legacy.Cdc.MarshalJSON(bechValidator{ - OperatorAddress: v.OperatorAddress, - ConsPubKey: bechConsPubKey, - Jailed: v.Jailed, - Status: v.Status, - Tokens: v.Tokens, - DelegatorShares: v.DelegatorShares, - Description: v.Description, - UnbondingHeight: v.UnbondingHeight, - UnbondingCompletionTime: v.UnbondingCompletionTime, - MinSelfDelegation: v.MinSelfDelegation, - Commission: v.Commission, - }) -} - -// UnmarshalJSON unmarshals the validator from JSON using Bech32 -func (v *Validator) UnmarshalJSON(data []byte) error { - bv := &bechValidator{} - if err := legacy.Cdc.UnmarshalJSON(data, bv); err != nil { - return err - } - consPubKey, err := legacybech32.UnmarshalPubKey(legacybech32.ConsPK, bv.ConsPubKey) //nolint:staticcheck - if err != nil { - return err - } - *v = Validator{ - OperatorAddress: bv.OperatorAddress, - ConsPubKey: consPubKey, - Jailed: bv.Jailed, - Tokens: bv.Tokens, - Status: bv.Status, - DelegatorShares: bv.DelegatorShares, - Description: bv.Description, - UnbondingHeight: bv.UnbondingHeight, - UnbondingCompletionTime: bv.UnbondingCompletionTime, - Commission: bv.Commission, - MinSelfDelegation: bv.MinSelfDelegation, - } - return nil -} diff --git a/x/staking/legacy/v040/genesis.pb.go b/x/staking/legacy/v040/genesis.pb.go deleted file mode 100644 index c8747812d1c..00000000000 --- a/x/staking/legacy/v040/genesis.pb.go +++ /dev/null @@ -1,962 +0,0 @@ -// Package v040 is taken from: -// https://github.com/cosmos/cosmos-sdk/blob/v0.40.1/x/staking/types/genesis.pb.go -// by copy-pasted only the relevants parts for Genesis. -//nolint -package v040 - -import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal - -var ( - _ = fmt.Errorf - _ = 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 staking module's genesis state. -type GenesisState struct { - // params defines all the paramaters of related to deposit. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // last_total_power tracks the total amounts of bonded tokens recorded during - // the previous end block. - LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power" yaml:"last_total_power"` - // last_validator_powers is a special index that provides a historical list - // of the last-block's bonded validators. - LastValidatorPowers []LastValidatorPower `protobuf:"bytes,3,rep,name=last_validator_powers,json=lastValidatorPowers,proto3" json:"last_validator_powers" yaml:"last_validator_powers"` - // delegations defines the validator set at genesis. - Validators []Validator `protobuf:"bytes,4,rep,name=validators,proto3" json:"validators"` - // delegations defines the delegations active at genesis. - Delegations []Delegation `protobuf:"bytes,5,rep,name=delegations,proto3" json:"delegations"` - // unbonding_delegations defines the unbonding delegations active at genesis. - UnbondingDelegations []UnbondingDelegation `protobuf:"bytes,6,rep,name=unbonding_delegations,json=unbondingDelegations,proto3" json:"unbonding_delegations" yaml:"unbonding_delegations"` - // redelegations defines the redelegations active at genesis. - Redelegations []Redelegation `protobuf:"bytes,7,rep,name=redelegations,proto3" json:"redelegations"` - Exported bool `protobuf:"varint,8,opt,name=exported,proto3" json:"exported,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_9b3dec8894f2831b, []int{0} -} - -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} - -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} - -func (m *GenesisState) XXX_Size() int { - return m.Size() -} - -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetLastValidatorPowers() []LastValidatorPower { - if m != nil { - return m.LastValidatorPowers - } - return nil -} - -func (m *GenesisState) GetValidators() []Validator { - if m != nil { - return m.Validators - } - return nil -} - -func (m *GenesisState) GetDelegations() []Delegation { - if m != nil { - return m.Delegations - } - return nil -} - -func (m *GenesisState) GetUnbondingDelegations() []UnbondingDelegation { - if m != nil { - return m.UnbondingDelegations - } - return nil -} - -func (m *GenesisState) GetRedelegations() []Redelegation { - if m != nil { - return m.Redelegations - } - return nil -} - -func (m *GenesisState) GetExported() bool { - if m != nil { - return m.Exported - } - return false -} - -// LastValidatorPower required for validator set update logic. -type LastValidatorPower struct { - // address is the address of the validator. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // power defines the power of the validator. - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` -} - -func (m *LastValidatorPower) Reset() { *m = LastValidatorPower{} } -func (m *LastValidatorPower) String() string { return proto.CompactTextString(m) } -func (*LastValidatorPower) ProtoMessage() {} -func (*LastValidatorPower) Descriptor() ([]byte, []int) { - return fileDescriptor_9b3dec8894f2831b, []int{1} -} - -func (m *LastValidatorPower) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *LastValidatorPower) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LastValidatorPower.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 *LastValidatorPower) XXX_Merge(src proto.Message) { - xxx_messageInfo_LastValidatorPower.Merge(m, src) -} - -func (m *LastValidatorPower) XXX_Size() int { - return m.Size() -} - -func (m *LastValidatorPower) XXX_DiscardUnknown() { - xxx_messageInfo_LastValidatorPower.DiscardUnknown(m) -} - -var xxx_messageInfo_LastValidatorPower proto.InternalMessageInfo - -func init() { - // proto.RegisterType((*GenesisState)(nil), "cosmos.staking.v1beta1.GenesisState") - // proto.RegisterType((*LastValidatorPower)(nil), "cosmos.staking.v1beta1.LastValidatorPower") -} - -func init() { - // proto.RegisterFile("cosmos/staking/v1beta1/genesis.proto", fileDescriptor_9b3dec8894f2831b) -} - -var fileDescriptor_9b3dec8894f2831b = []byte{ - // 493 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x3d, 0x6f, 0xd3, 0x40, - 0x18, 0xc7, 0x7d, 0xa4, 0x49, 0xc3, 0xa5, 0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 0x15, 0x90, 0x1e, 0x6e, 0xf3, 0x93, 0x48, 0xc4, 0x92, 0xbb, 0x7a, 0xbb, - 0x8f, 0x86, 0x6d, 0x5a, 0xae, 0xad, 0xd7, 0x98, 0xac, 0x7f, 0x5c, 0xa2, 0xe3, 0x4d, 0xe6, 0xba, - 0x31, 0x87, 0x6c, 0xb8, 0xaf, 0xd3, 0x62, 0x49, 0xba, 0xb8, 0xf9, 0x77, 0x58, 0x1b, 0x34, 0x5b, - 0xec, 0xb5, 0xbf, 0x9e, 0x99, 0xda, 0xef, 0x33, 0x53, 0x1b, 0xbd, 0x38, 0x5f, 0x18, 0xe8, 0x62, - 0x61, 0xa0, 0x5f, 0x0b, 0x03, 0x7d, 0x5b, 0x1a, 0xda, 0xc5, 0xd2, 0xd0, 0x7e, 0x2c, 0x0d, 0xed, - 0xc3, 0xe3, 0xff, 0xce, 0xf3, 0x49, 0x79, 0xfd, 0xd4, 0x64, 0x4f, 0x5b, 0xea, 0xd6, 0x3d, 0xfd, - 0x13, 0x00, 0x00, 0xff, 0xff, 0xff, 0x85, 0xad, 0xc8, 0xf1, 0x03, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Exported { - i-- - if m.Exported { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if len(m.Redelegations) > 0 { - for iNdEx := len(m.Redelegations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Redelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.UnbondingDelegations) > 0 { - for iNdEx := len(m.UnbondingDelegations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingDelegations[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.Delegations) > 0 { - for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Delegations[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.Validators) > 0 { - for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.LastValidatorPowers) > 0 { - for iNdEx := len(m.LastValidatorPowers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LastValidatorPowers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - { - size := m.LastTotalPower.Size() - i -= size - if _, err := m.LastTotalPower.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LastValidatorPower) 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 *LastValidatorPower) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LastValidatorPower) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Power != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Power)) - i-- - dAtA[i] = 0x10 - } - 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 - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - l = m.LastTotalPower.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.LastValidatorPowers) > 0 { - for _, e := range m.LastValidatorPowers { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Validators) > 0 { - for _, e := range m.Validators { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Delegations) > 0 { - for _, e := range m.Delegations { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.UnbondingDelegations) > 0 { - for _, e := range m.UnbondingDelegations { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Redelegations) > 0 { - for _, e := range m.Redelegations { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.Exported { - n += 2 - } - return n -} - -func (m *LastValidatorPower) 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)) - } - if m.Power != 0 { - n += 1 + sovGenesis(uint64(m.Power)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} - -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTotalPower", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastTotalPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastValidatorPowers", 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.LastValidatorPowers = append(m.LastValidatorPowers, LastValidatorPower{}) - if err := m.LastValidatorPowers[len(m.LastValidatorPowers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", 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.Validators = append(m.Validators, Validator{}) - if err := m.Validators[len(m.Validators)-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 Delegations", 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.Delegations = append(m.Delegations, Delegation{}) - if err := m.Delegations[len(m.Delegations)-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 UnbondingDelegations", 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.UnbondingDelegations = append(m.UnbondingDelegations, UnbondingDelegation{}) - if err := m.UnbondingDelegations[len(m.UnbondingDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Redelegations", 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.Redelegations = append(m.Redelegations, Redelegation{}) - if err := m.Redelegations[len(m.Redelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exported", 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.Exported = bool(v != 0) - 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 *LastValidatorPower) 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: LastValidatorPower: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LastValidatorPower: 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 != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) - } - m.Power = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Power |= int64(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 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/staking/legacy/v040/keys.go b/x/staking/legacy/v040/keys.go deleted file mode 100644 index 9f8c282306a..00000000000 --- a/x/staking/legacy/v040/keys.go +++ /dev/null @@ -1,326 +0,0 @@ -// Package v040 is copy-pasted from: -// https://github.com/cosmos/cosmos-sdk/blob/v0.41.0/x/staking/types/keys.go -package v040 - -import ( - "bytes" - "encoding/binary" - "fmt" - "strconv" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" - v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -const ( - // ModuleName is the name of the staking module - ModuleName = "staking" - - // StoreKey is the string store representation - StoreKey = ModuleName - - // QuerierRoute is the querier route for the staking module - QuerierRoute = ModuleName - - // RouterKey is the msg router key for the staking module - RouterKey = ModuleName -) - -var ( - // Keys for store prefixes - // Last* values are constant during a block. - LastValidatorPowerKey = []byte{0x11} // prefix for each key to a validator index, for bonded validators - LastTotalPowerKey = []byte{0x12} // prefix for the total power - - ValidatorsKey = []byte{0x21} // prefix for each key to a validator - ValidatorsByConsAddrKey = []byte{0x22} // prefix for each key to a validator index, by pubkey - ValidatorsByPowerIndexKey = []byte{0x23} // prefix for each key to a validator index, sorted by power - - DelegationKey = []byte{0x31} // key for a delegation - UnbondingDelegationKey = []byte{0x32} // key for an unbonding-delegation - UnbondingDelegationByValIndexKey = []byte{0x33} // prefix for each key for an unbonding-delegation, by validator operator - RedelegationKey = []byte{0x34} // key for a redelegation - RedelegationByValSrcIndexKey = []byte{0x35} // prefix for each key for an redelegation, by source validator operator - RedelegationByValDstIndexKey = []byte{0x36} // prefix for each key for an redelegation, by destination validator operator - - UnbondingQueueKey = []byte{0x41} // prefix for the timestamps in unbonding queue - RedelegationQueueKey = []byte{0x42} // prefix for the timestamps in redelegations queue - ValidatorQueueKey = []byte{0x43} // prefix for the timestamps in validator queue - - HistoricalInfoKey = []byte{0x50} // prefix for the historical info -) - -// gets the key for the validator with address -// VALUE: staking/Validator -func GetValidatorKey(operatorAddr sdk.ValAddress) []byte { - return append(ValidatorsKey, operatorAddr.Bytes()...) -} - -// gets the key for the validator with pubkey -// VALUE: validator operator address ([]byte) -func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte { - return append(ValidatorsByConsAddrKey, addr.Bytes()...) -} - -// Get the validator operator address from LastValidatorPowerKey -func AddressFromLastValidatorPowerKey(key []byte) []byte { - kv.AssertKeyAtLeastLength(key, 2) - return key[1:] // remove prefix bytes -} - -// get the validator by power index. -// Power index is the key used in the power-store, and represents the relative -// power ranking of the validator. -// VALUE: validator operator address ([]byte) -func GetValidatorsByPowerIndexKey(validator types.Validator) []byte { - // NOTE the address doesn't need to be stored because counter bytes must always be different - // NOTE the larger values are of higher value - - consensusPower := sdk.TokensToConsensusPower(validator.Tokens, sdk.DefaultPowerReduction) - consensusPowerBytes := make([]byte, 8) - binary.BigEndian.PutUint64(consensusPowerBytes, uint64(consensusPower)) - - powerBytes := consensusPowerBytes - powerBytesLen := len(powerBytes) // 8 - - // key is of format prefix || powerbytes || addrBytes - key := make([]byte, 1+powerBytesLen+v040auth.AddrLen) - - key[0] = ValidatorsByPowerIndexKey[0] - copy(key[1:powerBytesLen+1], powerBytes) - addr, err := sdk.ValAddressFromBech32(validator.OperatorAddress) - if err != nil { - panic(err) - } - operAddrInvr := sdk.CopyBytes(addr) - - for i, b := range operAddrInvr { - operAddrInvr[i] = ^b - } - - copy(key[powerBytesLen+1:], operAddrInvr) - - return key -} - -// get the bonded validator index key for an operator address -func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte { - return append(LastValidatorPowerKey, operator...) -} - -// parse the validators operator address from power rank key -func ParseValidatorPowerRankKey(key []byte) (operAddr []byte) { - powerBytesLen := 8 - kv.AssertKeyLength(key, 1+powerBytesLen+v040auth.AddrLen) - - operAddr = sdk.CopyBytes(key[powerBytesLen+1:]) - - for i, b := range operAddr { - operAddr[i] = ^b - } - - return operAddr -} - -// GetValidatorQueueKey returns the prefix key used for getting a set of unbonding -// validators whose unbonding completion occurs at the given time and height. -func GetValidatorQueueKey(timestamp time.Time, height int64) []byte { - heightBz := sdk.Uint64ToBigEndian(uint64(height)) - timeBz := sdk.FormatTimeBytes(timestamp) - timeBzL := len(timeBz) - prefixL := len(ValidatorQueueKey) - - bz := make([]byte, prefixL+8+timeBzL+8) - - // copy the prefix - copy(bz[:prefixL], ValidatorQueueKey) - - // copy the encoded time bytes length - copy(bz[prefixL:prefixL+8], sdk.Uint64ToBigEndian(uint64(timeBzL))) - - // copy the encoded time bytes - copy(bz[prefixL+8:prefixL+8+timeBzL], timeBz) - - // copy the encoded height - copy(bz[prefixL+8+timeBzL:], heightBz) - - return bz -} - -// ParseValidatorQueueKey returns the encoded time and height from a key created -// from GetValidatorQueueKey. -func ParseValidatorQueueKey(bz []byte) (time.Time, int64, error) { - prefixL := len(ValidatorQueueKey) - if prefix := bz[:prefixL]; !bytes.Equal(prefix, ValidatorQueueKey) { - return time.Time{}, 0, fmt.Errorf("invalid prefix; expected: %X, got: %X", ValidatorQueueKey, prefix) - } - - timeBzL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) - ts, err := sdk.ParseTimeBytes(bz[prefixL+8 : prefixL+8+int(timeBzL)]) - if err != nil { - return time.Time{}, 0, err - } - - height := sdk.BigEndianToUint64(bz[prefixL+8+int(timeBzL):]) - - return ts, int64(height), nil -} - -// gets the key for delegator bond with validator -// VALUE: staking/Delegation -func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(GetDelegationsKey(delAddr), valAddr.Bytes()...) -} - -// gets the prefix for a delegator for all validators -func GetDelegationsKey(delAddr sdk.AccAddress) []byte { - return append(DelegationKey, delAddr.Bytes()...) -} - -// gets the key for an unbonding delegation by delegator and validator addr -// VALUE: staking/UnbondingDelegation -func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append( - GetUBDsKey(delAddr.Bytes()), - valAddr.Bytes()...) -} - -// gets the index-key for an unbonding delegation, stored by validator-index -// VALUE: none (key rearrangement used) -func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(GetUBDsByValIndexKey(valAddr), delAddr.Bytes()...) -} - -// rearranges the ValIndexKey to get the UBDKey -func GetUBDKeyFromValIndexKey(indexKey []byte) []byte { - kv.AssertKeyAtLeastLength(indexKey, 2) - addrs := indexKey[1:] // remove prefix bytes - kv.AssertKeyLength(addrs, 2*v040auth.AddrLen) - - kv.AssertKeyAtLeastLength(addrs, v040auth.AddrLen+1) - valAddr := addrs[:v040auth.AddrLen] - delAddr := addrs[v040auth.AddrLen:] - - return GetUBDKey(delAddr, valAddr) -} - -// gets the prefix for all unbonding delegations from a delegator -func GetUBDsKey(delAddr sdk.AccAddress) []byte { - return append(UnbondingDelegationKey, delAddr.Bytes()...) -} - -// gets the prefix keyspace for the indexes of unbonding delegations for a validator -func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte { - return append(UnbondingDelegationByValIndexKey, valAddr.Bytes()...) -} - -// gets the prefix for all unbonding delegations from a delegator -func GetUnbondingDelegationTimeKey(timestamp time.Time) []byte { - bz := sdk.FormatTimeBytes(timestamp) - return append(UnbondingQueueKey, bz...) -} - -// GetREDKey returns a key prefix for indexing a redelegation from a delegator -// and source validator to a destination validator. -func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte { - key := make([]byte, 1+v040auth.AddrLen*3) - - copy(key[0:v040auth.AddrLen+1], GetREDsKey(delAddr.Bytes())) - copy(key[v040auth.AddrLen+1:2*v040auth.AddrLen+1], valSrcAddr.Bytes()) - copy(key[2*v040auth.AddrLen+1:3*v040auth.AddrLen+1], valDstAddr.Bytes()) - - return key -} - -// gets the index-key for a redelegation, stored by source-validator-index -// VALUE: none (key rearrangement used) -func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte { - REDSFromValsSrcKey := GetREDsFromValSrcIndexKey(valSrcAddr) - offset := len(REDSFromValsSrcKey) - - // key is of the form REDSFromValsSrcKey || delAddr || valDstAddr - key := make([]byte, len(REDSFromValsSrcKey)+2*v040auth.AddrLen) - copy(key[0:offset], REDSFromValsSrcKey) - copy(key[offset:offset+v040auth.AddrLen], delAddr.Bytes()) - copy(key[offset+v040auth.AddrLen:offset+2*v040auth.AddrLen], valDstAddr.Bytes()) - - return key -} - -// gets the index-key for a redelegation, stored by destination-validator-index -// VALUE: none (key rearrangement used) -func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte { - REDSToValsDstKey := GetREDsToValDstIndexKey(valDstAddr) - offset := len(REDSToValsDstKey) - - // key is of the form REDSToValsDstKey || delAddr || valSrcAddr - key := make([]byte, len(REDSToValsDstKey)+2*v040auth.AddrLen) - copy(key[0:offset], REDSToValsDstKey) - copy(key[offset:offset+v040auth.AddrLen], delAddr.Bytes()) - copy(key[offset+v040auth.AddrLen:offset+2*v040auth.AddrLen], valSrcAddr.Bytes()) - - return key -} - -// GetREDKeyFromValSrcIndexKey rearranges the ValSrcIndexKey to get the REDKey -func GetREDKeyFromValSrcIndexKey(indexKey []byte) []byte { - // note that first byte is prefix byte - kv.AssertKeyLength(indexKey, 3*v040auth.AddrLen+1) - - valSrcAddr := indexKey[1 : v040auth.AddrLen+1] - delAddr := indexKey[v040auth.AddrLen+1 : 2*v040auth.AddrLen+1] - valDstAddr := indexKey[2*v040auth.AddrLen+1 : 3*v040auth.AddrLen+1] - - return GetREDKey(delAddr, valSrcAddr, valDstAddr) -} - -// GetREDKeyFromValDstIndexKey rearranges the ValDstIndexKey to get the REDKey -func GetREDKeyFromValDstIndexKey(indexKey []byte) []byte { - // note that first byte is prefix byte - kv.AssertKeyLength(indexKey, 3*v040auth.AddrLen+1) - - valDstAddr := indexKey[1 : v040auth.AddrLen+1] - delAddr := indexKey[v040auth.AddrLen+1 : 2*v040auth.AddrLen+1] - valSrcAddr := indexKey[2*v040auth.AddrLen+1 : 3*v040auth.AddrLen+1] - - return GetREDKey(delAddr, valSrcAddr, valDstAddr) -} - -// GetRedelegationTimeKey returns a key prefix for indexing an unbonding -// redelegation based on a completion time. -func GetRedelegationTimeKey(timestamp time.Time) []byte { - bz := sdk.FormatTimeBytes(timestamp) - return append(RedelegationQueueKey, bz...) -} - -// GetREDsKey returns a key prefix for indexing a redelegation from a delegator -// address. -func GetREDsKey(delAddr sdk.AccAddress) []byte { - return append(RedelegationKey, delAddr.Bytes()...) -} - -// GetREDsFromValSrcIndexKey returns a key prefix for indexing a redelegation to -// a source validator. -func GetREDsFromValSrcIndexKey(valSrcAddr sdk.ValAddress) []byte { - return append(RedelegationByValSrcIndexKey, valSrcAddr.Bytes()...) -} - -// GetREDsToValDstIndexKey returns a key prefix for indexing a redelegation to a -// destination (target) validator. -func GetREDsToValDstIndexKey(valDstAddr sdk.ValAddress) []byte { - return append(RedelegationByValDstIndexKey, valDstAddr.Bytes()...) -} - -// GetREDsByDelToValDstIndexKey returns a key prefix for indexing a redelegation -// from an address to a source validator. -func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) []byte { - return append(GetREDsToValDstIndexKey(valDstAddr), delAddr.Bytes()...) -} - -// GetHistoricalInfoKey returns a key prefix for indexing HistoricalInfo objects. -func GetHistoricalInfoKey(height int64) []byte { - return append(HistoricalInfoKey, []byte(strconv.FormatInt(height, 10))...) -} diff --git a/x/staking/legacy/v040/migrate.go b/x/staking/legacy/v040/migrate.go deleted file mode 100644 index a0d9b4c9037..00000000000 --- a/x/staking/legacy/v040/migrate.go +++ /dev/null @@ -1,140 +0,0 @@ -package v040 - -import ( - "fmt" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - v034staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v034" - v038staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v038" -) - -func migrateBondStatus(oldStatus v034staking.BondStatus) BondStatus { - switch oldStatus { - case v034staking.Unbonded: - return Unbonded - - case v034staking.Unbonding: - return Unbonding - - case v034staking.Bonded: - return Bonded - - default: - panic(fmt.Errorf("invalid bond status %d", oldStatus)) - } -} - -// Migrate accepts exported v0.38 x/staking genesis state and migrates it to -// v0.40 x/staking genesis state. The migration includes: -// -// - Convert addresses from bytes to bech32 strings. -// - Update BondStatus staking constants. -// - Re-encode in v0.40 GenesisState. -func Migrate(stakingState v038staking.GenesisState) *GenesisState { - newLastValidatorPowers := make([]LastValidatorPower, len(stakingState.LastValidatorPowers)) - for i, oldLastValidatorPower := range stakingState.LastValidatorPowers { - newLastValidatorPowers[i] = LastValidatorPower{ - Address: oldLastValidatorPower.Address.String(), - Power: oldLastValidatorPower.Power, - } - } - - newValidators := make([]Validator, len(stakingState.Validators)) - for i, oldValidator := range stakingState.Validators { - pkAny, err := codectypes.NewAnyWithValue(oldValidator.ConsPubKey) - if err != nil { - panic(fmt.Sprintf("Can't pack validator consensus PK as Any: %s", err)) - } - newValidators[i] = Validator{ - OperatorAddress: oldValidator.OperatorAddress.String(), - ConsensusPubkey: pkAny, - Jailed: oldValidator.Jailed, - Status: migrateBondStatus(oldValidator.Status), - Tokens: oldValidator.Tokens, - DelegatorShares: oldValidator.DelegatorShares, - Description: Description{ - Moniker: oldValidator.Description.Moniker, - Identity: oldValidator.Description.Identity, - Website: oldValidator.Description.Website, - SecurityContact: oldValidator.Description.SecurityContact, - Details: oldValidator.Description.Details, - }, - UnbondingHeight: oldValidator.UnbondingHeight, - UnbondingTime: oldValidator.UnbondingCompletionTime, - Commission: Commission{ - CommissionRates: CommissionRates{ - Rate: oldValidator.Commission.Rate, - MaxRate: oldValidator.Commission.MaxRate, - MaxChangeRate: oldValidator.Commission.MaxChangeRate, - }, - UpdateTime: oldValidator.Commission.UpdateTime, - }, - MinSelfDelegation: oldValidator.MinSelfDelegation, - } - } - - newDelegations := make([]Delegation, len(stakingState.Delegations)) - for i, oldDelegation := range stakingState.Delegations { - newDelegations[i] = Delegation{ - DelegatorAddress: oldDelegation.DelegatorAddress.String(), - ValidatorAddress: oldDelegation.ValidatorAddress.String(), - Shares: oldDelegation.Shares, - } - } - - newUnbondingDelegations := make([]UnbondingDelegation, len(stakingState.UnbondingDelegations)) - for i, oldUnbondingDelegation := range stakingState.UnbondingDelegations { - newEntries := make([]UnbondingDelegationEntry, len(oldUnbondingDelegation.Entries)) - for j, oldEntry := range oldUnbondingDelegation.Entries { - newEntries[j] = UnbondingDelegationEntry{ - CreationHeight: oldEntry.CreationHeight, - CompletionTime: oldEntry.CompletionTime, - InitialBalance: oldEntry.InitialBalance, - Balance: oldEntry.Balance, - } - } - - newUnbondingDelegations[i] = UnbondingDelegation{ - DelegatorAddress: oldUnbondingDelegation.DelegatorAddress.String(), - ValidatorAddress: oldUnbondingDelegation.ValidatorAddress.String(), - Entries: newEntries, - } - } - - newRedelegations := make([]Redelegation, len(stakingState.Redelegations)) - for i, oldRedelegation := range stakingState.Redelegations { - newEntries := make([]RedelegationEntry, len(oldRedelegation.Entries)) - for j, oldEntry := range oldRedelegation.Entries { - newEntries[j] = RedelegationEntry{ - CreationHeight: oldEntry.CreationHeight, - CompletionTime: oldEntry.CompletionTime, - InitialBalance: oldEntry.InitialBalance, - SharesDst: oldEntry.SharesDst, - } - } - - newRedelegations[i] = Redelegation{ - DelegatorAddress: oldRedelegation.DelegatorAddress.String(), - ValidatorSrcAddress: oldRedelegation.ValidatorSrcAddress.String(), - ValidatorDstAddress: oldRedelegation.ValidatorDstAddress.String(), - Entries: newEntries, - } - } - - return &GenesisState{ - Params: Params{ - UnbondingTime: stakingState.Params.UnbondingTime, - MaxValidators: uint32(stakingState.Params.MaxValidators), - MaxEntries: uint32(stakingState.Params.MaxEntries), - HistoricalEntries: uint32(stakingState.Params.HistoricalEntries), - BondDenom: stakingState.Params.BondDenom, - }, - LastTotalPower: stakingState.LastTotalPower, - LastValidatorPowers: newLastValidatorPowers, - Validators: newValidators, - Delegations: newDelegations, - UnbondingDelegations: newUnbondingDelegations, - Redelegations: newRedelegations, - Exported: stakingState.Exported, - } -} diff --git a/x/staking/legacy/v040/migrate_test.go b/x/staking/legacy/v040/migrate_test.go deleted file mode 100644 index af409dde26b..00000000000 --- a/x/staking/legacy/v040/migrate_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package v040_test - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/simapp" - v034staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v034" - v038staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v038" - v040staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v040" -) - -func TestMigrate(t *testing.T) { - encodingConfig := simapp.MakeTestEncodingConfig() - clientCtx := client.Context{}. - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithJSONCodec(encodingConfig.Marshaler) - - consPubKey := ed25519.GenPrivKeyFromSecret([]byte("val0")).PubKey() - stakingGenState := v038staking.GenesisState{ - Validators: v038staking.Validators{v038staking.Validator{ - ConsPubKey: consPubKey, - Status: v034staking.Unbonded, - }}, - } - - migrated := v040staking.Migrate(stakingGenState) - - bz, err := clientCtx.Codec.MarshalJSON(migrated) - require.NoError(t, err) - - // Indent the JSON bz correctly. - var jsonObj map[string]interface{} - err = json.Unmarshal(bz, &jsonObj) - require.NoError(t, err) - indentedBz, err := json.MarshalIndent(jsonObj, "", " ") - require.NoError(t, err) - - // Make sure about: - // - consensus_pubkey: should be an any - // - validator's status should be 1 (new unbonded) - expected := `{ - "delegations": [], - "exported": false, - "last_total_power": "0", - "last_validator_powers": [], - "params": { - "bond_denom": "", - "historical_entries": 0, - "max_entries": 0, - "max_validators": 0, - "unbonding_time": "0s" - }, - "redelegations": [], - "unbonding_delegations": [], - "validators": [ - { - "commission": { - "commission_rates": { - "max_change_rate": "0", - "max_rate": "0", - "rate": "0" - }, - "update_time": "0001-01-01T00:00:00Z" - }, - "consensus_pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "KTeVrjP7NJIufvgMJsQRxZjfFyD+Exda6O7x+oxIvmA=" - }, - "delegator_shares": "0", - "description": { - "details": "", - "identity": "", - "moniker": "", - "security_contact": "", - "website": "" - }, - "jailed": false, - "min_self_delegation": "0", - "operator_address": "", - "status": "BOND_STATUS_UNBONDED", - "tokens": "0", - "unbonding_height": "0", - "unbonding_time": "0001-01-01T00:00:00Z" - } - ] -}` - - require.Equal(t, expected, string(indentedBz)) -} diff --git a/x/staking/legacy/v040/staking.pb.go b/x/staking/legacy/v040/staking.pb.go deleted file mode 100644 index 3357e826410..00000000000 --- a/x/staking/legacy/v040/staking.pb.go +++ /dev/null @@ -1,6663 +0,0 @@ -// Package v040 is taken from: -// https://github.com/cosmos/cosmos-sdk/blob/v0.40.1/x/staking/types/staking.pb.go -// nolint -package v040 - -import ( - bytes "bytes" - compress_gzip "compress/gzip" - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" - time "time" - - types1 "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" - _ "github.com/gogo/protobuf/gogoproto" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_protoc_gen_gogo_descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" - _ "github.com/golang/protobuf/ptypes/timestamp" - _ "github.com/regen-network/cosmos-proto" - types "github.com/tendermint/tendermint/proto/tendermint/types" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal - -var ( - _ = fmt.Errorf - _ = math.Inf - _ = 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 - -// BondStatus is the status of a validator. -type BondStatus int32 - -const ( - // UNSPECIFIED defines an invalid validator status. - Unspecified BondStatus = 0 - // UNBONDED defines a validator that is not bonded. - Unbonded BondStatus = 1 - // UNBONDING defines a validator that is unbonding. - Unbonding BondStatus = 2 - // BONDED defines a validator that is bonded. - Bonded BondStatus = 3 -) - -var BondStatus_name = map[int32]string{ - 0: "BOND_STATUS_UNSPECIFIED", - 1: "BOND_STATUS_UNBONDED", - 2: "BOND_STATUS_UNBONDING", - 3: "BOND_STATUS_BONDED", -} - -var BondStatus_value = map[string]int32{ - "BOND_STATUS_UNSPECIFIED": 0, - "BOND_STATUS_UNBONDED": 1, - "BOND_STATUS_UNBONDING": 2, - "BOND_STATUS_BONDED": 3, -} - -func (x BondStatus) String() string { - return proto.EnumName(BondStatus_name, int32(x)) -} - -func (BondStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{0} -} - -// 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). -type HistoricalInfo struct { - Header types.Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header"` - Valset []Validator `protobuf:"bytes,2,rep,name=valset,proto3" json:"valset"` -} - -func (m *HistoricalInfo) Reset() { *m = HistoricalInfo{} } -func (m *HistoricalInfo) String() string { return proto.CompactTextString(m) } -func (*HistoricalInfo) ProtoMessage() {} -func (*HistoricalInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{0} -} - -func (m *HistoricalInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *HistoricalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HistoricalInfo.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 *HistoricalInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistoricalInfo.Merge(m, src) -} - -func (m *HistoricalInfo) XXX_Size() int { - return m.Size() -} - -func (m *HistoricalInfo) XXX_DiscardUnknown() { - xxx_messageInfo_HistoricalInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_HistoricalInfo proto.InternalMessageInfo - -func (m *HistoricalInfo) GetHeader() types.Header { - if m != nil { - return m.Header - } - return types.Header{} -} - -func (m *HistoricalInfo) GetValset() []Validator { - if m != nil { - return m.Valset - } - return nil -} - -// CommissionRates defines the initial commission rates to be used for creating -// a validator. -type CommissionRates struct { - Rate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate"` - MaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=max_rate,json=maxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_rate" yaml:"max_rate"` - MaxChangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=max_change_rate,json=maxChangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_change_rate" yaml:"max_change_rate"` -} - -func (m *CommissionRates) Reset() { *m = CommissionRates{} } -func (*CommissionRates) ProtoMessage() {} -func (*CommissionRates) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{1} -} - -func (m *CommissionRates) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *CommissionRates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CommissionRates.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 *CommissionRates) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommissionRates.Merge(m, src) -} - -func (m *CommissionRates) XXX_Size() int { - return m.Size() -} - -func (m *CommissionRates) XXX_DiscardUnknown() { - xxx_messageInfo_CommissionRates.DiscardUnknown(m) -} - -var xxx_messageInfo_CommissionRates proto.InternalMessageInfo - -// Commission defines commission parameters for a given validator. -type Commission struct { - CommissionRates `protobuf:"bytes,1,opt,name=commission_rates,json=commissionRates,proto3,embedded=commission_rates" json:"commission_rates"` - UpdateTime time.Time `protobuf:"bytes,2,opt,name=update_time,json=updateTime,proto3,stdtime" json:"update_time" yaml:"update_time"` -} - -func (m *Commission) Reset() { *m = Commission{} } -func (*Commission) ProtoMessage() {} -func (*Commission) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{2} -} - -func (m *Commission) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *Commission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Commission.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 *Commission) XXX_Merge(src proto.Message) { - xxx_messageInfo_Commission.Merge(m, src) -} - -func (m *Commission) XXX_Size() int { - return m.Size() -} - -func (m *Commission) XXX_DiscardUnknown() { - xxx_messageInfo_Commission.DiscardUnknown(m) -} - -var xxx_messageInfo_Commission proto.InternalMessageInfo - -func (m *Commission) GetUpdateTime() time.Time { - if m != nil { - return m.UpdateTime - } - return time.Time{} -} - -// Description defines a validator description. -type Description struct { - Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` - Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` - Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` - SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty" yaml:"security_contact"` - Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` -} - -func (m *Description) Reset() { *m = Description{} } -func (*Description) ProtoMessage() {} -func (*Description) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []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 "" -} - -// 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. -type Validator struct { - OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty" yaml:"operator_address"` - ConsensusPubkey *types1.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"` - Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` - Status BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty"` - 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"` - DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` - Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` - UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` - UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` - Commission Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` - MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` -} - -func (m *Validator) Reset() { *m = Validator{} } -func (*Validator) ProtoMessage() {} -func (*Validator) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{4} -} - -func (m *Validator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Validator.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 *Validator) XXX_Merge(src proto.Message) { - xxx_messageInfo_Validator.Merge(m, src) -} - -func (m *Validator) XXX_Size() int { - return m.Size() -} - -func (m *Validator) XXX_DiscardUnknown() { - xxx_messageInfo_Validator.DiscardUnknown(m) -} - -var xxx_messageInfo_Validator proto.InternalMessageInfo - -// ValAddresses defines a repeated set of validator addresses. -type ValAddresses struct { - Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` -} - -func (m *ValAddresses) Reset() { *m = ValAddresses{} } -func (*ValAddresses) ProtoMessage() {} -func (*ValAddresses) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{5} -} - -func (m *ValAddresses) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *ValAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValAddresses.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 *ValAddresses) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValAddresses.Merge(m, src) -} - -func (m *ValAddresses) XXX_Size() int { - return m.Size() -} - -func (m *ValAddresses) XXX_DiscardUnknown() { - xxx_messageInfo_ValAddresses.DiscardUnknown(m) -} - -var xxx_messageInfo_ValAddresses proto.InternalMessageInfo - -func (m *ValAddresses) GetAddresses() []string { - if m != nil { - return m.Addresses - } - return nil -} - -// 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. -type DVPair struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` -} - -func (m *DVPair) Reset() { *m = DVPair{} } -func (*DVPair) ProtoMessage() {} -func (*DVPair) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{6} -} - -func (m *DVPair) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *DVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVPair.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 *DVPair) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVPair.Merge(m, src) -} - -func (m *DVPair) XXX_Size() int { - return m.Size() -} - -func (m *DVPair) XXX_DiscardUnknown() { - xxx_messageInfo_DVPair.DiscardUnknown(m) -} - -var xxx_messageInfo_DVPair proto.InternalMessageInfo - -// DVPairs defines an array of DVPair objects. -type DVPairs struct { - Pairs []DVPair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"` -} - -func (m *DVPairs) Reset() { *m = DVPairs{} } -func (m *DVPairs) String() string { return proto.CompactTextString(m) } -func (*DVPairs) ProtoMessage() {} -func (*DVPairs) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{7} -} - -func (m *DVPairs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *DVPairs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVPairs.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 *DVPairs) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVPairs.Merge(m, src) -} - -func (m *DVPairs) XXX_Size() int { - return m.Size() -} - -func (m *DVPairs) XXX_DiscardUnknown() { - xxx_messageInfo_DVPairs.DiscardUnknown(m) -} - -var xxx_messageInfo_DVPairs proto.InternalMessageInfo - -func (m *DVPairs) GetPairs() []DVPair { - if m != nil { - return m.Pairs - } - return nil -} - -// 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. -type DVVTriplet struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` -} - -func (m *DVVTriplet) Reset() { *m = DVVTriplet{} } -func (*DVVTriplet) ProtoMessage() {} -func (*DVVTriplet) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{8} -} - -func (m *DVVTriplet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *DVVTriplet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVVTriplet.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 *DVVTriplet) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVVTriplet.Merge(m, src) -} - -func (m *DVVTriplet) XXX_Size() int { - return m.Size() -} - -func (m *DVVTriplet) XXX_DiscardUnknown() { - xxx_messageInfo_DVVTriplet.DiscardUnknown(m) -} - -var xxx_messageInfo_DVVTriplet proto.InternalMessageInfo - -// DVVTriplets defines an array of DVVTriplet objects. -type DVVTriplets struct { - Triplets []DVVTriplet `protobuf:"bytes,1,rep,name=triplets,proto3" json:"triplets"` -} - -func (m *DVVTriplets) Reset() { *m = DVVTriplets{} } -func (m *DVVTriplets) String() string { return proto.CompactTextString(m) } -func (*DVVTriplets) ProtoMessage() {} -func (*DVVTriplets) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{9} -} - -func (m *DVVTriplets) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *DVVTriplets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVVTriplets.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 *DVVTriplets) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVVTriplets.Merge(m, src) -} - -func (m *DVVTriplets) XXX_Size() int { - return m.Size() -} - -func (m *DVVTriplets) XXX_DiscardUnknown() { - xxx_messageInfo_DVVTriplets.DiscardUnknown(m) -} - -var xxx_messageInfo_DVVTriplets proto.InternalMessageInfo - -func (m *DVVTriplets) GetTriplets() []DVVTriplet { - if m != nil { - return m.Triplets - } - return nil -} - -// 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. -type Delegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` - Shares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"shares"` -} - -func (m *Delegation) Reset() { *m = Delegation{} } -func (*Delegation) ProtoMessage() {} -func (*Delegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{10} -} - -func (m *Delegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Delegation.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 *Delegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Delegation.Merge(m, src) -} - -func (m *Delegation) XXX_Size() int { - return m.Size() -} - -func (m *Delegation) XXX_DiscardUnknown() { - xxx_messageInfo_Delegation.DiscardUnknown(m) -} - -var xxx_messageInfo_Delegation proto.InternalMessageInfo - -// UnbondingDelegation stores all of a single delegator's unbonding bonds -// for a single validator in an time-ordered list. -type UnbondingDelegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` - Entries []UnbondingDelegationEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries"` -} - -func (m *UnbondingDelegation) Reset() { *m = UnbondingDelegation{} } -func (*UnbondingDelegation) ProtoMessage() {} -func (*UnbondingDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{11} -} - -func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *UnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnbondingDelegation.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 *UnbondingDelegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnbondingDelegation.Merge(m, src) -} - -func (m *UnbondingDelegation) XXX_Size() int { - return m.Size() -} - -func (m *UnbondingDelegation) XXX_DiscardUnknown() { - xxx_messageInfo_UnbondingDelegation.DiscardUnknown(m) -} - -var xxx_messageInfo_UnbondingDelegation proto.InternalMessageInfo - -// UnbondingDelegationEntry defines an unbonding object with relevant metadata. -type UnbondingDelegationEntry struct { - CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` - CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_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"` -} - -func (m *UnbondingDelegationEntry) Reset() { *m = UnbondingDelegationEntry{} } -func (*UnbondingDelegationEntry) ProtoMessage() {} -func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{12} -} - -func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *UnbondingDelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnbondingDelegationEntry.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 *UnbondingDelegationEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnbondingDelegationEntry.Merge(m, src) -} - -func (m *UnbondingDelegationEntry) XXX_Size() int { - return m.Size() -} - -func (m *UnbondingDelegationEntry) XXX_DiscardUnknown() { - xxx_messageInfo_UnbondingDelegationEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_UnbondingDelegationEntry proto.InternalMessageInfo - -func (m *UnbondingDelegationEntry) GetCreationHeight() int64 { - if m != nil { - return m.CreationHeight - } - return 0 -} - -func (m *UnbondingDelegationEntry) GetCompletionTime() time.Time { - if m != nil { - return m.CompletionTime - } - return time.Time{} -} - -// RedelegationEntry defines a redelegation object with relevant metadata. -type RedelegationEntry struct { - CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` - CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_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"` - SharesDst github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=shares_dst,json=sharesDst,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"shares_dst"` -} - -func (m *RedelegationEntry) Reset() { *m = RedelegationEntry{} } -func (*RedelegationEntry) ProtoMessage() {} -func (*RedelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{13} -} - -func (m *RedelegationEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *RedelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RedelegationEntry.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 *RedelegationEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedelegationEntry.Merge(m, src) -} - -func (m *RedelegationEntry) XXX_Size() int { - return m.Size() -} - -func (m *RedelegationEntry) XXX_DiscardUnknown() { - xxx_messageInfo_RedelegationEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_RedelegationEntry proto.InternalMessageInfo - -func (m *RedelegationEntry) GetCreationHeight() int64 { - if m != nil { - return m.CreationHeight - } - return 0 -} - -func (m *RedelegationEntry) GetCompletionTime() time.Time { - if m != nil { - return m.CompletionTime - } - return time.Time{} -} - -// Redelegation contains the list of a particular delegator's redelegating bonds -// from a particular source validator to a particular destination validator. -type Redelegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` - Entries []RedelegationEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"` -} - -func (m *Redelegation) Reset() { *m = Redelegation{} } -func (*Redelegation) ProtoMessage() {} -func (*Redelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{14} -} - -func (m *Redelegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *Redelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Redelegation.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 *Redelegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Redelegation.Merge(m, src) -} - -func (m *Redelegation) XXX_Size() int { - return m.Size() -} - -func (m *Redelegation) XXX_DiscardUnknown() { - xxx_messageInfo_Redelegation.DiscardUnknown(m) -} - -var xxx_messageInfo_Redelegation proto.InternalMessageInfo - -// Params defines the parameters for the staking module. -type Params struct { - UnbondingTime time.Duration `protobuf:"bytes,1,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time" yaml:"unbonding_time"` - MaxValidators uint32 `protobuf:"varint,2,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty" yaml:"max_validators"` - MaxEntries uint32 `protobuf:"varint,3,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty" yaml:"max_entries"` - HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty" yaml:"historical_entries"` - BondDenom string `protobuf:"bytes,5,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{15} -} - -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) GetUnbondingTime() time.Duration { - if m != nil { - return m.UnbondingTime - } - return 0 -} - -func (m *Params) GetMaxValidators() uint32 { - if m != nil { - return m.MaxValidators - } - return 0 -} - -func (m *Params) GetMaxEntries() uint32 { - if m != nil { - return m.MaxEntries - } - return 0 -} - -func (m *Params) GetHistoricalEntries() uint32 { - if m != nil { - return m.HistoricalEntries - } - return 0 -} - -func (m *Params) GetBondDenom() string { - if m != nil { - return m.BondDenom - } - return "" -} - -// DelegationResponse is equivalent to Delegation except that it contains a -// balance in addition to shares which is more suitable for client responses. -type DelegationResponse struct { - Delegation Delegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` - Balance types2.Coin `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"` -} - -func (m *DelegationResponse) Reset() { *m = DelegationResponse{} } -func (*DelegationResponse) ProtoMessage() {} -func (*DelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{16} -} - -func (m *DelegationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *DelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DelegationResponse.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 *DelegationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DelegationResponse.Merge(m, src) -} - -func (m *DelegationResponse) XXX_Size() int { - return m.Size() -} - -func (m *DelegationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DelegationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DelegationResponse proto.InternalMessageInfo - -func (m *DelegationResponse) GetDelegation() Delegation { - if m != nil { - return m.Delegation - } - return Delegation{} -} - -func (m *DelegationResponse) GetBalance() types2.Coin { - if m != nil { - return m.Balance - } - return types2.Coin{} -} - -// RedelegationEntryResponse is equivalent to a RedelegationEntry except that it -// contains a balance in addition to shares which is more suitable for client -// responses. -type RedelegationEntryResponse struct { - RedelegationEntry RedelegationEntry `protobuf:"bytes,1,opt,name=redelegation_entry,json=redelegationEntry,proto3" json:"redelegation_entry"` - 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"` -} - -func (m *RedelegationEntryResponse) Reset() { *m = RedelegationEntryResponse{} } -func (m *RedelegationEntryResponse) String() string { return proto.CompactTextString(m) } -func (*RedelegationEntryResponse) ProtoMessage() {} -func (*RedelegationEntryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{17} -} - -func (m *RedelegationEntryResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *RedelegationEntryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RedelegationEntryResponse.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 *RedelegationEntryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedelegationEntryResponse.Merge(m, src) -} - -func (m *RedelegationEntryResponse) XXX_Size() int { - return m.Size() -} - -func (m *RedelegationEntryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RedelegationEntryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RedelegationEntryResponse proto.InternalMessageInfo - -func (m *RedelegationEntryResponse) GetRedelegationEntry() RedelegationEntry { - if m != nil { - return m.RedelegationEntry - } - return RedelegationEntry{} -} - -// RedelegationResponse is equivalent to a Redelegation except that its entries -// contain a balance in addition to shares which is more suitable for client -// responses. -type RedelegationResponse struct { - Redelegation Redelegation `protobuf:"bytes,1,opt,name=redelegation,proto3" json:"redelegation"` - Entries []RedelegationEntryResponse `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries"` -} - -func (m *RedelegationResponse) Reset() { *m = RedelegationResponse{} } -func (m *RedelegationResponse) String() string { return proto.CompactTextString(m) } -func (*RedelegationResponse) ProtoMessage() {} -func (*RedelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{18} -} - -func (m *RedelegationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *RedelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RedelegationResponse.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 *RedelegationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedelegationResponse.Merge(m, src) -} - -func (m *RedelegationResponse) XXX_Size() int { - return m.Size() -} - -func (m *RedelegationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RedelegationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RedelegationResponse proto.InternalMessageInfo - -func (m *RedelegationResponse) GetRedelegation() Redelegation { - if m != nil { - return m.Redelegation - } - return Redelegation{} -} - -func (m *RedelegationResponse) GetEntries() []RedelegationEntryResponse { - if m != nil { - return m.Entries - } - return nil -} - -// Pool is used for tracking bonded and not-bonded token supply of the bond -// denomination. -type Pool struct { - NotBondedTokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=not_bonded_tokens,json=notBondedTokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"not_bonded_tokens"` - BondedTokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=bonded_tokens,json=bondedTokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"bonded_tokens" yaml:"bonded_tokens"` -} - -func (m *Pool) Reset() { *m = Pool{} } -func (m *Pool) String() string { return proto.CompactTextString(m) } -func (*Pool) ProtoMessage() {} -func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{19} -} - -func (m *Pool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} - -func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pool.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 *Pool) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pool.Merge(m, src) -} - -func (m *Pool) XXX_Size() int { - return m.Size() -} - -func (m *Pool) XXX_DiscardUnknown() { - xxx_messageInfo_Pool.DiscardUnknown(m) -} - -var xxx_messageInfo_Pool proto.InternalMessageInfo - -func init() { - // proto.RegisterEnum("cosmos.staking.v1beta1.BondStatus", BondStatus_name, BondStatus_value) - // proto.RegisterType((*HistoricalInfo)(nil), "cosmos.staking.v1beta1.HistoricalInfo") - // proto.RegisterType((*CommissionRates)(nil), "cosmos.staking.v1beta1.CommissionRates") - // proto.RegisterType((*Commission)(nil), "cosmos.staking.v1beta1.Commission") - // proto.RegisterType((*Description)(nil), "cosmos.staking.v1beta1.Description") - // proto.RegisterType((*Validator)(nil), "cosmos.staking.v1beta1.Validator") - // proto.RegisterType((*ValAddresses)(nil), "cosmos.staking.v1beta1.ValAddresses") - // proto.RegisterType((*DVPair)(nil), "cosmos.staking.v1beta1.DVPair") - // proto.RegisterType((*DVPairs)(nil), "cosmos.staking.v1beta1.DVPairs") - // proto.RegisterType((*DVVTriplet)(nil), "cosmos.staking.v1beta1.DVVTriplet") - // proto.RegisterType((*DVVTriplets)(nil), "cosmos.staking.v1beta1.DVVTriplets") - // proto.RegisterType((*Delegation)(nil), "cosmos.staking.v1beta1.Delegation") - // proto.RegisterType((*UnbondingDelegation)(nil), "cosmos.staking.v1beta1.UnbondingDelegation") - // proto.RegisterType((*UnbondingDelegationEntry)(nil), "cosmos.staking.v1beta1.UnbondingDelegationEntry") - // proto.RegisterType((*RedelegationEntry)(nil), "cosmos.staking.v1beta1.RedelegationEntry") - // proto.RegisterType((*Redelegation)(nil), "cosmos.staking.v1beta1.Redelegation") - // proto.RegisterType((*Params)(nil), "cosmos.staking.v1beta1.Params") - // proto.RegisterType((*DelegationResponse)(nil), "cosmos.staking.v1beta1.DelegationResponse") - // proto.RegisterType((*RedelegationEntryResponse)(nil), "cosmos.staking.v1beta1.RedelegationEntryResponse") - // proto.RegisterType((*RedelegationResponse)(nil), "cosmos.staking.v1beta1.RedelegationResponse") - // proto.RegisterType((*Pool)(nil), "cosmos.staking.v1beta1.Pool") -} - -func init() { - proto.RegisterFile("cosmos/staking/v1beta1/staking.proto", fileDescriptor_64c30c6cf92913c9) -} - -var fileDescriptor_64c30c6cf92913c9 = []byte{ - // 1796 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4d, 0x6c, 0x23, 0x49, - 0x15, 0x76, 0x3b, 0x5e, 0xc7, 0x7e, 0x4e, 0xe2, 0xa4, 0x26, 0x33, 0xeb, 0x98, 0xc1, 0xed, 0x6d, - 0x56, 0x4b, 0x40, 0xbb, 0x0e, 0x93, 0x45, 0x8b, 0xc8, 0x05, 0xc6, 0x71, 0x86, 0x58, 0xbb, 0x0c, - 0xa1, 0x93, 0x09, 0x12, 0xac, 0xb0, 0xca, 0xdd, 0x15, 0xa7, 0x89, 0xbb, 0xdb, 0x74, 0x95, 0x87, - 0x58, 0xda, 0x03, 0xc7, 0x65, 0x10, 0x62, 0xb9, 0xed, 0x65, 0xa4, 0x91, 0xf6, 0xba, 0x12, 0x17, - 0xc4, 0x95, 0xeb, 0x02, 0x97, 0xe1, 0x86, 0x10, 0x32, 0x68, 0xe6, 0x82, 0x38, 0x21, 0x1f, 0x10, - 0x37, 0x50, 0xfd, 0xf4, 0x4f, 0xda, 0xf1, 0xcc, 0x78, 0xb4, 0x87, 0x91, 0xd8, 0x4b, 0xe2, 0x7a, - 0xf5, 0xde, 0xf7, 0xea, 0xfd, 0xd6, 0xab, 0x86, 0x57, 0x2d, 0x9f, 0xba,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xec, 0xd3, 0xb4, 0xfc, 0x08, 0xae, 0xc6, 0x66, 0xd1, - 0xc0, 0x4a, 0x59, 0x5f, 0x9f, 0x8c, 0xf5, 0xeb, 0x69, 0xeb, 0x13, 0x6c, 0x86, 0x79, 0x25, 0xa2, - 0x1f, 0x06, 0xd6, 0xa5, 0xa8, 0x36, 0x65, 0x11, 0xea, 0xc2, 0x6c, 0xd4, 0x04, 0x5b, 0x12, 0xb5, - 0x45, 0xd9, 0xe5, 0xae, 0x3d, 0x84, 0x52, 0xec, 0x12, 0x8a, 0x5a, 0x50, 0x60, 0xea, 0xb7, 0xf2, - 0xb0, 0x31, 0xdb, 0xc3, 0xa1, 0x98, 0xf2, 0x72, 0x24, 0x69, 0xfc, 0x47, 0x03, 0x88, 0x73, 0xf6, - 0xc5, 0x4c, 0x31, 0xde, 0xca, 0x55, 0xe3, 0x5d, 0x78, 0xae, 0x51, 0x4d, 0x49, 0xa7, 0xfc, 0xf9, - 0xf3, 0x2c, 0x5c, 0xb9, 0x13, 0x76, 0x9e, 0x17, 0xde, 0x07, 0x07, 0xb0, 0x48, 0x3c, 0x16, 0x38, - 0xc2, 0x09, 0x3c, 0xda, 0x5f, 0x99, 0x15, 0xed, 0x4b, 0x6c, 0xda, 0xf3, 0x58, 0x30, 0x52, 0xb1, - 0x0f, 0x61, 0x52, 0xde, 0xf8, 0xe5, 0x02, 0x54, 0x66, 0x49, 0xa2, 0x5d, 0x28, 0x5b, 0x01, 0x11, - 0x84, 0xf0, 0xfe, 0xd0, 0xc4, 0xfd, 0x51, 0x8d, 0x27, 0xcb, 0x14, 0x83, 0x61, 0xae, 0x84, 0x14, - 0x75, 0x7b, 0xf4, 0x80, 0x8f, 0x7d, 0x3c, 0xed, 0x38, 0xd7, 0x33, 0xce, 0x79, 0x86, 0xba, 0x3e, - 0x42, 0x25, 0x17, 0x01, 0xe4, 0xfd, 0xb1, 0x12, 0x53, 0xc5, 0x05, 0xf2, 0x63, 0x28, 0x3b, 0x9e, - 0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 0x1e, 0x3e, 0xae, - 0x65, 0xfe, 0xfc, 0xb8, 0x96, 0xf9, 0xfe, 0xeb, 0x4f, 0xf4, 0xdd, 0x79, 0xf4, 0x51, 0x5b, 0x78, - 0xb1, 0x9b, 0x17, 0x6d, 0xf8, 0xcd, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x48, 0x4c, 0x86, - 0xf3, 0x16, 0x00, 0x00, -} - -func (this *Pool) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { - return StakingDescription() -} - -func StakingDescription() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { - d := &github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet{} - gzipped := []byte{ - // 9603 bytes of a gzipped FileDescriptorSet - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x7d, 0x6d, 0x70, 0x24, 0xd7, - 0x71, 0xd8, 0xcd, 0xee, 0x02, 0xd8, 0x6d, 0x2c, 0x80, 0xc5, 0x03, 0xee, 0x6e, 0x6f, 0x79, 0x04, - 0xc0, 0xe1, 0xd7, 0xf1, 0x48, 0x02, 0xe4, 0x91, 0x77, 0x24, 0xf7, 0x24, 0xd2, 0x58, 0x60, 0x0f, - 0x07, 0x1e, 0xbe, 0x38, 0x00, 0x8e, 0xd4, 0x87, 0xb3, 0x35, 0x98, 0x7d, 0x58, 0x0c, 0xb1, 0x3b, - 0x33, 0x9c, 0x99, 0xbd, 0x3b, 0x50, 0x52, 0x15, 0x2d, 0x29, 0x8a, 0x44, 0xc7, 0x91, 0x14, 0xb9, - 0x1c, 0x89, 0xd6, 0x29, 0x92, 0xe5, 0x44, 0x8e, 0xac, 0xc4, 0x1f, 0x52, 0x94, 0x38, 0x49, 0x55, - 0xa4, 0x24, 0x8e, 0x25, 0xa5, 0xe2, 0x92, 0x2a, 0xae, 0xc4, 0x71, 0x25, 0x67, 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 0xd1, 0x7e, 0x17, 0x9e, 0x80, 0x91, 0x50, 0x07, 0x7a, 0x6d, 0x5a, 0x7e, 0x27, 0x1c, 0x6d, 0xcb, - 0x1a, 0xbd, 0x00, 0x93, 0x4d, 0x43, 0x37, 0x5c, 0x6c, 0x5b, 0x36, 0x26, 0x16, 0xcb, 0x9a, 0xca, - 0xff, 0xe7, 0xa1, 0x0e, 0x36, 0xb7, 0x1d, 0xc4, 0x66, 0x5c, 0x94, 0x89, 0x66, 0x2b, 0xf0, 0x74, - 0x26, 0xfd, 0xc6, 0x50, 0xee, 0x95, 0x57, 0x5e, 0x79, 0x25, 0x21, 0x7f, 0x79, 0x10, 0x26, 0xdb, - 0xcd, 0x99, 0xb6, 0xd3, 0xf7, 0x18, 0x0c, 0x1a, 0xcd, 0xc6, 0x0e, 0xb6, 0xa9, 0x92, 0x06, 0x14, - 0x5e, 0x42, 0xf3, 0x30, 0x50, 0x57, 0x77, 0x70, 0x3d, 0x9f, 0x9a, 0x91, 0x4e, 0x8d, 0x9e, 0x79, - 0xb0, 0xa7, 0x59, 0x39, 0xbb, 0x42, 0x48, 0x14, 0x46, 0x89, 0x9e, 0x86, 0x14, 0x77, 0xd1, 0x84, - 0xc3, 0xe9, 0xde, 0x38, 0x90, 0xb9, 0xa4, 0x50, 0x3a, 0x74, 0x07, 0x64, 0xc8, 0x5f, 0x66, 0x1b, - 0x83, 0x54, 0xe6, 0x34, 0x01, 0x10, 0xbb, 0x40, 0x05, 0x48, 0xd3, 0x69, 0x52, 0xc5, 0x22, 0xb4, - 0x79, 0x65, 0x62, 0x58, 0x55, 0xbc, 0xab, 0x36, 0xeb, 0x6e, 0xe5, 0x8a, 0x5a, 0x6f, 0x62, 0x6a, - 0xf0, 0x19, 0x25, 0xcb, 0x81, 0x97, 0x09, 0x0c, 0x4d, 0xc3, 0x30, 0x9b, 0x55, 0xba, 0x51, 0xc5, - 0xd7, 0xa8, 0xf7, 0x1c, 0x50, 0xd8, 0x44, 0x5b, 0x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23, 0xac, 0x09, 0x21, - 0xc4, 0x58, 0x04, 0x74, 0xee, 0xf1, 0x5c, 0xce, 0x17, 0x84, 0x71, 0x19, 0x0f, 0x01, 0xce, 0x3d, - 0x9e, 0x43, 0xf2, 0x02, 0x0c, 0x50, 0x33, 0x44, 0x08, 0x46, 0x57, 0xe6, 0x4b, 0xe5, 0x95, 0xca, - 0xfa, 0xc6, 0xd6, 0xf2, 0xfa, 0xda, 0xfc, 0x4a, 0x4e, 0xf2, 0x61, 0x4a, 0xf9, 0xb9, 0xed, 0x65, - 0xa5, 0xbc, 0x98, 0x4b, 0x04, 0x61, 0x1b, 0xe5, 0xf9, 0xad, 0xf2, 0x62, 0x2e, 0x29, 0x6b, 0x30, - 0xd9, 0xce, 0xa1, 0xb6, 0x9d, 0x42, 0x01, 0x5b, 0x48, 0x74, 0xb0, 0x05, 0xca, 0x2b, 0x6a, 0x0b, - 0xf2, 0x37, 0x13, 0x30, 0xd1, 0x26, 0xa8, 0xb4, 0x6d, 0xe4, 0x19, 0x18, 0x60, 0xb6, 0xcc, 0xc2, - 0xec, 0x03, 0x6d, 0xa3, 0x13, 0xb5, 0xec, 0x96, 0x50, 0x4b, 0xe9, 0x82, 0xa9, 0x46, 0xb2, 0x43, - 0xaa, 0x41, 0x58, 0xb4, 0x18, 0xec, 0x4f, 0xb6, 0x38, 0x7f, 0x16, 0x1f, 0xcf, 0xf5, 0x12, 0x1f, - 0x29, 0xac, 0xbf, 0x20, 0x30, 0xd0, 0x26, 0x08, 0x9c, 0x87, 0xf1, 0x16, 0x46, 0x3d, 0x3b, 0xe3, - 0xf7, 0x48, 0x90, 0xef, 0xa4, 0x9c, 0x18, 0x97, 0x98, 0x08, 0xb9, 0xc4, 0xf3, 0x51, 0x0d, 0xde, - 0xd5, 0x79, 0x10, 0x5a, 0xc6, 0xfa, 0x33, 0x12, 0x1c, 0x6b, 0x9f, 0x52, 0xb6, 0x95, 0xe1, 0x69, - 0x18, 0x6c, 0x60, 0x77, 0xcf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0x36, - 0x98, 0xaf, 0x93, 0xe5, 0x8f, 0x46, 0x23, 0x96, 0x44, 0x7d, 0xda, 0xdd, 0x5d, 0xb3, 0xfb, 0xd9, - 0x05, 0x12, 0xca, 0x8a, 0x83, 0x2c, 0x39, 0x56, 0x18, 0x25, 0x49, 0x23, 0x88, 0xb1, 0x61, 0x96, - 0x8c, 0xa4, 0x15, 0x5e, 0x42, 0x4b, 0x30, 0xf8, 0xa2, 0x43, 0x79, 0x0f, 0x52, 0xde, 0xf7, 0x74, - 0xe7, 0xfd, 0xec, 0x26, 0x65, 0x9e, 0x79, 0x76, 0xb3, 0xb2, 0xb6, 0xae, 0xac, 0xce, 0xaf, 0x28, - 0x9c, 0x1c, 0x9d, 0x80, 0x54, 0x5d, 0x7d, 0xf9, 0x20, 0x1c, 0xf4, 0x28, 0xa8, 0xd7, 0x41, 0x38, - 0x01, 0xa9, 0xab, 0x58, 0xdd, 0x0f, 0x87, 0x1a, 0x0a, 0xba, 0x8d, 0x93, 0x61, 0x0e, 0x06, 0xa8, - 0xbe, 0x10, 0x00, 0xd7, 0x58, 0xee, 0x08, 0x4a, 0x43, 0x6a, 0x61, 0x5d, 0x21, 0x13, 0x22, 0x07, - 0x59, 0x06, 0xad, 0x6c, 0x2c, 0x97, 0x17, 0xca, 0xb9, 0x84, 0x7c, 0x16, 0x06, 0x99, 0x12, 0xc8, - 0x64, 0xf1, 0xd4, 0x90, 0x3b, 0xc2, 0x8b, 0x9c, 0x87, 0x24, 0x6a, 0xb7, 0x57, 0x4b, 0x65, 0x25, - 0x97, 0x08, 0x0f, 0x75, 0x2a, 0x37, 0x20, 0x3b, 0x90, 0x0d, 0xe6, 0xe1, 0x3f, 0x9c, 0xc5, 0xf8, - 0x97, 0x24, 0x18, 0x0e, 0xe4, 0xd5, 0x24, 0x21, 0x52, 0xeb, 0x75, 0xf3, 0x6a, 0x45, 0xad, 0xeb, - 0xaa, 0xc3, 0x4d, 0x03, 0x28, 0x68, 0x9e, 0x40, 0x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3, 0x50, 0xce, 0x53, 0xbc, 0x00, 0x23, 0xa1, 0x84, 0x27, 0x9e, - 0xd5, 0x7b, 0x39, 0xab, 0x6c, 0x30, 0xdf, 0x29, 0x9e, 0x85, 0x14, 0x49, 0x5e, 0xe2, 0xc9, 0xff, - 0x32, 0x27, 0xa7, 0xe8, 0xc5, 0x37, 0x43, 0x5a, 0x24, 0x2d, 0xf1, 0xa4, 0xef, 0xe3, 0xa4, 0x1e, - 0x09, 0x21, 0x17, 0x09, 0x4b, 0x3c, 0xf9, 0x5f, 0x11, 0xe4, 0x82, 0x84, 0x90, 0xf7, 0xae, 0xc2, - 0x2f, 0xfd, 0x74, 0x8a, 0x07, 0x1d, 0xa1, 0xbb, 0xf3, 0x30, 0xc4, 0x33, 0x95, 0x78, 0xea, 0x0f, - 0xf0, 0xc6, 0x05, 0x45, 0xf1, 0x09, 0x18, 0xe8, 0x51, 0xe1, 0x3f, 0xc3, 0x49, 0x19, 0x7e, 0x71, - 0x01, 0x86, 0x03, 0xd9, 0x49, 0x3c, 0xf9, 0x5f, 0xe3, 0xe4, 0x41, 0x2a, 0x22, 0x3a, 0xcf, 0x4e, - 0xe2, 0x19, 0x7c, 0x50, 0x88, 0xce, 0x29, 0x88, 0xda, 0x44, 0x62, 0x12, 0x4f, 0xfd, 0x21, 0xa1, - 0x75, 0x41, 0x52, 0x7c, 0x06, 0x32, 0x5e, 0xb0, 0x89, 0xa7, 0xff, 0x30, 0xa7, 0xf7, 0x69, 0x88, - 0x06, 0x02, 0xc1, 0x2e, 0x9e, 0xc5, 0x5f, 0x17, 0x1a, 0x08, 0x50, 0x91, 0x69, 0x14, 0x4d, 0x60, - 0xe2, 0x39, 0x7d, 0x44, 0x4c, 0xa3, 0x48, 0xfe, 0x42, 0x46, 0x93, 0xfa, 0xfc, 0x78, 0x16, 0x3f, - 0x2b, 0x46, 0x93, 0xe2, 0x13, 0x31, 0xa2, 0x19, 0x41, 0x3c, 0x8f, 0xbf, 0x21, 0xc4, 0x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x7c, 0x9e, 0x81, 0xe5, 0x3c, 0xa4, 0x16, 0x55, 0x57, 0x25, 0x09, - 0x86, 0x7b, 0x8d, 0x05, 0x9a, 0xac, 0x42, 0x7e, 0xca, 0x6f, 0x24, 0x20, 0x75, 0xd9, 0x74, 0x31, - 0x7a, 0x2c, 0x90, 0x00, 0x8e, 0xb6, 0xb3, 0xe7, 0x4d, 0xbd, 0x66, 0xe0, 0xea, 0xaa, 0x53, 0x0b, - 0xbc, 0xfb, 0xf6, 0xcd, 0x29, 0x11, 0x32, 0xa7, 0x49, 0x18, 0xb0, 0xcd, 0xa6, 0x51, 0x15, 0x37, - 0x0e, 0x69, 0x01, 0x95, 0x21, 0xed, 0x59, 0x49, 0x2a, 0xce, 0x4a, 0xc6, 0x88, 0x95, 0x10, 0x1b, - 0xe6, 0x00, 0x65, 0x68, 0x87, 0x1b, 0x4b, 0x09, 0x32, 0x9e, 0xf3, 0xe2, 0xd6, 0xd6, 0x9b, 0xc1, - 0xfa, 0x64, 0x24, 0x98, 0x78, 0x63, 0xef, 0x29, 0x8f, 0x59, 0x5c, 0xce, 0xab, 0xe0, 0xda, 0x0b, - 0x99, 0x15, 0x7f, 0x83, 0x3e, 0x44, 0xfb, 0xe5, 0x9b, 0x15, 0x7b, 0x87, 0x7e, 0x12, 0x32, 0x8e, - 0x5e, 0x33, 0x54, 0xb7, 0x69, 0x63, 0x6e, 0x79, 0x3e, 0x40, 0xfe, 0x92, 0x04, 0x83, 0xcc, 0x92, - 0x03, 0x7a, 0x93, 0xda, 0xeb, 0x2d, 0xd1, 0x49, 0x6f, 0xc9, 0xc3, 0xeb, 0x6d, 0x1e, 0xc0, 0x13, - 0xc6, 0xe1, 0x4f, 0x83, 0xdb, 0x64, 0x0c, 0x4c, 0xc4, 0x4d, 0xbd, 0xc6, 0x27, 0x6a, 0x80, 0x48, - 0xfe, 0x8f, 0x12, 0x49, 0x62, 0x79, 0x3d, 0x9a, 0x87, 0x11, 0x21, 0x57, 0x65, 0xb7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 0xd9, 0xa3, 0x94, 0xff, 0x4c, 0x02, 0xf0, - 0x6d, 0xf6, 0xc7, 0xd3, 0xc4, 0x88, 0x2b, 0xe7, 0x8e, 0x37, 0x79, 0xa8, 0x54, 0x8d, 0x53, 0x47, - 0xf4, 0xf9, 0xd3, 0x09, 0x98, 0xd8, 0x16, 0x9e, 0xe7, 0xc7, 0x5e, 0x07, 0x1b, 0x30, 0x84, 0x0d, - 0xd7, 0xd6, 0xa9, 0x12, 0xc8, 0x68, 0x3f, 0xd2, 0x69, 0xb4, 0xdb, 0xf4, 0x89, 0x7e, 0xec, 0x46, - 0x6c, 0xba, 0x73, 0x36, 0x11, 0x6d, 0x7c, 0x30, 0x09, 0xf9, 0x4e, 0x94, 0x68, 0x01, 0xc6, 0x34, - 0x1b, 0x53, 0x40, 0x25, 0xb8, 0xf3, 0x57, 0x2a, 0xf8, 0x99, 0x65, 0x04, 0x41, 0x56, 0x46, 0x05, - 0x84, 0x47, 0x8f, 0x1a, 0x90, 0xb4, 0x8f, 0x98, 0x1d, 0xc1, 0xea, 0x31, 0xcf, 0x93, 0x79, 0xf8, - 0x10, 0x8d, 0x84, 0x19, 0xb0, 0xf8, 0x31, 0xea, 0x43, 0x69, 0x00, 0x79, 0x09, 0xc6, 0x74, 0x43, - 0x77, 0x75, 0xb5, 0x5e, 0xd9, 0x51, 0xeb, 0xaa, 0xa1, 0x1d, 0x26, 0x6b, 0x66, 0x2e, 0x9f, 0x37, - 0x1b, 0x61, 0x27, 0x2b, 0xa3, 0x1c, 0x52, 0x62, 0x00, 0x74, 0x11, 0x86, 0x44, 0x53, 0xa9, 0x43, - 0x65, 0x1b, 0x82, 0x3c, 0x90, 0xe0, 0xfd, 0x4c, 0x12, 0xc6, 0x15, 0x5c, 0xfd, 0xff, 0x43, 0xd1, - 0xdf, 0x50, 0xac, 0x02, 0xb0, 0xe9, 0x4e, 0x1c, 0xec, 0x21, 0x46, 0x83, 0x38, 0x8c, 0x0c, 0xe3, - 0xb0, 0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x9c, 0x8c, 0xff, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd5, 0xca, 0x34, 0x9e, 0x6a, - 0x94, 0x00, 0x00, - } - r := bytes.NewReader(gzipped) - gzipr, err := compress_gzip.NewReader(r) - if err != nil { - panic(err) - } - ungzipped, err := io.ReadAll(gzipr) - if err != nil { - panic(err) - } - if err := github_com_gogo_protobuf_proto.Unmarshal(ungzipped, d); err != nil { - panic(err) - } - return d -} - -func (this *CommissionRates) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*CommissionRates) - if !ok { - that2, ok := that.(CommissionRates) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Rate.Equal(that1.Rate) { - return false - } - if !this.MaxRate.Equal(that1.MaxRate) { - return false - } - if !this.MaxChangeRate.Equal(that1.MaxChangeRate) { - return false - } - return true -} - -func (this *Commission) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Commission) - if !ok { - that2, ok := that.(Commission) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CommissionRates.Equal(&that1.CommissionRates) { - return false - } - if !this.UpdateTime.Equal(that1.UpdateTime) { - 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 (this *UnbondingDelegationEntry) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*UnbondingDelegationEntry) - if !ok { - that2, ok := that.(UnbondingDelegationEntry) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CreationHeight != that1.CreationHeight { - return false - } - if !this.CompletionTime.Equal(that1.CompletionTime) { - return false - } - if !this.InitialBalance.Equal(that1.InitialBalance) { - return false - } - if !this.Balance.Equal(that1.Balance) { - return false - } - return true -} - -func (this *RedelegationEntry) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RedelegationEntry) - if !ok { - that2, ok := that.(RedelegationEntry) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CreationHeight != that1.CreationHeight { - return false - } - if !this.CompletionTime.Equal(that1.CompletionTime) { - return false - } - if !this.InitialBalance.Equal(that1.InitialBalance) { - return false - } - if !this.SharesDst.Equal(that1.SharesDst) { - return false - } - return true -} - -func (this *Params) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Params) - if !ok { - that2, ok := that.(Params) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.UnbondingTime != that1.UnbondingTime { - return false - } - if this.MaxValidators != that1.MaxValidators { - return false - } - if this.MaxEntries != that1.MaxEntries { - return false - } - if this.HistoricalEntries != that1.HistoricalEntries { - return false - } - if this.BondDenom != that1.BondDenom { - return false - } - return true -} - -func (this *RedelegationEntryResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RedelegationEntryResponse) - if !ok { - that2, ok := that.(RedelegationEntryResponse) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.RedelegationEntry.Equal(&that1.RedelegationEntry) { - return false - } - if !this.Balance.Equal(that1.Balance) { - return false - } - return true -} - -func (this *Pool) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Pool) - if !ok { - that2, ok := that.(Pool) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.NotBondedTokens.Equal(that1.NotBondedTokens) { - return false - } - if !this.BondedTokens.Equal(that1.BondedTokens) { - return false - } - return true -} - -func (m *HistoricalInfo) 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 *HistoricalInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HistoricalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Valset) > 0 { - for iNdEx := len(m.Valset) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Valset[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CommissionRates) 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 *CommissionRates) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommissionRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.MaxChangeRate.Size() - i -= size - if _, err := m.MaxChangeRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.MaxRate.Size() - i -= size - if _, err := m.MaxRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Rate.Size() - i -= size - if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Commission) 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 *Commission) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Commission) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintStaking(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x12 - { - size, err := m.CommissionRates.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - 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 = encodeVarintStaking(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 = encodeVarintStaking(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 = encodeVarintStaking(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 = encodeVarintStaking(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 = encodeVarintStaking(dAtA, i, uint64(len(m.Moniker))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Validator) 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 *Validator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - { - size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintStaking(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x4a - if m.UnbondingHeight != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingHeight)) - i-- - dAtA[i] = 0x40 - } - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - { - size := m.DelegatorShares.Size() - i -= size - if _, err := m.DelegatorShares.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size := m.Tokens.Size() - i -= size - if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.Status != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x20 - } - if m.Jailed { - i-- - if m.Jailed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.ConsensusPubkey != nil { - { - size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.OperatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValAddresses) 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 *ValAddresses) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = encodeVarintStaking(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DVPair) 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 *DVPair) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DVPairs) 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 *DVPairs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVPairs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Pairs) > 0 { - for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DVVTriplet) 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 *DVVTriplet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVVTriplet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorDstAddress) > 0 { - i -= len(m.ValidatorDstAddress) - copy(dAtA[i:], m.ValidatorDstAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorDstAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorSrcAddress) > 0 { - i -= len(m.ValidatorSrcAddress) - copy(dAtA[i:], m.ValidatorSrcAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorSrcAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DVVTriplets) 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 *DVVTriplets) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVVTriplets) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Triplets) > 0 { - for iNdEx := len(m.Triplets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Triplets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Delegation) 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 *Delegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Shares.Size() - i -= size - if _, err := m.Shares.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UnbondingDelegation) 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 *UnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = 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 = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UnbondingDelegationEntry) 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 *UnbondingDelegationEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Balance.Size() - i -= size - if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.InitialBalance.Size() - i -= size - if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintStaking(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0x12 - if m.CreationHeight != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.CreationHeight)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *RedelegationEntry) 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 *RedelegationEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RedelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.SharesDst.Size() - i -= size - if _, err := m.SharesDst.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.InitialBalance.Size() - i -= size - if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err9 != nil { - return 0, err9 - } - i -= n9 - i = encodeVarintStaking(dAtA, i, uint64(n9)) - i-- - dAtA[i] = 0x12 - if m.CreationHeight != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.CreationHeight)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Redelegation) 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 *Redelegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Redelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = 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 = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.ValidatorDstAddress) > 0 { - i -= len(m.ValidatorDstAddress) - copy(dAtA[i:], m.ValidatorDstAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorDstAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorSrcAddress) > 0 { - i -= len(m.ValidatorSrcAddress) - copy(dAtA[i:], m.ValidatorSrcAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorSrcAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BondDenom) > 0 { - i -= len(m.BondDenom) - copy(dAtA[i:], m.BondDenom) - i = encodeVarintStaking(dAtA, i, uint64(len(m.BondDenom))) - i-- - dAtA[i] = 0x2a - } - if m.HistoricalEntries != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.HistoricalEntries)) - i-- - dAtA[i] = 0x20 - } - if m.MaxEntries != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.MaxEntries)) - i-- - dAtA[i] = 0x18 - } - if m.MaxValidators != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.MaxValidators)) - i-- - dAtA[i] = 0x10 - } - n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) - if err10 != nil { - return 0, err10 - } - i -= n10 - i = encodeVarintStaking(dAtA, i, uint64(n10)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DelegationResponse) 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 *DelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Delegation.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RedelegationEntryResponse) 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 *RedelegationEntryResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RedelegationEntryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Balance.Size() - i -= size - if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size, err := m.RedelegationEntry.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RedelegationResponse) 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 *RedelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RedelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = 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 = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Redelegation.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Pool) 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 *Pool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.BondedTokens.Size() - i -= size - if _, err := m.BondedTokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.NotBondedTokens.Size() - i -= size - if _, err := m.NotBondedTokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintStaking(dAtA []byte, offset int, v uint64) int { - offset -= sovStaking(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} - -func (m *HistoricalInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Header.Size() - n += 1 + l + sovStaking(uint64(l)) - if len(m.Valset) > 0 { - for _, e := range m.Valset { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *CommissionRates) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Rate.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.MaxRate.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.MaxChangeRate.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *Commission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CommissionRates.Size() - n += 1 + l + sovStaking(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime) - n += 1 + l + sovStaking(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 + sovStaking(uint64(l)) - } - l = len(m.Identity) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.Website) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.SecurityContact) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.Details) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *Validator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.OperatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - if m.ConsensusPubkey != nil { - l = m.ConsensusPubkey.Size() - n += 1 + l + sovStaking(uint64(l)) - } - if m.Jailed { - n += 2 - } - if m.Status != 0 { - n += 1 + sovStaking(uint64(m.Status)) - } - l = m.Tokens.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.DelegatorShares.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Description.Size() - n += 1 + l + sovStaking(uint64(l)) - if m.UnbondingHeight != 0 { - n += 1 + sovStaking(uint64(m.UnbondingHeight)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime) - n += 1 + l + sovStaking(uint64(l)) - l = m.Commission.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.MinSelfDelegation.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *ValAddresses) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, s := range m.Addresses { - l = len(s) - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *DVPair) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *DVPairs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Pairs) > 0 { - for _, e := range m.Pairs { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *DVVTriplet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorDstAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *DVVTriplets) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Triplets) > 0 { - for _, e := range m.Triplets { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *Delegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = m.Shares.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *UnbondingDelegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *UnbondingDelegationEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CreationHeight != 0 { - n += 1 + sovStaking(uint64(m.CreationHeight)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovStaking(uint64(l)) - l = m.InitialBalance.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Balance.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *RedelegationEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CreationHeight != 0 { - n += 1 + sovStaking(uint64(m.CreationHeight)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovStaking(uint64(l)) - l = m.InitialBalance.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.SharesDst.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *Redelegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorDstAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) - n += 1 + l + sovStaking(uint64(l)) - if m.MaxValidators != 0 { - n += 1 + sovStaking(uint64(m.MaxValidators)) - } - if m.MaxEntries != 0 { - n += 1 + sovStaking(uint64(m.MaxEntries)) - } - if m.HistoricalEntries != 0 { - n += 1 + sovStaking(uint64(m.HistoricalEntries)) - } - l = len(m.BondDenom) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *DelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Delegation.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Balance.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *RedelegationEntryResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RedelegationEntry.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Balance.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *RedelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Redelegation.Size() - n += 1 + l + sovStaking(uint64(l)) - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *Pool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NotBondedTokens.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.BondedTokens.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func sovStaking(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} - -func sozStaking(x uint64) (n int) { - return sovStaking(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -func (this *ValAddresses) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{ - `&ValAddresses{`, - `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, - `}`, - }, "") - return s -} - -func valueToStringStaking(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} - -func (m *HistoricalInfo) 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 ErrIntOverflowStaking - } - 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: HistoricalInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HistoricalInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valset", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Valset = append(m.Valset, Validator{}) - if err := m.Valset[len(m.Valset)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *CommissionRates) 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 ErrIntOverflowStaking - } - 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: CommissionRates: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommissionRates: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxChangeRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxChangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *Commission) 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 ErrIntOverflowStaking - } - 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: Commission: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Commission: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommissionRates", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CommissionRates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdateTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UpdateTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - 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 ErrIntOverflowStaking - } - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Details = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *Validator) 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 ErrIntOverflowStaking - } - 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: Validator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Validator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusPubkey == nil { - m.ConsensusPubkey = &types1.Any{} - } - if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Jailed = 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 ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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 DelegatorShares", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DelegatorShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingHeight", wireType) - } - m.UnbondingHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnbondingHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *ValAddresses) 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 ErrIntOverflowStaking - } - 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: ValAddresses: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValAddresses: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *DVPair) 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 ErrIntOverflowStaking - } - 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: DVPair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVPair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *DVPairs) 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 ErrIntOverflowStaking - } - 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: DVPairs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVPairs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pairs = append(m.Pairs, DVPair{}) - if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *DVVTriplet) 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 ErrIntOverflowStaking - } - 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: DVVTriplet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVVTriplet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *DVVTriplets) 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 ErrIntOverflowStaking - } - 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: DVVTriplets: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVVTriplets: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Triplets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Triplets = append(m.Triplets, DVVTriplet{}) - if err := m.Triplets[len(m.Triplets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *Delegation) 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 ErrIntOverflowStaking - } - 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: Delegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Delegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Shares", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *UnbondingDelegation) 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 ErrIntOverflowStaking - } - 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: UnbondingDelegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - 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 ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, UnbondingDelegationEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *UnbondingDelegationEntry) 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 ErrIntOverflowStaking - } - 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: UnbondingDelegationEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnbondingDelegationEntry: 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 ErrIntOverflowStaking - } - 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 CompletionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *RedelegationEntry) 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 ErrIntOverflowStaking - } - 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: RedelegationEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RedelegationEntry: 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 ErrIntOverflowStaking - } - 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 CompletionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SharesDst", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SharesDst.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *Redelegation) 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 ErrIntOverflowStaking - } - 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: Redelegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Redelegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - 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 ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, RedelegationEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 UnbondingTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxValidators", wireType) - } - m.MaxValidators = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxValidators |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - 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 ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxEntries |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) - } - m.HistoricalEntries = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HistoricalEntries |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BondDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *DelegationResponse) 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 ErrIntOverflowStaking - } - 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: DelegationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegation", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Delegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *RedelegationEntryResponse) 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 ErrIntOverflowStaking - } - 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: RedelegationEntryResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RedelegationEntryResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RedelegationEntry", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RedelegationEntry.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - 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 ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *RedelegationResponse) 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 ErrIntOverflowStaking - } - 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: RedelegationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RedelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Redelegation", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Redelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - 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 ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, RedelegationEntryResponse{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *Pool) 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 ErrIntOverflowStaking - } - 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: Pool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NotBondedTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NotBondedTokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BondedTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BondedTokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func skipStaking(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, ErrIntOverflowStaking - } - 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, ErrIntOverflowStaking - } - 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, ErrIntOverflowStaking - } - 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, ErrInvalidLengthStaking - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupStaking - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthStaking - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthStaking = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStaking = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupStaking = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/staking/legacy/v040/types.go b/x/staking/legacy/v040/types.go deleted file mode 100644 index 8964296fa97..00000000000 --- a/x/staking/legacy/v040/types.go +++ /dev/null @@ -1,201 +0,0 @@ -package v040 - -import ( - "fmt" - "strings" - "time" - - yaml "gopkg.in/yaml.v2" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// Staking params default values -const ( - // DefaultUnbondingTime reflects three weeks in seconds as the default - // unbonding time. - // TODO: Justify our choice of default here. - DefaultUnbondingTime time.Duration = time.Hour * 24 * 7 * 3 - - // Default maximum number of bonded validators - DefaultMaxValidators uint32 = 100 - - // Default maximum entries in a UBD/RED pair - DefaultMaxEntries uint32 = 7 - - // DefaultHistorical entries is 10000. Apps that don't use IBC can ignore this - // value by not adding the staking module to the application module manager's - // SetOrderBeginBlockers. - DefaultHistoricalEntries uint32 = 10000 -) - -// NewParams creates a new Params instance -func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint32, bondDenom string) Params { - return Params{ - UnbondingTime: unbondingTime, - MaxValidators: maxValidators, - MaxEntries: maxEntries, - HistoricalEntries: historicalEntries, - BondDenom: bondDenom, - } -} - -// String returns a human readable string representation of the parameters. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -func DefaultParams() Params { - return NewParams( - DefaultUnbondingTime, - DefaultMaxValidators, - DefaultMaxEntries, - DefaultHistoricalEntries, - sdk.DefaultBondDenom, - ) -} - -// String implements the Stringer interface for a Commission object. -func (c Commission) String() string { - out, _ := yaml.Marshal(c) - return string(out) -} - -// String implements the Stringer interface for a CommissionRates object. -func (cr CommissionRates) String() string { - out, _ := yaml.Marshal(cr) - return string(out) -} - -// String implements the Stringer interface for a DVPair object. -func (dv DVPair) String() string { - out, _ := yaml.Marshal(dv) - return string(out) -} - -// String implements the Stringer interface for a DVVTriplet object. -func (dvv DVVTriplet) String() string { - out, _ := yaml.Marshal(dvv) - return string(out) -} - -// String returns a human readable string representation of a Delegation. -func (d Delegation) String() string { - out, _ := yaml.Marshal(d) - return string(out) -} - -// Delegations is a collection of delegations -type Delegations []Delegation - -func (d Delegations) String() (out string) { - for _, del := range d { - out += del.String() + "\n" - } - - return strings.TrimSpace(out) -} - -// String implements the stringer interface for a UnbondingDelegationEntry. -func (e UnbondingDelegationEntry) String() string { - out, _ := yaml.Marshal(e) - return string(out) -} - -// String returns a human readable string representation of an UnbondingDelegation. -func (ubd UnbondingDelegation) String() string { - out := fmt.Sprintf(`Unbonding Delegations between: - Delegator: %s - Validator: %s - Entries:`, ubd.DelegatorAddress, ubd.ValidatorAddress) - for i, entry := range ubd.Entries { - out += fmt.Sprintf(` Unbonding Delegation %d: - Creation Height: %v - Min time to unbond (unix): %v - Expected balance: %s`, i, entry.CreationHeight, - entry.CompletionTime, entry.Balance) - } - - return out -} - -// UnbondingDelegations is a collection of UnbondingDelegation -type UnbondingDelegations []UnbondingDelegation - -func (ubds UnbondingDelegations) String() (out string) { - for _, u := range ubds { - out += u.String() + "\n" - } - - return strings.TrimSpace(out) -} - -// String implements the Stringer interface for a RedelegationEntry object. -func (e RedelegationEntry) String() string { - out, _ := yaml.Marshal(e) - return string(out) -} - -// String returns a human readable string representation of a Redelegation. -func (red Redelegation) String() string { - out := fmt.Sprintf(`Redelegations between: - Delegator: %s - Source Validator: %s - Destination Validator: %s - Entries: -`, - red.DelegatorAddress, red.ValidatorSrcAddress, red.ValidatorDstAddress, - ) - - for i, entry := range red.Entries { - out += fmt.Sprintf(` Redelegation Entry #%d: - Creation height: %v - Min time to unbond (unix): %v - Dest Shares: %s -`, - i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, - ) - } - - return strings.TrimRight(out, "\n") -} - -// Redelegations are a collection of Redelegation -type Redelegations []Redelegation - -func (d Redelegations) String() (out string) { - for _, red := range d { - out += red.String() + "\n" - } - - return strings.TrimSpace(out) -} - -// String implements the Stringer interface for DelegationResponse. -func (d DelegationResponse) String() string { - return fmt.Sprintf("%s\n Balance: %s", d.Delegation.String(), d.Balance) -} - -// String implements the Stringer interface for a Validator object. -func (v Validator) String() string { - out, _ := yaml.Marshal(v) - return string(out) -} - -// Validators is a collection of Validator -type Validators []Validator - -func (v Validators) String() (out string) { - for _, val := range v { - out += val.String() + "\n" - } - - return strings.TrimSpace(out) -} - -// String implements the Stringer interface for a Description object. -func (d Description) String() string { - out, _ := yaml.Marshal(d) - return string(out) -} diff --git a/x/staking/legacy/v043/store.go b/x/staking/legacy/v043/store.go deleted file mode 100644 index 2e06d7d674e..00000000000 --- a/x/staking/legacy/v043/store.go +++ /dev/null @@ -1,78 +0,0 @@ -package v043 - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" - v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040" - v043distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" - v040staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v040" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// migratePrefixAddressAddressAddress is a helper function that migrates all keys of format: -// prefix_bytes | address_1_bytes | address_2_bytes | address_3_bytes -// into format: -// prefix_bytes | address_1_len (1 byte) | address_1_bytes | address_2_len (1 byte) | address_2_bytes | address_3_len (1 byte) | address_3_bytes -func migratePrefixAddressAddressAddress(store sdk.KVStore, prefixBz []byte) { - oldStore := prefix.NewStore(store, prefixBz) - - oldStoreIter := oldStore.Iterator(nil, nil) - defer oldStoreIter.Close() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - addr1 := oldStoreIter.Key()[:v040auth.AddrLen] - addr2 := oldStoreIter.Key()[v040auth.AddrLen : 2*v040auth.AddrLen] - addr3 := oldStoreIter.Key()[2*v040auth.AddrLen:] - newStoreKey := append(append(append( - prefixBz, - address.MustLengthPrefix(addr1)...), address.MustLengthPrefix(addr2)...), address.MustLengthPrefix(addr3)..., - ) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - oldStore.Delete(oldStoreIter.Key()) - } -} - -const powerBytesLen = 8 - -func migrateValidatorsByPowerIndexKey(store sdk.KVStore) { - oldStore := prefix.NewStore(store, v040staking.ValidatorsByPowerIndexKey) - - oldStoreIter := oldStore.Iterator(nil, nil) - defer oldStoreIter.Close() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - powerBytes := oldStoreIter.Key()[:powerBytesLen] - valAddr := oldStoreIter.Key()[powerBytesLen:] - newStoreKey := append(append(types.ValidatorsByPowerIndexKey, powerBytes...), address.MustLengthPrefix(valAddr)...) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - oldStore.Delete(oldStoreIter.Key()) - } -} - -// MigrateStore performs in-place store migrations from v0.40 to v0.43. The -// migration includes: -// -// - Setting the Power Reduction param in the paramstore -func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error { - store := ctx.KVStore(storeKey) - - v043distribution.MigratePrefixAddress(store, v040staking.LastValidatorPowerKey) - - v043distribution.MigratePrefixAddress(store, v040staking.ValidatorsKey) - v043distribution.MigratePrefixAddress(store, v040staking.ValidatorsByConsAddrKey) - migrateValidatorsByPowerIndexKey(store) - - v043distribution.MigratePrefixAddressAddress(store, v040staking.DelegationKey) - v043distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationKey) - v043distribution.MigratePrefixAddressAddress(store, v040staking.UnbondingDelegationByValIndexKey) - migratePrefixAddressAddressAddress(store, v040staking.RedelegationKey) - migratePrefixAddressAddressAddress(store, v040staking.RedelegationByValSrcIndexKey) - migratePrefixAddressAddressAddress(store, v040staking.RedelegationByValDstIndexKey) - - return nil -} diff --git a/x/staking/legacy/v043/store_test.go b/x/staking/legacy/v043/store_test.go deleted file mode 100644 index 09969111548..00000000000 --- a/x/staking/legacy/v043/store_test.go +++ /dev/null @@ -1,138 +0,0 @@ -package v043_test - -import ( - "bytes" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - v040staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v040" - v043staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v043" - "github.com/cosmos/cosmos-sdk/x/staking/teststaking" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func TestStoreMigration(t *testing.T) { - stakingKey := sdk.NewKVStoreKey("staking") - tStakingKey := sdk.NewTransientStoreKey("transient_test") - ctx := testutil.DefaultContext(stakingKey, tStakingKey) - store := ctx.KVStore(stakingKey) - - _, pk1, addr1 := testdata.KeyTestPubAddr() - valAddr1 := sdk.ValAddress(addr1) - val := teststaking.NewValidator(t, valAddr1, pk1) - _, pk1, addr2 := testdata.KeyTestPubAddr() - valAddr2 := sdk.ValAddress(addr2) - _, _, addr3 := testdata.KeyTestPubAddr() - consAddr := sdk.ConsAddress(addr3.String()) - _, _, addr4 := testdata.KeyTestPubAddr() - now := time.Now() - // Use dummy value for all keys. - value := []byte("foo") - - testCases := []struct { - name string - oldKey []byte - newKey []byte - }{ - { - "LastValidatorPowerKey", - v040staking.GetLastValidatorPowerKey(valAddr1), - types.GetLastValidatorPowerKey(valAddr1), - }, - { - "LastTotalPowerKey", - v040staking.LastTotalPowerKey, - types.LastTotalPowerKey, - }, - { - "ValidatorsKey", - v040staking.GetValidatorKey(valAddr1), - types.GetValidatorKey(valAddr1), - }, - { - "ValidatorsByConsAddrKey", - v040staking.GetValidatorByConsAddrKey(consAddr), - types.GetValidatorByConsAddrKey(consAddr), - }, - { - "ValidatorsByPowerIndexKey", - v040staking.GetValidatorsByPowerIndexKey(val), - types.GetValidatorsByPowerIndexKey(val, sdk.DefaultPowerReduction), - }, - { - "DelegationKey", - v040staking.GetDelegationKey(addr4, valAddr1), - types.GetDelegationKey(addr4, valAddr1), - }, - { - "UnbondingDelegationKey", - v040staking.GetUBDKey(addr4, valAddr1), - types.GetUBDKey(addr4, valAddr1), - }, - { - "UnbondingDelegationByValIndexKey", - v040staking.GetUBDByValIndexKey(addr4, valAddr1), - types.GetUBDByValIndexKey(addr4, valAddr1), - }, - { - "RedelegationKey", - v040staking.GetREDKey(addr4, valAddr1, valAddr2), - types.GetREDKey(addr4, valAddr1, valAddr2), - }, - { - "RedelegationByValSrcIndexKey", - v040staking.GetREDByValSrcIndexKey(addr4, valAddr1, valAddr2), - types.GetREDByValSrcIndexKey(addr4, valAddr1, valAddr2), - }, - { - "RedelegationByValDstIndexKey", - v040staking.GetREDByValDstIndexKey(addr4, valAddr1, valAddr2), - types.GetREDByValDstIndexKey(addr4, valAddr1, valAddr2), - }, - { - "UnbondingQueueKey", - v040staking.GetUnbondingDelegationTimeKey(now), - types.GetUnbondingDelegationTimeKey(now), - }, - { - "RedelegationQueueKey", - v040staking.GetRedelegationTimeKey(now), - types.GetRedelegationTimeKey(now), - }, - { - "ValidatorQueueKey", - v040staking.GetValidatorQueueKey(now, 4), - types.GetValidatorQueueKey(now, 4), - }, - { - "HistoricalInfoKey", - v040staking.GetHistoricalInfoKey(4), - types.GetHistoricalInfoKey(4), - }, - } - - // Set all the old keys to the store - for _, tc := range testCases { - store.Set(tc.oldKey, value) - } - - // Run migrations. - err := v043staking.MigrateStore(ctx, stakingKey) - require.NoError(t, err) - - // Make sure the new keys are set and old keys are deleted. - for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - if !bytes.Equal(tc.oldKey, tc.newKey) { - require.Nil(t, store.Get(tc.oldKey)) - } - require.Equal(t, value, store.Get(tc.newKey)) - }) - } -} diff --git a/x/staking/module.go b/x/staking/module.go index 3892a8aa93a..49af90e99d1 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -6,9 +6,8 @@ import ( "fmt" "math/rand" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -19,12 +18,15 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/staking/client/cli" - "github.com/cosmos/cosmos-sdk/x/staking/client/rest" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/simulation" "github.com/cosmos/cosmos-sdk/x/staking/types" ) +const ( + consensusVersion uint64 = 3 +) + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -60,7 +62,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the staking module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -70,13 +72,15 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the REST routes for the staking module. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterHandlers(clientCtx, rtr) -} +// Deprecated: RegisterRESTRoutes is deprecated. `x/staking` legacy REST implementation +// has been removed from the SDK. +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // 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)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root tx command for the staking module. @@ -118,9 +122,9 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { keeper.RegisterInvariants(ir, am.keeper) } -// Route returns the message routing key for the staking module. +// Deprecated: Route returns the message routing key for the staking module. func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) + return sdk.Route{} } // QuerierRoute returns the staking module's querier route name. @@ -138,9 +142,6 @@ 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) } // InitGenesis performs genesis initialization for the staking module. It returns @@ -150,18 +151,17 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. cdc.MustUnmarshalJSON(data, &genesisState) - return InitGenesis(ctx, am.keeper, am.accountKeeper, am.bankKeeper, &genesisState) + return am.keeper.InitGenesis(ctx, &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) + return cdc.MustMarshalJSON(am.keeper.ExportGenesis(ctx)) } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return consensusVersion } // BeginBlock returns the begin blocker for the staking module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { @@ -182,7 +182,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return nil } diff --git a/x/staking/simulation/decoder_test.go b/x/staking/simulation/decoder_test.go index 2a5baf02d98..2253782435c 100644 --- a/x/staking/simulation/decoder_test.go +++ b/x/staking/simulation/decoder_test.go @@ -7,12 +7,10 @@ import ( "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/codec" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" + simapp "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/x/staking/simulation" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -23,14 +21,6 @@ var ( valAddr1 = sdk.ValAddress(delPk1.Address()) ) -func makeTestCodec() (cdc *codec.LegacyAmino) { - cdc = codec.NewLegacyAmino() - sdk.RegisterLegacyAminoCodec(cdc) - cryptocodec.RegisterCrypto(cdc) - types.RegisterLegacyAminoCodec(cdc) - return -} - func TestDecodeStore(t *testing.T) { cdc := simapp.MakeTestEncodingConfig().Marshaler dec := simulation.NewDecodeStore(cdc) @@ -38,16 +28,16 @@ func TestDecodeStore(t *testing.T) { val, err := types.NewValidator(valAddr1, delPk1, types.NewDescription("test", "test", "test", "test", "test")) require.NoError(t, err) - del := types.NewDelegation(delAddr1, valAddr1, sdk.OneDec()) - ubd := types.NewUnbondingDelegation(delAddr1, valAddr1, 15, bondTime, sdk.OneInt(), 1) - red := types.NewRedelegation(delAddr1, valAddr1, valAddr1, 12, bondTime, sdk.OneInt(), sdk.OneDec(), 0) + del := types.NewDelegation(delAddr1, valAddr1, sdk.OneDec(), false) + ubd := types.NewUnbondingDelegation(delAddr1, valAddr1, 15, bondTime, sdk.OneInt()) + red := types.NewRedelegation(delAddr1, valAddr1, valAddr1, 12, bondTime, sdk.OneInt(), sdk.OneDec()) kvPairs := kv.Pairs{ Pairs: []kv.Pair{ {Key: types.LastTotalPowerKey, Value: cdc.MustMarshal(&sdk.IntProto{Int: sdk.OneInt()})}, {Key: types.GetValidatorKey(valAddr1), Value: cdc.MustMarshal(&val)}, {Key: types.LastValidatorPowerKey, Value: valAddr1.Bytes()}, - {Key: types.GetDelegationKey(delAddr1, valAddr1), Value: cdc.MustMarshal(&del)}, + {Key: types.GetLiquidDelegationKey(delAddr1, valAddr1), Value: cdc.MustMarshal(&del)}, {Key: types.GetUBDKey(delAddr1, valAddr1), Value: cdc.MustMarshal(&ubd)}, {Key: types.GetREDKey(delAddr1, valAddr1, valAddr1), Value: cdc.MustMarshal(&red)}, {Key: []byte{0x99}, Value: []byte{0x99}}, diff --git a/x/staking/simulation/genesis.go b/x/staking/simulation/genesis.go index cf4e8e50c44..7278c778c9a 100644 --- a/x/staking/simulation/genesis.go +++ b/x/staking/simulation/genesis.go @@ -40,9 +40,13 @@ func getHistEntries(r *rand.Rand) uint32 { func RandomizedGenState(simState *module.SimulationState) { // params var ( - unbondTime time.Duration - maxVals uint32 - histEntries uint32 + unbondTime time.Duration + maxVals uint32 + histEntries uint32 + minCommissionRate sdk.Dec + validatorBondFactor sdk.Dec + globalLiquidStakingCap sdk.Dec + validatorLiquidStakingCap sdk.Dec ) simState.AppParams.GetOrGenerate( @@ -63,7 +67,17 @@ func RandomizedGenState(simState *module.SimulationState) { // NOTE: the slashing module need to be defined after the staking module on the // NewSimulationManager constructor for this to work simState.UnbondTime = unbondTime - params := types.NewParams(simState.UnbondTime, maxVals, 7, histEntries, sdk.DefaultBondDenom) + params := types.NewParams( + simState.UnbondTime, + maxVals, + 7, + histEntries, + sdk.DefaultBondDenom, + minCommissionRate, + validatorBondFactor, + globalLiquidStakingCap, + validatorLiquidStakingCap, + ) // validators & delegations var ( @@ -88,11 +102,11 @@ func RandomizedGenState(simState *module.SimulationState) { if err != nil { panic(err) } - validator.Tokens = sdk.NewInt(simState.InitialStake) - validator.DelegatorShares = sdk.NewDec(simState.InitialStake) + validator.Tokens = sdk.NewInt((simState.InitialStake)) + validator.DelegatorShares = sdk.NewDecFromInt(sdk.NewInt((simState.InitialStake))) validator.Commission = commission - delegation := types.NewDelegation(simState.Accounts[i].Address, valAddr, sdk.NewDec(simState.InitialStake)) + delegation := types.NewDelegation(simState.Accounts[i].Address, valAddr, sdk.NewDecFromInt(sdk.NewInt((simState.InitialStake))), false) validators = append(validators, validator) delegations = append(delegations, delegation) diff --git a/x/staking/simulation/genesis_test.go b/x/staking/simulation/genesis_test.go index 464e8a40490..b6a817d7a51 100644 --- a/x/staking/simulation/genesis_test.go +++ b/x/staking/simulation/genesis_test.go @@ -63,7 +63,6 @@ func TestRandomizedGenState(t *testing.T) { require.Equal(t, "0.292059246265731326", stakingGenesis.Validators[2].Commission.CommissionRates.Rate.String()) require.Equal(t, "0.330000000000000000", stakingGenesis.Validators[2].Commission.CommissionRates.MaxRate.String()) require.Equal(t, "0.038337453731274481", stakingGenesis.Validators[2].Commission.CommissionRates.MaxChangeRate.String()) - require.Equal(t, "1", stakingGenesis.Validators[2].MinSelfDelegation.String()) } // TestRandomizedGenState1 tests abnormal scenarios of applying RandomizedGenState. diff --git a/x/staking/simulation/operations.go b/x/staking/simulation/operations.go index 2a1c86d635c..d9365c1b5db 100644 --- a/x/staking/simulation/operations.go +++ b/x/staking/simulation/operations.go @@ -146,7 +146,7 @@ func SimulateMsgCreateValidator(ak types.AccountKeeper, bk types.BankKeeper, k k simtypes.RandomDecAmount(r, maxCommission), ) - msg, err := types.NewMsgCreateValidator(address, simAccount.ConsKey.PubKey(), selfDelegation, description, commission, sdk.OneInt()) + msg, err := types.NewMsgCreateValidator(address, simAccount.ConsKey.PubKey(), selfDelegation, description, commission) if err != nil { return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to create CreateValidator message"), nil, err } @@ -207,7 +207,7 @@ func SimulateMsgEditValidator(ak types.AccountKeeper, bk types.BankKeeper, k kee simtypes.RandStringOfLength(r, 10), ) - msg := types.NewMsgEditValidator(address, description, &newCommissionRate, nil) + msg := types.NewMsgEditValidator(address, description, &newCommissionRate) txCtx := simulation.OperationInput{ R: r, diff --git a/x/staking/simulation/operations_test.go b/x/staking/simulation/operations_test.go index 37c01d993c4..5c6452f9a06 100644 --- a/x/staking/simulation/operations_test.go +++ b/x/staking/simulation/operations_test.go @@ -1,323 +1 @@ package simulation_test - -import ( - "math/rand" - "testing" - "time" - - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - "github.com/cosmos/cosmos-sdk/simapp" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/staking/simulation" - "github.com/cosmos/cosmos-sdk/x/staking/teststaking" - "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// TestWeightedOperations tests the weights of the operations. -func TestWeightedOperations(t *testing.T) { - app, ctx := createTestApp(false) - - ctx.WithChainID("test-chain") - - cdc := app.AppCodec() - appParams := make(simtypes.AppParams) - - weightesOps := simulation.WeightedOperations(appParams, cdc, app.AccountKeeper, - app.BankKeeper, app.StakingKeeper, - ) - - s := rand.NewSource(1) - r := rand.New(s) - accs := simtypes.RandomAccounts(r, 3) - - expected := []struct { - weight int - opMsgRoute string - opMsgName string - }{ - {simappparams.DefaultWeightMsgCreateValidator, types.ModuleName, types.TypeMsgCreateValidator}, - {simappparams.DefaultWeightMsgEditValidator, types.ModuleName, types.TypeMsgEditValidator}, - {simappparams.DefaultWeightMsgDelegate, types.ModuleName, types.TypeMsgDelegate}, - {simappparams.DefaultWeightMsgUndelegate, types.ModuleName, types.TypeMsgUndelegate}, - {simappparams.DefaultWeightMsgBeginRedelegate, types.ModuleName, types.TypeMsgBeginRedelegate}, - } - - for i, w := range weightesOps { - operationMsg, _, _ := w.Op()(r, app.BaseApp, ctx, accs, ctx.ChainID()) - // the following checks are very much dependent from the ordering of the output given - // by WeightedOperations. if the ordering in WeightedOperations changes some tests - // will fail - require.Equal(t, expected[i].weight, w.Weight(), "weight should be the same") - require.Equal(t, expected[i].opMsgRoute, operationMsg.Route, "route should be the same") - require.Equal(t, expected[i].opMsgName, operationMsg.Name, "operation Msg name should be the same") - } -} - -// TestSimulateMsgCreateValidator tests the normal scenario of a valid message of type TypeMsgCreateValidator. -// Abonormal scenarios, where the message are created by an errors are not tested here. -func TestSimulateMsgCreateValidator(t *testing.T) { - app, ctx := createTestApp(false) - - // setup 3 accounts - s := rand.NewSource(1) - r := rand.New(s) - accounts := getTestingAccounts(t, r, app, ctx, 3) - - // begin a new block - app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) - - // execute operation - op := simulation.SimulateMsgCreateValidator(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) - operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") - require.NoError(t, err) - - var msg types.MsgCreateValidator - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - - require.True(t, operationMsg.OK) - require.Equal(t, "0.080000000000000000", msg.Commission.MaxChangeRate.String()) - require.Equal(t, "0.080000000000000000", msg.Commission.MaxRate.String()) - require.Equal(t, "0.019527679037870745", msg.Commission.Rate.String()) - require.Equal(t, types.TypeMsgCreateValidator, msg.Type()) - require.Equal(t, []byte{0xa, 0x20, 0x51, 0xde, 0xbd, 0xe8, 0xfa, 0xdf, 0x4e, 0xfc, 0x33, 0xa5, 0x16, 0x94, 0xf6, 0xee, 0xd3, 0x69, 0x7a, 0x7a, 0x1c, 0x2d, 0x50, 0xb6, 0x2, 0xf7, 0x16, 0x4e, 0x66, 0x9f, 0xff, 0x38, 0x91, 0x9b}, msg.Pubkey.Value) - require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.DelegatorAddress) - require.Equal(t, "cosmosvaloper1ghekyjucln7y67ntx7cf27m9dpuxxemnsvnaes", msg.ValidatorAddress) - require.Len(t, futureOperations, 0) -} - -// TestSimulateMsgEditValidator tests the normal scenario of a valid message of type TypeMsgEditValidator. -// Abonormal scenarios, where the message is created by an errors are not tested here. -func TestSimulateMsgEditValidator(t *testing.T) { - app, ctx := createTestApp(false) - blockTime := time.Now().UTC() - ctx = ctx.WithBlockTime(blockTime) - - // setup 3 accounts - s := rand.NewSource(1) - r := rand.New(s) - accounts := getTestingAccounts(t, r, app, ctx, 3) - - // setup accounts[0] as validator - _ = getTestingValidator0(t, app, ctx, accounts) - - // begin a new block - app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) - - // execute operation - op := simulation.SimulateMsgEditValidator(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) - operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") - require.NoError(t, err) - - var msg types.MsgEditValidator - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - - require.True(t, operationMsg.OK) - require.Equal(t, "0.280623462081924936", msg.CommissionRate.String()) - require.Equal(t, "xKGLwQvuyN", msg.Description.Moniker) - require.Equal(t, "SlcxgdXhhu", msg.Description.Identity) - require.Equal(t, "WeLrQKjLxz", msg.Description.Website) - require.Equal(t, "rBqDOTtGTO", msg.Description.SecurityContact) - require.Equal(t, types.TypeMsgEditValidator, msg.Type()) - require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress) - require.Len(t, futureOperations, 0) -} - -// TestSimulateMsgDelegate tests the normal scenario of a valid message of type TypeMsgDelegate. -// Abonormal scenarios, where the message is created by an errors are not tested here. -func TestSimulateMsgDelegate(t *testing.T) { - app, ctx := createTestApp(false) - blockTime := time.Now().UTC() - ctx = ctx.WithBlockTime(blockTime) - - // setup 3 accounts - s := rand.NewSource(1) - r := rand.New(s) - accounts := getTestingAccounts(t, r, app, ctx, 3) - - // setup accounts[0] as validator - validator0 := getTestingValidator0(t, app, ctx, accounts) - setupValidatorRewards(app, ctx, validator0.GetOperator()) - - // begin a new block - app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) - - // execute operation - op := simulation.SimulateMsgDelegate(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) - operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") - require.NoError(t, err) - - var msg types.MsgDelegate - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - - require.True(t, operationMsg.OK) - require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.DelegatorAddress) - require.Equal(t, "98100858108421259236", msg.Amount.Amount.String()) - require.Equal(t, "stake", msg.Amount.Denom) - require.Equal(t, types.TypeMsgDelegate, msg.Type()) - require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress) - require.Len(t, futureOperations, 0) -} - -// TestSimulateMsgUndelegate tests the normal scenario of a valid message of type TypeMsgUndelegate. -// Abonormal scenarios, where the message is created by an errors are not tested here. -func TestSimulateMsgUndelegate(t *testing.T) { - app, ctx := createTestApp(false) - blockTime := time.Now().UTC() - ctx = ctx.WithBlockTime(blockTime) - - // setup 3 accounts - s := rand.NewSource(1) - r := rand.New(s) - accounts := getTestingAccounts(t, r, app, ctx, 3) - - // setup accounts[0] as validator - validator0 := getTestingValidator0(t, app, ctx, accounts) - - // setup delegation - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 2) - validator0, issuedShares := validator0.AddTokensFromDel(delTokens) - delegator := accounts[1] - delegation := types.NewDelegation(delegator.Address, validator0.GetOperator(), issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator0.GetOperator(), delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200)) - - setupValidatorRewards(app, ctx, validator0.GetOperator()) - - // begin a new block - app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) - - // execute operation - op := simulation.SimulateMsgUndelegate(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) - operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") - require.NoError(t, err) - - var msg types.MsgUndelegate - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - - require.True(t, operationMsg.OK) - require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.DelegatorAddress) - require.Equal(t, "280623462081924937", msg.Amount.Amount.String()) - require.Equal(t, "stake", msg.Amount.Denom) - require.Equal(t, types.TypeMsgUndelegate, msg.Type()) - require.Equal(t, "cosmosvaloper1tnh2q55v8wyygtt9srz5safamzdengsn9dsd7z", msg.ValidatorAddress) - require.Len(t, futureOperations, 0) -} - -// TestSimulateMsgBeginRedelegate tests the normal scenario of a valid message of type TypeMsgBeginRedelegate. -// Abonormal scenarios, where the message is created by an errors, are not tested here. -func TestSimulateMsgBeginRedelegate(t *testing.T) { - app, ctx := createTestApp(false) - blockTime := time.Now().UTC() - ctx = ctx.WithBlockTime(blockTime) - - // setup 3 accounts - s := rand.NewSource(5) - r := rand.New(s) - accounts := getTestingAccounts(t, r, app, ctx, 3) - - // setup accounts[0] as validator0 and accounts[1] as validator1 - validator0 := getTestingValidator0(t, app, ctx, accounts) - validator1 := getTestingValidator1(t, app, ctx, accounts) - - delTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 2) - validator0, issuedShares := validator0.AddTokensFromDel(delTokens) - - // setup accounts[2] as delegator - delegator := accounts[2] - delegation := types.NewDelegation(delegator.Address, validator1.GetOperator(), issuedShares) - app.StakingKeeper.SetDelegation(ctx, delegation) - app.DistrKeeper.SetDelegatorStartingInfo(ctx, validator1.GetOperator(), delegator.Address, distrtypes.NewDelegatorStartingInfo(2, sdk.OneDec(), 200)) - - setupValidatorRewards(app, ctx, validator0.GetOperator()) - setupValidatorRewards(app, ctx, validator1.GetOperator()) - - // begin a new block - app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}}) - - // execute operation - op := simulation.SimulateMsgBeginRedelegate(app.AccountKeeper, app.BankKeeper, app.StakingKeeper) - operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") - require.NoError(t, err) - - var msg types.MsgBeginRedelegate - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - - require.True(t, operationMsg.OK) - require.Equal(t, "cosmos12gwd9jchc69wck8dhstxgwz3z8qs8yv67ps8mu", msg.DelegatorAddress) - require.Equal(t, "489348507626016866", msg.Amount.Amount.String()) - require.Equal(t, "stake", msg.Amount.Denom) - require.Equal(t, types.TypeMsgBeginRedelegate, msg.Type()) - require.Equal(t, "cosmosvaloper1h6a7shta7jyc72hyznkys683z98z36e0zdk8g9", msg.ValidatorDstAddress) - require.Equal(t, "cosmosvaloper17s94pzwhsn4ah25tec27w70n65h5t2scgxzkv2", msg.ValidatorSrcAddress) - require.Len(t, futureOperations, 0) -} - -// returns context and an app with updated mint keeper -func createTestApp(isCheckTx bool) (*simapp.SimApp, sdk.Context) { - // sdk.PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)) - app := simapp.Setup(isCheckTx) - - ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) - app.MintKeeper.SetParams(ctx, minttypes.DefaultParams()) - app.MintKeeper.SetMinter(ctx, minttypes.DefaultInitialMinter()) - - return app, ctx -} - -func getTestingAccounts(t *testing.T, r *rand.Rand, app *simapp.SimApp, ctx sdk.Context, n int) []simtypes.Account { - accounts := simtypes.RandomAccounts(r, n) - - initAmt := app.StakingKeeper.TokensFromConsensusPower(ctx, 200) - initCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, initAmt)) - - // add coins to the accounts - for _, account := range accounts { - acc := app.AccountKeeper.NewAccountWithAddress(ctx, account.Address) - app.AccountKeeper.SetAccount(ctx, acc) - require.NoError(t, simapp.FundAccount(app.BankKeeper, ctx, account.Address, initCoins)) - } - - return accounts -} - -func getTestingValidator0(t *testing.T, app *simapp.SimApp, ctx sdk.Context, accounts []simtypes.Account) types.Validator { - commission0 := types.NewCommission(sdk.ZeroDec(), sdk.OneDec(), sdk.OneDec()) - return getTestingValidator(t, app, ctx, accounts, commission0, 0) -} - -func getTestingValidator1(t *testing.T, app *simapp.SimApp, ctx sdk.Context, accounts []simtypes.Account) types.Validator { - commission1 := types.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) - return getTestingValidator(t, app, ctx, accounts, commission1, 1) -} - -func getTestingValidator(t *testing.T, app *simapp.SimApp, ctx sdk.Context, accounts []simtypes.Account, commission types.Commission, n int) types.Validator { - account := accounts[n] - valPubKey := account.PubKey - valAddr := sdk.ValAddress(account.PubKey.Address().Bytes()) - validator := teststaking.NewValidator(t, valAddr, valPubKey) - validator, err := validator.SetInitialCommission(commission) - require.NoError(t, err) - - validator.DelegatorShares = sdk.NewDec(100) - validator.Tokens = app.StakingKeeper.TokensFromConsensusPower(ctx, 100) - - app.StakingKeeper.SetValidator(ctx, validator) - - return validator -} - -func setupValidatorRewards(app *simapp.SimApp, ctx sdk.Context, valAddress sdk.ValAddress) { - decCoins := sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdk.OneDec())} - historicalRewards := distrtypes.NewValidatorHistoricalRewards(decCoins, 2) - app.DistrKeeper.SetValidatorHistoricalRewards(ctx, valAddress, 2, historicalRewards) - // setup current revards - currentRewards := distrtypes.NewValidatorCurrentRewards(decCoins, 3) - app.DistrKeeper.SetValidatorCurrentRewards(ctx, valAddress, currentRewards) -} diff --git a/x/staking/teststaking/helper.go b/x/staking/teststaking/helper.go index 25b021df07a..6c633092ca9 100644 --- a/x/staking/teststaking/helper.go +++ b/x/staking/teststaking/helper.go @@ -1,6 +1,7 @@ package teststaking import ( + "context" "testing" "time" @@ -13,12 +14,12 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -// Helper is a structure which wraps the staking handler +// Helper is a structure which wraps the staking message server // and provides methods useful in tests type Helper struct { - t *testing.T - h sdk.Handler - k keeper.Keeper + t *testing.T + msgSrvr stakingtypes.MsgServer + k keeper.Keeper Ctx sdk.Context Commission stakingtypes.CommissionRates @@ -26,18 +27,18 @@ type Helper struct { Denom string } -// NewHelper creates staking Handler wrapper for tests +// NewHelper creates a new instance of Helper. func NewHelper(t *testing.T, ctx sdk.Context, k keeper.Keeper) *Helper { - return &Helper{t, staking.NewHandler(k), k, ctx, ZeroCommission(), sdk.DefaultBondDenom} + return &Helper{t, keeper.NewMsgServerImpl(k), k, ctx, ZeroCommission(), sdk.DefaultBondDenom} } -// CreateValidator calls handler to create a new staking validator +// CreateValidator calls staking module `MsgServer/CreateValidator` to create a new validator func (sh *Helper) CreateValidator(addr sdk.ValAddress, pk cryptotypes.PubKey, stakeAmount sdk.Int, ok bool) { coin := sdk.NewCoin(sh.Denom, stakeAmount) sh.createValidator(addr, pk, coin, ok) } -// CreateValidatorWithValPower calls handler to create a new staking validator with zero +// CreateValidatorWithValPower calls staking module `MsgServer/CreateValidator` to create a new validator with zero // commission func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk cryptotypes.PubKey, valPower int64, ok bool) sdk.Int { amount := sh.k.TokensFromConsensusPower(sh.Ctx, valPower) @@ -49,41 +50,100 @@ func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk cryptotype // CreateValidatorMsg returns a message used to create validator in this service. func (sh *Helper) CreateValidatorMsg(addr sdk.ValAddress, pk cryptotypes.PubKey, stakeAmount sdk.Int) *stakingtypes.MsgCreateValidator { coin := sdk.NewCoin(sh.Denom, stakeAmount) - msg, err := stakingtypes.NewMsgCreateValidator(addr, pk, coin, stakingtypes.Description{}, sh.Commission, sdk.OneInt()) + msg, err := stakingtypes.NewMsgCreateValidator(addr, pk, coin, stakingtypes.Description{}, sh.Commission) require.NoError(sh.t, err) return msg } +// CreateValidatorWithMsg calls staking module `MsgServer/CreateValidator` +func (sh *Helper) CreateValidatorWithMsg(ctx context.Context, msg *stakingtypes.MsgCreateValidator) (*stakingtypes.MsgCreateValidatorResponse, error) { + return sh.msgSrvr.CreateValidator(ctx, msg) +} + func (sh *Helper) createValidator(addr sdk.ValAddress, pk cryptotypes.PubKey, coin sdk.Coin, ok bool) { - msg, err := stakingtypes.NewMsgCreateValidator(addr, pk, coin, stakingtypes.Description{}, sh.Commission, sdk.OneInt()) + msg, err := stakingtypes.NewMsgCreateValidator(addr, pk, coin, stakingtypes.Description{}, sh.Commission) require.NoError(sh.t, err) - sh.Handle(msg, ok) + res, err := sh.msgSrvr.CreateValidator(sdk.WrapSDKContext(sh.Ctx), msg) + if ok { + require.NoError(sh.t, err) + require.NotNil(sh.t, res) + } else { + require.Error(sh.t, err) + require.Nil(sh.t, res) + } } -// Delegate calls handler to delegate stake for a validator +// Delegate calls staking module staking module `MsgServer/Delegate` to delegate stake for a validator func (sh *Helper) Delegate(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Int) { coin := sdk.NewCoin(sh.Denom, amount) msg := stakingtypes.NewMsgDelegate(delegator, val, coin) - sh.Handle(msg, true) + res, err := sh.msgSrvr.Delegate(sdk.WrapSDKContext(sh.Ctx), msg) + require.NoError(sh.t, err) + require.NotNil(sh.t, res) } -// DelegateWithPower calls handler to delegate stake for a validator +// DelegateWithPower calls staking module `MsgServer/Delegate` to delegate stake for a validator func (sh *Helper) DelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64) { coin := sdk.NewCoin(sh.Denom, sh.k.TokensFromConsensusPower(sh.Ctx, power)) msg := stakingtypes.NewMsgDelegate(delegator, val, coin) - sh.Handle(msg, true) + res, err := sh.msgSrvr.Delegate(sdk.WrapSDKContext(sh.Ctx), msg) + require.NoError(sh.t, err) + require.NotNil(sh.t, res) } -// Undelegate calls handler to unbound some stake from a validator. -func (sh *Helper) Undelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Int, ok bool) *sdk.Result { +// Undelegate calls staking module `MsgServer/Undelegate` to unbound some stake from a validator. +func (sh *Helper) Undelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Int, ok bool) { unbondAmt := sdk.NewCoin(sh.Denom, amount) msg := stakingtypes.NewMsgUndelegate(delegator, val, unbondAmt) - return sh.Handle(msg, ok) + res, err := sh.msgSrvr.Undelegate(sdk.WrapSDKContext(sh.Ctx), msg) + if ok { + require.NoError(sh.t, err) + require.NotNil(sh.t, res) + } else { + require.Error(sh.t, err) + require.Nil(sh.t, res) + } } -// Handle calls staking handler on a given message -func (sh *Helper) Handle(msg sdk.Msg, ok bool) *sdk.Result { - res, err := sh.h(sh.Ctx, msg) +func (sh *Helper) TokenizeShares(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Coin, shareOwner sdk.AccAddress, ok bool) { + msg := &stakingtypes.MsgTokenizeShares{ + DelegatorAddress: delegator.String(), + ValidatorAddress: val.String(), + Amount: amount, + TokenizedShareOwner: shareOwner.String(), + } + res, err := sh.msgSrvr.TokenizeShares(sdk.WrapSDKContext(sh.Ctx), msg) + if ok { + require.NoError(sh.t, err) + require.NotNil(sh.t, res) + } else { + require.Error(sh.t, err) + require.Nil(sh.t, res) + } +} + +func (sh *Helper) RedeemTokensForShares(delegator sdk.AccAddress, amount sdk.Coin, ok bool) { + msg := &stakingtypes.MsgRedeemTokensforShares{ + DelegatorAddress: delegator.String(), + Amount: amount, + } + res, err := sh.msgSrvr.RedeemTokens(sdk.WrapSDKContext(sh.Ctx), msg) + if ok { + require.NoError(sh.t, err) + require.NotNil(sh.t, res) + } else { + require.Error(sh.t, err) + require.Nil(sh.t, res) + } +} + +func (sh *Helper) TranserTokenizeShareRecord(recordID uint64, owner, newOwner sdk.AccAddress, ok bool) { + msg := &stakingtypes.MsgTransferTokenizeShareRecord{ + TokenizeShareRecordId: recordID, + Sender: owner.String(), + NewOwner: newOwner.String(), + } + res, err := sh.msgSrvr.TransferTokenizeShareRecord(sdk.WrapSDKContext(sh.Ctx), msg) if ok { require.NoError(sh.t, err) require.NotNil(sh.t, res) @@ -91,13 +151,12 @@ func (sh *Helper) Handle(msg sdk.Msg, ok bool) *sdk.Result { require.Error(sh.t, err) require.Nil(sh.t, res) } - return res } // CheckValidator asserts that a validor exists and has a given status (if status!="") // and if has a right jailed flag. func (sh *Helper) CheckValidator(addr sdk.ValAddress, status stakingtypes.BondStatus, jailed bool) stakingtypes.Validator { - v, ok := sh.k.GetValidator(sh.Ctx, addr) + v, ok := sh.k.GetLiquidValidator(sh.Ctx, addr) require.True(sh.t, ok) require.Equal(sh.t, jailed, v.Jailed, "wrong Jalied status") if status >= 0 { @@ -108,7 +167,7 @@ func (sh *Helper) CheckValidator(addr sdk.ValAddress, status stakingtypes.BondSt // CheckDelegator asserts that a delegator exists func (sh *Helper) CheckDelegator(delegator sdk.AccAddress, val sdk.ValAddress, found bool) { - _, ok := sh.k.GetDelegation(sh.Ctx, delegator, val) + _, ok := sh.k.GetLiquidDelegation(sh.Ctx, delegator, val) require.Equal(sh.t, ok, found) } diff --git a/x/staking/types/authz.pb.go b/x/staking/types/authz.pb.go index d4e5c5c5bdd..1c1cb92fd0d 100644 --- a/x/staking/types/authz.pb.go +++ b/x/staking/types/authz.pb.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/authz.proto +// source: staking/v1beta1/authz.proto package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - _ "github.com/regen-network/cosmos-proto" io "io" math "math" math_bits "math/bits" @@ -26,8 +26,6 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // AuthorizationType defines the type of staking module authorization type -// -// Since: cosmos-sdk 0.43 type AuthorizationType int32 const ( @@ -60,12 +58,10 @@ func (x AuthorizationType) String() string { } func (AuthorizationType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d6d8cdbc6f4432f0, []int{0} + return fileDescriptor_dbc817c76ffc2c21, []int{0} } // StakeAuthorization defines authorization for delegate/undelegate/redelegate. -// -// Since: cosmos-sdk 0.43 type StakeAuthorization struct { // 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. @@ -84,7 +80,7 @@ func (m *StakeAuthorization) Reset() { *m = StakeAuthorization{} } func (m *StakeAuthorization) String() string { return proto.CompactTextString(m) } func (*StakeAuthorization) ProtoMessage() {} func (*StakeAuthorization) Descriptor() ([]byte, []int) { - return fileDescriptor_d6d8cdbc6f4432f0, []int{0} + return fileDescriptor_dbc817c76ffc2c21, []int{0} } func (m *StakeAuthorization) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -181,7 +177,7 @@ func (m *StakeAuthorization_Validators) Reset() { *m = StakeAuthorizatio func (m *StakeAuthorization_Validators) String() string { return proto.CompactTextString(m) } func (*StakeAuthorization_Validators) ProtoMessage() {} func (*StakeAuthorization_Validators) Descriptor() ([]byte, []int) { - return fileDescriptor_d6d8cdbc6f4432f0, []int{0, 0} + return fileDescriptor_dbc817c76ffc2c21, []int{0, 0} } func (m *StakeAuthorization_Validators) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,41 +219,42 @@ func init() { proto.RegisterType((*StakeAuthorization_Validators)(nil), "cosmos.staking.v1beta1.StakeAuthorization.Validators") } -func init() { - proto.RegisterFile("cosmos/staking/v1beta1/authz.proto", fileDescriptor_d6d8cdbc6f4432f0) -} +func init() { proto.RegisterFile("staking/v1beta1/authz.proto", fileDescriptor_dbc817c76ffc2c21) } -var fileDescriptor_d6d8cdbc6f4432f0 = []byte{ - // 462 bytes of a gzipped FileDescriptorProto +var fileDescriptor_dbc817c76ffc2c21 = []byte{ + // 500 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0x86, 0x3d, 0x0d, 0x02, 0x72, 0xb8, 0xa8, 0x19, 0x21, 0x94, 0x06, 0x31, 0x2d, 0x59, 0x40, - 0xb8, 0x74, 0xac, 0x16, 0xb1, 0x61, 0x97, 0xb4, 0x2e, 0x8d, 0x54, 0xb5, 0x95, 0xeb, 0x56, 0xd0, - 0x8d, 0x35, 0x89, 0x47, 0xc9, 0x28, 0xb6, 0x27, 0xf2, 0x4c, 0x4a, 0xd2, 0xa7, 0xe0, 0x09, 0x78, - 0x00, 0xd6, 0x3c, 0x04, 0x0b, 0x16, 0x15, 0x2b, 0x76, 0xa0, 0xe4, 0x45, 0x90, 0xc7, 0xae, 0xa1, - 0x34, 0x65, 0xc3, 0xca, 0x97, 0xf3, 0xcd, 0xf7, 0x9f, 0x63, 0x1d, 0x43, 0xbd, 0x2b, 0x55, 0x24, - 0x95, 0xad, 0x34, 0x1b, 0x88, 0xb8, 0x67, 0x9f, 0xac, 0x75, 0xb8, 0x66, 0x6b, 0x36, 0x1b, 0xe9, - 0xfe, 0x29, 0x1d, 0x26, 0x52, 0x4b, 0x7c, 0x3f, 0x63, 0x68, 0xce, 0xd0, 0x9c, 0xa9, 0xdd, 0xeb, - 0xc9, 0x9e, 0x34, 0x88, 0x9d, 0xde, 0x65, 0x74, 0x6d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0x99, 0xd4, 0x33, 0x2e, 0x49, 0x9f, 0x82, 0x27, 0xe0, + 0x01, 0x58, 0xf7, 0x21, 0x10, 0xab, 0x8a, 0x15, 0x3b, 0x50, 0x22, 0xf1, 0x1c, 0xc8, 0x97, 0x84, + 0x96, 0xa6, 0x2b, 0x56, 0xbe, 0x9c, 0xcf, 0xdf, 0xf9, 0xe7, 0xe8, 0x18, 0x56, 0x84, 0xc4, 0x7d, + 0xca, 0x02, 0xf3, 0x74, 0xa3, 0x43, 0x24, 0xde, 0x30, 0x71, 0x22, 0x7b, 0x67, 0xc6, 0x20, 0xe6, + 0x92, 0xa3, 0x47, 0x5d, 0x2e, 0x22, 0x2e, 0x8c, 0x82, 0x31, 0x0a, 0xa6, 0xb6, 0x14, 0xf0, 0x80, + 0x67, 0x88, 0x99, 0xde, 0xe5, 0x74, 0x6d, 0x39, 0xa7, 0xbd, 0xbc, 0x50, 0x7c, 0x9a, 0x97, 0xb4, + 0xfc, 0xc9, 0xec, 0x60, 0x41, 0x66, 0x9d, 0xba, 0x9c, 0xb2, 0xbc, 0xbe, 0xfe, 0xbb, 0x04, 0xa8, + 0x2d, 0x71, 0x9f, 0x58, 0x89, 0xec, 0xf1, 0x98, 0x9e, 0x61, 0x49, 0x39, 0x43, 0x04, 0x20, 0xc2, + 0x43, 0x4f, 0xf2, 0x3e, 0x61, 0xa2, 0xaa, 0xae, 0xa9, 0xf5, 0x7b, 0x8d, 0x65, 0xa3, 0x30, 0xa7, + 0xae, 0x69, 0x22, 0x63, 0x93, 0x53, 0xd6, 0x7c, 0xf1, 0xe5, 0xe7, 0xea, 0xd3, 0x80, 0xca, 0x5e, + 0xd2, 0x31, 0xba, 0x3c, 0x2a, 0x22, 0x14, 0x17, 0x5d, 0xf8, 0x7d, 0x53, 0x8e, 0x06, 0x44, 0x64, + 0xb0, 0x53, 0x8e, 0xf0, 0xd0, 0xcd, 0xc4, 0xe8, 0x10, 0x00, 0x87, 0x21, 0xff, 0xe8, 0x85, 0x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, 0x9e, 0x21, 0xa5, 0xe6, 0xd1, 0xd7, 0xb1, 0xa6, 0x5e, 0x8c, 0x35, 0xf5, + 0xd7, 0x58, 0x53, 0x3f, 0x4d, 0x34, 0xe5, 0x62, 0xa2, 0x29, 0x3f, 0x26, 0x9a, 0x72, 0xfc, 0xe6, + 0xd2, 0x66, 0xd1, 0x93, 0x30, 0x11, 0x94, 0x33, 0xca, 0xba, 0x66, 0x48, 0x4f, 0x12, 0xea, 0x53, + 0x39, 0xd2, 0x8b, 0xa1, 0xeb, 0x11, 0xf7, 0x93, 0x90, 0x98, 0x43, 0x73, 0xfa, 0x6f, 0x65, 0x6b, + 0xd7, 0xb9, 0x9d, 0xed, 0xfa, 0xcb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x07, 0x38, 0x59, 0x44, + 0x73, 0x03, 0x00, 0x00, } func (m *StakeAuthorization) Marshal() (dAtA []byte, err error) { diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 485549077bd..a8ebc5f6409 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -17,6 +17,11 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgDelegate{}, "cosmos-sdk/MsgDelegate", nil) cdc.RegisterConcrete(&MsgUndelegate{}, "cosmos-sdk/MsgUndelegate", nil) cdc.RegisterConcrete(&MsgBeginRedelegate{}, "cosmos-sdk/MsgBeginRedelegate", nil) + cdc.RegisterConcrete(&MsgTokenizeShares{}, "cosmos-sdk/MsgTokenizeShares", nil) + cdc.RegisterConcrete(&MsgRedeemTokensforShares{}, "cosmos-sdk/MsgRedeemTokensforShares", nil) + cdc.RegisterConcrete(&MsgTransferTokenizeShareRecord{}, "cosmos-sdk/MsgTransferTokenizeShareRecord", nil) + cdc.RegisterConcrete(&MsgDisableTokenizeShares{}, "cosmos-sdk/MsgDisableTokenizeShares", nil) + cdc.RegisterConcrete(&MsgEnableTokenizeShares{}, "cosmos-sdk/MsgEnableTokenizeShares", nil) } // RegisterInterfaces registers the x/staking interfaces types with the interface registry @@ -27,6 +32,12 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgDelegate{}, &MsgUndelegate{}, &MsgBeginRedelegate{}, + &MsgCancelUnbondingDelegation{}, + &MsgTokenizeShares{}, + &MsgRedeemTokensforShares{}, + &MsgTransferTokenizeShareRecord{}, + &MsgDisableTokenizeShares{}, + &MsgEnableTokenizeShares{}, ) registry.RegisterImplementations( (*authz.Authorization)(nil), diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index e1cf042d991..38bd0000191 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -6,7 +6,7 @@ import ( "strings" "time" - yaml "gopkg.in/yaml.v2" + "sigs.k8s.io/yaml" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -30,11 +30,12 @@ func (dvv DVVTriplet) String() string { // NewDelegation creates a new delegation object // //nolint:interfacer -func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) Delegation { +func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec, validatorBond bool) Delegation { return Delegation{ DelegatorAddress: delegatorAddr.String(), ValidatorAddress: validatorAddr.String(), Shares: shares, + ValidatorBond: validatorBond, } } @@ -61,8 +62,10 @@ func UnmarshalDelegation(cdc codec.BinaryCodec, value []byte) (delegation Delega } func (d Delegation) GetDelegatorAddr() sdk.AccAddress { - delAddr := sdk.MustAccAddressFromBech32(d.DelegatorAddress) - + delAddr, err := sdk.AccAddressFromBech32(d.DelegatorAddress) + if err != nil { + panic(err) + } return delAddr } @@ -92,14 +95,12 @@ func (d Delegations) String() (out string) { return strings.TrimSpace(out) } -func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int, unbondingID uint64) UnbondingDelegationEntry { +func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int) UnbondingDelegationEntry { return UnbondingDelegationEntry{ - CreationHeight: creationHeight, - CompletionTime: completionTime, - InitialBalance: balance, - Balance: balance, - UnbondingId: unbondingID, - UnbondingOnHoldRefCount: 0, + CreationHeight: creationHeight, + CompletionTime: completionTime, + InitialBalance: balance, + Balance: balance, } } @@ -114,51 +115,25 @@ func (e UnbondingDelegationEntry) IsMature(currentTime time.Time) bool { return !e.CompletionTime.After(currentTime) } -// OnHold - is the current entry on hold due to external modules -func (e UnbondingDelegationEntry) OnHold() bool { - return e.UnbondingOnHoldRefCount > 0 -} - -// return the unbonding delegation entry -func MustMarshalUBDE(cdc codec.BinaryCodec, ubd UnbondingDelegationEntry) []byte { - return cdc.MustMarshal(&ubd) -} - -// unmarshal a unbonding delegation entry from a store value -func MustUnmarshalUBDE(cdc codec.BinaryCodec, value []byte) UnbondingDelegationEntry { - ubd, err := UnmarshalUBDE(cdc, value) - if err != nil { - panic(err) - } - - return ubd -} - -// unmarshal a unbonding delegation entry from a store value -func UnmarshalUBDE(cdc codec.BinaryCodec, value []byte) (ubd UnbondingDelegationEntry, err error) { - err = cdc.Unmarshal(value, &ubd) - return ubd, err -} - // NewUnbondingDelegation - create a new unbonding delegation object // //nolint:interfacer func NewUnbondingDelegation( delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, - creationHeight int64, minTime time.Time, balance sdk.Int, id uint64, + creationHeight int64, minTime time.Time, balance sdk.Int, ) UnbondingDelegation { return UnbondingDelegation{ DelegatorAddress: delegatorAddr.String(), ValidatorAddress: validatorAddr.String(), Entries: []UnbondingDelegationEntry{ - NewUnbondingDelegationEntry(creationHeight, minTime, balance, id), + NewUnbondingDelegationEntry(creationHeight, minTime, balance), }, } } // AddEntry - append entry to the unbonding delegation -func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, id uint64) { - entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance, id) +func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int) { + entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) ubd.Entries = append(ubd.Entries, entry) } @@ -216,14 +191,12 @@ func (ubds UnbondingDelegations) String() (out string) { return strings.TrimSpace(out) } -func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int, sharesDst sdk.Dec, id uint64) RedelegationEntry { +func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int, sharesDst sdk.Dec) RedelegationEntry { return RedelegationEntry{ - CreationHeight: creationHeight, - CompletionTime: completionTime, - InitialBalance: balance, - SharesDst: sharesDst, - UnbondingId: id, - UnbondingOnHoldRefCount: 0, + CreationHeight: creationHeight, + CompletionTime: completionTime, + InitialBalance: balance, + SharesDst: sharesDst, } } @@ -238,29 +211,24 @@ func (e RedelegationEntry) IsMature(currentTime time.Time) bool { return !e.CompletionTime.After(currentTime) } -// OnHold - is the current entry on hold due to external modules -func (e RedelegationEntry) OnHold() bool { - return e.UnbondingOnHoldRefCount > 0 -} - //nolint:interfacer func NewRedelegation( delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, - creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec, unbondingId uint64, + creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec, ) Redelegation { return Redelegation{ DelegatorAddress: delegatorAddr.String(), ValidatorSrcAddress: validatorSrcAddr.String(), ValidatorDstAddress: validatorDstAddr.String(), Entries: []RedelegationEntry{ - NewRedelegationEntry(creationHeight, minTime, balance, sharesDst, unbondingId), + NewRedelegationEntry(creationHeight, minTime, balance, sharesDst), }, } } // AddEntry - append entry to the unbonding delegation -func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec, unbondingId uint64) { - entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst, unbondingId) +func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec) { + entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst) red.Entries = append(red.Entries, entry) } @@ -330,10 +298,10 @@ func (d Redelegations) String() (out string) { // NewDelegationResp creates a new DelegationResponse instance func NewDelegationResp( - delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec, balance sdk.Coin, + delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec, validatorBond bool, balance sdk.Coin, ) DelegationResponse { return DelegationResponse{ - Delegation: NewDelegation(delegatorAddr, validatorAddr, shares), + Delegation: NewDelegation(delegatorAddr, validatorAddr, shares, validatorBond), Balance: balance, } } @@ -387,9 +355,10 @@ func NewRedelegationResponse( // NewRedelegationEntryResponse creates a new RedelegationEntryResponse instance. func NewRedelegationEntryResponse( - creationHeight int64, completionTime time.Time, sharesDst sdk.Dec, initialBalance, balance sdk.Int, id uint64) RedelegationEntryResponse { + creationHeight int64, completionTime time.Time, sharesDst sdk.Dec, initialBalance, balance sdk.Int, +) RedelegationEntryResponse { return RedelegationEntryResponse{ - RedelegationEntry: NewRedelegationEntry(creationHeight, completionTime, initialBalance, sharesDst, id), + RedelegationEntry: NewRedelegationEntry(creationHeight, completionTime, initialBalance, sharesDst), Balance: balance, } } diff --git a/x/staking/types/delegation_test.go b/x/staking/types/delegation_test.go index ba6fbfe58bf..338c87bf14b 100644 --- a/x/staking/types/delegation_test.go +++ b/x/staking/types/delegation_test.go @@ -13,7 +13,7 @@ import ( ) func TestDelegationEqual(t *testing.T) { - d1 := types.NewDelegation(sdk.AccAddress(valAddr1), valAddr2, sdk.NewDec(100)) + d1 := types.NewDelegation(sdk.AccAddress(valAddr1), valAddr2, sdk.NewDec(100), false) d2 := d1 ok := d1.String() == d2.String() @@ -27,13 +27,13 @@ func TestDelegationEqual(t *testing.T) { } func TestDelegationString(t *testing.T) { - d := types.NewDelegation(sdk.AccAddress(valAddr1), valAddr2, sdk.NewDec(100)) + d := types.NewDelegation(sdk.AccAddress(valAddr1), valAddr2, sdk.NewDec(100), false) require.NotEmpty(t, d.String()) } func TestUnbondingDelegationEqual(t *testing.T) { ubd1 := types.NewUnbondingDelegation(sdk.AccAddress(valAddr1), valAddr2, 0, - time.Unix(0, 0), sdk.NewInt(0), 1) + time.Unix(0, 0), sdk.NewInt(0)) ubd2 := ubd1 ok := ubd1.String() == ubd2.String() @@ -48,7 +48,7 @@ func TestUnbondingDelegationEqual(t *testing.T) { func TestUnbondingDelegationString(t *testing.T) { ubd := types.NewUnbondingDelegation(sdk.AccAddress(valAddr1), valAddr2, 0, - time.Unix(0, 0), sdk.NewInt(0), 1) + time.Unix(0, 0), sdk.NewInt(0)) require.NotEmpty(t, ubd.String()) } @@ -56,10 +56,10 @@ func TestUnbondingDelegationString(t *testing.T) { func TestRedelegationEqual(t *testing.T) { r1 := types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0, time.Unix(0, 0), sdk.NewInt(0), - sdk.NewDec(0), 1) + sdk.NewDec(0)) r2 := types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0, time.Unix(0, 0), sdk.NewInt(0), - sdk.NewDec(0), 2) + sdk.NewDec(0)) ok := r1.String() == r2.String() require.True(t, ok) @@ -74,16 +74,16 @@ func TestRedelegationEqual(t *testing.T) { func TestRedelegationString(t *testing.T) { r := types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0, time.Unix(0, 0), sdk.NewInt(0), - sdk.NewDec(10), 1) + sdk.NewDec(10)) require.NotEmpty(t, r.String()) } func TestDelegationResponses(t *testing.T) { cdc := codec.NewLegacyAmino() - dr1 := types.NewDelegationResp(sdk.AccAddress(valAddr1), valAddr2, sdk.NewDec(5), + dr1 := types.NewDelegationResp(sdk.AccAddress(valAddr1), valAddr2, sdk.NewDec(5), false, sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5))) - dr2 := types.NewDelegationResp(sdk.AccAddress(valAddr1), valAddr3, sdk.NewDec(5), + dr2 := types.NewDelegationResp(sdk.AccAddress(valAddr1), valAddr3, sdk.NewDec(5), false, sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5))) drs := types.DelegationResponses{dr1, dr2} @@ -111,8 +111,8 @@ func TestDelegationResponses(t *testing.T) { func TestRedelegationResponses(t *testing.T) { cdc := codec.NewLegacyAmino() entries := []types.RedelegationEntryResponse{ - types.NewRedelegationEntryResponse(0, time.Unix(0, 0), sdk.NewDec(5), sdk.NewInt(5), sdk.NewInt(5), 0), - types.NewRedelegationEntryResponse(0, time.Unix(0, 0), sdk.NewDec(5), sdk.NewInt(5), sdk.NewInt(5), 0), + types.NewRedelegationEntryResponse(0, time.Unix(0, 0), sdk.NewDec(5), sdk.NewInt(5), sdk.NewInt(5)), + types.NewRedelegationEntryResponse(0, time.Unix(0, 0), sdk.NewDec(5), sdk.NewInt(5), sdk.NewInt(5)), } rdr1 := types.NewRedelegationResponse(sdk.AccAddress(valAddr1), valAddr2, valAddr3, entries) rdr2 := types.NewRedelegationResponse(sdk.AccAddress(valAddr2), valAddr1, valAddr3, entries) diff --git a/x/staking/types/errors.go b/x/staking/types/errors.go index 10c16276dd9..5c393997c80 100644 --- a/x/staking/types/errors.go +++ b/x/staking/types/errors.go @@ -11,44 +11,60 @@ import ( // // REF: https://github.com/cosmos/cosmos-sdk/issues/5450 var ( - ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 2, "empty validator address") - ErrNoValidatorFound = sdkerrors.Register(ModuleName, 3, "validator does not exist") - ErrValidatorOwnerExists = sdkerrors.Register(ModuleName, 4, "validator already exist for this operator address; must use new validator operator address") - ErrValidatorPubKeyExists = sdkerrors.Register(ModuleName, 5, "validator already exist for this pubkey; must use new validator pubkey") - ErrValidatorPubKeyTypeNotSupported = sdkerrors.Register(ModuleName, 6, "validator pubkey type is not supported") - ErrValidatorJailed = sdkerrors.Register(ModuleName, 7, "validator for this address is currently jailed") - ErrBadRemoveValidator = sdkerrors.Register(ModuleName, 8, "failed to remove validator") - ErrCommissionNegative = sdkerrors.Register(ModuleName, 9, "commission must be positive") - ErrCommissionHuge = sdkerrors.Register(ModuleName, 10, "commission cannot be more than 100%") - ErrCommissionGTMaxRate = sdkerrors.Register(ModuleName, 11, "commission cannot be more than the max rate") - ErrCommissionUpdateTime = sdkerrors.Register(ModuleName, 12, "commission cannot be changed more than once in 24h") - ErrCommissionChangeRateNegative = sdkerrors.Register(ModuleName, 13, "commission change rate must be positive") - ErrCommissionChangeRateGTMaxRate = sdkerrors.Register(ModuleName, 14, "commission change rate cannot be more than the max rate") - ErrCommissionGTMaxChangeRate = sdkerrors.Register(ModuleName, 15, "commission cannot be changed more than max change rate") - ErrSelfDelegationBelowMinimum = sdkerrors.Register(ModuleName, 16, "validator's self delegation must be greater than their minimum self delegation") - ErrMinSelfDelegationDecreased = sdkerrors.Register(ModuleName, 17, "minimum self delegation cannot be decrease") - ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 18, "empty delegator address") - ErrNoDelegation = sdkerrors.Register(ModuleName, 19, "no delegation for (address, validator) tuple") - ErrBadDelegatorAddr = sdkerrors.Register(ModuleName, 20, "delegator does not exist with address") - ErrNoDelegatorForAddress = sdkerrors.Register(ModuleName, 21, "delegator does not contain delegation") - ErrInsufficientShares = sdkerrors.Register(ModuleName, 22, "insufficient delegation shares") - ErrDelegationValidatorEmpty = sdkerrors.Register(ModuleName, 23, "cannot delegate to an empty validator") - ErrNotEnoughDelegationShares = sdkerrors.Register(ModuleName, 24, "not enough delegation shares") - ErrNotMature = sdkerrors.Register(ModuleName, 25, "entry not mature") - ErrNoUnbondingDelegation = sdkerrors.Register(ModuleName, 26, "no unbonding delegation found") - ErrMaxUnbondingDelegationEntries = sdkerrors.Register(ModuleName, 27, "too many unbonding delegation entries for (delegator, validator) tuple") - ErrNoRedelegation = sdkerrors.Register(ModuleName, 28, "no redelegation found") - ErrSelfRedelegation = sdkerrors.Register(ModuleName, 29, "cannot redelegate to the same validator") - ErrTinyRedelegationAmount = sdkerrors.Register(ModuleName, 30, "too few tokens to redelegate (truncates to zero tokens)") - ErrBadRedelegationDst = sdkerrors.Register(ModuleName, 31, "redelegation destination validator not found") - ErrTransitiveRedelegation = sdkerrors.Register(ModuleName, 32, "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation") - ErrMaxRedelegationEntries = sdkerrors.Register(ModuleName, 33, "too many redelegation entries for (delegator, src-validator, dst-validator) tuple") - ErrDelegatorShareExRateInvalid = sdkerrors.Register(ModuleName, 34, "cannot delegate to validators with invalid (zero) ex-rate") - ErrBothShareMsgsGiven = sdkerrors.Register(ModuleName, 35, "both shares amount and shares percent provided") - ErrNeitherShareMsgsGiven = sdkerrors.Register(ModuleName, 36, "neither shares amount nor shares percent provided") - ErrInvalidHistoricalInfo = sdkerrors.Register(ModuleName, 37, "invalid historical info") - ErrNoHistoricalInfo = sdkerrors.Register(ModuleName, 38, "no historical info found") - ErrEmptyValidatorPubKey = sdkerrors.Register(ModuleName, 39, "empty validator public key") - ErrUnbondingNotFound = sdkerrors.Register(ModuleName, 40, "unbonding operation not found") - ErrUnbondingOnHoldRefCountNegative = sdkerrors.Register(ModuleName, 41, "cannot un-hold unbonding operation that is not on hold") + ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 2, "empty validator address") + ErrNoValidatorFound = sdkerrors.Register(ModuleName, 3, "validator does not exist") + ErrValidatorOwnerExists = sdkerrors.Register(ModuleName, 4, "validator already exist for this operator address; must use new validator operator address") + ErrValidatorPubKeyExists = sdkerrors.Register(ModuleName, 5, "validator already exist for this pubkey; must use new validator pubkey") + ErrValidatorPubKeyTypeNotSupported = sdkerrors.Register(ModuleName, 6, "validator pubkey type is not supported") + ErrValidatorJailed = sdkerrors.Register(ModuleName, 7, "validator for this address is currently jailed") + ErrBadRemoveValidator = sdkerrors.Register(ModuleName, 8, "failed to remove validator") + ErrCommissionNegative = sdkerrors.Register(ModuleName, 9, "commission must be positive") + ErrCommissionHuge = sdkerrors.Register(ModuleName, 10, "commission cannot be more than 100%") + ErrCommissionGTMaxRate = sdkerrors.Register(ModuleName, 11, "commission cannot be more than the max rate") + ErrCommissionUpdateTime = sdkerrors.Register(ModuleName, 12, "commission cannot be changed more than once in 24h") + ErrCommissionChangeRateNegative = sdkerrors.Register(ModuleName, 13, "commission change rate must be positive") + ErrCommissionChangeRateGTMaxRate = sdkerrors.Register(ModuleName, 14, "commission change rate cannot be more than the max rate") + ErrCommissionGTMaxChangeRate = sdkerrors.Register(ModuleName, 15, "commission cannot be changed more than max change rate") + ErrSelfDelegationBelowMinimum = sdkerrors.Register(ModuleName, 16, "validator's self delegation must be greater than their minimum self delegation") + ErrMinSelfDelegationDecreased = sdkerrors.Register(ModuleName, 17, "minimum self delegation cannot be decrease") + ErrEmptyDelegatorAddr = sdkerrors.Register(ModuleName, 18, "empty delegator address") + ErrNoDelegation = sdkerrors.Register(ModuleName, 19, "no delegation for (address, validator) tuple") + ErrBadDelegatorAddr = sdkerrors.Register(ModuleName, 20, "delegator does not exist with address") + ErrNoDelegatorForAddress = sdkerrors.Register(ModuleName, 21, "delegator does not contain delegation") + ErrInsufficientShares = sdkerrors.Register(ModuleName, 22, "insufficient delegation shares") + ErrDelegationValidatorEmpty = sdkerrors.Register(ModuleName, 23, "cannot delegate to an empty validator") + ErrNotEnoughDelegationShares = sdkerrors.Register(ModuleName, 24, "not enough delegation shares") + ErrNotMature = sdkerrors.Register(ModuleName, 25, "entry not mature") + ErrNoUnbondingDelegation = sdkerrors.Register(ModuleName, 26, "no unbonding delegation found") + ErrMaxUnbondingDelegationEntries = sdkerrors.Register(ModuleName, 27, "too many unbonding delegation entries for (delegator, validator) tuple") + ErrNoRedelegation = sdkerrors.Register(ModuleName, 28, "no redelegation found") + ErrSelfRedelegation = sdkerrors.Register(ModuleName, 29, "cannot redelegate to the same validator") + ErrTinyRedelegationAmount = sdkerrors.Register(ModuleName, 30, "too few tokens to redelegate (truncates to zero tokens)") + ErrBadRedelegationDst = sdkerrors.Register(ModuleName, 31, "redelegation destination validator not found") + ErrTransitiveRedelegation = sdkerrors.Register(ModuleName, 32, "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation") + ErrMaxRedelegationEntries = sdkerrors.Register(ModuleName, 33, "too many redelegation entries for (delegator, src-validator, dst-validator) tuple") + ErrDelegatorShareExRateInvalid = sdkerrors.Register(ModuleName, 34, "cannot delegate to validators with invalid (zero) ex-rate") + ErrBothShareMsgsGiven = sdkerrors.Register(ModuleName, 35, "both shares amount and shares percent provided") + ErrNeitherShareMsgsGiven = sdkerrors.Register(ModuleName, 36, "neither shares amount nor shares percent provided") + ErrInvalidHistoricalInfo = sdkerrors.Register(ModuleName, 37, "invalid historical info") + ErrNoHistoricalInfo = sdkerrors.Register(ModuleName, 38, "no historical info found") + ErrEmptyValidatorPubKey = sdkerrors.Register(ModuleName, 39, "empty validator public key") + ErrUnbondingNotFound = sdkerrors.Register(ModuleName, 40, "unbonding operation not found") + ErrUnbondingOnHoldRefCountNegative = sdkerrors.Register(ModuleName, 41, "cannot un-hold unbonding operation that is not on hold") + ErrNotEnoughBalance = sdkerrors.Register(ModuleName, 42, "not enough balance") + ErrTokenizeShareRecordNotExists = sdkerrors.Register(ModuleName, 43, "tokenize share record not exists") + ErrTokenizeShareRecordAlreadyExists = sdkerrors.Register(ModuleName, 44, "tokenize share record already exists") + ErrNotTokenizeShareRecordOwner = sdkerrors.Register(ModuleName, 45, "not tokenize share record owner") + ErrExceedingFreeVestingDelegations = sdkerrors.Register(ModuleName, 46, "trying to exceed vested free delegation for vesting account") + ErrOnlyBondDenomAllowdForTokenize = sdkerrors.Register(ModuleName, 47, "only bond denom is allowed for tokenize") + ErrInsufficientValidatorBondShares = sdkerrors.Register(ModuleName, 48, "insufficient validator bond shares") + ErrRedelegationNotAllowedForValidatorBond = sdkerrors.Register(ModuleName, 49, "redelegation is not allowed for validator bond delegation") + ErrValidatorBondNotAllowedForTokenizeShare = sdkerrors.Register(ModuleName, 50, "validator bond delegation is not allowed to tokenize share") + ErrValidatorBondNotAllowedFromModuleAccount = sdkerrors.Register(ModuleName, 51, "validator bond is not allowed from a module account") + ErrGlobalLiquidStakingCapExceeded = sdkerrors.Register(ModuleName, 52, "delegation from liquid staking provider exceeds the global cap") + ErrValidatorLiquidStakingCapExceeded = sdkerrors.Register(ModuleName, 53, "delegation from liquid staking provider exceeds the validator cap") + ErrTokenizeSharesDisabledForAccount = sdkerrors.Register(ModuleName, 54, "tokenize shares currently disabled for account") + ErrUnableToDisableTokenizeShares = sdkerrors.Register(ModuleName, 55, "unable to disable tokenize shares for account") + ErrTokenizeSharesAlreadyEnabledForAccount = sdkerrors.Register(ModuleName, 57, "tokenize shares is already enabled for this account") + ErrTokenizeSharesAlreadyDisabledForAccount = sdkerrors.Register(ModuleName, 58, "tokenize shares is already disabled for this account") ) diff --git a/x/staking/types/events.go b/x/staking/types/events.go index 99a0be1ad62..8bdb3a05a71 100644 --- a/x/staking/types/events.go +++ b/x/staking/types/events.go @@ -2,21 +2,27 @@ package types // staking module event types const ( - EventTypeCompleteUnbonding = "complete_unbonding" - EventTypeCompleteRedelegation = "complete_redelegation" - EventTypeCreateValidator = "create_validator" - EventTypeEditValidator = "edit_validator" - EventTypeDelegate = "delegate" - EventTypeUnbond = "unbond" - EventTypeRedelegate = "redelegate" + EventTypeCompleteUnbonding = "complete_unbonding" + EventTypeCompleteRedelegation = "complete_redelegation" + EventTypeCreateValidator = "create_validator" + EventTypeEditValidator = "edit_validator" + EventTypeDelegate = "delegate" + EventTypeUnbond = "unbond" + EventTypeRedelegate = "redelegate" + EventTypeTokenizeShares = "tokenize_shares" + EventTypeRedeemShares = "redeem_shares" + EventTypeTransferTokenizeShareRecord = "transfer_tokenize_share_record" + EventTypeValidatorBondDelegation = "validator_bond_delegation" - AttributeKeyValidator = "validator" - AttributeKeyCommissionRate = "commission_rate" - AttributeKeyMinSelfDelegation = "min_self_delegation" - AttributeKeySrcValidator = "source_validator" - AttributeKeyDstValidator = "destination_validator" - AttributeKeyDelegator = "delegator" - AttributeKeyCompletionTime = "completion_time" - AttributeKeyNewShares = "new_shares" - AttributeValueCategory = ModuleName + AttributeKeyValidator = "validator" + AttributeKeyCommissionRate = "commission_rate" + AttributeKeySrcValidator = "source_validator" + AttributeKeyDstValidator = "destination_validator" + AttributeKeyDelegator = "delegator" + AttributeKeyCompletionTime = "completion_time" + AttributeKeyNewShares = "new_shares" + AttributeKeyShareOwner = "share_owner" + AttributeKeyShareRecordID = "share_record_id" + AttributeKeyAmount = "amount" + AttributeValueCategory = ModuleName ) diff --git a/x/staking/types/expected_keepers.go b/x/staking/types/expected_keepers.go index 243dd1349ab..12aa6297018 100644 --- a/x/staking/types/expected_keepers.go +++ b/x/staking/types/expected_keepers.go @@ -32,10 +32,14 @@ type BankKeeper interface { GetSupply(ctx sdk.Context, denom string) sdk.Coin + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx sdk.Context, senderPool, recipientPool string, amt sdk.Coins) error + 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 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(cts sdk.Context, name string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error } @@ -55,8 +59,8 @@ type ValidatorSet interface { Validator(sdk.Context, sdk.ValAddress) ValidatorI // get a particular validator by operator address ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) ValidatorI // get a particular validator by consensus address - TotalBondedTokens(sdk.Context) sdk.Int // total bonded tokens within the validator set - StakingTokenSupply(sdk.Context) sdk.Int // total staking token supply + TotalBondedTokens(sdk.Context) sdk.Int // total bonded tokens within the validator set + StakingTokenSupply(sdk.Context) sdk.Int // total staking token supply // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, InfractionType) @@ -89,17 +93,17 @@ type DelegationSet interface { // StakingHooks event hooks for staking validator object (noalias) type StakingHooks interface { - AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator is created - BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator's state changes - AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is deleted - - AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is bonded - AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator begins unbonding - - BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) // Must be called when a delegation is created - BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) // Must be called when a delegation's shares are modified - BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) // Must be called when a delegation is removed - AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) - BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) - AfterUnbondingInitiated(ctx sdk.Context, id uint64) error + AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error // Must be called when a validator is created + BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error // Must be called when a validator's state changes + AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator is deleted + BeforeTokenizeShareRecordRemoved(ctx sdk.Context, recordID uint64) error // Must be called when tokenize share record is deleted + + AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator is bonded + AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator begins unbonding + + BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error // Must be called when a delegation is created + BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error // Must be called when a delegation's shares are modified + BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error // Must be called when a delegation is removed + AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error + BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error } diff --git a/x/staking/types/genesis.pb.go b/x/staking/types/genesis.pb.go index 2ea6f8bf996..343ef6fa9fd 100644 --- a/x/staking/types/genesis.pb.go +++ b/x/staking/types/genesis.pb.go @@ -1,12 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/genesis.proto +// source: staking/v1beta1/genesis.proto package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -30,26 +31,30 @@ type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // last_total_power tracks the total amounts of bonded tokens recorded during // the previous end block. - LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power" yaml:"last_total_power"` + LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power"` // last_validator_powers is a special index that provides a historical list // of the last-block's bonded validators. - LastValidatorPowers []LastValidatorPower `protobuf:"bytes,3,rep,name=last_validator_powers,json=lastValidatorPowers,proto3" json:"last_validator_powers" yaml:"last_validator_powers"` + LastValidatorPowers []LastValidatorPower `protobuf:"bytes,3,rep,name=last_validator_powers,json=lastValidatorPowers,proto3" json:"last_validator_powers"` // delegations defines the validator set at genesis. Validators []Validator `protobuf:"bytes,4,rep,name=validators,proto3" json:"validators"` // delegations defines the delegations active at genesis. Delegations []Delegation `protobuf:"bytes,5,rep,name=delegations,proto3" json:"delegations"` // unbonding_delegations defines the unbonding delegations active at genesis. - UnbondingDelegations []UnbondingDelegation `protobuf:"bytes,6,rep,name=unbonding_delegations,json=unbondingDelegations,proto3" json:"unbonding_delegations" yaml:"unbonding_delegations"` + UnbondingDelegations []UnbondingDelegation `protobuf:"bytes,6,rep,name=unbonding_delegations,json=unbondingDelegations,proto3" json:"unbonding_delegations"` // redelegations defines the redelegations active at genesis. Redelegations []Redelegation `protobuf:"bytes,7,rep,name=redelegations,proto3" json:"redelegations"` Exported bool `protobuf:"varint,8,opt,name=exported,proto3" json:"exported,omitempty"` + // store tokenize share records to provide reward to record owners + TokenizeShareRecords []TokenizeShareRecord `protobuf:"bytes,9,rep,name=tokenize_share_records,json=tokenizeShareRecords,proto3" json:"tokenize_share_records"` + // last tokenize share record id, used for next share record id calculation + LastTokenizeShareRecordId uint64 `protobuf:"varint,10,opt,name=last_tokenize_share_record_id,json=lastTokenizeShareRecordId,proto3" json:"last_tokenize_share_record_id,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_9b3dec8894f2831b, []int{0} + return fileDescriptor_30376b0921a07e54, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -127,6 +132,20 @@ func (m *GenesisState) GetExported() bool { return false } +func (m *GenesisState) GetTokenizeShareRecords() []TokenizeShareRecord { + if m != nil { + return m.TokenizeShareRecords + } + return nil +} + +func (m *GenesisState) GetLastTokenizeShareRecordId() uint64 { + if m != nil { + return m.LastTokenizeShareRecordId + } + return 0 +} + // LastValidatorPower required for validator set update logic. type LastValidatorPower struct { // address is the address of the validator. @@ -139,7 +158,7 @@ func (m *LastValidatorPower) Reset() { *m = LastValidatorPower{} } func (m *LastValidatorPower) String() string { return proto.CompactTextString(m) } func (*LastValidatorPower) ProtoMessage() {} func (*LastValidatorPower) Descriptor() ([]byte, []int) { - return fileDescriptor_9b3dec8894f2831b, []int{1} + return fileDescriptor_30376b0921a07e54, []int{1} } func (m *LastValidatorPower) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -173,43 +192,46 @@ func init() { proto.RegisterType((*LastValidatorPower)(nil), "cosmos.staking.v1beta1.LastValidatorPower") } -func init() { - proto.RegisterFile("cosmos/staking/v1beta1/genesis.proto", fileDescriptor_9b3dec8894f2831b) -} - -var fileDescriptor_9b3dec8894f2831b = []byte{ - // 493 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x3d, 0x6f, 0xd3, 0x40, - 0x18, 0xc7, 0x7d, 0xa4, 0x49, 0xc3, 0xa5, 0x20, 0x74, 0xa4, 0x60, 0x45, 0xc8, 0x0e, 0x56, 0x84, - 0x22, 0x5e, 0x6c, 0xb5, 0x6c, 0x15, 0x53, 0x84, 0xa8, 0x8a, 0x10, 0x8a, 0x8e, 0x97, 0x81, 0x25, - 0xba, 0xd4, 0x27, 0x63, 0xd5, 0xf1, 0x59, 0x7e, 0x2e, 0xa5, 0xdd, 0x11, 0x62, 0xe4, 0x23, 0xf4, - 0xe3, 0x74, 0xec, 0xc0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- 0xec, 0xb5, 0xbf, 0x9e, 0x99, 0xda, 0xef, 0x33, 0x53, 0x1b, 0xbd, 0x38, 0x5f, 0x18, 0xe8, 0x62, - 0x61, 0xa0, 0x5f, 0x0b, 0x03, 0x7d, 0x5b, 0x1a, 0xda, 0xc5, 0xd2, 0xd0, 0x7e, 0x2c, 0x0d, 0xed, - 0xc3, 0xe3, 0xff, 0xce, 0xf3, 0x49, 0x79, 0xfd, 0xd4, 0x64, 0x4f, 0x5b, 0xea, 0xd6, 0x3d, 0xfd, - 0x13, 0x00, 0x00, 0xff, 0xff, 0xff, 0x85, 0xad, 0xc8, 0xf1, 0x03, 0x00, 0x00, +func init() { proto.RegisterFile("staking/v1beta1/genesis.proto", fileDescriptor_30376b0921a07e54) } + +var fileDescriptor_30376b0921a07e54 = []byte{ + // 565 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, + 0x1c, 0xc6, 0x13, 0xd6, 0x75, 0x9d, 0x3b, 0x10, 0x32, 0xdd, 0x94, 0x55, 0x5a, 0x5a, 0x2a, 0x84, + 0x2a, 0x50, 0x13, 0xad, 0xdc, 0x10, 0x12, 0x50, 0x21, 0x4d, 0x43, 0x1c, 0xaa, 0x74, 0x20, 0xe0, + 0x12, 0xb9, 0xb5, 0x49, 0xad, 0xa6, 0x71, 0x17, 0x3b, 0x63, 0xe3, 0x09, 0x38, 0xf2, 0x08, 0x13, + 0xcf, 0xc0, 0x43, 0xec, 0x38, 0x71, 0x42, 0x1c, 0x26, 0xd4, 0x5e, 0x78, 0x0c, 0x14, 0xdb, 0x29, + 0x41, 0x59, 0x39, 0xb5, 0xd6, 0xf7, 0x7d, 0xbf, 0xff, 0xdf, 0x91, 0x3f, 0xb0, 0xc7, 0x05, 0x9a, + 0xd0, 0x28, 0x70, 0x4f, 0xf6, 0x87, 0x44, 0xa0, 0x7d, 0x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0x03, 0xeb, 0x7f, 0x4b, 0xb1, 0xe6, 0xa9, 0xc3, + 0xe3, 0xca, 0xe7, 0xf3, 0x86, 0xf1, 0xfb, 0xbc, 0x61, 0xf4, 0xde, 0x5d, 0xcc, 0x6d, 0xf3, 0x72, + 0x6e, 0x9b, 0xbf, 0xe6, 0xb6, 0xf9, 0x65, 0x61, 0x1b, 0x97, 0x0b, 0xdb, 0xf8, 0xb1, 0xb0, 0x8d, + 0xf7, 0x4f, 0x73, 0xbd, 0xa1, 0xc7, 0x61, 0xc2, 0x29, 0x8b, 0x68, 0x34, 0x72, 0x43, 0x7a, 0x9c, + 0x50, 0x4c, 0xc5, 0x59, 0x47, 0x7f, 0xa7, 0xce, 0x94, 0xe1, 0x24, 0x24, 0xee, 0x69, 0xd6, 0x74, + 0x55, 0xaa, 0x61, 0x59, 0x16, 0xfe, 0xd1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x54, 0x30, + 0xfd, 0x79, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -232,6 +254,25 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.LastTokenizeShareRecordId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.LastTokenizeShareRecordId)) + i-- + dAtA[i] = 0x50 + } + if len(m.TokenizeShareRecords) > 0 { + for iNdEx := len(m.TokenizeShareRecords) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenizeShareRecords[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } if m.Exported { i-- if m.Exported { @@ -424,6 +465,15 @@ func (m *GenesisState) Size() (n int) { if m.Exported { n += 2 } + if len(m.TokenizeShareRecords) > 0 { + for _, e := range m.TokenizeShareRecords { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.LastTokenizeShareRecordId != 0 { + n += 1 + sovGenesis(uint64(m.LastTokenizeShareRecordId)) + } return n } @@ -734,6 +784,59 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } } m.Exported = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenizeShareRecords", 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.TokenizeShareRecords = append(m.TokenizeShareRecords, TokenizeShareRecord{}) + if err := m.TokenizeShareRecords[len(m.TokenizeShareRecords)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastTokenizeShareRecordId", wireType) + } + m.LastTokenizeShareRecordId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastTokenizeShareRecordId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/staking/types/hooks.go b/x/staking/types/hooks.go index b9da167888b..bf60ce62f6e 100644 --- a/x/staking/types/hooks.go +++ b/x/staking/types/hooks.go @@ -5,74 +5,108 @@ import ( ) // combine multiple staking hooks, all hook functions are run in array sequence +var _ StakingHooks = &MultiStakingHooks{} + type MultiStakingHooks []StakingHooks func NewMultiStakingHooks(hooks ...StakingHooks) MultiStakingHooks { return hooks } -func (h MultiStakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { for i := range h { - h[i].AfterValidatorCreated(ctx, valAddr) + if err := h[i].AfterValidatorCreated(ctx, valAddr); err != nil { + return err + } } + + return nil } -func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { for i := range h { - h[i].BeforeValidatorModified(ctx, valAddr) + if err := h[i].BeforeValidatorModified(ctx, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { for i := range h { - h[i].AfterValidatorRemoved(ctx, consAddr, valAddr) + if err := h[i].AfterValidatorRemoved(ctx, consAddr, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) BeforeTokenizeShareRecordRemoved(ctx sdk.Context, recordID uint64) error { for i := range h { - h[i].AfterValidatorBonded(ctx, consAddr, valAddr) + if err := h[i].BeforeTokenizeShareRecordRemoved(ctx, recordID); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { for i := range h { - h[i].AfterValidatorBeginUnbonding(ctx, consAddr, valAddr) + if err := h[i].AfterValidatorBonded(ctx, consAddr, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { for i := range h { - h[i].BeforeDelegationCreated(ctx, delAddr, valAddr) + if err := h[i].AfterValidatorBeginUnbonding(ctx, consAddr, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { for i := range h { - h[i].BeforeDelegationSharesModified(ctx, delAddr, valAddr) + if err := h[i].BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { for i := range h { - h[i].BeforeDelegationRemoved(ctx, delAddr, valAddr) + if err := h[i].BeforeDelegationSharesModified(ctx, delAddr, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { +func (h MultiStakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { for i := range h { - h[i].AfterDelegationModified(ctx, delAddr, valAddr) + if err := h[i].BeforeDelegationRemoved(ctx, delAddr, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) { +func (h MultiStakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { for i := range h { - h[i].BeforeValidatorSlashed(ctx, valAddr, fraction) + if err := h[i].AfterDelegationModified(ctx, delAddr, valAddr); err != nil { + return err + } } + return nil } -func (h MultiStakingHooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error { + +func (h MultiStakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { for i := range h { - if err := h[i].AfterUnbondingInitiated(ctx, id); err != nil { + if err := h[i].BeforeValidatorSlashed(ctx, valAddr, fraction); err != nil { return err } } diff --git a/x/staking/types/hooks_template.go b/x/staking/types/hooks_template.go deleted file mode 100644 index aafb1a1ae08..00000000000 --- a/x/staking/types/hooks_template.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type StakingHooksTemplate struct{} - -var _ StakingHooks = StakingHooksTemplate{} - -func (h StakingHooksTemplate) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) { -} -func (h StakingHooksTemplate) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) { -} -func (h StakingHooksTemplate) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error { - return nil -} diff --git a/x/staking/types/keys.go b/x/staking/types/keys.go index 63bf7e778f8..3f06adeb0e0 100644 --- a/x/staking/types/keys.go +++ b/x/staking/types/keys.go @@ -24,6 +24,9 @@ const ( // RouterKey is the msg router key for the staking module RouterKey = ModuleName + + // Prefix for module accounts that custodian tokenized shares + TokenizeShareModuleAccountPrefix = "tokenizeshare_" ) var ( @@ -43,41 +46,21 @@ var ( RedelegationByValSrcIndexKey = []byte{0x35} // prefix for each key for an redelegation, by source validator operator RedelegationByValDstIndexKey = []byte{0x36} // prefix for each key for an redelegation, by destination validator operator - UnbondingIdKey = []byte{0x37} // key for the counter for the incrementing id for UnbondingOperations - UnbondingIndexKey = []byte{0x38} // prefix for an index for looking up unbonding operations by their IDs - UnbondingTypeKey = []byte{0x39} // prefix for an index containing the type of unbonding operations - UnbondingQueueKey = []byte{0x41} // prefix for the timestamps in unbonding queue RedelegationQueueKey = []byte{0x42} // prefix for the timestamps in redelegations queue ValidatorQueueKey = []byte{0x43} // prefix for the timestamps in validator queue - HistoricalInfoKey = []byte{0x50} // prefix for the historical info - ValidatorUpdatesKey = []byte{0x61} // prefix for the end block validator updates key -) - -type UnbondingType int + HistoricalInfoKey = []byte{0x50} // prefix for the historical info -const ( - UnbondingType_Undefined UnbondingType = iota - UnbondingType_UnbondingDelegation - UnbondingType_Redelegation - UnbondingType_ValidatorUnbonding + TokenizeShareRecordPrefix = []byte{0x61} // key for tokenizeshare record prefix + TokenizeShareRecordIDByOwnerPrefix = []byte{0x62} // key for tokenizeshare record id by owner prefix + TokenizeShareRecordIDByDenomPrefix = []byte{0x63} // key for tokenizeshare record id by denom prefix + LastTokenizeShareRecordIDKey = []byte{0x64} // key for last tokenize share record id + TotalLiquidStakedTokensKey = []byte{0x65} // key for total liquid staked tokens + TokenizeSharesLockKey = []byte{0x66} // key for locking tokenize shares + TokenizeSharesUnlockQueueKey = []byte{0x67} // key for the queue that unlocks tokenize shares ) -// Returns a key for an index containing the type of unbonding operations -func GetUnbondingTypeKey(id uint64) []byte { - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, id) - return append(UnbondingTypeKey, bz...) -} - -// Returns a key for the index for looking up UnbondingDelegations by the UnbondingDelegationEntries they contain -func GetUnbondingIndexKey(id uint64) []byte { - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, id) - return append(UnbondingIndexKey, bz...) -} - // GetValidatorKey creates the key for the validator with address // VALUE: staking/Validator func GetValidatorKey(operatorAddr sdk.ValAddress) []byte { @@ -202,14 +185,14 @@ func ParseValidatorQueueKey(bz []byte) (time.Time, int64, error) { return ts, int64(height), nil } -// GetDelegationKey creates the key for delegator bond with validator +// GetLiquidDelegationKey creates the key for delegator bond with validator // VALUE: staking/Delegation -func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(GetDelegationsKey(delAddr), address.MustLengthPrefix(valAddr)...) +func GetLiquidDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { + return append(GetLiquidDelegationsKey(delAddr), address.MustLengthPrefix(valAddr)...) } -// GetDelegationsKey creates the prefix for a delegator for all validators -func GetDelegationsKey(delAddr sdk.AccAddress) []byte { +// GetLiquidDelegationsKey creates the prefix for a delegator for all validators +func GetLiquidDelegationsKey(delAddr sdk.AccAddress) []byte { return append(DelegationKey, address.MustLengthPrefix(delAddr)...) } @@ -375,3 +358,34 @@ func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.ValAddr func GetHistoricalInfoKey(height int64) []byte { return append(HistoricalInfoKey, []byte(strconv.FormatInt(height, 10))...) } + +// GetTokenizeShareRecordByIndexKey returns the key of the specified id. Intended for querying the tokenizeShareRecord by the id. +func GetTokenizeShareRecordByIndexKey(id uint64) []byte { + return append(TokenizeShareRecordPrefix, sdk.Uint64ToBigEndian(id)...) +} + +// GetTokenizeShareRecordIdsByOwnerPrefix returns the key of the specified owner. Intended for querying all tokenizeShareRecords of an owner +func GetTokenizeShareRecordIdsByOwnerPrefix(owner sdk.AccAddress) []byte { + return append(TokenizeShareRecordIDByOwnerPrefix, address.MustLengthPrefix(owner)...) +} + +// GetTokenizeShareRecordIdByOwnerAndIdKey returns the key of the specified owner and id. Intended for setting tokenizeShareRecord of an owner +func GetTokenizeShareRecordIDByOwnerAndIDKey(owner sdk.AccAddress, id uint64) []byte { + return append(append(TokenizeShareRecordIDByOwnerPrefix, address.MustLengthPrefix(owner)...), sdk.Uint64ToBigEndian(id)...) +} + +func GetTokenizeShareRecordIDByDenomKey(denom string) []byte { + return append(TokenizeShareRecordIDByDenomPrefix, []byte(denom)...) +} + +// GetTokenizeSharesLockKey returns the key for storing a tokenize share lock for a specified account +func GetTokenizeSharesLockKey(owner sdk.AccAddress) []byte { + return append(TokenizeSharesLockKey, address.MustLengthPrefix(owner)...) +} + +// GetTokenizeShareAuthorizationTimeKey returns the prefix key used for getting a set of pending +// tokenize share unlocks that complete at the given time +func GetTokenizeShareAuthorizationTimeKey(timestamp time.Time) []byte { + bz := sdk.FormatTimeBytes(timestamp) + return append(TokenizeSharesUnlockQueueKey, bz...) +} diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 7252761acfb..729e083616c 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -1,7 +1,8 @@ package types import ( - "bytes" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec/legacy" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -10,12 +11,22 @@ import ( ) // staking message types +// +//nolint:gosec // these are not hard coded credentials const ( - TypeMsgUndelegate = "begin_unbonding" - TypeMsgEditValidator = "edit_validator" - TypeMsgCreateValidator = "create_validator" - TypeMsgDelegate = "delegate" - TypeMsgBeginRedelegate = "begin_redelegate" + TypeMsgUndelegate = "begin_unbonding" + TypeMsgUnbondValidator = "unbond_validator" + TypeMsgEditValidator = "edit_validator" + TypeMsgCreateValidator = "create_validator" + TypeMsgDelegate = "delegate" + TypeMsgBeginRedelegate = "begin_redelegate" + TypeMsgCancelUnbondingDelegation = "cancel_unbond" + TypeMsgTokenizeShares = "tokenize_shares" + TypeMsgRedeemTokensforShares = "redeem_tokens_for_shares" + TypeMsgTransferTokenizeShareRecord = "transfer_tokenize_share_record" + TypeMsgDisableTokenizeShares = "disable_tokenize_shares" + TypeMsgEnableTokenizeShares = "enable_tokenize_shares" + TypeMsgValidatorBond = "validator_bond" ) var ( @@ -25,14 +36,22 @@ var ( _ sdk.Msg = &MsgEditValidator{} _ sdk.Msg = &MsgDelegate{} _ sdk.Msg = &MsgUndelegate{} + _ sdk.Msg = &MsgUnbondValidator{} _ sdk.Msg = &MsgBeginRedelegate{} + _ sdk.Msg = &MsgTokenizeShares{} + _ sdk.Msg = &MsgRedeemTokensforShares{} + _ sdk.Msg = &MsgTransferTokenizeShareRecord{} + _ sdk.Msg = &MsgDisableTokenizeShares{} + _ sdk.Msg = &MsgEnableTokenizeShares{} + _ sdk.Msg = &MsgCancelUnbondingDelegation{} + _ sdk.Msg = &MsgValidatorBond{} ) // NewMsgCreateValidator creates a new MsgCreateValidator instance. // Delegator address and validator address are the same. func NewMsgCreateValidator( valAddr sdk.ValAddress, pubKey cryptotypes.PubKey, //nolint:interfacer - selfDelegation sdk.Coin, description Description, commission CommissionRates, minSelfDelegation sdk.Int, + selfDelegation sdk.Coin, description Description, commission CommissionRates, ) (*MsgCreateValidator, error) { var pkAny *codectypes.Any if pubKey != nil { @@ -42,13 +61,12 @@ func NewMsgCreateValidator( } } return &MsgCreateValidator{ - Description: description, - DelegatorAddress: sdk.AccAddress(valAddr).String(), - ValidatorAddress: valAddr.String(), - Pubkey: pkAny, - Value: selfDelegation, - Commission: commission, - MinSelfDelegation: minSelfDelegation, + Description: description, + DelegatorAddress: sdk.AccAddress(valAddr).String(), + ValidatorAddress: valAddr.String(), + Pubkey: pkAny, + Value: selfDelegation, + Commission: commission, }, nil } @@ -64,17 +82,13 @@ func (msg MsgCreateValidator) Type() string { return TypeMsgCreateValidator } // sign the msg as well. func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress { // delegator is first signer so delegator pays fees - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) - if err != nil { - panic(err) - } - addrs := []sdk.AccAddress{delAddr} - addr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) - if err != nil { - panic(err) - } - if !bytes.Equal(delAddr.Bytes(), addr.Bytes()) { - addrs = append(addrs, sdk.AccAddress(addr)) + delegator, _ := sdk.AccAddressFromBech32(msg.DelegatorAddress) + addrs := []sdk.AccAddress{delegator} + valAddr, _ := sdk.ValAddressFromBech32(msg.ValidatorAddress) + + valAccAddr := sdk.AccAddress(valAddr) + if !delegator.Equals(valAccAddr) { + addrs = append(addrs, valAccAddr) } return addrs @@ -82,31 +96,23 @@ func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress { // GetSignBytes returns the message bytes to sign over. func (msg MsgCreateValidator) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgCreateValidator) ValidateBasic() error { - // note that unmarshaling from bech32 ensures either empty or valid + // note that unmarshaling from bech32 ensures both non-empty and valid delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { - return err - } - if delAddr.Empty() { - return ErrEmptyDelegatorAddr + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } - - if msg.ValidatorAddress == "" { - return ErrEmptyValidatorAddr - } - valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) if err != nil { - return err + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) } if !sdk.AccAddress(valAddr).Equals(delAddr) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "validator address is invalid") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "validator address is invalid") } if msg.Pubkey == nil { @@ -114,33 +120,20 @@ func (msg MsgCreateValidator) ValidateBasic() error { } if !msg.Value.IsValid() || !msg.Value.Amount.IsPositive() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid delegation amount") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid delegation amount") } if msg.Description == (Description{}) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty description") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty description") } if msg.Commission == (CommissionRates{}) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty commission") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty commission") } - if err := msg.Commission.Validate(); err != nil { - return err - } - - if !msg.MinSelfDelegation.IsPositive() { - return sdkerrors.Wrap( - sdkerrors.ErrInvalidRequest, - "minimum self delegation must be a positive integer", - ) - } - - if msg.Value.Amount.LT(msg.MinSelfDelegation) { - return ErrSelfDelegationBelowMinimum - } + err = msg.Commission.Validate() - return nil + return err } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces @@ -152,12 +145,11 @@ func (msg MsgCreateValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) // NewMsgEditValidator creates a new MsgEditValidator instance // //nolint:interfacer -func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec, newMinSelfDelegation *sdk.Int) *MsgEditValidator { +func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec) *MsgEditValidator { return &MsgEditValidator{ - Description: description, - CommissionRate: newRate, - ValidatorAddress: valAddr.String(), - MinSelfDelegation: newMinSelfDelegation, + Description: description, + CommissionRate: newRate, + ValidatorAddress: valAddr.String(), } } @@ -169,39 +161,29 @@ func (msg MsgEditValidator) Type() string { return TypeMsgEditValidator } // GetSigners implements the sdk.Msg interface. func (msg MsgEditValidator) GetSigners() []sdk.AccAddress { - valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{valAddr.Bytes()} + valAddr, _ := sdk.ValAddressFromBech32(msg.ValidatorAddress) + return []sdk.AccAddress{sdk.AccAddress(valAddr)} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgEditValidator) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgEditValidator) ValidateBasic() error { - if msg.ValidatorAddress == "" { - return ErrEmptyValidatorAddr + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) } if msg.Description == (Description{}) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty description") - } - - if msg.MinSelfDelegation != nil && !msg.MinSelfDelegation.IsPositive() { - return sdkerrors.Wrap( - sdkerrors.ErrInvalidRequest, - "minimum self delegation must be a positive integer", - ) + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty description") } if msg.CommissionRate != nil { if msg.CommissionRate.GT(sdk.OneDec()) || msg.CommissionRate.IsNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "commission rate must be between 0 and 1 (inclusive)") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "commission rate must be between 0 and 1 (inclusive)") } } @@ -227,31 +209,30 @@ func (msg MsgDelegate) Type() string { return TypeMsgDelegate } // GetSigners implements the sdk.Msg interface. func (msg MsgDelegate) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { panic(err) } - return []sdk.AccAddress{delAddr} + return []sdk.AccAddress{delegator} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgDelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgDelegate) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return ErrEmptyDelegatorAddr + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } - - if msg.ValidatorAddress == "" { - return ErrEmptyValidatorAddr + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) } if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { - return sdkerrors.Wrap( + return errorsmod.Wrap( sdkerrors.ErrInvalidRequest, "invalid delegation amount", ) @@ -282,35 +263,33 @@ func (msg MsgBeginRedelegate) Type() string { return TypeMsgBeginRedelegate } // GetSigners implements the sdk.Msg interface func (msg MsgBeginRedelegate) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { panic(err) } - return []sdk.AccAddress{delAddr} + return []sdk.AccAddress{delegator} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgBeginRedelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgBeginRedelegate) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return ErrEmptyDelegatorAddr + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } - - if msg.ValidatorSrcAddress == "" { - return ErrEmptyValidatorAddr + if _, err := sdk.ValAddressFromBech32(msg.ValidatorSrcAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid source validator address: %s", err) } - - if msg.ValidatorDstAddress == "" { - return ErrEmptyValidatorAddr + if _, err := sdk.ValAddressFromBech32(msg.ValidatorDstAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid destination validator address: %s", err) } if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { - return sdkerrors.Wrap( + return errorsmod.Wrap( sdkerrors.ErrInvalidRequest, "invalid shares amount", ) @@ -338,31 +317,137 @@ func (msg MsgUndelegate) Type() string { return TypeMsgUndelegate } // GetSigners implements the sdk.Msg interface. func (msg MsgUndelegate) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { panic(err) } - return []sdk.AccAddress{delAddr} + return []sdk.AccAddress{delegator} } // GetSignBytes implements the sdk.Msg interface. func (msg MsgUndelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := legacy.Cdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } // ValidateBasic implements the sdk.Msg interface. func (msg MsgUndelegate) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return ErrEmptyDelegatorAddr + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return errorsmod.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid shares amount", + ) + } + + return nil +} + +// NewMsgUnbondValidator creates a new MsgUnbondValidator instance. +// +//nolint:interfacer +func NewMsgUnbondValidator(valAddr sdk.ValAddress) *MsgUnbondValidator { + return &MsgUnbondValidator{ + ValidatorAddress: valAddr.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgUnbondValidator) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgUnbondValidator) Type() string { return TypeMsgUnbondValidator } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgUnbondValidator) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgUnbondValidator) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUnbondValidator) ValidateBasic() error { + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgTokenizeShares) Type() string { return TypeMsgTokenizeShares } + +func (msg MsgTokenizeShares) GetSigners() []sdk.AccAddress { + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delegator} +} + +func (msg MsgTokenizeShares) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgTokenizeShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + if _, err := sdk.AccAddressFromBech32(msg.TokenizedShareOwner); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid tokenize share owner address: %s", err) + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return errorsmod.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid shares amount", + ) + } + + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgRedeemTokensforShares) Type() string { return TypeMsgRedeemTokensforShares } + +func (msg MsgRedeemTokensforShares) GetSigners() []sdk.AccAddress { + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) } + return []sdk.AccAddress{delegator} +} + +func (msg MsgRedeemTokensforShares) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} - if msg.ValidatorAddress == "" { - return ErrEmptyValidatorAddr +func (msg MsgRedeemTokensforShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { - return sdkerrors.Wrap( + return errorsmod.Wrap( sdkerrors.ErrInvalidRequest, "invalid shares amount", ) @@ -370,3 +455,182 @@ func (msg MsgUndelegate) ValidateBasic() error { return nil } + +// Type implements the sdk.Msg interface. +func (msg MsgTransferTokenizeShareRecord) Type() string { return TypeMsgTransferTokenizeShareRecord } + +func (msg MsgTransferTokenizeShareRecord) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +func (msg MsgTransferTokenizeShareRecord) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgTransferTokenizeShareRecord) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err) + } + if _, err := sdk.AccAddressFromBech32(msg.NewOwner); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid new owner address: %s", err) + } + + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) Type() string { return TypeMsgDisableTokenizeShares } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgDisableTokenizeShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err) + } + + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) Type() string { return TypeMsgEnableTokenizeShares } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgEnableTokenizeShares) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err) + } + + return nil +} + +// NewMsgCancelUnbondingDelegation creates a new MsgCancelUnbondingDelegation instance. +// +//nolint:interfacer +func NewMsgCancelUnbondingDelegation(delAddr sdk.AccAddress, valAddr sdk.ValAddress, creationHeight int64, amount sdk.Coin) *MsgCancelUnbondingDelegation { + return &MsgCancelUnbondingDelegation{ + DelegatorAddress: delAddr.String(), + ValidatorAddress: valAddr.String(), + Amount: amount, + CreationHeight: creationHeight, + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) Type() string { return TypeMsgCancelUnbondingDelegation } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) GetSigners() []sdk.AccAddress { + delegator, _ := sdk.AccAddressFromBech32(msg.DelegatorAddress) + return []sdk.AccAddress{delegator} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) GetSignBytes() []byte { + return sdk.MustSortJSON(legacy.Cdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgCancelUnbondingDelegation) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return errorsmod.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid amount", + ) + } + + if msg.CreationHeight <= 0 { + return errorsmod.Wrap( + sdkerrors.ErrInvalidRequest, + "invalid height", + ) + } + + return nil +} + +// NewMsgValidatorBond creates a new MsgValidatorBond instance. +// +//nolint:interfacer +func NewMsgValidatorBond(delAddr sdk.AccAddress, valAddr sdk.ValAddress) *MsgValidatorBond { + return &MsgValidatorBond{ + DelegatorAddress: delAddr.String(), + ValidatorAddress: valAddr.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgValidatorBond) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgValidatorBond) Type() string { return TypeMsgValidatorBond } + +// GetSigners implements the sdk.Msg interface. +func (msg MsgValidatorBond) GetSigners() []sdk.AccAddress { + delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delegator} +} + +// GetSignBytes implements the sdk.Msg interface. +func (msg MsgValidatorBond) GetSignBytes() []byte { + bz := legacy.Cdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgValidatorBond) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) + } + + return nil +} diff --git a/x/staking/types/msg_test.go b/x/staking/types/msg_test.go index f1ba552d911..0379ed26641 100644 --- a/x/staking/types/msg_test.go +++ b/x/staking/types/msg_test.go @@ -37,7 +37,7 @@ func TestMsgDecode(t *testing.T) { // now let's try to serialize the whole message commission1 := types.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) - msg, err := types.NewMsgCreateValidator(valAddr1, pk1, coinPos, types.Description{}, commission1, sdk.OneInt()) + msg, err := types.NewMsgCreateValidator(valAddr1, pk1, coinPos, types.Description{}, commission1) require.NoError(t, err) msgSerialized, err := cdc.MarshalInterface(msg) require.NoError(t, err) @@ -72,14 +72,11 @@ func TestMsgCreateValidator(t *testing.T) { {"empty pubkey", "a", "b", "c", "d", "e", commission1, sdk.OneInt(), valAddr1, emptyPubkey, coinPos, false}, {"empty bond", "a", "b", "c", "d", "e", commission2, sdk.OneInt(), valAddr1, pk1, coinZero, false}, {"nil bond", "a", "b", "c", "d", "e", commission2, sdk.OneInt(), valAddr1, pk1, sdk.Coin{}, false}, - {"zero min self delegation", "a", "b", "c", "d", "e", commission1, sdk.ZeroInt(), valAddr1, pk1, coinPos, false}, - {"negative min self delegation", "a", "b", "c", "d", "e", commission1, sdk.NewInt(-1), valAddr1, pk1, coinPos, false}, - {"delegation less than min self delegation", "a", "b", "c", "d", "e", commission1, coinPos.Amount.Add(sdk.OneInt()), valAddr1, pk1, coinPos, false}, } for _, tc := range tests { description := types.NewDescription(tc.moniker, tc.identity, tc.website, tc.securityContact, tc.details) - msg, err := types.NewMsgCreateValidator(tc.validatorAddr, tc.pubkey, tc.bond, description, tc.CommissionRates, tc.minSelfDelegation) + msg, err := types.NewMsgCreateValidator(tc.validatorAddr, tc.pubkey, tc.bond, description, tc.CommissionRates) require.NoError(t, err) if tc.expectPass { require.Nil(t, msg.ValidateBasic(), "test: %v", tc.name) @@ -108,7 +105,7 @@ func TestMsgEditValidator(t *testing.T) { description := types.NewDescription(tc.moniker, tc.identity, tc.website, tc.securityContact, tc.details) newRate := sdk.ZeroDec() - msg := types.NewMsgEditValidator(tc.validatorAddr, description, &newRate, &tc.minSelfDelegation) + msg := types.NewMsgEditValidator(tc.validatorAddr, description, &newRate) if tc.expectPass { require.Nil(t, msg.ValidateBasic(), "test: %v", tc.name) } else { diff --git a/x/staking/types/params.go b/x/staking/types/params.go index 8ccae6b5650..db5a057b754 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -6,7 +6,7 @@ import ( "strings" "time" - yaml "gopkg.in/yaml.v2" + "sigs.k8s.io/yaml" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -33,12 +33,26 @@ const ( ) var ( - KeyUnbondingTime = []byte("UnbondingTime") - KeyMaxValidators = []byte("MaxValidators") - KeyMaxEntries = []byte("MaxEntries") - KeyBondDenom = []byte("BondDenom") - KeyHistoricalEntries = []byte("HistoricalEntries") - KeyPowerReduction = []byte("PowerReduction") + // DefaultMinCommissionRate is set to 0% + DefaultMinCommissionRate = sdk.ZeroDec() + // DefaultValidatorBondFactor is set to -1 (disabled) + DefaultValidatorBondFactor = sdk.NewDecFromInt(sdk.NewInt(-1)) + // DefaultGlobalLiquidStakingCap is set to 100% + DefaultGlobalLiquidStakingCap = sdk.OneDec() + // DefaultValidatorLiquidStakingCap is set to 100% + DefaultValidatorLiquidStakingCap = sdk.OneDec() +) + +var ( + KeyUnbondingTime = []byte("UnbondingTime") + KeyMaxValidators = []byte("MaxValidators") + KeyMaxEntries = []byte("MaxEntries") + KeyBondDenom = []byte("BondDenom") + KeyHistoricalEntries = []byte("HistoricalEntries") + KeyMinCommissionRate = []byte("MinCommissionRate") + KeyValidatorBondFactor = []byte("ValidatorBondFactor") + KeyGlobalLiquidStakingCap = []byte("GlobalLiquidStakingCap") + KeyValidatorLiquidStakingCap = []byte("ValidatorLiquidStakingCap") ) var _ paramtypes.ParamSet = (*Params)(nil) @@ -49,13 +63,27 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint32, bondDenom string) Params { +func NewParams( + unbondingTime time.Duration, + maxValidators uint32, + maxEntries uint32, + historicalEntries uint32, + bondDenom string, + minCommissionRate sdk.Dec, + validatorBondFactor sdk.Dec, + globalLiquidStakingCap sdk.Dec, + validatorLiquidStakingCap sdk.Dec, +) Params { return Params{ - UnbondingTime: unbondingTime, - MaxValidators: maxValidators, - MaxEntries: maxEntries, - HistoricalEntries: historicalEntries, - BondDenom: bondDenom, + UnbondingTime: unbondingTime, + MaxValidators: maxValidators, + MaxEntries: maxEntries, + HistoricalEntries: historicalEntries, + BondDenom: bondDenom, + MinCommissionRate: minCommissionRate, + ValidatorBondFactor: validatorBondFactor, + GlobalLiquidStakingCap: globalLiquidStakingCap, + ValidatorLiquidStakingCap: validatorLiquidStakingCap, } } @@ -67,6 +95,10 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyMaxEntries, &p.MaxEntries, validateMaxEntries), paramtypes.NewParamSetPair(KeyHistoricalEntries, &p.HistoricalEntries, validateHistoricalEntries), paramtypes.NewParamSetPair(KeyBondDenom, &p.BondDenom, validateBondDenom), + paramtypes.NewParamSetPair(KeyMinCommissionRate, &p.MinCommissionRate, validateMinCommissionRate), + paramtypes.NewParamSetPair(KeyValidatorBondFactor, &p.ValidatorBondFactor, validateValidatorBondFactor), + paramtypes.NewParamSetPair(KeyGlobalLiquidStakingCap, &p.GlobalLiquidStakingCap, validateGlobalLiquidStakingCap), + paramtypes.NewParamSetPair(KeyValidatorLiquidStakingCap, &p.ValidatorLiquidStakingCap, validateValidatorLiquidStakingCap), } } @@ -78,6 +110,10 @@ func DefaultParams() Params { DefaultMaxEntries, DefaultHistoricalEntries, sdk.DefaultBondDenom, + DefaultMinCommissionRate, + DefaultValidatorBondFactor, + DefaultGlobalLiquidStakingCap, + DefaultValidatorLiquidStakingCap, ) } @@ -125,7 +161,13 @@ func (p Params) Validate() error { return err } - return nil + if err := validateMinCommissionRate(p.MinCommissionRate); err != nil { + return err + } + + err := validateValidatorBondFactor(p.ValidatorBondFactor) + + return err } func validateUnbondingTime(i interface{}) error { @@ -186,11 +228,9 @@ func validateBondDenom(i interface{}) error { return errors.New("bond denom cannot be blank") } - if err := sdk.ValidateDenom(v); err != nil { - return err - } + err := sdk.ValidateDenom(v) - return nil + return err } func ValidatePowerReduction(i interface{}) error { @@ -205,3 +245,64 @@ func ValidatePowerReduction(i interface{}) error { return nil } + +func validateMinCommissionRate(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("minimum commission rate cannot be negative: %s", v) + } + if v.GT(sdk.OneDec()) { + return fmt.Errorf("minimum commission rate cannot be greater than 100%%: %s", v) + } + + return nil +} + +func validateValidatorBondFactor(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() && !v.Equal(sdk.NewDec(-1)) { + return fmt.Errorf("invalid validator bond factor: %s", v) + } + + return nil +} + +func validateGlobalLiquidStakingCap(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("global liquid staking cap cannot be negative: %s", v) + } + if v.GT(sdk.OneDec()) { + return fmt.Errorf("global liquid staking cap cannot be greater than 100%%: %s", v) + } + + return nil +} + +func validateValidatorLiquidStakingCap(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("validator liquid staking cap cannot be negative: %s", v) + } + if v.GT(sdk.OneDec()) { + return fmt.Errorf("validator liquid staking cap cannot be greater than 100%%: %s", v) + } + + return nil +} diff --git a/x/staking/types/query.pb.go b/x/staking/types/query.pb.go index 29f84adc27a..3c5f954aa58 100644 --- a/x/staking/types/query.pb.go +++ b/x/staking/types/query.pb.go @@ -1,13 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/query.proto +// source: staking/v1beta1/query.proto package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + 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" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -30,6 +33,34 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type TokenizeShareLockStatus int32 + +const ( + TokenizeShareLockStatus_LOCKED TokenizeShareLockStatus = 0 + TokenizeShareLockStatus_UNLOCKED TokenizeShareLockStatus = 1 + TokenizeShareLockStatus_LOCK_EXPIRING TokenizeShareLockStatus = 2 +) + +var TokenizeShareLockStatus_name = map[int32]string{ + 0: "LOCKED", + 1: "UNLOCKED", + 2: "LOCK_EXPIRING", +} + +var TokenizeShareLockStatus_value = map[string]int32{ + "LOCKED": 0, + "UNLOCKED": 1, + "LOCK_EXPIRING": 2, +} + +func (x TokenizeShareLockStatus) String() string { + return proto.EnumName(TokenizeShareLockStatus_name, int32(x)) +} + +func (TokenizeShareLockStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{0} +} + // QueryValidatorsRequest is request type for Query/Validators RPC method. type QueryValidatorsRequest struct { // status enables to query for validators matching a given status. @@ -42,7 +73,7 @@ func (m *QueryValidatorsRequest) Reset() { *m = QueryValidatorsRequest{} func (m *QueryValidatorsRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorsRequest) ProtoMessage() {} func (*QueryValidatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{0} + return fileDescriptor_b8598f616533c087, []int{0} } func (m *QueryValidatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -97,7 +128,7 @@ func (m *QueryValidatorsResponse) Reset() { *m = QueryValidatorsResponse func (m *QueryValidatorsResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorsResponse) ProtoMessage() {} func (*QueryValidatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{1} + return fileDescriptor_b8598f616533c087, []int{1} } func (m *QueryValidatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -150,7 +181,7 @@ func (m *QueryValidatorRequest) Reset() { *m = QueryValidatorRequest{} } func (m *QueryValidatorRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorRequest) ProtoMessage() {} func (*QueryValidatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{2} + return fileDescriptor_b8598f616533c087, []int{2} } func (m *QueryValidatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -188,7 +219,7 @@ func (m *QueryValidatorRequest) GetValidatorAddr() string { // QueryValidatorResponse is response type for the Query/Validator RPC method type QueryValidatorResponse struct { - // validator defines the the validator info. + // validator defines the validator info. Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` } @@ -196,7 +227,7 @@ func (m *QueryValidatorResponse) Reset() { *m = QueryValidatorResponse{} func (m *QueryValidatorResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorResponse) ProtoMessage() {} func (*QueryValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{3} + return fileDescriptor_b8598f616533c087, []int{3} } func (m *QueryValidatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -245,7 +276,7 @@ func (m *QueryValidatorDelegationsRequest) Reset() { *m = QueryValidator func (m *QueryValidatorDelegationsRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorDelegationsRequest) ProtoMessage() {} func (*QueryValidatorDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{4} + return fileDescriptor_b8598f616533c087, []int{4} } func (m *QueryValidatorDelegationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -300,7 +331,7 @@ func (m *QueryValidatorDelegationsResponse) Reset() { *m = QueryValidato func (m *QueryValidatorDelegationsResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorDelegationsResponse) ProtoMessage() {} func (*QueryValidatorDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{5} + return fileDescriptor_b8598f616533c087, []int{5} } func (m *QueryValidatorDelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -360,7 +391,7 @@ func (m *QueryValidatorUnbondingDelegationsRequest) String() string { } func (*QueryValidatorUnbondingDelegationsRequest) ProtoMessage() {} func (*QueryValidatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{6} + return fileDescriptor_b8598f616533c087, []int{6} } func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -419,7 +450,7 @@ func (m *QueryValidatorUnbondingDelegationsResponse) String() string { } func (*QueryValidatorUnbondingDelegationsResponse) ProtoMessage() {} func (*QueryValidatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{7} + return fileDescriptor_b8598f616533c087, []int{7} } func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -474,7 +505,7 @@ func (m *QueryDelegationRequest) Reset() { *m = QueryDelegationRequest{} func (m *QueryDelegationRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegationRequest) ProtoMessage() {} func (*QueryDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{8} + return fileDescriptor_b8598f616533c087, []int{8} } func (m *QueryDelegationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -513,7 +544,7 @@ func (m *QueryDelegationResponse) Reset() { *m = QueryDelegationResponse func (m *QueryDelegationResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegationResponse) ProtoMessage() {} func (*QueryDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{9} + return fileDescriptor_b8598f616533c087, []int{9} } func (m *QueryDelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -562,7 +593,7 @@ func (m *QueryUnbondingDelegationRequest) Reset() { *m = QueryUnbondingD func (m *QueryUnbondingDelegationRequest) String() string { return proto.CompactTextString(m) } func (*QueryUnbondingDelegationRequest) ProtoMessage() {} func (*QueryUnbondingDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{10} + return fileDescriptor_b8598f616533c087, []int{10} } func (m *QueryUnbondingDelegationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -602,7 +633,7 @@ func (m *QueryUnbondingDelegationResponse) Reset() { *m = QueryUnbonding func (m *QueryUnbondingDelegationResponse) String() string { return proto.CompactTextString(m) } func (*QueryUnbondingDelegationResponse) ProtoMessage() {} func (*QueryUnbondingDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{11} + return fileDescriptor_b8598f616533c087, []int{11} } func (m *QueryUnbondingDelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -651,7 +682,7 @@ func (m *QueryDelegatorDelegationsRequest) Reset() { *m = QueryDelegator func (m *QueryDelegatorDelegationsRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorDelegationsRequest) ProtoMessage() {} func (*QueryDelegatorDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{12} + return fileDescriptor_b8598f616533c087, []int{12} } func (m *QueryDelegatorDelegationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -693,7 +724,7 @@ func (m *QueryDelegatorDelegationsResponse) Reset() { *m = QueryDelegato func (m *QueryDelegatorDelegationsResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorDelegationsResponse) ProtoMessage() {} func (*QueryDelegatorDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{13} + return fileDescriptor_b8598f616533c087, []int{13} } func (m *QueryDelegatorDelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -753,7 +784,7 @@ func (m *QueryDelegatorUnbondingDelegationsRequest) String() string { } func (*QueryDelegatorUnbondingDelegationsRequest) ProtoMessage() {} func (*QueryDelegatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{14} + return fileDescriptor_b8598f616533c087, []int{14} } func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -798,7 +829,7 @@ func (m *QueryDelegatorUnbondingDelegationsResponse) String() string { } func (*QueryDelegatorUnbondingDelegationsResponse) ProtoMessage() {} func (*QueryDelegatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{15} + return fileDescriptor_b8598f616533c087, []int{15} } func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -858,7 +889,7 @@ func (m *QueryRedelegationsRequest) Reset() { *m = QueryRedelegationsReq func (m *QueryRedelegationsRequest) String() string { return proto.CompactTextString(m) } func (*QueryRedelegationsRequest) ProtoMessage() {} func (*QueryRedelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{16} + return fileDescriptor_b8598f616533c087, []int{16} } func (m *QueryRedelegationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -899,7 +930,7 @@ func (m *QueryRedelegationsResponse) Reset() { *m = QueryRedelegationsRe func (m *QueryRedelegationsResponse) String() string { return proto.CompactTextString(m) } func (*QueryRedelegationsResponse) ProtoMessage() {} func (*QueryRedelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{17} + return fileDescriptor_b8598f616533c087, []int{17} } func (m *QueryRedelegationsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -955,7 +986,7 @@ func (m *QueryDelegatorValidatorsRequest) Reset() { *m = QueryDelegatorV func (m *QueryDelegatorValidatorsRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorValidatorsRequest) ProtoMessage() {} func (*QueryDelegatorValidatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{18} + return fileDescriptor_b8598f616533c087, []int{18} } func (m *QueryDelegatorValidatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -987,7 +1018,7 @@ var xxx_messageInfo_QueryDelegatorValidatorsRequest proto.InternalMessageInfo // QueryDelegatorValidatorsResponse is response type for the // Query/DelegatorValidators RPC method. type QueryDelegatorValidatorsResponse struct { - // validators defines the the validators' info of a delegator. + // validators defines the validators' info of a delegator. Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -997,7 +1028,7 @@ func (m *QueryDelegatorValidatorsResponse) Reset() { *m = QueryDelegator func (m *QueryDelegatorValidatorsResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorValidatorsResponse) ProtoMessage() {} func (*QueryDelegatorValidatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{19} + return fileDescriptor_b8598f616533c087, []int{19} } func (m *QueryDelegatorValidatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1053,7 +1084,7 @@ func (m *QueryDelegatorValidatorRequest) Reset() { *m = QueryDelegatorVa func (m *QueryDelegatorValidatorRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorValidatorRequest) ProtoMessage() {} func (*QueryDelegatorValidatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{20} + return fileDescriptor_b8598f616533c087, []int{20} } func (m *QueryDelegatorValidatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1085,7 +1116,7 @@ var xxx_messageInfo_QueryDelegatorValidatorRequest proto.InternalMessageInfo // QueryDelegatorValidatorResponse response type for the // Query/DelegatorValidator RPC method. type QueryDelegatorValidatorResponse struct { - // validator defines the the validator info. + // validator defines the validator info. Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` } @@ -1093,7 +1124,7 @@ func (m *QueryDelegatorValidatorResponse) Reset() { *m = QueryDelegatorV func (m *QueryDelegatorValidatorResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorValidatorResponse) ProtoMessage() {} func (*QueryDelegatorValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{21} + return fileDescriptor_b8598f616533c087, []int{21} } func (m *QueryDelegatorValidatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1140,7 +1171,7 @@ func (m *QueryHistoricalInfoRequest) Reset() { *m = QueryHistoricalInfoR func (m *QueryHistoricalInfoRequest) String() string { return proto.CompactTextString(m) } func (*QueryHistoricalInfoRequest) ProtoMessage() {} func (*QueryHistoricalInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{22} + return fileDescriptor_b8598f616533c087, []int{22} } func (m *QueryHistoricalInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1187,7 +1218,7 @@ func (m *QueryHistoricalInfoResponse) Reset() { *m = QueryHistoricalInfo func (m *QueryHistoricalInfoResponse) String() string { return proto.CompactTextString(m) } func (*QueryHistoricalInfoResponse) ProtoMessage() {} func (*QueryHistoricalInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{23} + return fileDescriptor_b8598f616533c087, []int{23} } func (m *QueryHistoricalInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1231,7 +1262,7 @@ func (m *QueryPoolRequest) Reset() { *m = QueryPoolRequest{} } func (m *QueryPoolRequest) String() string { return proto.CompactTextString(m) } func (*QueryPoolRequest) ProtoMessage() {} func (*QueryPoolRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{24} + return fileDescriptor_b8598f616533c087, []int{24} } func (m *QueryPoolRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1270,7 +1301,7 @@ func (m *QueryPoolResponse) Reset() { *m = QueryPoolResponse{} } func (m *QueryPoolResponse) String() string { return proto.CompactTextString(m) } func (*QueryPoolResponse) ProtoMessage() {} func (*QueryPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{25} + return fileDescriptor_b8598f616533c087, []int{25} } func (m *QueryPoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1314,7 +1345,7 @@ 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_f270127f442bbcd8, []int{26} + return fileDescriptor_b8598f616533c087, []int{26} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1353,7 +1384,7 @@ 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_f270127f442bbcd8, []int{27} + return fileDescriptor_b8598f616533c087, []int{27} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1389,1638 +1420,1783 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -func init() { - proto.RegisterType((*QueryValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorsRequest") - proto.RegisterType((*QueryValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorsResponse") - proto.RegisterType((*QueryValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorRequest") - proto.RegisterType((*QueryValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorResponse") - proto.RegisterType((*QueryValidatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsRequest") - proto.RegisterType((*QueryValidatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsResponse") - proto.RegisterType((*QueryValidatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest") - proto.RegisterType((*QueryValidatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse") - proto.RegisterType((*QueryDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryDelegationRequest") - proto.RegisterType((*QueryDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryDelegationResponse") - proto.RegisterType((*QueryUnbondingDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationRequest") - proto.RegisterType((*QueryUnbondingDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationResponse") - proto.RegisterType((*QueryDelegatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest") - proto.RegisterType((*QueryDelegatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse") - proto.RegisterType((*QueryDelegatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest") - proto.RegisterType((*QueryDelegatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse") - proto.RegisterType((*QueryRedelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryRedelegationsRequest") - proto.RegisterType((*QueryRedelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryRedelegationsResponse") - proto.RegisterType((*QueryDelegatorValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest") - proto.RegisterType((*QueryDelegatorValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse") - proto.RegisterType((*QueryDelegatorValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorRequest") - proto.RegisterType((*QueryDelegatorValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorResponse") - proto.RegisterType((*QueryHistoricalInfoRequest)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoRequest") - proto.RegisterType((*QueryHistoricalInfoResponse)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoResponse") - proto.RegisterType((*QueryPoolRequest)(nil), "cosmos.staking.v1beta1.QueryPoolRequest") - proto.RegisterType((*QueryPoolResponse)(nil), "cosmos.staking.v1beta1.QueryPoolResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.staking.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.staking.v1beta1.QueryParamsResponse") +// QueryTokenizeShareRecordByIdRequest is request type for the +// Query/QueryTokenizeShareRecordById RPC method. +type QueryTokenizeShareRecordByIdRequest struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } -func init() { - proto.RegisterFile("cosmos/staking/v1beta1/query.proto", fileDescriptor_f270127f442bbcd8) -} - -var fileDescriptor_f270127f442bbcd8 = []byte{ - // 1303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0xcf, 0x4f, 0x1c, 0x75, - 0x14, 0xdf, 0x2f, 0x20, 0x91, 0xd7, 0xb4, 0xa9, 0xdf, 0x05, 0xc4, 0x29, 0xee, 0xd2, 0x09, 0x22, - 0xa5, 0x74, 0x46, 0xa0, 0x52, 0xac, 0x4d, 0x15, 0xac, 0x54, 0xd2, 0x83, 0xb0, 0x46, 0xfc, 0x75, - 0x20, 0xb3, 0x3b, 0xd3, 0xd9, 0x49, 0x97, 0x99, 0xed, 0xcc, 0x40, 0x40, 0xc2, 0x41, 0x4f, 0x7a, - 0xd3, 0x78, 0x52, 0x2f, 0x3d, 0x98, 0x98, 0xe8, 0x51, 0xff, 0x01, 0x4f, 0xd6, 0x1b, 0x46, 0x0f, - 0x7a, 0xa9, 0x06, 0x3c, 0x34, 0x9e, 0xbc, 0x19, 0x6f, 0x66, 0xbf, 0xf3, 0x66, 0x76, 0x86, 0xf9, - 0xb9, 0xcb, 0x12, 0xd2, 0x13, 0xbb, 0xdf, 0x7d, 0x3f, 0x3e, 0x9f, 0xf7, 0xbe, 0xef, 0x7d, 0xdf, - 0x0b, 0xc0, 0x57, 0x0c, 0x6b, 0xdd, 0xb0, 0x44, 0xcb, 0x96, 0xee, 0x68, 0xba, 0x2a, 0x6e, 0x4e, - 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, 0xf7, 0x8a, - 0x39, 0x7e, 0x13, 0xfb, 0x56, 0xf8, 0x92, 0xd1, 0xf7, 0x20, 0x1f, 0x71, 0x95, 0xb1, 0xaa, 0x5b, - 0xb8, 0xc9, 0x25, 0x1a, 0xbe, 0xac, 0xfc, 0x36, 0x14, 0x99, 0xdf, 0x88, 0x40, 0x1f, 0x37, 0xe5, - 0x75, 0xec, 0x2d, 0x91, 0xae, 0x91, 0xfb, 0x12, 0xf4, 0x3a, 0x79, 0x46, 0xba, 0x6d, 0x5c, 0x14, - 0x34, 0xc0, 0x7f, 0xe9, 0xf6, 0xb2, 0x1b, 0x2e, 0xec, 0xe8, 0x1a, 0xca, 0xc2, 0xb5, 0x43, 0x35, - 0xe4, 0x0b, 0xc6, 0xcf, 0x6e, 0x57, 0x8b, 0x46, 0x87, 0xe1, 0xa8, 0x74, 0xac, 0xab, 0x39, 0xb1, - 0x39, 0xde, 0xf6, 0xf5, 0x95, 0xdb, 0xbe, 0x3c, 0x4e, 0x29, 0xed, 0xeb, 0x64, 0x42, 0xef, 0x35, - 0xb2, 0x14, 0x98, 0x8f, 0x62, 0x23, 0xfb, 0x87, 0xc0, 0x53, 0x8c, 0x5b, 0x49, 0x91, 0xdb, 0x0e, - 0xf9, 0x24, 0x50, 0xcb, 0xac, 0xac, 0x45, 0x56, 0xf7, 0x59, 0xcb, 0xac, 0xac, 0x06, 0xde, 0x97, - 0x49, 0xa0, 0xb2, 0x65, 0x1f, 0x96, 0xee, 0x76, 0xa4, 0x65, 0xcb, 0x5e, 0x4d, 0x78, 0x8d, 0x7a, - 0x3a, 0x90, 0xce, 0x3d, 0x02, 0x5c, 0x14, 0x65, 0x4c, 0x9f, 0x06, 0x83, 0xa6, 0x92, 0x50, 0x44, - 0x93, 0x71, 0x19, 0xf4, 0x9b, 0x3b, 0x54, 0x46, 0x03, 0xa6, 0x72, 0xdc, 0x73, 0x40, 0x31, 0x78, - 0x43, 0xc3, 0x93, 0xf5, 0x89, 0x95, 0xcf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, 0x86, 0x64, 0x84, 0x16, 0x62, 0x91, 0x38, - 0xa3, 0xef, 0xe2, 0xfd, 0xfd, 0x02, 0xd9, 0xdb, 0x2f, 0x90, 0x3f, 0xf7, 0x0b, 0xe4, 0x93, 0x83, - 0x42, 0x6e, 0xef, 0xa0, 0x90, 0xfb, 0xed, 0xa0, 0x90, 0x7b, 0x77, 0x52, 0xd5, 0xec, 0xea, 0x46, - 0x59, 0xa8, 0x18, 0xeb, 0xae, 0x0d, 0xe7, 0xcf, 0x25, 0x4b, 0xbe, 0x23, 0x6e, 0x79, 0x06, 0xed, - 0xed, 0xba, 0x62, 0x95, 0x7b, 0xd9, 0x3f, 0x88, 0x66, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x4b, - 0x6e, 0xeb, 0x7f, 0xe4, 0x1a, 0x00, 0x00, +func (m *QueryTokenizeShareRecordByIdRequest) Reset() { *m = QueryTokenizeShareRecordByIdRequest{} } +func (m *QueryTokenizeShareRecordByIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByIdRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordByIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{28} +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByIdRequest.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 *QueryTokenizeShareRecordByIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByIdRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByIdRequest.DiscardUnknown(m) } -// 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 +var xxx_messageInfo_QueryTokenizeShareRecordByIdRequest proto.InternalMessageInfo -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Validators queries all validators that match the given status. - Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) - // Validator queries validator info for given validator address. - Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) - // ValidatorDelegations queries delegate info for given validator. - ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) - // ValidatorUnbondingDelegations queries unbonding delegations of a validator. - ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) - // Delegation queries delegate info for given validator delegator pair. - Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) - // UnbondingDelegation queries unbonding info for given validator delegator - // pair. - UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) - // DelegatorDelegations queries all delegations of a given delegator address. - DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) - // DelegatorUnbondingDelegations queries all unbonding delegations of a given - // delegator address. - DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) - // Redelegations queries redelegations of given address. - Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) - // DelegatorValidators queries all validators info for given delegator - // address. - DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) - // DelegatorValidator queries validator info for given delegator validator - // pair. - DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) - // HistoricalInfo queries the historical info for given height. - HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) - // Pool queries the pool info. - Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) - // Parameters queries the staking parameters. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +func (m *QueryTokenizeShareRecordByIdRequest) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 } -type queryClient struct { - cc grpc1.ClientConn +// QueryTokenizeShareRecordByIdRequest is response type for the +// Query/QueryTokenizeShareRecordById RPC method. +type QueryTokenizeShareRecordByIdResponse struct { + Record TokenizeShareRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` } -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryTokenizeShareRecordByIdResponse) Reset() { *m = QueryTokenizeShareRecordByIdResponse{} } +func (m *QueryTokenizeShareRecordByIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByIdResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordByIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{29} } - -func (c *queryClient) Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) { - out := new(QueryValidatorsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validators", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByIdResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByIdResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByIdResponse.DiscardUnknown(m) } -func (c *queryClient) Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) { - out := new(QueryValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validator", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryTokenizeShareRecordByIdResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordByIdResponse) GetRecord() TokenizeShareRecord { + if m != nil { + return m.Record } - return out, nil + return TokenizeShareRecord{} } -func (c *queryClient) ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) { - out := new(QueryValidatorDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorDelegations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryTokenizeShareRecordByDenomRequest is request type for the +// Query/QueryTokenizeShareRecordByDenom RPC method. +type QueryTokenizeShareRecordByDenomRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` } -func (c *queryClient) ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) { - out := new(QueryValidatorUnbondingDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryTokenizeShareRecordByDenomRequest) Reset() { + *m = QueryTokenizeShareRecordByDenomRequest{} +} +func (m *QueryTokenizeShareRecordByDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByDenomRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordByDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{30} +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest.DiscardUnknown(m) } -func (c *queryClient) Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) { - out := new(QueryDelegationResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Delegation", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryTokenizeShareRecordByDenomRequest proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordByDenomRequest) GetDenom() string { + if m != nil { + return m.Denom } - return out, nil + return "" } -func (c *queryClient) UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) { - out := new(QueryUnbondingDelegationResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/UnbondingDelegation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryTokenizeShareRecordByDenomResponse is response type for the +// Query/QueryTokenizeShareRecordByDenom RPC method. +type QueryTokenizeShareRecordByDenomResponse struct { + Record TokenizeShareRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` } -func (c *queryClient) DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) { - out := new(QueryDelegatorDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorDelegations", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryTokenizeShareRecordByDenomResponse) Reset() { + *m = QueryTokenizeShareRecordByDenomResponse{} +} +func (m *QueryTokenizeShareRecordByDenomResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordByDenomResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordByDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{31} +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordByDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse.DiscardUnknown(m) } -func (c *queryClient) DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) { - out := new(QueryDelegatorUnbondingDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryTokenizeShareRecordByDenomResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordByDenomResponse) GetRecord() TokenizeShareRecord { + if m != nil { + return m.Record } - return out, nil + return TokenizeShareRecord{} } -func (c *queryClient) Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) { - out := new(QueryRedelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Redelegations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryTokenizeShareRecordsOwnedRequest is request type for the +// Query/QueryTokenizeShareRecordsOwned RPC method. +type QueryTokenizeShareRecordsOwnedRequest struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` } -func (c *queryClient) DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) { - out := new(QueryDelegatorValidatorsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidators", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryTokenizeShareRecordsOwnedRequest) Reset() { *m = QueryTokenizeShareRecordsOwnedRequest{} } +func (m *QueryTokenizeShareRecordsOwnedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordsOwnedRequest) ProtoMessage() {} +func (*QueryTokenizeShareRecordsOwnedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{32} +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest.Merge(m, src) +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordsOwnedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest.DiscardUnknown(m) } -func (c *queryClient) DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) { - out := new(QueryDelegatorValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidator", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryTokenizeShareRecordsOwnedRequest proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordsOwnedRequest) GetOwner() string { + if m != nil { + return m.Owner } - return out, nil + return "" } -func (c *queryClient) HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) { - out := new(QueryHistoricalInfoResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/HistoricalInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryTokenizeShareRecordsOwnedResponse is response type for the +// Query/QueryTokenizeShareRecordsOwned RPC method. +type QueryTokenizeShareRecordsOwnedResponse struct { + Records []TokenizeShareRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` } -func (c *queryClient) Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) { - out := new(QueryPoolResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Pool", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryTokenizeShareRecordsOwnedResponse) Reset() { + *m = QueryTokenizeShareRecordsOwnedResponse{} } - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryTokenizeShareRecordsOwnedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareRecordsOwnedResponse) ProtoMessage() {} +func (*QueryTokenizeShareRecordsOwnedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{33} +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil } - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Validators queries all validators that match the given status. - Validators(context.Context, *QueryValidatorsRequest) (*QueryValidatorsResponse, error) - // Validator queries validator info for given validator address. - Validator(context.Context, *QueryValidatorRequest) (*QueryValidatorResponse, error) - // ValidatorDelegations queries delegate info for given validator. - ValidatorDelegations(context.Context, *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) - // ValidatorUnbondingDelegations queries unbonding delegations of a validator. - ValidatorUnbondingDelegations(context.Context, *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) - // Delegation queries delegate info for given validator delegator pair. - Delegation(context.Context, *QueryDelegationRequest) (*QueryDelegationResponse, error) - // UnbondingDelegation queries unbonding info for given validator delegator - // pair. - UnbondingDelegation(context.Context, *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) - // DelegatorDelegations queries all delegations of a given delegator address. - DelegatorDelegations(context.Context, *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) - // DelegatorUnbondingDelegations queries all unbonding delegations of a given - // delegator address. - DelegatorUnbondingDelegations(context.Context, *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) - // Redelegations queries redelegations of given address. - Redelegations(context.Context, *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) - // DelegatorValidators queries all validators info for given delegator - // address. - DelegatorValidators(context.Context, *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) - // DelegatorValidator queries validator info for given delegator validator - // pair. - DelegatorValidator(context.Context, *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) - // HistoricalInfo queries the historical info for given height. - HistoricalInfo(context.Context, *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) - // Pool queries the pool info. - Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error) - // Parameters queries the staking parameters. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse.Merge(m, src) +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareRecordsOwnedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse.DiscardUnknown(m) } -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +var xxx_messageInfo_QueryTokenizeShareRecordsOwnedResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareRecordsOwnedResponse) GetRecords() []TokenizeShareRecord { + if m != nil { + return m.Records + } + return nil } -func (*UnimplementedQueryServer) Validators(ctx context.Context, req *QueryValidatorsRequest) (*QueryValidatorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Validators not implemented") +// QueryAllTokenizeShareRecordsRequest is request type for the +// Query/QueryAllTokenizeShareRecords RPC method. +type QueryAllTokenizeShareRecordsRequest struct { } -func (*UnimplementedQueryServer) Validator(ctx context.Context, req *QueryValidatorRequest) (*QueryValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Validator not implemented") + +func (m *QueryAllTokenizeShareRecordsRequest) Reset() { *m = QueryAllTokenizeShareRecordsRequest{} } +func (m *QueryAllTokenizeShareRecordsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllTokenizeShareRecordsRequest) ProtoMessage() {} +func (*QueryAllTokenizeShareRecordsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{34} } -func (*UnimplementedQueryServer) ValidatorDelegations(ctx context.Context, req *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidatorDelegations not implemented") +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) ValidatorUnbondingDelegations(ctx context.Context, req *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidatorUnbondingDelegations not implemented") +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllTokenizeShareRecordsRequest.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 (*UnimplementedQueryServer) Delegation(ctx context.Context, req *QueryDelegationRequest) (*QueryDelegationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delegation not implemented") +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllTokenizeShareRecordsRequest.Merge(m, src) } -func (*UnimplementedQueryServer) UnbondingDelegation(ctx context.Context, req *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UnbondingDelegation not implemented") +func (m *QueryAllTokenizeShareRecordsRequest) XXX_Size() int { + return m.Size() } -func (*UnimplementedQueryServer) DelegatorDelegations(ctx context.Context, req *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorDelegations not implemented") +func (m *QueryAllTokenizeShareRecordsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllTokenizeShareRecordsRequest.DiscardUnknown(m) } -func (*UnimplementedQueryServer) DelegatorUnbondingDelegations(ctx context.Context, req *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorUnbondingDelegations not implemented") + +var xxx_messageInfo_QueryAllTokenizeShareRecordsRequest proto.InternalMessageInfo + +// QueryAllTokenizeShareRecordsResponse is response type for the +// Query/QueryAllTokenizeShareRecords RPC method. +type QueryAllTokenizeShareRecordsResponse struct { + Records []TokenizeShareRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` } -func (*UnimplementedQueryServer) Redelegations(ctx context.Context, req *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Redelegations not implemented") + +func (m *QueryAllTokenizeShareRecordsResponse) Reset() { *m = QueryAllTokenizeShareRecordsResponse{} } +func (m *QueryAllTokenizeShareRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllTokenizeShareRecordsResponse) ProtoMessage() {} +func (*QueryAllTokenizeShareRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{35} } -func (*UnimplementedQueryServer) DelegatorValidators(ctx context.Context, req *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidators not implemented") +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) DelegatorValidator(ctx context.Context, req *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidator not implemented") +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllTokenizeShareRecordsResponse.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 (*UnimplementedQueryServer) HistoricalInfo(ctx context.Context, req *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HistoricalInfo not implemented") +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllTokenizeShareRecordsResponse.Merge(m, src) } -func (*UnimplementedQueryServer) Pool(ctx context.Context, req *QueryPoolRequest) (*QueryPoolResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Pool not implemented") +func (m *QueryAllTokenizeShareRecordsResponse) XXX_Size() int { + return m.Size() } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +func (m *QueryAllTokenizeShareRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllTokenizeShareRecordsResponse.DiscardUnknown(m) } -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} +var xxx_messageInfo_QueryAllTokenizeShareRecordsResponse proto.InternalMessageInfo -func _Query_Validators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Validators(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Validators", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Validators(ctx, req.(*QueryValidatorsRequest)) +func (m *QueryAllTokenizeShareRecordsResponse) GetRecords() []TokenizeShareRecord { + if m != nil { + return m.Records } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_Validator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Validator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Validator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Validator(ctx, req.(*QueryValidatorRequest)) - } - return interceptor(ctx, in, info, handler) +// QueryLastTokenizeShareRecordIdRequest is request type for the +// Query/QueryLastTokenizeShareRecordId RPC method. +type QueryLastTokenizeShareRecordIdRequest struct { } -func _Query_ValidatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ValidatorDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ValidatorDelegations(ctx, req.(*QueryValidatorDelegationsRequest)) +func (m *QueryLastTokenizeShareRecordIdRequest) Reset() { *m = QueryLastTokenizeShareRecordIdRequest{} } +func (m *QueryLastTokenizeShareRecordIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLastTokenizeShareRecordIdRequest) ProtoMessage() {} +func (*QueryLastTokenizeShareRecordIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{36} +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest.Merge(m, src) +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLastTokenizeShareRecordIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest.DiscardUnknown(m) } -func _Query_ValidatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorUnbondingDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, req.(*QueryValidatorUnbondingDelegationsRequest)) - } - return interceptor(ctx, in, info, handler) +var xxx_messageInfo_QueryLastTokenizeShareRecordIdRequest proto.InternalMessageInfo + +// QueryLastTokenizeShareRecordIdResponse is response type for the +// Query/QueryLastTokenizeShareRecordId RPC method. +type QueryLastTokenizeShareRecordIdResponse struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } -func _Query_Delegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Delegation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Delegation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Delegation(ctx, req.(*QueryDelegationRequest)) +func (m *QueryLastTokenizeShareRecordIdResponse) Reset() { + *m = QueryLastTokenizeShareRecordIdResponse{} +} +func (m *QueryLastTokenizeShareRecordIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLastTokenizeShareRecordIdResponse) ProtoMessage() {} +func (*QueryLastTokenizeShareRecordIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{37} +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse.Merge(m, src) +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLastTokenizeShareRecordIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse.DiscardUnknown(m) } -func _Query_UnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUnbondingDelegationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).UnbondingDelegation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/UnbondingDelegation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UnbondingDelegation(ctx, req.(*QueryUnbondingDelegationRequest)) +var xxx_messageInfo_QueryLastTokenizeShareRecordIdResponse proto.InternalMessageInfo + +func (m *QueryLastTokenizeShareRecordIdResponse) GetId() uint64 { + if m != nil { + return m.Id } - return interceptor(ctx, in, info, handler) + return 0 } -func _Query_DelegatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorDelegations(ctx, req.(*QueryDelegatorDelegationsRequest)) - } - return interceptor(ctx, in, info, handler) +// QueryTotalTokenizeSharedAssetsRequest is request type for the +// Query/QueryTotalTokenizeSharedAssets RPC method. +type QueryTotalTokenizeSharedAssetsRequest struct { } -func _Query_DelegatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorUnbondingDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, req.(*QueryDelegatorUnbondingDelegationsRequest)) +func (m *QueryTotalTokenizeSharedAssetsRequest) Reset() { *m = QueryTotalTokenizeSharedAssetsRequest{} } +func (m *QueryTotalTokenizeSharedAssetsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalTokenizeSharedAssetsRequest) ProtoMessage() {} +func (*QueryTotalTokenizeSharedAssetsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{38} +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest.Merge(m, src) +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalTokenizeSharedAssetsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest.DiscardUnknown(m) } -func _Query_Redelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRedelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Redelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Redelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Redelegations(ctx, req.(*QueryRedelegationsRequest)) - } - return interceptor(ctx, in, info, handler) +var xxx_messageInfo_QueryTotalTokenizeSharedAssetsRequest proto.InternalMessageInfo + +// QueryTotalTokenizeSharedAssetsResponse is response type for the +// Query/QueryTotalTokenizeSharedAssets RPC method. +type QueryTotalTokenizeSharedAssetsResponse struct { + Value types.Coin `protobuf:"bytes,1,opt,name=value,proto3" json:"value"` } -func _Query_DelegatorValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorValidatorsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorValidators(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidators", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorValidators(ctx, req.(*QueryDelegatorValidatorsRequest)) +func (m *QueryTotalTokenizeSharedAssetsResponse) Reset() { + *m = QueryTotalTokenizeSharedAssetsResponse{} +} +func (m *QueryTotalTokenizeSharedAssetsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalTokenizeSharedAssetsResponse) ProtoMessage() {} +func (*QueryTotalTokenizeSharedAssetsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{39} +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse.Merge(m, src) +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalTokenizeSharedAssetsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse.DiscardUnknown(m) } -func _Query_DelegatorValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorValidatorRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorValidator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorValidator(ctx, req.(*QueryDelegatorValidatorRequest)) +var xxx_messageInfo_QueryTotalTokenizeSharedAssetsResponse proto.InternalMessageInfo + +func (m *QueryTotalTokenizeSharedAssetsResponse) GetValue() types.Coin { + if m != nil { + return m.Value } - return interceptor(ctx, in, info, handler) + return types.Coin{} } -func _Query_HistoricalInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryHistoricalInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).HistoricalInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/HistoricalInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).HistoricalInfo(ctx, req.(*QueryHistoricalInfoRequest)) - } - return interceptor(ctx, in, info, handler) +// QueryQueryTotalLiquidStakedRequest is request type for the +// Query/QueryQueryTotalLiquidStaked RPC method. +type QueryTotalLiquidStaked struct { } -func _Query_Pool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPoolRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Pool(ctx, in) +func (m *QueryTotalLiquidStaked) Reset() { *m = QueryTotalLiquidStaked{} } +func (m *QueryTotalLiquidStaked) String() string { return proto.CompactTextString(m) } +func (*QueryTotalLiquidStaked) ProtoMessage() {} +func (*QueryTotalLiquidStaked) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{40} +} +func (m *QueryTotalLiquidStaked) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalLiquidStaked) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalLiquidStaked.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Pool", +} +func (m *QueryTotalLiquidStaked) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalLiquidStaked.Merge(m, src) +} +func (m *QueryTotalLiquidStaked) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalLiquidStaked) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalLiquidStaked.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalLiquidStaked proto.InternalMessageInfo + +// QueryQueryTotalLiquidStakedResponse is response type for the +// Query/QueryQueryTotalLiquidStaked RPC method. +type QueryTotalLiquidStakedResponse struct { + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens"` +} + +func (m *QueryTotalLiquidStakedResponse) Reset() { *m = QueryTotalLiquidStakedResponse{} } +func (m *QueryTotalLiquidStakedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalLiquidStakedResponse) ProtoMessage() {} +func (*QueryTotalLiquidStakedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{41} +} +func (m *QueryTotalLiquidStakedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalLiquidStakedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalLiquidStakedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Pool(ctx, req.(*QueryPoolRequest)) +} +func (m *QueryTotalLiquidStakedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalLiquidStakedResponse.Merge(m, src) +} +func (m *QueryTotalLiquidStakedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalLiquidStakedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalLiquidStakedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalLiquidStakedResponse proto.InternalMessageInfo + +// QueryTokenizeShareLockInfo queries the tokenize share lock information +// associated with given account +type QueryTokenizeShareLockInfo struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryTokenizeShareLockInfo) Reset() { *m = QueryTokenizeShareLockInfo{} } +func (m *QueryTokenizeShareLockInfo) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareLockInfo) ProtoMessage() {} +func (*QueryTokenizeShareLockInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{42} +} +func (m *QueryTokenizeShareLockInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareLockInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareLockInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryTokenizeShareLockInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareLockInfo.Merge(m, src) +} +func (m *QueryTokenizeShareLockInfo) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareLockInfo) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareLockInfo.DiscardUnknown(m) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err +var xxx_messageInfo_QueryTokenizeShareLockInfo proto.InternalMessageInfo + +func (m *QueryTokenizeShareLockInfo) GetAddress() string { + if m != nil { + return m.Address } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) + return "" +} + +// QueryTokenizeShareLockInfoResponse is the response from the +// QueryTokenizeShareLockInfo query +type QueryTokenizeShareLockInfoResponse struct { + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + ExpirationTime string `protobuf:"bytes,2,opt,name=expiration_time,json=expirationTime,proto3" json:"expiration_time,omitempty"` +} + +func (m *QueryTokenizeShareLockInfoResponse) Reset() { *m = QueryTokenizeShareLockInfoResponse{} } +func (m *QueryTokenizeShareLockInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenizeShareLockInfoResponse) ProtoMessage() {} +func (*QueryTokenizeShareLockInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b8598f616533c087, []int{43} +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenizeShareLockInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Params", +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenizeShareLockInfoResponse.Merge(m, src) +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenizeShareLockInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenizeShareLockInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenizeShareLockInfoResponse proto.InternalMessageInfo + +func (m *QueryTokenizeShareLockInfoResponse) GetStatus() string { + if m != nil { + return m.Status } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + return "" +} + +func (m *QueryTokenizeShareLockInfoResponse) GetExpirationTime() string { + if m != nil { + return m.ExpirationTime } - return interceptor(ctx, in, info, handler) + return "" } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.staking.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Validators", - Handler: _Query_Validators_Handler, - }, - { - MethodName: "Validator", - Handler: _Query_Validator_Handler, - }, - { - MethodName: "ValidatorDelegations", - Handler: _Query_ValidatorDelegations_Handler, - }, - { - MethodName: "ValidatorUnbondingDelegations", - Handler: _Query_ValidatorUnbondingDelegations_Handler, - }, - { - MethodName: "Delegation", - Handler: _Query_Delegation_Handler, - }, - { - MethodName: "UnbondingDelegation", - Handler: _Query_UnbondingDelegation_Handler, - }, - { - MethodName: "DelegatorDelegations", - Handler: _Query_DelegatorDelegations_Handler, - }, - { - MethodName: "DelegatorUnbondingDelegations", - Handler: _Query_DelegatorUnbondingDelegations_Handler, - }, - { - MethodName: "Redelegations", - Handler: _Query_Redelegations_Handler, - }, - { - MethodName: "DelegatorValidators", - Handler: _Query_DelegatorValidators_Handler, - }, - { - MethodName: "DelegatorValidator", - Handler: _Query_DelegatorValidator_Handler, - }, - { - MethodName: "HistoricalInfo", - Handler: _Query_HistoricalInfo_Handler, - }, - { - MethodName: "Pool", - Handler: _Query_Pool_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/staking/v1beta1/query.proto", +func init() { + proto.RegisterEnum("cosmos.staking.v1beta1.TokenizeShareLockStatus", TokenizeShareLockStatus_name, TokenizeShareLockStatus_value) + proto.RegisterType((*QueryValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorsRequest") + proto.RegisterType((*QueryValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorsResponse") + proto.RegisterType((*QueryValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorRequest") + proto.RegisterType((*QueryValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorResponse") + proto.RegisterType((*QueryValidatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsRequest") + proto.RegisterType((*QueryValidatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsResponse") + proto.RegisterType((*QueryValidatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest") + proto.RegisterType((*QueryValidatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse") + proto.RegisterType((*QueryDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryDelegationRequest") + proto.RegisterType((*QueryDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryDelegationResponse") + proto.RegisterType((*QueryUnbondingDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationRequest") + proto.RegisterType((*QueryUnbondingDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationResponse") + proto.RegisterType((*QueryDelegatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest") + proto.RegisterType((*QueryDelegatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse") + proto.RegisterType((*QueryDelegatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest") + proto.RegisterType((*QueryDelegatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse") + proto.RegisterType((*QueryRedelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryRedelegationsRequest") + proto.RegisterType((*QueryRedelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryRedelegationsResponse") + proto.RegisterType((*QueryDelegatorValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest") + proto.RegisterType((*QueryDelegatorValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse") + proto.RegisterType((*QueryDelegatorValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorRequest") + proto.RegisterType((*QueryDelegatorValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorResponse") + proto.RegisterType((*QueryHistoricalInfoRequest)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoRequest") + proto.RegisterType((*QueryHistoricalInfoResponse)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoResponse") + proto.RegisterType((*QueryPoolRequest)(nil), "cosmos.staking.v1beta1.QueryPoolRequest") + proto.RegisterType((*QueryPoolResponse)(nil), "cosmos.staking.v1beta1.QueryPoolResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.staking.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.staking.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryTokenizeShareRecordByIdRequest)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByIdRequest") + proto.RegisterType((*QueryTokenizeShareRecordByIdResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByIdResponse") + proto.RegisterType((*QueryTokenizeShareRecordByDenomRequest)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByDenomRequest") + proto.RegisterType((*QueryTokenizeShareRecordByDenomResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordByDenomResponse") + proto.RegisterType((*QueryTokenizeShareRecordsOwnedRequest)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedRequest") + proto.RegisterType((*QueryTokenizeShareRecordsOwnedResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareRecordsOwnedResponse") + proto.RegisterType((*QueryAllTokenizeShareRecordsRequest)(nil), "cosmos.staking.v1beta1.QueryAllTokenizeShareRecordsRequest") + proto.RegisterType((*QueryAllTokenizeShareRecordsResponse)(nil), "cosmos.staking.v1beta1.QueryAllTokenizeShareRecordsResponse") + proto.RegisterType((*QueryLastTokenizeShareRecordIdRequest)(nil), "cosmos.staking.v1beta1.QueryLastTokenizeShareRecordIdRequest") + proto.RegisterType((*QueryLastTokenizeShareRecordIdResponse)(nil), "cosmos.staking.v1beta1.QueryLastTokenizeShareRecordIdResponse") + proto.RegisterType((*QueryTotalTokenizeSharedAssetsRequest)(nil), "cosmos.staking.v1beta1.QueryTotalTokenizeSharedAssetsRequest") + proto.RegisterType((*QueryTotalTokenizeSharedAssetsResponse)(nil), "cosmos.staking.v1beta1.QueryTotalTokenizeSharedAssetsResponse") + proto.RegisterType((*QueryTotalLiquidStaked)(nil), "cosmos.staking.v1beta1.QueryTotalLiquidStaked") + proto.RegisterType((*QueryTotalLiquidStakedResponse)(nil), "cosmos.staking.v1beta1.QueryTotalLiquidStakedResponse") + proto.RegisterType((*QueryTokenizeShareLockInfo)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareLockInfo") + proto.RegisterType((*QueryTokenizeShareLockInfoResponse)(nil), "cosmos.staking.v1beta1.QueryTokenizeShareLockInfoResponse") +} + +func init() { proto.RegisterFile("staking/v1beta1/query.proto", fileDescriptor_b8598f616533c087) } + +var fileDescriptor_b8598f616533c087 = []byte{ + // 1893 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5a, 0xcd, 0x6f, 0x13, 0xdb, + 0x15, 0xf7, 0x0d, 0x21, 0xc0, 0xa1, 0xa4, 0xe1, 0x26, 0x84, 0x64, 0x00, 0x3b, 0x4c, 0x21, 0x09, + 0xa1, 0xb1, 0x4b, 0x80, 0x90, 0x42, 0x48, 0x9a, 0x10, 0xa0, 0x56, 0x22, 0x08, 0x0e, 0x50, 0x68, + 0x17, 0xd6, 0xc4, 0x33, 0x38, 0xa3, 0xd8, 0x33, 0xce, 0xcc, 0x38, 0x10, 0x50, 0x16, 0xed, 0xaa, + 0xec, 0x2a, 0x55, 0xaa, 0x54, 0xa9, 0x52, 0x59, 0x54, 0xad, 0xd4, 0x8f, 0x55, 0xd3, 0x2d, 0x52, + 0x57, 0xa5, 0xbb, 0x94, 0x76, 0xd1, 0xf7, 0x16, 0xbc, 0x27, 0x78, 0x0b, 0xfe, 0x83, 0xa7, 0xb7, + 0x7b, 0x9a, 0x3b, 0x67, 0xc6, 0x63, 0xcf, 0x97, 0xed, 0x38, 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+ 0x7e, 0xbe, 0x07, 0xa8, 0xa5, 0x4c, 0xd0, 0x84, 0xa2, 0x5d, 0x6a, 0xfc, 0x12, 0x74, 0x57, 0xad, + 0xa2, 0x91, 0x49, 0xe8, 0x28, 0xb1, 0x15, 0x34, 0x13, 0x0f, 0x34, 0xc3, 0x76, 0xd9, 0x17, 0x24, + 0x4b, 0x86, 0xbf, 0x0c, 0xdf, 0x63, 0x4a, 0xef, 0xab, 0xab, 0x92, 0x22, 0x3f, 0x97, 0x96, 0x56, + 0x04, 0x4d, 0xca, 0x48, 0x39, 0x55, 0x13, 0x67, 0x37, 0xd2, 0xa2, 0xed, 0xe5, 0x4e, 0x68, 0x93, + 0xad, 0xeb, 0x58, 0x7b, 0xa6, 0x4d, 0x16, 0xf9, 0x35, 0x38, 0x13, 0x2e, 0x56, 0xb9, 0xca, 0x69, + 0x6c, 0x35, 0xea, 0x2a, 0xe7, 0xa7, 0x08, 0x91, 0x5a, 0x0a, 0xf8, 0x29, 0x18, 0x0c, 0x36, 0x39, + 0x27, 0x29, 0x6a, 0xd1, 0x06, 0xdb, 0x03, 0xfb, 0x45, 0xf3, 0x19, 0xc7, 0x24, 0xd6, 0x03, 0x6f, + 0xc0, 0x50, 0xa4, 0x7c, 0xeb, 0x51, 0x5f, 0x87, 0xb3, 0x41, 0x56, 0xf5, 0xbb, 0x4f, 0x15, 0x49, + 0x74, 0x81, 0x56, 0x9f, 0x2a, 0x92, 0x66, 0x83, 0x66, 0x0f, 0x7c, 0x39, 0x98, 0xb4, 0x2d, 0x8e, + 0x98, 0xe7, 0xe1, 0x80, 0x65, 0x32, 0xf2, 0x86, 0x11, 0x0c, 0xda, 0xd6, 0xc0, 0x9f, 0xc5, 0xac, + 0x98, 0x29, 0x14, 0xfc, 0x2c, 0xdb, 0x19, 0xa9, 0x63, 0x16, 0x04, 0x6e, 0xdb, 0x0d, 0x6c, 0x43, + 0xe8, 0xd1, 0x05, 0x41, 0x37, 0x7c, 0xb6, 0x3b, 0x39, 0xcb, 0x4f, 0xa0, 0xef, 0x42, 0x36, 0x22, + 0xbe, 0xda, 0xec, 0x1e, 0x72, 0x82, 0x66, 0x08, 0xd5, 0xcc, 0xc4, 0x19, 0x5d, 0x97, 0x0c, 0xc7, + 0x01, 0x59, 0x27, 0x3c, 0x81, 0x1b, 0xd1, 0xc4, 0x65, 0xd8, 0xbf, 0x2e, 0x14, 0xca, 0x76, 0xdb, + 0xd7, 0x5f, 0xf5, 0x85, 0xb0, 0xd9, 0xdf, 0x50, 0x65, 0xfb, 0xb2, 0x67, 0xed, 0xe6, 0xfb, 0xb0, + 0xf9, 0x65, 0x06, 0x16, 0xe4, 0xb5, 0xb2, 0x2c, 0x2e, 0x19, 0xc2, 0xaa, 0x24, 0xf2, 0xeb, 0xf8, + 0xb5, 0xf0, 0xbc, 0x71, 0x4c, 0xde, 0x87, 0x0e, 0xc3, 0x84, 0x84, 0xe3, 0xc2, 0xd9, 0x49, 0x53, + 0xf1, 0xe7, 0xef, 0x12, 0x83, 0x79, 0xd9, 0x58, 0x29, 0x2f, 0x27, 0x73, 0x6a, 0x11, 0x27, 0x8f, + 0xf8, 0x67, 0x54, 0x17, 0x57, 0x53, 0xc6, 0x46, 0x49, 0xd2, 0x93, 0x69, 0xc5, 0x78, 0xbb, 0x35, + 0x0a, 0x08, 0x32, 0xad, 0x18, 0x19, 0xd4, 0xc5, 0x8f, 0xe3, 0x69, 0x5c, 0xc5, 0x76, 0x41, 0xcd, + 0xad, 0x9a, 0x07, 0x24, 0xed, 0x83, 0x03, 0x82, 0xf5, 0xfd, 0xc0, 0x3c, 0xb6, 0x1f, 0x79, 0x09, + 0xf8, 0x60, 0x39, 0x07, 0x73, 0xd0, 0x88, 0x73, 0x08, 0xbe, 0x2b, 0x3d, 0x2b, 0xc9, 0x9a, 0x75, + 0x79, 0x32, 0xe4, 0xa2, 0x64, 0x7d, 0xb9, 0x32, 0x9d, 0x95, 0xe5, 0xfb, 0x72, 0x51, 0x1a, 0xb9, + 0x05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7, 0x1e, + 0xbd, 0xbb, 0x33, 0x3e, 0xde, 0xcf, 0xfa, 0xdf, 0x09, 0x74, 0x56, 0xf7, 0xc8, 0x34, 0x3c, 0x8b, + 0x7c, 0x9b, 0x78, 0xee, 0x62, 0x43, 0x32, 0x48, 0x6a, 0x82, 0x91, 0x1a, 0xa3, 0x3f, 0x08, 0x22, + 0xb5, 0xe2, 0xc8, 0x65, 0x65, 0xe5, 0x89, 0x9a, 0x7a, 0x61, 0x8d, 0x06, 0x36, 0xe9, 0xcf, 0x09, + 0xb4, 0x9b, 0x4d, 0x37, 0x1d, 0x0e, 0xb5, 0xeb, 0xea, 0xef, 0xb9, 0x73, 0x75, 0xec, 0x44, 0x5c, + 0x67, 0x18, 0xae, 0x38, 0x3d, 0x19, 0x84, 0xcb, 0xec, 0xf1, 0xe9, 0x4b, 0x02, 0x1d, 0x56, 0x47, + 0x4e, 0x47, 0xc2, 0x75, 0xbb, 0x87, 0x00, 0xdc, 0xf9, 0xba, 0xf6, 0x22, 0x92, 0x41, 0x86, 0x64, + 0x80, 0xc6, 0x03, 0x91, 0x58, 0x00, 0x7e, 0x43, 0x6a, 0x6e, 0xcd, 0x95, 0x4e, 0x9e, 0x5e, 0x0b, + 0x35, 0x18, 0x3e, 0x36, 0xe0, 0x26, 0x9b, 0x13, 0x46, 0xf8, 0x31, 0xfa, 0x7b, 0x02, 0x5c, 0x70, + 0xbf, 0x4e, 0xa7, 0x1a, 0x57, 0xef, 0x1e, 0x14, 0x70, 0xd3, 0x4d, 0xcb, 0x3b, 0x08, 0x7f, 0x47, + 0xa0, 0x3f, 0xb0, 0x39, 0xa7, 0xd7, 0x1b, 0x35, 0x50, 0x35, 0x13, 0xe0, 0xa6, 0x9a, 0x15, 0x77, + 0xe0, 0x99, 0x91, 0x0d, 0xe8, 0xce, 0x23, 0x22, 0x1b, 0xde, 0xfa, 0x47, 0x44, 0x36, 0x62, 0x20, + 0x80, 0x7e, 0x0b, 0x6c, 0xcc, 0x23, 0xfc, 0x16, 0xd5, 0xf9, 0x47, 0xf8, 0x2d, 0x72, 0x1e, 0xe0, + 0x84, 0x35, 0xa0, 0xa9, 0x8f, 0x0c, 0x6b, 0xf8, 0xd4, 0x20, 0x32, 0xac, 0x11, 0xb3, 0x04, 0x3e, + 0x46, 0x37, 0xe1, 0xa8, 0xa7, 0xef, 0x8f, 0xb8, 0x80, 0x7b, 0xf6, 0x73, 0xe3, 0x8d, 0xed, 0x77, + 0x99, 0x7f, 0x49, 0xe0, 0x98, 0x7f, 0xff, 0x3f, 0x56, 0x7f, 0xc6, 0xda, 0x32, 0xdc, 0xd5, 0xc6, + 0x65, 0x2a, 0x58, 0x66, 0x1f, 0xbf, 0x79, 0x1f, 0x27, 0xdb, 0xef, 0xe3, 0xe4, 0xcb, 0xf7, 0x71, + 0xf2, 0xab, 0x0f, 0xf1, 0xd8, 0xf6, 0x87, 0x78, 0xec, 0xff, 0x1f, 0xe2, 0xb1, 0x9f, 0x4e, 0xbb, + 0xe6, 0x1c, 0xf2, 0x5a, 0xa1, 0xac, 0xcb, 0xaa, 0x22, 0x2b, 0xb9, 0x54, 0x81, 0x91, 0x92, 0x8d, + 0x8d, 0x51, 0x34, 0x38, 0x5a, 0x54, 0xc5, 0x72, 0x41, 0x4a, 0x3d, 0x73, 0xce, 0x47, 0x36, 0x04, + 0x59, 0xee, 0x60, 0xff, 0x90, 0x75, 0xf1, 0xdb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0a, 0xb1, 0x4c, + 0x74, 0x81, 0x26, 0x00, 0x00, } -func (m *QueryValidatorsRequest) 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 +// 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 { + // Validators queries all validators that match the given status. + Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) + // Validator queries validator info for given validator address. + Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) + // ValidatorDelegations queries delegate info for given validator. + ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) + // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) + // Delegation queries delegate info for given validator delegator pair. + Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) + // UnbondingDelegation queries unbonding info for given validator delegator + // pair. + UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) + // DelegatorDelegations queries all delegations of a given delegator address. + DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) + // DelegatorUnbondingDelegations queries all unbonding delegations of a given + // delegator address. + DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) + // Redelegations queries redelegations of given address. + Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) + // DelegatorValidators queries all validators info for given delegator + // address. + DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) + // DelegatorValidator queries validator info for given delegator validator + // pair. + DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) + // HistoricalInfo queries the historical info for given height. + HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) + // Pool queries the pool info. + Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) + // Parameters queries the staking parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Query for individual tokenize share record information by share by id + TokenizeShareRecordById(ctx context.Context, in *QueryTokenizeShareRecordByIdRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordByIdResponse, error) + // Query for individual tokenize share record information by share denom + TokenizeShareRecordByDenom(ctx context.Context, in *QueryTokenizeShareRecordByDenomRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordByDenomResponse, error) + // Query tokenize share records by address + TokenizeShareRecordsOwned(ctx context.Context, in *QueryTokenizeShareRecordsOwnedRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordsOwnedResponse, error) + // Query for all tokenize share records + AllTokenizeShareRecords(ctx context.Context, in *QueryAllTokenizeShareRecordsRequest, opts ...grpc.CallOption) (*QueryAllTokenizeShareRecordsResponse, error) + // Query for last tokenize share record id + LastTokenizeShareRecordId(ctx context.Context, in *QueryLastTokenizeShareRecordIdRequest, opts ...grpc.CallOption) (*QueryLastTokenizeShareRecordIdResponse, error) + // Query for total tokenized staked assets + TotalTokenizeSharedAssets(ctx context.Context, in *QueryTotalTokenizeSharedAssetsRequest, opts ...grpc.CallOption) (*QueryTotalTokenizeSharedAssetsResponse, error) + // Query for total liquid staked (including tokenized shares or owned by an liquid staking provider) + TotalLiquidStaked(ctx context.Context, in *QueryTotalLiquidStaked, opts ...grpc.CallOption) (*QueryTotalLiquidStakedResponse, error) + // Query tokenize share locks + TokenizeShareLockInfo(ctx context.Context, in *QueryTokenizeShareLockInfo, opts ...grpc.CallOption) (*QueryTokenizeShareLockInfoResponse, error) } -func (m *QueryValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type queryClient struct { + cc grpc1.ClientConn } -func (m *QueryValidatorsRequest) 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.Status) > 0 { - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} } -func (m *QueryValidatorsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) { + out := new(QueryValidatorsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validators", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryValidatorsResponse) 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.Validators) > 0 { - for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func (c *queryClient) Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) { + out := new(QueryValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validator", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) { + out := new(QueryValidatorDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorDelegations", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryValidatorRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) { + out := new(QueryValidatorUnbondingDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa +func (c *queryClient) Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) { + out := new(QueryDelegationResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Delegation", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) { + out := new(QueryUnbondingDelegationResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/UnbondingDelegation", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) +func (c *queryClient) DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) { + out := new(QueryDelegatorDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorDelegations", in, out, opts...) + if err != nil { + return nil, err } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorDelegationsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) { + out := new(QueryDelegatorUnbondingDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryValidatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryValidatorDelegationsRequest) 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.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa +func (c *queryClient) Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) { + out := new(QueryRedelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Redelegations", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorDelegationsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) { + out := new(QueryDelegatorValidatorsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidators", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryValidatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryValidatorDelegationsResponse) 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.DelegationResponses) > 0 { - for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DelegationResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func (c *queryClient) DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) { + out := new(QueryDelegatorValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidator", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorUnbondingDelegationsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) { + out := new(QueryHistoricalInfoResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/HistoricalInfo", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryValidatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) { + out := new(QueryPoolResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Pool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryValidatorUnbondingDelegationsRequest) 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.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorUnbondingDelegationsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) TokenizeShareRecordById(ctx context.Context, in *QueryTokenizeShareRecordByIdRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordByIdResponse, error) { + out := new(QueryTokenizeShareRecordByIdResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/TokenizeShareRecordById", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryValidatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) TokenizeShareRecordByDenom(ctx context.Context, in *QueryTokenizeShareRecordByDenomRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordByDenomResponse, error) { + out := new(QueryTokenizeShareRecordByDenomResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/TokenizeShareRecordByDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryValidatorUnbondingDelegationsResponse) 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.UnbondingResponses) > 0 { - for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func (c *queryClient) TokenizeShareRecordsOwned(ctx context.Context, in *QueryTokenizeShareRecordsOwnedRequest, opts ...grpc.CallOption) (*QueryTokenizeShareRecordsOwnedResponse, error) { + out := new(QueryTokenizeShareRecordsOwnedResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/TokenizeShareRecordsOwned", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryDelegationRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) AllTokenizeShareRecords(ctx context.Context, in *QueryAllTokenizeShareRecordsRequest, opts ...grpc.CallOption) (*QueryAllTokenizeShareRecordsResponse, error) { + out := new(QueryAllTokenizeShareRecordsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/AllTokenizeShareRecords", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryDelegationRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) LastTokenizeShareRecordId(ctx context.Context, in *QueryLastTokenizeShareRecordIdRequest, opts ...grpc.CallOption) (*QueryLastTokenizeShareRecordIdResponse, error) { + out := new(QueryLastTokenizeShareRecordIdResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/LastTokenizeShareRecordId", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa +func (c *queryClient) TotalTokenizeSharedAssets(ctx context.Context, in *QueryTotalTokenizeSharedAssetsRequest, opts ...grpc.CallOption) (*QueryTotalTokenizeSharedAssetsResponse, error) { + out := new(QueryTotalTokenizeSharedAssetsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/TotalTokenizeSharedAssets", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryDelegationResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) TotalLiquidStaked(ctx context.Context, in *QueryTotalLiquidStaked, opts ...grpc.CallOption) (*QueryTotalLiquidStakedResponse, error) { + out := new(QueryTotalLiquidStakedResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/TotalLiquidStaked", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryDelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.DelegationResponse != nil { - { - size, err := m.DelegationResponse.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 *QueryUnbondingDelegationRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) TokenizeShareLockInfo(ctx context.Context, in *QueryTokenizeShareLockInfo, opts ...grpc.CallOption) (*QueryTokenizeShareLockInfoResponse, error) { + out := new(QueryTokenizeShareLockInfoResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/TokenizeShareLockInfo", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryUnbondingDelegationRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryServer is the server API for Query service. +type QueryServer interface { + // Validators queries all validators that match the given status. + Validators(context.Context, *QueryValidatorsRequest) (*QueryValidatorsResponse, error) + // Validator queries validator info for given validator address. + Validator(context.Context, *QueryValidatorRequest) (*QueryValidatorResponse, error) + // ValidatorDelegations queries delegate info for given validator. + ValidatorDelegations(context.Context, *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) + // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + ValidatorUnbondingDelegations(context.Context, *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) + // Delegation queries delegate info for given validator delegator pair. + Delegation(context.Context, *QueryDelegationRequest) (*QueryDelegationResponse, error) + // UnbondingDelegation queries unbonding info for given validator delegator + // pair. + UnbondingDelegation(context.Context, *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) + // DelegatorDelegations queries all delegations of a given delegator address. + DelegatorDelegations(context.Context, *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) + // DelegatorUnbondingDelegations queries all unbonding delegations of a given + // delegator address. + DelegatorUnbondingDelegations(context.Context, *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) + // Redelegations queries redelegations of given address. + Redelegations(context.Context, *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) + // DelegatorValidators queries all validators info for given delegator + // address. + DelegatorValidators(context.Context, *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) + // DelegatorValidator queries validator info for given delegator validator + // pair. + DelegatorValidator(context.Context, *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) + // HistoricalInfo queries the historical info for given height. + HistoricalInfo(context.Context, *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) + // Pool queries the pool info. + Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error) + // Parameters queries the staking parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Query for individual tokenize share record information by share by id + TokenizeShareRecordById(context.Context, *QueryTokenizeShareRecordByIdRequest) (*QueryTokenizeShareRecordByIdResponse, error) + // Query for individual tokenize share record information by share denom + TokenizeShareRecordByDenom(context.Context, *QueryTokenizeShareRecordByDenomRequest) (*QueryTokenizeShareRecordByDenomResponse, error) + // Query tokenize share records by address + TokenizeShareRecordsOwned(context.Context, *QueryTokenizeShareRecordsOwnedRequest) (*QueryTokenizeShareRecordsOwnedResponse, error) + // Query for all tokenize share records + AllTokenizeShareRecords(context.Context, *QueryAllTokenizeShareRecordsRequest) (*QueryAllTokenizeShareRecordsResponse, error) + // Query for last tokenize share record id + LastTokenizeShareRecordId(context.Context, *QueryLastTokenizeShareRecordIdRequest) (*QueryLastTokenizeShareRecordIdResponse, error) + // Query for total tokenized staked assets + TotalTokenizeSharedAssets(context.Context, *QueryTotalTokenizeSharedAssetsRequest) (*QueryTotalTokenizeSharedAssetsResponse, error) + // Query for total liquid staked (including tokenized shares or owned by an liquid staking provider) + TotalLiquidStaked(context.Context, *QueryTotalLiquidStaked) (*QueryTotalLiquidStakedResponse, error) + // Query tokenize share locks + TokenizeShareLockInfo(context.Context, *QueryTokenizeShareLockInfo) (*QueryTokenizeShareLockInfoResponse, error) } -func (m *QueryUnbondingDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryUnbondingDelegationResponse) 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 (*UnimplementedQueryServer) Validators(ctx context.Context, req *QueryValidatorsRequest) (*QueryValidatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Validators not implemented") } - -func (m *QueryUnbondingDelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) Validator(ctx context.Context, req *QueryValidatorRequest) (*QueryValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Validator not implemented") } - -func (m *QueryUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Unbond.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 (*UnimplementedQueryServer) ValidatorDelegations(ctx context.Context, req *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidatorDelegations not implemented") } - -func (m *QueryDelegatorDelegationsRequest) 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 (*UnimplementedQueryServer) ValidatorUnbondingDelegations(ctx context.Context, req *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidatorUnbondingDelegations not implemented") +} +func (*UnimplementedQueryServer) Delegation(ctx context.Context, req *QueryDelegationRequest) (*QueryDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delegation not implemented") +} +func (*UnimplementedQueryServer) UnbondingDelegation(ctx context.Context, req *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnbondingDelegation not implemented") +} +func (*UnimplementedQueryServer) DelegatorDelegations(ctx context.Context, req *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorDelegations not implemented") +} +func (*UnimplementedQueryServer) DelegatorUnbondingDelegations(ctx context.Context, req *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorUnbondingDelegations not implemented") +} +func (*UnimplementedQueryServer) Redelegations(ctx context.Context, req *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Redelegations not implemented") +} +func (*UnimplementedQueryServer) DelegatorValidators(ctx context.Context, req *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidators not implemented") +} +func (*UnimplementedQueryServer) DelegatorValidator(ctx context.Context, req *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidator not implemented") +} +func (*UnimplementedQueryServer) HistoricalInfo(ctx context.Context, req *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HistoricalInfo not implemented") +} +func (*UnimplementedQueryServer) Pool(ctx context.Context, req *QueryPoolRequest) (*QueryPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Pool not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) TokenizeShareRecordById(ctx context.Context, req *QueryTokenizeShareRecordByIdRequest) (*QueryTokenizeShareRecordByIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenizeShareRecordById not implemented") +} +func (*UnimplementedQueryServer) TokenizeShareRecordByDenom(ctx context.Context, req *QueryTokenizeShareRecordByDenomRequest) (*QueryTokenizeShareRecordByDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenizeShareRecordByDenom not implemented") +} +func (*UnimplementedQueryServer) TokenizeShareRecordsOwned(ctx context.Context, req *QueryTokenizeShareRecordsOwnedRequest) (*QueryTokenizeShareRecordsOwnedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenizeShareRecordsOwned not implemented") +} +func (*UnimplementedQueryServer) AllTokenizeShareRecords(ctx context.Context, req *QueryAllTokenizeShareRecordsRequest) (*QueryAllTokenizeShareRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllTokenizeShareRecords not implemented") +} +func (*UnimplementedQueryServer) LastTokenizeShareRecordId(ctx context.Context, req *QueryLastTokenizeShareRecordIdRequest) (*QueryLastTokenizeShareRecordIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LastTokenizeShareRecordId not implemented") +} +func (*UnimplementedQueryServer) TotalTokenizeSharedAssets(ctx context.Context, req *QueryTotalTokenizeSharedAssetsRequest) (*QueryTotalTokenizeSharedAssetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalTokenizeSharedAssets not implemented") +} +func (*UnimplementedQueryServer) TotalLiquidStaked(ctx context.Context, req *QueryTotalLiquidStaked) (*QueryTotalLiquidStakedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalLiquidStaked not implemented") +} +func (*UnimplementedQueryServer) TokenizeShareLockInfo(ctx context.Context, req *QueryTokenizeShareLockInfo) (*QueryTokenizeShareLockInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenizeShareLockInfo not implemented") } -func (m *QueryDelegatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *QueryDelegatorDelegationsRequest) 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 +func _Query_Validators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorsRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).Validators(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Validators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Validators(ctx, req.(*QueryValidatorsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorDelegationsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Validator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Validator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Validator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Validator(ctx, req.(*QueryValidatorRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_ValidatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ValidatorDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ValidatorDelegations(ctx, req.(*QueryValidatorDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorDelegationsResponse) 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 +func _Query_ValidatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorUnbondingDelegationsRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.DelegationResponses) > 0 { - for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DelegationResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if interceptor == nil { + return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, req.(*QueryValidatorUnbondingDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorUnbondingDelegationsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Delegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegationRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryDelegatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorUnbondingDelegationsRequest) 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 interceptor == nil { + return srv.(QueryServer).Delegation(ctx, in) } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Delegation", } - return len(dAtA) - i, nil + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Delegation(ctx, req.(*QueryDelegationRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorUnbondingDelegationsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_UnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUnbondingDelegationRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryDelegatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorUnbondingDelegationsResponse) 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 interceptor == nil { + return srv.(QueryServer).UnbondingDelegation(ctx, in) } - if len(m.UnbondingResponses) > 0 { - for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/UnbondingDelegation", } - return len(dAtA) - i, nil + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UnbondingDelegation(ctx, req.(*QueryUnbondingDelegationRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryRedelegationsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_DelegatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorDelegationsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryRedelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if interceptor == nil { + return srv.(QueryServer).DelegatorDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorDelegations(ctx, req.(*QueryDelegatorDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryRedelegationsRequest) 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] = 0x22 +func _Query_DelegatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorUnbondingDelegationsRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.DstValidatorAddr) > 0 { - i -= len(m.DstValidatorAddr) - copy(dAtA[i:], m.DstValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DstValidatorAddr))) - i-- - dAtA[i] = 0x1a + if interceptor == nil { + return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, in) } - if len(m.SrcValidatorAddr) > 0 { - i -= len(m.SrcValidatorAddr) - copy(dAtA[i:], m.SrcValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.SrcValidatorAddr))) - i-- - dAtA[i] = 0x12 + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, req.(*QueryDelegatorUnbondingDelegationsRequest)) } - return len(dAtA) - i, nil + return interceptor(ctx, in, info, handler) } -func (m *QueryRedelegationsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Redelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRedelegationsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Redelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Redelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Redelegations(ctx, req.(*QueryRedelegationsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryRedelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_DelegatorValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorValidatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorValidators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorValidators(ctx, req.(*QueryDelegatorValidatorsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryRedelegationsResponse) 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 +func _Query_DelegatorValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorValidatorRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.RedelegationResponses) > 0 { - for iNdEx := len(m.RedelegationResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RedelegationResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if interceptor == nil { + return srv.(QueryServer).DelegatorValidator(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorValidator(ctx, req.(*QueryDelegatorValidatorRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_HistoricalInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHistoricalInfoRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryDelegatorValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorValidatorsRequest) 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 interceptor == nil { + return srv.(QueryServer).HistoricalInfo(ctx, in) } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/HistoricalInfo", } - return len(dAtA) - i, nil + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HistoricalInfo(ctx, req.(*QueryHistoricalInfoRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Pool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPoolRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Pool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Pool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Pool(ctx, req.(*QueryPoolRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.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 (m *QueryDelegatorValidatorsResponse) 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 +func _Query_TokenizeShareRecordById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenizeShareRecordByIdRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.Validators) > 0 { - for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if interceptor == nil { + return srv.(QueryServer).TokenizeShareRecordById(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/TokenizeShareRecordById", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenizeShareRecordById(ctx, req.(*QueryTokenizeShareRecordByIdRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_TokenizeShareRecordByDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenizeShareRecordByDenomRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).TokenizeShareRecordByDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/TokenizeShareRecordByDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenizeShareRecordByDenom(ctx, req.(*QueryTokenizeShareRecordByDenomRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_TokenizeShareRecordsOwned_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenizeShareRecordsOwnedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TokenizeShareRecordsOwned(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/TokenizeShareRecordsOwned", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenizeShareRecordsOwned(ctx, req.(*QueryTokenizeShareRecordsOwnedRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0x12 +func _Query_AllTokenizeShareRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllTokenizeShareRecordsRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).AllTokenizeShareRecords(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/AllTokenizeShareRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllTokenizeShareRecords(ctx, req.(*QueryAllTokenizeShareRecordsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_LastTokenizeShareRecordId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLastTokenizeShareRecordIdRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).LastTokenizeShareRecordId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/LastTokenizeShareRecordId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LastTokenizeShareRecordId(ctx, req.(*QueryLastTokenizeShareRecordIdRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_TotalTokenizeSharedAssets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalTokenizeSharedAssetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalTokenizeSharedAssets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/TotalTokenizeSharedAssets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalTokenizeSharedAssets(ctx, req.(*QueryTotalTokenizeSharedAssetsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDelegatorValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) +func _Query_TotalLiquidStaked_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalLiquidStaked) + if err := dec(in); err != nil { + return nil, err } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).TotalLiquidStaked(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/TotalLiquidStaked", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalLiquidStaked(ctx, req.(*QueryTotalLiquidStaked)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryHistoricalInfoRequest) Marshal() (dAtA []byte, err error) { +func _Query_TokenizeShareLockInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenizeShareLockInfo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TokenizeShareLockInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/TokenizeShareLockInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenizeShareLockInfo(ctx, req.(*QueryTokenizeShareLockInfo)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.staking.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Validators", + Handler: _Query_Validators_Handler, + }, + { + MethodName: "Validator", + Handler: _Query_Validator_Handler, + }, + { + MethodName: "ValidatorDelegations", + Handler: _Query_ValidatorDelegations_Handler, + }, + { + MethodName: "ValidatorUnbondingDelegations", + Handler: _Query_ValidatorUnbondingDelegations_Handler, + }, + { + MethodName: "Delegation", + Handler: _Query_Delegation_Handler, + }, + { + MethodName: "UnbondingDelegation", + Handler: _Query_UnbondingDelegation_Handler, + }, + { + MethodName: "DelegatorDelegations", + Handler: _Query_DelegatorDelegations_Handler, + }, + { + MethodName: "DelegatorUnbondingDelegations", + Handler: _Query_DelegatorUnbondingDelegations_Handler, + }, + { + MethodName: "Redelegations", + Handler: _Query_Redelegations_Handler, + }, + { + MethodName: "DelegatorValidators", + Handler: _Query_DelegatorValidators_Handler, + }, + { + MethodName: "DelegatorValidator", + Handler: _Query_DelegatorValidator_Handler, + }, + { + MethodName: "HistoricalInfo", + Handler: _Query_HistoricalInfo_Handler, + }, + { + MethodName: "Pool", + Handler: _Query_Pool_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "TokenizeShareRecordById", + Handler: _Query_TokenizeShareRecordById_Handler, + }, + { + MethodName: "TokenizeShareRecordByDenom", + Handler: _Query_TokenizeShareRecordByDenom_Handler, + }, + { + MethodName: "TokenizeShareRecordsOwned", + Handler: _Query_TokenizeShareRecordsOwned_Handler, + }, + { + MethodName: "AllTokenizeShareRecords", + Handler: _Query_AllTokenizeShareRecords_Handler, + }, + { + MethodName: "LastTokenizeShareRecordId", + Handler: _Query_LastTokenizeShareRecordId_Handler, + }, + { + MethodName: "TotalTokenizeSharedAssets", + Handler: _Query_TotalTokenizeSharedAssets_Handler, + }, + { + MethodName: "TotalLiquidStaked", + Handler: _Query_TotalLiquidStaked_Handler, + }, + { + MethodName: "TokenizeShareLockInfo", + Handler: _Query_TokenizeShareLockInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "staking/v1beta1/query.proto", +} + +func (m *QueryValidatorsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3030,25 +3206,39 @@ func (m *QueryHistoricalInfoRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryHistoricalInfoRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryHistoricalInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + 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] = 0x8 + dAtA[i] = 0x12 + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryHistoricalInfoResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3058,19 +3248,19 @@ func (m *QueryHistoricalInfoResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryHistoricalInfoResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryHistoricalInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Hist != nil { + if m.Pagination != nil { { - size, err := m.Hist.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3078,12 +3268,26 @@ func (m *QueryHistoricalInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[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 *QueryPoolRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3093,20 +3297,27 @@ func (m *QueryPoolRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPoolRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryPoolResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3116,18 +3327,18 @@ func (m *QueryPoolResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPoolResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Pool.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3139,7 +3350,7 @@ func (m *QueryPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorDelegationsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3149,20 +3360,39 @@ func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorDelegationsRequest) 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.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorDelegationsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3172,482 +3402,3301 @@ func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorDelegationsResponse) 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 + 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.DelegationResponses) > 0 { + for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DelegationResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - 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++ +func (m *QueryValidatorUnbondingDelegationsRequest) 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 *QueryValidatorsRequest) Size() (n int) { - if m == nil { - return 0 - } + +func (m *QueryValidatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorUnbondingDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Status) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + { + 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 } - return n + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryValidatorsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryValidatorUnbondingDelegationsResponse) 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 *QueryValidatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorUnbondingDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Validators) > 0 { - for _, e := range m.Validators { - l = e.Size() - 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] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.UnbondingResponses) > 0 { + for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UnbondingResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryValidatorRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryDelegationRequest) 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 n + return dAtA[:n], nil } -func (m *QueryValidatorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Validator.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryValidatorDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryValidatorDelegationsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryDelegationResponse) 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 *QueryDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.DelegationResponses) > 0 { - for _, e := range m.DelegationResponses { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.DelegationResponse != nil { + { + size, err := m.DelegationResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryValidatorUnbondingDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryUnbondingDelegationRequest) 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 n + return dAtA[:n], nil } -func (m *QueryValidatorUnbondingDelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryUnbondingDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUnbondingDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.UnbondingResponses) > 0 { - for _, e := range m.UnbondingResponses { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryDelegationRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryUnbondingDelegationResponse) 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 n + return dAtA[:n], nil } -func (m *QueryDelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DelegationResponse != nil { - l = m.DelegationResponse.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryUnbondingDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryUnbondingDelegationRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.Unbond.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryUnbondingDelegationResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryDelegatorDelegationsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - l = m.Unbond.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return dAtA[:n], nil } -func (m *QueryDelegatorDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - 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 *QueryDelegatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDelegatorDelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryDelegatorDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.DelegationResponses) > 0 { - for _, e := range m.DelegationResponses { - l = e.Size() - 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] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryDelegatorUnbondingDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryDelegatorDelegationsResponse) 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 n + return dAtA[:n], nil } -func (m *QueryDelegatorUnbondingDelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryDelegatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.UnbondingResponses) > 0 { - for _, e := range m.UnbondingResponses { - l = e.Size() - 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] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.DelegationResponses) > 0 { + for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DelegationResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryRedelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SrcValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.DstValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryDelegatorUnbondingDelegationsRequest) 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 n + return dAtA[:n], nil } -func (m *QueryRedelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryDelegatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorUnbondingDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.RedelegationResponses) > 0 { - for _, e := range m.RedelegationResponses { - l = e.Size() - 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] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryDelegatorValidatorsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryDelegatorUnbondingDelegationsResponse) 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 *QueryDelegatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorUnbondingDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + { + 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 } - return n + if len(m.UnbondingResponses) > 0 { + for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UnbondingResponses[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 *QueryDelegatorValidatorsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryRedelegationsRequest) 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 *QueryRedelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRedelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Validators) > 0 { - for _, e := range m.Validators { - l = e.Size() - 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] = 0x22 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.DstValidatorAddr) > 0 { + i -= len(m.DstValidatorAddr) + copy(dAtA[i:], m.DstValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DstValidatorAddr))) + i-- + dAtA[i] = 0x1a } - return n + if len(m.SrcValidatorAddr) > 0 { + i -= len(m.SrcValidatorAddr) + copy(dAtA[i:], m.SrcValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SrcValidatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryDelegatorValidatorRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryRedelegationsResponse) 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 *QueryRedelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRedelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.DelegatorAddr) - 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] = 0x12 } - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.RedelegationResponses) > 0 { + for iNdEx := len(m.RedelegationResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RedelegationResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryDelegatorValidatorResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryDelegatorValidatorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - l = m.Validator.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return dAtA[:n], nil } -func (m *QueryHistoricalInfoRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryDelegatorValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Height != 0 { - n += 1 + sovQuery(uint64(m.Height)) + 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 } - return n + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryHistoricalInfoResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryDelegatorValidatorsResponse) 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 *QueryDelegatorValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Hist != nil { - l = m.Hist.Size() - 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] = 0x12 } - return n -} - -func (m *QueryPoolRequest) Size() (n int) { - if m == nil { - return 0 + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[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 *QueryDelegatorValidatorRequest) 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 *QueryDelegatorValidatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorValidatorResponse) 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 *QueryDelegatorValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Validator.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 *QueryHistoricalInfoRequest) 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 *QueryHistoricalInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHistoricalInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryHistoricalInfoResponse) 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 *QueryHistoricalInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHistoricalInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Hist != nil { + { + size, err := m.Hist.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 *QueryPoolRequest) 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 *QueryPoolRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryPoolResponse) 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 *QueryPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Pool.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 *QueryTokenizeShareRecordByIdRequest) 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 *QueryTokenizeShareRecordByIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordByIdResponse) 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 *QueryTokenizeShareRecordByIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Record.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 *QueryTokenizeShareRecordByDenomRequest) 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 *QueryTokenizeShareRecordByDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenizeShareRecordByDenomResponse) 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 *QueryTokenizeShareRecordByDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Record.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 *QueryTokenizeShareRecordsOwnedRequest) 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 *QueryTokenizeShareRecordsOwnedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordsOwnedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *QueryTokenizeShareRecordsOwnedResponse) 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 *QueryTokenizeShareRecordsOwnedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareRecordsOwnedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[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 *QueryAllTokenizeShareRecordsRequest) 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 *QueryAllTokenizeShareRecordsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllTokenizeShareRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllTokenizeShareRecordsResponse) 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 *QueryAllTokenizeShareRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllTokenizeShareRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[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 *QueryLastTokenizeShareRecordIdRequest) 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 *QueryLastTokenizeShareRecordIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLastTokenizeShareRecordIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryLastTokenizeShareRecordIdResponse) 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 *QueryLastTokenizeShareRecordIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLastTokenizeShareRecordIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) 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 *QueryTotalTokenizeSharedAssetsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) 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 *QueryTotalTokenizeSharedAssetsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Value.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 *QueryTotalLiquidStaked) 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 *QueryTotalLiquidStaked) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalLiquidStaked) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalLiquidStakedResponse) 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 *QueryTotalLiquidStakedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalLiquidStakedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.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 *QueryTokenizeShareLockInfo) 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 *QueryTokenizeShareLockInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareLockInfo) 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 *QueryTokenizeShareLockInfoResponse) 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 *QueryTokenizeShareLockInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenizeShareLockInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ExpirationTime) > 0 { + i -= len(m.ExpirationTime) + copy(dAtA[i:], m.ExpirationTime) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ExpirationTime))) + i-- + dAtA[i] = 0x12 + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) + 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 *QueryValidatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Status) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Validators) > 0 { + for _, e := range m.Validators { + 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 *QueryValidatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Validator.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryValidatorDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + 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 *QueryValidatorDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DelegationResponses) > 0 { + for _, e := range m.DelegationResponses { + 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 *QueryValidatorUnbondingDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + 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 *QueryValidatorUnbondingDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.UnbondingResponses) > 0 { + for _, e := range m.UnbondingResponses { + 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 *QueryDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DelegationResponse != nil { + l = m.DelegationResponse.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUnbondingDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUnbondingDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Unbond.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDelegatorDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + 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 *QueryDelegatorDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DelegationResponses) > 0 { + for _, e := range m.DelegationResponses { + 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 *QueryDelegatorUnbondingDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + 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 *QueryDelegatorUnbondingDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.UnbondingResponses) > 0 { + for _, e := range m.UnbondingResponses { + 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 *QueryRedelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SrcValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.DstValidatorAddr) + 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 *QueryRedelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RedelegationResponses) > 0 { + for _, e := range m.RedelegationResponses { + 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 *QueryDelegatorValidatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + 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 *QueryDelegatorValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Validators) > 0 { + for _, e := range m.Validators { + 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 *QueryDelegatorValidatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Validator.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryHistoricalInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryHistoricalInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Hist != nil { + l = m.Hist.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPoolRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Pool.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 *QueryTokenizeShareRecordByIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovQuery(uint64(m.Id)) + } + return n +} + +func (m *QueryTokenizeShareRecordByIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Record.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTokenizeShareRecordByDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokenizeShareRecordByDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Record.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTokenizeShareRecordsOwnedRequest) 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)) + } + return n +} + +func (m *QueryTokenizeShareRecordsOwnedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAllTokenizeShareRecordsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllTokenizeShareRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryLastTokenizeShareRecordIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryLastTokenizeShareRecordIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovQuery(uint64(m.Id)) + } + return n +} + +func (m *QueryTotalTokenizeSharedAssetsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalTokenizeSharedAssetsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Value.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTotalLiquidStaked) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalLiquidStakedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Tokens.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTokenizeShareLockInfo) 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 *QueryTokenizeShareLockInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Status) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ExpirationTime) + 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 sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryValidatorsRequest) 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: QueryValidatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", 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.Status = 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 *QueryValidatorsResponse) 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: QueryValidatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", 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.Validators = append(m.Validators, Validator{}) + if err := m.Validators[len(m.Validators)-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 *QueryValidatorRequest) 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: QueryValidatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = 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 *QueryValidatorResponse) 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: QueryValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", 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.Validator.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 *QueryValidatorDelegationsRequest) 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: QueryValidatorDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = 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 *QueryValidatorDelegationsResponse) 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: QueryValidatorDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) + if err := m.DelegationResponses[len(m.DelegationResponses)-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 *QueryValidatorUnbondingDelegationsRequest) 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: QueryValidatorUnbondingDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = 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 *QueryValidatorUnbondingDelegationsResponse) 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: QueryValidatorUnbondingDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) + if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 *QueryDelegationRequest) 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: QueryDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = 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 *QueryDelegationResponse) 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: QueryDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponse", 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.DelegationResponse == nil { + m.DelegationResponse = &DelegationResponse{} + } + if err := m.DelegationResponse.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 *QueryUnbondingDelegationRequest) 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: QueryUnbondingDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUnbondingDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = 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 + } } - var l int - _ = l - return n -} -func (m *QueryPoolResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = m.Pool.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return nil } - -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryUnbondingDelegationResponse) 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: QueryUnbondingDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUnbondingDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Unbond", 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.Unbond.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 + } } - var l int - _ = l - return n -} -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *QueryValidatorsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorDelegationsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3670,15 +6719,15 @@ func (m *QueryValidatorsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorDelegationsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3706,7 +6755,7 @@ func (m *QueryValidatorsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Status = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -3765,7 +6814,7 @@ func (m *QueryValidatorsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorDelegationsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3788,15 +6837,15 @@ func (m *QueryValidatorsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorDelegationsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3823,8 +6872,8 @@ func (m *QueryValidatorsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Validators = append(m.Validators, Validator{}) - if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) + if err := m.DelegationResponses[len(m.DelegationResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3885,7 +6934,7 @@ func (m *QueryValidatorsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3908,15 +6957,15 @@ func (m *QueryValidatorRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3944,7 +6993,43 @@ func (m *QueryValidatorRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddr = 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 @@ -3967,7 +7052,7 @@ func (m *QueryValidatorRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3990,15 +7075,49 @@ func (m *QueryValidatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) + if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 { @@ -4025,7 +7144,10 @@ func (m *QueryValidatorResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Validator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4050,7 +7172,7 @@ func (m *QueryValidatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorDelegationsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRedelegationsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4073,15 +7195,15 @@ func (m *QueryValidatorDelegationsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorDelegationsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRedelegationsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRedelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4109,9 +7231,73 @@ func (m *QueryValidatorDelegationsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SrcValidatorAddr", 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.SrcValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DstValidatorAddr", 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.DstValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -4168,7 +7354,7 @@ func (m *QueryValidatorDelegationsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorDelegationsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRedelegationsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4191,15 +7377,15 @@ func (m *QueryValidatorDelegationsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorDelegationsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRedelegationsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRedelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RedelegationResponses", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4226,8 +7412,8 @@ func (m *QueryValidatorDelegationsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) - if err := m.DelegationResponses[len(m.DelegationResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RedelegationResponses = append(m.RedelegationResponses, RedelegationResponse{}) + if err := m.RedelegationResponses[len(m.RedelegationResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4288,7 +7474,7 @@ func (m *QueryValidatorDelegationsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4311,15 +7497,15 @@ func (m *QueryValidatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4347,7 +7533,7 @@ func (m *QueryValidatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4406,7 +7592,7 @@ func (m *QueryValidatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error } return nil } -func (m *QueryValidatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4429,15 +7615,15 @@ func (m *QueryValidatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4464,8 +7650,8 @@ func (m *QueryValidatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - m.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) - if err := m.UnbondingResponses[len(m.UnbondingResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Validators = append(m.Validators, Validator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4526,7 +7712,7 @@ func (m *QueryValidatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryDelegationRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorValidatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4549,10 +7735,10 @@ func (m *QueryDelegationRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorValidatorRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4640,7 +7826,7 @@ func (m *QueryDelegationRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegationResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorValidatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4663,15 +7849,15 @@ func (m *QueryDelegationResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorValidatorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponse", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4698,10 +7884,7 @@ func (m *QueryDelegationResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.DelegationResponse == nil { - m.DelegationResponse = &DelegationResponse{} - } - if err := m.DelegationResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Validator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4726,7 +7909,7 @@ func (m *QueryDelegationResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryUnbondingDelegationRequest) Unmarshal(dAtA []byte) error { +func (m *QueryHistoricalInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4749,17 +7932,17 @@ func (m *QueryUnbondingDelegationRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryUnbondingDelegationRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryHistoricalInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUnbondingDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryHistoricalInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4769,29 +7952,66 @@ func (m *QueryUnbondingDelegationRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHistoricalInfoResponse) 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: QueryHistoricalInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHistoricalInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Hist", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4801,24 +8021,78 @@ func (m *QueryUnbondingDelegationRequest) 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 { + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Hist == nil { + m.Hist = &HistoricalInfo{} + } + if err := m.Hist.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 *QueryPoolRequest) 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 } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex + 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: QueryPoolRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4840,7 +8114,7 @@ func (m *QueryUnbondingDelegationRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryUnbondingDelegationResponse) Unmarshal(dAtA []byte) error { +func (m *QueryPoolResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4863,15 +8137,15 @@ func (m *QueryUnbondingDelegationResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryUnbondingDelegationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPoolResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUnbondingDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Unbond", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4898,7 +8172,7 @@ func (m *QueryUnbondingDelegationResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Unbond.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pool.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4923,7 +8197,7 @@ func (m *QueryUnbondingDelegationResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorDelegationsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4946,80 +8220,12 @@ func (m *QueryDelegatorDelegationsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorDelegationsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = 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:]) @@ -5041,7 +8247,7 @@ func (m *QueryDelegatorDelegationsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorDelegationsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5064,49 +8270,15 @@ func (m *QueryDelegatorDelegationsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorDelegationsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) - if err := m.DelegationResponses[len(m.DelegationResponses)-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) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5133,10 +8305,7 @@ func (m *QueryDelegatorDelegationsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5161,7 +8330,7 @@ func (m *QueryDelegatorDelegationsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareRecordByIdRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5184,49 +8353,17 @@ func (m *QueryDelegatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } - var msglen int + m.Id = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5236,28 +8373,11 @@ func (m *QueryDelegatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Id |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5279,7 +8399,7 @@ func (m *QueryDelegatorUnbondingDelegationsRequest) Unmarshal(dAtA []byte) error } return nil } -func (m *QueryDelegatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareRecordByIdResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5302,49 +8422,15 @@ func (m *QueryDelegatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) - if err := m.UnbondingResponses[len(m.UnbondingResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5371,10 +8457,7 @@ func (m *QueryDelegatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5399,7 +8482,7 @@ func (m *QueryDelegatorUnbondingDelegationsResponse) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryRedelegationsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareRecordByDenomRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5422,15 +8505,15 @@ func (m *QueryRedelegationsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRedelegationsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareRecordByDenomRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRedelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareRecordByDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5458,75 +8541,61 @@ func (m *QueryRedelegationsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcValidatorAddr", 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 + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.SrcValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DstValidatorAddr", 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 + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTokenizeShareRecordByDenomResponse) 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 postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.DstValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: + 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: QueryTokenizeShareRecordByDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenizeShareRecordByDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5553,10 +8622,7 @@ func (m *QueryRedelegationsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5581,7 +8647,7 @@ func (m *QueryRedelegationsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRedelegationsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareRecordsOwnedRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5604,51 +8670,17 @@ func (m *QueryRedelegationsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRedelegationsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRedelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RedelegationResponses", 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.RedelegationResponses = append(m.RedelegationResponses, RedelegationResponse{}) - if err := m.RedelegationResponses[len(m.RedelegationResponses)-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) + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5658,27 +8690,23 @@ func (m *QueryRedelegationsResponse) 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.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5701,7 +8729,7 @@ func (m *QueryRedelegationsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareRecordsOwnedResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5724,17 +8752,17 @@ func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareRecordsOwnedResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5744,60 +8772,76 @@ func (m *QueryDelegatorValidatorsRequest) 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.DelegatorAddr = 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 - } + m.Records = append(m.Records, TokenizeShareRecord{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if msglen < 0 { - return ErrInvalidLengthQuery + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllTokenizeShareRecordsRequest) 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 err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if iNdEx >= l { + return io.ErrUnexpectedEOF } - iNdEx = postIndex + 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: QueryAllTokenizeShareRecordsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllTokenizeShareRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5819,7 +8863,7 @@ func (m *QueryDelegatorValidatorsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllTokenizeShareRecordsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5842,49 +8886,15 @@ func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllTokenizeShareRecordsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllTokenizeShareRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", 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.Validators = append(m.Validators, Validator{}) - if err := m.Validators[len(m.Validators)-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) + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5911,10 +8921,8 @@ func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Records = append(m.Records, TokenizeShareRecord{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5939,7 +8947,7 @@ func (m *QueryDelegatorValidatorsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorValidatorRequest) Unmarshal(dAtA []byte) error { +func (m *QueryLastTokenizeShareRecordIdRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5962,76 +8970,12 @@ func (m *QueryDelegatorValidatorRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorValidatorRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6053,7 +8997,7 @@ func (m *QueryDelegatorValidatorRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegatorValidatorResponse) Unmarshal(dAtA []byte) error { +func (m *QueryLastTokenizeShareRecordIdResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6076,17 +9020,17 @@ func (m *QueryDelegatorValidatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorValidatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryLastTokenizeShareRecordIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } - var msglen int + m.Id = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6096,25 +9040,11 @@ func (m *QueryDelegatorValidatorResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Id |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Validator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6136,7 +9066,7 @@ func (m *QueryDelegatorValidatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHistoricalInfoRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTotalTokenizeSharedAssetsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6159,31 +9089,12 @@ func (m *QueryHistoricalInfoRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHistoricalInfoRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHistoricalInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6205,7 +9116,7 @@ func (m *QueryHistoricalInfoRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryHistoricalInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTotalTokenizeSharedAssetsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6228,15 +9139,15 @@ func (m *QueryHistoricalInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryHistoricalInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHistoricalInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTotalTokenizeSharedAssetsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hist", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6263,10 +9174,7 @@ func (m *QueryHistoricalInfoResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Hist == nil { - m.Hist = &HistoricalInfo{} - } - if err := m.Hist.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6291,7 +9199,7 @@ func (m *QueryHistoricalInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPoolRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTotalLiquidStaked) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6314,10 +9222,10 @@ func (m *QueryPoolRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPoolRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTotalLiquidStaked: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPoolRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTotalLiquidStaked: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -6341,7 +9249,7 @@ func (m *QueryPoolRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPoolResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTotalLiquidStakedResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6364,17 +9272,17 @@ func (m *QueryPoolResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPoolResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTotalLiquidStakedResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTotalLiquidStakedResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) + 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 ErrIntOverflowQuery @@ -6384,22 +9292,23 @@ func (m *QueryPoolResponse) 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 err := m.Pool.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6424,7 +9333,7 @@ func (m *QueryPoolResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareLockInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6447,12 +9356,44 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareLockInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareLockInfo: 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:]) @@ -6474,7 +9415,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTokenizeShareLockInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6497,17 +9438,17 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTokenizeShareLockInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTokenizeShareLockInfoResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6517,24 +9458,55 @@ func (m *QueryParamsResponse) 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 err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationTime", 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.ExpirationTime = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/staking/types/query.pb.gw.go b/x/staking/types/query.pb.gw.go index 0982dfc3d67..5b5c5327010 100644 --- a/x/staking/types/query.pb.gw.go +++ b/x/staking/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cosmos/staking/v1beta1/query.proto +// source: staking/v1beta1/query.proto /* Package types is a reverse proxy. @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join var ( filter_Query_Validators_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} @@ -874,12 +876,14 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Validators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -887,6 +891,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Validators_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -900,6 +905,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Validator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -907,6 +914,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Validator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -920,6 +928,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ValidatorDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -927,6 +937,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ValidatorDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -940,6 +951,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ValidatorUnbondingDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -947,6 +960,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ValidatorUnbondingDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -960,6 +974,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Delegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -967,6 +983,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Delegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -980,6 +997,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_UnbondingDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -987,6 +1006,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_UnbondingDelegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1000,6 +1020,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegatorDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1007,6 +1029,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegatorDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1020,6 +1043,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegatorUnbondingDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1027,6 +1052,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegatorUnbondingDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1040,6 +1066,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Redelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1047,6 +1075,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Redelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1060,6 +1089,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegatorValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1067,6 +1098,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegatorValidators_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1080,6 +1112,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_DelegatorValidator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1087,6 +1121,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_DelegatorValidator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1100,6 +1135,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_HistoricalInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1107,6 +1144,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_HistoricalInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1120,6 +1158,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Pool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1127,6 +1167,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Pool_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1140,6 +1181,8 @@ 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() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1147,6 +1190,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/staking/types/staking.pb.go b/x/staking/types/staking.pb.go index 5165724ac96..9adaa67f839 100644 --- a/x/staking/types/staking.pb.go +++ b/x/staking/types/staking.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/staking.proto +// source: staking/v1beta1/staking.proto package types @@ -7,19 +7,17 @@ import ( bytes "bytes" compress_gzip "compress/gzip" fmt "fmt" - types1 "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-proto" + types2 "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" - _ "github.com/gogo/protobuf/gogoproto" + types3 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_protoc_gen_gogo_descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + _ "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/regen-network/cosmos-proto" - types3 "github.com/tendermint/tendermint/abci/types" types "github.com/tendermint/tendermint/proto/tendermint/types" - _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" io "io" io_ioutil "io/ioutil" math "math" @@ -74,7 +72,7 @@ func (x BondStatus) String() string { } func (BondStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{0} + return fileDescriptor_76a7656dabf68054, []int{0} } // InfractionType indicates the infraction type a validator commited. @@ -106,7 +104,7 @@ func (x InfractionType) String() string { } func (InfractionType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{1} + return fileDescriptor_76a7656dabf68054, []int{1} } // HistoricalInfo contains header and validator information for a given block. @@ -122,7 +120,7 @@ func (m *HistoricalInfo) Reset() { *m = HistoricalInfo{} } func (m *HistoricalInfo) String() string { return proto.CompactTextString(m) } func (*HistoricalInfo) ProtoMessage() {} func (*HistoricalInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{0} + return fileDescriptor_76a7656dabf68054, []int{0} } func (m *HistoricalInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -171,15 +169,15 @@ type CommissionRates struct { // rate is the commission rate charged to delegators, as a fraction. Rate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate"` // max_rate defines the maximum commission rate which validator can ever charge, as a fraction. - MaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=max_rate,json=maxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_rate" yaml:"max_rate"` + MaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=max_rate,json=maxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_rate"` // max_change_rate defines the maximum daily increase of the validator commission, as a fraction. - MaxChangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=max_change_rate,json=maxChangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_change_rate" yaml:"max_change_rate"` + MaxChangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=max_change_rate,json=maxChangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_change_rate"` } func (m *CommissionRates) Reset() { *m = CommissionRates{} } func (*CommissionRates) ProtoMessage() {} func (*CommissionRates) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{1} + return fileDescriptor_76a7656dabf68054, []int{1} } func (m *CommissionRates) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -213,13 +211,13 @@ type Commission struct { // commission_rates defines the initial commission rates to be used for creating a validator. CommissionRates `protobuf:"bytes,1,opt,name=commission_rates,json=commissionRates,proto3,embedded=commission_rates" json:"commission_rates"` // update_time is the last time the commission rate was changed. - UpdateTime time.Time `protobuf:"bytes,2,opt,name=update_time,json=updateTime,proto3,stdtime" json:"update_time" yaml:"update_time"` + UpdateTime time.Time `protobuf:"bytes,2,opt,name=update_time,json=updateTime,proto3,stdtime" json:"update_time"` } func (m *Commission) Reset() { *m = Commission{} } func (*Commission) ProtoMessage() {} func (*Commission) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{2} + return fileDescriptor_76a7656dabf68054, []int{2} } func (m *Commission) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -264,7 +262,7 @@ type Description struct { // website defines an optional website link. Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` // security_contact defines an optional email for security contact. - SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty" yaml:"security_contact"` + SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` // details define other optional details. Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` } @@ -272,7 +270,7 @@ type Description struct { func (m *Description) Reset() { *m = Description{} } func (*Description) ProtoMessage() {} func (*Description) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{3} + return fileDescriptor_76a7656dabf68054, []int{3} } func (m *Description) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -346,9 +344,9 @@ func (m *Description) GetDetails() string { // multiplied by exchange rate. type Validator struct { // operator_address defines the address of the validator's operator; bech encoded in JSON. - OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty" yaml:"operator_address"` + OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` // consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. - ConsensusPubkey *types1.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"` + ConsensusPubkey *types2.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty"` // jailed defined whether the validator has been jailed from bonded status or not. Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` // status is the validator status (bonded/unbonding/unbonded). @@ -356,27 +354,25 @@ type Validator struct { // tokens define the delegated tokens (incl. self-delegation). 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"` // delegator_shares defines total shares issued to a validator's delegators. - DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` + DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares"` // description defines the description terms for the validator. Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` // unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. - UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` + UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty"` // unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. - UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` + UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time"` // commission defines the commission parameters. Commission Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` - // min_self_delegation is the validator's self declared minimum self delegation. - MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` - // strictly positive if this validator's unbonding has been stopped by external modules - UnbondingOnHoldRefCount int64 `protobuf:"varint,12,opt,name=unbonding_on_hold_ref_count,json=unbondingOnHoldRefCount,proto3" json:"unbonding_on_hold_ref_count,omitempty"` - // list of unbonding ids, each uniquely identifing an unbonding of this validator - UnbondingIds []uint64 `protobuf:"varint,13,rep,packed,name=unbonding_ids,json=unbondingIds,proto3" json:"unbonding_ids,omitempty"` + // Number of shares self bonded from the validator + TotalValidatorBondShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=total_validator_bond_shares,json=totalValidatorBondShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total_validator_bond_shares"` + // Total number of shares either tokenized or owned by a liquid staking provider + TotalLiquidShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,12,opt,name=total_liquid_shares,json=totalLiquidShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total_liquid_shares"` } func (m *Validator) Reset() { *m = Validator{} } func (*Validator) ProtoMessage() {} func (*Validator) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{4} + return fileDescriptor_76a7656dabf68054, []int{4} } func (m *Validator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -413,7 +409,7 @@ type ValAddresses struct { func (m *ValAddresses) Reset() { *m = ValAddresses{} } func (*ValAddresses) ProtoMessage() {} func (*ValAddresses) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{5} + return fileDescriptor_76a7656dabf68054, []int{5} } func (m *ValAddresses) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -453,14 +449,14 @@ func (m *ValAddresses) GetAddresses() []string { // 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. type DVPair struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } func (m *DVPair) Reset() { *m = DVPair{} } func (*DVPair) ProtoMessage() {} func (*DVPair) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{6} + return fileDescriptor_76a7656dabf68054, []int{6} } func (m *DVPair) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -498,7 +494,7 @@ func (m *DVPairs) Reset() { *m = DVPairs{} } func (m *DVPairs) String() string { return proto.CompactTextString(m) } func (*DVPairs) ProtoMessage() {} func (*DVPairs) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{7} + return fileDescriptor_76a7656dabf68054, []int{7} } func (m *DVPairs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -539,15 +535,15 @@ func (m *DVPairs) GetPairs() []DVPair { // example, a DVVTriplet can be used to construct the key to getting a // Redelegation from state. type DVVTriplet struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` } func (m *DVVTriplet) Reset() { *m = DVVTriplet{} } func (*DVVTriplet) ProtoMessage() {} func (*DVVTriplet) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{8} + return fileDescriptor_76a7656dabf68054, []int{8} } func (m *DVVTriplet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -585,7 +581,7 @@ func (m *DVVTriplets) Reset() { *m = DVVTriplets{} } func (m *DVVTriplets) String() string { return proto.CompactTextString(m) } func (*DVVTriplets) ProtoMessage() {} func (*DVVTriplets) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{9} + return fileDescriptor_76a7656dabf68054, []int{9} } func (m *DVVTriplets) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -626,17 +622,19 @@ func (m *DVVTriplets) GetTriplets() []DVVTriplet { // validator. type Delegation struct { // delegator_address is the bech32-encoded address of the delegator. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` // validator_address is the bech32-encoded address of the validator. - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // shares define the delegation shares received. Shares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"shares"` + // has this delegation been marked as a validator self bond. + ValidatorBond bool `protobuf:"varint,4,opt,name=validator_bond,json=validatorBond,proto3" json:"validator_bond,omitempty"` } func (m *Delegation) Reset() { *m = Delegation{} } func (*Delegation) ProtoMessage() {} func (*Delegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{10} + return fileDescriptor_76a7656dabf68054, []int{10} } func (m *Delegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -669,9 +667,9 @@ var xxx_messageInfo_Delegation proto.InternalMessageInfo // for a single validator in an time-ordered list. type UnbondingDelegation struct { // delegator_address is the bech32-encoded address of the delegator. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` // validator_address is the bech32-encoded address of the validator. - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // entries are the unbonding delegation entries. Entries []UnbondingDelegationEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries"` } @@ -679,7 +677,7 @@ type UnbondingDelegation struct { func (m *UnbondingDelegation) Reset() { *m = UnbondingDelegation{} } func (*UnbondingDelegation) ProtoMessage() {} func (*UnbondingDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{11} + return fileDescriptor_76a7656dabf68054, []int{11} } func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -711,23 +709,19 @@ var xxx_messageInfo_UnbondingDelegation proto.InternalMessageInfo // UnbondingDelegationEntry defines an unbonding object with relevant metadata. type UnbondingDelegationEntry struct { // creation_height is the height which the unbonding took place. - CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` // completion_time is the unix time for unbonding completion. - CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` + CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` // initial_balance defines the tokens initially scheduled to receive at completion. - 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"` + 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"` // balance defines the tokens to receive at completion. 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"` - // Incrementing id that uniquely identifies this entry - UnbondingId uint64 `protobuf:"varint,5,opt,name=unbonding_id,json=unbondingId,proto3" json:"unbonding_id,omitempty"` - // Strictly positive if this entry's unbonding has been stopped by external modules - UnbondingOnHoldRefCount int64 `protobuf:"varint,6,opt,name=unbonding_on_hold_ref_count,json=unbondingOnHoldRefCount,proto3" json:"unbonding_on_hold_ref_count,omitempty"` } func (m *UnbondingDelegationEntry) Reset() { *m = UnbondingDelegationEntry{} } func (*UnbondingDelegationEntry) ProtoMessage() {} func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{12} + return fileDescriptor_76a7656dabf68054, []int{12} } func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -770,40 +764,22 @@ func (m *UnbondingDelegationEntry) GetCompletionTime() time.Time { return time.Time{} } -func (m *UnbondingDelegationEntry) GetUnbondingId() uint64 { - if m != nil { - return m.UnbondingId - } - return 0 -} - -func (m *UnbondingDelegationEntry) GetUnbondingOnHoldRefCount() int64 { - if m != nil { - return m.UnbondingOnHoldRefCount - } - return 0 -} - // RedelegationEntry defines a redelegation object with relevant metadata. type RedelegationEntry struct { // creation_height defines the height which the redelegation took place. - CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` // completion_time defines the unix time for redelegation completion. - CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` + CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` // initial_balance defines the initial balance when redelegation started. - 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"` + 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"` // shares_dst is the amount of destination-validator shares created by redelegation. SharesDst github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=shares_dst,json=sharesDst,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"shares_dst"` - // Incrementing id that uniquely identifies this entry - UnbondingId uint64 `protobuf:"varint,5,opt,name=unbonding_id,json=unbondingId,proto3" json:"unbonding_id,omitempty"` - // Strictly positive if this entry's unbonding has been stopped by external modules - UnbondingOnHoldRefCount int64 `protobuf:"varint,6,opt,name=unbonding_on_hold_ref_count,json=unbondingOnHoldRefCount,proto3" json:"unbonding_on_hold_ref_count,omitempty"` } func (m *RedelegationEntry) Reset() { *m = RedelegationEntry{} } func (*RedelegationEntry) ProtoMessage() {} func (*RedelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{13} + return fileDescriptor_76a7656dabf68054, []int{13} } func (m *RedelegationEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -846,29 +822,15 @@ func (m *RedelegationEntry) GetCompletionTime() time.Time { return time.Time{} } -func (m *RedelegationEntry) GetUnbondingId() uint64 { - if m != nil { - return m.UnbondingId - } - return 0 -} - -func (m *RedelegationEntry) GetUnbondingOnHoldRefCount() int64 { - if m != nil { - return m.UnbondingOnHoldRefCount - } - return 0 -} - // Redelegation contains the list of a particular delegator's redelegating bonds // from a particular source validator to a particular destination validator. type Redelegation struct { // delegator_address is the bech32-encoded address of the delegator. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` // validator_src_address is the validator redelegation source operator address. - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` // validator_dst_address is the validator redelegation destination operator address. - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` // entries are the redelegation entries. Entries []RedelegationEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"` } @@ -876,7 +838,7 @@ type Redelegation struct { func (m *Redelegation) Reset() { *m = Redelegation{} } func (*Redelegation) ProtoMessage() {} func (*Redelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{14} + return fileDescriptor_76a7656dabf68054, []int{14} } func (m *Redelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -908,21 +870,32 @@ var xxx_messageInfo_Redelegation proto.InternalMessageInfo // Params defines the parameters for the staking module. type Params struct { // unbonding_time is the time duration of unbonding. - UnbondingTime time.Duration `protobuf:"bytes,1,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time" yaml:"unbonding_time"` + UnbondingTime time.Duration `protobuf:"bytes,1,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time"` // max_validators is the maximum number of validators. - MaxValidators uint32 `protobuf:"varint,2,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty" yaml:"max_validators"` + MaxValidators uint32 `protobuf:"varint,2,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty"` // max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). - MaxEntries uint32 `protobuf:"varint,3,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty" yaml:"max_entries"` + MaxEntries uint32 `protobuf:"varint,3,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty"` // historical_entries is the number of historical entries to persist. - HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty" yaml:"historical_entries"` + HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` // bond_denom defines the bondable coin denomination. - BondDenom string `protobuf:"bytes,5,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom"` + BondDenom string `protobuf:"bytes,5,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty"` + // min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators + MinCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=min_commission_rate,json=minCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_commission_rate" yaml:"min_commission_rate"` + // validator_bond_factor is required as a safety check for tokenizing shares and + // delegations from liquid staking providers + ValidatorBondFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=validator_bond_factor,json=validatorBondFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_bond_factor" yaml:"validator_bond_factor"` + // global_liquid_staking_cap represents a cap on the portion of stake that + // comes from liquid staking providers + GlobalLiquidStakingCap github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=global_liquid_staking_cap,json=globalLiquidStakingCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"global_liquid_staking_cap" yaml:"global_liquid_staking_cap"` + // validator_liquid_staking_cap represents a cap on the portion of stake that + // comes from liquid staking providers for a specific validator + ValidatorLiquidStakingCap github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=validator_liquid_staking_cap,json=validatorLiquidStakingCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"validator_liquid_staking_cap" yaml:"validator_liquid_staking_cap"` } func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{15} + return fileDescriptor_76a7656dabf68054, []int{15} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -990,13 +963,13 @@ func (m *Params) GetBondDenom() string { // balance in addition to shares which is more suitable for client responses. type DelegationResponse struct { Delegation Delegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` - Balance types2.Coin `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"` + Balance types3.Coin `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"` } func (m *DelegationResponse) Reset() { *m = DelegationResponse{} } func (*DelegationResponse) ProtoMessage() {} func (*DelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{16} + return fileDescriptor_76a7656dabf68054, []int{16} } func (m *DelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1032,11 +1005,11 @@ func (m *DelegationResponse) GetDelegation() Delegation { return Delegation{} } -func (m *DelegationResponse) GetBalance() types2.Coin { +func (m *DelegationResponse) GetBalance() types3.Coin { if m != nil { return m.Balance } - return types2.Coin{} + return types3.Coin{} } // RedelegationEntryResponse is equivalent to a RedelegationEntry except that it @@ -1051,7 +1024,7 @@ func (m *RedelegationEntryResponse) Reset() { *m = RedelegationEntryResp func (m *RedelegationEntryResponse) String() string { return proto.CompactTextString(m) } func (*RedelegationEntryResponse) ProtoMessage() {} func (*RedelegationEntryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{17} + return fileDescriptor_76a7656dabf68054, []int{17} } func (m *RedelegationEntryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1099,7 +1072,7 @@ func (m *RedelegationResponse) Reset() { *m = RedelegationResponse{} } func (m *RedelegationResponse) String() string { return proto.CompactTextString(m) } func (*RedelegationResponse) ProtoMessage() {} func (*RedelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{18} + return fileDescriptor_76a7656dabf68054, []int{18} } func (m *RedelegationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1146,14 +1119,14 @@ func (m *RedelegationResponse) GetEntries() []RedelegationEntryResponse { // denomination. type Pool struct { NotBondedTokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=not_bonded_tokens,json=notBondedTokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"not_bonded_tokens"` - BondedTokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=bonded_tokens,json=bondedTokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"bonded_tokens" yaml:"bonded_tokens"` + BondedTokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=bonded_tokens,json=bondedTokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"bonded_tokens"` } func (m *Pool) Reset() { *m = Pool{} } func (m *Pool) String() string { return proto.CompactTextString(m) } func (*Pool) ProtoMessage() {} func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{19} + return fileDescriptor_76a7656dabf68054, []int{19} } func (m *Pool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1182,23 +1155,93 @@ func (m *Pool) XXX_DiscardUnknown() { var xxx_messageInfo_Pool proto.InternalMessageInfo -// ValidatorUpdates defines an array of abci.ValidatorUpdate objects. -type ValidatorUpdates struct { - Updates []types3.ValidatorUpdate `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` +// TokenizeShareRecord represents a tokenized delegation +type TokenizeShareRecord struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + ModuleAccount string `protobuf:"bytes,3,opt,name=module_account,json=moduleAccount,proto3" json:"module_account,omitempty"` + Validator string `protobuf:"bytes,4,opt,name=validator,proto3" json:"validator,omitempty"` +} + +func (m *TokenizeShareRecord) Reset() { *m = TokenizeShareRecord{} } +func (m *TokenizeShareRecord) String() string { return proto.CompactTextString(m) } +func (*TokenizeShareRecord) ProtoMessage() {} +func (*TokenizeShareRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_76a7656dabf68054, []int{20} +} +func (m *TokenizeShareRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenizeShareRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenizeShareRecord.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 *TokenizeShareRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenizeShareRecord.Merge(m, src) +} +func (m *TokenizeShareRecord) XXX_Size() int { + return m.Size() +} +func (m *TokenizeShareRecord) XXX_DiscardUnknown() { + xxx_messageInfo_TokenizeShareRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenizeShareRecord proto.InternalMessageInfo + +func (m *TokenizeShareRecord) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *TokenizeShareRecord) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *TokenizeShareRecord) GetModuleAccount() string { + if m != nil { + return m.ModuleAccount + } + return "" +} + +func (m *TokenizeShareRecord) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +// PendingTokenizeShareAuthorizations stores a list of addresses that have their +// tokenize share enablement in progress +type PendingTokenizeShareAuthorizations struct { + Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` } -func (m *ValidatorUpdates) Reset() { *m = ValidatorUpdates{} } -func (m *ValidatorUpdates) String() string { return proto.CompactTextString(m) } -func (*ValidatorUpdates) ProtoMessage() {} -func (*ValidatorUpdates) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{20} +func (m *PendingTokenizeShareAuthorizations) Reset() { *m = PendingTokenizeShareAuthorizations{} } +func (m *PendingTokenizeShareAuthorizations) String() string { return proto.CompactTextString(m) } +func (*PendingTokenizeShareAuthorizations) ProtoMessage() {} +func (*PendingTokenizeShareAuthorizations) Descriptor() ([]byte, []int) { + return fileDescriptor_76a7656dabf68054, []int{21} } -func (m *ValidatorUpdates) XXX_Unmarshal(b []byte) error { +func (m *PendingTokenizeShareAuthorizations) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ValidatorUpdates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PendingTokenizeShareAuthorizations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ValidatorUpdates.Marshal(b, m, deterministic) + return xxx_messageInfo_PendingTokenizeShareAuthorizations.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1208,21 +1251,21 @@ func (m *ValidatorUpdates) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *ValidatorUpdates) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorUpdates.Merge(m, src) +func (m *PendingTokenizeShareAuthorizations) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingTokenizeShareAuthorizations.Merge(m, src) } -func (m *ValidatorUpdates) XXX_Size() int { +func (m *PendingTokenizeShareAuthorizations) XXX_Size() int { return m.Size() } -func (m *ValidatorUpdates) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorUpdates.DiscardUnknown(m) +func (m *PendingTokenizeShareAuthorizations) XXX_DiscardUnknown() { + xxx_messageInfo_PendingTokenizeShareAuthorizations.DiscardUnknown(m) } -var xxx_messageInfo_ValidatorUpdates proto.InternalMessageInfo +var xxx_messageInfo_PendingTokenizeShareAuthorizations proto.InternalMessageInfo -func (m *ValidatorUpdates) GetUpdates() []types3.ValidatorUpdate { +func (m *PendingTokenizeShareAuthorizations) GetAddresses() []string { if m != nil { - return m.Updates + return m.Addresses } return nil } @@ -1250,142 +1293,141 @@ func init() { proto.RegisterType((*RedelegationEntryResponse)(nil), "cosmos.staking.v1beta1.RedelegationEntryResponse") proto.RegisterType((*RedelegationResponse)(nil), "cosmos.staking.v1beta1.RedelegationResponse") proto.RegisterType((*Pool)(nil), "cosmos.staking.v1beta1.Pool") - proto.RegisterType((*ValidatorUpdates)(nil), "cosmos.staking.v1beta1.ValidatorUpdates") -} - -func init() { - proto.RegisterFile("cosmos/staking/v1beta1/staking.proto", fileDescriptor_64c30c6cf92913c9) -} - -var fileDescriptor_64c30c6cf92913c9 = []byte{ - // 2021 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0x4f, 0x6c, 0x23, 0x57, - 0x19, 0xf7, 0xd8, 0xae, 0xe3, 0x7c, 0x4e, 0xe2, 0xe4, 0x6d, 0x76, 0xd7, 0xf1, 0x2e, 0xb6, 0x77, - 0x5a, 0x95, 0xb0, 0x6a, 0x1d, 0x36, 0xad, 0x8a, 0x88, 0x90, 0x68, 0x1c, 0x3b, 0x8d, 0xd5, 0x6d, - 0x36, 0x8c, 0x9d, 0x54, 0x40, 0xc5, 0x68, 0x3c, 0xf3, 0xe2, 0x0c, 0xb1, 0x67, 0xcc, 0xbc, 0xe7, - 0x6d, 0x2c, 0xf5, 0xc0, 0xb1, 0x84, 0x03, 0xe5, 0xd6, 0x4b, 0xa4, 0x95, 0x7a, 0x42, 0x42, 0xe2, - 0x82, 0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a, 0x31, 0x03, 0xae, 0x1c, 0x9f, 0x54, - 0xf2, 0xa1, 0x50, 0xa3, 0x3f, 0xa0, 0x23, 0xb4, 0x32, 0x29, 0x55, 0xbf, 0xb7, 0x5b, 0xbb, 0xdb, - 0xd0, 0x5b, 0xcd, 0xb7, 0xb6, 0xe7, 0x95, 0xe2, 0xdc, 0xf1, 0x49, 0x05, 0xea, 0xee, 0xb0, 0xd3, - 0xc3, 0x2d, 0xbb, 0xeb, 0xa0, 0xdb, 0x50, 0x98, 0x14, 0x78, 0x77, 0xbb, 0xdd, 0x7c, 0xa7, 0x31, - 0x9f, 0x14, 0x96, 0xd7, 0xdd, 0xf7, 0x1d, 0x36, 0x09, 0xc4, 0x59, 0x6b, 0x9b, 0x9f, 0x3e, 0x2a, - 0x29, 0x0f, 0x1f, 0x95, 0x94, 0xbf, 0x3d, 0x2a, 0x29, 0x1f, 0x3d, 0x2e, 0x25, 0x1e, 0x3e, 0x2e, - 0x25, 0xfe, 0xf4, 0xb8, 0x94, 0xf8, 0xde, 0x2b, 0x4f, 0xcc, 0x9e, 0xa3, 0xe0, 0x0f, 0x23, 0x3c, - 0x8f, 0x3a, 0x19, 0x3e, 0x88, 0x5e, 0xfb, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0xe2, 0xd3, - 0xf7, 0x37, 0x19, 0x00, 0x00, + proto.RegisterType((*TokenizeShareRecord)(nil), "cosmos.staking.v1beta1.TokenizeShareRecord") + proto.RegisterType((*PendingTokenizeShareAuthorizations)(nil), "cosmos.staking.v1beta1.PendingTokenizeShareAuthorizations") +} + +func init() { proto.RegisterFile("staking/v1beta1/staking.proto", fileDescriptor_76a7656dabf68054) } + +var fileDescriptor_76a7656dabf68054 = []byte{ + // 2031 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x4d, 0x6c, 0x1b, 0xc7, + 0x15, 0xe6, 0x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xff, 0xff, 0x83, 0xe3, 0xba, 0x67, 0xd9, 0x19, 0x00, 0x00, } func (this *Pool) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { @@ -1394,791 +1436,498 @@ func (this *Pool) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_ func StakingDescription() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { d := &github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet{} var gzipped = []byte{ - // 12543 bytes of a gzipped FileDescriptorSet - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x7d, 0x6d, 0x74, 0x1c, 0xd7, - 0x75, 0x18, 0x66, 0x3f, 0x80, 0xdd, 0x8b, 0x05, 0xb0, 0x78, 0x00, 0x49, 0x70, 0x49, 0x01, 0xd0, - 0xe8, 0x8b, 0xa2, 0x24, 0x50, 0xa2, 0x44, 0x4a, 0x04, 0x6d, 0xcb, 0xbb, 0xc0, 0x12, 0x80, 0x84, - 0x2f, 0x0d, 0x40, 0x4a, 0x96, 0x3f, 0x26, 0x83, 0xdd, 0x87, 0xc5, 0x88, 0xbb, 0x33, 0xe3, 0x9d, - 0x59, 0x12, 0x50, 0x92, 0x1e, 0xc5, 0x76, 0x52, 0x9b, 0x39, 0x6d, 0xe2, 0xba, 0xa7, 0x51, 0x9c, - 0xd0, 0x95, 0xe3, 0xb4, 0x4e, 0x9c, 0xb4, 0xf9, 0x72, 0xf3, 0xd1, 0xf6, 0xb4, 0x4e, 0x7b, 0xd2, - 0x24, 0x4e, 0xd3, 0x63, 0xb7, 0x39, 0x6d, 0x9a, 0x93, 0xd2, 0xa9, 0xec, 0xb6, 0xae, 0xeb, 0x26, - 0x8e, 0xea, 0x36, 0xe9, 0xf1, 0x49, 0xd3, 0xf3, 0xbe, 0xe6, 0x6b, 0x77, 0x76, 0x76, 0x21, 0xd2, - 0x4e, 0xea, 0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, 0x06, 0xb6, 0x1d, 0x5c, 0x65, 0x1a, 0x91, 0xec, 0x51, 0xa7, 0x80, 0x11, 0xb5, 0xab, 0x54, - 0xea, 0x50, 0x2a, 0xf5, 0x02, 0x8c, 0xb9, 0x4d, 0x52, 0x9b, 0x9a, 0x51, 0x13, 0xba, 0x79, 0x26, - 0xae, 0x25, 0x73, 0x65, 0x41, 0xa7, 0x10, 0x32, 0x65, 0x14, 0x07, 0xca, 0x68, 0x11, 0xc0, 0x34, - 0xb0, 0xb9, 0xab, 0x56, 0x71, 0xa5, 0x3e, 0x95, 0x89, 0x90, 0xd2, 0x06, 0x41, 0x69, 0x93, 0x92, - 0xc9, 0xa0, 0x95, 0x3a, 0xba, 0xe0, 0xa9, 0xda, 0x50, 0x84, 0xa6, 0xac, 0xb1, 0x49, 0xd6, 0xa6, - 0x6d, 0x97, 0x61, 0xb4, 0x89, 0x89, 0xde, 0xe3, 0x2a, 0xef, 0x59, 0x96, 0x36, 0x62, 0x2e, 0xb6, - 0x67, 0x0a, 0x27, 0x63, 0x1d, 0x1b, 0x69, 0xfa, 0x8b, 0xe8, 0x1e, 0x70, 0x01, 0x2a, 0x55, 0x2b, - 0xa0, 0x56, 0x28, 0x27, 0x80, 0xeb, 0x5a, 0x03, 0x17, 0x5e, 0x86, 0xd1, 0xa0, 0x78, 0xd0, 0x24, - 0xa4, 0x6d, 0x47, 0x6b, 0x3a, 0x54, 0x0b, 0xd3, 0x0a, 0x2b, 0xa0, 0x3c, 0x24, 0xb1, 0x51, 0xa5, - 0x56, 0x2e, 0xad, 0x90, 0x7f, 0xd1, 0xdb, 0xbd, 0x0e, 0x27, 0x69, 0x87, 0xef, 0x6f, 0x1f, 0xd1, - 0x00, 0xe7, 0x70, 0xbf, 0x0b, 0x4f, 0xc2, 0x48, 0xa0, 0x03, 0xbd, 0x56, 0x2d, 0x7f, 0x17, 0x1c, - 0xe9, 0xc8, 0x1a, 0xbd, 0x00, 0x93, 0x2d, 0x43, 0x37, 0x1c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73, 0x0b, 0xc4, 0x95, 0xcd, 0x0f, 0xb2, 0xe0, 0x58, 0x61, - 0x94, 0x24, 0x8c, 0x20, 0xca, 0x86, 0x59, 0x30, 0x92, 0x51, 0x78, 0x09, 0x2d, 0xc1, 0xe0, 0x4b, - 0x36, 0xe5, 0x3d, 0x48, 0x79, 0xdf, 0xdb, 0x9d, 0xf7, 0x33, 0x5b, 0x94, 0x79, 0xf6, 0x99, 0x2d, - 0x75, 0x7d, 0x43, 0x59, 0x2b, 0xae, 0x2a, 0x9c, 0x1c, 0x1d, 0x87, 0x54, 0x5d, 0x7b, 0xf9, 0x20, - 0xe8, 0xf4, 0x28, 0xa8, 0xd7, 0x41, 0x38, 0x0e, 0xa9, 0xeb, 0x58, 0xbb, 0x1a, 0x74, 0x35, 0x14, - 0x74, 0x07, 0x27, 0xc3, 0x19, 0x48, 0x53, 0x79, 0x21, 0x00, 0x2e, 0xb1, 0xfc, 0x00, 0xca, 0x40, - 0x6a, 0x61, 0x43, 0x21, 0x13, 0x22, 0x0f, 0x39, 0x06, 0x55, 0x37, 0x57, 0xca, 0x0b, 0xe5, 0x7c, - 0x42, 0x3e, 0x07, 0x83, 0x4c, 0x08, 0x64, 0xb2, 0xb8, 0x62, 0xc8, 0x0f, 0xf0, 0x22, 0xe7, 0x21, - 0x89, 0xaf, 0x97, 0xd7, 0x4a, 0x65, 0x25, 0x9f, 0x08, 0x0e, 0x75, 0x2a, 0x9f, 0x96, 0x6d, 0xc8, - 0xf9, 0xe3, 0xf0, 0x6f, 0xce, 0x62, 0xfc, 0x33, 0x12, 0x0c, 0xfb, 0xe2, 0x6a, 0x12, 0x10, 0x69, - 0xf5, 0xba, 0x79, 0x5d, 0xd5, 0xea, 0xba, 0x66, 0x73, 0xd5, 0x00, 0x0a, 0x2a, 0x12, 0x48, 0xaf, - 0x43, 0xf7, 0x4d, 0x9a, 0x22, 0xe9, 0xfc, 0xa0, 0xfc, 0x31, 0x09, 0xf2, 0xe1, 0xc0, 0x36, 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0x52, 0x24, 0x78, 0x89, 0x27, 0xff, 0x5e, - 0x4e, 0x4e, 0xd1, 0xe7, 0xdf, 0x0a, 0x19, 0x11, 0xb4, 0xc4, 0x93, 0x7e, 0x1f, 0x27, 0x75, 0x49, - 0x08, 0xb9, 0x08, 0x58, 0xe2, 0xc9, 0xff, 0xaa, 0x20, 0x17, 0x24, 0x84, 0xbc, 0x77, 0x11, 0x7e, - 0xe6, 0xfb, 0x53, 0xdc, 0xe9, 0x08, 0xd9, 0x5d, 0x84, 0x21, 0x1e, 0xa9, 0xc4, 0x53, 0x7f, 0x88, - 0x57, 0x2e, 0x28, 0xe6, 0x9f, 0x84, 0x74, 0x8f, 0x02, 0xff, 0x6b, 0x9c, 0x94, 0xe1, 0xcf, 0x2f, - 0xc0, 0xb0, 0x2f, 0x3a, 0x89, 0x27, 0xff, 0xeb, 0x9c, 0xdc, 0x4f, 0x45, 0x9a, 0xce, 0xa3, 0x93, - 0x78, 0x06, 0x3f, 0x20, 0x9a, 0xce, 0x29, 0x88, 0xd8, 0x44, 0x60, 0x12, 0x4f, 0xfd, 0x83, 0x42, - 0xea, 0x82, 0x64, 0xfe, 0x69, 0xc8, 0xba, 0xce, 0x26, 0x9e, 0xfe, 0xc3, 0x9c, 0xde, 0xa3, 0x21, - 0x12, 0xf0, 0x39, 0xbb, 0x78, 0x16, 0x7f, 0x43, 0x48, 0xc0, 0x47, 0x45, 0xa6, 0x51, 0x38, 0x80, - 0x89, 0xe7, 0xf4, 0x11, 0x31, 0x8d, 0x42, 0xf1, 0x0b, 0x19, 0x4d, 0x6a, 0xf3, 0xe3, 0x59, 0xfc, - 0x4d, 0x31, 0x9a, 0x14, 0x9f, 0x34, 0x23, 0x1c, 0x11, 0xc4, 0xf3, 0xf8, 0x21, 0xd1, 0x8c, 0x50, - 0x40, 0x30, 0xbf, 0x09, 0xa8, 0x3d, 0x1a, 0x88, 0xe7, 0xf7, 0x2a, 0xe7, 0x37, 0xde, 0x16, 0x0c, - 0xcc, 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2d, 0x1e, 0x6f, 0x28, 0xac, 0x80, 0x8e, 0xc2, 0x20, - 0xbb, 0x1f, 0xc1, 0x8f, 0xa3, 0xf0, 0x92, 0xbc, 0x00, 0x43, 0x94, 0xf7, 0x86, 0x85, 0x10, 0xbf, - 0x59, 0xc7, 0x2f, 0x62, 0xd0, 0xd0, 0x94, 0xb3, 0x4f, 0x78, 0x8d, 0x45, 0x90, 0xaa, 0x6a, 0x8e, - 0xc6, 0xfb, 0x4d, 0xff, 0x97, 0xdf, 0x06, 0x19, 0xce, 0xc4, 0x46, 0x67, 0x21, 0x69, 0x5a, 0x36, - 0x3f, 0x50, 0x52, 0x88, 0xea, 0xca, 0x86, 0x55, 0x4a, 0x91, 0x48, 0x45, 0x21, 0xc8, 0x25, 0x25, - 0xd2, 0xa8, 0x3e, 0xe5, 0x33, 0xaa, 0xbe, 0x21, 0xf7, 0xfd, 0xcb, 0x86, 0xb4, 0x4d, 0x1d, 0x5c, - 0x65, 0xf9, 0x78, 0x02, 0xa6, 0x7d, 0x5f, 0xaf, 0xe1, 0xa6, 0xad, 0x9b, 0x06, 0xf7, 0xe7, 0x4c, - 0x5b, 0x90, 0xaf, 0x91, 0xfc, 0x7b, 0x84, 0xba, 0xbc, 0x15, 0x92, 0x45, 0xcb, 0x42, 0x05, 0xc8, - 0xd0, 0x72, 0xc5, 0x64, 0xfa, 0x92, 0x52, 0xdc, 0x32, 0xf9, 0x66, 0x9b, 0xbb, 0xce, 0x75, 0xad, - 0xe9, 0x5e, 0x21, 0x14, 0x65, 0xf9, 0x02, 0x64, 0x17, 0x4c, 0xc3, 0xc6, 0x86, 0xdd, 0xa2, 0x73, - 0x70, 0xa7, 0x6e, 0x56, 0xae, 0x72, 0x0e, 0xac, 0x40, 0x04, 0xae, 0x59, 0x16, 0xa5, 0x4c, 0x29, - 0xe4, 0x5f, 0x16, 0x1b, 0x96, 0xb6, 0x22, 0x45, 0x74, 0xa1, 0x7f, 0x11, 0xf1, 0x4e, 0xba, 0x32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x36, 0xf3, 0xd8, 0x31, 0xd5, 0xed, 0xad, - 0x29, 0x13, 0x7d, 0xad, 0x29, 0x37, 0x82, 0xa9, 0x5c, 0x9f, 0x8b, 0x6a, 0x37, 0xb2, 0xab, 0x6e, - 0x6e, 0x97, 0x28, 0x3b, 0x67, 0xe4, 0xcb, 0xf8, 0xd2, 0x29, 0xa0, 0xc0, 0xe4, 0xce, 0xc1, 0xcb, - 0x9a, 0xe1, 0xe8, 0x06, 0x56, 0xdb, 0x46, 0xee, 0x78, 0x1b, 0x53, 0x11, 0x50, 0x72, 0x76, 0x13, - 0x2e, 0xb1, 0x97, 0xd1, 0x95, 0x15, 0x18, 0x0d, 0x1a, 0x78, 0x34, 0x0a, 0x09, 0x67, 0x9f, 0x0b, - 0x20, 0xe1, 0xec, 0xa3, 0x47, 0x79, 0xf2, 0x27, 0x41, 0x93, 0x3f, 0xed, 0xde, 0x95, 0xd3, 0x79, - 0x99, 0x1f, 0x59, 0x76, 0x67, 0x83, 0x6b, 0xf4, 0xc3, 0x5c, 0xe5, 0x07, 0x61, 0x2c, 0x64, 0xd5, - 0xa3, 0x52, 0x81, 0xf2, 0x18, 0x8c, 0x04, 0x4c, 0xb8, 0x7c, 0x14, 0x26, 0x3b, 0x59, 0x64, 0x79, - 0xcf, 0x85, 0x07, 0x2c, 0x2b, 0x3a, 0x07, 0x19, 0xd7, 0x24, 0x77, 0x48, 0x3d, 0xd0, 0x5e, 0x08, - 0x64, 0xc5, 0x45, 0x0d, 0x64, 0xb0, 0x13, 0x81, 0x0c, 0xb6, 0xfc, 0x1d, 0x30, 0x15, 0x65, 0x6e, - 0x43, 0xdd, 0x48, 0xb9, 0x6a, 0x78, 0x14, 0x06, 0xf9, 0xb3, 0x61, 0x09, 0xba, 0x67, 0xc3, 0x4b, - 0x44, 0x3d, 0x99, 0xe9, 0x4d, 0xb2, 0xad, 0x1c, 0x5a, 0x90, 0x55, 0x38, 0x1e, 0x69, 0x72, 0xa3, - 0x77, 0x7f, 0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0x2b, 0x32, 0xd3, 0x0f, 0x44, 0x8d, 0x45, - 0x48, 0xde, 0x2c, 0xaa, 0xfb, 0xdc, 0xad, 0x19, 0x49, 0x19, 0xab, 0x84, 0x86, 0xe2, 0x9d, 0x30, - 0xcc, 0x92, 0x41, 0x2a, 0x8d, 0x10, 0x13, 0xb1, 0x11, 0xe2, 0x34, 0xe1, 0xf5, 0xc6, 0xad, 0x19, - 0xc4, 0xba, 0xe5, 0x23, 0x96, 0x69, 0xdc, 0x08, 0x0c, 0x42, 0x08, 0x7c, 0x7d, 0xfa, 0x4d, 0x09, - 0x86, 0x17, 0x7d, 0x0f, 0x2c, 0x4e, 0xc1, 0x50, 0xc3, 0x34, 0xf4, 0xab, 0xb8, 0xe9, 0xee, 0x5c, - 0xb0, 0x22, 0x09, 0xed, 0xd8, 0x2f, 0x5b, 0x38, 0x07, 0xe2, 0x5e, 0xb4, 0x28, 0x13, 0xaa, 0xeb, - 0x78, 0xc7, 0xd6, 0xc5, 0x68, 0x28, 0xa2, 0x88, 0x2e, 0x41, 0xde, 0xc6, 0x95, 0x56, 0x53, 0x77, - 0x0e, 0xd4, 0x8a, 0x69, 0x38, 0x5a, 0x85, 0x2d, 0x70, 0xb2, 0xa5, 0x13, 0x6f, 0xdc, 0x9a, 0x39, - 0xc6, 0xda, 0x1a, 0xc6, 0x90, 0x95, 0x31, 0x01, 0x5a, 0x60, 0x10, 0x52, 0x43, 0x15, 0x3b, 0x9a, - 0x5e, 0x67, 0x27, 0x34, 0xb2, 0x8a, 0x28, 0xfa, 0xfa, 0xf2, 0x03, 0x19, 0xff, 0x0a, 0xe8, 0x12, - 0xe4, 0x4d, 0x0b, 0x37, 0x03, 0xb7, 0x52, 0xa4, 0x70, 0xcd, 0x61, 0x0c, 0x59, 0x19, 0x13, 0x20, - 0x71, 0x63, 0xc5, 0x09, 0x6c, 0x40, 0xb4, 0x76, 0xbc, 0xcb, 0xb1, 0x93, 0x6d, 0xa3, 0x51, 0x34, - 0x0e, 0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, 0x17, 0xbc, 0x86, 0x10, 0x64, 0x65, 0x54, 0x40, 0xb8, 0x83, 0xaa, 0x01, - 0x89, 0x2c, 0x89, 0xda, 0xd1, 0xf7, 0xe2, 0x7a, 0x0b, 0x25, 0x65, 0xee, 0xa1, 0x44, 0x25, 0x41, - 0x06, 0xcc, 0x45, 0x8d, 0x7a, 0x50, 0xea, 0xa3, 0xde, 0x0b, 0x63, 0xe2, 0x88, 0xec, 0x8e, 0x56, - 0xd7, 0x8c, 0xca, 0x61, 0x02, 0x73, 0xe6, 0x55, 0x78, 0xb5, 0x21, 0x76, 0xb2, 0x22, 0xce, 0xe0, - 0x96, 0x18, 0x00, 0x2d, 0xc3, 0x90, 0xa8, 0x2a, 0x75, 0xa8, 0x80, 0x46, 0x90, 0xa3, 0xbb, 0x21, - 0xe7, 0x77, 0x2d, 0x34, 0x3e, 0x4a, 0x29, 0xc3, 0x3e, 0xcf, 0x12, 0xe7, 0xbb, 0x06, 0xbb, 0xfa, - 0x2e, 0x5f, 0x90, 0xfa, 0x87, 0x49, 0x18, 0x57, 0x70, 0xf5, 0xff, 0x8f, 0x75, 0x7f, 0x63, 0xbd, - 0x06, 0xc0, 0xec, 0x09, 0xb1, 0xe0, 0x87, 0x18, 0x6e, 0x62, 0x91, 0xb2, 0x8c, 0xc3, 0xa2, 0xed, - 0x7c, 0x33, 0x07, 0xfc, 0x56, 0x02, 0x72, 0xfe, 0x01, 0xff, 0x36, 0xf5, 0xab, 0x68, 0xc5, 0xb3, - 0xa5, 0xec, 0xd8, 0x77, 0xe4, 0x8b, 0x95, 0x6d, 0xd3, 0xa3, 0xbb, 0x11, 0xfd, 0x5f, 0x09, 0x18, - 0xe4, 0x1b, 0x9e, 0x95, 0xb6, 0x70, 0x5c, 0x8a, 0xbb, 0x4a, 0xd8, 0x3d, 0x1a, 0x7f, 0xb5, 0x43, - 0x34, 0xfe, 0x76, 0x18, 0x6d, 0x68, 0xfb, 0x6a, 0xe0, 0x20, 0x99, 0x74, 0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 0xad, 0xf0, 0x48, 0x4f, 0x68, 0xee, 0x46, 0xd3, 0x6d, 0x0e, 0xc0, - 0xff, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x97, 0xcb, 0xb2, 0x05, 0xc2, 0x00, 0x00, + // 7844 bytes of a gzipped FileDescriptorSet + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x7d, 0x6b, 0x90, 0x1c, 0xd7, + 0x75, 0xde, 0xce, 0x63, 0x67, 0x67, 0xce, 0xcc, 0xce, 0xf6, 0xde, 0x5d, 0x00, 0x83, 0x05, 0xb1, + 0xbb, 0x1c, 0x8a, 0x04, 0x08, 0x12, 0x0b, 0x12, 0x24, 0x00, 0x62, 0x60, 0x89, 0x99, 0x17, 0x96, + 0x03, 0xec, 0x63, 0xd8, 0xb3, 0x0b, 0x3e, 0xec, 0xa4, 0xd3, 0xdb, 0x73, 0x77, 0xb6, 0x89, 0x9e, + 0xee, 0x56, 0x77, 0x0f, 0x80, 0x45, 0x9c, 0x14, 0x1d, 0x25, 0x8e, 0x84, 0x94, 0x1d, 0x39, 0x4e, + 0xd9, 0xb2, 0x2c, 0x28, 0x94, 0x65, 0x47, 0xb6, 0xa2, 0x3c, 0x6c, 0x29, 0x4a, 0x1c, 0x57, 0x12, + 0x25, 0xa9, 0x38, 0x8a, 0x7e, 0xa4, 0x64, 0xff, 0x88, 0xad, 0x3c, 0x18, 0x87, 0x52, 0x25, 0x8a, + 0x23, 0xc7, 0x8e, 0xc3, 0x54, 0x25, 0xa5, 0x52, 0x55, 0xea, 0xbe, 0xba, 0x7b, 0x5e, 0x3b, 0xb3, + 0x30, 0x48, 0xbb, 0x4a, 0xbf, 0xb0, 0xf7, 0xdc, 0x73, 0xbe, 0x7b, 0xee, 0xb9, 0xe7, 0x9e, 0x73, + 0xee, 0xed, 0xee, 0x01, 0xfc, 0xcb, 0x2b, 0xb0, 0xdc, 0xb2, 0xac, 0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0c, 0x61, 0x72, 0x88, 0xfd, 0xaa, 0x66, 0xa7, 0xdd, 0x8b, 0x92, 0x24, 0x62, 0x1c, + 0x62, 0xca, 0xc5, 0xce, 0x2d, 0x5d, 0xc3, 0xb9, 0x04, 0x05, 0x38, 0xd5, 0x07, 0xd0, 0x60, 0xfd, + 0xbd, 0x18, 0x42, 0x0e, 0x95, 0x21, 0x85, 0xef, 0x78, 0xd8, 0x74, 0x75, 0xcb, 0xcc, 0x4d, 0x51, + 0x90, 0xc7, 0x07, 0xac, 0x22, 0x36, 0x9a, 0xbd, 0x10, 0x81, 0x1c, 0xba, 0x08, 0x53, 0x96, 0xed, + 0xe9, 0x96, 0xe9, 0xe6, 0x92, 0xcb, 0x91, 0xd3, 0xe9, 0xf3, 0x8f, 0x0c, 0x74, 0x84, 0x4d, 0xc6, + 0x23, 0x0b, 0x66, 0x54, 0x03, 0xc9, 0xb5, 0x3a, 0x8e, 0x86, 0x15, 0xcd, 0x6a, 0x62, 0x45, 0x37, + 0x77, 0xad, 0x5c, 0x8a, 0x02, 0x2c, 0xf5, 0x4f, 0x84, 0x32, 0x96, 0xad, 0x26, 0xae, 0x99, 0xbb, + 0x96, 0x9c, 0x75, 0xbb, 0xda, 0xe8, 0x28, 0x24, 0xdc, 0x7d, 0xd3, 0x53, 0xef, 0xe4, 0x32, 0xd4, + 0x43, 0x78, 0x2b, 0xff, 0xab, 0x09, 0x98, 0x19, 0xc7, 0xc5, 0xae, 0xc0, 0xe4, 0x2e, 0x99, 0x65, + 0x2e, 0x7a, 0x18, 0x1b, 0x30, 0x99, 0x6e, 0x23, 0x26, 0x1e, 0xd0, 0x88, 0x45, 0x48, 0x9b, 0xd8, + 0xf5, 0x70, 0x93, 0x79, 0x44, 0x6c, 0x4c, 0x9f, 0x02, 0x26, 0xd4, 0xef, 0x52, 0xf1, 0x07, 0x72, + 0xa9, 0x57, 0x61, 0xc6, 0x57, 0x49, 0x71, 0x54, 0xb3, 0x25, 0x7c, 0xf3, 0xd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0xe9, 0xad, 0xd7, 0xea, 0x55, + 0xa5, 0xb2, 0xb9, 0x5d, 0x5a, 0xab, 0x4a, 0x11, 0x94, 0x05, 0xa0, 0x84, 0xab, 0x6b, 0x9b, 0xc5, + 0x2d, 0x29, 0xea, 0xb7, 0x6b, 0x1b, 0x5b, 0x17, 0x9f, 0x97, 0x62, 0xbe, 0xc0, 0x36, 0x23, 0xc4, + 0xc3, 0x0c, 0xcf, 0x9d, 0x97, 0x26, 0x91, 0x04, 0x19, 0x06, 0x50, 0x7b, 0xb5, 0x5a, 0xb9, 0xf8, + 0xbc, 0x94, 0xe8, 0xa6, 0x3c, 0x77, 0x5e, 0x9a, 0x42, 0xd3, 0x90, 0xa2, 0x94, 0xd2, 0xe6, 0xe6, + 0x9a, 0x94, 0xf4, 0x31, 0x1b, 0x5b, 0x72, 0x6d, 0x63, 0x55, 0x4a, 0xf9, 0x98, 0xab, 0xf2, 0xe6, + 0x76, 0x5d, 0x02, 0x1f, 0x61, 0xbd, 0xda, 0x68, 0x14, 0x57, 0xab, 0x52, 0xda, 0xe7, 0x28, 0xbd, + 0xb6, 0x55, 0x6d, 0x48, 0x99, 0x2e, 0xb5, 0x9e, 0x3b, 0x2f, 0x4d, 0xfb, 0x43, 0x54, 0x37, 0xb6, + 0xd7, 0xa5, 0x2c, 0x9a, 0x85, 0x69, 0x36, 0x84, 0x50, 0x62, 0xa6, 0x87, 0x74, 0xf1, 0x79, 0x49, + 0x0a, 0x14, 0x61, 0x28, 0xb3, 0x5d, 0x84, 0x8b, 0xcf, 0x4b, 0x28, 0x5f, 0x86, 0x49, 0xea, 0x86, + 0x08, 0x41, 0x76, 0xad, 0x58, 0xaa, 0xae, 0x29, 0x9b, 0xf5, 0xad, 0xda, 0xe6, 0x46, 0x71, 0x4d, + 0x8a, 0x04, 0x34, 0xb9, 0xfa, 0xf2, 0x76, 0x4d, 0xae, 0x56, 0xa4, 0x68, 0x98, 0x56, 0xaf, 0x16, + 0xb7, 0xaa, 0x15, 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x14, 0x8d, 0x53, 0x45, 0x17, 0x87, 0xcc, + 0xb4, 0xcf, 0x31, 0x9f, 0x01, 0x49, 0x33, 0x74, 0x6c, 0x7a, 0x8a, 0xeb, 0x39, 0x58, 0x6d, 0xeb, + 0x66, 0x8b, 0xa6, 0x9a, 0x64, 0x61, 0x72, 0x57, 0x35, 0x5c, 0x2c, 0xcf, 0xb0, 0xee, 0x86, 0xe8, + 0x25, 0x12, 0xd4, 0x81, 0x9c, 0x90, 0x44, 0xa2, 0x4b, 0x82, 0x75, 0xfb, 0x12, 0xf9, 0x9f, 0x48, + 0x41, 0x3a, 0x54, 0x80, 0xa3, 0x47, 0x21, 0xf3, 0x86, 0x7a, 0x4b, 0x55, 0xc4, 0xa1, 0x8a, 0x59, + 0x22, 0x4d, 0x68, 0x75, 0x7e, 0xb0, 0x7a, 0x06, 0xe6, 0x29, 0x8b, 0xd5, 0xf1, 0xb0, 0xa3, 0x68, + 0x86, 0xea, 0xba, 0xd4, 0x68, 0x49, 0xca, 0x8a, 0x48, 0xdf, 0x26, 0xe9, 0x2a, 0x8b, 0x1e, 0x74, + 0x01, 0xe6, 0xa8, 0x44, 0xbb, 0x63, 0x78, 0xba, 0x6d, 0x60, 0x85, 0x1c, 0xf3, 0x5c, 0x9a, 0x72, + 0x7c, 0xcd, 0x66, 0x09, 0xc7, 0x3a, 0x67, 0x20, 0x1a, 0xb9, 0xa8, 0x02, 0x27, 0xa9, 0x58, 0x0b, + 0x9b, 0xd8, 0x51, 0x3d, 0xac, 0xe0, 0x0f, 0x77, 0x54, 0xc3, 0x55, 0x54, 0xb3, 0xa9, 0xec, 0xa9, + 0xee, 0x5e, 0x6e, 0x9e, 0x00, 0x94, 0xa2, 0xb9, 0x88, 0x7c, 0x9c, 0x30, 0xae, 0x72, 0xbe, 0x2a, + 0x65, 0x2b, 0x9a, 0xcd, 0x97, 0x54, 0x77, 0x0f, 0x15, 0xe0, 0x28, 0x45, 0x71, 0x3d, 0x47, 0x37, + 0x5b, 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0xb1, 0xb3, 0x4f, 0x41, 0x86, + 0x23, 0x5d, 0x78, 0x6c, 0x93, 0x62, 0x67, 0x04, 0xe2, 0xbf, 0xe2, 0x88, 0x73, 0x21, 0xc4, 0x06, + 0x17, 0x2d, 0x94, 0x61, 0xfa, 0x30, 0x58, 0xbf, 0xce, 0xb1, 0x32, 0x38, 0x0c, 0xb2, 0x0a, 0x33, + 0x14, 0x44, 0xeb, 0xb8, 0x9e, 0xd5, 0xa6, 0x11, 0xf0, 0x60, 0x98, 0x7f, 0xfd, 0x2d, 0xb6, 0x6b, + 0xb2, 0x44, 0xac, 0xec, 0x4b, 0x15, 0x0a, 0x40, 0x9f, 0x96, 0x35, 0xb1, 0x66, 0x8c, 0x40, 0xf8, + 0x2a, 0x57, 0xc4, 0xe7, 0x2f, 0xdc, 0x80, 0x79, 0xf2, 0x37, 0x0d, 0x50, 0x61, 0x4d, 0x46, 0x5f, + 0xc1, 0xe5, 0x7e, 0xe3, 0x23, 0x6c, 0x63, 0xce, 0xf9, 0x00, 0x21, 0x9d, 0x42, 0xab, 0xd8, 0xc2, + 0x9e, 0x87, 0x1d, 0x57, 0x51, 0x8d, 0x41, 0xea, 0x85, 0xee, 0x30, 0x72, 0x3f, 0xf3, 0x9d, 0xee, + 0x55, 0x5c, 0x65, 0x92, 0x45, 0xc3, 0x28, 0x6c, 0xc3, 0xb1, 0x01, 0x5e, 0x31, 0x06, 0xe6, 0x27, + 0x39, 0xe6, 0x7c, 0x9f, 0x67, 0x10, 0xd8, 0x3a, 0x08, 0xba, 0xbf, 0x96, 0x63, 0x60, 0xfe, 0x2c, + 0xc7, 0x44, 0x5c, 0x56, 0x2c, 0x29, 0x41, 0xbc, 0x06, 0xb3, 0xb7, 0xb0, 0xb3, 0x63, 0xb9, 0xfc, + 0xde, 0x68, 0x0c, 0xb8, 0x4f, 0x71, 0xb8, 0x19, 0x2e, 0x48, 0x2f, 0x92, 0x08, 0xd6, 0x65, 0x48, + 0xee, 0xaa, 0x1a, 0x1e, 0x03, 0xe2, 0x3e, 0x87, 0x98, 0x22, 0xfc, 0x44, 0xb4, 0x08, 0x99, 0x96, + 0xc5, 0x73, 0xd4, 0x68, 0xf1, 0x4f, 0x73, 0xf1, 0xb4, 0x90, 0xe1, 0x10, 0xb6, 0x65, 0x77, 0x0c, + 0x92, 0xc0, 0x46, 0x43, 0xfc, 0x4d, 0x01, 0x21, 0x64, 0x38, 0xc4, 0x21, 0xcc, 0xfa, 0x96, 0x80, + 0x70, 0x43, 0xf6, 0x7c, 0x11, 0xd2, 0x96, 0x69, 0xec, 0x5b, 0xe6, 0x38, 0x4a, 0x7c, 0x86, 0x23, + 0x00, 0x17, 0x21, 0x00, 0x57, 0x20, 0x35, 0xee, 0x42, 0xfc, 0xc2, 0x77, 0xc4, 0xf6, 0x10, 0x2b, + 0xb0, 0x0a, 0x33, 0x22, 0x40, 0xe9, 0x96, 0x39, 0x06, 0xc4, 0xdf, 0xe2, 0x10, 0xd9, 0x90, 0x18, + 0x9f, 0x86, 0x87, 0x5d, 0xaf, 0x85, 0xc7, 0x01, 0xf9, 0x9c, 0x98, 0x06, 0x17, 0xe1, 0xa6, 0xdc, + 0xc1, 0xa6, 0xb6, 0x37, 0x1e, 0xc2, 0x2f, 0x0a, 0x53, 0x0a, 0x19, 0x02, 0x51, 0x86, 0xe9, 0xb6, + 0xea, 0xb8, 0x7b, 0xaa, 0x31, 0xd6, 0x72, 0xfc, 0x12, 0xc7, 0xc8, 0xf8, 0x42, 0xdc, 0x22, 0x1d, + 0xf3, 0x30, 0x30, 0x9f, 0x17, 0x16, 0x09, 0x89, 0xf1, 0xad, 0xe7, 0x7a, 0xf4, 0x92, 0xed, 0x30, + 0x68, 0x7f, 0x5b, 0x6c, 0x3d, 0x26, 0xbb, 0x1e, 0x46, 0xbc, 0x02, 0x29, 0x57, 0xbf, 0x3b, 0x16, + 0xcc, 0x17, 0xc4, 0x4a, 0x53, 0x01, 0x22, 0xfc, 0x1a, 0x1c, 0x1f, 0x98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b, 0xa2, 0x41, 0x9c, 0xff, 0x12, 0xec, 0x90, 0x68, 0xd0, 0xe7, 0x75, 0x07, 0x87, + 0x81, 0xb7, 0x12, 0x90, 0xa8, 0xab, 0x8e, 0xda, 0x76, 0xd1, 0xb5, 0xbe, 0x22, 0x53, 0x5c, 0x01, + 0xf6, 0xfd, 0xde, 0x37, 0xbf, 0x78, 0x60, 0x2e, 0xf7, 0x89, 0x01, 0x35, 0xe6, 0xe3, 0x90, 0x25, + 0xc7, 0xd8, 0xd0, 0xdb, 0x02, 0x51, 0xfa, 0x0c, 0x94, 0x9c, 0x43, 0x83, 0x47, 0x55, 0x68, 0x09, + 0xd2, 0x84, 0x2d, 0x08, 0x74, 0x84, 0x07, 0xda, 0xea, 0x9d, 0x2a, 0xa3, 0xa0, 0xb3, 0x80, 0xf6, + 0xfc, 0x8b, 0x05, 0x25, 0x30, 0x01, 0xe1, 0x9b, 0x0d, 0x7a, 0x04, 0xfb, 0x49, 0x00, 0x5a, 0x80, + 0xb2, 0x37, 0xd0, 0xd8, 0x39, 0x2c, 0x45, 0x28, 0x15, 0xfa, 0x16, 0xda, 0x0f, 0xc3, 0x5c, 0x5b, + 0x37, 0x95, 0x9e, 0x13, 0x2e, 0x3f, 0x2a, 0xac, 0x1d, 0xce, 0x53, 0xff, 0xf0, 0xed, 0xa5, 0x85, + 0x7d, 0xb5, 0x6d, 0x14, 0xf2, 0x03, 0x20, 0xf3, 0xf2, 0x6c, 0x5b, 0x37, 0xbb, 0x4f, 0xc6, 0xe8, + 0x2f, 0x46, 0xc2, 0x2e, 0x41, 0xf5, 0xdc, 0x55, 0x35, 0xcf, 0x72, 0xd8, 0x0f, 0x55, 0x97, 0x36, + 0x0e, 0xad, 0xc0, 0x23, 0x4c, 0x81, 0x81, 0xa0, 0xf9, 0x90, 0x23, 0x91, 0x24, 0x78, 0x95, 0x52, + 0xd1, 0x8f, 0x45, 0xe0, 0x78, 0xcb, 0xb0, 0x76, 0x42, 0x75, 0x33, 0x73, 0x20, 0x45, 0x53, 0x6d, + 0xf6, 0x1b, 0x40, 0x25, 0xf9, 0xd0, 0x8a, 0x2c, 0x33, 0x45, 0x86, 0x02, 0xe7, 0xe5, 0xa3, 0xac, + 0x8f, 0xd7, 0xd4, 0xac, 0xa7, 0xac, 0xda, 0xe8, 0xa7, 0x22, 0xf0, 0x48, 0xa0, 0xff, 0x00, 0x95, + 0x52, 0x54, 0xa5, 0xed, 0x43, 0xab, 0xf4, 0x58, 0xaf, 0x6d, 0x06, 0x69, 0x75, 0xdc, 0xef, 0xee, + 0x55, 0x2c, 0x14, 0x6f, 0x3e, 0x1b, 0x01, 0x14, 0x24, 0x48, 0x19, 0xbb, 0x36, 0x39, 0x28, 0x93, + 0x63, 0x54, 0xb0, 0xd3, 0xf8, 0x56, 0x19, 0x5e, 0xb6, 0xf9, 0x9c, 0xe2, 0x18, 0x15, 0x8a, 0x5f, + 0x97, 0x83, 0x74, 0x14, 0xe5, 0x3b, 0x6e, 0xc0, 0xcb, 0x9e, 0x2b, 0x65, 0x4b, 0x17, 0xd2, 0x7d, + 0x19, 0x67, 0x22, 0xff, 0x8d, 0x08, 0x1c, 0xef, 0xdb, 0xfb, 0xbe, 0xb2, 0x7f, 0x06, 0x90, 0x13, + 0xea, 0xe4, 0x3f, 0xc0, 0xc8, 0x94, 0x3e, 0x74, 0x28, 0x99, 0x75, 0xfa, 0x32, 0xdb, 0x7b, 0x95, + 0x51, 0xd9, 0x4b, 0xa0, 0xff, 0x2c, 0x02, 0xf3, 0x61, 0x65, 0xfc, 0x69, 0x6d, 0x40, 0x26, 0xac, + 0x0b, 0x9f, 0xd0, 0x07, 0xc6, 0x99, 0x10, 0x9f, 0x4b, 0x97, 0x3c, 0x7a, 0x39, 0x08, 0xb3, 0xec, + 0xfa, 0xf1, 0xd9, 0xb1, 0x6d, 0x23, 0x74, 0xea, 0x0d, 0xb7, 0x71, 0x51, 0x73, 0xc6, 0xeb, 0x96, + 0x65, 0xa0, 0x3f, 0x0f,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xe7, 0xdc, 0x1d, + 0xf1, 0xc4, 0xa6, 0xfb, 0xd9, 0xce, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x61, 0xee, 0x69, + 0xf8, 0x69, 0x00, 0x00, } r := bytes.NewReader(gzipped) gzipr, err := compress_gzip.NewReader(r) @@ -2318,12 +2067,6 @@ func (this *UnbondingDelegationEntry) Equal(that interface{}) bool { if !this.Balance.Equal(that1.Balance) { return false } - if this.UnbondingId != that1.UnbondingId { - return false - } - if this.UnbondingOnHoldRefCount != that1.UnbondingOnHoldRefCount { - return false - } return true } func (this *RedelegationEntry) Equal(that interface{}) bool { @@ -2357,12 +2100,6 @@ func (this *RedelegationEntry) Equal(that interface{}) bool { if !this.SharesDst.Equal(that1.SharesDst) { return false } - if this.UnbondingId != that1.UnbondingId { - return false - } - if this.UnbondingOnHoldRefCount != that1.UnbondingOnHoldRefCount { - return false - } return true } func (this *Params) Equal(that interface{}) bool { @@ -2399,6 +2136,18 @@ func (this *Params) Equal(that interface{}) bool { if this.BondDenom != that1.BondDenom { return false } + if !this.MinCommissionRate.Equal(that1.MinCommissionRate) { + return false + } + if !this.ValidatorBondFactor.Equal(that1.ValidatorBondFactor) { + return false + } + if !this.GlobalLiquidStakingCap.Equal(that1.GlobalLiquidStakingCap) { + return false + } + if !this.ValidatorLiquidStakingCap.Equal(that1.ValidatorLiquidStakingCap) { + return false + } return true } func (this *RedelegationEntryResponse) Equal(that interface{}) bool { @@ -2455,6 +2204,39 @@ func (this *Pool) Equal(that interface{}) bool { } return true } +func (this *TokenizeShareRecord) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TokenizeShareRecord) + if !ok { + that2, ok := that.(TokenizeShareRecord) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Owner != that1.Owner { + return false + } + if this.ModuleAccount != that1.ModuleAccount { + return false + } + if this.Validator != that1.Validator { + return false + } + return true +} func (m *HistoricalInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2674,33 +2456,20 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.UnbondingIds) > 0 { - dAtA5 := make([]byte, len(m.UnbondingIds)*10) - var j4 int - for _, num := range m.UnbondingIds { - for num >= 1<<7 { - dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j4++ - } - dAtA5[j4] = uint8(num) - j4++ - } - i -= j4 - copy(dAtA[i:], dAtA5[:j4]) - i = encodeVarintStaking(dAtA, i, uint64(j4)) - i-- - dAtA[i] = 0x6a - } - if m.UnbondingOnHoldRefCount != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingOnHoldRefCount)) - i-- - dAtA[i] = 0x60 + { + size := m.TotalLiquidShares.Size() + i -= size + if _, err := m.TotalLiquidShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x62 { - size := m.MinSelfDelegation.Size() + size := m.TotalValidatorBondShares.Size() i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.TotalValidatorBondShares.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintStaking(dAtA, i, uint64(size)) @@ -2717,12 +2486,12 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x52 - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) - if err7 != nil { - return 0, err7 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) + if err5 != nil { + return 0, err5 } - i -= n7 - i = encodeVarintStaking(dAtA, i, uint64(n7)) + i -= n5 + i = encodeVarintStaking(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x4a if m.UnbondingHeight != 0 { @@ -3004,6 +2773,16 @@ func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ValidatorBond { + i-- + if m.ValidatorBond { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } { size := m.Shares.Size() i -= size @@ -3102,16 +2881,6 @@ func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.UnbondingOnHoldRefCount != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingOnHoldRefCount)) - i-- - dAtA[i] = 0x30 - } - if m.UnbondingId != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingId)) - i-- - dAtA[i] = 0x28 - } { size := m.Balance.Size() i -= size @@ -3132,12 +2901,12 @@ func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error } i-- dAtA[i] = 0x1a - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err10 != nil { - return 0, err10 + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err8 != nil { + return 0, err8 } - i -= n10 - i = encodeVarintStaking(dAtA, i, uint64(n10)) + i -= n8 + i = encodeVarintStaking(dAtA, i, uint64(n8)) i-- dAtA[i] = 0x12 if m.CreationHeight != 0 { @@ -3168,16 +2937,6 @@ func (m *RedelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.UnbondingOnHoldRefCount != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingOnHoldRefCount)) - i-- - dAtA[i] = 0x30 - } - if m.UnbondingId != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingId)) - i-- - dAtA[i] = 0x28 - } { size := m.SharesDst.Size() i -= size @@ -3198,12 +2957,12 @@ func (m *RedelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x1a - n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err11 != nil { - return 0, err11 + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err9 != nil { + return 0, err9 } - i -= n11 - i = encodeVarintStaking(dAtA, i, uint64(n11)) + i -= n9 + i = encodeVarintStaking(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x12 if m.CreationHeight != 0 { @@ -3292,6 +3051,46 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.ValidatorLiquidStakingCap.Size() + i -= size + if _, err := m.ValidatorLiquidStakingCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size := m.GlobalLiquidStakingCap.Size() + i -= size + if _, err := m.GlobalLiquidStakingCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size := m.ValidatorBondFactor.Size() + i -= size + if _, err := m.ValidatorBondFactor.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.MinCommissionRate.Size() + i -= size + if _, err := m.MinCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 if len(m.BondDenom) > 0 { i -= len(m.BondDenom) copy(dAtA[i:], m.BondDenom) @@ -3314,12 +3113,12 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - n12, err12 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) - if err12 != nil { - return 0, err12 + n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) + if err10 != nil { + return 0, err10 } - i -= n12 - i = encodeVarintStaking(dAtA, i, uint64(n12)) + i -= n10 + i = encodeVarintStaking(dAtA, i, uint64(n10)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -3501,7 +3300,7 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ValidatorUpdates) Marshal() (dAtA []byte, err error) { +func (m *TokenizeShareRecord) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3511,26 +3310,70 @@ func (m *ValidatorUpdates) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatorUpdates) MarshalTo(dAtA []byte) (int, error) { +func (m *TokenizeShareRecord) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatorUpdates) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TokenizeShareRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Updates) > 0 { - for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0x22 + } + if len(m.ModuleAccount) > 0 { + i -= len(m.ModuleAccount) + copy(dAtA[i:], m.ModuleAccount) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ModuleAccount))) + i-- + dAtA[i] = 0x1a + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *PendingTokenizeShareAuthorizations) 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 *PendingTokenizeShareAuthorizations) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PendingTokenizeShareAuthorizations) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Addresses[iNdEx]))) i-- dAtA[i] = 0xa } @@ -3656,18 +3499,10 @@ func (m *Validator) Size() (n int) { n += 1 + l + sovStaking(uint64(l)) l = m.Commission.Size() n += 1 + l + sovStaking(uint64(l)) - l = m.MinSelfDelegation.Size() + l = m.TotalValidatorBondShares.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.TotalLiquidShares.Size() n += 1 + l + sovStaking(uint64(l)) - if m.UnbondingOnHoldRefCount != 0 { - n += 1 + sovStaking(uint64(m.UnbondingOnHoldRefCount)) - } - if len(m.UnbondingIds) > 0 { - l = 0 - for _, e := range m.UnbondingIds { - l += sovStaking(uint64(e)) - } - n += 1 + sovStaking(uint64(l)) + l - } return n } @@ -3770,6 +3605,9 @@ func (m *Delegation) Size() (n int) { } l = m.Shares.Size() n += 1 + l + sovStaking(uint64(l)) + if m.ValidatorBond { + n += 2 + } return n } @@ -3811,12 +3649,6 @@ func (m *UnbondingDelegationEntry) Size() (n int) { n += 1 + l + sovStaking(uint64(l)) l = m.Balance.Size() n += 1 + l + sovStaking(uint64(l)) - if m.UnbondingId != 0 { - n += 1 + sovStaking(uint64(m.UnbondingId)) - } - if m.UnbondingOnHoldRefCount != 0 { - n += 1 + sovStaking(uint64(m.UnbondingOnHoldRefCount)) - } return n } @@ -3835,12 +3667,6 @@ func (m *RedelegationEntry) Size() (n int) { n += 1 + l + sovStaking(uint64(l)) l = m.SharesDst.Size() n += 1 + l + sovStaking(uint64(l)) - if m.UnbondingId != 0 { - n += 1 + sovStaking(uint64(m.UnbondingId)) - } - if m.UnbondingOnHoldRefCount != 0 { - n += 1 + sovStaking(uint64(m.UnbondingOnHoldRefCount)) - } return n } @@ -3892,6 +3718,14 @@ func (m *Params) Size() (n int) { if l > 0 { n += 1 + l + sovStaking(uint64(l)) } + l = m.MinCommissionRate.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.ValidatorBondFactor.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.GlobalLiquidStakingCap.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.ValidatorLiquidStakingCap.Size() + n += 1 + l + sovStaking(uint64(l)) return n } @@ -3951,15 +3785,39 @@ func (m *Pool) Size() (n int) { return n } -func (m *ValidatorUpdates) Size() (n int) { +func (m *TokenizeShareRecord) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Updates) > 0 { - for _, e := range m.Updates { - l = e.Size() + if m.Id != 0 { + n += 1 + sovStaking(uint64(m.Id)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ModuleAccount) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + return n +} + +func (m *PendingTokenizeShareAuthorizations) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, s := range m.Addresses { + l = len(s) n += 1 + l + sovStaking(uint64(l)) } } @@ -4676,7 +4534,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ConsensusPubkey == nil { - m.ConsensusPubkey = &types1.Any{} + m.ConsensusPubkey = &types2.Any{} } if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4909,7 +4767,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalValidatorBondShares", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4937,15 +4795,15 @@ func (m *Validator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TotalValidatorBondShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOnHoldRefCount", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalLiquidShares", wireType) } - m.UnbondingOnHoldRefCount = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowStaking @@ -4955,87 +4813,26 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.UnbondingOnHoldRefCount |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 13: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UnbondingIds = append(m.UnbondingIds, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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.UnbondingIds) == 0 { - m.UnbondingIds = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UnbondingIds = append(m.UnbondingIds, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingIds", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStaking } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalLiquidShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStaking(dAtA[iNdEx:]) @@ -5694,6 +5491,26 @@ func (m *Delegation) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorBond", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ValidatorBond = bool(v != 0) default: iNdEx = preIndex skippy, err := skipStaking(dAtA[iNdEx:]) @@ -6012,44 +5829,6 @@ func (m *UnbondingDelegationEntry) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingId", wireType) - } - m.UnbondingId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnbondingId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOnHoldRefCount", wireType) - } - m.UnbondingOnHoldRefCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnbondingOnHoldRefCount |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipStaking(dAtA[iNdEx:]) @@ -6220,44 +5999,6 @@ func (m *RedelegationEntry) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingId", wireType) - } - m.UnbondingId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnbondingId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOnHoldRefCount", wireType) - } - m.UnbondingOnHoldRefCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnbondingOnHoldRefCount |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipStaking(dAtA[iNdEx:]) @@ -6610,6 +6351,142 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.BondDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCommissionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorBondFactor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidatorBondFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalLiquidStakingCap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GlobalLiquidStakingCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorLiquidStakingCap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ValidatorLiquidStakingCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStaking(dAtA[iNdEx:]) @@ -7099,7 +6976,7 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } return nil } -func (m *ValidatorUpdates) Unmarshal(dAtA []byte) error { +func (m *TokenizeShareRecord) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7122,17 +6999,36 @@ func (m *ValidatorUpdates) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ValidatorUpdates: wiretype end group for non-group") + return fmt.Errorf("proto: TokenizeShareRecord: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorUpdates: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TokenizeShareRecord: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Updates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowStaking @@ -7142,25 +7038,169 @@ func (m *ValidatorUpdates) 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 ErrInvalidLengthStaking } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthStaking } if postIndex > l { return io.ErrUnexpectedEOF } - m.Updates = append(m.Updates, types3.ValidatorUpdate{}) - if err := m.Updates[len(m.Updates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ModuleAccount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { return err } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PendingTokenizeShareAuthorizations) 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 ErrIntOverflowStaking + } + 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: PendingTokenizeShareAuthorizations: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingTokenizeShareAuthorizations: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/staking/types/tokenize_share_record.go b/x/staking/types/tokenize_share_record.go new file mode 100644 index 00000000000..c68a1771aa2 --- /dev/null +++ b/x/staking/types/tokenize_share_record.go @@ -0,0 +1,18 @@ +package types + +import ( + fmt "fmt" + "strconv" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +func (r TokenizeShareRecord) GetModuleAddress() sdk.AccAddress { + return authtypes.NewModuleAddress(r.ModuleAccount) +} + +func (r TokenizeShareRecord) GetShareTokenDenom() string { + return fmt.Sprintf("%s/%s", strings.ToLower(r.Validator), strconv.Itoa(int(r.Id))) +} diff --git a/x/staking/types/tx.pb.go b/x/staking/types/tx.pb.go index 59e3b4ba665..953aa77527c 100644 --- a/x/staking/types/tx.pb.go +++ b/x/staking/types/tx.pb.go @@ -1,23 +1,24 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/tx.proto +// source: staking/v1beta1/tx.proto package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" 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/types" - _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/regen-network/cosmos-proto" 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" @@ -40,9 +41,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreateValidator struct { Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` Commission CommissionRates `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission"` - MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` - DelegatorAddress string `protobuf:"bytes,4,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,5,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation"` + DelegatorAddress string `protobuf:"bytes,4,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,5,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` Pubkey *types.Any `protobuf:"bytes,6,opt,name=pubkey,proto3" json:"pubkey,omitempty"` Value types1.Coin `protobuf:"bytes,7,opt,name=value,proto3" json:"value"` } @@ -51,7 +52,7 @@ func (m *MsgCreateValidator) Reset() { *m = MsgCreateValidator{} } func (m *MsgCreateValidator) String() string { return proto.CompactTextString(m) } func (*MsgCreateValidator) ProtoMessage() {} func (*MsgCreateValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{0} + return fileDescriptor_dc1f14f20335eae7, []int{0} } func (m *MsgCreateValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -88,7 +89,7 @@ func (m *MsgCreateValidatorResponse) Reset() { *m = MsgCreateValidatorRe func (m *MsgCreateValidatorResponse) String() string { return proto.CompactTextString(m) } func (*MsgCreateValidatorResponse) ProtoMessage() {} func (*MsgCreateValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{1} + return fileDescriptor_dc1f14f20335eae7, []int{1} } func (m *MsgCreateValidatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -120,20 +121,20 @@ var xxx_messageInfo_MsgCreateValidatorResponse proto.InternalMessageInfo // MsgEditValidator defines a SDK message for editing an existing validator. type MsgEditValidator struct { Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // 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 - CommissionRate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=commission_rate,json=commissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission_rate,omitempty" yaml:"commission_rate"` - MinSelfDelegation *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation,omitempty" yaml:"min_self_delegation"` + CommissionRate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=commission_rate,json=commissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission_rate,omitempty"` + MinSelfDelegation *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation,omitempty"` } func (m *MsgEditValidator) Reset() { *m = MsgEditValidator{} } func (m *MsgEditValidator) String() string { return proto.CompactTextString(m) } func (*MsgEditValidator) ProtoMessage() {} func (*MsgEditValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{2} + return fileDescriptor_dc1f14f20335eae7, []int{2} } func (m *MsgEditValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,7 +171,7 @@ func (m *MsgEditValidatorResponse) Reset() { *m = MsgEditValidatorRespon func (m *MsgEditValidatorResponse) String() string { return proto.CompactTextString(m) } func (*MsgEditValidatorResponse) ProtoMessage() {} func (*MsgEditValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{3} + return fileDescriptor_dc1f14f20335eae7, []int{3} } func (m *MsgEditValidatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -202,8 +203,8 @@ var xxx_messageInfo_MsgEditValidatorResponse proto.InternalMessageInfo // MsgDelegate defines a SDK message for performing a delegation of coins // from a delegator to a validator. type MsgDelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` } @@ -211,7 +212,7 @@ func (m *MsgDelegate) Reset() { *m = MsgDelegate{} } func (m *MsgDelegate) String() string { return proto.CompactTextString(m) } func (*MsgDelegate) ProtoMessage() {} func (*MsgDelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{4} + return fileDescriptor_dc1f14f20335eae7, []int{4} } func (m *MsgDelegate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -269,7 +270,7 @@ func (m *MsgDelegateResponse) Reset() { *m = MsgDelegateResponse{} } func (m *MsgDelegateResponse) String() string { return proto.CompactTextString(m) } func (*MsgDelegateResponse) ProtoMessage() {} func (*MsgDelegateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{5} + return fileDescriptor_dc1f14f20335eae7, []int{5} } func (m *MsgDelegateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -301,9 +302,9 @@ var xxx_messageInfo_MsgDelegateResponse proto.InternalMessageInfo // MsgBeginRedelegate defines a SDK message for performing a redelegation // of coins from a delegator and source validator to a destination validator. type MsgBeginRedelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` Amount types1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` } @@ -311,7 +312,7 @@ func (m *MsgBeginRedelegate) Reset() { *m = MsgBeginRedelegate{} } func (m *MsgBeginRedelegate) String() string { return proto.CompactTextString(m) } func (*MsgBeginRedelegate) ProtoMessage() {} func (*MsgBeginRedelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{6} + return fileDescriptor_dc1f14f20335eae7, []int{6} } func (m *MsgBeginRedelegate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -377,7 +378,7 @@ func (m *MsgBeginRedelegateResponse) Reset() { *m = MsgBeginRedelegateRe func (m *MsgBeginRedelegateResponse) String() string { return proto.CompactTextString(m) } func (*MsgBeginRedelegateResponse) ProtoMessage() {} func (*MsgBeginRedelegateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{7} + return fileDescriptor_dc1f14f20335eae7, []int{7} } func (m *MsgBeginRedelegateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -416,8 +417,8 @@ func (m *MsgBeginRedelegateResponse) GetCompletionTime() time.Time { // MsgUndelegate defines a SDK message for performing an undelegation from a // delegate and a validator. type MsgUndelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` } @@ -425,7 +426,7 @@ func (m *MsgUndelegate) Reset() { *m = MsgUndelegate{} } func (m *MsgUndelegate) String() string { return proto.CompactTextString(m) } func (*MsgUndelegate) ProtoMessage() {} func (*MsgUndelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{8} + return fileDescriptor_dc1f14f20335eae7, []int{8} } func (m *MsgUndelegate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -484,7 +485,7 @@ func (m *MsgUndelegateResponse) Reset() { *m = MsgUndelegateResponse{} } func (m *MsgUndelegateResponse) String() string { return proto.CompactTextString(m) } func (*MsgUndelegateResponse) ProtoMessage() {} func (*MsgUndelegateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{9} + return fileDescriptor_dc1f14f20335eae7, []int{9} } func (m *MsgUndelegateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -520,931 +521,4095 @@ func (m *MsgUndelegateResponse) GetCompletionTime() time.Time { return time.Time{} } -func init() { - proto.RegisterType((*MsgCreateValidator)(nil), "cosmos.staking.v1beta1.MsgCreateValidator") - proto.RegisterType((*MsgCreateValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgCreateValidatorResponse") - proto.RegisterType((*MsgEditValidator)(nil), "cosmos.staking.v1beta1.MsgEditValidator") - proto.RegisterType((*MsgEditValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgEditValidatorResponse") - proto.RegisterType((*MsgDelegate)(nil), "cosmos.staking.v1beta1.MsgDelegate") - proto.RegisterType((*MsgDelegateResponse)(nil), "cosmos.staking.v1beta1.MsgDelegateResponse") - proto.RegisterType((*MsgBeginRedelegate)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegate") - proto.RegisterType((*MsgBeginRedelegateResponse)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegateResponse") - proto.RegisterType((*MsgUndelegate)(nil), "cosmos.staking.v1beta1.MsgUndelegate") - proto.RegisterType((*MsgUndelegateResponse)(nil), "cosmos.staking.v1beta1.MsgUndelegateResponse") +// MsgUnbondValidator defines a method for performing the status transition for +// a validator from bonded to unbonded +type MsgUnbondValidator struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"address"` } -func init() { proto.RegisterFile("cosmos/staking/v1beta1/tx.proto", fileDescriptor_0926ef28816b35ab) } - -var fileDescriptor_0926ef28816b35ab = []byte{ - // 861 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4d, 0x6b, 0xe3, 0x46, - 0x18, 0xb6, 0x6c, 0xc7, 0x4d, 0x27, 0xe4, 0x4b, 0xf9, 0xc0, 0x11, 0xc1, 0x0a, 0x4a, 0x3f, 0x42, - 0xdb, 0xc8, 0x4d, 0x4a, 0x29, 0xe4, 0x52, 0xe2, 0xb8, 0xa1, 0x21, 0x35, 0x14, 0x25, 0xed, 0xa1, - 0x14, 0x8c, 0x3e, 0xc6, 0xaa, 0xb0, 0xa4, 0x51, 0x34, 0xe3, 0x10, 0x43, 0x7f, 0x40, 0x8f, 0x81, - 0xde, 0x7a, 0xca, 0x8f, 0xe8, 0x8f, 0x08, 0x81, 0x85, 0x1c, 0x97, 0x3d, 0x78, 0x17, 0x67, 0x0f, - 0x7b, 0xf6, 0x2f, 0x58, 0x34, 0x1a, 0xc9, 0xb2, 0xfc, 0x81, 0x09, 0xeb, 0xcb, 0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 0x44, 0x89, 0xac, 0xa8, 0xce, 0x21, 0xfa, - 0x68, 0xfe, 0x9f, 0x3b, 0x31, 0xf3, 0xee, 0x4e, 0xcc, 0x48, 0xdb, 0x40, 0x18, 0xb6, 0x93, 0x02, - 0xb1, 0x87, 0x5c, 0x0c, 0xa5, 0x7f, 0x73, 0x60, 0xa5, 0x86, 0xcd, 0x9f, 0x0c, 0x8b, 0xcc, 0xc8, - 0x6b, 0x3f, 0x8e, 0xd2, 0x34, 0x4b, 0x35, 0xe5, 0x7b, 0x1d, 0x71, 0x29, 0xd4, 0x74, 0x82, 0x92, - 0x0e, 0x58, 0xee, 0x7b, 0xad, 0xee, 0xab, 0x04, 0x32, 0x67, 0x55, 0xa7, 0x74, 0x55, 0x15, 0xea, - 0xbd, 0x8e, 0xb8, 0x19, 0x06, 0x4a, 0x51, 0x49, 0xca, 0x92, 0x3e, 0xe0, 0x6f, 0xfe, 0x66, 0xb4, - 0x99, 0x43, 0x43, 0xfd, 0x3c, 0x43, 0x23, 0x27, 0x6a, 0x26, 0x80, 0x62, 0xba, 0x28, 0x71, 0xc5, - 0xba, 0x1c, 0x58, 0xa8, 0x61, 0x93, 0x9d, 0x83, 0xa3, 0xed, 0xcf, 0x7d, 0x38, 0xfb, 0x67, 0x9f, - 0x65, 0xff, 0x1f, 0x40, 0x41, 0x75, 0x50, 0xcb, 0x25, 0xb4, 0x56, 0x53, 0xf8, 0x96, 0xc1, 0x8f, - 0xf2, 0x54, 0x80, 0x0d, 0xb0, 0x96, 0xc8, 0x31, 0xce, 0xfd, 0x21, 0x4b, 0x7b, 0x63, 0x05, 0x9a, - 0x96, 0xab, 0x40, 0x63, 0x06, 0x12, 0x5c, 0x82, 0x8d, 0x7e, 0x7e, 0xd8, 0xd7, 0x53, 0x32, 0xec, - 0xf4, 0x3a, 0xe2, 0x76, 0x5a, 0x86, 0x04, 0x4c, 0x52, 0xd6, 0xe2, 0xf5, 0x0b, 0x5f, 0x1f, 0xc9, - 0x6a, 0x60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x8f, 0x4f, 0xa5, 0xcc, 0xcb, 0xa7, 0x52, 0xe6, 0x8f, - 0x6f, 0x26, 0x8e, 0xae, 0x9b, 0xf8, 0xcb, 0x94, 0x0e, 0x31, 0xad, 0x40, 0x2d, 0xf9, 0xdd, 0xfb, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0xdc, 0x0e, 0x15, 0x7e, 0x0b, 0x00, 0x00, +func (m *MsgUnbondValidator) Reset() { *m = MsgUnbondValidator{} } +func (m *MsgUnbondValidator) String() string { return proto.CompactTextString(m) } +func (*MsgUnbondValidator) ProtoMessage() {} +func (*MsgUnbondValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{10} +} +func (m *MsgUnbondValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnbondValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnbondValidator.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 *MsgUnbondValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnbondValidator.Merge(m, src) +} +func (m *MsgUnbondValidator) XXX_Size() int { + return m.Size() +} +func (m *MsgUnbondValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnbondValidator.DiscardUnknown(m) } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var xxx_messageInfo_MsgUnbondValidator proto.InternalMessageInfo -// 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 +func (m *MsgUnbondValidator) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} -// 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 { - // CreateValidator defines a method for creating a new validator. - CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) - // EditValidator defines a method for editing an existing validator. - EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) - // BeginRedelegate defines a method for performing a redelegation - // of coins from a delegator and source validator to a destination validator. - BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) - // Undelegate defines a method for performing an undelegation from a - // delegate and a validator. - Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) +type MsgUnbondValidatorResponse struct { } -type msgClient struct { - cc grpc1.ClientConn +func (m *MsgUnbondValidatorResponse) Reset() { *m = MsgUnbondValidatorResponse{} } +func (m *MsgUnbondValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnbondValidatorResponse) ProtoMessage() {} +func (*MsgUnbondValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{11} +} +func (m *MsgUnbondValidatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnbondValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnbondValidatorResponse.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 *MsgUnbondValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnbondValidatorResponse.Merge(m, src) +} +func (m *MsgUnbondValidatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnbondValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnbondValidatorResponse.DiscardUnknown(m) } -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} +var xxx_messageInfo_MsgUnbondValidatorResponse proto.InternalMessageInfo + +// MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator +// +// Since: cosmos-sdk 0.46 +type MsgCancelUnbondingDelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + // amount is always less than or equal to unbonding delegation entry balance + Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + // creation_height is the height which the unbonding took place. + CreationHeight int64 `protobuf:"varint,4,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` } -func (c *msgClient) CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) { - out := new(MsgCreateValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/CreateValidator", in, out, opts...) - if err != nil { - return nil, err +func (m *MsgCancelUnbondingDelegation) Reset() { *m = MsgCancelUnbondingDelegation{} } +func (m *MsgCancelUnbondingDelegation) String() string { return proto.CompactTextString(m) } +func (*MsgCancelUnbondingDelegation) ProtoMessage() {} +func (*MsgCancelUnbondingDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{12} +} +func (m *MsgCancelUnbondingDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelUnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelUnbondingDelegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *MsgCancelUnbondingDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelUnbondingDelegation.Merge(m, src) +} +func (m *MsgCancelUnbondingDelegation) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelUnbondingDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelUnbondingDelegation.DiscardUnknown(m) } -func (c *msgClient) EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) { - out := new(MsgEditValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/EditValidator", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_MsgCancelUnbondingDelegation proto.InternalMessageInfo + +func (m *MsgCancelUnbondingDelegation) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress } - return out, nil + return "" } -func (c *msgClient) Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { - out := new(MsgDelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Delegate", in, out, opts...) - if err != nil { - return nil, err +func (m *MsgCancelUnbondingDelegation) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress } - return out, nil + return "" } -func (c *msgClient) BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) { - out := new(MsgBeginRedelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/BeginRedelegate", in, out, opts...) - if err != nil { - return nil, err +func (m *MsgCancelUnbondingDelegation) GetAmount() types1.Coin { + if m != nil { + return m.Amount } - return out, nil + return types1.Coin{} } -func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) { - out := new(MsgUndelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Undelegate", in, out, opts...) - if err != nil { - return nil, err +func (m *MsgCancelUnbondingDelegation) GetCreationHeight() int64 { + if m != nil { + return m.CreationHeight } - return out, nil + return 0 } -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateValidator defines a method for creating a new validator. - CreateValidator(context.Context, *MsgCreateValidator) (*MsgCreateValidatorResponse, error) - // EditValidator defines a method for editing an existing validator. - EditValidator(context.Context, *MsgEditValidator) (*MsgEditValidatorResponse, error) - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - Delegate(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) - // BeginRedelegate defines a method for performing a redelegation - // of coins from a delegator and source validator to a destination validator. - BeginRedelegate(context.Context, *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) - // Undelegate defines a method for performing an undelegation from a - // delegate and a validator. - Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) +// MsgCancelUnbondingDelegationResponse +// +// Since: cosmos-sdk 0.46 +type MsgCancelUnbondingDelegationResponse struct { } -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { +func (m *MsgCancelUnbondingDelegationResponse) Reset() { *m = MsgCancelUnbondingDelegationResponse{} } +func (m *MsgCancelUnbondingDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCancelUnbondingDelegationResponse) ProtoMessage() {} +func (*MsgCancelUnbondingDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{13} } - -func (*UnimplementedMsgServer) CreateValidator(ctx context.Context, req *MsgCreateValidator) (*MsgCreateValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateValidator not implemented") +func (m *MsgCancelUnbondingDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedMsgServer) EditValidator(ctx context.Context, req *MsgEditValidator) (*MsgEditValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EditValidator not implemented") +func (m *MsgCancelUnbondingDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelUnbondingDelegationResponse.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 (*UnimplementedMsgServer) Delegate(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delegate not implemented") +func (m *MsgCancelUnbondingDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelUnbondingDelegationResponse.Merge(m, src) } -func (*UnimplementedMsgServer) BeginRedelegate(ctx context.Context, req *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BeginRedelegate not implemented") +func (m *MsgCancelUnbondingDelegationResponse) XXX_Size() int { + return m.Size() } -func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegate) (*MsgUndelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") +func (m *MsgCancelUnbondingDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelUnbondingDelegationResponse.DiscardUnknown(m) } -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) +var xxx_messageInfo_MsgCancelUnbondingDelegationResponse proto.InternalMessageInfo + +type MsgTokenizeShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + TokenizedShareOwner string `protobuf:"bytes,4,opt,name=tokenized_share_owner,json=tokenizedShareOwner,proto3" json:"tokenized_share_owner,omitempty"` } -func _Msg_CreateValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateValidator) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateValidator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/CreateValidator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateValidator(ctx, req.(*MsgCreateValidator)) +func (m *MsgTokenizeShares) Reset() { *m = MsgTokenizeShares{} } +func (m *MsgTokenizeShares) String() string { return proto.CompactTextString(m) } +func (*MsgTokenizeShares) ProtoMessage() {} +func (*MsgTokenizeShares) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{14} +} +func (m *MsgTokenizeShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTokenizeShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTokenizeShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *MsgTokenizeShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTokenizeShares.Merge(m, src) +} +func (m *MsgTokenizeShares) XXX_Size() int { + return m.Size() +} +func (m *MsgTokenizeShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTokenizeShares.DiscardUnknown(m) } -func _Msg_EditValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgEditValidator) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).EditValidator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/EditValidator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).EditValidator(ctx, req.(*MsgEditValidator)) - } - return interceptor(ctx, in, info, handler) +var xxx_messageInfo_MsgTokenizeShares proto.InternalMessageInfo + +type MsgTokenizeSharesResponse struct { + Amount types1.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` } -func _Msg_Delegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Delegate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/Delegate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Delegate(ctx, req.(*MsgDelegate)) +func (m *MsgTokenizeSharesResponse) Reset() { *m = MsgTokenizeSharesResponse{} } +func (m *MsgTokenizeSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTokenizeSharesResponse) ProtoMessage() {} +func (*MsgTokenizeSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{15} +} +func (m *MsgTokenizeSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTokenizeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTokenizeSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *MsgTokenizeSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTokenizeSharesResponse.Merge(m, src) +} +func (m *MsgTokenizeSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTokenizeSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTokenizeSharesResponse.DiscardUnknown(m) } -func _Msg_BeginRedelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBeginRedelegate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).BeginRedelegate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/BeginRedelegate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).BeginRedelegate(ctx, req.(*MsgBeginRedelegate)) - } - return interceptor(ctx, in, info, handler) -} +var xxx_messageInfo_MsgTokenizeSharesResponse proto.InternalMessageInfo -func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUndelegate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Undelegate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/Undelegate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Undelegate(ctx, req.(*MsgUndelegate)) +func (m *MsgTokenizeSharesResponse) GetAmount() types1.Coin { + if m != nil { + return m.Amount } - return interceptor(ctx, in, info, handler) + return types1.Coin{} } -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.staking.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateValidator", - Handler: _Msg_CreateValidator_Handler, - }, - { - MethodName: "EditValidator", - Handler: _Msg_EditValidator_Handler, - }, - { - MethodName: "Delegate", - Handler: _Msg_Delegate_Handler, - }, - { - MethodName: "BeginRedelegate", - Handler: _Msg_BeginRedelegate_Handler, - }, - { - MethodName: "Undelegate", - Handler: _Msg_Undelegate_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/staking/v1beta1/tx.proto", +type MsgRedeemTokensforShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + Amount types1.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` } -func (m *MsgCreateValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *MsgRedeemTokensforShares) Reset() { *m = MsgRedeemTokensforShares{} } +func (m *MsgRedeemTokensforShares) String() string { return proto.CompactTextString(m) } +func (*MsgRedeemTokensforShares) ProtoMessage() {} +func (*MsgRedeemTokensforShares) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{16} +} +func (m *MsgRedeemTokensforShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRedeemTokensforShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRedeemTokensforShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return dAtA[:n], nil +} +func (m *MsgRedeemTokensforShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRedeemTokensforShares.Merge(m, src) +} +func (m *MsgRedeemTokensforShares) XXX_Size() int { + return m.Size() +} +func (m *MsgRedeemTokensforShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRedeemTokensforShares.DiscardUnknown(m) } -func (m *MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var xxx_messageInfo_MsgRedeemTokensforShares proto.InternalMessageInfo + +type MsgRedeemTokensforSharesResponse struct { + Amount types1.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` } -func (m *MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) +func (m *MsgRedeemTokensforSharesResponse) Reset() { *m = MsgRedeemTokensforSharesResponse{} } +func (m *MsgRedeemTokensforSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRedeemTokensforSharesResponse) ProtoMessage() {} +func (*MsgRedeemTokensforSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{17} +} +func (m *MsgRedeemTokensforSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRedeemTokensforSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRedeemTokensforSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - 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)) + return nil, err } - i-- - dAtA[i] = 0x32 - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x2a - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0x22 + return b[:n], nil } - { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) +} +func (m *MsgRedeemTokensforSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRedeemTokensforSharesResponse.Merge(m, src) +} +func (m *MsgRedeemTokensforSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRedeemTokensforSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRedeemTokensforSharesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRedeemTokensforSharesResponse proto.InternalMessageInfo + +func (m *MsgRedeemTokensforSharesResponse) GetAmount() types1.Coin { + if m != nil { + return m.Amount } - i-- - dAtA[i] = 0x1a - { - size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + return types1.Coin{} +} + +type MsgTransferTokenizeShareRecord struct { + TokenizeShareRecordId uint64 `protobuf:"varint,1,opt,name=tokenize_share_record_id,json=tokenizeShareRecordId,proto3" json:"tokenize_share_record_id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + NewOwner string `protobuf:"bytes,3,opt,name=new_owner,json=newOwner,proto3" json:"new_owner,omitempty"` +} + +func (m *MsgTransferTokenizeShareRecord) Reset() { *m = MsgTransferTokenizeShareRecord{} } +func (m *MsgTransferTokenizeShareRecord) String() string { return proto.CompactTextString(m) } +func (*MsgTransferTokenizeShareRecord) ProtoMessage() {} +func (*MsgTransferTokenizeShareRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{18} +} +func (m *MsgTransferTokenizeShareRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferTokenizeShareRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferTokenizeShareRecord.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + return b[:n], nil } - i-- - dAtA[i] = 0x12 - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) +} +func (m *MsgTransferTokenizeShareRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferTokenizeShareRecord.Merge(m, src) +} +func (m *MsgTransferTokenizeShareRecord) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferTokenizeShareRecord) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferTokenizeShareRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferTokenizeShareRecord proto.InternalMessageInfo + +type MsgTransferTokenizeShareRecordResponse struct { +} + +func (m *MsgTransferTokenizeShareRecordResponse) Reset() { + *m = MsgTransferTokenizeShareRecordResponse{} +} +func (m *MsgTransferTokenizeShareRecordResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTransferTokenizeShareRecordResponse) ProtoMessage() {} +func (*MsgTransferTokenizeShareRecordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{19} +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferTokenizeShareRecordResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + return b[:n], nil } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil } - -func (m *MsgCreateValidatorResponse) 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 *MsgTransferTokenizeShareRecordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferTokenizeShareRecordResponse.Merge(m, src) } - -func (m *MsgCreateValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *MsgTransferTokenizeShareRecordResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferTokenizeShareRecordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferTokenizeShareRecordResponse.DiscardUnknown(m) } -func (m *MsgCreateValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +var xxx_messageInfo_MsgTransferTokenizeShareRecordResponse proto.InternalMessageInfo + +type MsgDisableTokenizeShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` } -func (m *MsgEditValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *MsgDisableTokenizeShares) Reset() { *m = MsgDisableTokenizeShares{} } +func (m *MsgDisableTokenizeShares) String() string { return proto.CompactTextString(m) } +func (*MsgDisableTokenizeShares) ProtoMessage() {} +func (*MsgDisableTokenizeShares) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{20} +} +func (m *MsgDisableTokenizeShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableTokenizeShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableTokenizeShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return dAtA[:n], nil +} +func (m *MsgDisableTokenizeShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableTokenizeShares.Merge(m, src) +} +func (m *MsgDisableTokenizeShares) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableTokenizeShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableTokenizeShares.DiscardUnknown(m) } -func (m *MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var xxx_messageInfo_MsgDisableTokenizeShares proto.InternalMessageInfo + +type MsgDisableTokenizeSharesResponse struct { } -func (m *MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MinSelfDelegation != nil { - { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.CommissionRate != nil { - { - size := m.CommissionRate.Size() - i -= size - if _, err := m.CommissionRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) +func (m *MsgDisableTokenizeSharesResponse) Reset() { *m = MsgDisableTokenizeSharesResponse{} } +func (m *MsgDisableTokenizeSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDisableTokenizeSharesResponse) ProtoMessage() {} +func (*MsgDisableTokenizeSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{21} +} +func (m *MsgDisableTokenizeSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableTokenizeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableTokenizeSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + return b[:n], nil } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil } - -func (m *MsgEditValidatorResponse) 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 *MsgDisableTokenizeSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableTokenizeSharesResponse.Merge(m, src) } - -func (m *MsgEditValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *MsgDisableTokenizeSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableTokenizeSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableTokenizeSharesResponse.DiscardUnknown(m) } -func (m *MsgEditValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +var xxx_messageInfo_MsgDisableTokenizeSharesResponse proto.InternalMessageInfo + +type MsgEnableTokenizeShares struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` } -func (m *MsgDelegate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *MsgEnableTokenizeShares) Reset() { *m = MsgEnableTokenizeShares{} } +func (m *MsgEnableTokenizeShares) String() string { return proto.CompactTextString(m) } +func (*MsgEnableTokenizeShares) ProtoMessage() {} +func (*MsgEnableTokenizeShares) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{22} +} +func (m *MsgEnableTokenizeShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableTokenizeShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableTokenizeShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return dAtA[:n], nil +} +func (m *MsgEnableTokenizeShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableTokenizeShares.Merge(m, src) +} +func (m *MsgEnableTokenizeShares) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableTokenizeShares) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableTokenizeShares.DiscardUnknown(m) } -func (m *MsgDelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var xxx_messageInfo_MsgEnableTokenizeShares proto.InternalMessageInfo + +type MsgEnableTokenizeSharesResponse struct { + CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` } -func (m *MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) +func (m *MsgEnableTokenizeSharesResponse) Reset() { *m = MsgEnableTokenizeSharesResponse{} } +func (m *MsgEnableTokenizeSharesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEnableTokenizeSharesResponse) ProtoMessage() {} +func (*MsgEnableTokenizeSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{23} +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableTokenizeSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa + return b[:n], nil } - return len(dAtA) - i, nil +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableTokenizeSharesResponse.Merge(m, src) +} +func (m *MsgEnableTokenizeSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableTokenizeSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableTokenizeSharesResponse.DiscardUnknown(m) } -func (m *MsgDelegateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +var xxx_messageInfo_MsgEnableTokenizeSharesResponse proto.InternalMessageInfo + +func (m *MsgEnableTokenizeSharesResponse) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime } - return dAtA[:n], nil + return time.Time{} } -func (m *MsgDelegateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// MsgValidatorBond defines a SDK message for performing validator self-bond of delegated coins +// from a delegator to a validator. +type MsgValidatorBond struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } -func (m *MsgDelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (m *MsgValidatorBond) Reset() { *m = MsgValidatorBond{} } +func (m *MsgValidatorBond) String() string { return proto.CompactTextString(m) } +func (*MsgValidatorBond) ProtoMessage() {} +func (*MsgValidatorBond) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{24} } - -func (m *MsgBeginRedelegate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *MsgValidatorBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgValidatorBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgValidatorBond.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return dAtA[:n], nil +} +func (m *MsgValidatorBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgValidatorBond.Merge(m, src) +} +func (m *MsgValidatorBond) XXX_Size() int { + return m.Size() +} +func (m *MsgValidatorBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgValidatorBond.DiscardUnknown(m) } -func (m *MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var xxx_messageInfo_MsgValidatorBond proto.InternalMessageInfo + +type MsgValidatorBondResponse struct { } -func (m *MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) +func (m *MsgValidatorBondResponse) Reset() { *m = MsgValidatorBondResponse{} } +func (m *MsgValidatorBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgValidatorBondResponse) ProtoMessage() {} +func (*MsgValidatorBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc1f14f20335eae7, []int{25} +} +func (m *MsgValidatorBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgValidatorBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgValidatorBondResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.ValidatorDstAddress) > 0 { - i -= len(m.ValidatorDstAddress) - copy(dAtA[i:], m.ValidatorDstAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorDstAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorSrcAddress) > 0 { - i -= len(m.ValidatorSrcAddress) - copy(dAtA[i:], m.ValidatorSrcAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorSrcAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa + return b[:n], nil } - return len(dAtA) - i, nil +} +func (m *MsgValidatorBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgValidatorBondResponse.Merge(m, src) +} +func (m *MsgValidatorBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgValidatorBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgValidatorBondResponse.DiscardUnknown(m) } -func (m *MsgBeginRedelegateResponse) 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 +var xxx_messageInfo_MsgValidatorBondResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateValidator)(nil), "cosmos.staking.v1beta1.MsgCreateValidator") + proto.RegisterType((*MsgCreateValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgCreateValidatorResponse") + proto.RegisterType((*MsgEditValidator)(nil), "cosmos.staking.v1beta1.MsgEditValidator") + proto.RegisterType((*MsgEditValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgEditValidatorResponse") + proto.RegisterType((*MsgDelegate)(nil), "cosmos.staking.v1beta1.MsgDelegate") + proto.RegisterType((*MsgDelegateResponse)(nil), "cosmos.staking.v1beta1.MsgDelegateResponse") + proto.RegisterType((*MsgBeginRedelegate)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegate") + proto.RegisterType((*MsgBeginRedelegateResponse)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegateResponse") + proto.RegisterType((*MsgUndelegate)(nil), "cosmos.staking.v1beta1.MsgUndelegate") + proto.RegisterType((*MsgUndelegateResponse)(nil), "cosmos.staking.v1beta1.MsgUndelegateResponse") + proto.RegisterType((*MsgUnbondValidator)(nil), "cosmos.staking.v1beta1.MsgUnbondValidator") + proto.RegisterType((*MsgUnbondValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgUnbondValidatorResponse") + proto.RegisterType((*MsgCancelUnbondingDelegation)(nil), "cosmos.staking.v1beta1.MsgCancelUnbondingDelegation") + proto.RegisterType((*MsgCancelUnbondingDelegationResponse)(nil), "cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse") + proto.RegisterType((*MsgTokenizeShares)(nil), "cosmos.staking.v1beta1.MsgTokenizeShares") + proto.RegisterType((*MsgTokenizeSharesResponse)(nil), "cosmos.staking.v1beta1.MsgTokenizeSharesResponse") + proto.RegisterType((*MsgRedeemTokensforShares)(nil), "cosmos.staking.v1beta1.MsgRedeemTokensforShares") + proto.RegisterType((*MsgRedeemTokensforSharesResponse)(nil), "cosmos.staking.v1beta1.MsgRedeemTokensforSharesResponse") + proto.RegisterType((*MsgTransferTokenizeShareRecord)(nil), "cosmos.staking.v1beta1.MsgTransferTokenizeShareRecord") + proto.RegisterType((*MsgTransferTokenizeShareRecordResponse)(nil), "cosmos.staking.v1beta1.MsgTransferTokenizeShareRecordResponse") + proto.RegisterType((*MsgDisableTokenizeShares)(nil), "cosmos.staking.v1beta1.MsgDisableTokenizeShares") + proto.RegisterType((*MsgDisableTokenizeSharesResponse)(nil), "cosmos.staking.v1beta1.MsgDisableTokenizeSharesResponse") + proto.RegisterType((*MsgEnableTokenizeShares)(nil), "cosmos.staking.v1beta1.MsgEnableTokenizeShares") + proto.RegisterType((*MsgEnableTokenizeSharesResponse)(nil), "cosmos.staking.v1beta1.MsgEnableTokenizeSharesResponse") + proto.RegisterType((*MsgValidatorBond)(nil), "cosmos.staking.v1beta1.MsgValidatorBond") + proto.RegisterType((*MsgValidatorBondResponse)(nil), "cosmos.staking.v1beta1.MsgValidatorBondResponse") } -func (m *MsgBeginRedelegateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func init() { proto.RegisterFile("staking/v1beta1/tx.proto", fileDescriptor_dc1f14f20335eae7) } + +var fileDescriptor_dc1f14f20335eae7 = []byte{ + // 1355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x6f, 0x13, 0xc7, + 0x1b, 0xf6, 0x3a, 0x26, 0xbf, 0x30, 0x40, 0x02, 0x9b, 0x04, 0x9c, 0x85, 0x9f, 0x8d, 0x4c, 0x0b, + 0x29, 0x95, 0xed, 0x42, 0x69, 0x41, 0x11, 0x2a, 0xc2, 0x98, 0xaa, 0x08, 0xac, 0x56, 0x1b, 0x52, + 0xa9, 0x1f, 0x92, 0xb5, 0xde, 0x1d, 0x6f, 0x46, 0xde, 0x9d, 0x71, 0x76, 0xd6, 0x09, 0xe6, 0x44, + 0xdb, 0x4b, 0x6f, 0x45, 0xaa, 0x2a, 0xb5, 0x37, 0x0e, 0x3d, 0x71, 0xaa, 0x2a, 0xfe, 0x08, 0x54, + 0xf5, 0x80, 0x38, 0x55, 0x3d, 0xa4, 0x6d, 0x72, 0x68, 0x8f, 0x15, 0x7f, 0x41, 0xb5, 0x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0xf3, 0x3d, 0x41, 0xa8, 0xa3, 0x8f, 0x2c, 0xca, 0xac, 0x30, 0x5b, 0x76, 0xf4, 0x58, 0x36, 0x83, + 0xba, 0x82, 0x6d, 0x62, 0x64, 0xb6, 0x2a, 0x75, 0x07, 0x55, 0xce, 0xec, 0x9e, 0xca, 0x2d, 0xd6, + 0x28, 0x22, 0x6a, 0x06, 0x62, 0xcb, 0x35, 0x56, 0x7f, 0x6d, 0x0b, 0x7a, 0x09, 0x5c, 0xf7, 0x26, + 0x2a, 0xef, 0x0b, 0xca, 0x40, 0x13, 0xbc, 0x1d, 0x8c, 0xdb, 0xca, 0x94, 0xb7, 0xf9, 0xfd, 0x9f, + 0xf2, 0x12, 0xab, 0x35, 0x6e, 0xec, 0x2d, 0x17, 0x9e, 0x49, 0xe0, 0x50, 0x8d, 0x9a, 0x2b, 0xd8, + 0xf8, 0x0f, 0xe5, 0x71, 0x13, 0xcc, 0xf7, 0x9d, 0x79, 0xaf, 0xc4, 0x5d, 0x61, 0x75, 0xb1, 0x82, + 0x1b, 0x04, 0x1b, 0xbd, 0xae, 0x7e, 0x25, 0x4e, 0x19, 0x5f, 0x60, 0xf9, 0xd9, 0x66, 0x7e, 0xba, + 0xab, 0xd9, 0xd6, 0x52, 0x21, 0xf0, 0x75, 0x50, 0x13, 0x3e, 0x49, 0x22, 0xb4, 0xa2, 0x1a, 0x1f, + 0xa6, 0xc1, 0x09, 0x6f, 0xd0, 0x68, 0x58, 0x87, 0x96, 0x0f, 0x42, 0xd8, 0xdc, 0x69, 0x96, 0xff, + 0xe3, 0x02, 0x2c, 0x9f, 0x01, 0x33, 0xba, 0x37, 0x4c, 0xbd, 0x48, 0xad, 0x42, 0x64, 0xae, 0xfa, + 0x45, 0x38, 0xa1, 0x4e, 0x07, 0x8f, 0xdf, 0x62, 0x4f, 0x13, 0x33, 0xe1, 0x34, 0x78, 0x21, 0x49, + 0x2b, 0x21, 0xea, 0xb7, 0x69, 0x70, 0xa4, 0x46, 0xc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b0, 0x28, + 0xc5, 0xba, 0x20, 0xfc, 0xbc, 0x27, 0x81, 0x63, 0xde, 0x2d, 0x10, 0xff, 0x75, 0x6e, 0xb6, 0x41, + 0x7e, 0x88, 0x07, 0x7b, 0x35, 0xba, 0x1e, 0x4a, 0xec, 0x7d, 0x44, 0x8c, 0x97, 0x0a, 0xc1, 0xc6, + 0xdf, 0xab, 0xdf, 0x85, 0x72, 0xce, 0xbf, 0xa6, 0xf7, 0xf9, 0x1a, 0xe8, 0x72, 0xfe, 0xab, 0x83, + 0x60, 0xa2, 0x46, 0x4d, 0x79, 0x0d, 0xcc, 0x44, 0x5f, 0xef, 0xcf, 0x0e, 0x7b, 0x93, 0x1a, 0x7c, + 0x4f, 0x53, 0xce, 0x8f, 0x8e, 0x15, 0x21, 0x69, 0x81, 0x43, 0xfd, 0xef, 0x73, 0x8b, 0x09, 0x24, + 0x7d, 0x48, 0xe5, 0x95, 0x51, 0x91, 0x62, 0xb3, 0x0f, 0xc1, 0x94, 0x78, 0x15, 0x39, 0x95, 0x60, + 0x1d, 0x80, 0x94, 0x97, 0x47, 0x00, 0x09, 0xf6, 0x35, 0x30, 0x13, 0xbd, 0xde, 0x27, 0xa9, 0x17, + 0xc1, 0x26, 0xaa, 0x37, 0xec, 0xa2, 0xdb, 0x00, 0x20, 0x74, 0x2b, 0x7d, 0x31, 0x81, 0xa1, 0x07, + 0x53, 0x8a, 0x23, 0xc1, 0xc2, 0xc7, 0x8a, 0xde, 0xce, 0xce, 0x26, 0x32, 0xf4, 0x61, 0x13, 0x8f, + 0x35, 0xe4, 0x7a, 0x26, 0x7f, 0x26, 0x81, 0x85, 0xe1, 0x77, 0xb3, 0x0b, 0x49, 0x69, 0x36, 0xcc, + 0x4a, 0xb9, 0xfc, 0x3c, 0x56, 0xc2, 0x23, 0x0c, 0xa6, 0x23, 0x5d, 0xed, 0xa5, 0x04, 0xbe, 0x7e, + 0xa8, 0x72, 0x6e, 0x64, 0xa8, 0xd8, 0xef, 0x2e, 0x38, 0x18, 0x1e, 0x8b, 0x72, 0x52, 0xae, 0xc7, + 0xce, 0x4f, 0xe5, 0xd2, 0xb8, 0x16, 0x62, 0xef, 0x2f, 0x24, 0x70, 0x3c, 0x69, 0x6a, 0xbe, 0x9e, + 0x74, 0x9c, 0xe1, 0x76, 0xca, 0x1b, 0xcf, 0x67, 0x27, 0xfc, 0xfa, 0x44, 0x02, 0xf3, 0xf1, 0x83, + 0x30, 0x49, 0x9d, 0x58, 0x8b, 0x44, 0x75, 0x12, 0x27, 0x9d, 0x7c, 0x4f, 0x02, 0x73, 0xb1, 0x63, + 0xae, 0x9c, 0xd4, 0x8e, 0x62, 0x0c, 0x94, 0x8b, 0x63, 0x1a, 0x84, 0x7b, 0x66, 0xff, 0xcc, 0x49, + 0xea, 0x99, 0x7d, 0xc8, 0xc4, 0x9e, 0x19, 0x3b, 0x1b, 0x2a, 0xef, 0x3d, 0xde, 0xca, 0x49, 0x4f, + 0xb6, 0x72, 0xd2, 0xcf, 0x5b, 0x39, 0xe9, 0xfe, 0x76, 0x2e, 0xf5, 0x64, 0x3b, 0x97, 0xfa, 0x61, + 0x3b, 0x97, 0x7a, 0xff, 0x4a, 0xe8, 0x1f, 0x26, 0xb4, 0x66, 0x75, 0x28, 0x22, 0x18, 0x61, 0xbd, + 0x6c, 0xa1, 0xb5, 0x0e, 0x32, 0x90, 0xdb, 0x2d, 0xf2, 0x4d, 0x8a, 0x36, 0x31, 0x3a, 0x16, 0x2c, + 0xdf, 0x09, 0xfe, 0x6a, 0xf6, 0xff, 0x7e, 0x6a, 0x4c, 0xb2, 0x69, 0xfb, 0xea, 0x1f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x9e, 0xad, 0xa8, 0xf8, 0x51, 0x17, 0x00, 0x00, } -func (m *MsgBeginRedelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintTx(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil +// 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 { + // CreateValidator defines a method for creating a new validator. + CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) + // EditValidator defines a method for editing an existing validator. + EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) + // BeginRedelegate defines a method for performing a redelegation + // of coins from a delegator and source validator to a destination validator. + BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) + // Undelegate defines a method for performing an undelegation from a + // delegate and a validator. + Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) + // UnbondValidator defines a method for performing the status transition for a validator + // from bonded to unbonded + UnbondValidator(ctx context.Context, in *MsgUnbondValidator, opts ...grpc.CallOption) (*MsgUnbondValidatorResponse, error) + // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + // and delegate back to previous validator. + // + // Since: cosmos-sdk 0.46 + CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) + // TokenizeShares defines a method for tokenizing shares from a validator. + TokenizeShares(ctx context.Context, in *MsgTokenizeShares, opts ...grpc.CallOption) (*MsgTokenizeSharesResponse, error) + // RedeemTokens defines a method for redeeming tokens from a validator for + // shares. + RedeemTokens(ctx context.Context, in *MsgRedeemTokensforShares, opts ...grpc.CallOption) (*MsgRedeemTokensforSharesResponse, error) + // TransferTokenizeShareRecord defines a method to transfer ownership of + // TokenizeShareRecord + TransferTokenizeShareRecord(ctx context.Context, in *MsgTransferTokenizeShareRecord, opts ...grpc.CallOption) (*MsgTransferTokenizeShareRecordResponse, error) + // DisableTokenizeShares defines a method to prevent the tokenization of an addresses stake + DisableTokenizeShares(ctx context.Context, in *MsgDisableTokenizeShares, opts ...grpc.CallOption) (*MsgDisableTokenizeSharesResponse, error) + // EnableTokenizeShares defines a method to re-enable the tokenization of an addresseses stake + // after it has been disabled + EnableTokenizeShares(ctx context.Context, in *MsgEnableTokenizeShares, opts ...grpc.CallOption) (*MsgEnableTokenizeSharesResponse, error) + // ValidatorBond defines a method for performing a validator self-bond + ValidatorBond(ctx context.Context, in *MsgValidatorBond, opts ...grpc.CallOption) (*MsgValidatorBondResponse, error) } -func (m *MsgUndelegate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) { + out := new(MsgCreateValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/CreateValidator", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *msgClient) EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) { + out := new(MsgEditValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/EditValidator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa +func (c *msgClient) Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { + out := new(MsgDelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Delegate", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *MsgUndelegateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *msgClient) BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) { + out := new(MsgBeginRedelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/BeginRedelegate", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *MsgUndelegateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) { + out := new(MsgUndelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Undelegate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *MsgUndelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err10 != nil { - return 0, err10 +func (c *msgClient) UnbondValidator(ctx context.Context, in *MsgUnbondValidator, opts ...grpc.CallOption) (*MsgUnbondValidatorResponse, error) { + out := new(MsgUnbondValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/UnbondValidator", in, out, opts...) + if err != nil { + return nil, err } - i -= n10 - i = encodeVarintTx(dAtA, i, uint64(n10)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + return out, 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++ +func (c *msgClient) CancelUnbondingDelegation(ctx context.Context, in *MsgCancelUnbondingDelegation, opts ...grpc.CallOption) (*MsgCancelUnbondingDelegationResponse, error) { + out := new(MsgCancelUnbondingDelegationResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation", in, out, opts...) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return out, nil } -func (m *MsgCreateValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Description.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Commission.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.MinSelfDelegation.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Pubkey != nil { - l = m.Pubkey.Size() - n += 1 + l + sovTx(uint64(l)) + +func (c *msgClient) TokenizeShares(ctx context.Context, in *MsgTokenizeShares, opts ...grpc.CallOption) (*MsgTokenizeSharesResponse, error) { + out := new(MsgTokenizeSharesResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/TokenizeShares", in, out, opts...) + if err != nil { + return nil, err } - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - return n + return out, nil } -func (m *MsgCreateValidatorResponse) Size() (n int) { - if m == nil { - return 0 +func (c *msgClient) RedeemTokens(ctx context.Context, in *MsgRedeemTokensforShares, opts ...grpc.CallOption) (*MsgRedeemTokensforSharesResponse, error) { + out := new(MsgRedeemTokensforSharesResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/RedeemTokens", in, out, opts...) + if err != nil { + return nil, err } - var l int - _ = l - return n + return out, nil } -func (m *MsgEditValidator) 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.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.CommissionRate != nil { - l = m.CommissionRate.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.MinSelfDelegation != nil { - l = m.MinSelfDelegation.Size() - n += 1 + l + sovTx(uint64(l)) +func (c *msgClient) TransferTokenizeShareRecord(ctx context.Context, in *MsgTransferTokenizeShareRecord, opts ...grpc.CallOption) (*MsgTransferTokenizeShareRecordResponse, error) { + out := new(MsgTransferTokenizeShareRecordResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/TransferTokenizeShareRecord", in, out, opts...) + if err != nil { + return nil, err } - return n + return out, nil } -func (m *MsgEditValidatorResponse) Size() (n int) { - if m == nil { - return 0 +func (c *msgClient) DisableTokenizeShares(ctx context.Context, in *MsgDisableTokenizeShares, opts ...grpc.CallOption) (*MsgDisableTokenizeSharesResponse, error) { + out := new(MsgDisableTokenizeSharesResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/DisableTokenizeShares", in, out, opts...) + if err != nil { + return nil, err } - var l int - _ = l - return n + return out, nil } -func (m *MsgDelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (c *msgClient) EnableTokenizeShares(ctx context.Context, in *MsgEnableTokenizeShares, opts ...grpc.CallOption) (*MsgEnableTokenizeSharesResponse, error) { + out := new(MsgEnableTokenizeSharesResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/EnableTokenizeShares", in, out, opts...) + if err != nil { + return nil, err } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n + return out, nil } -func (m *MsgDelegateResponse) Size() (n int) { - if m == nil { - return 0 +func (c *msgClient) ValidatorBond(ctx context.Context, in *MsgValidatorBond, opts ...grpc.CallOption) (*MsgValidatorBondResponse, error) { + out := new(MsgValidatorBondResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/ValidatorBond", in, out, opts...) + if err != nil { + return nil, err } - var l int - _ = l - return n + return out, nil } -func (m *MsgBeginRedelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorDstAddress) - if l > 0 { +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateValidator defines a method for creating a new validator. + CreateValidator(context.Context, *MsgCreateValidator) (*MsgCreateValidatorResponse, error) + // EditValidator defines a method for editing an existing validator. + EditValidator(context.Context, *MsgEditValidator) (*MsgEditValidatorResponse, error) + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + Delegate(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) + // BeginRedelegate defines a method for performing a redelegation + // of coins from a delegator and source validator to a destination validator. + BeginRedelegate(context.Context, *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) + // Undelegate defines a method for performing an undelegation from a + // delegate and a validator. + Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) + // UnbondValidator defines a method for performing the status transition for a validator + // from bonded to unbonded + UnbondValidator(context.Context, *MsgUnbondValidator) (*MsgUnbondValidatorResponse, error) + // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + // and delegate back to previous validator. + // + // Since: cosmos-sdk 0.46 + CancelUnbondingDelegation(context.Context, *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) + // TokenizeShares defines a method for tokenizing shares from a validator. + TokenizeShares(context.Context, *MsgTokenizeShares) (*MsgTokenizeSharesResponse, error) + // RedeemTokens defines a method for redeeming tokens from a validator for + // shares. + RedeemTokens(context.Context, *MsgRedeemTokensforShares) (*MsgRedeemTokensforSharesResponse, error) + // TransferTokenizeShareRecord defines a method to transfer ownership of + // TokenizeShareRecord + TransferTokenizeShareRecord(context.Context, *MsgTransferTokenizeShareRecord) (*MsgTransferTokenizeShareRecordResponse, error) + // DisableTokenizeShares defines a method to prevent the tokenization of an addresses stake + DisableTokenizeShares(context.Context, *MsgDisableTokenizeShares) (*MsgDisableTokenizeSharesResponse, error) + // EnableTokenizeShares defines a method to re-enable the tokenization of an addresseses stake + // after it has been disabled + EnableTokenizeShares(context.Context, *MsgEnableTokenizeShares) (*MsgEnableTokenizeSharesResponse, error) + // ValidatorBond defines a method for performing a validator self-bond + ValidatorBond(context.Context, *MsgValidatorBond) (*MsgValidatorBondResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateValidator(ctx context.Context, req *MsgCreateValidator) (*MsgCreateValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateValidator not implemented") +} +func (*UnimplementedMsgServer) EditValidator(ctx context.Context, req *MsgEditValidator) (*MsgEditValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EditValidator not implemented") +} +func (*UnimplementedMsgServer) Delegate(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delegate not implemented") +} +func (*UnimplementedMsgServer) BeginRedelegate(ctx context.Context, req *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BeginRedelegate not implemented") +} +func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegate) (*MsgUndelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") +} +func (*UnimplementedMsgServer) UnbondValidator(ctx context.Context, req *MsgUnbondValidator) (*MsgUnbondValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnbondValidator not implemented") +} +func (*UnimplementedMsgServer) CancelUnbondingDelegation(ctx context.Context, req *MsgCancelUnbondingDelegation) (*MsgCancelUnbondingDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelUnbondingDelegation not implemented") +} +func (*UnimplementedMsgServer) TokenizeShares(ctx context.Context, req *MsgTokenizeShares) (*MsgTokenizeSharesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenizeShares not implemented") +} +func (*UnimplementedMsgServer) RedeemTokens(ctx context.Context, req *MsgRedeemTokensforShares) (*MsgRedeemTokensforSharesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RedeemTokens not implemented") +} +func (*UnimplementedMsgServer) TransferTokenizeShareRecord(ctx context.Context, req *MsgTransferTokenizeShareRecord) (*MsgTransferTokenizeShareRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TransferTokenizeShareRecord not implemented") +} +func (*UnimplementedMsgServer) DisableTokenizeShares(ctx context.Context, req *MsgDisableTokenizeShares) (*MsgDisableTokenizeSharesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisableTokenizeShares not implemented") +} +func (*UnimplementedMsgServer) EnableTokenizeShares(ctx context.Context, req *MsgEnableTokenizeShares) (*MsgEnableTokenizeSharesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EnableTokenizeShares not implemented") +} +func (*UnimplementedMsgServer) ValidatorBond(ctx context.Context, req *MsgValidatorBond) (*MsgValidatorBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidatorBond not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateValidator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/CreateValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateValidator(ctx, req.(*MsgCreateValidator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_EditValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEditValidator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EditValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/EditValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EditValidator(ctx, req.(*MsgEditValidator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Delegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Delegate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/Delegate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Delegate(ctx, req.(*MsgDelegate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_BeginRedelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBeginRedelegate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).BeginRedelegate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/BeginRedelegate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).BeginRedelegate(ctx, req.(*MsgBeginRedelegate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUndelegate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Undelegate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/Undelegate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Undelegate(ctx, req.(*MsgUndelegate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UnbondValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnbondValidator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UnbondValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/UnbondValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UnbondValidator(ctx, req.(*MsgUnbondValidator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CancelUnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelUnbondingDelegation) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelUnbondingDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelUnbondingDelegation(ctx, req.(*MsgCancelUnbondingDelegation)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_TokenizeShares_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTokenizeShares) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TokenizeShares(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/TokenizeShares", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TokenizeShares(ctx, req.(*MsgTokenizeShares)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RedeemTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRedeemTokensforShares) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RedeemTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/RedeemTokens", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RedeemTokens(ctx, req.(*MsgRedeemTokensforShares)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_TransferTokenizeShareRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTransferTokenizeShareRecord) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TransferTokenizeShareRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/TransferTokenizeShareRecord", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TransferTokenizeShareRecord(ctx, req.(*MsgTransferTokenizeShareRecord)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DisableTokenizeShares_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDisableTokenizeShares) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DisableTokenizeShares(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/DisableTokenizeShares", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DisableTokenizeShares(ctx, req.(*MsgDisableTokenizeShares)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_EnableTokenizeShares_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEnableTokenizeShares) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EnableTokenizeShares(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/EnableTokenizeShares", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EnableTokenizeShares(ctx, req.(*MsgEnableTokenizeShares)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ValidatorBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgValidatorBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ValidatorBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/ValidatorBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ValidatorBond(ctx, req.(*MsgValidatorBond)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.staking.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateValidator", + Handler: _Msg_CreateValidator_Handler, + }, + { + MethodName: "EditValidator", + Handler: _Msg_EditValidator_Handler, + }, + { + MethodName: "Delegate", + Handler: _Msg_Delegate_Handler, + }, + { + MethodName: "BeginRedelegate", + Handler: _Msg_BeginRedelegate_Handler, + }, + { + MethodName: "Undelegate", + Handler: _Msg_Undelegate_Handler, + }, + { + MethodName: "UnbondValidator", + Handler: _Msg_UnbondValidator_Handler, + }, + { + MethodName: "CancelUnbondingDelegation", + Handler: _Msg_CancelUnbondingDelegation_Handler, + }, + { + MethodName: "TokenizeShares", + Handler: _Msg_TokenizeShares_Handler, + }, + { + MethodName: "RedeemTokens", + Handler: _Msg_RedeemTokens_Handler, + }, + { + MethodName: "TransferTokenizeShareRecord", + Handler: _Msg_TransferTokenizeShareRecord_Handler, + }, + { + MethodName: "DisableTokenizeShares", + Handler: _Msg_DisableTokenizeShares_Handler, + }, + { + MethodName: "EnableTokenizeShares", + Handler: _Msg_EnableTokenizeShares_Handler, + }, + { + MethodName: "ValidatorBond", + Handler: _Msg_ValidatorBond_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "staking/v1beta1/tx.proto", +} + +func (m *MsgCreateValidator) 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 *MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + 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] = 0x32 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x2a + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0x22 + } + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + 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 *MsgCreateValidatorResponse) 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 *MsgCreateValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEditValidator) 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 *MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinSelfDelegation != nil { + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.CommissionRate != nil { + { + size := m.CommissionRate.Size() + i -= size + if _, err := m.CommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + 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 *MsgEditValidatorResponse) 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 *MsgEditValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDelegate) 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 *MsgDelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDelegateResponse) 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 *MsgDelegateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgBeginRedelegate) 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 *MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBeginRedelegateResponse) 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 *MsgBeginRedelegateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBeginRedelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintTx(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgUndelegate) 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 *MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUndelegateResponse) 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 *MsgUndelegateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintTx(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgUnbondValidator) 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 *MsgUnbondValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbondValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUnbondValidatorResponse) 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 *MsgUnbondValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnbondValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCancelUnbondingDelegation) 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 *MsgCancelUnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelUnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCancelUnbondingDelegationResponse) 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 *MsgCancelUnbondingDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgTokenizeShares) 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 *MsgTokenizeShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTokenizeShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenizedShareOwner) > 0 { + i -= len(m.TokenizedShareOwner) + copy(dAtA[i:], m.TokenizedShareOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenizedShareOwner))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTokenizeSharesResponse) 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 *MsgTokenizeSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTokenizeSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.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 *MsgRedeemTokensforShares) 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 *MsgRedeemTokensforShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRedeemTokensforShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRedeemTokensforSharesResponse) 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 *MsgRedeemTokensforSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRedeemTokensforSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.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 *MsgTransferTokenizeShareRecord) 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 *MsgTransferTokenizeShareRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferTokenizeShareRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NewOwner) > 0 { + i -= len(m.NewOwner) + copy(dAtA[i:], m.NewOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewOwner))) + i-- + dAtA[i] = 0x1a + } + 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] = 0x12 + } + if m.TokenizeShareRecordId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TokenizeShareRecordId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferTokenizeShareRecordResponse) 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 *MsgTransferTokenizeShareRecordResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferTokenizeShareRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDisableTokenizeShares) 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 *MsgDisableTokenizeShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableTokenizeShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDisableTokenizeSharesResponse) 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 *MsgDisableTokenizeSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableTokenizeSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEnableTokenizeShares) 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 *MsgEnableTokenizeShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableTokenizeShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEnableTokenizeSharesResponse) 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 *MsgEnableTokenizeSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableTokenizeSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err16 != nil { + return 0, err16 + } + i -= n16 + i = encodeVarintTx(dAtA, i, uint64(n16)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgValidatorBond) 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 *MsgValidatorBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgValidatorBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgValidatorBondResponse) 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 *MsgValidatorBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgValidatorBondResponse) 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 *MsgCreateValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Commission.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + 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)) + return n +} + +func (m *MsgCreateValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEditValidator) 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.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CommissionRate != nil { + l = m.CommissionRate.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.MinSelfDelegation != nil { + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgEditValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDelegateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgBeginRedelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBeginRedelegateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUndelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUndelegateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUnbondValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUnbondValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCancelUnbondingDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + if m.CreationHeight != 0 { + n += 1 + sovTx(uint64(m.CreationHeight)) + } + return n +} + +func (m *MsgCancelUnbondingDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgTokenizeShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.TokenizedShareOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTokenizeSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgRedeemTokensforShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgRedeemTokensforSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgTransferTokenizeShareRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TokenizeShareRecordId != 0 { + n += 1 + sovTx(uint64(m.TokenizeShareRecordId)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NewOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTransferTokenizeShareRecordResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDisableTokenizeShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDisableTokenizeSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEnableTokenizeShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgEnableTokenizeSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgValidatorBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} + return n +} + +func (m *MsgValidatorBondResponse) 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 *MsgCreateValidator) 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: MsgCreateValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidator: 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 Commission", 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.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", 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 + } + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + 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 7: + 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 + 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 *MsgCreateValidatorResponse) 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: MsgCreateValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidatorResponse: 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 *MsgEditValidator) 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: MsgEditValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditValidator: 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 ValidatorAddress", 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", 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.Dec + m.CommissionRate = &v + if err := m.CommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", 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.MinSelfDelegation = &v + if err := m.MinSelfDelegation.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 *MsgEditValidatorResponse) 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: MsgEditValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditValidatorResponse: 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 *MsgDelegate) 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: MsgDelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 + } + if err := m.Amount.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 *MsgDelegateResponse) 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: MsgDelegateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegateResponse: 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 *MsgBeginRedelegate) 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: MsgBeginRedelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", 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.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", 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.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 + } + if err := m.Amount.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 *MsgBeginRedelegateResponse) 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: MsgBeginRedelegateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBeginRedelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, 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 *MsgUndelegate) 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: MsgUndelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUndelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 + } + if err := m.Amount.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 *MsgUndelegateResponse) 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: MsgUndelegateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUndelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, 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 *MsgUnbondValidator) 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: MsgUnbondValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnbondValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ValidatorAddress = 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 + } + } -func (m *MsgBeginRedelegateResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovTx(uint64(l)) - return n + return nil } - -func (m *MsgUndelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (m *MsgUnbondValidatorResponse) 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: MsgUnbondValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnbondValidatorResponse: 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 + } } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} -func (m *MsgUndelegateResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovTx(uint64(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)))) + return nil } -func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { +func (m *MsgCancelUnbondingDelegation) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1467,17 +4632,17 @@ func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateValidator: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCancelUnbondingDelegation: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateValidator: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCancelUnbondingDelegation: 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) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1487,28 +4652,59 @@ func (m *MsgCreateValidator) 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 ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1535,13 +4731,132 @@ func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 4: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(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 (m *MsgCancelUnbondingDelegationResponse) 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: MsgCancelUnbondingDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelUnbondingDelegationResponse: 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 *MsgTokenizeShares) 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: MsgTokenizeShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTokenizeShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1569,13 +4884,11 @@ func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1603,13 +4916,13 @@ func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1619,29 +4932,30 @@ func (m *MsgCreateValidator) 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 ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 6: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenizedShareOwner", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1651,31 +4965,77 @@ func (m *MsgCreateValidator) 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 ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen 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 { + m.TokenizedShareOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { return err } - iNdEx = postIndex - case 7: + 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 *MsgTokenizeSharesResponse) 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: MsgTokenizeSharesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTokenizeSharesResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1702,7 +5062,7 @@ func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1727,7 +5087,7 @@ func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRedeemTokensforShares) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1750,12 +5110,77 @@ func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateValidatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRedeemTokensforShares: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRedeemTokensforShares: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1777,7 +5202,7 @@ func (m *MsgCreateValidatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { +func (m *MsgRedeemTokensforSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1800,15 +5225,15 @@ func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgEditValidator: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRedeemTokensforSharesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditValidator: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRedeemTokensforSharesResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1835,15 +5260,65 @@ func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - var stringLen uint64 + 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 *MsgTransferTokenizeShareRecord) 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: MsgTransferTokenizeShareRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferTokenizeShareRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenizeShareRecordId", wireType) + } + m.TokenizeShareRecordId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1853,27 +5328,14 @@ func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TokenizeShareRecordId |= 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1901,15 +5363,11 @@ func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.CommissionRate = &v - if err := m.CommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewOwner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1937,11 +5395,7 @@ func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Int - m.MinSelfDelegation = &v - if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.NewOwner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1964,7 +5418,7 @@ func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgEditValidatorResponse) Unmarshal(dAtA []byte) error { +func (m *MsgTransferTokenizeShareRecordResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1987,10 +5441,10 @@ func (m *MsgEditValidatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgEditValidatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgTransferTokenizeShareRecordResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgTransferTokenizeShareRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2014,7 +5468,7 @@ func (m *MsgEditValidatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDelegate) Unmarshal(dAtA []byte) error { +func (m *MsgDisableTokenizeShares) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2037,10 +5491,10 @@ func (m *MsgDelegate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDelegate: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDisableTokenizeShares: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDisableTokenizeShares: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2075,71 +5529,6 @@ func (m *MsgDelegate) Unmarshal(dAtA []byte) error { } m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2161,7 +5550,7 @@ func (m *MsgDelegate) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDelegateResponse) Unmarshal(dAtA []byte) error { +func (m *MsgDisableTokenizeSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2184,10 +5573,10 @@ func (m *MsgDelegateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDelegateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDisableTokenizeSharesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDisableTokenizeSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2211,7 +5600,7 @@ func (m *MsgDelegateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { +func (m *MsgEnableTokenizeShares) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2234,10 +5623,10 @@ func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBeginRedelegate: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEnableTokenizeShares: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEnableTokenizeShares: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2272,103 +5661,6 @@ func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { } m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", 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.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", 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.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - 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 - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2390,7 +5682,7 @@ func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBeginRedelegateResponse) Unmarshal(dAtA []byte) error { +func (m *MsgEnableTokenizeSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2413,10 +5705,10 @@ func (m *MsgBeginRedelegateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBeginRedelegateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEnableTokenizeSharesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBeginRedelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEnableTokenizeSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2473,7 +5765,7 @@ func (m *MsgBeginRedelegateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUndelegate) Unmarshal(dAtA []byte) error { +func (m *MsgValidatorBond) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2496,10 +5788,10 @@ func (m *MsgUndelegate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUndelegate: wiretype end group for non-group") + return fmt.Errorf("proto: MsgValidatorBond: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgValidatorBond: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2566,39 +5858,6 @@ func (m *MsgUndelegate) Unmarshal(dAtA []byte) error { } m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - 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 - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2620,7 +5879,7 @@ func (m *MsgUndelegate) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUndelegateResponse) Unmarshal(dAtA []byte) error { +func (m *MsgValidatorBondResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2643,45 +5902,12 @@ func (m *MsgUndelegateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUndelegateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgValidatorBondResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgValidatorBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 02da27fec73..fa5630e56bc 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -7,9 +7,11 @@ import ( "strings" "time" + errorsmod "cosmossdk.io/errors" + abci "github.com/tendermint/tendermint/abci/types" tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - "gopkg.in/yaml.v2" + "sigs.k8s.io/yaml" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -47,24 +49,33 @@ func NewValidator(operator sdk.ValAddress, pubKey cryptotypes.PubKey, descriptio } return Validator{ - OperatorAddress: operator.String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: Unbonded, - Tokens: sdk.ZeroInt(), - DelegatorShares: sdk.ZeroDec(), - Description: description, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.OneInt(), - UnbondingOnHoldRefCount: 0, + OperatorAddress: operator.String(), + ConsensusPubkey: pkAny, + Jailed: false, + Status: Unbonded, + Tokens: sdk.ZeroInt(), + DelegatorShares: sdk.ZeroDec(), + Description: description, + UnbondingHeight: int64(0), + UnbondingTime: time.Unix(0, 0).UTC(), + Commission: NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + TotalValidatorBondShares: sdk.ZeroDec(), + TotalLiquidShares: sdk.ZeroDec(), }, nil } // String implements the Stringer interface for a Validator object. func (v Validator) String() string { - out, _ := yaml.Marshal(v) + bz, err := codec.ProtoMarshalJSON(&v, nil) + if err != nil { + panic(err) + } + + out, err := yaml.JSONToYAML(bz) + if err != nil { + panic(err) + } + return string(out) } @@ -79,15 +90,6 @@ func (v Validators) String() (out string) { return strings.TrimSpace(out) } -// ToSDKValidators - convenience function convert []Validator to []sdk.ValidatorI -func (v Validators) ToSDKValidators() (validators []ValidatorI) { - for _, val := range v { - validators = append(validators, val) - } - - return validators -} - // Sort Validators sorts validator array in ascending operator address order func (v Validators) Sort() { sort.Sort(v) @@ -233,23 +235,23 @@ func (d Description) UpdateDescription(d2 Description) (Description, error) { // EnsureLength ensures the length of a validator'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) + return d, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid moniker length; got: %d, max: %d", len(d.Moniker), MaxMonikerLength) } if len(d.Identity) > MaxIdentityLength { - return d, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid identity length; got: %d, max: %d", len(d.Identity), MaxIdentityLength) + return d, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid identity length; got: %d, max: %d", len(d.Identity), MaxIdentityLength) } if len(d.Website) > MaxWebsiteLength { - return d, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid website length; got: %d, max: %d", len(d.Website), MaxWebsiteLength) + return d, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid website length; got: %d, max: %d", len(d.Website), MaxWebsiteLength) } if len(d.SecurityContact) > MaxSecurityContactLength { - return d, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid security contact length; got: %d, max: %d", len(d.SecurityContact), MaxSecurityContactLength) + return d, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid security contact length; got: %d, max: %d", len(d.SecurityContact), MaxSecurityContactLength) } if len(d.Details) > MaxDetailsLength { - return d, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid details length; got: %d, max: %d", len(d.Details), MaxDetailsLength) + return d, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid details length; got: %d, max: %d", len(d.Details), MaxDetailsLength) } return d, nil @@ -335,7 +337,7 @@ func (v Validator) SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, error) { return sdk.ZeroDec(), ErrInsufficientShares } - return v.GetDelegatorShares().MulInt(amt).QuoTruncate(v.GetTokens().ToDec()), nil + return v.GetDelegatorShares().MulInt(amt).QuoTruncate(sdk.NewDecFromInt(v.GetTokens())), nil } // get the bonded tokens which the validator holds @@ -375,7 +377,7 @@ func (v Validator) AddTokensFromDel(amount sdk.Int) (Validator, sdk.Dec) { var issuedShares sdk.Dec if v.DelegatorShares.IsZero() { // the first delegation to a validator sets the exchange rate to one - issuedShares = amount.ToDec() + issuedShares = sdk.NewDecFromInt(amount) } else { shares, err := v.SharesFromTokens(amount) if err != nil { @@ -444,7 +446,6 @@ func (v *Validator) MinEqual(other *Validator) bool { v.Description.Equal(other.Description) && v.Commission.Equal(other.Commission) && v.Jailed == other.Jailed && - v.MinSelfDelegation.Equal(other.MinSelfDelegation) && v.ConsensusPubkey.Equal(other.ConsensusPubkey) } @@ -455,8 +456,8 @@ func (v *Validator) Equal(v2 *Validator) bool { v.UnbondingTime.Equal(v2.UnbondingTime) } -func (v Validator) IsJailed() bool { return v.Jailed } -func (v Validator) GetMoniker() string { return v.Description.Moniker } +func (v Validator) IsJailed() bool { return v.Jailed } +func (v Validator) GetMoniker() string { return v.Description.Moniker } func (v Validator) GetStatus() BondStatus { return v.Status } func (v Validator) GetOperator() sdk.ValAddress { if v.OperatorAddress == "" { @@ -473,7 +474,7 @@ func (v Validator) GetOperator() sdk.ValAddress { func (v Validator) ConsPubKey() (cryptotypes.PubKey, error) { pk, ok := v.ConsensusPubkey.GetCachedValue().(cryptotypes.PubKey) if !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) } return pk, nil @@ -498,7 +499,7 @@ func (v Validator) TmConsPublicKey() (tmprotocrypto.PublicKey, error) { func (v Validator) GetConsAddr() (sdk.ConsAddress, error) { pk, ok := v.ConsensusPubkey.GetCachedValue().(cryptotypes.PubKey) if !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) } return sdk.ConsAddress(pk.Address()), nil @@ -509,9 +510,10 @@ func (v Validator) GetBondedTokens() sdk.Int { return v.BondedTokens() } func (v Validator) GetConsensusPower(r sdk.Int) int64 { return v.ConsensusPower(r) } -func (v Validator) GetCommission() sdk.Dec { return v.Commission.Rate } -func (v Validator) GetMinSelfDelegation() sdk.Int { return v.MinSelfDelegation } -func (v Validator) GetDelegatorShares() sdk.Dec { return v.DelegatorShares } +func (v Validator) GetCommission() sdk.Dec { return v.Commission.Rate } +func (v Validator) GetDelegatorShares() sdk.Dec { return v.DelegatorShares } + +func (v Validator) GetMinSelfDelegation() sdk.Int { return sdk.ZeroInt() } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (v Validator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {