Type Alias altair_runtime::CollatorSelection
source · pub type CollatorSelection = Pallet<Runtime>;
Aliased Type§
struct CollatorSelection(/* private fields */);
Implementations
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
pub fn set_invulnerables(
origin: <T as Config>::RuntimeOrigin,
new: Vec<<T as Config>::AccountId>
) -> Result<(), DispatchError>
pub fn set_invulnerables( origin: <T as Config>::RuntimeOrigin, new: Vec<<T as Config>::AccountId> ) -> Result<(), DispatchError>
Set the list of invulnerable (fixed) collators. These collators must do some preparation, namely to have registered session keys.
The call will remove any accounts that have not registered keys from the set. That is,
it is non-atomic; the caller accepts all AccountId
s passed in new
individually as
acceptable Invulnerables, and is not proposing a set of new Invulnerables.
This call does not maintain mutual exclusivity of Invulnerables
and Candidates
. It
is recommended to use a batch of add_invulnerable
and remove_invulnerable
instead. A
batch_all
can also be used to enforce atomicity. If any candidates are included in
new
, they should be removed with remove_invulnerable_candidate
after execution.
Must be called by the UpdateOrigin
.
pub fn set_desired_candidates(
origin: <T as Config>::RuntimeOrigin,
max: u32
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn set_desired_candidates( origin: <T as Config>::RuntimeOrigin, max: u32 ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Set the ideal number of non-invulnerable collators. If lowering this number, then the number of running collators could be higher than this figure. Aside from that edge case, there should be no other way to have more candidates than the desired number.
The origin for this call must be the UpdateOrigin
.
pub fn set_candidacy_bond(
origin: <T as Config>::RuntimeOrigin,
bond: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn set_candidacy_bond( origin: <T as Config>::RuntimeOrigin, bond: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Set the candidacy bond amount.
If the candidacy bond is increased by this call, all current candidates which have a deposit lower than the new bond will be kicked from the list and get their deposits back.
The origin for this call must be the UpdateOrigin
.
pub fn register_as_candidate(
origin: <T as Config>::RuntimeOrigin
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn register_as_candidate( origin: <T as Config>::RuntimeOrigin ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Register this account as a collator candidate. The account must (a) already have
registered session keys and (b) be able to reserve the CandidacyBond
.
This call is not available to Invulnerable
collators.
pub fn leave_intent(
origin: <T as Config>::RuntimeOrigin
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn leave_intent( origin: <T as Config>::RuntimeOrigin ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Deregister origin
as a collator candidate. Note that the collator can only leave on
session change. The CandidacyBond
will be unreserved immediately.
This call will fail if the total number of candidates would drop below
MinEligibleCollators
.
pub fn add_invulnerable(
origin: <T as Config>::RuntimeOrigin,
who: <T as Config>::AccountId
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn add_invulnerable( origin: <T as Config>::RuntimeOrigin, who: <T as Config>::AccountId ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Add a new account who
to the list of Invulnerables
collators. who
must have
registered session keys. If who
is a candidate, they will be removed.
The origin for this call must be the UpdateOrigin
.
pub fn remove_invulnerable(
origin: <T as Config>::RuntimeOrigin,
who: <T as Config>::AccountId
) -> Result<(), DispatchError>
pub fn remove_invulnerable( origin: <T as Config>::RuntimeOrigin, who: <T as Config>::AccountId ) -> Result<(), DispatchError>
Remove an account who
from the list of Invulnerables
collators. Invulnerables
must
be sorted.
The origin for this call must be the UpdateOrigin
.
pub fn update_bond(
origin: <T as Config>::RuntimeOrigin,
new_deposit: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn update_bond( origin: <T as Config>::RuntimeOrigin, new_deposit: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Update the candidacy bond of collator candidate origin
to a new amount new_deposit
.
Setting a new_deposit
that is lower than the current deposit while origin
is
occupying a top-DesiredCandidates
slot is not allowed.
This call will fail if origin
is not a collator candidate, the updated bond is lower
than the minimum candidacy bond, and/or the amount cannot be reserved.
pub fn take_candidate_slot(
origin: <T as Config>::RuntimeOrigin,
deposit: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
target: <T as Config>::AccountId
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn take_candidate_slot( origin: <T as Config>::RuntimeOrigin, deposit: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, target: <T as Config>::AccountId ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
The caller origin
replaces a candidate target
in the collator candidate list by
reserving deposit
. The amount deposit
reserved by the caller must be greater than
the existing bond of the target it is trying to replace.
This call will fail if the caller is already a collator candidate or invulnerable, the
caller does not have registered session keys, the target is not a collator candidate,
and/or the deposit
amount cannot be reserved.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
pub fn account_id() -> <T as Config>::AccountId
pub fn account_id() -> <T as Config>::AccountId
Get a unique, inaccessible account ID from the PotId
.
pub fn assemble_collators() -> Vec<<T as Config>::AccountId>
pub fn assemble_collators() -> Vec<<T as Config>::AccountId>
Assemble the current set of candidates and invulnerables into the next collator set.
This is done on the fly, as frequent as we are told to do so, as the session manager.
pub fn kick_stale_candidates(
candidates: impl IntoIterator<Item = <T as Config>::AccountId>
) -> u32
pub fn kick_stale_candidates( candidates: impl IntoIterator<Item = <T as Config>::AccountId> ) -> u32
Kicks out candidates that did not produce a block in the kick threshold and refunds their deposits.
Return value is the number of candidates left in the list.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
pub fn invulnerables(
) -> BoundedVec<<T as Config>::AccountId, <T as Config>::MaxInvulnerables>
pub fn invulnerables( ) -> BoundedVec<<T as Config>::AccountId, <T as Config>::MaxInvulnerables>
An auto-generated getter for [Invulnerables
].
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
pub fn candidate_list(
) -> BoundedVec<CandidateInfo<<T as Config>::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>, <T as Config>::MaxCandidates>
pub fn candidate_list( ) -> BoundedVec<CandidateInfo<<T as Config>::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>, <T as Config>::MaxCandidates>
An auto-generated getter for [CandidateList
].
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
An auto-generated getter for [LastAuthoredBlock
].
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
pub fn desired_candidates() -> u32
pub fn desired_candidates() -> u32
An auto-generated getter for [DesiredCandidates
].
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
pub fn candidacy_bond(
) -> <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance
pub fn candidacy_bond( ) -> <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance
An auto-generated getter for [CandidacyBond
].
Trait Implementations
§impl<T> Callable<T> for Pallet<T>where
T: Config,
impl<T> Callable<T> for Pallet<T>where
T: Config,
type RuntimeCall = Call<T>
§impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
§fn integrity_test()
fn integrity_test()
§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
]). Read more§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
§impl<T> OnRuntimeUpgrade for Pallet<T>where
T: Config,
impl<T> OnRuntimeUpgrade for Pallet<T>where
T: Config,
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].§impl<T> IntegrityTest for Pallet<T>where
T: Config,
impl<T> IntegrityTest for Pallet<T>where
T: Config,
§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].§impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
§fn on_initialize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
) -> Weight
fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number ) -> Weight
Hooks::on_initialize
].§impl<T> StorageInfoTrait for Pallet<T>where
T: Config,
impl<T> StorageInfoTrait for Pallet<T>where
T: Config,
fn storage_info() -> Vec<StorageInfo>
§impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
§fn offchain_worker(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
)
fn offchain_worker( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )
§impl<T> OnGenesis for Pallet<T>where
T: Config,
impl<T> OnGenesis for Pallet<T>where
T: Config,
§fn on_genesis()
fn on_genesis()
§impl<T> WhitelistedStorageKeys for Pallet<T>where
T: Config,
impl<T> WhitelistedStorageKeys for Pallet<T>where
T: Config,
§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.§impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
§fn on_finalize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
)
fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )
Hooks::on_finalize
].§impl<T> PalletsInfoAccess for Pallet<T>where
T: Config,
impl<T> PalletsInfoAccess for Pallet<T>where
T: Config,
§impl<T> SessionManager<<T as Config>::AccountId> for Pallet<T>where
T: Config,
impl<T> SessionManager<<T as Config>::AccountId> for Pallet<T>where
T: Config,
Play the role of the session manager.
§fn new_session(index: u32) -> Option<Vec<<T as Config>::AccountId>>
fn new_session(index: u32) -> Option<Vec<<T as Config>::AccountId>>
§fn start_session(_: u32)
fn start_session(_: u32)
§fn end_session(_: u32)
fn end_session(_: u32)
§impl<T> BeforeAllRuntimeMigrations for Pallet<T>where
T: Config,
impl<T> BeforeAllRuntimeMigrations for Pallet<T>where
T: Config,
§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
impl<T> Eq for Pallet<T>
§impl<T> PalletInfoAccess for Pallet<T>where
T: Config,
impl<T> PalletInfoAccess for Pallet<T>where
T: Config,
§fn module_name() -> &'static str
fn module_name() -> &'static str
§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
§impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
§impl<T> GetStorageVersion for Pallet<T>where
T: Config,
impl<T> GetStorageVersion for Pallet<T>where
T: Config,
§type CurrentStorageVersion = StorageVersion
type CurrentStorageVersion = StorageVersion
§fn current_storage_version(
) -> <Pallet<T> as GetStorageVersion>::CurrentStorageVersion
fn current_storage_version( ) -> <Pallet<T> as GetStorageVersion>::CurrentStorageVersion
§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
§impl<T> EventHandler<<T as Config>::AccountId, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config + Config,
impl<T> EventHandler<<T as Config>::AccountId, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config + Config,
Keep track of number of authored blocks per authority, uncles are counted as well since they’re a valid proof of being online.