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:
Kian Paimani
2022-10-19 21:05:27 +01:00
committed by GitHub
parent 4870337d34
commit 0fe016eed7
5 changed files with 292 additions and 103 deletions
@@ -267,6 +267,7 @@ pub mod helpers;
const LOG_TARGET: &str = "runtime::election-provider";
pub mod migrations;
pub mod signed;
pub mod unsigned;
pub mod weights;
@@ -1265,8 +1266,8 @@ pub mod pallet {
#[pallet::storage]
pub type SignedSubmissionNextIndex<T: Config> = StorageValue<_, u32, ValueQuery>;
/// A sorted, bounded set of `(score, index)`, where each `index` points to a value in
/// `SignedSubmissions`.
/// A sorted, bounded vector of `(score, block_number, index)`, where each `index` points to a
/// value in `SignedSubmissions`.
///
/// We never need to process more than a single signed submission at a time. Signed submissions
/// can be quite large, so we're willing to pay the cost of multiple database accesses to access
@@ -1296,9 +1297,14 @@ pub mod pallet {
#[pallet::getter(fn minimum_untrusted_score)]
pub type MinimumUntrustedScore<T: Config> = StorageValue<_, ElectionScore>;
/// The current storage version.
///
/// v1: https://github.com/paritytech/substrate/pull/12237/
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
#[pallet::without_storage_info]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(PhantomData<T>);
}