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:
Ankan
2022-12-26 16:48:40 +01:00
committed by GitHub
parent 017cf70378
commit 9726a10dbb
14 changed files with 286 additions and 201 deletions
+10 -4
View File
@@ -20,13 +20,14 @@
use crate::{self as pallet_staking, *};
use frame_election_provider_support::{onchain, SequentialPhragmen, VoteWeight};
use frame_support::{
assert_ok, parameter_types,
assert_ok, ord_parameter_types, parameter_types,
traits::{
ConstU32, ConstU64, Currency, FindAuthor, GenesisBuild, Get, Hooks, Imbalance,
OnUnbalanced, OneSessionHandler,
ConstU32, ConstU64, Currency, EitherOfDiverse, FindAuthor, GenesisBuild, Get, Hooks,
Imbalance, OnUnbalanced, OneSessionHandler,
},
weights::constants::RocksDbWeight,
};
use frame_system::{EnsureRoot, EnsureSignedBy};
use sp_core::H256;
use sp_io;
use sp_runtime::{
@@ -292,7 +293,7 @@ impl crate::pallet::pallet::Config for Test {
type Reward = MockReward;
type SessionsPerEra = SessionsPerEra;
type SlashDeferDuration = SlashDeferDuration;
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
type AdminOrigin = EnsureOneOrRoot;
type BondingDuration = BondingDuration;
type SessionInterface = Self;
type EraPayout = ConvertCurve<RewardCurve>;
@@ -797,6 +798,11 @@ pub(crate) fn staking_events() -> Vec<crate::Event<Test>> {
parameter_types! {
static StakingEventsIndex: usize = 0;
}
ord_parameter_types! {
pub const One: u64 = 1;
}
type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<AccountId>, EnsureSignedBy<One, AccountId>>;
pub(crate) fn staking_events_since_last_call() -> Vec<crate::Event<Test>> {
let all: Vec<_> = System::events()