Skip to content
Snippets Groups Projects
Unverified Commit 12ed0f4f authored by José Molina Colmenero's avatar José Molina Colmenero Committed by GitHub
Browse files

Add an extra_constant to pallet-collator-selection (#7206)


Currently `pallet-collator-selection` does not expose a way to query the
assigned pot account derived from the `PotId` configuration item.
Without it, it is not possible to transfer the existential deposit to
it.

This PR addresses this issue by exposing an extra constant.

---------

Co-authored-by: default avatarBastian Köcher <git@kchr.de>
parent cbf3925e
No related merge requests found
Pipeline #512624 waiting for manual action with stages
in 40 minutes and 4 seconds
......@@ -150,22 +150,27 @@ pub mod pallet {
type UpdateOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// Account Identifier from which the internal Pot is generated.
#[pallet::constant]
type PotId: Get<PalletId>;
/// Maximum number of candidates that we should have.
///
/// This does not take into account the invulnerables.
#[pallet::constant]
type MaxCandidates: Get<u32>;
/// Minimum number eligible collators. Should always be greater than zero. This includes
/// Invulnerable collators. This ensures that there will always be one collator who can
/// produce a block.
#[pallet::constant]
type MinEligibleCollators: Get<u32>;
/// Maximum number of invulnerables.
#[pallet::constant]
type MaxInvulnerables: Get<u32>;
// Will be kicked if block is not produced in threshold.
#[pallet::constant]
type KickThreshold: Get<BlockNumberFor<Self>>;
/// A stable ID for a validator.
......@@ -183,6 +188,14 @@ pub mod pallet {
type WeightInfo: WeightInfo;
}
#[pallet::extra_constants]
impl<T: Config> Pallet<T> {
/// Gets this pallet's derived pot account.
fn pot_account() -> T::AccountId {
Self::account_id()
}
}
/// Basic information about a collation candidate.
#[derive(
PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo, MaxEncodedLen,
......
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
title: "Add an extra_constant to pallet-collator-selection"
doc:
- audience: Runtime Dev
description: |
- Allows to query collator-selection's pot account via extra constant.
crates:
- name: pallet-collator-selection
bump: minor
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment