mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 20:51:05 +00:00
Allow StakingAdmin to set min_commission (#13018)
* staking admin can set min commission * ".git/.scripts/bench-bot.sh" pallet dev pallet_staking * fmt * fix for pr comments Co-authored-by: command-bot <>
This commit is contained in:
@@ -183,8 +183,10 @@ pub mod pallet {
|
||||
#[pallet::constant]
|
||||
type SlashDeferDuration: Get<EraIndex>;
|
||||
|
||||
/// The origin which can cancel a deferred slash. Root can always do this.
|
||||
type SlashCancelOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
/// The origin which can manage less critical staking parameters that does not require root.
|
||||
///
|
||||
/// Supported actions: (1) cancel deferred slash, (2) set minimum commission.
|
||||
type AdminOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// Interface for interacting with a session pallet.
|
||||
type SessionInterface: SessionInterface<Self::AccountId>;
|
||||
@@ -1452,7 +1454,7 @@ pub mod pallet {
|
||||
|
||||
/// Cancel enactment of a deferred slash.
|
||||
///
|
||||
/// Can be called by the `T::SlashCancelOrigin`.
|
||||
/// Can be called by the `T::AdminOrigin`.
|
||||
///
|
||||
/// Parameters: era and indices of the slashes for that era to kill.
|
||||
#[pallet::call_index(17)]
|
||||
@@ -1462,7 +1464,7 @@ pub mod pallet {
|
||||
era: EraIndex,
|
||||
slash_indices: Vec<u32>,
|
||||
) -> DispatchResult {
|
||||
T::SlashCancelOrigin::ensure_origin(origin)?;
|
||||
T::AdminOrigin::ensure_origin(origin)?;
|
||||
|
||||
ensure!(!slash_indices.is_empty(), Error::<T>::EmptyTargets);
|
||||
ensure!(is_sorted_and_unique(&slash_indices), Error::<T>::NotSortedAndUnique);
|
||||
@@ -1683,7 +1685,6 @@ pub mod pallet {
|
||||
config_op_exp!(MinCommission<T>, min_commission);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Declare a `controller` to stop participating as either a validator or nominator.
|
||||
///
|
||||
/// Effects will be felt at the beginning of the next era.
|
||||
@@ -1792,6 +1793,18 @@ pub mod pallet {
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Sets the minimum amount of commission that each validators must maintain.
|
||||
///
|
||||
/// This call has lower privilege requirements than `set_staking_config` and can be called
|
||||
/// by the `T::AdminOrigin`. Root can always call this.
|
||||
#[pallet::call_index(25)]
|
||||
#[pallet::weight(T::WeightInfo::set_min_commission())]
|
||||
pub fn set_min_commission(origin: OriginFor<T>, new: Perbill) -> DispatchResult {
|
||||
T::AdminOrigin::ensure_origin(origin)?;
|
||||
MinCommission::<T>::put(new);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user