referrerpolicy=no-referrer-when-downgrade
people_westend_runtime

Type Alias CollatorSelection

Source
pub type CollatorSelection = Pallet<Runtime>;

Aliased Type§

struct CollatorSelection(/* private fields */);

Implementations

Source§

impl<T> Pallet<T>
where T: Config,

Source

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 AccountIds 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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source§

impl<T> Pallet<T>
where T: Config,

Source

pub fn account_id() -> <T as Config>::AccountId

Get a unique, inaccessible account ID from the PotId.

Source

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.

Source

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.

Source

pub fn do_try_state() -> Result<(), DispatchError>

Ensure the correctness of the state of this pallet.

This should be valid before or after each state transition of this pallet.

§Invariants
§DesiredCandidates
  • The current desired candidate count should not exceed the candidate list capacity.
  • The number of selected candidates together with the invulnerables must be greater than or equal to the minimum number of eligible collators.

Trait Implementations

Source§

impl<T> BeforeAllRuntimeMigrations for Pallet<T>
where T: Config,

Source§

fn before_all_runtime_migrations() -> Weight

Something that should happen before runtime migrations are executed.
Source§

impl<T> Benchmarking for Pallet<T>
where T: Config + Config + Config + Config,

Source§

fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>

Get the benchmarks available for this pallet. Generally there is one benchmark per extrinsic, so these are sometimes just called “extrinsics”. Read more
Source§

fn run_benchmark( extrinsic: &[u8], c: &[(BenchmarkParameter, u32)], whitelist: &[TrackedStorageKey], verify: bool, internal_repeats: u32, ) -> Result<Vec<BenchmarkResult>, BenchmarkError>

Run the benchmarks for this pallet.
Source§

impl<T> Callable<T> for Pallet<T>
where T: Config,

Source§

impl<T> Clone for Pallet<T>

Source§

fn clone(&self) -> Pallet<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Pallet<T>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> DispatchViewFunction for Pallet<T>
where T: Config,

Source§

fn dispatch_view_function<O>( id: &ViewFunctionId, input: &mut &[u8], output: &mut O, ) -> Result<(), ViewFunctionDispatchError>
where O: Output,

Source§

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.

Source§

fn note_author(author: <T as Config>::AccountId)

Note that the given account ID is the author of the current block.
Source§

impl<T> GetStorageVersion for Pallet<T>
where T: Config,

Source§

type InCodeStorageVersion = StorageVersion

This type is generated by the pallet macro. Read more
Source§

fn in_code_storage_version() -> <Pallet<T> as GetStorageVersion>::InCodeStorageVersion

Returns the in-code storage version as specified in the storage_version attribute, or NoStorageVersionSet if the attribute is missing.
Source§

fn on_chain_storage_version() -> StorageVersion

Returns the storage version of the pallet as last set in the actual on-chain storage.
Source§

fn current_storage_version() -> Self::InCodeStorageVersion

👎Deprecated: This method has been renamed to in_code_storage_version and will be removed after March 2024.
DEPRECATED: Use Self::current_storage_version instead. Read more
Source§

impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

Source§

fn integrity_test()

Check the integrity of this pallet’s configuration. Read more
Source§

fn try_state( _: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Result<(), DispatchError>

Execute the sanity checks of this pallet, per block. Read more
Source§

fn on_initialize(_n: BlockNumber) -> Weight

Block initialization hook. This is called at the very beginning of block execution. Read more
Source§

fn on_finalize(_n: BlockNumber)

Block finalization hook. This is called at the very end of block execution. Read more
Source§

fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight

Hook to consume a block’s idle time. This will run when the block is being finalized (before Hooks::on_finalize). Read more
Source§

fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)

A hook to run logic after inherent application. Read more
Source§

fn on_runtime_upgrade() -> Weight

Hook executed when a code change (aka. a “runtime upgrade”) is detected by the FRAME Executive pallet. Read more
Source§

fn pre_upgrade() -> Result<Vec<u8>, DispatchError>

Execute some pre-checks prior to a runtime upgrade. Read more
Source§

fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>

Execute some post-checks after a runtime upgrade. Read more
Source§

fn offchain_worker(_n: BlockNumber)

Implementing this function on a pallet allows you to perform long-running tasks that are dispatched as separate threads, and entirely independent of the main blockchain execution. Read more
Source§

impl<T> IntegrityTest for Pallet<T>
where T: Config,

Source§

impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

Source§

fn offchain_worker( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, )

This function is being called after every block import (when fully synced). Read more
Source§

impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

Source§

fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, )

Source§

impl<T> OnGenesis for Pallet<T>
where T: Config,

Source§

fn on_genesis()

Something that should happen at genesis.
Source§

impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

Source§

fn on_idle( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, remaining_weight: Weight, ) -> Weight

Source§

impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

Source§

fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Weight

Source§

impl<T> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

Source§

fn on_poll( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, weight: &mut WeightMeter, )

Code to execute every now and then at the beginning of the block after inherent application. Read more
Source§

impl<T> OnRuntimeUpgrade for Pallet<T>
where T: Config,

Source§

fn on_runtime_upgrade() -> Weight

Source§

fn pre_upgrade() -> Result<Vec<u8>, DispatchError>

Source§

fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError>

Source§

fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>

The expected and default behavior of this method is to handle executing pre_upgrade -> on_runtime_upgrade -> post_upgrade hooks for a migration. Read more
Source§

impl<T> PalletInfoAccess for Pallet<T>
where T: Config,

Source§

fn index() -> usize

Index of the pallet as configured in the runtime.
Source§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
Source§

fn name_hash() -> [u8; 16]

Two128 hash of name.
Source§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
Source§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
Source§

impl<T> PalletsInfoAccess for Pallet<T>
where T: Config,

Source§

fn count() -> usize

The number of pallets’ information that this type represents. Read more
Source§

fn infos() -> Vec<PalletInfoData>

All of the pallets’ information that this type represents.
Source§

impl<T> PartialEq for Pallet<T>

Source§

fn eq(&self, other: &Pallet<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> SessionManager<<T as Config>::AccountId> for Pallet<T>
where T: Config,

Play the role of the session manager.

Source§

fn new_session(index: u32) -> Option<Vec<<T as Config>::AccountId>>

Plan a new session, and optionally provide the new validator set. Read more
Source§

fn start_session(_: u32)

Start an already planned session. Read more
Source§

fn end_session(_: u32)

End the session. Read more
Source§

fn new_session_genesis(new_index: u32) -> Option<Vec<ValidatorId>>

Same as new_session, but it this should only be called at genesis. Read more
Source§

impl<T> StorageInfoTrait for Pallet<T>
where T: Config,

Source§

impl<T> TryDecodeEntireStorage for Pallet<T>
where T: Config,

Source§

fn try_decode_entire_state() -> Result<usize, Vec<TryDecodeEntireStorageError>>

Decode the entire data under the given storage, returning Ok(bytes_decoded) if success.
Source§

impl<T> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
where T: Config,

Source§

fn try_state( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, _s: Select, ) -> Result<(), DispatchError>

Execute the state checks.
Source§

impl<T> ViewFunctionIdPrefix for Pallet<T>
where T: Config,

Source§

fn prefix() -> [u8; 16]

Source§

impl<T> WhitelistedStorageKeys for Pallet<T>
where T: Config,

Source§

fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>

Returns a 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.
Source§

impl<T> Eq for Pallet<T>