Documentation ¶
Index ¶
- Constants
- func BeginBlocker(ctx sdk.Ctx, req abci.RequestBeginBlock, k Keeper)
- func EndBlocker(ctx sdk.Ctx, k Keeper) []abci.ValidatorUpdate
- func NewQuerier(k Keeper) sdk.Querier
- func ParamKeyTable() sdk.KeyTable
- type Keeper
- func (k Keeper) AllValidators(ctx sdk.Ctx) (validators []exported.ValidatorI)
- func (k Keeper) BeginUnstakingValidator(ctx sdk.Ctx, validator types.Validator)
- func (k Keeper) BlocksPerSession(ctx sdk.Ctx) (res int64)
- func (k Keeper) BurnForChallenge(ctx sdk.Ctx, challenges sdk.BigInt, address sdk.Address)
- func (k Keeper) ClearSessionCache()
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) ConvertState(ctx sdk.Ctx)
- func (k Keeper) DAOAllocation(ctx sdk.Ctx) (res int64)
- func (k Keeper) DeletePrevStateValPower(ctx sdk.Ctx, addr sdk.Address)
- func (k Keeper) DeleteValidator(ctx sdk.Ctx, addr sdk.Address)
- func (k Keeper) DeleteValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address)
- func (k Keeper) DeleteWaitingValidator(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) DowntimeJailDuration(ctx sdk.Ctx) (res time.Duration)
- func (k Keeper) EditStakeValidator(ctx sdk.Ctx, currentValidator, updatedValidator types.Validator, ...) sdk.Error
- func (k Keeper) FinishUnstakingValidator(ctx sdk.Ctx, validator types.Validator)
- func (k Keeper) ForceValidatorUnstake(ctx sdk.Ctx, validator types.Validator) sdk.Error
- func (k Keeper) GetAccount(ctx sdk.Ctx, addr sdk.Address) (acc *auth.BaseAccount)
- func (k Keeper) GetAllValidators(ctx sdk.Ctx) (validators []types.Validator)
- func (k Keeper) GetAllValidatorsAddrs(ctx sdk.Ctx) (validators []sdk.Address)
- func (k Keeper) GetAllValidatorsWithOpts(ctx sdk.Ctx, opts types.QueryValidatorsParams) (validators []types.Validator)
- func (k Keeper) GetBalance(ctx sdk.Ctx, addr sdk.Address) sdk.BigInt
- func (k Keeper) GetParams(ctx sdk.Ctx) types.Params
- func (k Keeper) GetPreviousProposer(ctx sdk.Ctx) (addr sdk.Address)
- func (k Keeper) GetStakedPool(ctx sdk.Ctx) (stakedPool exported.ModuleAccountI)
- func (k Keeper) GetStakedTokens(ctx sdk.Ctx) sdk.BigInt
- func (k Keeper) GetStakedValidators(ctx sdk.Ctx) (validators []exported.ValidatorI)
- func (k Keeper) GetValidator(ctx sdk.Ctx, addr sdk.Address) (validator types.Validator, found bool)
- func (k Keeper) GetValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address) (info types.ValidatorSigningInfo, found bool)
- func (k Keeper) GetValidators(ctx sdk.Ctx, maxRetrieve uint16) (validators []types.Validator)
- func (k Keeper) GetValidatorsByChain(ctx sdk.Ctx, networkID string) (validators []sdk.Address, count int)
- func (k Keeper) GetWaitingValidators(ctx sdk.Ctx) (validators []types.Validator)
- func (k Keeper) IncrementJailedValidators(ctx sdk.Ctx)
- func (k Keeper) IsWaitingValidator(ctx sdk.Ctx, valAddr sdk.Address) bool
- func (k Keeper) IterateAndExecuteOverMissedArray(ctx sdk.Ctx, address sdk.Address, ...)
- func (k Keeper) IterateAndExecuteOverPrevStateVals(ctx sdk.Ctx, fn func(index int64, validator exported.ValidatorI) (stop bool))
- func (k Keeper) IterateAndExecuteOverPrevStateValsByPower(ctx sdk.Ctx, handler func(address sdk.Address, power int64) (stop bool))
- func (k Keeper) IterateAndExecuteOverStakedVals(ctx sdk.Ctx, fn func(index int64, validator exported.ValidatorI) (stop bool))
- func (k Keeper) IterateAndExecuteOverValSigningInfo(ctx sdk.Ctx, ...)
- func (k Keeper) IterateAndExecuteOverVals(ctx sdk.Ctx, fn func(index int64, validator exported.ValidatorI) (stop bool))
- func (k Keeper) JailValidator(ctx sdk.Ctx, addr sdk.Address)
- func (k Keeper) Logger(ctx sdk.Ctx) log.Logger
- func (k Keeper) MaxChains(ctx sdk.Ctx) (res int64)
- func (k Keeper) MaxEvidenceAge(ctx sdk.Ctx) (res time.Duration)
- func (k Keeper) MaxJailedBlocks(ctx sdk.Ctx) (res int64)
- func (k Keeper) MaxValidators(ctx sdk.Ctx) (res int64)
- func (k Keeper) MinSignedPerWindow(ctx sdk.Ctx) (res int64)
- func (k Keeper) MinimumStake(ctx sdk.Ctx) (res int64)
- func (k Keeper) NodeReward(ctx sdk.Ctx, reward sdk.BigInt) (nodeReward sdk.BigInt, feesCollected sdk.BigInt)
- func (k Keeper) PrevStateValidatorsPower(ctx sdk.Ctx) (power sdk.BigInt)
- func (k Keeper) ProposerAllocation(ctx sdk.Ctx) (res int64)
- func (k Keeper) RelaysToTokensMultiplier(ctx sdk.Ctx) sdk.BigInt
- func (k Keeper) ReleaseWaitingValidators(ctx sdk.Ctx)
- func (k Keeper) ResetValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address)
- func (k Keeper) RewardForRelays(ctx sdk.Ctx, relays sdk.BigInt, address sdk.Address) sdk.BigInt
- func (k Keeper) SendCoins(ctx sdk.Ctx, fromAddress sdk.Address, toAddress sdk.Address, amount sdk.BigInt) sdk.Error
- func (k Keeper) SetParams(ctx sdk.Ctx, params types.Params)
- func (k Keeper) SetPrevStateValPower(ctx sdk.Ctx, addr sdk.Address, power int64)
- func (k Keeper) SetPrevStateValidatorsPower(ctx sdk.Ctx, power sdk.BigInt)
- func (k Keeper) SetPreviousProposer(ctx sdk.Ctx, consAddr sdk.Address)
- func (k Keeper) SetStakedValidator(ctx sdk.Ctx, validator types.Validator)
- func (k Keeper) SetStakedValidatorByChains(ctx sdk.Ctx, validator types.Validator)
- func (k Keeper) SetUnstakingValidator(ctx sdk.Ctx, val types.Validator)
- func (k Keeper) SetValidator(ctx sdk.Ctx, validator types.Validator)
- func (k Keeper) SetValidatorMissedAt(ctx sdk.Ctx, addr sdk.Address, index int64, missed bool)
- func (k Keeper) SetValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address, info types.ValidatorSigningInfo)
- func (k Keeper) SetValidatorSigningInfos(ctx sdk.Ctx, infos []types.ValidatorSigningInfo)
- func (k Keeper) SetValidators(ctx sdk.Ctx, validators types.Validators)
- func (k Keeper) SetWaitingValidator(ctx sdk.Ctx, val types.Validator)
- func (k Keeper) SetWaitingValidators(ctx sdk.Ctx, vals types.Validators)
- func (k Keeper) SignedBlocksWindow(ctx sdk.Ctx) (res int64)
- func (k Keeper) SlashFractionDoubleSign(ctx sdk.Ctx) (res sdk.BigDec)
- func (k Keeper) SlashFractionDowntime(ctx sdk.Ctx) (res sdk.BigDec)
- func (k Keeper) StakeDenom(ctx sdk.Ctx) (res string)
- func (k Keeper) StakeValidator(ctx sdk.Ctx, validator types.Validator, amount sdk.BigInt) sdk.Error
- func (k Keeper) TotalTokens(ctx sdk.Ctx) sdk.BigInt
- func (k Keeper) UnStakingTime(ctx sdk.Ctx) (res time.Duration)
- func (k Keeper) UnjailValidator(ctx sdk.Ctx, addr sdk.Address)
- func (k Keeper) UpdateTendermintValidators(ctx sdk.Ctx) (updates []abci.ValidatorUpdate)
- func (k Keeper) UpgradeCodec(ctx sdk.Ctx)
- func (k Keeper) UpgradeMissedBlocksArray(ctx sdk.Ctx, validators types.Validators) sdk.Error
- func (k Keeper) ValidateEditStake(ctx sdk.Ctx, currentValidator types.Validator, amount sdk.BigInt) sdk.Error
- func (k Keeper) ValidateUnjailMessage(ctx sdk.Ctx, msg types.MsgUnjail) (addr sdk.Address, err sdk.Error)
- func (k Keeper) ValidateValidatorBeginUnstaking(ctx sdk.Ctx, validator types.Validator) sdk.Error
- func (k Keeper) ValidateValidatorFinishUnstaking(ctx sdk.Ctx, validator types.Validator) sdk.Error
- func (k Keeper) ValidateValidatorStaking(ctx sdk.Ctx, validator types.Validator, amount sdk.BigInt) sdk.Error
- func (k Keeper) Validator(ctx sdk.Ctx, address sdk.Address) exported.ValidatorI
- func (k Keeper) WaitToBeginUnstakingValidator(ctx sdk.Ctx, validator types.Validator) sdk.Error
Constants ¶
const (
DefaultParamspace = types.ModuleName
)
Default parameter namespace
Variables ¶
This section is empty.
Functions ¶
func BeginBlocker ¶
func BeginBlocker(ctx sdk.Ctx, req abci.RequestBeginBlock, k Keeper)
BeginBlocker - Called at the beggining of every block 1) allocate tokens to block producer 2) mint any custom awards for each validator 3) set new proposer 4) check block sigs and byzantine evidence to slash
func EndBlocker ¶
func EndBlocker(ctx sdk.Ctx, k Keeper) []abci.ValidatorUpdate
EndBlocker - Called at the end of every block, update validator set
func NewQuerier ¶
creates a querier for staking REST endpoints
Types ¶
type Keeper ¶
type Keeper struct { Cdc *codec.Codec AccountKeeper types.AuthKeeper PocketKeeper types.PocketKeeper // todo combine all modules Paramstore sdk.Subspace // contains filtered or unexported fields }
Keeper of the staking store
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, accountKeeper types.AuthKeeper, paramstore sdk.Subspace, codespace sdk.CodespaceType) Keeper
NewKeeper creates a new staking Keeper instance
func (Keeper) AllValidators ¶
func (k Keeper) AllValidators(ctx sdk.Ctx) (validators []exported.ValidatorI)
AllValidators - Retrieve a list of all validators
func (Keeper) BeginUnstakingValidator ¶
BeginUnstakingValidator - Store ops when validator begins to unstake -> starts the unstaking timer
func (Keeper) BlocksPerSession ¶
BlocksPerSession - Retrieve blocks per session
func (Keeper) BurnForChallenge ¶
BurnForChallenge - Tries to remove coins from account & supply for a challenged validator
func (Keeper) ClearSessionCache ¶
func (k Keeper) ClearSessionCache()
func (Keeper) Codespace ¶
func (k Keeper) Codespace() sdk.CodespaceType
Codespace - Retrieve the codespace
func (Keeper) ConvertState ¶
func (Keeper) DAOAllocation ¶
DAOAllocation - Retrieve DAO allocation
func (Keeper) DeletePrevStateValPower ¶
DeletePrevStateValPower - Remove the power of a SINGLE staked validator from the previous state
func (Keeper) DeleteValidator ¶
SetValidator - Store validator in the main store
func (Keeper) DeleteValidatorSigningInfo ¶
func (Keeper) DeleteWaitingValidator ¶
DeleteWaitingValidator - Remove waiting validators
func (Keeper) DowntimeJailDuration ¶
DowntimeJailDuration - Downtime jail duration
func (Keeper) EditStakeValidator ¶
func (k Keeper) EditStakeValidator(ctx sdk.Ctx, currentValidator, updatedValidator types.Validator, amount sdk.BigInt) sdk.Error
EditStakeValidator - Edit an already staked validator with the staking message
func (Keeper) FinishUnstakingValidator ¶
FinishUnstakingValidator - Store ops to unstake a validator -> called after unstaking time is up
func (Keeper) ForceValidatorUnstake ¶
ForceValidatorUnstake - Coerce unstake (called when slashed below the minimum)
func (Keeper) GetAccount ¶
GetAccount - Retrieve account info
func (Keeper) GetAllValidators ¶
GetAllValidators - Retrieve set of all validators with no limits from the main store
func (Keeper) GetAllValidatorsAddrs ¶
GetAllValidators - Retrieve set of all validators with no limits from the main store
func (Keeper) GetAllValidatorsWithOpts ¶
func (k Keeper) GetAllValidatorsWithOpts(ctx sdk.Ctx, opts types.QueryValidatorsParams) (validators []types.Validator)
GetAllValidators - - Retrieve the set of all validators with no limits from the main store
func (Keeper) GetBalance ¶
GetBalance - Retrieve balance for account
func (Keeper) GetPreviousProposer ¶
GetPreviousProposer - Retrieve the proposer public key for this block
func (Keeper) GetStakedPool ¶
func (k Keeper) GetStakedPool(ctx sdk.Ctx) (stakedPool exported.ModuleAccountI)
GetStakedPool - Retrieve the staked tokens pool's module account
func (Keeper) GetStakedTokens ¶
GetStakedTokens - Retrieve total staking tokens supply which is staked
func (Keeper) GetStakedValidators ¶
func (k Keeper) GetStakedValidators(ctx sdk.Ctx) (validators []exported.ValidatorI)
GetStakedValidators - Retrieve StakedValidators
func (Keeper) GetValidator ¶
GetValidator - Retrieve validator with address from the main store
func (Keeper) GetValidatorSigningInfo ¶
func (k Keeper) GetValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address) (info types.ValidatorSigningInfo, found bool)
GetValidatorSigningInfo - Retrieve signing information for the validator by address
func (Keeper) GetValidators ¶
GetValidators - Retrieve a given amount of all the validators
func (Keeper) GetValidatorsByChain ¶
func (k Keeper) GetValidatorsByChain(ctx sdk.Ctx, networkID string) (validators []sdk.Address, count int)
GetValidatorByChains - Returns the validator staked by network identifier
func (Keeper) GetWaitingValidators ¶
GetWaitingValidators - Retrieve waiting validators
func (Keeper) IncrementJailedValidators ¶
func (Keeper) IsWaitingValidator ¶
IsWaitingValidator - Check if validator is waiting
func (Keeper) IterateAndExecuteOverMissedArray ¶
func (k Keeper) IterateAndExecuteOverMissedArray(ctx sdk.Ctx, address sdk.Address, handler func(index int64, missed bool) (stop bool))
IterateAndExecuteOverMissedArray - Stored by *validator* address (not operator address)
func (Keeper) IterateAndExecuteOverPrevStateVals ¶
func (k Keeper) IterateAndExecuteOverPrevStateVals( ctx sdk.Ctx, fn func(index int64, validator exported.ValidatorI) (stop bool))
IterateAndExecuteOverPrevStateVals - Goes through the active validator set and perform the provided function
func (Keeper) IterateAndExecuteOverPrevStateValsByPower ¶
func (k Keeper) IterateAndExecuteOverPrevStateValsByPower( ctx sdk.Ctx, handler func(address sdk.Address, power int64) (stop bool))
IterateAndExecuteOverPrevStateValsByPower - Goes over prevState validator powers and perform a function on each validator.
func (Keeper) IterateAndExecuteOverStakedVals ¶
func (k Keeper) IterateAndExecuteOverStakedVals( ctx sdk.Ctx, fn func(index int64, validator exported.ValidatorI) (stop bool))
IterateAndExecuteOverStakedVals - Goes through the staked validator set and execute handler
func (Keeper) IterateAndExecuteOverValSigningInfo ¶
func (k Keeper) IterateAndExecuteOverValSigningInfo(ctx sdk.Ctx, handler func(addr sdk.Address, info types.ValidatorSigningInfo) (stop bool))
IterateAndExecuteOverValSigningInfo - Goes over signing info validators and executes handler
func (Keeper) IterateAndExecuteOverVals ¶
func (k Keeper) IterateAndExecuteOverVals( ctx sdk.Ctx, fn func(index int64, validator exported.ValidatorI) (stop bool))
IterateAndExecuteOverVals - Goes through the validator set and executes handler
func (Keeper) JailValidator ¶
JailValidator - Send a validator to jail
func (Keeper) MaxEvidenceAge ¶
MaxEvidenceAge - Max age for evidence
func (Keeper) MaxValidators ¶
MaxValidators - Retrieve maximum number of validators
func (Keeper) MinSignedPerWindow ¶
MinSignedPerWindow - Downtime slashing threshold
func (Keeper) MinimumStake ¶
MinimumStake - Retrieve Minimum stake
func (Keeper) NodeReward ¶
func (Keeper) PrevStateValidatorsPower ¶
PrevStateValidatorsPower - Load the prevState total validator power.
func (Keeper) ProposerAllocation ¶
ProposerAllocation - Retrieve proposer allocation
func (Keeper) RelaysToTokensMultiplier ¶
RelaysToTokensMultiplier - Retrieve relay token multipler
func (Keeper) ReleaseWaitingValidators ¶
ReleaseWaitingValidators - Remove UnstakingValidators from store
func (Keeper) ResetValidatorSigningInfo ¶
func (Keeper) RewardForRelays ¶
RewardForRelays - Award coins to an address (will be called at the beginning of the next block)
func (Keeper) SendCoins ¶
func (k Keeper) SendCoins(ctx sdk.Ctx, fromAddress sdk.Address, toAddress sdk.Address, amount sdk.BigInt) sdk.Error
SendCoins - Deliver coins to account
func (Keeper) SetPrevStateValPower ¶
SetPrevStateValPower - Store the power of a SINGLE staked validator from the previous state
func (Keeper) SetPrevStateValidatorsPower ¶
SetPrevStateValidatorsPower - Store the prevState total validator power (used in moving the curr to prev)
func (Keeper) SetPreviousProposer ¶
SetPreviousProposer - Store proposer public key for this block
func (Keeper) SetStakedValidator ¶
SetStakedValidator - Store staked validator
func (Keeper) SetStakedValidatorByChains ¶
SetStakedValidatorByChains - Store staked validator using networkId
func (Keeper) SetUnstakingValidator ¶
SetUnstakingValidator - Store a validator address to the appropriate position in the unstaking queue
func (Keeper) SetValidator ¶
SetValidator - Store validator in the main store and state stores (stakingset/ unstakingset)
func (Keeper) SetValidatorMissedAt ¶
SetValidatorMissedAt - Store missed validator
func (Keeper) SetValidatorSigningInfo ¶
func (k Keeper) SetValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address, info types.ValidatorSigningInfo)
SetValidatorSigningInfo - Store signing information for the validator by address
func (Keeper) SetValidatorSigningInfos ¶
func (k Keeper) SetValidatorSigningInfos(ctx sdk.Ctx, infos []types.ValidatorSigningInfo)
func (Keeper) SetValidators ¶
func (k Keeper) SetValidators(ctx sdk.Ctx, validators types.Validators)
func (Keeper) SetWaitingValidator ¶
SetWaitingValidator - Store validator on WaitingToBeginUnstaking store
func (Keeper) SetWaitingValidators ¶
func (k Keeper) SetWaitingValidators(ctx sdk.Ctx, vals types.Validators)
func (Keeper) SignedBlocksWindow ¶
SignedBlocksWindow - Sliding window for downtime slashing
func (Keeper) SlashFractionDoubleSign ¶
SlashFractionDoubleSign - Retrieve slash fraction for double signature
func (Keeper) SlashFractionDowntime ¶
SlashFractionDowntime - Retrieve slash fraction time
func (Keeper) StakeDenom ¶
StakeDenom - Bondable coin denomination
func (Keeper) StakeValidator ¶
StakeValidator - Store ops when a validator stakes
func (Keeper) TotalTokens ¶
TotalTokens - Retrieve staking tokens from the total supply
func (Keeper) UnStakingTime ¶
UnStakingTime - Retrieve unstaking time param
func (Keeper) UnjailValidator ¶
UnjailValidator - Remove a validator from jail
func (Keeper) UpdateTendermintValidators ¶
func (k Keeper) UpdateTendermintValidators(ctx sdk.Ctx) (updates []abci.ValidatorUpdate)
UpdateTendermintValidators - Apply and return accumulated updates to the staked validator set It gets called once after genesis, another time maybe after genesis transactions, then once at every EndBlock.
func (Keeper) UpgradeCodec ¶
func (Keeper) UpgradeMissedBlocksArray ¶
func (Keeper) ValidateEditStake ¶
func (k Keeper) ValidateEditStake(ctx sdk.Ctx, currentValidator types.Validator, amount sdk.BigInt) sdk.Error
ValidateEditStake - Validate the updates to a current staked validator
func (Keeper) ValidateUnjailMessage ¶
func (k Keeper) ValidateUnjailMessage(ctx sdk.Ctx, msg types.MsgUnjail) (addr sdk.Address, err sdk.Error)
ValidateUnjailMessage - Check unjail message
func (Keeper) ValidateValidatorBeginUnstaking ¶
ValidateValidatorBeginUnstaking - Check for validator status
func (Keeper) ValidateValidatorFinishUnstaking ¶
ValidateValidatorFinishUnstaking - Check if validator can finish unstaking
func (Keeper) ValidateValidatorStaking ¶
func (k Keeper) ValidateValidatorStaking(ctx sdk.Ctx, validator types.Validator, amount sdk.BigInt) sdk.Error
ValidateValidatorStaking - Check Validator before staking