mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +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:
@@ -414,7 +414,7 @@ decl_storage! {
|
||||
/// The length of the bonding duration in blocks.
|
||||
pub BondingDuration get(bonding_duration) config(): T::BlockNumber = T::BlockNumber::sa(1000);
|
||||
|
||||
/// Any validators that may never be slashed or forcibly kicked. It's a Vec since they're easy to initialise
|
||||
/// Any validators that may never be slashed or forcibly kicked. It's a Vec since they're easy to initialize
|
||||
/// and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets.
|
||||
pub Invulnerables get(invulnerables) config(): Vec<T::AccountId>;
|
||||
|
||||
@@ -915,7 +915,7 @@ impl<T: Trait> Module<T> {
|
||||
Self::slashable_balance_of,
|
||||
min_validator_count,
|
||||
ElectionConfig::<BalanceOf<T>> {
|
||||
equalise: false,
|
||||
equalize: false,
|
||||
tolerance: <BalanceOf<T>>::sa(10 as u64),
|
||||
iterations: 10,
|
||||
}
|
||||
@@ -960,7 +960,7 @@ impl<T: Trait> Module<T> {
|
||||
}
|
||||
|
||||
/// Call when a validator is determined to be offline. `count` is the
|
||||
/// number of offences the validator has committed.
|
||||
/// number of offenses the validator has committed.
|
||||
///
|
||||
/// NOTE: This is called with the controller (not the stash) account id.
|
||||
pub fn on_offline_validator(controller: T::AccountId, count: usize) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1525,7 +1525,7 @@ fn phragmen_election_works_example_2() {
|
||||
Staking::slashable_balance_of,
|
||||
min_validator_count,
|
||||
ElectionConfig::<BalanceOf<Test>> {
|
||||
equalise: true,
|
||||
equalize: true,
|
||||
tolerance: <BalanceOf<Test>>::sa(10 as u64),
|
||||
iterations: 10,
|
||||
}
|
||||
@@ -1806,7 +1806,7 @@ fn bond_with_little_staked_value() {
|
||||
|
||||
#[test]
|
||||
#[ignore] // Enable this once post-processing is on.
|
||||
fn phragmen_linear_worse_case_equalise() {
|
||||
fn phragmen_linear_worse_case_equalize() {
|
||||
with_externalities(&mut ExtBuilder::default()
|
||||
.nominate(false)
|
||||
.validator_pool(true)
|
||||
|
||||
Reference in New Issue
Block a user