referrerpolicy=no-referrer-when-downgrade
pub trait Config: Config + CreateInherent<Call<Self>> {
Show 27 associated items type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent> + TryInto<Event<Self>>; type Currency: ReservableCurrency<Self::AccountId> + Currency<Self::AccountId>; type EstimateCallFee: EstimateCallFee<Call<Self>, BalanceOf<Self>>; type UnsignedPhase: Get<BlockNumberFor<Self>>; type SignedPhase: Get<BlockNumberFor<Self>>; type BetterSignedThreshold: Get<Perbill>; type OffchainRepeat: Get<BlockNumberFor<Self>>; type MinerTxPriority: Get<TransactionPriority>; type MinerConfig: MinerConfig<AccountId = Self::AccountId, MaxVotesPerVoter = <Self::DataProvider as ElectionDataProvider>::MaxVotesPerVoter, MaxWinners = Self::MaxWinners>; type SignedMaxSubmissions: Get<u32>; type SignedMaxWeight: Get<Weight>; type SignedMaxRefunds: Get<u32>; type SignedRewardBase: Get<BalanceOf<Self>>; type SignedDepositByte: Get<BalanceOf<Self>>; type SignedDepositWeight: Get<BalanceOf<Self>>; type MaxWinners: Get<u32>; type SignedDepositBase: Convert<usize, BalanceOf<Self>>; type ElectionBounds: Get<ElectionBounds>; type SlashHandler: OnUnbalanced<NegativeImbalanceOf<Self>>; type RewardHandler: OnUnbalanced<PositiveImbalanceOf<Self>>; type DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>>; type Fallback: InstantElectionProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>, DataProvider = Self::DataProvider, MaxWinners = Self::MaxWinners>; type GovernanceFallback: InstantElectionProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>, DataProvider = Self::DataProvider, MaxWinners = Self::MaxWinners>; type Solver: NposSolver<AccountId = Self::AccountId>; type ForceOrigin: EnsureOrigin<Self::RuntimeOrigin>; type BenchmarkingConfig: BenchmarkingConfig; type WeightInfo: WeightInfo;
}
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 RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent> + TryInto<Event<Self>>

source

type Currency: ReservableCurrency<Self::AccountId> + Currency<Self::AccountId>

Currency type.

source

type EstimateCallFee: EstimateCallFee<Call<Self>, BalanceOf<Self>>

Something that can predict the fee of a call. Used to sensibly distribute rewards.

source

type UnsignedPhase: Get<BlockNumberFor<Self>>

Duration of the unsigned phase.

source

type SignedPhase: Get<BlockNumberFor<Self>>

Duration of the signed phase.

source

type BetterSignedThreshold: Get<Perbill>

The minimum amount of improvement to the solution score that defines a solution as “better” in the Signed phase.

source

type OffchainRepeat: Get<BlockNumberFor<Self>>

The repeat threshold of the offchain worker.

For example, if it is 5, that means that at least 5 blocks will elapse between attempts to submit the worker’s solution.

source

type MinerTxPriority: Get<TransactionPriority>

The priority of the unsigned transaction submitted in the unsigned-phase

source

type MinerConfig: MinerConfig<AccountId = Self::AccountId, MaxVotesPerVoter = <Self::DataProvider as ElectionDataProvider>::MaxVotesPerVoter, MaxWinners = Self::MaxWinners>

Configurations of the embedded miner.

Any external software implementing this can use the unsigned::Miner type provided, which can mine new solutions and trim them accordingly.

source

type SignedMaxSubmissions: Get<u32>

Maximum number of signed submissions that can be queued.

It is best to avoid adjusting this during an election, as it impacts downstream data structures. In particular, SignedSubmissionIndices<T> is bounded on this value. If you update this value during an election, you must ensure that SignedSubmissionIndices.len() is less than or equal to the new value. Otherwise, attempts to submit new solutions may cause a runtime panic.

source

type SignedMaxWeight: Get<Weight>

Maximum weight of a signed solution.

If Config::MinerConfig is being implemented to submit signed solutions (outside of this pallet), then MinerConfig::solution_weight is used to compare against this value.

source

type SignedMaxRefunds: Get<u32>

The maximum amount of unchecked solutions to refund the call fee for.

source

type SignedRewardBase: Get<BalanceOf<Self>>

Base reward for a signed solution

source

type SignedDepositByte: Get<BalanceOf<Self>>

Per-byte deposit for a signed solution.

source

type SignedDepositWeight: Get<BalanceOf<Self>>

Per-weight deposit for a signed solution.

source

type MaxWinners: Get<u32>

The maximum number of winners that can be elected by this ElectionProvider implementation.

Note: This must always be greater or equal to T::DataProvider::desired_targets().

source

type SignedDepositBase: Convert<usize, BalanceOf<Self>>

Something that calculates the signed deposit base based on the signed submissions queue size.

source

type ElectionBounds: Get<ElectionBounds>

The maximum number of electing voters and electable targets to put in the snapshot. At the moment, snapshots are only over a single block, but once multi-block elections are introduced they will take place over multiple blocks.

source

type SlashHandler: OnUnbalanced<NegativeImbalanceOf<Self>>

Handler for the slashed deposits.

source

type RewardHandler: OnUnbalanced<PositiveImbalanceOf<Self>>

Handler for the rewards.

source

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

Something that will provide the election data.

source

type Fallback: InstantElectionProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>, DataProvider = Self::DataProvider, MaxWinners = Self::MaxWinners>

Configuration for the fallback.

source

type GovernanceFallback: InstantElectionProvider<AccountId = Self::AccountId, BlockNumber = BlockNumberFor<Self>, DataProvider = Self::DataProvider, MaxWinners = Self::MaxWinners>

Configuration of the governance-only fallback.

As a side-note, it is recommend for test-nets to use type ElectionProvider = BoundedExecution<_> if the test-net is not expected to have thousands of nominators.

source

type Solver: NposSolver<AccountId = Self::AccountId>

OCW election solution miner algorithm implementation.

source

type ForceOrigin: EnsureOrigin<Self::RuntimeOrigin>

Origin that can control this pallet. Note that any action taken by this origin (such) as providing an emergency solution is not checked. Thus, it must be a trusted origin.

source

type BenchmarkingConfig: BenchmarkingConfig

The configuration of benchmarking.

source

type WeightInfo: WeightInfo

The weight of the pallet.

Object Safety§

This trait is not object safe.

Implementors§