keeper

package
v0.29.0-dev1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	DefaultParamspace = "stake"
)

Default parameter namespace

Variables

View Source
var (
	// Keys for store prefixes
	// TODO DEPRECATED: delete in next release and reorder keys
	// ParamKey                         = []byte{0x00} // key for parameters relating to staking
	PoolKey = []byte{0x01} // key for the staking pools

	// Last* values are const 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
)

nolint

View Source
var (
	Addrs = createTestAddrs(500)
	PKs   = createTestPubKeys(500)
)

dummy addresses used for testing

Functions

func AddressFromLastValidatorPowerKey added in v0.25.0

func AddressFromLastValidatorPowerKey(key []byte) []byte

Get the validator operator address from LastValidatorPowerKey

func GetDelegationKey

func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte

gets the key for delegator bond with validator VALUE: stake/types.Delegation

func GetDelegationsKey

func GetDelegationsKey(delAddr sdk.AccAddress) []byte

gets the prefix for a delegator for all validators

func GetLastValidatorPowerKey added in v0.25.0

func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte

get the bonded validator index key for an operator address

func GetREDByValDstIndexKey

func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte

gets the index-key for a redelegation, stored by destination-validator-index VALUE: none (key rearrangement used)

func GetREDByValSrcIndexKey

func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte

gets the index-key for a redelegation, stored by source-validator-index VALUE: none (key rearrangement used)

func GetREDKey

func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte

gets the key for a redelegation VALUE: stake/types.RedelegationKey

func GetREDKeyFromValDstIndexKey

func GetREDKeyFromValDstIndexKey(indexKey []byte) []byte

GetREDKeyFromValDstIndexKey rearranges the ValDstIndexKey to get the REDKey

func GetREDKeyFromValSrcIndexKey

func GetREDKeyFromValSrcIndexKey(indexKey []byte) []byte

GetREDKeyFromValSrcIndexKey rearranges the ValSrcIndexKey to get the REDKey

func GetREDsByDelToValDstIndexKey

func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) []byte

gets the prefix keyspace for all redelegations redelegating towards a destination validator from a particular delegator

func GetREDsFromValSrcIndexKey

func GetREDsFromValSrcIndexKey(valSrcAddr sdk.ValAddress) []byte

gets the prefix keyspace for all redelegations redelegating away from a source validator

func GetREDsKey

func GetREDsKey(delAddr sdk.AccAddress) []byte

gets the prefix keyspace for redelegations from a delegator

func GetREDsToValDstIndexKey

func GetREDsToValDstIndexKey(valDstAddr sdk.ValAddress) []byte

gets the prefix keyspace for all redelegations redelegating towards a destination validator

func GetRedelegationTimeKey added in v0.25.0

func GetRedelegationTimeKey(timestamp time.Time) []byte

gets the prefix for all unbonding delegations from a delegator

func GetUBDByValIndexKey

func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte

gets the index-key for an unbonding delegation, stored by validator-index VALUE: none (key rearrangement used)

func GetUBDKey

func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte

gets the key for an unbonding delegation by delegator and validator addr VALUE: stake/types.UnbondingDelegation

func GetUBDKeyFromValIndexKey

func GetUBDKeyFromValIndexKey(IndexKey []byte) []byte

rearranges the ValIndexKey to get the UBDKey

func GetUBDsByValIndexKey

func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte

gets the prefix keyspace for the indexes of unbonding delegations for a validator

func GetUBDsKey

func GetUBDsKey(delAddr sdk.AccAddress) []byte

gets the prefix for all unbonding delegations from a delegator

func GetUnbondingDelegationTimeKey added in v0.25.0

func GetUnbondingDelegationTimeKey(timestamp time.Time) []byte

gets the prefix for all unbonding delegations from a delegator

func GetValidatorByConsAddrKey added in v0.25.0

func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte

gets the key for the validator with pubkey VALUE: validator operator address ([]byte)

func GetValidatorKey

func GetValidatorKey(operatorAddr sdk.ValAddress) []byte

gets the key for the validator with address VALUE: stake/types.Validator

func GetValidatorQueueTimeKey added in v0.25.0

