mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 10:01:02 +00:00
EPM: allow duplicate submissions (#12237)
* allow for duplicate signed submissions * Fix a bunch of things, seems all good now * fmt * Fix * Update frame/election-provider-multi-phase/src/signed.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * Update frame/election-provider-multi-phase/src/signed.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * add migratin * fmt * comment typo * some review comments * fix bench Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> Co-authored-by: Ross Bulat <ross@parity.io>
This commit is contained in:
@@ -320,21 +320,14 @@ frame_benchmarking::benchmarks! {
|
||||
}
|
||||
|
||||
submit {
|
||||
// the solution will be worse than all of them meaning the score need to be checked against
|
||||
// ~ log2(c)
|
||||
let solution = RawSolution {
|
||||
score: ElectionScore { minimal_stake: 10_000_000u128 - 1, ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// the queue is full and the solution is only better than the worse.
|
||||
<MultiPhase<T>>::create_snapshot().map_err(<&str>::from)?;
|
||||
MultiPhase::<T>::on_initialize_open_signed();
|
||||
<Round<T>>::put(1);
|
||||
|
||||
let mut signed_submissions = SignedSubmissions::<T>::get();
|
||||
|
||||
// Insert `max - 1` submissions because the call to `submit` will insert another
|
||||
// submission and the score is worse then the previous scores.
|
||||
// Insert `max` submissions
|
||||
for i in 0..(T::SignedMaxSubmissions::get() - 1) {
|
||||
let raw_solution = RawSolution {
|
||||
score: ElectionScore { minimal_stake: 10_000_000u128 + (i as u128), ..Default::default() },
|
||||
@@ -350,6 +343,12 @@ frame_benchmarking::benchmarks! {
|
||||
}
|
||||
signed_submissions.put();
|
||||
|
||||
// this score will eject the weakest one.
|
||||
let solution = RawSolution {
|
||||
score: ElectionScore { minimal_stake: 10_000_000u128 + 1, ..Default::default() },
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let caller = frame_benchmarking::whitelisted_caller();
|
||||
let deposit = MultiPhase::<T>::deposit_for(
|
||||
&solution,
|
||||
|
||||
Reference in New Issue
Block a user