mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 15:05:40 +00:00
Adding Fallback on election failure (#5093)
* Adding `Fallback` on election failure
Use the newly introduced `BoundedOnChainSequentialPhragmen`
and `UnboundedOnChainSequentialPhragmen`
* Adding `BoundedOnchainExecution`
after changes in substrate
* Introducing `ExecutionConfig`
from `frame_election_provider_support::onchain`
* `OnChainSequentialPhragmen` > `OnChainSeqPhragmen`
Renaming to have a shorter name
* `BoundedOnchainExecution` -> `BoundedExecution`
And `UnboundedOnchainExecution` -> `UnboundedExecution`
* `Fallback` back to `NoFallback`
`UnboundedExecution` for `GovernanceFallback`
* Update runtime/test-runtime/src/lib.rs
* update lockfile for {"substrate"}
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -16,7 +16,10 @@
|
||||
|
||||
//! Code for elections.
|
||||
|
||||
use frame_election_provider_support::SortedListProvider;
|
||||
use frame_election_provider_support::{
|
||||
onchain::{ExecutionConfig, UnboundedExecution},
|
||||
ElectionDataProvider, SequentialPhragmen, SortedListProvider,
|
||||
};
|
||||
use sp_std::{boxed::Box, marker::PhantomData};
|
||||
|
||||
/// Implements the weight types for the elections module and a specific
|
||||
@@ -64,9 +67,20 @@ impl pallet_election_provider_multi_phase::BenchmarkingConfig for BenchmarkConfi
|
||||
/// The accuracy type used for genesis election provider;
|
||||
pub type OnOnChainAccuracy = sp_runtime::Perbill;
|
||||
|
||||
/// Election Configuration parameters
|
||||
pub struct OnChainSeqPhragmen<T: frame_system::Config, S>(PhantomData<(T, S)>);
|
||||
impl<
|
||||
T: frame_system::Config,
|
||||
S: ElectionDataProvider<AccountId = T::AccountId, BlockNumber = T::BlockNumber>,
|
||||
> ExecutionConfig for OnChainSeqPhragmen<T, S>
|
||||
{
|
||||
type System = T;
|
||||
type Solver = SequentialPhragmen<T::AccountId, OnOnChainAccuracy>;
|
||||
type DataProvider = S;
|
||||
}
|
||||
|
||||
/// The election provider of the genesis
|
||||
pub type GenesisElectionOf<T> =
|
||||
frame_election_provider_support::onchain::OnChainSequentialPhragmen<T>;
|
||||
pub type GenesisElectionOf<T, S> = UnboundedExecution<OnChainSeqPhragmen<T, S>>;
|
||||
|
||||
/// Implementation of `frame_election_provider_support::SortedListProvider` that updates the
|
||||
/// bags-list but uses [`pallet_staking::Nominators`] for `iter`. This is meant to be a transitionary
|
||||
|
||||
Reference in New Issue
Block a user