func GetValidatorQueueTimeKey(timestamp time.Time) []byte

gets the prefix for all unbonding delegations from a delegator

func GetValidatorsByPowerIndexKey

func GetValidatorsByPowerIndexKey(validator types.Validator) []byte

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 MakeTestCodec

func MakeTestCodec() *codec.Codec

create a codec used only for testing

func NewPubKey

func NewPubKey(pk string) (res crypto.PubKey)

func ParamTypeTable added in v0.25.0

func ParamTypeTable() params.TypeTable

ParamTable for stake module

func RandomBondedValidator added in v0.26.0

func RandomBondedValidator(r *rand.Rand, keeper Keeper, ctx sdk.Context) types.Validator

RandomBondedValidator returns a random bonded validator given access to the keeper and ctx

func RandomValidator added in v0.26.0

func RandomValidator(r *rand.Rand, keeper Keeper, ctx sdk.Context) types.Validator

RandomValidator returns a random validator given access to the keeper and ctx

func TestAddr

func TestAddr(addr string, bech string) sdk.AccAddress

for incode address generation

func TestingUpdateValidator added in v0.25.0

func TestingUpdateValidator(keeper Keeper, ctx sdk.Context, validator types.Validator, apply bool) types.Validator

update validator for testing

func ValEq

intended to be used with require/assert: require.True(ValEq(...))

func ValidatorByPowerIndexExists

func ValidatorByPowerIndexExists(ctx sdk.Context, keeper Keeper, power []byte) bool

does a certain by-power index record exist

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

keeper of the stake store

func CreateTestInput

func CreateTestInput(t *testing.T, isCheckTx bool, initCoins int64) (sdk.Context, auth.AccountKeeper, Keeper)

hogpodge of all sorts of input required for testing

func NewKeeper

func NewKeeper(cdc *codec.Codec, key, tkey sdk.StoreKey, ck bank.Keeper, paramstore params.Subspace, codespace sdk.CodespaceType) Keeper

func (Keeper) AddValidatorTokensAndShares added in v0.25.0

func (k Keeper) AddValidatorTokensAndShares(ctx sdk.Context, validator types.Validator,
	tokensToAdd sdk.Int) (valOut types.Validator, addedShares sdk.Dec)

Update the tokens of an existing validator, update the validators power index key

func (Keeper) ApplyAndReturnValidatorSetUpdates added in v0.25.0

func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []abci.ValidatorUpdate)

Apply and return accumulated updates to the bonded validator set. Also, * Updates the active valset as keyed by LastValidatorPowerKey. * Updates the total power as keyed by LastTotalPowerKey. * Updates validator status' according to updated powers. * Updates the fee pool bonded vs loose tokens. * Updates relevant indices. It gets called once after genesis, another time maybe after genesis transactions, then once at every EndBlock.

CONTRACT: Only validators with non-zero power or zero-power that were bonded at the previous block height or were removed from the validator set entirely are returned to Tendermint.

func (Keeper) BeginRedelegation

func (k Keeper) BeginRedelegation(ctx sdk.Context, delAddr sdk.AccAddress,
	valSrcAddr, valDstAddr sdk.ValAddress, sharesAmount sdk.Dec) (types.Redelegation, sdk.Error)

begin unbonding / redelegation; create a redelegation record

func (Keeper) BeginUnbonding

func (k Keeper) BeginUnbonding(ctx sdk.Context,
	delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec) (types.UnbondingDelegation, sdk.Error)

begin unbonding an unbonding record

func (Keeper) BondDenom added in v0.25.0

func (k Keeper) BondDenom(ctx sdk.Context) (res string)

BondDenom - Bondable coin denomination

func (Keeper) BondedRatio added in v0.25.0

func (k Keeper) BondedRatio(ctx sdk.Context) sdk.Dec

total power from the bond

func (Keeper) Codespace

func (k Keeper) Codespace() sdk.CodespaceType

return the codespace

func (Keeper) CompleteRedelegation

func (k Keeper) CompleteRedelegation(ctx sdk.Context, delAddr sdk.AccAddress,
	valSrcAddr, valDstAddr sdk.ValAddress) sdk.Error

complete unbonding an ongoing redelegation

