Adding benchmarking for new frame_election_provider_support (#11149)

* First stab at adding benchmarking for
`election-provider-support` onchain

* Adding `BoundedPhragMMS` and fixing stuff

* Fixing node runtime

* Fixing tests

* Finalising all benchmarking stuff

* better comments

* Better benchmarking config

* Better `WeightInfo` and benchmarking

* Fixing tests

* Adding some documentation

* Fixing some typos

* Incorporating review feedback

* cleanup of rustdocs

* rustdoc changes

* changes after code review

* Fixing some errors.

* Fixing dependencies post merge

* Bringing back `UnboundedExecution`

* Better rustdoc and naming

* Cargo.toml formatting
This commit is contained in:
Georges
2022-04-15 11:15:01 +01:00
committed by GitHub
parent 7dca0e467c
commit ae75a371bf
18 changed files with 365 additions and 54 deletions
@@ -37,7 +37,7 @@ use sp_std::prelude::*;
///
/// In almost all cases, a balanced solution will have a better score than an unbalanced solution,
/// yet this is not 100% guaranteed because the first element of a [`crate::ElectionScore`] does not
/// directly related to balancing.
/// directly relate to balancing.
///
/// Note that some reference implementation adopt an approach in which voters are balanced randomly
/// per round. To advocate determinism, we don't do this. In each round, all voters are exactly
@@ -37,7 +37,7 @@ use sp_std::{prelude::*, rc::Rc};
/// - The algorithm is a _best-effort_ to elect `to_elect`. If less candidates are provided, less
/// winners are returned, without an error.
///
/// This can only fail of the normalization fails. This can happen if for any of the resulting
/// This can only fail if the normalization fails. This can happen if for any of the resulting
/// assignments, `assignment.distribution.map(|p| p.deconstruct()).sum()` fails to fit inside
/// `UpperOf<P>`. A user of this crate may statically assert that this can never happen and safely
/// `expect` this to return `Ok`.