Documentation ¶
Index ¶
- Constants
- func BeginBlocker(ctx sdk.Ctx, req abci.RequestBeginBlock, k Keeper)
- func EndBlocker(ctx sdk.Ctx, k Keeper) []abci.ValidatorUpdate
- func ModuleAccountInvariants(k Keeper) sdk.Invariant
- func NewQuerier(k Keeper) sdk.Querier
- func NonNegativePowerInvariant(k Keeper) sdk.Invariant
- func ParamKeyTable() sdk.KeyTable
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- type Keeper
- func (k Keeper) AddPubKeyRelation(ctx sdk.Ctx, pubkey posCrypto.PublicKey)
- func (k Keeper) AfterValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) AfterValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) AfterValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) AfterValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)
- func (k Keeper) AfterValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) AfterValidatorUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) AllValidators(ctx sdk.Ctx) (validators []exported.ValidatorI)
- func (k Keeper) AwardCoinsTo(ctx sdk.Ctx, amount sdk.Int, address sdk.Address)
- func (k Keeper) BeforeValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) BeforeValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) BeforeValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) BeforeValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)
- func (k Keeper) BeforeValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) BeforeValidatorUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
- func (k Keeper) BeginUnstakingValidator(ctx sdk.Ctx, validator types.Validator) sdk.Error
- func (k Keeper) BurnValidator(ctx sdk.Ctx, address sdk.Address, severityPercentage sdk.Dec)
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) DeletePrevStateValPower(ctx sdk.Ctx, addr sdk.Address)
- func (k Keeper) DowntimeJailDuration(ctx sdk.Ctx) (res time.Duration)
- func (k Keeper) FinishUnstakingValidator(ctx sdk.Ctx, validator types.Validator) sdk.Error
- func (k Keeper) ForceValidatorUnstake(ctx sdk.Ctx, validator types.Validator) sdk.Error
- func (k Keeper) GetAllValidators(ctx sdk.Ctx) (validators []types.Validator)
- func (k Keeper) GetBalance(ctx sdk.Ctx, addr sdk.Address) sdk.Int
- func (k Keeper) GetBlockHeight(ctx sdk.Ctx) int64
- func (k Keeper) GetBlockTime(ctx sdk.Ctx) time.Time
- func (k Keeper) GetLatestBlockID(ctx sdk.Ctx) abci.BlockID
- func (k Keeper) GetParams(ctx sdk.Ctx) types.Params
- func (k Keeper) GetPreviousProposer(ctx sdk.Ctx) (address sdk.Address)
- func (k Keeper) GetStakedPool(ctx sdk.Ctx) (stakedPool exported.ModuleAccountI)
- func (k Keeper) GetStakedTokens(ctx sdk.Ctx) sdk.Int
- func (k Keeper) GetUnstakedTokens(ctx sdk.Ctx) (unstakedTokens sdk.Int)
- func (k Keeper) GetValidator(ctx sdk.Ctx, addr sdk.Address) (validator types.Validator, found bool)
- func (k Keeper) GetValidatorSigningInfo(ctx sdk.Ctx, address sdk.Address) (info types.ValidatorSigningInfo, found bool)
- func (k Keeper) GetValidators(ctx sdk.Ctx, maxRetrieve uint16) (validators []types.Validator)
- 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) MaxEvidenceAge(ctx sdk.Ctx) (res time.Duration)
- func (k Keeper) MaxValidators(ctx sdk.Ctx) (res uint64)
- func (k Keeper) MinSignedPerWindow(ctx sdk.Ctx) (res int64)
- func (k Keeper) MinimumStake(ctx sdk.Ctx) (res int64)
- func (k Keeper) PrevStateValidatorPower(ctx sdk.Ctx, addr sdk.Address) (power int64)
- func (k Keeper) PrevStateValidatorsPower(ctx sdk.Ctx) (power sdk.Int)
- func (k Keeper) ProposerRewardPercentage(ctx sdk.Ctx) (res int8)
- func (k Keeper) RegisterValidator(ctx sdk.Ctx, validator types.Validator)
- func (k Keeper) SendCoins(ctx sdk.Ctx, fromAddress sdk.Address, toAddress sdk.Address, amount sdk.Int) sdk.Error
- func (k *Keeper) SetHooks(sh types.POSHooks) *Keeper
- func (k Keeper) SetMissedBlockArray(ctx sdk.Ctx, address sdk.Address, index int64, missed bool)
- 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.Int)
- func (k Keeper) SetPreviousProposer(ctx sdk.Ctx, address sdk.Address)
- func (k Keeper) SetStakedValidator(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) SetValidatorSigningInfo(ctx sdk.Ctx, address sdk.Address, info types.ValidatorSigningInfo)
- func (k Keeper) SignedBlocksWindow(ctx sdk.Ctx) (res int64)
- func (k Keeper) SlashFractionDoubleSign(ctx sdk.Ctx) (res sdk.Dec)
- func (k Keeper) SlashFractionDowntime(ctx sdk.Ctx) (res sdk.Dec)
- func (k Keeper) StakeDenom(ctx sdk.Ctx) (res string)
- func (k Keeper) StakeValidator(ctx sdk.Ctx, validator types.Validator, amount sdk.Int)
- func (k Keeper) StakedRatio(ctx sdk.Ctx) sdk.Dec
- func (k Keeper) TotalTokens(ctx sdk.Ctx) sdk.Int
- 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) 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.Int) sdk.Error
- func (k Keeper) Validator(ctx sdk.Ctx, address sdk.Address) exported.ValidatorI
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)
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
Called every block, update validator set
func ModuleAccountInvariants ¶
ModuleAccountInvariants checks that the staked ModuleAccounts pools reflects the tokens actively staked and not staked
func NewQuerier ¶
creates a querier for staking REST endpoints
func NonNegativePowerInvariant ¶
NonNegativePowerInvariant checks that all stored validators have >= 0 power.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all staking invariants
Types ¶
type Keeper ¶
keeper of the staking store
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, coinKeeper bank.Keeper, supplyKeeper types.SupplyKeeper, paramstore sdk.Subspace, codespace sdk.CodespaceType) Keeper
NewKeeper creates a new staking Keeper instance
func (Keeper) AddPubKeyRelation ¶
func (Keeper) AfterValidatorBeginUnstaking ¶
func (Keeper) AfterValidatorRegistered ¶
func (Keeper) AfterValidatorRemoved ¶
func (Keeper) AfterValidatorSlashed ¶
func (Keeper) AfterValidatorStaked ¶
func (Keeper) AfterValidatorUnstaked ¶
func (Keeper) AllValidators ¶
func (k Keeper) AllValidators(ctx sdk.Ctx) (validators []exported.ValidatorI)
func (Keeper) AwardCoinsTo ¶
award coins to an address (will be called at the beginning of the next block)
func (Keeper) BeforeValidatorBeginUnstaking ¶
func (Keeper) BeforeValidatorRegistered ¶
func (Keeper) BeforeValidatorRemoved ¶
func (Keeper) BeforeValidatorSlashed ¶
func (Keeper) BeforeValidatorStaked ¶
func (Keeper) BeforeValidatorUnstaked ¶
func (Keeper) BeginUnstakingValidator ¶
store ops when validator begins to unstake -> starts the unstaking timer
func (Keeper) BurnValidator ¶
func (Keeper) DeletePrevStateValPower ¶
Delete the power of a SINGLE staked validator from the previous state
func (Keeper) DowntimeJailDuration ¶
Downtime jail duration
func (Keeper) FinishUnstakingValidator ¶
store ops to unstake a validator -> called after unstaking time is up
func (Keeper) ForceValidatorUnstake ¶
force unstake (called when slashed below the minimum)
func (Keeper) GetAllValidators ¶
get the set of all validators with no limits from the main store
func (Keeper) GetPreviousProposer ¶
get the proposer public key for this block
func (Keeper) GetStakedPool ¶
func (k Keeper) GetStakedPool(ctx sdk.Ctx) (stakedPool exported.ModuleAccountI)
GetStakedPool returns the staked tokens pool's module account
func (Keeper) GetStakedTokens ¶
GetStakedTokens total staking tokens supply which is staked
func (Keeper) GetUnstakedTokens ¶
GetUnstakedTokens returns the amount of not staked tokens
func (Keeper) GetValidator ¶
get a single validator from the main store
func (Keeper) GetValidatorSigningInfo ¶
func (k Keeper) GetValidatorSigningInfo(ctx sdk.Ctx, address sdk.Address) (info types.ValidatorSigningInfo, found bool)
stored by consensus address
func (Keeper) GetValidators ¶
return a given amount of all the validators
func (Keeper) IterateAndExecuteOverMissedArray ¶
func (k Keeper) IterateAndExecuteOverMissedArray(ctx sdk.Ctx, address sdk.Address, handler func(index int64, missed bool) (stop bool))
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))
iterate 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))
Iterate 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))
iterate through the staked validator set and perform the provided function
func (Keeper) IterateAndExecuteOverValSigningInfo ¶
func (Keeper) IterateAndExecuteOverVals ¶
func (k Keeper) IterateAndExecuteOverVals( ctx sdk.Ctx, fn func(index int64, validator exported.ValidatorI) (stop bool))
iterate through the validator set and perform the provided function
func (Keeper) JailValidator ¶
send a validator to jail
func (Keeper) MaxEvidenceAge ¶
MaxEvidenceAge - max age for evidence
func (Keeper) MaxValidators ¶
MaxValidators - Maximum number of validators
func (Keeper) MinSignedPerWindow ¶
Downtime slashing threshold
func (Keeper) PrevStateValidatorPower ¶
get the power of a SINGLE staked validator from the previous state
func (Keeper) PrevStateValidatorsPower ¶
Load the prevState total validator power.
func (Keeper) ProposerRewardPercentage ¶
func (Keeper) RegisterValidator ¶
register the validator in the necessary stores in the world state
func (Keeper) SetMissedBlockArray ¶
func (Keeper) SetPrevStateValPower ¶
set the power of a SINGLE staked validator from the previous state
func (Keeper) SetPrevStateValidatorsPower ¶
Set the prevState total validator power (used in moving the curr to prev)
func (Keeper) SetPreviousProposer ¶
set the proposer public key for this block
func (Keeper) SetStakedValidator ¶
set staked validator
func (Keeper) SetUnstakingValidator ¶
Insert a validator address to the appropriate position in the unstaking queue
func (Keeper) SetValidator ¶
set a validator in the main store
func (Keeper) SetValidatorSigningInfo ¶
func (Keeper) SignedBlocksWindow ¶
SignedBlocksWindow - sliding window for downtime slashing
func (Keeper) SlashFractionDoubleSign ¶
SlashFractionDoubleSign
func (Keeper) SlashFractionDowntime ¶
SlashFractionDowntime
func (Keeper) StakeDenom ¶
StakeDenom - Stakeable coin denomination
func (Keeper) StakeValidator ¶
store ops when a validator stakes
func (Keeper) StakedRatio ¶
StakedRatio the fraction of the staking tokens which are currently staked
func (Keeper) TotalTokens ¶
TotalTokens staking tokens from the total supply
func (Keeper) UnStakingTime ¶
UnstakingTime
func (Keeper) UnjailValidator ¶
remove a validator from jail
func (Keeper) UpdateTendermintValidators ¶
func (k Keeper) UpdateTendermintValidators(ctx sdk.Ctx) (updates []abci.ValidatorUpdate)
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.