func (Keeper) CompleteUnbonding

func (k Keeper) CompleteUnbonding(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) sdk.Error

complete unbonding an unbonding record CONTRACT: Expects unbonding passed in has finished the unbonding period

func (Keeper) Delegate

func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdk.Coin,
	validator types.Validator, subtractAccount bool) (newShares sdk.Dec, err sdk.Error)

Perform a delegation, set/update everything necessary within the store.

func (Keeper) Delegation

func (k Keeper) Delegation(ctx sdk.Context, addrDel sdk.AccAddress, addrVal sdk.ValAddress) sdk.Delegation

get the delegation for a particular set of delegator and validator addresses

func (Keeper) DeleteLastValidatorPower added in v0.25.0

func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress)

Delete the last validator power.

func (Keeper) DeleteValidatorByPowerIndex added in v0.25.0

func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) DeleteValidatorQueue added in v0.26.0

func (k Keeper) DeleteValidatorQueue(ctx sdk.Context, val types.Validator)

Delete a validator address from the validator queue

func (Keeper) DeleteValidatorQueueTimeSlice added in v0.26.0

func (k Keeper) DeleteValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time)

Deletes a specific validator queue timeslice.

func (Keeper) DequeueAllMatureRedelegationQueue added in v0.25.0

func (k Keeper) DequeueAllMatureRedelegationQueue(ctx sdk.Context, currTime time.Time) (matureRedelegations []types.DVVTriplet)

Returns a concatenated list of all the timeslices before currTime, and deletes the timeslices from the queue

func (Keeper) DequeueAllMatureUnbondingQueue added in v0.25.0

func (k Keeper) DequeueAllMatureUnbondingQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []types.DVPair)

Returns a concatenated list of all the timeslices before currTime, and deletes the timeslices from the queue

func (Keeper) GetAllDelegations

func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegation)

return all delegations used during genesis dump

func (Keeper) GetAllDelegatorDelegations added in v0.25.0

func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) (
	delegations []types.Delegation)

return all delegations for a delegator

func (Keeper) GetAllMatureValidatorQueue added in v0.25.0

func (k Keeper) GetAllMatureValidatorQueue(ctx sdk.Context, currTime time.Time) (matureValsAddrs []sdk.ValAddress)

Returns a concatenated list of all the timeslices before currTime, and deletes the timeslices from the queue

func (Keeper) GetAllRedelegations added in v0.25.0

func (k Keeper) GetAllRedelegations(ctx sdk.Context, delegator sdk.AccAddress) (redelegations []types.Redelegation)

return all redelegations for a delegator

func (Keeper) GetAllUnbondingDelegations added in v0.25.0

func (k Keeper) GetAllUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress) (
	unbondingDelegations []types.UnbondingDelegation)

return all unbonding-delegations for a delegator

func (Keeper) GetAllValidators

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

get the set of all validators with no limits, used during genesis dump

func (Keeper) GetBondedValidatorsByPower added in v0.25.0

func (k Keeper) GetBondedValidatorsByPower(ctx sdk.Context) []types.Validator

get the current group of bonded validators sorted by power-rank

func (Keeper) GetDelegation

func (k Keeper) GetDelegation(ctx sdk.Context,
	delAddr sdk.AccAddress, valAddr sdk.ValAddress) (
	delegation types.Delegation, found bool)

return a specific delegation

func (Keeper) GetDelegatorDelegations added in v0.25.0

func (k Keeper) GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress,
	maxRetrieve uint16) (delegations []types.Delegation)

return a given amount of all the delegations from a delegator

func (Keeper) GetDelegatorValidator added in v0.25.0

func (k Keeper) GetDelegatorValidator(ctx sdk.Context, delegatorAddr sdk.AccAddress,
	validatorAddr sdk.ValAddress) (validator types.Validator, err sdk.Error)

return a validator that a delegator is bonded to

func (Keeper) GetDelegatorValidators added in v0.25.0

func (k Keeper) GetDelegatorValidators(ctx sdk.Context, delegatorAddr sdk.AccAddress,
	maxRetrieve uint16) (validators []types.Validator)

