Expand description
Validator Collators pallet.
Stores the validator set announced by the chain that runs pallet-staking-async, typically
Asset Hub, and offers it as a session manager, so the relay-chain validators of the current era
collate on a system parachain.
§Overview
The announcing chain sends the active validator set of each era, tagged with the era index of
pallet-staking-async.
This pallet stores the latest set, received through set_validators from Config::SetOrigin
or from another pallet through Pallet::receive_validator_set. It rejects a set whose era
is not newer than the stored one, or that has more validators than Config::MaxValidators.
The pallet is a [pallet_session::SessionManager]. At every session rotation it returns the
stored validators that have registered local session keys, checked with
Config::ValidatorRegistration. MaxCollators optionally caps how many of them are
returned. The runtime combines this pallet with pallet-collator-selection through
[pallet_session::UnionSessionManager], so invulnerables and candidates keep collating next to
the validators.
The stored set is the one staking elected for the era. The relay chain enacts only the elected validators with relay-chain session keys, and each system chain returns only those with keys registered there, so a returned collator is not necessarily an active relay-chain validator.
The pallet is also a [pallet_session::ShouldEndSession]. Pallet-session queues a new set at
one rotation and enacts it at the next. When a set arrives the pallet forces two rotations in
the following two blocks, so the set is in force without waiting for the regular period. The
regular rotations given by Config::PeriodicSession continue as before.
The returned validators author blocks like any collator, so a pallet-collator-selection event
handler pays them from its pot and records them in LastAuthoredBlock.
A runtime must configure pallet-collator-selection’s KickThreshold to exceed a full Aura
round of the merged list, Config::MaxValidators plus the invulnerables and candidates, times
the blocks the chain produces per Aura slot. Otherwise bonded candidates are kicked as stale
between their slots.
§TODO
- A random draw among the opted-in validators when a cap is set. For now the cap keeps a prefix of the set in account order.
- Counting the blocks each validator authors and reporting era points to the chain where
pallet-staking-asyncruns, typically Asset Hub. - Dropping validators that author no blocks for a session.
- (Only if a need is established) Propagating relay-chain offences to the collator set.
Re-exports§
pub use pallet::*;