mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12: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:
@@ -177,8 +177,8 @@ pub use frame_support::{traits::Get, weights::Weight, BoundedVec, RuntimeDebug};
|
||||
/// Re-export some type as they are used in the interface.
|
||||
pub use sp_arithmetic::PerThing;
|
||||
pub use sp_npos_elections::{
|
||||
Assignment, ElectionResult, Error, ExtendedBalance, IdentifierT, PerThing128, Support,
|
||||
Supports, VoteWeight,
|
||||
Assignment, BalancingConfig, ElectionResult, Error, ExtendedBalance, IdentifierT, PerThing128,
|
||||
Support, Supports, VoteWeight,
|
||||
};
|
||||
pub use traits::NposSolution;
|
||||
|
||||
@@ -568,11 +568,8 @@ pub struct SequentialPhragmen<AccountId, Accuracy, Balancing = ()>(
|
||||
sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>,
|
||||
);
|
||||
|
||||
impl<
|
||||
AccountId: IdentifierT,
|
||||
Accuracy: PerThing128,
|
||||
Balancing: Get<Option<(usize, ExtendedBalance)>>,
|
||||
> NposSolver for SequentialPhragmen<AccountId, Accuracy, Balancing>
|
||||
impl<AccountId: IdentifierT, Accuracy: PerThing128, Balancing: Get<Option<BalancingConfig>>>
|
||||
NposSolver for SequentialPhragmen<AccountId, Accuracy, Balancing>
|
||||
{
|
||||
type AccountId = AccountId;
|
||||
type Accuracy = Accuracy;
|
||||
@@ -596,11 +593,8 @@ pub struct PhragMMS<AccountId, Accuracy, Balancing = ()>(
|
||||
sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>,
|
||||
);
|
||||
|
||||
impl<
|
||||
AccountId: IdentifierT,
|
||||
Accuracy: PerThing128,
|
||||
Balancing: Get<Option<(usize, ExtendedBalance)>>,
|
||||
> NposSolver for PhragMMS<AccountId, Accuracy, Balancing>
|
||||
impl<AccountId: IdentifierT, Accuracy: PerThing128, Balancing: Get<Option<BalancingConfig>>>
|
||||
NposSolver for PhragMMS<AccountId, Accuracy, Balancing>
|
||||
{
|
||||
type AccountId = AccountId;
|
||||
type Accuracy = Accuracy;
|
||||
|
||||
Reference in New Issue
Block a user