keeper

package
v0.0.0-...-4955b9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
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

func NewQuerier(k Keeper) sdk.Querier

creates a querier for staking REST endpoints

func ParamKeyTable

func ParamKeyTable() sdk.KeyTable

ParamKeyTable for staking module

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

func (k Keeper) BeginUnstakingValidator(ctx sdk.Ctx, validator types.Validator)

BeginUnstakingValidator - Store ops when validator begins to unstake -> starts the unstaking timer

func (Keeper) BlocksPerSession

func (k Keeper) BlocksPerSession(ctx sdk.Ctx) (res int64)

BlocksPerSession - Retrieve blocks per session

func (Keeper) BurnForChallenge

func (k Keeper) BurnForChallenge(ctx sdk.Ctx, challenges sdk.BigInt, address sdk.Address)

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 (k Keeper) ConvertState(ctx sdk.Ctx)

func (Keeper) DAOAllocation

func (k Keeper) DAOAllocation(ctx sdk.Ctx) (res int64)

DAOAllocation - Retrieve DAO allocation

func (Keeper) DeletePrevStateValPower

func (k Keeper) DeletePrevStateValPower(ctx sdk.Ctx, addr sdk.Address)

DeletePrevStateValPower - Remove the power of a SINGLE staked validator from the previous state

func (Keeper) DeleteValidator

func (k Keeper) DeleteValidator(ctx sdk.Ctx, addr sdk.Address)

SetValidator - Store validator in the main store

func (Keeper) DeleteValidatorSigningInfo

func (k Keeper) DeleteValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address)

func (Keeper) DeleteWaitingValidator

func (k Keeper) DeleteWaitingValidator(ctx sdk.Ctx, valAddr sdk.Address)

DeleteWaitingValidator - Remove waiting validators

func (Keeper) DowntimeJailDuration

func (k Keeper) DowntimeJailDuration(ctx sdk.Ctx) (res time.Duration)

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

func (k Keeper) FinishUnstakingValidator(ctx sdk.Ctx, validator types.Validator)

FinishUnstakingValidator - Store ops to unstake a validator -> called after unstaking time is up

func (Keeper) ForceValidatorUnstake

func (k Keeper) ForceValidatorUnstake(ctx sdk.Ctx, validator types.Validator) sdk.Error

ForceValidatorUnstake - Coerce unstake (called when slashed below the minimum)

func (Keeper) GetAccount

func (k Keeper) GetAccount(ctx sdk.Ctx, addr sdk.Address) (acc *auth.BaseAccount)

GetAccount - Retrieve account info

func (Keeper) GetAllValidators

func (k Keeper) GetAllValidators(ctx sdk.Ctx) (validators []types.Validator)

GetAllValidators - Retrieve set of all validators with no limits from the main store

func (Keeper) GetAllValidatorsAddrs

func (k Keeper) GetAllValidatorsAddrs(ctx sdk.Ctx) (validators []sdk.Address)

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

func (k Keeper) GetBalance(ctx sdk.Ctx, addr sdk.Address) sdk.BigInt

GetBalance - Retrieve balance for account

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Ctx) types.Params

GetParams - Retrieve all parameters as types.Params

func (Keeper) GetPreviousProposer

func (k Keeper) GetPreviousProposer(ctx sdk.Ctx) (addr sdk.Address)

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

func (k Keeper) GetStakedTokens(ctx sdk.Ctx) sdk.BigInt

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

func (k Keeper) GetValidator(ctx sdk.Ctx, addr sdk.Address) (validator types.Validator, found bool)

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

func (k Keeper) GetValidators(ctx sdk.Ctx, maxRetrieve uint16) (validators []types.Validator)

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

func (k Keeper) GetWaitingValidators(ctx sdk.Ctx) (validators []types.Validator)

GetWaitingValidators - Retrieve waiting validators

func (Keeper) IncrementJailedValidators

func (k Keeper) IncrementJailedValidators(ctx sdk.Ctx)

func (Keeper) IsWaitingValidator

func (k Keeper) IsWaitingValidator(ctx sdk.Ctx, valAddr sdk.Address) bool

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

func (k Keeper) JailValidator(ctx sdk.Ctx, addr sdk.Address)

JailValidator - Send a validator to jail

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Ctx) log.Logger

Logger - returns a module-specific logger.

func (Keeper) MaxChains

func (k Keeper) MaxChains(ctx sdk.Ctx) (res int64)

func (Keeper) MaxEvidenceAge

func (k Keeper) MaxEvidenceAge(ctx sdk.Ctx) (res time.Duration)

MaxEvidenceAge - Max age for evidence

func (Keeper) MaxJailedBlocks

func (k Keeper) MaxJailedBlocks(ctx sdk.Ctx) (res int64)

func (Keeper) MaxValidators

func (k Keeper) MaxValidators(ctx sdk.Ctx) (res int64)

MaxValidators - Retrieve maximum number of validators

func (Keeper) MinSignedPerWindow

func (k Keeper) MinSignedPerWindow(ctx sdk.Ctx) (res int64)

MinSignedPerWindow - Downtime slashing threshold

func (Keeper) MinimumStake

func (k Keeper) MinimumStake(ctx sdk.Ctx) (res int64)

MinimumStake - Retrieve Minimum stake

func (Keeper) NodeReward

func (k Keeper) NodeReward(ctx sdk.Ctx, reward sdk.BigInt) (nodeReward sdk.BigInt, feesCollected sdk.BigInt)

func (Keeper) PrevStateValidatorsPower

func (k Keeper) PrevStateValidatorsPower(ctx sdk.Ctx) (power sdk.BigInt)

PrevStateValidatorsPower - Load the prevState total validator power.

