mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
combine iteratons and tolerance in sp-npos-elections API (#11498)
* Initial implementation of mms * Some more attempts at `mms` * Functioning `MMS` algorithm implementation. Adding some tests too * More tests and typos fixed. * Adding fuzzer for `mms` (but could not test it on Mac M1) * Missing imports * Fixing rustdoc * More accurate implementation of `mms` * Removing the fuzzer `mms` implementation * Implementing `NposSolver` for `MMS` had to add the `Clone` trait, maybe I could see if I can get rid of it. * Fixing rust docs by adding () to resolve ambiguity * Amending `unwrap` to `expect` removing unneeded `Clone` trait * Removing redundant `mms3.rs` * Implementing `BalancingConfig` and rustdoc changes * Implementing `weight` for `MMS` * Implementing `weight` for `MMS` * Fixing post merge * Initial implementation of mms * Some more attempts at `mms` * Functioning `MMS` algorithm implementation. Adding some tests too * More tests and typos fixed. * Adding fuzzer for `mms` (but could not test it on Mac M1) * Missing imports * Fixing rustdoc * More accurate implementation of `mms` * Removing the fuzzer `mms` implementation * Implementing `NposSolver` for `MMS` had to add the `Clone` trait, maybe I could see if I can get rid of it. * Amending `unwrap` to `expect` removing unneeded `Clone` trait * Fixing rust docs by adding () to resolve ambiguity * Removing redundant `mms3.rs` * Implementing `BalancingConfig` and rustdoc changes * Implementing `weight` for `MMS` * Implementing `weight` for `MMS` * Fixing post merge * Removing left over from rebase * Fixing tests * Removing unneeded import * Removing unneeded functions * Removing useless imports Co-authored-by: kianenigma <kian@parity.io>
This commit is contained in:
@@ -1808,7 +1808,7 @@ mod tests {
|
||||
};
|
||||
use frame_election_provider_support::ElectionProvider;
|
||||
use frame_support::{assert_noop, assert_ok};
|
||||
use sp_npos_elections::Support;
|
||||
use sp_npos_elections::{BalancingConfig, Support};
|
||||
|
||||
#[test]
|
||||
fn phase_rotation_works() {
|
||||
@@ -2163,7 +2163,7 @@ mod tests {
|
||||
assert_eq!(MultiPhase::current_phase(), Phase::Signed);
|
||||
|
||||
// set the solution balancing to get the desired score.
|
||||
crate::mock::Balancing::set(Some((2, 0)));
|
||||
crate::mock::Balancing::set(Some(BalancingConfig { iterations: 2, tolerance: 0 }));
|
||||
|
||||
let (solution, _) = MultiPhase::mine_solution().unwrap();
|
||||
// Default solution's score.
|
||||
|
||||
@@ -39,8 +39,8 @@ use sp_core::{
|
||||
H256,
|
||||
};
|
||||
use sp_npos_elections::{
|
||||
assignment_ratio_to_staked_normalized, seq_phragmen, to_supports, ElectionResult,
|
||||
EvaluateSupport, ExtendedBalance,
|
||||
assignment_ratio_to_staked_normalized, seq_phragmen, to_supports, BalancingConfig,
|
||||
ElectionResult, EvaluateSupport,
|
||||
};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
@@ -324,7 +324,7 @@ impl InstantElectionProvider for MockFallback {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub static Balancing: Option<(usize, ExtendedBalance)> = Some((0, 0));
|
||||
pub static Balancing: Option<BalancingConfig> = Some( BalancingConfig { iterations: 0, tolerance: 0 } );
|
||||
}
|
||||
|
||||
pub struct TestBenchmarkingConfig;
|
||||
|
||||
Reference in New Issue
Block a user