BfcStaking
Description
The core DPoS consensus mechanism of the Bifrost Node is defined in pallet_bfc_staking
. The pallet_bfc_staking
is a custom pallet that defines the concepts of validators and nominators and also manages their self-bonds and nominations. In addition, it defines the concept of rounds as well as the logic within the rounds.
Extrinsics
set_staking_expectations(expectations: Range<BalanceOf>
)
interface:
api.tx.bfcStaking.setStakingExpectations
summary: Sets the expectations for total staked. These expectations determine the issuance of the round. The origin should be the root.
set_inflation(schedule: Range<Perbill>
)
interface:
api.tx.bfcStaking.setInflation
summary: Sets the annual inflation rate to derive per-round inflation. The origin should be the root.
set_max_full_selected(new: u32
)
interface:
api.tx.bfcStaking.setMaxFullSelected
summary: Sets the maximum number of full validator candidates selected per round. The origin should be the root.
set_basic_full_selected(new: u32
)
interface:
api.tx.bfcStaking.setMaxBasicSelected
summary: Sets the maximum number of basic validator candidates selected per round. The origin should be the root.
set_min_total_selected(new: u32
)
interface:
api.tx.bfcStaking.setMinTotalSelected
summary: Sets the minimum number of validator candidates selected per round. The origin should be the root.
set_default_validator_commission(new: Perbill
, tier: TierType
)
interface:
api.tx.bfcStaking.setDefaultValidatorCommission
summary: Sets the default commission rate for all validators of the given tier. The origin should be the root.
set_max_validator_commission(new: Perbill
, tier: TierType
)
interface:
api.tx.bfcStaking.setMaxValidatorCommission
summary: Sets the maximum commission rate for all validators of the given tier. The origin should be the root.
set_validator_commission(new: Perbill
)
interface:
api.tx.bfcStaking.setValidatorCommission
summary: Sets the commission rate of the given validator. The origin should be the controller account.
set_validator_tier(more: BalanceOf
, new: TierType
, relayer?: AccountId
)
interface:
api.tx.bfcStaking.setValidatorTier
summary: Modifies validator candidate tier. The actual state reflection will apply at the next round. The origin should be the stash account.
set_blocks_per_round(new: u32
)
interface:
api.tx.bfcStaking.setBlocksPerRound
summary: Sets blocks per round. The
new
round length will be updated immediately in the next block. This also updates the per-round inflation config. The origin should be the root.
set_storage_cache_lifetime(new: u32
)
interface:
api.tx.bfcStaking.setStorageCacheLifetime
summary: Sets the
StorageCacheLifetime
round length. The origin should be the root.
join_candidates(controller: AccountId
, relayer?: AccountId
, bond: BalanceOf
, candidate_count: u32
)
interface:
api.tx.bfcStaking.joinCandidates
summary: Join the set of validator candidates. The origin should be the stash account.
schedule_leave_candidates(candidate_count: u32
)
interface:
api.tx.bfcStaking.scheduleLeaveCandidates
summary: Requests to leave the set of candidates. If successful, the account is immediately removed from the candidate pool to prevent selection as a validator. The origin should be the controller account.
execute_leave_candidates(candidate_nomination_count: u32
)
interface:
api.tx.bfcStaking.executeLeaveCandidates
summary: Executes leave candidates request. The origin should be the stash account.
cancel_leave_candidates(candidate_count: u32
)
interface:
api.tx.bfcStaking.cancelLeaveCandidates
summary: Cancels open request to leave candidates. The origin should be the controller account.
set_controller(new: AccountId
)
interface:
api.tx.bfcStaking.setController
summary: (Re-)sets the bonded controller account. The origin must be the bonded stash account. The actual change will apply on the next round update. The origin should be the stash account.
set_candidate_reward_dst(new_reward_dst: RewardDestination
)
interface:
api.tx.bfcStaking.setCandidateRewardDst
summary: Sets the validator candidate reward destination. The origin should be the controller account.
set_nominator_reward_dst(new_reward_dst: RewardDestination
)
interface:
api.tx.bfcStaking.setNominatorRewardDst
summary: Sets the nominator reward destination.
go_offline()
interface:
api.tx.bfcStaking.goOffline
summary: Temporarily leaves the set of validator candidates without unbonding. The origin should be the controller account.
go_online()
interface:
api.tx.bfcStaking.goOnline
summary: Rejoins the set of validator candidates if previously been kicked out or went offline. The origin should be the controller account.
candidate_bond_more(more: BalanceOf
)
interface:
api.tx.bfcStaking.candidateBondMore
summary: Increases validator candidate self-bond by
more
. The origin should be the stash account.
schedule_candidate_bond_less(less: BalanceOf
)
interface:
api.tx.bfcStaking.scheduleCandidateBondLess
summary: Requests by validator candidate to decrease self-bond by
less
. The origin should be the controller account.
execute_candidate_bond_less()
interface:
api.tx.bfcStaking.executeCandidateBondLess
summary: Executes pending request to adjust the validator candidate self-bond. The origin should be the stash account.
cancel_candidate_bond_less()
interface:
api.tx.bfcStaking.cancelCandidateBondLess
summary: Cancels pending request to adjust the validator candidate self bond. The origin should be the controller account.
nominate(candidate: AccountId
, amount: BalanceOf
, candidate_nomination_count: u32
, nomination_count: u32
)
interface:
api.tx.bfcStaking.nominate
summary: Nominates the given
candidate
.
schedule_leave_nominators()
interface:
api.tx.bfcStaking.scheduleLeaveNominators
summary: Requests to leave the set of nominators.
execute_leave_nominators(nomination_count: u32
)
interface:
api.tx.bfcStaking.executeLeaveNominators
summary: Executes the right to exit the set of nominators and revoke all ongoing nominations.
cancel_leave_nominators()
interface:
api.tx.bfcStaking.cancelLeaveNominators
summary: Cancels a pending request to exit the set of nominators.
schedule_revoke_nomination(validator: AccountId
)
interface:
api.tx.bfcStaking.scheduleRevokeNomination
summary: Requests to revoke an existing nomination.
nominator_bond_more(candidate: AccountId
, more: BalanceOf
)
interface:
api.tx.bfcStaking.nominatorBondMore
summary: Bonds more for a specific validator candidate.
schedule_nominator_bond_less(candidate: AccountId
, less: BalanceOf
)
interface:
api.tx.bfcStaking.scheduleNominatorBondLess
summary: Requests bond less for a specific validator candidate.
execute_nomination_request(candidate: AccountId
)
interface:
api.tx.bfcStaking.executeNominationRequest
summary: Executes pending request to change an existing nomination.
cancel_nomination_request(candidate: AccountId
)
interface:
api.tx.bfcStaking.cancelNominationRequest
summary: Cancels request to change an existing nomination.
Storage Values
Session(): SessionIndex
interface:
api.query.bfcStaking.session
summary: Current session index of current round.
Round(): RoundInfo<T::BlockNumber>
interface:
api.query.bfcStaking.round
summary: Current round index and specific information.
StorageCacheLifetime(): u32
interface:
api.query.bfcStaking.storageCacheLifetime
summary: The maximum storage lifetime for storage data to be cached.
DefaultFullValidatorCommission(): Perbill
interface:
api.query.bfcStaking.defaultFullValidatorCommission
summary: Default commission rate for full validators.
DefaultBasicValidatorCommission(): Perbill
interface:
api.query.bfcStaking.defaultBasicValidatorCommission
summary: Default commission rate for basic validators.
MaxFullValidatorCommission(): Perbill
interface:
api.query.bfcStaking.maxFullValidatorCommission
summary: Maximum commission rate for full validators.
MaxBasicValidatorCommission(): Perbill
interface:
api.query.bfcStaking.maxBasicValidatorCommission
summary: Maximum commission rate for basic validators.
MaxTotalSelected(): u32
interface:
api.query.bfcStaking.maxTotalSelected
summary: Maximum node candidates selected every round.
MaxFullSelected(): u32
interface:
api.query.bfcStaking.maxFullSelected
summary: Maximum full node candidates selected every round.
MaxBasicSelected(): u32
interface:
api.query.bfcStaking.maxBasicSelected
summary: Maximum basic node candidates selected every round.
MinTotalSelected(): u32
interface:
api.query.bfcStaking.minTotalSelected
summary: Minimum candidates selected every round.
ProductivityPerBlock(): Perbill
interface:
api.query.bfcStaking.productivityPerBlock
summary: Productivity rate per block in the current round.
NominatorState(AccountId
): Option<Nominator<AccountId, BalanceOf>>
interface:
api.query.bfcStaking.nominatorState
summary: Gets nominator state associated with an account if the account is nominating else None.
CandidateInfo(AccountId
): Option<CandidateMetadata<AccountId, BalanceOf, BlockNumberOf>>
interface:
api.query.bfcStaking.candidateInfo
summary: Gets validator candidate info associated with an account if the account is candidate else None.
BondedStash(AccountId
): Option<AccountId>
interface:
api.query.bfcStaking.bondedStash
summary: Map from all locked "stash" accounts to the controller account.
TopNominations(AccountId
): Option<Nominations<AccountId, BalanceOf>>
interface:
api.query.bfcStaking.topNominations
summary: Top nominations for validator candidate.
BottomNominations(AccountId
): Option<Nominations<AccountId, BalanceOf>>
interface:
api.query.bfcStaking.bottomNominations
summary: Bottom nominations for validator candidate.
SelectedCandidates(): Vec<AccountId>
interface:
api.query.bfcStaking.selectedCandidates
summary: Active validator set (full and basic) selected for the current round.
SelectedFullCandidates(): Vec<AccountId>
interface:
api.query.bfcStaking.selectedFullCandidates
summary: Active full validator set selected for the current round.
SelectedBasicCandidates(): Vec<AccountId>
interface:
api.query.bfcStaking.selectedBasicCandidates
summary: Active basic validator set selected for the current round.
CachedSelectedCandidates(): Vec<(RoundIndex, Vec<AccountId>)>
interface:
api.query.bfcStaking.cachedSelectedCandidates
summary: Cached active validator set selected from previous rounds.
Majority(): u32
interface:
api.query.bfcStaking.majority
summary: Majority of the current active validator set.
CachedMajority(): Vec<(RoundIndex, u32)>
interface:
api.query.bfcStaking.cachedMajority
summary: Cached majority based on the active validator set selected from previous rounds.
Total(): BalanceOf
interface:
api.query.bfcStaking.total
summary: Total capital locked by this staking pallet.
CandidatePool(): Vec<Bond<AccountId, BalanceOf>>
interface:
api.query.bfcStaking.candidatePool
summary: The pool of validator candidates, each with their total voting power.
AtStake(RoundIndex
): ValidatorSnapshot<AccountId, BalanceOf>
interface:
api.query.bfcStaking.atStake
summary: Snapshot of validator nomination stake at the start of the round.
TotalAtStake(RoundIndex
): Option<TotalSnapshot<BalanceOf>>
interface:
api.query.bfcStaking.totalAtStake
summary: Snapshot of the network state at the start of the round.
DelayedPayouts(RoundIndex
): Option<DelayedPayout<BalanceOf>>
interface:
api.query.bfcStaking.delayedPayouts
summary: Delayed reward payouts.
DelayedControllerSets(RoundIndex
): Vec<DelayedControllerSet<AccountId>>
interface:
api.query.bfcStaking.delayedControllerSets
summary: Delayed new controller account set requests.
Staked(RoundIndex
): BalanceOf
interface:
api.query.bfcStaking.staked
summary: Total counted stake for selected candidates in the round.
InflationConfig(): InflationInfo<BalanceOf>
interface:
api.query.bfcStaking.inflationConfig
summary: Inflation configuration.
Points(RoundIndex
): RewardPoint
interface:
api.query.bfcStaking.points
summary: Total points awarded to validators for block production in the round.
AwardedPts(AccountId
): RewardPoint
interface:
api.query.bfcStaking.awardedPts
summary: Points for each validator per round.
AwardedTokens(): BalanceOf
interface:
api.query.bfcStaking.awardedTokens
summary: Tokens awarded to validators and nominators since genesis.
Constants
DefaultBlocksPerSession: u32
interface:
api.consts.bfcStaking.defaultBlocksPerSession
summary: Default number of blocks per session at genesis.
DefaultBlocksPerRound: u32
interface:
api.consts.bfcStaking.defaultBlocksPerRound
summary: Default number of blocks per round at genesis.
MinBlocksPerRound: u32
interface:
api.consts.bfcStaking.minBlocksPerRound
summary: Default minimum number of blocks per round at genesis.
StorageCacheLifetimeInRounds: u32
interface:
api.consts.bfcStaking.storageCacheLifetimeInRounds
summary: Maximum lifetime in rounds for certain storage data to be cached.
LeaveCandidatesDelay: RoundIndex
interface:
api.consts.bfcStaking.leaveCandidatesDelay
summary: Number of rounds that candidates remain bonded before exit request is executable.
CandidateBondLessDelay: RoundIndex
interface:
api.consts.bfcStaking.candidateBondLessDelay
summary: Number of rounds candidate requests to decrease self-bond must wait to be executable.
LeaveNominatorsDelay: RoundIndex
interface:
api.consts.bfcStaking.leaveNominatorsDelay
summary: Number of rounds that nominators remain bonded before exit request is executable.
RevokeNominationDelay: RoundIndex
interface:
api.consts.bfcStaking.revokeNominationDelay
summary: Number of rounds that nominations remain bonded before revocation request is executable.
NominationBondLessDelay: RoundIndex
interface:
api.consts.bfcStaking.nominationBondLessDelay
summary: Number of rounds that nomination less requests must wait before executable.
RewardPaymentDelay: RoundIndex
interface:
api.consts.bfcStaking.rewardPaymentDelay
summary: Number of rounds after which block authors are rewarded.
DefaultMaxSelectedFullCandidates: u32
interface:
api.consts.bfcStaking.defaultMaxSelectedFullCandidates
summary: Default maximum number of selected full node candidates every round.
DefaultMaxSelectedBasicCandidates: u32
interface:
api.consts.bfcStaking.defaultMaxSelectedBasicCandidates
summary: Default maximum number of selected basic node candidates every round.
DefaultMinSelectedCandidates: u32
interface:
api.consts.bfcStaking.defaultMinSelectedCandidates
summary: Default minimum number of selected candidates (full and basic) every round.
MaxTopNominationsPerCandidate: u32
interface:
api.consts.bfcStaking.maxTopNominationsPerCandidate
summary: Maximum top nominations counted per candidate.
MaxBottomNominationsPerCandidate: u32
interface:
api.consts.bfcStaking.maxBottomNominationsPerCandidate
summary: Maximum bottom nominations counted per candidate.
MaxNominationsPerNominator: u32
interface:
api.consts.bfcStaking.maxNominationsPerNominator
summary: Maximum nominations per nominator.
DefaultFullValidatorCommission: Perbill
interface:
api.consts.bfcStaking.defaultFullValidatorCommission
summary: Default commission rate for a full validator.
DefaultBasicValidatorCommission: Perbill
interface:
api.consts.bfcStaking.defaultBasicValidatorCommission
summary: Default commission rate for a basic validator.
MaxFullValidatorCommission: Perbill
interface:
api.consts.bfcStaking.maxFullValidatorCommission
summary: Maximum commission rate available for a full validator.
MaxBasicValidatorCommission: Perbill
interface:
api.consts.bfcStaking.maxBasicValidatorCommission
summary: Maximum commission rate available for a basic validator.
MinFullValidatorStk: BalanceOf
interface:
api.consts.bfcStaking.minFullValidatorStk
summary: Minimum stake required for any full node candidate to be in
SelectedCandidates
for the round.
MinBasicValidatorStk: BalanceOf
interface:
api.consts.bfcStaking.minBasicValidatorStk
summary: Minimum stake required for any basic node candidate to be in
SelectedCandidates
for the round.
MinFullCandidateStk: BalanceOf
interface:
api.consts.bfcStaking.minFullCandidateStk
summary: Minimum stake required for any account to be a full validator candidate.
MinBasicCandidateStk: BalanceOf
interface:
api.consts.bfcStaking.minBasicCandidateStk
summary: Minimum stake required for any account to be a basic validator candidate.
MinNominatorStk: BalanceOf
interface:
api.consts.bfcStaking.minNominatorStk
summary: Minimum stake for any registered on-chain account to be a nominator.
Last updated