Return all validators that a delegator is bonded to. If maxRetrieve is supplied, the respective amount will be returned.

func (Keeper) GetLastTotalPower added in v0.25.0

func (k Keeper) GetLastTotalPower(ctx sdk.Context) (power sdk.Int)

Load the last total validator power.

func (Keeper) GetLastValidatorPower added in v0.25.0

func (k Keeper) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) (power sdk.Int)

Load the last validator power. Returns zero if the operator was not a validator last block.

func (Keeper) GetLastValidators added in v0.25.0

func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator)

get the group of the bonded validators

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (res types.Params)

Get all parameteras as types.Params

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context) (pool types.Pool)

load the pool

func (Keeper) GetRedelegation

func (k Keeper) GetRedelegation(ctx sdk.Context,
	delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) (red types.Redelegation, found bool)

return a redelegation

func (Keeper) GetRedelegationQueueTimeSlice added in v0.25.0

func (k Keeper) GetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvvTriplets []types.DVVTriplet)

Gets a specific redelegation queue timeslice. A timeslice is a slice of DVVTriplets corresponding to redelegations that expire at a certain time.

func (Keeper) GetRedelegations added in v0.25.0

func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress,
	maxRetrieve uint16) (redelegations []types.Redelegation)

return a given amount of all the delegator redelegations

func (Keeper) GetRedelegationsFromValidator

func (k Keeper) GetRedelegationsFromValidator(ctx sdk.Context, valAddr sdk.ValAddress) (reds []types.Redelegation)

return all redelegations from a particular validator

func (Keeper) GetUnbondingDelegation

func (k Keeper) GetUnbondingDelegation(ctx sdk.Context,
	delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, found bool)

return a unbonding delegation

func (Keeper) GetUnbondingDelegations added in v0.25.0

func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress,
	maxRetrieve uint16) (unbondingDelegations []types.UnbondingDelegation)

return a given amount of all the delegator unbonding-delegations

func (Keeper) GetUnbondingDelegationsFromValidator

func (k Keeper) GetUnbondingDelegationsFromValidator(ctx sdk.Context, valAddr sdk.ValAddress) (ubds []types.UnbondingDelegation)

return all unbonding delegations from a particular validator

func (Keeper) GetUnbondingQueueTimeSlice added in v0.25.0

func (k Keeper) GetUnbondingQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPairs []types.DVPair)

gets a specific unbonding queue timeslice. A timeslice is a slice of DVPairs corresponding to unbonding delegations that expire at a certain time.

func (Keeper) GetValidator

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

get a single validator

func (Keeper) GetValidatorByConsAddr added in v0.25.0

func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator types.Validator, found bool)

get a single validator by consensus address

func (Keeper) GetValidatorDelegations added in v0.27.0

func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []types.Delegation)

return all delegations to a specific validator. Useful for querier.

func (Keeper) GetValidatorQueueTimeSlice added in v0.25.0

func (k Keeper) GetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (valAddrs []sdk.ValAddress)

gets a specific validator queue timeslice. A timeslice is a slice of ValAddresses corresponding to unbonding validators that expire at a certain time.

func (Keeper) GetValidatorSet

func (k Keeper) GetValidatorSet() sdk.ValidatorSet

Returns self as it is both a validatorset and delegationset

func (Keeper) GetValidators

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

return a given amount of all the validators

func (Keeper) HasReceivingRedelegation

func (k Keeper) HasReceivingRedelegation(ctx sdk.Context,
	delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool

check if validator is receiving a redelegation

func (Keeper) InflateSupply added in v0.25.0

func (k Keeper) InflateSupply(ctx sdk.Context, newTokens sdk.Dec)

when minting new tokens

func (Keeper) InsertRedelegationQueue added in v0.25.0

func (k Keeper) InsertRedelegationQueue(ctx sdk.Context, red types.Redelegation)

Insert an redelegation delegation to the appropriate timeslice in the redelegation queue

func (Keeper) InsertUnbondingQueue added in v0.25.0

func (k Keeper) InsertUnbondingQueue(ctx sdk.Context, ubd types.UnbondingDelegation)

Insert an unbonding delegation to the appropriate timeslice in the unbonding queue

func (Keeper) InsertValidatorQueue added in v0.25.0

func (k Keeper) InsertValidatorQueue(ctx sdk.Context, val types.Validator)

Insert an validator address to the appropriate timeslice in the validator queue

func (Keeper) IterateBondedValidatorsByPower added in v0.26.0

func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index int64, validator sdk.Validator) (stop bool))

