Disable equalize, avoiding consensus issue (#4608)

* Disable equalize, avoiding consensus issue

* Update frame/staking/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Gavin Wood
2020-01-13 12:49:52 +01:00
committed by GitHub
parent 4de8d5cef9
commit 2597457a7e
2 changed files with 1 additions and 36 deletions
-34
View File
@@ -1519,40 +1519,6 @@ impl<T: Trait> Module<T> {
Self::slashable_balance_of,
);
if cfg!(feature = "equalize") {
let mut staked_assignments
: Vec<(T::AccountId, Vec<PhragmenStakedAssignment<T::AccountId>>)>
= Vec::with_capacity(assignments.len());
for (n, assignment) in assignments.iter() {
let mut staked_assignment
: Vec<PhragmenStakedAssignment<T::AccountId>>
= Vec::with_capacity(assignment.len());
// If this is a self vote, then we don't need to equalise it at all. While the
// staking system does not allow nomination and validation at the same time,
// this must always be 100% support.
if assignment.len() == 1 && assignment[0].0 == *n {
continue;
}
for (c, per_thing) in assignment.iter() {
let nominator_stake = to_votes(Self::slashable_balance_of(n));
let other_stake = *per_thing * nominator_stake;
staked_assignment.push((c.clone(), other_stake));
}
staked_assignments.push((n.clone(), staked_assignment));
}
let tolerance = 0_u128;
let iterations = 2_usize;
sp_phragmen::equalize::<_, _, T::CurrencyToVote, _>(
staked_assignments,
&mut supports,
tolerance,
iterations,
Self::slashable_balance_of,
);
}
// Clear Stakers.
for v in Self::current_elected().iter() {
<Stakers<T>>::remove(v);