migrate pallet-elections-phragmen to attribute macros (#8044)

* All done

* Fix benchmarks

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Fix metadata.

* Fix build

* Add migrations

* Fix

* Update frame/elections-phragmen/src/migrations/v4.rs

* Better migeation test

* More test

* Fix warn

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Fix test

* early exit

* Fix

* Fix build

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Kian Paimani
2021-04-23 09:12:34 +02:00
committed by GitHub
parent 327934c19e
commit 8cc1af31c4
9 changed files with 657 additions and 455 deletions
@@ -23,9 +23,9 @@ use super::*;
use frame_system::RawOrigin;
use frame_benchmarking::{benchmarks, account, whitelist, impl_benchmark_test_suite};
use frame_support::traits::OnInitialize;
use frame_support::{traits::OnInitialize, dispatch::DispatchResultWithPostInfo};
use crate::Module as Elections;
use crate::Pallet as Elections;
const BALANCE_FACTOR: u32 = 250;
const MAX_VOTERS: u32 = 500;
@@ -87,11 +87,12 @@ fn submit_candidates_with_self_vote<T: Config>(c: u32, prefix: &'static str)
Ok(candidates)
}
/// Submit one voter.
fn submit_voter<T: Config>(caller: T::AccountId, votes: Vec<T::AccountId>, stake: BalanceOf<T>)
-> frame_support::dispatch::DispatchResult
{
fn submit_voter<T: Config>(
caller: T::AccountId,
votes: Vec<T::AccountId>,
stake: BalanceOf<T>,
) -> DispatchResultWithPostInfo {
<Elections<T>>::vote(RawOrigin::Signed(caller).into(), votes, stake)
}