func (Keeper) ProposerAllocation

func (k Keeper) ProposerAllocation(ctx sdk.Ctx) (res int64)

ProposerAllocation - Retrieve proposer allocation

func (Keeper) RelaysToTokensMultiplier

func (k Keeper) RelaysToTokensMultiplier(ctx sdk.Ctx) sdk.BigInt

RelaysToTokensMultiplier - Retrieve relay token multipler

func (Keeper) ReleaseWaitingValidators

func (k Keeper) ReleaseWaitingValidators(ctx sdk.Ctx)

ReleaseWaitingValidators - Remove UnstakingValidators from store

func (Keeper) ResetValidatorSigningInfo

func (k Keeper) ResetValidatorSigningInfo(ctx sdk.Ctx, addr sdk.Address)

func (Keeper) RewardForRelays

func (k Keeper) RewardForRelays(ctx sdk.Ctx, relays sdk.BigInt, address sdk.Address) sdk.BigInt

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) SetParams

func (k Keeper) SetParams(ctx sdk.Ctx, params types.Params)

SetParams - Apply set of params

func (Keeper) SetPrevStateValPower

func (k Keeper) SetPrevStateValPower(ctx sdk.Ctx, addr sdk.Address, power int64)

SetPrevStateValPower - Store the power of a SINGLE staked validator from the previous state

func (Keeper) SetPrevStateValidatorsPower

func (k Keeper) SetPrevStateValidatorsPower(ctx sdk.Ctx, power sdk.BigInt)

SetPrevStateValidatorsPower - Store the prevState total validator power (used in moving the curr to prev)

func (Keeper) SetPreviousProposer

func (k Keeper) SetPreviousProposer(ctx sdk.Ctx, consAddr sdk.Address)

SetPreviousProposer - Store proposer public key for this block

func (Keeper) SetStakedValidator

func (k Keeper) SetStakedValidator(ctx sdk.Ctx, validator types.Validator)

SetStakedValidator - Store staked validator

func (Keeper) SetStakedValidatorByChains

func (k Keeper) SetStakedValidatorByChains(ctx sdk.Ctx, validator types.Validator)

SetStakedValidatorByChains - Store staked validator using networkId

func (Keeper) SetUnstakingValidator

func (k Keeper) SetUnstakingValidator(ctx sdk.Ctx, val types.Validator)

SetUnstakingValidator - Store a validator address to the appropriate position in the unstaking queue

func (Keeper) SetValidator

func (k Keeper) SetValidator(ctx sdk.Ctx, validator types.Validator)

SetValidator - Store validator in the main store and state stores (stakingset/ unstakingset)

func (Keeper) SetValidatorMissedAt

func (k Keeper) SetValidatorMissedAt(ctx sdk.Ctx, addr sdk.Address, index int64, missed bool)

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

func (k Keeper) SetWaitingValidator(ctx sdk.Ctx, val types.Validator)

SetWaitingValidator - Store validator on WaitingToBeginUnstaking store

func (Keeper) SetWaitingValidators

func (k Keeper) SetWaitingValidators(ctx sdk.Ctx, vals types.Validators)

func (Keeper) SignedBlocksWindow

func (k Keeper) SignedBlocksWindow(ctx sdk.Ctx) (res int64)

SignedBlocksWindow - Sliding window for downtime slashing

func (Keeper) SlashFractionDoubleSign

func (k Keeper) SlashFractionDoubleSign(ctx sdk.Ctx) (res sdk.BigDec)

SlashFractionDoubleSign - Retrieve slash fraction for double signature

func (Keeper) SlashFractionDowntime

func (k Keeper) SlashFractionDowntime(ctx sdk.Ctx) (res sdk.BigDec)

SlashFractionDowntime - Retrieve slash fraction time

func (Keeper) StakeDenom

func (k Keeper) StakeDenom(ctx sdk.Ctx) (res string)

StakeDenom - Bondable coin denomination

func (Keeper) StakeValidator

func (k Keeper) StakeValidator(ctx sdk.Ctx, validator types.Validator, amount sdk.BigInt) sdk.Error

StakeValidator - Store ops when a validator stakes

func (Keeper) TotalTokens

func (k Keeper) TotalTokens(ctx sdk.Ctx) sdk.BigInt

TotalTokens - Retrieve staking tokens from the total supply

func (Keeper) UnStakingTime

func (k Keeper) UnStakingTime(ctx sdk.Ctx) (res time.Duration)

UnStakingTime - Retrieve unstaking time param

func (Keeper) UnjailValidator

func (k Keeper) UnjailValidator(ctx sdk.Ctx, addr sdk.Address)

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 (k Keeper) UpgradeCodec(ctx sdk.Ctx)

func (Keeper) UpgradeMissedBlocksArray

func (k Keeper) UpgradeMissedBlocksArray(ctx sdk.Ctx, validators types.Validators) sdk.Error

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

func (k Keeper) ValidateValidatorBeginUnstaking(ctx sdk.Ctx, validator types.Validator) sdk.Error

ValidateValidatorBeginUnstaking - Check for validator status

func (Keeper) ValidateValidatorFinishUnstaking

func (k Keeper) ValidateValidatorFinishUnstaking(ctx sdk.Ctx, validator types.Validator) sdk.Error

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

func (Keeper) Validator

func (k Keeper) Validator(ctx sdk.Ctx, address sdk.Address) exported.ValidatorI

Validator - wrapper for GetValidator call

func (Keeper) WaitToBeginUnstakingValidator

func (k Keeper) WaitToBeginUnstakingValidator(ctx sdk.Ctx, validator types.Validator) sdk.Error

WaitToBeginUnstakingValidator - Change validator status to waiting to begin unstaking

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL