srml-module: Phragmen election (#3364)

* phragmen election module.

* Add new files.

* Some doc update

* Update weights.

* bump and a few nits.

* Performance improvement.

* Master.into()

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Fix build

* Some fixes.

* Fix build.

* Proper outgoing and runner-up managment.

* Bit more sensical weight values.

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

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* fix lock file

* Fix build.

* Remove runner-ups

* Some refactors.

* Add support for reporting voters.

* Fix member check.

* Remove equlize.rs

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

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

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Bring back runner ups.

* use decode_len

* Better weight values.

* Update bogus doc

* Bump.

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Review comments.

* One more test

* Fix tests

* Fix build

* .. and fix benchmarks.

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

* Version bump
This commit is contained in:
Kian Paimani
2019-09-19 12:04:02 +02:00
committed by Gavin Wood
parent 5585770a12
commit bfe240d1b0
12 changed files with 1715 additions and 45 deletions
+3 -2
View File
@@ -1241,7 +1241,7 @@ impl<T: Trait> Module<T> {
);
if let Some(phragmen_result) = maybe_phragmen_result {
let elected_stashes = phragmen_result.winners;
let elected_stashes = phragmen_result.winners.iter().map(|(s, _)| s.clone()).collect::<Vec<T::AccountId>>();
let mut assignments = phragmen_result.assignments;
// helper closure.
@@ -1284,7 +1284,8 @@ impl<T: Trait> Module<T> {
}
}
if cfg!(feature = "equalize") {
#[cfg(feature = "equalize")]
{
let tolerance = 0_u128;
let iterations = 2_usize;
equalize::<_, _, _, T::CurrencyToVote>(