pub trait DefaultConfig: DefaultConfig {
Show 22 associated items
type RuntimeHoldReason;
type CurrencyBalance: AtLeast32BitUnsigned + FullCodec + DecodeWithMemTracking + HasCompact<Type: DecodeWithMemTracking> + Copy + MaybeSerializeDeserialize + Debug + Default + From<u64> + TypeInfo + Send + Sync + MaxEncodedLen;
type CurrencyToVote;
type NominationsQuota;
type HistoryDepth: Get<u32>;
type RewardRemainder;
type Slash;
type Reward;
type SessionsPerEra: Get<SessionIndex>;
type PlanningEraOffset: Get<SessionIndex>;
type BondingDuration: Get<EraIndex>;
type SlashDeferDuration: Get<EraIndex>;
type MaxExposurePageSize: Get<u32>;
type MaxValidatorSet: Get<u32>;
type MaxUnlockingChunks: Get<u32>;
type MaxControllersInDeprecationBatch: Get<u32>;
type EventListeners;
type MaxInvulnerables: Get<u32>;
type MaxDisabledValidators: Get<u32>;
type MaxEraDuration: Get<u64>;
type Filter;
type WeightInfo: WeightInfo;
}
Expand description
Based on Config
. Auto-generated by
#[pallet::config(with_default)]
.
Can be used in tandem with
#[register_default_config]
and
#[derive_impl]
to derive test config traits
based on existing pallet config traits in a safe and developer-friendly way.
See here for more information and caveats about
the auto-generated DefaultConfig
trait and how it is generated.
Required Associated Types§
Sourcetype RuntimeHoldReason
type RuntimeHoldReason
Overarching hold reason.
Sourcetype CurrencyBalance: AtLeast32BitUnsigned + FullCodec + DecodeWithMemTracking + HasCompact<Type: DecodeWithMemTracking> + Copy + MaybeSerializeDeserialize + Debug + Default + From<u64> + TypeInfo + Send + Sync + MaxEncodedLen
type CurrencyBalance: AtLeast32BitUnsigned + FullCodec + DecodeWithMemTracking + HasCompact<Type: DecodeWithMemTracking> + Copy + MaybeSerializeDeserialize + Debug + Default + From<u64> + TypeInfo + Send + Sync + MaxEncodedLen
Just the Currency::Balance
type; we have this item to allow us to constrain it to
From<u64>
.
Sourcetype CurrencyToVote
type CurrencyToVote
Convert a balance into a number used for election calculation. This must fit into a
u64
but is allowed to be sensibly lossy. The u64
is used to communicate with the
[frame_election_provider_support
] crate which accepts u64 numbers and does operations
in 128.
Consequently, the backward convert is used convert the u128s from sp-elections back to a
BalanceOf
.
Sourcetype NominationsQuota
type NominationsQuota
Something that defines the maximum number of nominations per nominator.
Sourcetype HistoryDepth: Get<u32>
type HistoryDepth: Get<u32>
Number of eras to keep in history.
Following information is kept for eras in [current_era - HistoryDepth, current_era]
: ErasValidatorPrefs
, ErasValidatorReward
,
ErasRewardPoints
, ErasTotalStake
, ClaimedRewards
,
ErasStakersPaged
, ErasStakersOverview
.
Must be more than the number of eras delayed by session.
I.e. active era must always be in history. I.e. active_era > current_era - history_depth
must be guaranteed.
If migrating an existing pallet from storage value to config value, this should be set to same value or greater as in storage.
Sourcetype RewardRemainder
type RewardRemainder
Tokens have been minted and are unused for validator-reward. See Era payout.
Sourcetype Reward
type Reward
Handler for the unbalanced increment when rewarding a staker.
NOTE: in most cases, the implementation of OnUnbalanced
should modify the total
issuance.
Sourcetype SessionsPerEra: Get<SessionIndex>
type SessionsPerEra: Get<SessionIndex>
Number of sessions per era, as per the preferences of the relay chain.
Sourcetype PlanningEraOffset: Get<SessionIndex>
type PlanningEraOffset: Get<SessionIndex>
Number of sessions before the end of an era when the election for the next era will start.
- This determines how many sessions before the last session of the era the staking election process should begin.
- The value is bounded between 1 (election starts at the beginning of the last
session) and
SessionsPerEra
(election starts at the beginning of the first session of the era).
§Example:
- If
SessionsPerEra = 6
andPlanningEraOffset = 1
, the election starts at the beginning of session6 - 1 = 5
. - If
PlanningEraOffset = 6
, the election starts at the beginning of session6 - 6 = 0
, meaning it starts at the very beginning of the era.
Sourcetype BondingDuration: Get<EraIndex>
type BondingDuration: Get<EraIndex>
Number of eras that staked funds must remain bonded for.
Sourcetype SlashDeferDuration: Get<EraIndex>
type SlashDeferDuration: Get<EraIndex>
Number of eras that slashes are deferred by, after computation.
This should be less than the bonding duration. Set to 0 if slashes should be applied immediately, without opportunity for intervention.
Sourcetype MaxExposurePageSize: Get<u32>
type MaxExposurePageSize: Get<u32>
The maximum size of each T::ExposurePage
.
An ExposurePage
is weakly bounded to a maximum of MaxExposurePageSize
nominators.
For older non-paged exposure, a reward payout was restricted to the top
MaxExposurePageSize
nominators. This is to limit the i/o cost for the
nominator payout.
Note: MaxExposurePageSize
is used to bound ClaimedRewards
and is unsafe to
reduce without handling it in a migration.
Sourcetype MaxValidatorSet: Get<u32>
type MaxValidatorSet: Get<u32>
The absolute maximum of winner validators this pallet should return.
As this pallet supports multi-block election, the set of winner validators per election is bounded by this type.
Sourcetype MaxUnlockingChunks: Get<u32>
type MaxUnlockingChunks: Get<u32>
The maximum number of unlocking
chunks a StakingLedger
can
have. Effectively determines how many unique eras a staker may be
unbonding in.
Note: MaxUnlockingChunks
is used as the upper bound for the
BoundedVec
item StakingLedger.unlocking
. Setting this value
lower than the existing value can lead to inconsistencies in the
StakingLedger
and will need to be handled properly in a runtime
migration. The test reducing_max_unlocking_chunks_abrupt
shows
this effect.
Sourcetype MaxControllersInDeprecationBatch: Get<u32>
type MaxControllersInDeprecationBatch: Get<u32>
The maximum amount of controller accounts that can be deprecated in one call.
Sourcetype EventListeners
type EventListeners
Something that listens to staking updates and performs actions based on the data it receives.
WARNING: this only reports slashing and withdraw events for the time being.
Sourcetype MaxInvulnerables: Get<u32>
type MaxInvulnerables: Get<u32>
Maximum number of invulnerable validators.
Sourcetype MaxDisabledValidators: Get<u32>
type MaxDisabledValidators: Get<u32>
Maximum number of disabled validators.
Sourcetype MaxEraDuration: Get<u64>
type MaxEraDuration: Get<u64>
Maximum allowed era duration in milliseconds.
This provides a defensive upper bound to cap the effective era duration, preventing excessively long eras from causing runaway inflation (e.g., due to bugs). If the actual era duration exceeds this value, it will be clamped to this maximum.
Example: For an ideal era duration of 24 hours (86,400,000 ms), this can be set to 604,800,000 ms (7 days).
Sourcetype Filter
type Filter
Filter some accounts from participating in staking.
This is useful for example to blacklist an account that is participating in staking in another way (such as pools).
Sourcetype WeightInfo: WeightInfo
type WeightInfo: WeightInfo
Weight information for extrinsics in this pallet.