mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 04:11:07 +00:00
move generics of election trait to associated types (#10475)
* move generics of election trait to associated types * fix doctest
This commit is contained in:
@@ -844,7 +844,9 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> ElectionDataProvider<T::AccountId, BlockNumberFor<T>> for Pallet<T> {
|
||||
impl<T: Config> ElectionDataProvider for Pallet<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type BlockNumber = BlockNumberFor<T>;
|
||||
const MAXIMUM_VOTES_PER_VOTER: u32 = T::MAX_NOMINATIONS;
|
||||
|
||||
fn desired_targets() -> data_provider::Result<u32> {
|
||||
|
||||
@@ -79,16 +79,16 @@ pub mod pallet {
|
||||
|
||||
/// Something that provides the election functionality.
|
||||
type ElectionProvider: frame_election_provider_support::ElectionProvider<
|
||||
Self::AccountId,
|
||||
Self::BlockNumber,
|
||||
AccountId = Self::AccountId,
|
||||
BlockNumber = Self::BlockNumber,
|
||||
// we only accept an election provider that has staking as data provider.
|
||||
DataProvider = Pallet<Self>,
|
||||
>;
|
||||
|
||||
/// Something that provides the election functionality at genesis.
|
||||
type GenesisElectionProvider: frame_election_provider_support::ElectionProvider<
|
||||
Self::AccountId,
|
||||
Self::BlockNumber,
|
||||
AccountId = Self::AccountId,
|
||||
BlockNumber = Self::BlockNumber,
|
||||
DataProvider = Pallet<Self>,
|
||||
>;
|
||||
|
||||
|
||||
@@ -4013,7 +4013,7 @@ mod election_data_provider {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
assert_eq!(Staking::nominators(101).unwrap().targets, vec![11, 21]);
|
||||
assert_eq!(
|
||||
<Staking as ElectionDataProvider<AccountId, BlockNumber>>::voters(None)
|
||||
<Staking as ElectionDataProvider>::voters(None)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|x| x.0 == 101)
|
||||
@@ -4028,7 +4028,7 @@ mod election_data_provider {
|
||||
// 11 is gone.
|
||||
start_active_era(2);
|
||||
assert_eq!(
|
||||
<Staking as ElectionDataProvider<AccountId, BlockNumber>>::voters(None)
|
||||
<Staking as ElectionDataProvider>::voters(None)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|x| x.0 == 101)
|
||||
@@ -4040,7 +4040,7 @@ mod election_data_provider {
|
||||
// resubmit and it is back
|
||||
assert_ok!(Staking::nominate(Origin::signed(100), vec![11, 21]));
|
||||
assert_eq!(
|
||||
<Staking as ElectionDataProvider<AccountId, BlockNumber>>::voters(None)
|
||||
<Staking as ElectionDataProvider>::voters(None)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|x| x.0 == 101)
|
||||
|
||||
Reference in New Issue
Block a user