mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
Use proper bounded vector type for nominations (#10601)
* Use proper bounded vector type for nominations * add docs and tweak chill_other for cleanup purposes * Fix the build * remove TODO * add a bit more doc * even more docs gushc * Update frame/staking/src/pallet/mod.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Update frame/staking/src/pallet/mod.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Fix the nasty bug * also bound the Snapshot type * fix doc test * document bounded_vec * self-review * remove unused * Fix build * frame-support: repetition overload for bounded_vec Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fix * remove the need to allocate into unbounded voters etc etc * Don't expect * unbreal the build again * handle macro a bit better Co-authored-by: Zeke Mostov <z.mostov@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -158,20 +158,10 @@ pub fn generate_random_npos_result(
|
||||
|
||||
(
|
||||
match election_type {
|
||||
ElectionType::Phragmen(conf) => seq_phragmen::<AccountId, sp_runtime::Perbill>(
|
||||
to_elect,
|
||||
candidates.clone(),
|
||||
voters.clone(),
|
||||
conf,
|
||||
)
|
||||
.unwrap(),
|
||||
ElectionType::Phragmms(conf) => phragmms::<AccountId, sp_runtime::Perbill>(
|
||||
to_elect,
|
||||
candidates.clone(),
|
||||
voters.clone(),
|
||||
conf,
|
||||
)
|
||||
.unwrap(),
|
||||
ElectionType::Phragmen(conf) =>
|
||||
seq_phragmen(to_elect, candidates.clone(), voters.clone(), conf).unwrap(),
|
||||
ElectionType::Phragmms(conf) =>
|
||||
phragmms(to_elect, candidates.clone(), voters.clone(), conf).unwrap(),
|
||||
},
|
||||
candidates,
|
||||
voters,
|
||||
|
||||
@@ -24,7 +24,7 @@ use honggfuzz::fuzz;
|
||||
use rand::{self, SeedableRng};
|
||||
use sp_npos_elections::{
|
||||
assignment_ratio_to_staked_normalized, is_score_better, seq_phragmen, to_supports,
|
||||
EvaluateSupport, VoteWeight,
|
||||
ElectionResult, EvaluateSupport, VoteWeight,
|
||||
};
|
||||
use sp_runtime::Perbill;
|
||||
|
||||
@@ -68,13 +68,8 @@ fn main() {
|
||||
};
|
||||
|
||||
if iterations > 0 {
|
||||
let balanced = seq_phragmen::<AccountId, sp_runtime::Perbill>(
|
||||
to_elect,
|
||||
candidates,
|
||||
voters,
|
||||
Some((iterations, 0)),
|
||||
)
|
||||
.unwrap();
|
||||
let balanced: ElectionResult<AccountId, sp_runtime::Perbill> =
|
||||
seq_phragmen(to_elect, candidates, voters, Some((iterations, 0))).unwrap();
|
||||
|
||||
let balanced_score = {
|
||||
let staked = assignment_ratio_to_staked_normalized(
|
||||
|
||||
@@ -23,8 +23,8 @@ use common::*;
|
||||
use honggfuzz::fuzz;
|
||||
use rand::{self, SeedableRng};
|
||||
use sp_npos_elections::{
|
||||
assignment_ratio_to_staked_normalized, is_score_better, phragmms, to_supports, EvaluateSupport,
|
||||
VoteWeight,
|
||||
assignment_ratio_to_staked_normalized, is_score_better, phragmms, to_supports, ElectionResult,
|
||||
EvaluateSupport, VoteWeight,
|
||||
};
|
||||
use sp_runtime::Perbill;
|
||||
|
||||
@@ -67,13 +67,8 @@ fn main() {
|
||||
score
|
||||
};
|
||||
|
||||
let balanced = phragmms::<AccountId, sp_runtime::Perbill>(
|
||||
to_elect,
|
||||
candidates,
|
||||
voters,
|
||||
Some((iterations, 0)),
|
||||
)
|
||||
.unwrap();
|
||||
let balanced: ElectionResult<AccountId, Perbill> =
|
||||
phragmms(to_elect, candidates, voters, Some((iterations, 0))).unwrap();
|
||||
|
||||
let balanced_score = {
|
||||
let staked =
|
||||
|
||||
Reference in New Issue
Block a user