Documentation ¶
Index ¶
- Variables
- func BallotResult(parentHeader, header RoundHeader, parentShardState *shard.State, ...) (shard.SlotList, shard.SlotList, shard.SlotList, error)
- func BlockSigners(bitmap []byte, parentCommittee *shard.Committee) (shard.SlotList, shard.SlotList, error)
- func ComputeAndMutateEPOSStatus(bc Reader, state ValidatorState, addr common.Address) error
- func ComputeCurrentSigning(snapshot, wrapper *staking.ValidatorWrapper) *staking.Computed
- func IncrementValidatorSigningCounts(staked *shard.StakedSlots, state ValidatorState, ...) error
- func IsBelowSigningThreshold(quotient numeric.Dec) bool
- func MinCommissionRate(era1, era2 bool) numeric.Dec
- func UpdateMaxCommissionFee(IsTopMaxRate bool, state stateValidatorWrapper, addr common.Address, ...) error
- func UpdateMinimumCommissionFee(electionEpoch *big.Int, state *state.DB, addr common.Address, ...) (bool, error)
- type Reader
- type RoundHeader
- type ValidatorState
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDivByZero .. ErrDivByZero = errors.New("toSign of availability cannot be 0, mistake in protocol") )
Functions ¶
func BallotResult ¶
func BallotResult( parentHeader, header RoundHeader, parentShardState *shard.State, shardID uint32, ) (shard.SlotList, shard.SlotList, shard.SlotList, error)
BallotResult returns (parentCommittee.Slots, payable, missings, err)
func BlockSigners ¶
func BlockSigners( bitmap []byte, parentCommittee *shard.Committee, ) (shard.SlotList, shard.SlotList, error)
BlockSigners ..
func ComputeAndMutateEPOSStatus ¶
func ComputeAndMutateEPOSStatus( bc Reader, state ValidatorState, addr common.Address, ) error
ComputeAndMutateEPOSStatus sets the validator to inactive and thereby keeping it out of consideration in the pool of validators for whenever committee selection happens in future, the signing threshold is 66%
func ComputeCurrentSigning ¶
func ComputeCurrentSigning( snapshot, wrapper *staking.ValidatorWrapper, ) *staking.Computed
ComputeCurrentSigning returns (signed, toSign, quotient, error)
func IncrementValidatorSigningCounts ¶
func IncrementValidatorSigningCounts( staked *shard.StakedSlots, state ValidatorState, signers, missing shard.SlotList, ) error
IncrementValidatorSigningCounts ..
func IsBelowSigningThreshold ¶
IsBelowSigningThreshold ..
func MinCommissionRate ¶
Returns the minimum commission rate between the two options. The later rate supersedes the earlier rate. If neither is applicable, returns 0.
func UpdateMaxCommissionFee ¶
func UpdateMaxCommissionFee(IsTopMaxRate bool, state stateValidatorWrapper, addr common.Address, curRate numeric.Dec) error
UpdateMaxCommissionFee makes sure the max-rate is at least higher than the rate + max-rate-change.
func UpdateMinimumCommissionFee ¶
func UpdateMinimumCommissionFee( electionEpoch *big.Int, state *state.DB, addr common.Address, minRate numeric.Dec, promoPeriod uint64, ) (bool, error)
UpdateMinimumCommissionFee update the validator commission fee to the minRate if the validator has a lower commission rate and promoPeriod epochs have passed after the validator was first elected. It returns true if the commission was updated
Types ¶
type Reader ¶
type Reader interface { ReadValidatorSnapshot( addr common.Address, ) (*staking.ValidatorSnapshot, error) }
Reader ..
type RoundHeader ¶
RoundHeader is the interface of block.Header for calculating the BallotResult.
type ValidatorState ¶
type ValidatorState interface { ValidatorWrapper(common.Address, bool, bool) (*staking.ValidatorWrapper, error) UpdateValidatorWrapper(common.Address, *staking.ValidatorWrapper) error }
ValidatorState is the interface of state.DB