diff --git a/substrate/core/phragmen/src/lib.rs b/substrate/core/phragmen/src/lib.rs index 8ea3d55552..5295d0f422 100644 --- a/substrate/core/phragmen/src/lib.rs +++ b/substrate/core/phragmen/src/lib.rs @@ -478,18 +478,20 @@ fn do_equalize( let mut cumulative_stake: ExtendedBalance = 0; let mut last_index = elected_edges.len() - 1; - elected_edges.iter_mut().enumerate().for_each(|(idx, e)| { + let mut idx = 0usize; + for e in &mut elected_edges[..] { if let Some(support) = support_map.get_mut(&e.0) { - let stake: ExtendedBalance = support.total; + let stake = support.total; let stake_mul = stake.saturating_mul(idx as ExtendedBalance); let stake_sub = stake_mul.saturating_sub(cumulative_stake); if stake_sub > budget { last_index = idx.checked_sub(1).unwrap_or(0); - return + break; } cumulative_stake = cumulative_stake.saturating_add(stake); } - }); + idx += 1; + } let last_stake = elected_edges[last_index].1; let split_ways = last_index + 1; diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs index cc3a886e97..e7cc09b84f 100644 --- a/substrate/node/runtime/src/lib.rs +++ b/substrate/node/runtime/src/lib.rs @@ -85,7 +85,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 164, - impl_version: 164, + impl_version: 165, apis: RUNTIME_API_VERSIONS, }; diff --git a/substrate/srml/staking/src/lib.rs b/substrate/srml/staking/src/lib.rs index 4c73b64bd4..e82188a463 100644 --- a/substrate/srml/staking/src/lib.rs +++ b/substrate/srml/staking/src/lib.rs @@ -266,8 +266,7 @@ use sr_primitives::{ curve::PiecewiseLinear, weights::SimpleDispatchInfo, traits::{ - Convert, Zero, One, StaticLookup, CheckedSub, Saturating, Bounded, SimpleArithmetic, - SaturatedConversion, + Convert, Zero, One, StaticLookup, CheckedSub, Saturating, Bounded, SaturatedConversion, } }; use sr_staking_primitives::{