referrerpolicy=no-referrer-when-downgrade

Trait Config

Source
pub trait Config: Config + Config<RuntimeEvent: From<Event<Self>>> {
    type RelayChainOrigin: EnsureOrigin<Self::RuntimeOrigin>;
    type AHStakingInterface: AHStakingInterface<AccountId = Self::AccountId>;
    type SendToRelayChain: SendToRelayChain<AccountId = Self::AccountId>;
    type MaxValidatorSetRetries: Get<u32>;
    type ValidatorSetExportSession: Get<SessionIndex>;
}
Expand description

Configuration trait of this pallet.

The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.

Consequently, a runtime that wants to include this pallet must implement this trait.

Required Associated Types§

Source

type RelayChainOrigin: EnsureOrigin<Self::RuntimeOrigin>

An origin type that allows us to be sure a call is being dispatched by the relay chain.

It be can be configured to something like Root or relay chain or similar.

Source

type AHStakingInterface: AHStakingInterface<AccountId = Self::AccountId>

Our communication handle to the local staking pallet.

Source

type SendToRelayChain: SendToRelayChain<AccountId = Self::AccountId>

Our communication handle to the relay chain.

Source

type MaxValidatorSetRetries: Get<u32>

Maximum number of times that we retry sending a validator set to RC, after which, if sending still fails, we emit an UnexpectedKind::ValidatorSetDropped event and drop it.

Source

type ValidatorSetExportSession: Get<SessionIndex>

The end session index within an era post which we export validator set to RC.

This is a 1-indexed session number relative to the era start:

  • 0 = export immediately when received from staking pallet
  • 1 = export at end of first session of era
  • 5 = export at end of 5th session of era (for 6-session eras)

The validator set is placed in OutgoingValidatorSet when election completes in pallet-staking-async. The XCM message is sent when BOTH conditions met:

  1. Current session offset >= ValidatorSetExportSession
  2. OutgoingValidatorSet exists (validator set buffered)

Setting to 0 bypasses the session check and exports immediately.

Example: With SessionsPerEra=6 and ValidatorSetExportSession=4:

  • Session 0: Election completes → validator set buffered in OutgoingValidatorSet
  • Sessions 1-4: Buffered (session offset < 5)
  • End of Session 4 and start of Session 5: Export triggered.

Must be < SessionsPerEra.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§