mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 14:31:02 +00:00
Pools: Add ability to configure commission claiming permissions (#2474)
Addresses #409. This request has been raised by multiple community members - the ability for the nomination pool root role to configure permissionless commission claiming: > Would it be possible to have a claim_commission_other extrinsic for claiming commission of nomination pools permissionless? This PR does not quite introduce this additional call, but amends `do_claim_commission` to check a new `claim_permission` field in the `Commission` struct, configured by an enum: ``` enum CommissionClaimPermission { Permissionless, Account(AccountId), } ``` This can be optionally set in a bonded pool's `commission.claim_permission` field: ``` struct BondedPool { commission: { <snip> claim_permission: Option<CommissionClaimPermission<T::AccountId>>, }, <snip> } ``` This is a new field and requires a migration to add it to existing pools. This will be `None` on pool creation, falling back to the `root` role having sole access to claim commission if it is not set; this is the behaviour as it is today. Once set, the field _can_ be set to `None` again. #### Changes - [x] Add `commision.claim_permission` field. - [x] Add `can_claim_commission` and amend `do_claim_commission`. - [x] Add `set_commission_claim_permission` call. - [x] Test to cover new configs and call. - [x] Add and amend benchmarks. - [x] Generate new weights + slot into call `set_commission_claim_permission`. - [x] Add migration to introduce `commission.claim_permission`, bump storage version. - [x] Update Westend weights. - [x] Migration working. --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -1533,11 +1533,10 @@ pub mod migrations {
|
|||||||
parachains_configuration::migration::v8::MigrateToV8<Runtime>,
|
parachains_configuration::migration::v8::MigrateToV8<Runtime>,
|
||||||
parachains_configuration::migration::v9::MigrateToV9<Runtime>,
|
parachains_configuration::migration::v9::MigrateToV9<Runtime>,
|
||||||
paras_registrar::migration::MigrateToV1<Runtime, ()>,
|
paras_registrar::migration::MigrateToV1<Runtime, ()>,
|
||||||
pallet_nomination_pools::migration::versioned::V5toV6<Runtime>,
|
|
||||||
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, ()>,
|
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, ()>,
|
||||||
pallet_nomination_pools::migration::versioned::V6ToV7<Runtime>,
|
|
||||||
pallet_grandpa::migrations::MigrateV4ToV5<Runtime>,
|
pallet_grandpa::migrations::MigrateV4ToV5<Runtime>,
|
||||||
parachains_configuration::migration::v10::MigrateToV10<Runtime>,
|
parachains_configuration::migration::v10::MigrateToV10<Runtime>,
|
||||||
|
pallet_nomination_pools::migration::versioned::V7ToV8<Runtime>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
//! Autogenerated weights for `pallet_nomination_pools`
|
//! Autogenerated weights for `pallet_nomination_pools`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2023-09-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2023-11-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! WORST CASE MAP SIZE: `1000000`
|
//! WORST CASE MAP SIZE: `1000000`
|
||||||
//! HOSTNAME: `runner-nbnwcyh-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
//! HOSTNAME: `runner-yprdrvc7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024
|
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -53,7 +53,7 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:0)
|
/// Storage: `Staking::Bonded` (r:1 w:0)
|
||||||
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Ledger` (r:1 w:1)
|
/// Storage: `Staking::Ledger` (r:1 w:1)
|
||||||
@@ -78,20 +78,22 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
|
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `VoterList::ListBags` (r:2 w:2)
|
/// Storage: `VoterList::ListBags` (r:2 w:2)
|
||||||
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
|
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||||
fn join() -> Weight {
|
fn join() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `3318`
|
// Measured: `3355`
|
||||||
// Estimated: `8877`
|
// Estimated: `8877`
|
||||||
// Minimum execution time: 187_795_000 picoseconds.
|
// Minimum execution time: 173_707_000 picoseconds.
|
||||||
Weight::from_parts(193_857_000, 0)
|
Weight::from_parts(179_920_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 8877))
|
.saturating_add(Weight::from_parts(0, 8877))
|
||||||
.saturating_add(T::DbWeight::get().reads(19))
|
.saturating_add(T::DbWeight::get().reads(20))
|
||||||
.saturating_add(T::DbWeight::get().writes(12))
|
.saturating_add(T::DbWeight::get().writes(13))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
||||||
@@ -110,22 +112,24 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
|
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `VoterList::ListBags` (r:2 w:2)
|
/// Storage: `VoterList::ListBags` (r:2 w:2)
|
||||||
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
|
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||||
fn bond_extra_transfer() -> Weight {
|
fn bond_extra_transfer() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `3328`
|
// Measured: `3365`
|
||||||
// Estimated: `8877`
|
// Estimated: `8877`
|
||||||
// Minimum execution time: 186_245_000 picoseconds.
|
// Minimum execution time: 174_414_000 picoseconds.
|
||||||
Weight::from_parts(190_916_000, 0)
|
Weight::from_parts(178_068_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 8877))
|
.saturating_add(Weight::from_parts(0, 8877))
|
||||||
.saturating_add(T::DbWeight::get().reads(16))
|
.saturating_add(T::DbWeight::get().reads(17))
|
||||||
.saturating_add(T::DbWeight::get().writes(12))
|
.saturating_add(T::DbWeight::get().writes(13))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::ClaimPermissions` (r:1 w:0)
|
/// Storage: `NominationPools::ClaimPermissions` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
||||||
@@ -144,22 +148,24 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
|
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `VoterList::ListBags` (r:2 w:2)
|
/// Storage: `VoterList::ListBags` (r:2 w:2)
|
||||||
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
|
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||||
fn bond_extra_other() -> Weight {
|
fn bond_extra_other() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `3274`
|
// Measured: `3312`
|
||||||
// Estimated: `8799`
|
// Estimated: `8799`
|
||||||
// Minimum execution time: 217_918_000 picoseconds.
|
// Minimum execution time: 198_864_000 picoseconds.
|
||||||
Weight::from_parts(224_772_000, 0)
|
Weight::from_parts(203_783_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 8799))
|
.saturating_add(Weight::from_parts(0, 8799))
|
||||||
.saturating_add(T::DbWeight::get().reads(16))
|
.saturating_add(T::DbWeight::get().reads(17))
|
||||||
.saturating_add(T::DbWeight::get().writes(12))
|
.saturating_add(T::DbWeight::get().writes(13))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::ClaimPermissions` (r:1 w:0)
|
/// Storage: `NominationPools::ClaimPermissions` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
||||||
@@ -168,10 +174,10 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||||
fn claim_payout() -> Weight {
|
fn claim_payout() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `1137`
|
// Measured: `1138`
|
||||||
// Estimated: `4182`
|
// Estimated: `4182`
|
||||||
// Minimum execution time: 76_958_000 picoseconds.
|
// Minimum execution time: 70_250_000 picoseconds.
|
||||||
Weight::from_parts(78_278_000, 0)
|
Weight::from_parts(72_231_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4182))
|
.saturating_add(Weight::from_parts(0, 4182))
|
||||||
.saturating_add(T::DbWeight::get().reads(6))
|
.saturating_add(T::DbWeight::get().reads(6))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
@@ -179,7 +185,7 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:0)
|
/// Storage: `Staking::Bonded` (r:1 w:0)
|
||||||
@@ -210,16 +216,16 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `NominationPools::CounterForSubPoolsStorage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::CounterForSubPoolsStorage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
fn unbond() -> Weight {
|
fn unbond() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `3597`
|
// Measured: `3545`
|
||||||
// Estimated: `8877`
|
// Estimated: `8877`
|
||||||
// Minimum execution time: 170_992_000 picoseconds.
|
// Minimum execution time: 155_853_000 picoseconds.
|
||||||
Weight::from_parts(179_987_000, 0)
|
Weight::from_parts(161_032_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 8877))
|
.saturating_add(Weight::from_parts(0, 8877))
|
||||||
.saturating_add(T::DbWeight::get().reads(20))
|
.saturating_add(T::DbWeight::get().reads(20))
|
||||||
.saturating_add(T::DbWeight::get().writes(13))
|
.saturating_add(T::DbWeight::get().writes(13))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:0)
|
/// Storage: `Staking::Bonded` (r:1 w:0)
|
||||||
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Ledger` (r:1 w:1)
|
/// Storage: `Staking::Ledger` (r:1 w:1)
|
||||||
@@ -230,25 +236,27 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Balances::Freezes` (r:1 w:0)
|
/// Storage: `Balances::Freezes` (r:1 w:0)
|
||||||
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||||
/// The range of component `s` is `[0, 100]`.
|
/// The range of component `s` is `[0, 100]`.
|
||||||
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
|
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `1670`
|
// Measured: `1744`
|
||||||
// Estimated: `4764`
|
// Estimated: `4764`
|
||||||
// Minimum execution time: 60_740_000 picoseconds.
|
// Minimum execution time: 62_933_000 picoseconds.
|
||||||
Weight::from_parts(64_502_831, 0)
|
Weight::from_parts(65_847_171, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4764))
|
.saturating_add(Weight::from_parts(0, 4764))
|
||||||
// Standard Error: 2_724
|
// Standard Error: 1_476
|
||||||
.saturating_add(Weight::from_parts(37_725, 0).saturating_mul(s.into()))
|
.saturating_add(Weight::from_parts(59_648, 0).saturating_mul(s.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(6))
|
.saturating_add(T::DbWeight::get().reads(7))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(3))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::CurrentEra` (r:1 w:0)
|
/// Storage: `Staking::CurrentEra` (r:1 w:0)
|
||||||
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1)
|
/// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(261), added: 2736, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(261), added: 2736, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:0)
|
/// Storage: `Staking::Bonded` (r:1 w:0)
|
||||||
@@ -261,6 +269,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `System::Account` (r:1 w:1)
|
/// Storage: `System::Account` (r:1 w:1)
|
||||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::ClaimPermissions` (r:0 w:1)
|
/// Storage: `NominationPools::ClaimPermissions` (r:0 w:1)
|
||||||
@@ -268,22 +278,22 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// The range of component `s` is `[0, 100]`.
|
/// The range of component `s` is `[0, 100]`.
|
||||||
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `2098`
|
// Measured: `2134`
|
||||||
// Estimated: `4764`
|
// Estimated: `4764`
|
||||||
// Minimum execution time: 127_322_000 picoseconds.
|
// Minimum execution time: 123_641_000 picoseconds.
|
||||||
Weight::from_parts(132_064_603, 0)
|
Weight::from_parts(127_222_589, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4764))
|
.saturating_add(Weight::from_parts(0, 4764))
|
||||||
// Standard Error: 3_424
|
// Standard Error: 2_493
|
||||||
.saturating_add(Weight::from_parts(64_590, 0).saturating_mul(s.into()))
|
.saturating_add(Weight::from_parts(83_361, 0).saturating_mul(s.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(10))
|
.saturating_add(T::DbWeight::get().reads(11))
|
||||||
.saturating_add(T::DbWeight::get().writes(8))
|
.saturating_add(T::DbWeight::get().writes(9))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::PoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::CurrentEra` (r:1 w:0)
|
/// Storage: `Staking::CurrentEra` (r:1 w:0)
|
||||||
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1)
|
/// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(261), added: 2736, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(261), added: 2736, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:1)
|
/// Storage: `Staking::Bonded` (r:1 w:1)
|
||||||
@@ -292,16 +302,18 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::SlashingSpans` (r:1 w:0)
|
/// Storage: `Staking::SlashingSpans` (r:1 w:0)
|
||||||
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `Staking::Validators` (r:1 w:0)
|
|
||||||
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
|
|
||||||
/// Storage: `Staking::Nominators` (r:1 w:0)
|
|
||||||
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`)
|
|
||||||
/// Storage: `System::Account` (r:2 w:2)
|
|
||||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
|
||||||
/// Storage: `Balances::Locks` (r:2 w:1)
|
/// Storage: `Balances::Locks` (r:2 w:1)
|
||||||
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Balances::Freezes` (r:2 w:1)
|
/// Storage: `Balances::Freezes` (r:2 w:1)
|
||||||
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `System::Account` (r:2 w:2)
|
||||||
|
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `Staking::Validators` (r:1 w:0)
|
||||||
|
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `Staking::Nominators` (r:1 w:0)
|
||||||
|
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1)
|
/// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:1)
|
/// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:1)
|
||||||
@@ -323,17 +335,15 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Storage: `NominationPools::ClaimPermissions` (r:0 w:1)
|
/// Storage: `NominationPools::ClaimPermissions` (r:0 w:1)
|
||||||
/// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
|
||||||
/// The range of component `s` is `[0, 100]`.
|
/// The range of component `s` is `[0, 100]`.
|
||||||
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `2454`
|
// Measured: `2453`
|
||||||
// Estimated: `8538`
|
// Estimated: `8538`
|
||||||
// Minimum execution time: 236_510_000 picoseconds.
|
// Minimum execution time: 219_469_000 picoseconds.
|
||||||
Weight::from_parts(243_943_334, 0)
|
Weight::from_parts(227_526_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 8538))
|
.saturating_add(Weight::from_parts(0, 8538))
|
||||||
// Standard Error: 4_864
|
.saturating_add(T::DbWeight::get().reads(24))
|
||||||
.saturating_add(Weight::from_parts(14_974, 0).saturating_mul(s.into()))
|
.saturating_add(T::DbWeight::get().writes(20))
|
||||||
.saturating_add(T::DbWeight::get().reads(23))
|
|
||||||
.saturating_add(T::DbWeight::get().writes(19))
|
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::LastPoolId` (r:1 w:1)
|
/// Storage: `NominationPools::LastPoolId` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::LastPoolId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::LastPoolId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
@@ -359,14 +369,12 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:1)
|
/// Storage: `Staking::Bonded` (r:1 w:1)
|
||||||
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Ledger` (r:1 w:1)
|
|
||||||
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
|
|
||||||
/// Storage: `Staking::CurrentEra` (r:1 w:0)
|
|
||||||
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
|
||||||
/// Storage: `Balances::Locks` (r:2 w:1)
|
/// Storage: `Balances::Locks` (r:2 w:1)
|
||||||
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Balances::Freezes` (r:2 w:1)
|
/// Storage: `Balances::Freezes` (r:2 w:1)
|
||||||
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::CounterForRewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::CounterForRewardPools` (r:1 w:1)
|
||||||
@@ -376,21 +384,23 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Storage: `NominationPools::CounterForReversePoolIdLookup` (r:1 w:1)
|
/// Storage: `NominationPools::CounterForReversePoolIdLookup` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::CounterForReversePoolIdLookup` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::CounterForReversePoolIdLookup` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: `Staking::Ledger` (r:0 w:1)
|
||||||
|
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Payee` (r:0 w:1)
|
/// Storage: `Staking::Payee` (r:0 w:1)
|
||||||
/// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
|
||||||
fn create() -> Weight {
|
fn create() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `1222`
|
// Measured: `1102`
|
||||||
// Estimated: `8538`
|
// Estimated: `8538`
|
||||||
// Minimum execution time: 197_883_000 picoseconds.
|
// Minimum execution time: 166_466_000 picoseconds.
|
||||||
Weight::from_parts(201_750_000, 0)
|
Weight::from_parts(171_425_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 8538))
|
.saturating_add(Weight::from_parts(0, 8538))
|
||||||
.saturating_add(T::DbWeight::get().reads(24))
|
.saturating_add(T::DbWeight::get().reads(23))
|
||||||
.saturating_add(T::DbWeight::get().writes(16))
|
.saturating_add(T::DbWeight::get().writes(17))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:0)
|
/// Storage: `Staking::Bonded` (r:1 w:0)
|
||||||
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Ledger` (r:1 w:0)
|
/// Storage: `Staking::Ledger` (r:1 w:0)
|
||||||
@@ -416,36 +426,36 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// The range of component `n` is `[1, 16]`.
|
/// The range of component `n` is `[1, 16]`.
|
||||||
fn nominate(n: u32, ) -> Weight {
|
fn nominate(n: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `1779`
|
// Measured: `1738`
|
||||||
// Estimated: `4556 + n * (2520 ±0)`
|
// Estimated: `4556 + n * (2520 ±0)`
|
||||||
// Minimum execution time: 65_505_000 picoseconds.
|
// Minimum execution time: 59_650_000 picoseconds.
|
||||||
Weight::from_parts(67_148_657, 0)
|
Weight::from_parts(60_620_077, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4556))
|
.saturating_add(Weight::from_parts(0, 4556))
|
||||||
// Standard Error: 9_115
|
// Standard Error: 7_316
|
||||||
.saturating_add(Weight::from_parts(1_421_198, 0).saturating_mul(n.into()))
|
.saturating_add(Weight::from_parts(1_467_406, 0).saturating_mul(n.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(12))
|
.saturating_add(T::DbWeight::get().reads(12))
|
||||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
|
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
|
||||||
.saturating_add(T::DbWeight::get().writes(5))
|
.saturating_add(T::DbWeight::get().writes(5))
|
||||||
.saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into()))
|
.saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into()))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:0)
|
/// Storage: `Staking::Bonded` (r:1 w:0)
|
||||||
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Ledger` (r:1 w:0)
|
/// Storage: `Staking::Ledger` (r:1 w:0)
|
||||||
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
|
||||||
fn set_state() -> Weight {
|
fn set_state() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `1367`
|
// Measured: `1363`
|
||||||
// Estimated: `4556`
|
// Estimated: `4556`
|
||||||
// Minimum execution time: 34_157_000 picoseconds.
|
// Minimum execution time: 31_170_000 picoseconds.
|
||||||
Weight::from_parts(35_557_000, 0)
|
Weight::from_parts(32_217_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4556))
|
.saturating_add(Weight::from_parts(0, 4556))
|
||||||
.saturating_add(T::DbWeight::get().reads(3))
|
.saturating_add(T::DbWeight::get().reads(3))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::Metadata` (r:1 w:1)
|
/// Storage: `NominationPools::Metadata` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::Metadata` (`max_values`: None, `max_size`: Some(270), added: 2745, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::Metadata` (`max_values`: None, `max_size`: Some(270), added: 2745, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::CounterForMetadata` (r:1 w:1)
|
/// Storage: `NominationPools::CounterForMetadata` (r:1 w:1)
|
||||||
@@ -453,13 +463,13 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// The range of component `n` is `[1, 256]`.
|
/// The range of component `n` is `[1, 256]`.
|
||||||
fn set_metadata(n: u32, ) -> Weight {
|
fn set_metadata(n: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `497`
|
// Measured: `498`
|
||||||
// Estimated: `3735`
|
// Estimated: `3735`
|
||||||
// Minimum execution time: 13_806_000 picoseconds.
|
// Minimum execution time: 12_603_000 picoseconds.
|
||||||
Weight::from_parts(14_540_018, 0)
|
Weight::from_parts(13_241_702, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3735))
|
.saturating_add(Weight::from_parts(0, 3735))
|
||||||
// Standard Error: 123
|
// Standard Error: 116
|
||||||
.saturating_add(Weight::from_parts(644, 0).saturating_mul(n.into()))
|
.saturating_add(Weight::from_parts(1_428, 0).saturating_mul(n.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(3))
|
.saturating_add(T::DbWeight::get().reads(3))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
@@ -479,25 +489,25 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 5_870_000 picoseconds.
|
// Minimum execution time: 3_608_000 picoseconds.
|
||||||
Weight::from_parts(6_253_000, 0)
|
Weight::from_parts(3_801_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 0))
|
.saturating_add(Weight::from_parts(0, 0))
|
||||||
.saturating_add(T::DbWeight::get().writes(6))
|
.saturating_add(T::DbWeight::get().writes(6))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
fn update_roles() -> Weight {
|
fn update_roles() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `497`
|
// Measured: `498`
|
||||||
// Estimated: `3685`
|
// Estimated: `3719`
|
||||||
// Minimum execution time: 18_290_000 picoseconds.
|
// Minimum execution time: 16_053_000 picoseconds.
|
||||||
Weight::from_parts(18_961_000, 0)
|
Weight::from_parts(16_473_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3685))
|
.saturating_add(Weight::from_parts(0, 3719))
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Bonded` (r:1 w:0)
|
/// Storage: `Staking::Bonded` (r:1 w:0)
|
||||||
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Staking::Ledger` (r:1 w:0)
|
/// Storage: `Staking::Ledger` (r:1 w:0)
|
||||||
@@ -516,16 +526,16 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
fn chill() -> Weight {
|
fn chill() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `1942`
|
// Measured: `1901`
|
||||||
// Estimated: `4556`
|
// Estimated: `4556`
|
||||||
// Minimum execution time: 63_708_000 picoseconds.
|
// Minimum execution time: 57_251_000 picoseconds.
|
||||||
Weight::from_parts(65_570_000, 0)
|
Weight::from_parts(59_390_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4556))
|
.saturating_add(Weight::from_parts(0, 4556))
|
||||||
.saturating_add(T::DbWeight::get().reads(9))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(5))
|
.saturating_add(T::DbWeight::get().writes(5))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
||||||
@@ -534,37 +544,49 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||||
fn set_commission() -> Weight {
|
fn set_commission() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `736`
|
// Measured: `770`
|
||||||
// Estimated: `3685`
|
// Estimated: `3719`
|
||||||
// Minimum execution time: 34_291_000 picoseconds.
|
// Minimum execution time: 29_888_000 picoseconds.
|
||||||
Weight::from_parts(34_767_000, 0)
|
Weight::from_parts(31_056_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3685))
|
.saturating_add(Weight::from_parts(0, 3719))
|
||||||
.saturating_add(T::DbWeight::get().reads(4))
|
.saturating_add(T::DbWeight::get().reads(4))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
fn set_commission_max() -> Weight {
|
fn set_commission_max() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `537`
|
// Measured: `538`
|
||||||
// Estimated: `3685`
|
// Estimated: `3719`
|
||||||
// Minimum execution time: 18_406_000 picoseconds.
|
// Minimum execution time: 15_769_000 picoseconds.
|
||||||
Weight::from_parts(18_999_000, 0)
|
Weight::from_parts(16_579_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3685))
|
.saturating_add(Weight::from_parts(0, 3719))
|
||||||
.saturating_add(T::DbWeight::get().reads(2))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
fn set_commission_change_rate() -> Weight {
|
fn set_commission_change_rate() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `497`
|
// Measured: `498`
|
||||||
// Estimated: `3685`
|
// Estimated: `3719`
|
||||||
// Minimum execution time: 18_440_000 picoseconds.
|
// Minimum execution time: 15_385_000 picoseconds.
|
||||||
Weight::from_parts(19_230_000, 0)
|
Weight::from_parts(16_402_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3685))
|
.saturating_add(Weight::from_parts(0, 3719))
|
||||||
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
|
}
|
||||||
|
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
|
||||||
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
|
fn set_commission_claim_permission() -> Weight {
|
||||||
|
// Proof Size summary in bytes:
|
||||||
|
// Measured: `498`
|
||||||
|
// Estimated: `3719`
|
||||||
|
// Minimum execution time: 14_965_000 picoseconds.
|
||||||
|
Weight::from_parts(15_548_000, 0)
|
||||||
|
.saturating_add(Weight::from_parts(0, 3719))
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
@@ -576,14 +598,14 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `508`
|
// Measured: `508`
|
||||||
// Estimated: `4182`
|
// Estimated: `4182`
|
||||||
// Minimum execution time: 14_310_000 picoseconds.
|
// Minimum execution time: 13_549_000 picoseconds.
|
||||||
Weight::from_parts(14_681_000, 0)
|
Weight::from_parts(14_307_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4182))
|
.saturating_add(Weight::from_parts(0, 4182))
|
||||||
.saturating_add(T::DbWeight::get().reads(2))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
/// Storage: `NominationPools::RewardPools` (r:1 w:1)
|
||||||
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
/// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0)
|
||||||
@@ -592,16 +614,16 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||||
fn claim_commission() -> Weight {
|
fn claim_commission() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `934`
|
// Measured: `968`
|
||||||
// Estimated: `3685`
|
// Estimated: `3719`
|
||||||
// Minimum execution time: 64_526_000 picoseconds.
|
// Minimum execution time: 60_153_000 picoseconds.
|
||||||
Weight::from_parts(66_800_000, 0)
|
Weight::from_parts(61_369_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3685))
|
.saturating_add(Weight::from_parts(0, 3719))
|
||||||
.saturating_add(T::DbWeight::get().reads(4))
|
.saturating_add(T::DbWeight::get().reads(4))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
/// Storage: `NominationPools::BondedPools` (r:1 w:0)
|
||||||
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(220), added: 2695, mode: `MaxEncodedLen`)
|
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `Balances::Freezes` (r:1 w:1)
|
/// Storage: `Balances::Freezes` (r:1 w:1)
|
||||||
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `System::Account` (r:1 w:1)
|
/// Storage: `System::Account` (r:1 w:1)
|
||||||
@@ -610,10 +632,10 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
|
|||||||
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
|
||||||
fn adjust_pool_deposit() -> Weight {
|
fn adjust_pool_deposit() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `866`
|
// Measured: `867`
|
||||||
// Estimated: `4764`
|
// Estimated: `4764`
|
||||||
// Minimum execution time: 73_472_000 picoseconds.
|
// Minimum execution time: 64_985_000 picoseconds.
|
||||||
Weight::from_parts(74_698_000, 0)
|
Weight::from_parts(66_616_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 4764))
|
.saturating_add(Weight::from_parts(0, 4764))
|
||||||
.saturating_add(T::DbWeight::get().reads(4))
|
.saturating_add(T::DbWeight::get().reads(4))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ use frame_support::{
|
|||||||
use frame_system::RawOrigin as RuntimeOrigin;
|
use frame_system::RawOrigin as RuntimeOrigin;
|
||||||
use pallet_nomination_pools::{
|
use pallet_nomination_pools::{
|
||||||
BalanceOf, BondExtra, BondedPoolInner, BondedPools, ClaimPermission, ClaimPermissions,
|
BalanceOf, BondExtra, BondedPoolInner, BondedPools, ClaimPermission, ClaimPermissions,
|
||||||
Commission, CommissionChangeRate, ConfigOp, GlobalMaxCommission, MaxPoolMembers,
|
Commission, CommissionChangeRate, CommissionClaimPermission, ConfigOp, GlobalMaxCommission,
|
||||||
MaxPoolMembersPerPool, MaxPools, Metadata, MinCreateBond, MinJoinBond, Pallet as Pools,
|
MaxPoolMembers, MaxPoolMembersPerPool, MaxPools, Metadata, MinCreateBond, MinJoinBond,
|
||||||
PoolMembers, PoolRoles, PoolState, RewardPools, SubPoolsStorage,
|
Pallet as Pools, PoolMembers, PoolRoles, PoolState, RewardPools, SubPoolsStorage,
|
||||||
};
|
};
|
||||||
use pallet_staking::MaxNominationsOf;
|
use pallet_staking::MaxNominationsOf;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
@@ -706,17 +706,24 @@ frame_benchmarking::benchmarks! {
|
|||||||
max_increase: Perbill::from_percent(20),
|
max_increase: Perbill::from_percent(20),
|
||||||
min_delay: 0u32.into(),
|
min_delay: 0u32.into(),
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
|
// set a claim permission to an account.
|
||||||
|
Pools::<T>::set_commission_claim_permission(
|
||||||
|
RuntimeOrigin::Signed(depositor.clone()).into(),
|
||||||
|
1u32.into(),
|
||||||
|
Some(CommissionClaimPermission::Account(depositor.clone()))
|
||||||
|
).unwrap();
|
||||||
|
|
||||||
}:_(RuntimeOrigin::Signed(depositor.clone()), 1u32.into(), Some((Perbill::from_percent(20), depositor.clone())))
|
}:_(RuntimeOrigin::Signed(depositor.clone()), 1u32.into(), Some((Perbill::from_percent(20), depositor.clone())))
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(BondedPools::<T>::get(1).unwrap().commission, Commission {
|
assert_eq!(BondedPools::<T>::get(1).unwrap().commission, Commission {
|
||||||
current: Some((Perbill::from_percent(20), depositor)),
|
current: Some((Perbill::from_percent(20), depositor.clone())),
|
||||||
max: Some(Perbill::from_percent(50)),
|
max: Some(Perbill::from_percent(50)),
|
||||||
change_rate: Some(CommissionChangeRate {
|
change_rate: Some(CommissionChangeRate {
|
||||||
max_increase: Perbill::from_percent(20),
|
max_increase: Perbill::from_percent(20),
|
||||||
min_delay: 0u32.into()
|
min_delay: 0u32.into()
|
||||||
}),
|
}),
|
||||||
throttle_from: Some(1u32.into()),
|
throttle_from: Some(1u32.into()),
|
||||||
|
claim_permission: Some(CommissionClaimPermission::Account(depositor)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,6 +738,7 @@ frame_benchmarking::benchmarks! {
|
|||||||
max: Some(Perbill::from_percent(50)),
|
max: Some(Perbill::from_percent(50)),
|
||||||
change_rate: None,
|
change_rate: None,
|
||||||
throttle_from: Some(0u32.into()),
|
throttle_from: Some(0u32.into()),
|
||||||
|
claim_permission: None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -751,9 +759,25 @@ frame_benchmarking::benchmarks! {
|
|||||||
min_delay: 1000u32.into(),
|
min_delay: 1000u32.into(),
|
||||||
}),
|
}),
|
||||||
throttle_from: Some(1_u32.into()),
|
throttle_from: Some(1_u32.into()),
|
||||||
|
claim_permission: None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_commission_claim_permission {
|
||||||
|
// Create a pool.
|
||||||
|
let (depositor, pool_account) = create_pool_account::<T>(0, Pools::<T>::depositor_min_bond() * 2u32.into(), None);
|
||||||
|
}:_(RuntimeOrigin::Signed(depositor.clone()), 1u32.into(), Some(CommissionClaimPermission::Account(depositor.clone())))
|
||||||
|
verify {
|
||||||
|
assert_eq!(
|
||||||
|
BondedPools::<T>::get(1).unwrap().commission, Commission {
|
||||||
|
current: None,
|
||||||
|
max: None,
|
||||||
|
change_rate: None,
|
||||||
|
throttle_from: None,
|
||||||
|
claim_permission: Some(CommissionClaimPermission::Account(depositor)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
set_claim_permission {
|
set_claim_permission {
|
||||||
// Create a pool
|
// Create a pool
|
||||||
let min_create_bond = Pools::<T>::depositor_min_bond();
|
let min_create_bond = Pools::<T>::depositor_min_bond();
|
||||||
@@ -786,8 +810,13 @@ frame_benchmarking::benchmarks! {
|
|||||||
CurrencyOf::<T>::set_balance(&reward_account, ed + origin_weight);
|
CurrencyOf::<T>::set_balance(&reward_account, ed + origin_weight);
|
||||||
|
|
||||||
// member claims a payout to make some commission available.
|
// member claims a payout to make some commission available.
|
||||||
let _ = Pools::<T>::claim_payout(RuntimeOrigin::Signed(claimer).into());
|
let _ = Pools::<T>::claim_payout(RuntimeOrigin::Signed(claimer.clone()).into());
|
||||||
|
// set a claim permission to an account.
|
||||||
|
let _ = Pools::<T>::set_commission_claim_permission(
|
||||||
|
RuntimeOrigin::Signed(depositor.clone()).into(),
|
||||||
|
1u32.into(),
|
||||||
|
Some(CommissionClaimPermission::Account(claimer))
|
||||||
|
);
|
||||||
whitelist_account!(depositor);
|
whitelist_account!(depositor);
|
||||||
}:_(RuntimeOrigin::Signed(depositor.clone()), 1u32.into())
|
}:_(RuntimeOrigin::Signed(depositor.clone()), 1u32.into())
|
||||||
verify {
|
verify {
|
||||||
|
|||||||
@@ -676,6 +676,13 @@ pub struct PoolRoles<AccountId> {
|
|||||||
pub bouncer: Option<AccountId>,
|
pub bouncer: Option<AccountId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A pool's possible commission claiming permissions.
|
||||||
|
#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
|
||||||
|
pub enum CommissionClaimPermission<AccountId> {
|
||||||
|
Permissionless,
|
||||||
|
Account(AccountId),
|
||||||
|
}
|
||||||
|
|
||||||
/// Pool commission.
|
/// Pool commission.
|
||||||
///
|
///
|
||||||
/// The pool `root` can set commission configuration after pool creation. By default, all commission
|
/// The pool `root` can set commission configuration after pool creation. By default, all commission
|
||||||
@@ -705,6 +712,9 @@ pub struct Commission<T: Config> {
|
|||||||
/// The block from where throttling should be checked from. This value will be updated on all
|
/// The block from where throttling should be checked from. This value will be updated on all
|
||||||
/// commission updates and when setting an initial `change_rate`.
|
/// commission updates and when setting an initial `change_rate`.
|
||||||
pub throttle_from: Option<BlockNumberFor<T>>,
|
pub throttle_from: Option<BlockNumberFor<T>>,
|
||||||
|
// Whether commission can be claimed permissionlessly, or whether an account can claim
|
||||||
|
// commission. `Root` role can always claim.
|
||||||
|
pub claim_permission: Option<CommissionClaimPermission<T::AccountId>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Config> Commission<T> {
|
impl<T: Config> Commission<T> {
|
||||||
@@ -1078,6 +1088,17 @@ impl<T: Config> BondedPool<T> {
|
|||||||
self.is_root(who)
|
self.is_root(who)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn can_claim_commission(&self, who: &T::AccountId) -> bool {
|
||||||
|
if let Some(permission) = self.commission.claim_permission.as_ref() {
|
||||||
|
match permission {
|
||||||
|
CommissionClaimPermission::Permissionless => true,
|
||||||
|
CommissionClaimPermission::Account(account) => account == who || self.is_root(who),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.is_root(who)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn is_destroying(&self) -> bool {
|
fn is_destroying(&self) -> bool {
|
||||||
matches!(self.state, PoolState::Destroying)
|
matches!(self.state, PoolState::Destroying)
|
||||||
}
|
}
|
||||||
@@ -1572,7 +1593,7 @@ pub mod pallet {
|
|||||||
use sp_runtime::Perbill;
|
use sp_runtime::Perbill;
|
||||||
|
|
||||||
/// The current storage version.
|
/// The current storage version.
|
||||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(7);
|
const STORAGE_VERSION: StorageVersion = StorageVersion::new(8);
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::storage_version(STORAGE_VERSION)]
|
#[pallet::storage_version(STORAGE_VERSION)]
|
||||||
@@ -1850,6 +1871,11 @@ pub mod pallet {
|
|||||||
pool_id: PoolId,
|
pool_id: PoolId,
|
||||||
change_rate: CommissionChangeRate<BlockNumberFor<T>>,
|
change_rate: CommissionChangeRate<BlockNumberFor<T>>,
|
||||||
},
|
},
|
||||||
|
/// Pool commission claim permission has been updated.
|
||||||
|
PoolCommissionClaimPermissionUpdated {
|
||||||
|
pool_id: PoolId,
|
||||||
|
permission: Option<CommissionClaimPermission<T::AccountId>>,
|
||||||
|
},
|
||||||
/// Pool commission has been claimed.
|
/// Pool commission has been claimed.
|
||||||
PoolCommissionClaimed { pool_id: PoolId, commission: BalanceOf<T> },
|
PoolCommissionClaimed { pool_id: PoolId, commission: BalanceOf<T> },
|
||||||
/// Topped up deficit in frozen ED of the reward pool.
|
/// Topped up deficit in frozen ED of the reward pool.
|
||||||
@@ -2742,6 +2768,32 @@ pub mod pallet {
|
|||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
Self::do_adjust_pool_deposit(who, pool_id)
|
Self::do_adjust_pool_deposit(who, pool_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set or remove a pool's commission claim permission.
|
||||||
|
///
|
||||||
|
/// Determines who can claim the pool's pending commission. Only the `Root` role of the pool
|
||||||
|
/// is able to conifigure commission claim permissions.
|
||||||
|
#[pallet::call_index(22)]
|
||||||
|
#[pallet::weight(T::WeightInfo::set_commission_claim_permission())]
|
||||||
|
pub fn set_commission_claim_permission(
|
||||||
|
origin: OriginFor<T>,
|
||||||
|
pool_id: PoolId,
|
||||||
|
permission: Option<CommissionClaimPermission<T::AccountId>>,
|
||||||
|
) -> DispatchResult {
|
||||||
|
let who = ensure_signed(origin)?;
|
||||||
|
let mut bonded_pool = BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?;
|
||||||
|
ensure!(bonded_pool.can_manage_commission(&who), Error::<T>::DoesNotHavePermission);
|
||||||
|
|
||||||
|
bonded_pool.commission.claim_permission = permission.clone();
|
||||||
|
bonded_pool.put();
|
||||||
|
|
||||||
|
Self::deposit_event(Event::<T>::PoolCommissionClaimPermissionUpdated {
|
||||||
|
pool_id,
|
||||||
|
permission,
|
||||||
|
});
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::hooks]
|
#[pallet::hooks]
|
||||||
@@ -3106,12 +3158,12 @@ impl<T: Config> Pallet<T> {
|
|||||||
|
|
||||||
fn do_claim_commission(who: T::AccountId, pool_id: PoolId) -> DispatchResult {
|
fn do_claim_commission(who: T::AccountId, pool_id: PoolId) -> DispatchResult {
|
||||||
let bonded_pool = BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?;
|
let bonded_pool = BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?;
|
||||||
ensure!(bonded_pool.can_manage_commission(&who), Error::<T>::DoesNotHavePermission);
|
ensure!(bonded_pool.can_claim_commission(&who), Error::<T>::DoesNotHavePermission);
|
||||||
|
|
||||||
let mut reward_pool = RewardPools::<T>::get(pool_id)
|
let mut reward_pool = RewardPools::<T>::get(pool_id)
|
||||||
.defensive_ok_or::<Error<T>>(DefensiveError::RewardPoolNotFound.into())?;
|
.defensive_ok_or::<Error<T>>(DefensiveError::RewardPoolNotFound.into())?;
|
||||||
|
|
||||||
// IMPORTANT: make sure that any newly pending commission not yet processed is added to
|
// IMPORTANT: ensure newly pending commission not yet processed is added to
|
||||||
// `total_commission_pending`.
|
// `total_commission_pending`.
|
||||||
reward_pool.update_records(
|
reward_pool.update_records(
|
||||||
pool_id,
|
pool_id,
|
||||||
|
|||||||
@@ -27,6 +27,15 @@ use sp_runtime::TryRuntimeError;
|
|||||||
pub mod versioned {
|
pub mod versioned {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
/// v8: Adds commission claim permissions to `BondedPools`.
|
||||||
|
pub type V7ToV8<T> = frame_support::migrations::VersionedMigration<
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
v8::VersionUncheckedMigrateV7ToV8<T>,
|
||||||
|
crate::pallet::Pallet<T>,
|
||||||
|
<T as frame_system::Config>::DbWeight,
|
||||||
|
>;
|
||||||
|
|
||||||
/// Migration V6 to V7 wrapped in a [`frame_support::migrations::VersionedMigration`], ensuring
|
/// Migration V6 to V7 wrapped in a [`frame_support::migrations::VersionedMigration`], ensuring
|
||||||
/// the migration is only performed when on-chain version is 6.
|
/// the migration is only performed when on-chain version is 6.
|
||||||
pub type V6ToV7<T> = frame_support::migrations::VersionedMigration<
|
pub type V6ToV7<T> = frame_support::migrations::VersionedMigration<
|
||||||
@@ -47,6 +56,74 @@ pub mod versioned {
|
|||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod v8 {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[derive(Decode)]
|
||||||
|
pub struct OldCommission<T: Config> {
|
||||||
|
pub current: Option<(Perbill, T::AccountId)>,
|
||||||
|
pub max: Option<Perbill>,
|
||||||
|
pub change_rate: Option<CommissionChangeRate<BlockNumberFor<T>>>,
|
||||||
|
pub throttle_from: Option<BlockNumberFor<T>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Decode)]
|
||||||
|
pub struct OldBondedPoolInner<T: Config> {
|
||||||
|
pub commission: OldCommission<T>,
|
||||||
|
pub member_counter: u32,
|
||||||
|
pub points: BalanceOf<T>,
|
||||||
|
pub roles: PoolRoles<T::AccountId>,
|
||||||
|
pub state: PoolState,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Config> OldBondedPoolInner<T> {
|
||||||
|
fn migrate_to_v8(self) -> BondedPoolInner<T> {
|
||||||
|
BondedPoolInner {
|
||||||
|
commission: Commission {
|
||||||
|
current: self.commission.current,
|
||||||
|
max: self.commission.max,
|
||||||
|
change_rate: self.commission.change_rate,
|
||||||
|
throttle_from: self.commission.throttle_from,
|
||||||
|
// `claim_permission` is a new field.
|
||||||
|
claim_permission: None,
|
||||||
|
},
|
||||||
|
member_counter: self.member_counter,
|
||||||
|
points: self.points,
|
||||||
|
roles: self.roles,
|
||||||
|
state: self.state,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct VersionUncheckedMigrateV7ToV8<T>(sp_std::marker::PhantomData<T>);
|
||||||
|
impl<T: Config> OnRuntimeUpgrade for VersionUncheckedMigrateV7ToV8<T> {
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
|
||||||
|
Ok(Vec::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_runtime_upgrade() -> Weight {
|
||||||
|
let mut translated = 0u64;
|
||||||
|
BondedPools::<T>::translate::<OldBondedPoolInner<T>, _>(|_key, old_value| {
|
||||||
|
translated.saturating_inc();
|
||||||
|
Some(old_value.migrate_to_v8())
|
||||||
|
});
|
||||||
|
T::DbWeight::get().reads_writes(translated, translated + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn post_upgrade(_: Vec<u8>) -> Result<(), TryRuntimeError> {
|
||||||
|
// Check new `claim_permission` field is present.
|
||||||
|
ensure!(
|
||||||
|
BondedPools::<T>::iter()
|
||||||
|
.all(|(_, inner)| inner.commission.claim_permission.is_none()),
|
||||||
|
"`claim_permission` value has not been set correctly."
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// This migration accumulates and initializes the [`TotalValueLocked`] for all pools.
|
/// This migration accumulates and initializes the [`TotalValueLocked`] for all pools.
|
||||||
///
|
///
|
||||||
/// WARNING: This migration works under the assumption that the [`BondedPools`] cannot be inflated
|
/// WARNING: This migration works under the assumption that the [`BondedPools`] cannot be inflated
|
||||||
|
|||||||
@@ -5761,7 +5761,13 @@ mod commission {
|
|||||||
// Then:
|
// Then:
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
BondedPool::<Runtime>::get(1).unwrap().commission,
|
BondedPool::<Runtime>::get(1).unwrap().commission,
|
||||||
Commission { current: None, max: None, change_rate: None, throttle_from: Some(1) }
|
Commission {
|
||||||
|
current: None,
|
||||||
|
max: None,
|
||||||
|
change_rate: None,
|
||||||
|
throttle_from: Some(1),
|
||||||
|
claim_permission: None,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
pool_events_since_last_call(),
|
pool_events_since_last_call(),
|
||||||
@@ -5956,6 +5962,7 @@ mod commission {
|
|||||||
min_delay: 2_u64
|
min_delay: 2_u64
|
||||||
}),
|
}),
|
||||||
throttle_from: Some(1_u64),
|
throttle_from: Some(1_u64),
|
||||||
|
claim_permission: None,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -6007,6 +6014,7 @@ mod commission {
|
|||||||
min_delay: 2_u64
|
min_delay: 2_u64
|
||||||
}),
|
}),
|
||||||
throttle_from: Some(3_u64),
|
throttle_from: Some(3_u64),
|
||||||
|
claim_permission: None,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -6082,7 +6090,8 @@ mod commission {
|
|||||||
max_increase: Perbill::from_percent(1),
|
max_increase: Perbill::from_percent(1),
|
||||||
min_delay: 2
|
min_delay: 2
|
||||||
}),
|
}),
|
||||||
throttle_from: Some(7)
|
throttle_from: Some(7),
|
||||||
|
claim_permission: None,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -6183,6 +6192,7 @@ mod commission {
|
|||||||
max: Some(Perbill::from_percent(50)),
|
max: Some(Perbill::from_percent(50)),
|
||||||
change_rate: None,
|
change_rate: None,
|
||||||
throttle_from: Some(1),
|
throttle_from: Some(1),
|
||||||
|
claim_permission: None,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -6409,6 +6419,7 @@ mod commission {
|
|||||||
min_delay: 10_u64
|
min_delay: 10_u64
|
||||||
}),
|
}),
|
||||||
throttle_from: Some(11),
|
throttle_from: Some(11),
|
||||||
|
claim_permission: None,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -6502,7 +6513,8 @@ mod commission {
|
|||||||
max_increase: Perbill::from_percent(1),
|
max_increase: Perbill::from_percent(1),
|
||||||
min_delay: 0
|
min_delay: 0
|
||||||
}),
|
}),
|
||||||
throttle_from: Some(1)
|
throttle_from: Some(1),
|
||||||
|
claim_permission: None,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -6885,6 +6897,13 @@ mod commission {
|
|||||||
#[test]
|
#[test]
|
||||||
fn claim_commission_works() {
|
fn claim_commission_works() {
|
||||||
ExtBuilder::default().build_and_execute(|| {
|
ExtBuilder::default().build_and_execute(|| {
|
||||||
|
/// Deposit rewards into the pool and claim payout. This will set up pending commission
|
||||||
|
/// to be tested in various scenarios.
|
||||||
|
fn deposit_rewards_and_claim_payout(caller: AccountId, points: u128) {
|
||||||
|
deposit_rewards(points);
|
||||||
|
assert_ok!(Pools::claim_payout(RuntimeOrigin::signed(caller)));
|
||||||
|
}
|
||||||
|
|
||||||
let pool_id = 1;
|
let pool_id = 1;
|
||||||
|
|
||||||
let _ = Currency::set_balance(&900, 5);
|
let _ = Currency::set_balance(&900, 5);
|
||||||
@@ -6905,21 +6924,9 @@ mod commission {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Pool earns 80 points, payout is triggered.
|
|
||||||
deposit_rewards(80);
|
|
||||||
assert_eq!(
|
|
||||||
PoolMembers::<Runtime>::get(10).unwrap(),
|
|
||||||
PoolMember::<Runtime> { pool_id, points: 10, ..Default::default() }
|
|
||||||
);
|
|
||||||
|
|
||||||
assert_ok!(Pools::claim_payout(RuntimeOrigin::signed(10)));
|
|
||||||
assert_eq!(
|
|
||||||
pool_events_since_last_call(),
|
|
||||||
vec![Event::PaidOut { member: 10, pool_id, payout: 40 }]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Given:
|
// Given:
|
||||||
assert_eq!(RewardPool::<Runtime>::current_balance(pool_id), 40);
|
deposit_rewards_and_claim_payout(10, 100);
|
||||||
|
assert_eq!(RewardPool::<Runtime>::current_balance(pool_id), 50);
|
||||||
|
|
||||||
// Pool does not exist
|
// Pool does not exist
|
||||||
assert_noop!(
|
assert_noop!(
|
||||||
@@ -6944,6 +6951,176 @@ mod commission {
|
|||||||
Pools::claim_commission(RuntimeOrigin::signed(900), pool_id,),
|
Pools::claim_commission(RuntimeOrigin::signed(900), pool_id,),
|
||||||
Error::<Runtime>::NoPendingCommission
|
Error::<Runtime>::NoPendingCommission
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
pool_events_since_last_call(),
|
||||||
|
vec![
|
||||||
|
Event::PaidOut { member: 10, pool_id, payout: 50 },
|
||||||
|
Event::PoolCommissionClaimed { pool_id: 1, commission: 50 }
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// The pool commission's claim_permission field is updated to `Permissionless` by the
|
||||||
|
// root member, which means anyone can now claim commission for the pool.
|
||||||
|
|
||||||
|
// Given:
|
||||||
|
// Some random non-pool member to claim commission.
|
||||||
|
let non_pool_member = 1001;
|
||||||
|
let _ = Currency::set_balance(&non_pool_member, 5);
|
||||||
|
|
||||||
|
// Set up pending commission.
|
||||||
|
deposit_rewards_and_claim_payout(10, 100);
|
||||||
|
assert_ok!(Pools::set_commission_claim_permission(
|
||||||
|
RuntimeOrigin::signed(900),
|
||||||
|
pool_id,
|
||||||
|
Some(CommissionClaimPermission::Permissionless)
|
||||||
|
));
|
||||||
|
|
||||||
|
// When:
|
||||||
|
assert_ok!(Pools::claim_commission(RuntimeOrigin::signed(non_pool_member), pool_id));
|
||||||
|
|
||||||
|
// Then:
|
||||||
|
assert_eq!(RewardPool::<Runtime>::current_balance(pool_id), 0);
|
||||||
|
assert_eq!(
|
||||||
|
pool_events_since_last_call(),
|
||||||
|
vec![
|
||||||
|
Event::PaidOut { member: 10, pool_id, payout: 50 },
|
||||||
|
Event::PoolCommissionClaimPermissionUpdated {
|
||||||
|
pool_id: 1,
|
||||||
|
permission: Some(CommissionClaimPermission::Permissionless)
|
||||||
|
},
|
||||||
|
Event::PoolCommissionClaimed { pool_id: 1, commission: 50 },
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// The pool commission's claim_permission is updated to an adhoc account by the root
|
||||||
|
// member, which means now only that account (in addition to the root role) can claim
|
||||||
|
// commission for the pool.
|
||||||
|
|
||||||
|
// Given:
|
||||||
|
// The account designated to claim commission.
|
||||||
|
let designated_commission_claimer = 2001;
|
||||||
|
let _ = Currency::set_balance(&designated_commission_claimer, 5);
|
||||||
|
|
||||||
|
// Set up pending commission.
|
||||||
|
deposit_rewards_and_claim_payout(10, 100);
|
||||||
|
assert_ok!(Pools::set_commission_claim_permission(
|
||||||
|
RuntimeOrigin::signed(900),
|
||||||
|
pool_id,
|
||||||
|
Some(CommissionClaimPermission::Account(designated_commission_claimer))
|
||||||
|
));
|
||||||
|
|
||||||
|
// When:
|
||||||
|
// Previous claimer can no longer claim commission.
|
||||||
|
assert_noop!(
|
||||||
|
Pools::claim_commission(RuntimeOrigin::signed(1001), pool_id,),
|
||||||
|
Error::<Runtime>::DoesNotHavePermission
|
||||||
|
);
|
||||||
|
// Designated claimer can claim commission.
|
||||||
|
assert_ok!(Pools::claim_commission(
|
||||||
|
RuntimeOrigin::signed(designated_commission_claimer),
|
||||||
|
pool_id
|
||||||
|
));
|
||||||
|
|
||||||
|
// Then:
|
||||||
|
assert_eq!(
|
||||||
|
pool_events_since_last_call(),
|
||||||
|
vec![
|
||||||
|
Event::PaidOut { member: 10, pool_id, payout: 50 },
|
||||||
|
Event::PoolCommissionClaimPermissionUpdated {
|
||||||
|
pool_id: 1,
|
||||||
|
permission: Some(CommissionClaimPermission::Account(2001))
|
||||||
|
},
|
||||||
|
Event::PoolCommissionClaimed { pool_id: 1, commission: 50 },
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Even with an Account claim permission set, the `root` role of the pool can still
|
||||||
|
// claim commission.
|
||||||
|
|
||||||
|
// Given:
|
||||||
|
deposit_rewards_and_claim_payout(10, 100);
|
||||||
|
|
||||||
|
// When:
|
||||||
|
assert_ok!(Pools::claim_commission(RuntimeOrigin::signed(900), pool_id));
|
||||||
|
|
||||||
|
// Then:
|
||||||
|
assert_eq!(
|
||||||
|
pool_events_since_last_call(),
|
||||||
|
vec![
|
||||||
|
Event::PaidOut { member: 10, pool_id, payout: 50 },
|
||||||
|
Event::PoolCommissionClaimed { pool_id: 1, commission: 50 },
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// The root role updates commission's claim_permission back to `None`, which results in
|
||||||
|
// only the root member being able to claim commission for the pool.
|
||||||
|
|
||||||
|
// Given:
|
||||||
|
deposit_rewards_and_claim_payout(10, 100);
|
||||||
|
|
||||||
|
// When:
|
||||||
|
assert_ok!(Pools::set_commission_claim_permission(
|
||||||
|
RuntimeOrigin::signed(900),
|
||||||
|
pool_id,
|
||||||
|
None
|
||||||
|
));
|
||||||
|
// Previous claimer can no longer claim commission.
|
||||||
|
assert_noop!(
|
||||||
|
Pools::claim_commission(
|
||||||
|
RuntimeOrigin::signed(designated_commission_claimer),
|
||||||
|
pool_id,
|
||||||
|
),
|
||||||
|
Error::<Runtime>::DoesNotHavePermission
|
||||||
|
);
|
||||||
|
// Root can claim commission.
|
||||||
|
assert_ok!(Pools::claim_commission(RuntimeOrigin::signed(900), pool_id));
|
||||||
|
|
||||||
|
// Then:
|
||||||
|
assert_eq!(
|
||||||
|
pool_events_since_last_call(),
|
||||||
|
vec![
|
||||||
|
Event::PaidOut { member: 10, pool_id, payout: 50 },
|
||||||
|
Event::PoolCommissionClaimPermissionUpdated { pool_id: 1, permission: None },
|
||||||
|
Event::PoolCommissionClaimed { pool_id: 1, commission: 50 },
|
||||||
|
]
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn set_commission_claim_permission_handles_errors() {
|
||||||
|
ExtBuilder::default().build_and_execute(|| {
|
||||||
|
let pool_id = 1;
|
||||||
|
|
||||||
|
let _ = Currency::set_balance(&900, 5);
|
||||||
|
assert_eq!(
|
||||||
|
pool_events_since_last_call(),
|
||||||
|
vec![
|
||||||
|
Event::Created { depositor: 10, pool_id },
|
||||||
|
Event::Bonded { member: 10, pool_id, bonded: 10, joined: true },
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Cannot operate on a non-existing pool.
|
||||||
|
assert_noop!(
|
||||||
|
Pools::set_commission_claim_permission(
|
||||||
|
RuntimeOrigin::signed(10),
|
||||||
|
90,
|
||||||
|
Some(CommissionClaimPermission::Permissionless)
|
||||||
|
),
|
||||||
|
Error::<Runtime>::PoolNotFound
|
||||||
|
);
|
||||||
|
|
||||||
|
// Only the root role can change the commission claim permission.
|
||||||
|
assert_noop!(
|
||||||
|
Pools::set_commission_claim_permission(
|
||||||
|
RuntimeOrigin::signed(10),
|
||||||
|
pool_id,
|
||||||
|
Some(CommissionClaimPermission::Permissionless)
|
||||||
|
),
|
||||||
|
Error::<Runtime>::DoesNotHavePermission
|
||||||
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+285
-238
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user