Expand description
§Staking Async Pallet
This pallet is a fork of the original pallet-staking
, with a number of key differences:
- It no longer has access to a secure timestamp, previously used to calculate the duration of an era.
- It no longer has access to a pallet-session.
- It no longer has access to a pallet-authorship.
- It is capable of working with a multi-page
ElectionProvider``, aka.
pallet-election-provider-multi-block`.
While pallet-staking
was somewhat general-purpose, this pallet is absolutely NOT right from
the get-go: It is designed to be used ONLY in Polkadot/Kusama AssetHub system parachains.
The workings of this pallet can be divided into a number of subsystems, as follows.
§User Interactions
TODO
§Session and Era Rotation
TODO
§Exposure Collection
TODO
§Slashing of Validators and Exposures
TODO
Re-exports§
pub use weights::WeightInfo;
pub use ledger::StakingLedger;
pub use ledger::UnlockChunk;
pub use __tt_error_token_1 as tt_error_token;
pub use __tt_default_parts_7 as tt_default_parts;
pub use __tt_extra_parts_7 as tt_extra_parts;
pub use __tt_default_parts_v2_7 as tt_default_parts_v2;
Modules§
- Contains all the interactions with
Config::Currency
to manipulate the underlying staking asset. - Staking pallet benchmarking.
- Default implementations of
DefaultConfig
, which can be used to implementConfig
. - Auto-generated docs-only module listing all defined dispatchables for this pallet.
- A static size tracker for the election snapshot data.
- A Ledger implementation for stakers.
- Manages all era rotation logic based on session increments.
- A slashing implementation for NPoS systems.
- Auto-generated docs-only module listing all (public and private) defined storage types for this pallet.
- Testing utils for staking. Provides some common functions to setup staking state, such as bonding validators, nominators, and generating different types of solutions.
- Autogenerated weights for
pallet_staking_async
Macros§
Structs§
- Information regarding the active era (era in used in session).
- A utility struct that provides a way to check if a given account is a staker.
- Custom bound for
BondedEras
which is equal toConfig::BondingDuration
+ 1. - A bounded wrapper for [
sp_staking::ExposurePage
]. - Reward points of an era. Used to split era total payout between validators.
- A snapshot of the stake backing a single validator in the system.
- A nomination quota that allows up to MAX nominations for all validators.
- Can be used to configure the genesis state of this pallet.
- The amount of exposure for an era that an individual nominator has (susceptible to slashing).
- A record of the nominations made by a specific account.
- Facade struct to encapsulate
PagedExposureMetadata
and a single page ofExposurePage
. - The
Pallet
struct, the main type that implements traits and standalone functions within the pallet. - A pending slash record. The value of the slash has been computed but not applied yet, rather deferred for several eras.
- A simple voter list implementation that does not require any additional pallets. Note, this does not provided nominators in sorted ordered. If you desire nominators in a sorted order take a look at [`pallet-bags-list].
- A simple sorted list implementation that does not require any additional pallets. Note, this does not provide validators in sorted order. If you desire nominators in a sorted order take a look at [
pallet-bags-list
]. - Preference of what happens regarding validation.
Enums§
- Contains a variant per dispatchable extrinsic that this pallet has.
- Possible operations on the configuration values of this pallet.
- The
Error
enum of this pallet. - The
Event
enum of this pallet - Mode of era-forcing.
- A reason for placing a hold on funds.
- A destination account for payment.
- Status of a paged snapshot progress.
- Representation of the status of a staker.
Traits§
- Configuration trait of this pallet.
- 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. - Handler for determining how much of a balance should be paid out on the current era.
- Something that defines the maximum number of nominations per nominator based on a curve.
Type Aliases§
- The active era information, it holds index and start.
- The balance type of this pallet.
- Map from all locked “stash” accounts to the controller account.
- A mapping from still-bonded eras to the first session index of that era.
- Alias for a bounded set of exposures behind a validator, parameterized by this pallet’s election provider.
- The amount of currency given to reporters of a slash event which was canceled by extraordinary circumstances (e.g. governance).
- The current planned era index.
- History of claimed paged rewards by era and validator.
- Rewards for the last
Config::HistoryDepth
eras. If reward hasn’t been set or has been removed then 0 reward is returned. - Summary of validator exposure at a given era.
- Paginated exposure of a validator at given era.
- The total amount staked for the last
Config::HistoryDepth
eras. If total hasn’t been set or has been removed then 0 stake is returned. - Exposure of validator at era with the preferences of validators.
- The total validator era payout for the last
Config::HistoryDepth
eras. - Mode of era forcing.
- Any validators that may never be slashed or forcibly kicked. It’s a Vec since they’re easy to initialize and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets.
- Map from all (unlocked) “controller” accounts to the info regarding the staking.
- Maximum number of nominations per nominator.
- The maximum nominator count before we stop allowing new validators to join.
- Maximum staked rewards, i.e. the percentage of the era inflation that is used for stake rewards. See Era payout.
- The maximum validator count before we stop allowing new validators to join.
- Alias for the maximum number of winners (aka. active validators), as defined in by this pallet’s config.
- Alias for the maximum number of winners per page, as expected by the election provider.
- The minimum amount of commission that validators can set.
- The minimum active bond to become and maintain the role of a nominator.
- The minimum active bond to become and maintain the role of a validator.
- The minimum active nominator stake of the last successful election.
- Module
Deprecated Type alias toPallet
, to be used byconstruct_runtime
. - The map from nominator stash key to their nomination preferences, namely the validators that they wish to support.
- Stores reported offences in a queue until they are processed in subsequent blocks.
- Tracks the eras that contain offences in
OffenceQueue
, sorted from earliest to latest. - Where the reward payment should be made. Keyed by stash.
- Tracks the currently processed offence record from the
OffenceQueue
. - Counter for the number of “reward” points earned by a given validator.
- The percentage of the slash that is distributed to reporters.
- All unapplied slashes that are queued for later.
- The ideal number of active validators.
- The map from (wannabe) validator stash key to the preferences of that validator.
- Stakers whose funds are managed by other pallets.