iterate through the bonded validator set and perform the provided function

func (Keeper) IterateDelegations

func (k Keeper) IterateDelegations(ctx sdk.Context, delAddr sdk.AccAddress,
	fn func(index int64, del sdk.Delegation) (stop bool))

iterate through all of the delegations from a delegator

func (Keeper) IterateLastValidatorPowers added in v0.27.0

func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, handler func(operator sdk.ValAddress, power sdk.Int) (stop bool))

Iterate over last validator powers.

func (Keeper) IterateLastValidators added in v0.26.0

func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, validator sdk.Validator) (stop bool))

iterate through the active validator set and perform the provided function

func (Keeper) IterateRedelegations added in v0.26.0

func (k Keeper) IterateRedelegations(ctx sdk.Context, fn func(index int64, red types.Redelegation) (stop bool))

iterate through all redelegations

func (Keeper) IterateUnbondingDelegations added in v0.24.0

func (k Keeper) IterateUnbondingDelegations(ctx sdk.Context, fn func(index int64, ubd types.UnbondingDelegation) (stop bool))

iterate through all of the unbonding delegations

func (Keeper) IterateValidators

func (k Keeper) IterateValidators(ctx sdk.Context, fn func(index int64, validator sdk.Validator) (stop bool))

iterate through the validator set and perform the provided function

func (Keeper) Jail added in v0.25.0

func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)

jail a validator

func (Keeper) LastValidatorsIterator added in v0.26.0

func (k Keeper) LastValidatorsIterator(ctx sdk.Context) (iterator sdk.Iterator)

returns an iterator for the consensus validators in the last block

func (Keeper) MaxValidators added in v0.25.0

func (k Keeper) MaxValidators(ctx sdk.Context) (res uint16)

MaxValidators - Maximum number of validators

func (Keeper) OnDelegationCreated added in v0.25.0

func (k Keeper) OnDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Keeper) OnDelegationRemoved added in v0.25.0

func (k Keeper) OnDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Keeper) OnDelegationSharesModified added in v0.25.0

func (k Keeper) OnDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Keeper) OnValidatorBeginUnbonding added in v0.25.0

func (k Keeper) OnValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Keeper) OnValidatorBonded added in v0.25.0

func (k Keeper) OnValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Keeper) OnValidatorCreated added in v0.25.0

func (k Keeper) OnValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

Expose the hooks if present

func (Keeper) OnValidatorModified added in v0.25.0

func (k Keeper) OnValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

func (Keeper) OnValidatorPowerDidChange added in v0.25.0

func (k Keeper) OnValidatorPowerDidChange(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Keeper) OnValidatorRemoved added in v0.25.0

func (k Keeper) OnValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Keeper) RedelegationQueueIterator added in v0.25.0

func (k Keeper) RedelegationQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns all the redelegation queue timeslices from time 0 until endTime

func (Keeper) RemoveDelegation

func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation)

remove a delegation from store

func (Keeper) RemoveRedelegation

func (k Keeper) RemoveRedelegation(ctx sdk.Context, red types.Redelegation)

remove a redelegation object and associated index

func (Keeper) RemoveUnbondingDelegation

func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)

remove the unbonding delegation object and associated index

func (Keeper) RemoveValidator

func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress)

remove the validator record and associated indexes except for the bonded validator index which is only handled in ApplyAndReturnTendermintUpdates

func (Keeper) RemoveValidatorTokens added in v0.25.0

func (k Keeper) RemoveValidatorTokens(ctx sdk.Context, validator types.Validator, tokensToRemove sdk.Dec) types.Validator

Update the tokens of an existing validator, update the validators power index key

func (Keeper) RemoveValidatorTokensAndShares added in v0.25.0

