[EPM pallet]: remove number of signed submissions (#10945)

* [EPM pallet]: remove `number of signed submissions`

Closing #9229

* fix tests

* remove needless assert

* Update frame/election-provider-multi-phase/src/lib.rs

* cargo fmt

Signed-off-by: Niklas <niklasadolfsson1@gmail.com>

* fix grumbles

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* drop `num_signed_submissions` in WeightInfo too

* fix build

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Niklas Adolfsson
2022-03-03 23:47:10 +01:00
committed by GitHub
parent d6a52c637c
commit e6b6c8aac6
6 changed files with 101 additions and 156 deletions
@@ -310,7 +310,6 @@ frame_benchmarking::benchmarks! {
}
submit {
let c in 1 .. (T::SignedMaxSubmissions::get() - 1);
// the solution will be worse than all of them meaning the score need to be checked against
// ~ log2(c)
@@ -324,7 +323,10 @@ frame_benchmarking::benchmarks! {
<Round<T>>::put(1);
let mut signed_submissions = SignedSubmissions::<T>::get();
for i in 0..c {
// Insert `max - 1` submissions because the call to `submit` will insert another
// submission and the score is worse then the previous scores.
for i in 0..(T::SignedMaxSubmissions::get() - 1) {
let raw_solution = RawSolution {
score: ElectionScore { minimal_stake: 10_000_000u128 + (i as u128), ..Default::default() },
..Default::default()
@@ -342,9 +344,9 @@ frame_benchmarking::benchmarks! {
let caller = frame_benchmarking::whitelisted_caller();
T::Currency::make_free_balance_be(&caller, T::Currency::minimum_balance() * 10u32.into());
}: _(RawOrigin::Signed(caller), Box::new(solution), c)
}: _(RawOrigin::Signed(caller), Box::new(solution))
verify {
assert!(<MultiPhase<T>>::signed_submissions().len() as u32 == c + 1);
assert!(<MultiPhase<T>>::signed_submissions().len() as u32 == T::SignedMaxSubmissions::get());
}
submit_unsigned {