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§
Sourcetype UnsignedPhase: Get<BlockNumberFor<Self>>
type UnsignedPhase: Get<BlockNumberFor<Self>>
Duration of the unsigned phase.
Sourcetype SignedPhase: Get<BlockNumberFor<Self>>
type SignedPhase: Get<BlockNumberFor<Self>>
Duration of the signed phase.
Sourcetype SignedValidationPhase: Get<BlockNumberFor<Self>>
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.
Sourcetype VoterSnapshotPerBlock: Get<u32>
type VoterSnapshotPerBlock: Get<u32>
The number of snapshot voters to fetch per block.
Sourcetype TargetSnapshotPerBlock: Get<u32>
type TargetSnapshotPerBlock: Get<u32>
The number of snapshot targets to fetch per block.
Sourcetype Pages: Get<PageIndex>
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.
Sourcetype DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>>
type DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>>
Something that will provide the election data.
Sourcetype 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 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
.
Sourcetype Fallback: InstantElectionProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>, DataProvider = Self::DataProvider, 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>
The fallback type used for the election.
Sourcetype Verifier: Verifier<Solution = SolutionOf<Self::MinerConfig>, AccountId = Self::AccountId> + AsynchronousVerifier
type Verifier: Verifier<Solution = SolutionOf<Self::MinerConfig>, AccountId = Self::AccountId> + AsynchronousVerifier
The verifier pallet’s interface.
Sourcetype AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>
type AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>
The origin that can perform administration operations on this pallet.
Sourcetype AreWeDone: Get<Phase<Self>>
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
.
Sourcetype WeightInfo: WeightInfo
type WeightInfo: WeightInfo
The weight of the pallet.
Sourcetype OnRoundRotation: OnRoundRotation
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.