mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 02:55:43 +00:00
Convert all UK spelling to US (#2138)
* all the ise * forgot a misspelling * a few more replacements * bump impl * rollback and fixes * bump impl again * Add aliases for RPC * Update on_demand.rs
This commit is contained in:
@@ -26,11 +26,11 @@ use crate::{Exposure, BalanceOf, Trait, ValidatorPrefs, IndividualExposure};
|
||||
/// Configure the behavior of the Phragmen election.
|
||||
/// Might be deprecated.
|
||||
pub struct ElectionConfig<Balance: HasCompact> {
|
||||
/// Perform equalise?.
|
||||
pub equalise: bool,
|
||||
/// Number of equalise iterations.
|
||||
/// Perform equalize?.
|
||||
pub equalize: bool,
|
||||
/// Number of equalize iterations.
|
||||
pub iterations: usize,
|
||||
/// Tolerance of max change per equalise iteration.
|
||||
/// Tolerance of max change per equalize iteration.
|
||||
pub tolerance: Balance,
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ pub struct Candidate<AccountId, Balance: HasCompact> {
|
||||
approval_stake: Balance,
|
||||
/// Flag for being elected.
|
||||
elected: bool,
|
||||
/// This is most often equal to `Exposure.total` but not always. Needed for [`equalise`]
|
||||
/// This is most often equal to `Exposure.total` but not always. Needed for [`equalize`]
|
||||
backing_stake: Balance
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ pub struct Edge<AccountId, Balance: HasCompact> {
|
||||
backing_stake: Balance,
|
||||
/// Index of the candidate stored in the 'candidates' vector
|
||||
candidate_index: usize,
|
||||
/// Index of the candidate stored in the 'elected_candidates' vector. Used only with equalise.
|
||||
/// Index of the candidate stored in the 'elected_candidates' vector. Used only with equalize.
|
||||
elected_idx: usize,
|
||||
/// Indicates if this edge is a vote for an elected candidate. Used only with equalise.
|
||||
/// Indicates if this edge is a vote for an elected candidate. Used only with equalize.
|
||||
elected: bool,
|
||||
}
|
||||
|
||||
@@ -223,10 +223,10 @@ pub fn elect<T: Trait + 'static, FR, FN, FV, FS>(
|
||||
}
|
||||
}
|
||||
|
||||
// Optionally perform equalise post-processing.
|
||||
if config.equalise {
|
||||
// Optionally perform equalize post-processing.
|
||||
if config.equalize {
|
||||
let tolerance = config.tolerance;
|
||||
let equalise_iterations = config.iterations;
|
||||
let equalize_iterations = config.iterations;
|
||||
|
||||
// Fix indexes
|
||||
nominators.iter_mut().for_each(|n| {
|
||||
@@ -237,10 +237,10 @@ pub fn elect<T: Trait + 'static, FR, FN, FV, FS>(
|
||||
});
|
||||
});
|
||||
|
||||
for _i in 0..equalise_iterations {
|
||||
for _i in 0..equalize_iterations {
|
||||
let mut max_diff = <BalanceOf<T>>::zero();
|
||||
nominators.iter_mut().for_each(|mut n| {
|
||||
let diff = equalise::<T>(&mut n, &mut elected_candidates, tolerance);
|
||||
let diff = equalize::<T>(&mut n, &mut elected_candidates, tolerance);
|
||||
if diff > max_diff {
|
||||
max_diff = diff;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ pub fn elect<T: Trait + 'static, FR, FN, FV, FS>(
|
||||
Some(elected_candidates)
|
||||
}
|
||||
|
||||
pub fn equalise<T: Trait + 'static>(
|
||||
pub fn equalize<T: Trait + 'static>(
|
||||
nominator: &mut Nominator<T::AccountId, BalanceOf<T>>,
|
||||
elected_candidates: &mut Vec<Candidate<T::AccountId, BalanceOf<T>>>,
|
||||
tolerance: BalanceOf<T>
|
||||
|
||||
Reference in New Issue
Block a user