mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 20:01:08 +00:00
Scale and increase validator count (#6417)
This commit is contained in:
@@ -303,7 +303,7 @@ use frame_support::{
|
||||
};
|
||||
use pallet_session::historical;
|
||||
use sp_runtime::{
|
||||
Perbill, PerU16, PerThing, RuntimeDebug, DispatchError,
|
||||
Percent, Perbill, PerU16, PerThing, RuntimeDebug, DispatchError,
|
||||
curve::PiecewiseLinear,
|
||||
traits::{
|
||||
Convert, Zero, StaticLookup, CheckedSub, Saturating, SaturatedConversion, AtLeast32Bit,
|
||||
@@ -1794,6 +1794,34 @@ decl_module! {
|
||||
ValidatorCount::put(new);
|
||||
}
|
||||
|
||||
/// Increments the ideal number of validators.
|
||||
///
|
||||
/// The dispatch origin must be Root.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Base Weight: 1.717 µs
|
||||
/// Read/Write: Validator Count
|
||||
/// # </weight>
|
||||
#[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(1, 1)]
|
||||
fn increase_validator_count(origin, #[compact] additional: u32) {
|
||||
ensure_root(origin)?;
|
||||
ValidatorCount::mutate(|n| *n += additional);
|
||||
}
|
||||
|
||||
/// Scale up the ideal number of validators by a factor.
|
||||
///
|
||||
/// The dispatch origin must be Root.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Base Weight: 1.717 µs
|
||||
/// Read/Write: Validator Count
|
||||
/// # </weight>
|
||||
#[weight = 2 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(1, 1)]
|
||||
fn scale_validator_count(origin, factor: Percent) {
|
||||
ensure_root(origin)?;
|
||||
ValidatorCount::mutate(|n| *n += factor * *n);
|
||||
}
|
||||
|
||||
/// Force there to be no new eras indefinitely.
|
||||
///
|
||||
/// The dispatch origin must be Root.
|
||||
|
||||
Reference in New Issue
Block a user