Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions frame/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ pallet-staking-reward-curve = { version = "2.0.0", path = "../staking/reward-cu
substrate-test-utils = { version = "2.0.0", path = "../../test-utils" }

[features]
equalize = []
migrate = []
default = ["std", "equalize"]
default = ["std"]
std = [
"serde",
"safe-mix/std",
Expand Down
34 changes: 0 additions & 34 deletions frame/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down