referrerpolicy=no-referrer-when-downgrade
pub trait Config: Config + Config<RuntimeEvent: From<Event<Self>>> {
Show 14 associated items type UnsignedPhase: Get<BlockNumberFor<Self>>; type SignedPhase: Get<BlockNumberFor<Self>>; type SignedValidationPhase: Get<BlockNumberFor<Self>>; type VoterSnapshotPerBlock: Get<u32>; type TargetSnapshotPerBlock: Get<u32>; type Pages: Get<PageIndex>; type DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>>; type MinerConfig: MinerConfig<Pages = Self::Pages, AccountId = <Self as Config>::AccountId, MaxVotesPerVoter = <Self::DataProvider as ElectionDataProvider>::MaxVotesPerVoter, VoterSnapshotPerBlock = Self::VoterSnapshotPerBlock, TargetSnapshotPerBlock = Self::TargetSnapshotPerBlock, MaxBackersPerWinner = <Self::Verifier as Verifier>::MaxBackersPerWinner, MaxWinnersPerPage = <Self::Verifier as Verifier>::MaxWinnersPerPage>; type Fallback: InstantElectionProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>, DataProvider = Self::DataProvider, MaxBackersPerWinner = <Self::Verifier as Verifier>::MaxBackersPerWinner, MaxWinnersPerPage = <Self::Verifier as Verifier>::MaxWinnersPerPage>; type Verifier: Verifier<Solution = SolutionOf<Self::MinerConfig>, AccountId = Self::AccountId> + AsynchronousVerifier; type AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>; type AreWeDone: Get<Phase<Self>>; type WeightInfo: WeightInfo; type OnRoundRotation: OnRoundRotation;
}
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 UnsignedPhase: Get<BlockNumberFor<Self>>

Duration of the unsigned phase.

Source

type SignedPhase: Get<BlockNumberFor<Self>>

Duration of the signed phase.

Source

type SignedValidationPhase: Get<BlockNumberFor<Self>>

Duration of the singed validation phase.

The duration of this should not be less than T::Pages, and there is no point in it being more than SignedPhase::MaxSubmission::get() * T::Pages. TODO: integrity test for it.

Source

type VoterSnapshotPerBlock: Get<u32>

The number of snapshot voters to fetch per block.

Source

type TargetSnapshotPerBlock: Get<u32>

The number of snapshot targets to fetch per block.

Source

type Pages: Get<PageIndex>

The number of pages.

The snapshot is created with this many keys in the storage map.

The solutions may contain at MOST this many pages, but less pages are acceptable as well.

Source

type DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>>

Something that will provide the election data.

Source

type MinerConfig: MinerConfig<Pages = Self::Pages, AccountId = <Self as Config>::AccountId, MaxVotesPerVoter = <Self::DataProvider as ElectionDataProvider>::MaxVotesPerVoter, VoterSnapshotPerBlock = Self::VoterSnapshotPerBlock, TargetSnapshotPerBlock = Self::TargetSnapshotPerBlock, MaxBackersPerWinner = <Self::Verifier as Verifier>::MaxBackersPerWinner, MaxWinnersPerPage = <Self::Verifier as Verifier>::MaxWinnersPerPage>

The miner configuration.

These configurations are passed to crate::unsigned::miner::BaseMiner. An external miner implementation should implement this trait, and use the said BaseMiner.

Source

type Fallback: InstantElectionProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>, DataProvider = Self::DataProvider, MaxBackersPerWinner = <Self::Verifier as Verifier>::MaxBackersPerWinner, MaxWinnersPerPage = <Self::Verifier as Verifier>::MaxWinnersPerPage>

The fallback type used for the election.

Source

type Verifier: Verifier<Solution = SolutionOf<Self::MinerConfig>, AccountId = Self::AccountId> + AsynchronousVerifier

The verifier pallet’s interface.

Source

type AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>

The origin that can perform administration operations on this pallet.

Source

type AreWeDone: Get<Phase<Self>>

An indicator of whether we should move to do the crate::types::Phase::Done or not? This is called at the end of the election process.

Common implementation is ProceedRegardlessOf or RevertToSignedIfNotQueuedOf.

Source

type WeightInfo: WeightInfo

The weight of the pallet.

Source

type OnRoundRotation: OnRoundRotation

Single type that implement super::OnRoundRotation to do something when the round ends.

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§