Nomination pool configurations can be managed by custom origin (#3959)

closes https://github.com/paritytech/polkadot-sdk/issues/3894

Allows Nomination Pool configuration to be set by a custom origin
instead of root.

In runtimes, we would set this to be `StakingAdmin`, same as for
pallet-staking.

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
This commit is contained in:
Ankan
2024-04-09 12:14:19 +02:00
committed by GitHub
parent 6ce126a88d
commit 10ed76437f
9 changed files with 61 additions and 9 deletions
+11 -2
View File
@@ -17,8 +17,11 @@
use super::*;
use crate::{self as pools};
use frame_support::{assert_ok, derive_impl, parameter_types, traits::fungible::Mutate, PalletId};
use frame_system::RawOrigin;
use frame_support::{
assert_ok, derive_impl, ord_parameter_types, parameter_types, traits::fungible::Mutate,
PalletId,
};
use frame_system::{EnsureSignedBy, RawOrigin};
use sp_runtime::{BuildStorage, FixedU128};
use sp_staking::{OnStakingUpdate, Stake};
@@ -289,6 +292,11 @@ parameter_types! {
pub static CheckLevel: u8 = 255;
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
}
ord_parameter_types! {
pub const Admin: u128 = 42;
}
impl pools::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
@@ -303,6 +311,7 @@ impl pools::Config for Runtime {
type MaxMetadataLen = MaxMetadataLen;
type MaxUnbonding = MaxUnbonding;
type MaxPointsToBalance = frame_support::traits::ConstU8<10>;
type AdminOrigin = EnsureSignedBy<Admin, AccountId>;
}
type Block = frame_system::mocking::MockBlock<Runtime>;