mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 11:05:40 +00:00
bounding staking: BoundedElectionProvider trait (#12362)
* add a bounded election provider trait * extract common trait election provider base * fmt * only bound the outer support vector * fix tests * docs * fix rust docs * fmt * fix rustdocs * docs * improve docs * small doc change
This commit is contained in:
@@ -80,7 +80,7 @@ macro_rules! log {
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
use crate::types::*;
|
||||
use frame_election_provider_support::ElectionProvider;
|
||||
use frame_election_provider_support::ElectionProviderBase;
|
||||
use frame_support::{
|
||||
pallet_prelude::*,
|
||||
traits::{Defensive, ReservableCurrency},
|
||||
@@ -330,7 +330,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
if <T as pallet_staking::Config>::ElectionProvider::ongoing() {
|
||||
if <<T as pallet_staking::Config>::ElectionProvider as ElectionProviderBase>::ongoing()
|
||||
{
|
||||
// NOTE: we assume `ongoing` does not consume any weight.
|
||||
// there is an ongoing election -- we better not do anything. Imagine someone is not
|
||||
// exposed anywhere in the last era, and the snapshot for the election is already
|
||||
|
||||
@@ -104,7 +104,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
pub struct MockElection;
|
||||
impl frame_election_provider_support::ElectionProvider for MockElection {
|
||||
impl frame_election_provider_support::ElectionProviderBase for MockElection {
|
||||
type AccountId = AccountId;
|
||||
type BlockNumber = BlockNumber;
|
||||
type DataProvider = Staking;
|
||||
@@ -113,7 +113,9 @@ impl frame_election_provider_support::ElectionProvider for MockElection {
|
||||
fn ongoing() -> bool {
|
||||
Ongoing::get()
|
||||
}
|
||||
}
|
||||
|
||||
impl frame_election_provider_support::ElectionProvider for MockElection {
|
||||
fn elect() -> Result<frame_election_provider_support::Supports<AccountId>, Self::Error> {
|
||||
Err(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user