func (k Keeper) RemoveValidatorTokensAndShares(ctx sdk.Context, validator types.Validator,
	sharesToRemove sdk.Dec) (valOut types.Validator, removedTokens sdk.Dec)

Update the tokens of an existing validator, update the validators power index key

func (Keeper) SetDelegation

func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation)

set the delegation

func (*Keeper) SetHooks added in v0.26.0

func (k *Keeper) SetHooks(sh sdk.StakingHooks) *Keeper

Set the validator hooks

func (Keeper) SetLastTotalPower added in v0.25.0

func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdk.Int)

Set the last total validator power.

func (Keeper) SetLastValidatorPower added in v0.25.0

func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress, power sdk.Int)

Set the last validator power.

func (Keeper) SetNewValidatorByPowerIndex added in v0.25.0

func (k Keeper) SetNewValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) SetParams

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

set the params

func (Keeper) SetPool

func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)

set the pool

func (Keeper) SetRedelegation

func (k Keeper) SetRedelegation(ctx sdk.Context, red types.Redelegation)

set a redelegation and associated index

func (Keeper) SetRedelegationQueueTimeSlice added in v0.25.0

func (k Keeper) SetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DVVTriplet)

Sets a specific redelegation queue timeslice.

func (Keeper) SetUnbondingDelegation

func (k Keeper) SetUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation)

set the unbonding delegation and associated index

func (Keeper) SetUnbondingQueueTimeSlice added in v0.25.0

func (k Keeper) SetUnbondingQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DVPair)

Sets a specific unbonding queue timeslice.

func (Keeper) SetValidator

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

set the main record holding validator details

func (Keeper) SetValidatorByConsAddr added in v0.25.0

func (k Keeper) SetValidatorByConsAddr(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) SetValidatorByPowerIndex

func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) SetValidatorQueueTimeSlice added in v0.25.0

func (k Keeper) SetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []sdk.ValAddress)

Sets a specific validator queue timeslice.

func (Keeper) Slash

func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, slashFactor sdk.Dec)

Slash a validator for an infraction committed at a known height Find the contributing stake at that height and burn the specified slashFactor of it, updating unbonding delegation & redelegations appropriately

CONTRACT:

slashFactor is non-negative

CONTRACT:

Infraction committed equal to or less than an unbonding period in the past,
so all unbonding delegations and redelegations from that height are stored

CONTRACT:

Slash will not slash unbonded validators (for the above reason)

CONTRACT:

Infraction committed at the current height or at a past height,
not at a height in the future

func (Keeper) TotalPower

func (k Keeper) TotalPower(ctx sdk.Context) sdk.Dec

total power from the bond (not last, but current)

func (Keeper) UnbondAllMatureValidatorQueue added in v0.25.0

func (k Keeper) UnbondAllMatureValidatorQueue(ctx sdk.Context)

Unbonds all the unbonding validators that have finished their unbonding period

func (Keeper) UnbondingQueueIterator added in v0.25.0

func (k Keeper) UnbondingQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns all the unbonding queue timeslices from time 0 until endTime

func (Keeper) UnbondingTime added in v0.25.0

func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration)

UnbondingTime

func (Keeper) Unjail added in v0.25.0

func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)

unjail a validator

func (Keeper) UpdateValidatorCommission added in v0.25.0

func (k Keeper) UpdateValidatorCommission(ctx sdk.Context, validator types.Validator, newRate sdk.Dec) (types.Commission, sdk.Error)

UpdateValidatorCommission attempts to update a validator's commission rate. An error is returned if the new commission rate is invalid.

func (Keeper) Validator

func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) sdk.Validator

get the sdk.validator for a particular address

func (Keeper) ValidatorByConsAddr added in v0.25.0

func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) sdk.Validator

get the sdk.validator for a particular pubkey

func (Keeper) ValidatorQueueIterator added in v0.25.0

func (k Keeper) ValidatorQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns all the validator queue timeslices from time 0 until endTime

func (Keeper) ValidatorsPowerStoreIterator added in v0.26.0

func (k Keeper) ValidatorsPowerStoreIterator(ctx sdk.Context) (iterator sdk.Iterator)

returns an iterator for the current validator power store

Jump to

Keyboard shortcuts

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