permissionless bond_extra in nomination pools (#12608)

* create enum

* logic check

* add benchmarks

* -enum

* update

* bond extra other

* update

* update

* update

* cargo fmt

* Permissioned

* update

* cargo fmt

* update

* update index

* doc update

Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>

* doc update

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* cargo fmt

* bond_extra auto compound

* bond_extra_other

* Apply suggestions from code review

* Fixes from kian

* updates docs & test

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/tests.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/tests.rs

* Update frame/nomination-pools/src/tests.rs

* Update frame/nomination-pools/src/tests.rs

* Update frame/nomination-pools/src/tests.rs

* Update frame/nomination-pools/src/tests.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/tests.rs

* fixes + fmt

* expand ClaimPermissions + add benchmarks

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_nomination_pools

* tidy up claim payout benches

* fix

* + test: claim_payout_other_works

* comments, rename to set_claim_permission

* fix comment

* remove ClaimPermission on leave pool

* fix test

* ".git/.scripts/commands/fmt/fmt.sh"

* + test for ClaimPermissions::remove()

* impl can_bond_extra & can_claim_payout

---------

Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: parity-processbot <>
Co-authored-by: Ross Bulat <ross@parity.io>
This commit is contained in:
Doordashcon
2023-02-22 13:17:11 +01:00
committed by GitHub
parent f8e3bdad3d
commit 35a89957ca
4 changed files with 567 additions and 142 deletions
@@ -30,9 +30,9 @@ use frame_election_provider_support::SortedListProvider;
use frame_support::{assert_ok, ensure, traits::Get};
use frame_system::RawOrigin as RuntimeOrigin;
use pallet_nomination_pools::{
BalanceOf, BondExtra, BondedPoolInner, BondedPools, ConfigOp, MaxPoolMembers,
MaxPoolMembersPerPool, MaxPools, Metadata, MinCreateBond, MinJoinBond, Pallet as Pools,
PoolMembers, PoolRoles, PoolState, RewardPools, SubPoolsStorage,
BalanceOf, BondExtra, BondedPoolInner, BondedPools, ClaimPermission, ClaimPermissions,
ConfigOp, MaxPoolMembers, MaxPoolMembersPerPool, MaxPools, Metadata, MinCreateBond,
MinJoinBond, Pallet as Pools, PoolMembers, PoolRoles, PoolState, RewardPools, SubPoolsStorage,
};
use sp_runtime::traits::{Bounded, StaticLookup, Zero};
use sp_staking::{EraIndex, StakingInterface};
@@ -252,17 +252,22 @@ frame_benchmarking::benchmarks! {
);
}
bond_extra_reward {
bond_extra_other {
let claimer: T::AccountId = account("claimer", USER_SEED + 4, 0);
let origin_weight = Pools::<T>::depositor_min_bond() * 2u32.into();
let scenario = ListScenario::<T>::new(origin_weight, true)?;
let extra = (scenario.dest_weight - origin_weight).max(CurrencyOf::<T>::minimum_balance());
// set claim preferences to `PermissionlessAll` to any account to bond extra on member's behalf.
let _ = Pools::<T>::set_claim_permission(RuntimeOrigin::Signed(scenario.creator1.clone()).into(), ClaimPermission::PermissionlessAll);
// transfer exactly `extra` to the depositor of the src pool (1),
let reward_account1 = Pools::<T>::create_reward_account(1);
assert!(extra >= CurrencyOf::<T>::minimum_balance());
CurrencyOf::<T>::deposit_creating(&reward_account1, extra);
}: bond_extra(RuntimeOrigin::Signed(scenario.creator1.clone()), BondExtra::Rewards)
}: _(RuntimeOrigin::Signed(claimer), T::Lookup::unlookup(scenario.creator1.clone()), BondExtra::Rewards)
verify {
assert!(
T::Staking::active_stake(&scenario.origin1).unwrap() >=
@@ -271,6 +276,8 @@ frame_benchmarking::benchmarks! {
}
claim_payout {
let claimer: T::AccountId = account("claimer", USER_SEED + 4, 0);
let origin_weight = Pools::<T>::depositor_min_bond() * 2u32.into();
let ed = CurrencyOf::<T>::minimum_balance();
let (depositor, pool_account) = create_pool_account::<T>(0, origin_weight);
@@ -279,6 +286,10 @@ frame_benchmarking::benchmarks! {
// Send funds to the reward account of the pool
CurrencyOf::<T>::make_free_balance_be(&reward_account, ed + origin_weight);
// set claim preferences to `PermissionlessAll` so any account can claim rewards on member's
// behalf.
let _ = Pools::<T>::set_claim_permission(RuntimeOrigin::Signed(depositor.clone()).into(), ClaimPermission::PermissionlessAll);
// Sanity check
assert_eq!(
CurrencyOf::<T>::free_balance(&depositor),
@@ -286,7 +297,7 @@ frame_benchmarking::benchmarks! {
);
whitelist_account!(depositor);
}:_(RuntimeOrigin::Signed(depositor.clone()))
}:claim_payout_other(RuntimeOrigin::Signed(claimer), depositor.clone())
verify {
assert_eq!(
CurrencyOf::<T>::free_balance(&depositor),
@@ -298,6 +309,7 @@ frame_benchmarking::benchmarks! {
);
}
unbond {
// The weight the nominator will start at. The value used here is expected to be
// significantly higher than the first position in a list (e.g. the first bag threshold).
@@ -654,6 +666,28 @@ frame_benchmarking::benchmarks! {
assert!(T::Staking::nominations(Pools::<T>::create_bonded_account(1)).is_none());
}
set_claim_permission {
// Create a pool
let min_create_bond = Pools::<T>::depositor_min_bond();
let (depositor, pool_account) = create_pool_account::<T>(0, min_create_bond);
// Join pool
let min_join_bond = MinJoinBond::<T>::get().max(CurrencyOf::<T>::minimum_balance());
let joiner = create_funded_user_with_balance::<T>("joiner", 0, min_join_bond * 4u32.into());
let joiner_lookup = T::Lookup::unlookup(joiner.clone());
Pools::<T>::join(RuntimeOrigin::Signed(joiner.clone()).into(), min_join_bond, 1)
.unwrap();
// Sanity check join worked
assert_eq!(
T::Staking::active_stake(&pool_account).unwrap(),
min_create_bond + min_join_bond
);
}:_(RuntimeOrigin::Signed(joiner.clone()), ClaimPermission::PermissionlessAll)
verify {
assert_eq!(ClaimPermissions::<T>::get(joiner), ClaimPermission::PermissionlessAll);
}
impl_benchmark_test_suite!(
Pallet,
crate::mock::new_test_ext(),
+177 -37
View File
@@ -61,6 +61,10 @@
//!
//! After joining a pool, a member can claim rewards by calling [`Call::claim_payout`].
//!
//! A pool member can also set a `ClaimPermission` with [`Call::set_claim_permission`], to allow
//! other members to permissionlessly bond or withdraw their rewards by calling
//! [`Call::bond_extra_other`] or [`Call::claim_payout_other`] respectively.
//!
//! For design docs see the [reward pool](#reward-pool) section.
//!
//! ### Leave
@@ -411,6 +415,43 @@ enum AccountType {
Reward,
}
/// The permission a pool member can set for other accounts to claim rewards on their behalf.
#[derive(Encode, Decode, MaxEncodedLen, Clone, Copy, Debug, PartialEq, Eq, TypeInfo)]
pub enum ClaimPermission {
/// Only the pool member themself can claim their rewards.
Permissioned,
/// Anyone can compound rewards on a pool member's behalf.
PermissionlessCompound,
/// Anyone can withdraw rewards on a pool member's behalf.
PermissionlessWithdraw,
/// Anyone can withdraw and compound rewards on a member's behalf.
PermissionlessAll,
}
impl ClaimPermission {
fn can_bond_extra(&self) -> bool {
match self {
ClaimPermission::PermissionlessAll => true,
ClaimPermission::PermissionlessCompound => true,
_ => false,
}
}
fn can_claim_payout(&self) -> bool {
match self {
ClaimPermission::PermissionlessAll => true,
ClaimPermission::PermissionlessWithdraw => true,
_ => false,
}
}
}
impl Default for ClaimPermission {
fn default() -> Self {
Self::Permissioned
}
}
/// A member in a pool.
#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebugNoBound, CloneNoBound)]
#[cfg_attr(feature = "std", derive(frame_support::PartialEqNoBound, DefaultNoBound))]
@@ -1313,6 +1354,11 @@ pub mod pallet {
pub type ReversePoolIdLookup<T: Config> =
CountedStorageMap<_, Twox64Concat, T::AccountId, PoolId, OptionQuery>;
/// Map from a pool member account to their opted claim permission.
#[pallet::storage]
pub type ClaimPermissions<T: Config> =
StorageMap<_, Twox64Concat, T::AccountId, ClaimPermission, ValueQuery>;
#[pallet::genesis_config]
pub struct GenesisConfig<T: Config> {
pub min_join_bond: BalanceOf<T>,
@@ -1470,6 +1516,8 @@ pub mod pallet {
PoolIdInUse,
/// Pool id provided is not correct/usable.
InvalidPoolId,
/// Bonding extra is restricted to the exact pending reward amount.
BondExtraRestricted,
}
#[derive(Encode, Decode, PartialEq, TypeInfo, frame_support::PalletError, RuntimeDebug)]
@@ -1560,44 +1608,18 @@ pub mod pallet {
/// accumulated rewards, see [`BondExtra`].
///
/// Bonding extra funds implies an automatic payout of all pending rewards as well.
/// See `bond_extra_other` to bond pending rewards of `other` members.
// NOTE: this transaction is implemented with the sole purpose of readability and
// correctness, not optimization. We read/write several storage items multiple times instead
// of just once, in the spirit reusing code.
#[pallet::call_index(1)]
#[pallet::weight(
T::WeightInfo::bond_extra_transfer()
.max(T::WeightInfo::bond_extra_reward())
.max(T::WeightInfo::bond_extra_other())
)]
pub fn bond_extra(origin: OriginFor<T>, extra: BondExtra<BalanceOf<T>>) -> DispatchResult {
let who = ensure_signed(origin)?;
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
// payout related stuff: we must claim the payouts, and updated recorded payout data
// before updating the bonded pool points, similar to that of `join` transaction.
reward_pool.update_records(bonded_pool.id, bonded_pool.points)?;
let claimed =
Self::do_reward_payout(&who, &mut member, &mut bonded_pool, &mut reward_pool)?;
let (points_issued, bonded) = match extra {
BondExtra::FreeBalance(amount) =>
(bonded_pool.try_bond_funds(&who, amount, BondType::Later)?, amount),
BondExtra::Rewards =>
(bonded_pool.try_bond_funds(&who, claimed, BondType::Later)?, claimed),
};
bonded_pool.ok_to_be_open()?;
member.points =
member.points.checked_add(&points_issued).ok_or(Error::<T>::OverflowRisk)?;
Self::deposit_event(Event::<T>::Bonded {
member: who.clone(),
pool_id: member.pool_id,
bonded,
joined: false,
});
Self::put_member_with_pools(&who, member, bonded_pool, reward_pool);
Ok(())
Self::do_bond_extra(who.clone(), who, extra)
}
/// A bonded member can use this to claim their payout based on the rewards that the pool
@@ -1606,16 +1628,13 @@ pub mod pallet {
///
/// The member will earn rewards pro rata based on the members stake vs the sum of the
/// members in the pools stake. Rewards do not "expire".
///
/// See `claim_payout_other` to caim rewards on bahalf of some `other` pool member.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::claim_payout())]
pub fn claim_payout(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
let _ = Self::do_reward_payout(&who, &mut member, &mut bonded_pool, &mut reward_pool)?;
Self::put_member_with_pools(&who, member, bonded_pool, reward_pool);
Ok(())
let signer = ensure_signed(origin)?;
Self::do_claim_payout(signer.clone(), signer)
}
/// Unbond up to `unbonding_points` of the `member_account`'s funds from the pool. It
@@ -1715,7 +1734,6 @@ pub mod pallet {
// Now that we know everything has worked write the items to storage.
SubPoolsStorage::insert(&member.pool_id, sub_pools);
Self::put_member_with_pools(&member_account, member, bonded_pool, reward_pool);
Ok(())
}
@@ -1840,6 +1858,9 @@ pub mod pallet {
});
let post_info_weight = if member.total_points().is_zero() {
// remove any `ClaimPermission` associated with the member.
ClaimPermissions::<T>::remove(&member_account);
// member being reaped.
PoolMembers::<T>::remove(&member_account);
Self::deposit_event(Event::<T>::MemberRemoved {
@@ -2114,6 +2135,67 @@ pub mod pallet {
ensure!(bonded_pool.can_nominate(&who), Error::<T>::NotNominator);
T::Staking::chill(&bonded_pool.bonded_account())
}
/// `origin` bonds funds from `extra` for some pool member `member` into their respective
/// pools.
///
/// `origin` can bond extra funds from free balance or pending rewards when `origin ==
/// other`.
///
/// In the case of `origin != other`, `origin` can only bond extra pending rewards of
/// `other` members assuming set_claim_permission for the given member is
/// `PermissionlessAll` or `PermissionlessCompound`.
#[pallet::call_index(14)]
#[pallet::weight(
T::WeightInfo::bond_extra_transfer()
.max(T::WeightInfo::bond_extra_other())
)]
pub fn bond_extra_other(
origin: OriginFor<T>,
member: AccountIdLookupOf<T>,
extra: BondExtra<BalanceOf<T>>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
Self::do_bond_extra(who, T::Lookup::lookup(member)?, extra)
}
/// Allows a pool member to set a claim permission to allow or disallow permissionless
/// bonding and withdrawing.
///
/// By default, this is `Permissioned`, which implies only the pool member themselves can
/// claim their pending rewards. If a pool member wishes so, they can set this to
/// `PermissionlessAll` to allow any account to claim their rewards and bond extra to the
/// pool.
///
/// # Arguments
///
/// * `origin` - Member of a pool.
/// * `actor` - Account to claim reward. // improve this
#[pallet::call_index(15)]
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1))]
pub fn set_claim_permission(
origin: OriginFor<T>,
permission: ClaimPermission,
) -> DispatchResult {
let who = ensure_signed(origin)?;
ensure!(PoolMembers::<T>::contains_key(&who), Error::<T>::PoolMemberNotFound);
ClaimPermissions::<T>::mutate(who, |source| {
*source = permission;
});
Ok(())
}
/// `origin` can claim payouts on some pool member `other`'s behalf.
///
/// Pool member `other` must have a `PermissionlessAll` or `PermissionlessWithdraw` in order
/// for this call to be successful.
#[pallet::call_index(16)]
#[pallet::weight(T::WeightInfo::claim_payout())]
pub fn claim_payout_other(origin: OriginFor<T>, other: T::AccountId) -> DispatchResult {
let signer = ensure_signed(origin)?;
Self::do_claim_payout(signer, other)
}
}
#[pallet::hooks]
@@ -2398,6 +2480,64 @@ impl<T: Config> Pallet<T> {
Ok(())
}
fn do_bond_extra(
signer: T::AccountId,
who: T::AccountId,
extra: BondExtra<BalanceOf<T>>,
) -> DispatchResult {
if signer != who {
ensure!(
ClaimPermissions::<T>::get(&who).can_bond_extra(),
Error::<T>::DoesNotHavePermission
);
ensure!(extra == BondExtra::Rewards, Error::<T>::BondExtraRestricted);
}
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
// payout related stuff: we must claim the payouts, and updated recorded payout data
// before updating the bonded pool points, similar to that of `join` transaction.
reward_pool.update_records(bonded_pool.id, bonded_pool.points)?;
let claimed =
Self::do_reward_payout(&who, &mut member, &mut bonded_pool, &mut reward_pool)?;
let (points_issued, bonded) = match extra {
BondExtra::FreeBalance(amount) =>
(bonded_pool.try_bond_funds(&who, amount, BondType::Later)?, amount),
BondExtra::Rewards =>
(bonded_pool.try_bond_funds(&who, claimed, BondType::Later)?, claimed),
};
bonded_pool.ok_to_be_open()?;
member.points =
member.points.checked_add(&points_issued).ok_or(Error::<T>::OverflowRisk)?;
Self::deposit_event(Event::<T>::Bonded {
member: who.clone(),
pool_id: member.pool_id,
bonded,
joined: false,
});
Self::put_member_with_pools(&who, member, bonded_pool, reward_pool);
Ok(())
}
fn do_claim_payout(signer: T::AccountId, who: T::AccountId) -> DispatchResult {
if signer != who {
ensure!(
ClaimPermissions::<T>::get(&who).can_claim_payout(),
Error::<T>::DoesNotHavePermission
);
}
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
let _ = Self::do_reward_payout(&who, &mut member, &mut bonded_pool, &mut reward_pool)?;
Self::put_member_with_pools(&who, member, bonded_pool, reward_pool);
Ok(())
}
/// Ensure the correctness of the state of this pallet.
///
/// This should be valid before or after each state transition of this pallet.
@@ -2104,6 +2104,36 @@ mod claim_payout {
);
})
}
#[test]
fn claim_payout_other_works() {
ExtBuilder::default().add_members(vec![(20, 20)]).build_and_execute(|| {
Balances::make_free_balance_be(&default_reward_account(), 8);
// ... of which only 3 are claimable to make sure the reward account does not die.
let claimable_reward = 8 - ExistentialDeposit::get();
// NOTE: easier to read if we use 3, so let's use the number instead of variable.
assert_eq!(claimable_reward, 3, "test is correct if rewards are divisible by 3");
// given
assert_eq!(Balances::free_balance(10), 35);
// Permissioned by default
assert_noop!(
Pools::claim_payout_other(RuntimeOrigin::signed(80), 10),
Error::<Runtime>::DoesNotHavePermission
);
assert_ok!(Pools::set_claim_permission(
RuntimeOrigin::signed(10),
ClaimPermission::PermissionlessWithdraw
));
assert_ok!(Pools::claim_payout_other(RuntimeOrigin::signed(80), 10));
// then
assert_eq!(Balances::free_balance(10), 36);
assert_eq!(Balances::free_balance(&default_reward_account()), 7);
})
}
}
mod unbond {
@@ -2130,10 +2160,21 @@ mod unbond {
Error::<T>::MinimumBondNotMet
);
// Make permissionless
assert_eq!(ClaimPermissions::<Runtime>::get(10), ClaimPermission::Permissioned);
assert_ok!(Pools::set_claim_permission(
RuntimeOrigin::signed(20),
ClaimPermission::PermissionlessAll
));
// but can go to 0
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, 15));
assert_eq!(PoolMembers::<Runtime>::get(20).unwrap().active_points(), 0);
assert_eq!(PoolMembers::<Runtime>::get(20).unwrap().unbonding_points(), 20);
assert_eq!(
ClaimPermissions::<Runtime>::get(20),
ClaimPermission::PermissionlessAll
);
})
}
@@ -4098,6 +4139,49 @@ mod withdraw_unbonded {
assert!(!Metadata::<T>::contains_key(1));
})
}
#[test]
fn withdraw_unbonded_removes_claim_permissions_on_leave() {
ExtBuilder::default().add_members(vec![(20, 20)]).build_and_execute(|| {
// Given
CurrentEra::set(1);
assert_eq!(PoolMembers::<Runtime>::get(20).unwrap().points, 20);
assert_ok!(Pools::set_claim_permission(
RuntimeOrigin::signed(20),
ClaimPermission::PermissionlessAll
));
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, 20));
assert_eq!(ClaimPermissions::<Runtime>::get(20), ClaimPermission::PermissionlessAll);
assert_eq!(
pool_events_since_last_call(),
vec![
Event::Created { depositor: 10, pool_id: 1 },
Event::Bonded { member: 10, pool_id: 1, bonded: 10, joined: true },
Event::Bonded { member: 20, pool_id: 1, bonded: 20, joined: true },
Event::Unbonded { member: 20, pool_id: 1, balance: 20, points: 20, era: 4 },
]
);
CurrentEra::set(5);
// When
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(20), 20, 0));
assert_eq!(
pool_events_since_last_call(),
vec![
Event::Withdrawn { member: 20, pool_id: 1, balance: 20, points: 20 },
Event::MemberRemoved { pool_id: 1, member: 20 }
]
);
// Then
assert_eq!(PoolMembers::<Runtime>::get(20), None);
assert_eq!(ClaimPermissions::<Runtime>::contains_key(20), false);
});
}
}
mod create {
@@ -4280,6 +4364,45 @@ mod create {
}
}
#[test]
fn set_claimable_actor_works() {
ExtBuilder::default().build_and_execute(|| {
// Given
Balances::make_free_balance_be(&11, ExistentialDeposit::get() + 2);
assert!(!PoolMembers::<Runtime>::contains_key(&11));
// When
assert_ok!(Pools::join(RuntimeOrigin::signed(11), 2, 1));
// Then
assert_eq!(
pool_events_since_last_call(),
vec![
Event::Created { depositor: 10, pool_id: 1 },
Event::Bonded { member: 10, pool_id: 1, bonded: 10, joined: true },
Event::Bonded { member: 11, pool_id: 1, bonded: 2, joined: true },
]
);
// Make permissionless
assert_eq!(ClaimPermissions::<Runtime>::get(11), ClaimPermission::Permissioned);
assert_noop!(
Pools::set_claim_permission(
RuntimeOrigin::signed(12),
ClaimPermission::PermissionlessAll
),
Error::<T>::PoolMemberNotFound
);
assert_ok!(Pools::set_claim_permission(
RuntimeOrigin::signed(11),
ClaimPermission::PermissionlessAll
));
// then
assert_eq!(ClaimPermissions::<Runtime>::get(11), ClaimPermission::PermissionlessAll);
});
}
mod nominate {
use super::*;
@@ -4592,6 +4715,7 @@ mod bond_extra {
// when
assert_ok!(Pools::bond_extra(RuntimeOrigin::signed(10), BondExtra::Rewards));
assert_eq!(Balances::free_balance(&default_reward_account()), 7);
// then
assert_eq!(Balances::free_balance(10), 35);
@@ -4623,6 +4747,61 @@ mod bond_extra {
);
})
}
#[test]
fn bond_extra_other() {
ExtBuilder::default().add_members(vec![(20, 20)]).build_and_execute(|| {
Balances::make_free_balance_be(&default_reward_account(), 8);
// ... of which only 3 are claimable to make sure the reward account does not die.
let claimable_reward = 8 - ExistentialDeposit::get();
// NOTE: easier to read if we use 3, so let's use the number instead of variable.
assert_eq!(claimable_reward, 3, "test is correct if rewards are divisible by 3");
// given
assert_eq!(PoolMembers::<Runtime>::get(10).unwrap().points, 10);
assert_eq!(PoolMembers::<Runtime>::get(20).unwrap().points, 20);
assert_eq!(BondedPools::<Runtime>::get(1).unwrap().points, 30);
assert_eq!(Balances::free_balance(10), 35);
assert_eq!(Balances::free_balance(20), 20);
// Permissioned by default
assert_noop!(
Pools::bond_extra_other(RuntimeOrigin::signed(80), 20, BondExtra::Rewards),
Error::<Runtime>::DoesNotHavePermission
);
assert_ok!(Pools::set_claim_permission(
RuntimeOrigin::signed(10),
ClaimPermission::PermissionlessAll
));
assert_ok!(Pools::bond_extra_other(RuntimeOrigin::signed(50), 10, BondExtra::Rewards));
assert_eq!(Balances::free_balance(&default_reward_account()), 7);
// then
assert_eq!(Balances::free_balance(10), 35);
assert_eq!(PoolMembers::<Runtime>::get(10).unwrap().points, 10 + 1);
assert_eq!(BondedPools::<Runtime>::get(1).unwrap().points, 30 + 1);
// when
assert_noop!(
Pools::bond_extra_other(RuntimeOrigin::signed(40), 40, BondExtra::Rewards),
Error::<Runtime>::PoolMemberNotFound
);
// when
assert_ok!(Pools::bond_extra_other(
RuntimeOrigin::signed(20),
20,
BondExtra::FreeBalance(10)
));
// then
assert_eq!(Balances::free_balance(20), 12);
assert_eq!(Balances::free_balance(&default_reward_account()), 5);
assert_eq!(PoolMembers::<Runtime>::get(20).unwrap().points, 30);
assert_eq!(BondedPools::<Runtime>::get(1).unwrap().points, 41);
})
}
}
mod update_roles {
+171 -99
View File
@@ -18,25 +18,26 @@
//! Autogenerated weights for pallet_nomination_pools
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-01-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! HOSTNAME: `runner-ehxwxxsd-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
// ./target/production/substrate
// target/production/substrate
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_nomination_pools
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/nomination-pools/src/weights.rs
// --json-file=/builds/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=pallet_nomination_pools
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/nomination-pools/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs
#![cfg_attr(rustfmt, rustfmt_skip)]
@@ -50,7 +51,7 @@ use sp_std::marker::PhantomData;
pub trait WeightInfo {
fn join() -> Weight;
fn bond_extra_transfer() -> Weight;
fn bond_extra_reward() -> Weight;
fn bond_extra_other() -> Weight;
fn claim_payout() -> Weight;
fn unbond() -> Weight;
fn pool_withdraw_unbonded(s: u32, ) -> Weight;
@@ -63,6 +64,7 @@ pub trait WeightInfo {
fn set_configs() -> Weight;
fn update_roles() -> Weight;
fn chill() -> Weight;
fn set_claim_permission() -> Weight;
}
/// Weights for pallet_nomination_pools using the Substrate node and recommended hardware.
@@ -98,8 +100,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `3573`
// Estimated: `37988`
// Minimum execution time: 140_155 nanoseconds.
Weight::from_parts(141_098_000, 37988)
// Minimum execution time: 169_857 nanoseconds.
Weight::from_ref_time(173_895_000)
.saturating_add(Weight::from_proof_size(37988))
.saturating_add(T::DbWeight::get().reads(17_u64))
.saturating_add(T::DbWeight::get().writes(12_u64))
}
@@ -125,11 +128,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `3615`
// Estimated: `38583`
// Minimum execution time: 136_048 nanoseconds.
Weight::from_parts(136_767_000, 38583)
// Minimum execution time: 167_372 nanoseconds.
Weight::from_ref_time(168_776_000)
.saturating_add(Weight::from_proof_size(38583))
.saturating_add(T::DbWeight::get().reads(14_u64))
.saturating_add(T::DbWeight::get().writes(12_u64))
}
/// Storage: NominationPools ClaimPermissions (r:1 w:0)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
/// Storage: NominationPools PoolMembers (r:1 w:1)
/// Proof: NominationPools PoolMembers (max_values: None, max_size: Some(237), added: 2712, mode: MaxEncodedLen)
/// Storage: NominationPools BondedPools (r:1 w:1)
@@ -148,15 +154,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen)
/// Storage: VoterList ListBags (r:2 w:2)
/// Proof: VoterList ListBags (max_values: None, max_size: Some(82), added: 2557, mode: MaxEncodedLen)
fn bond_extra_reward() -> Weight {
fn bond_extra_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `3615`
// Estimated: `38583`
// Minimum execution time: 151_473 nanoseconds.
Weight::from_parts(152_375_000, 38583)
.saturating_add(T::DbWeight::get().reads(14_u64))
// Measured: `3680`
// Estimated: `41099`
// Minimum execution time: 186_346 nanoseconds.
Weight::from_ref_time(191_308_000)
.saturating_add(Weight::from_proof_size(41099))
.saturating_add(T::DbWeight::get().reads(15_u64))
.saturating_add(T::DbWeight::get().writes(13_u64))
}
/// Storage: NominationPools ClaimPermissions (r:1 w:0)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
/// Storage: NominationPools PoolMembers (r:1 w:1)
/// Proof: NominationPools PoolMembers (max_values: None, max_size: Some(237), added: 2712, mode: MaxEncodedLen)
/// Storage: NominationPools BondedPools (r:1 w:1)
@@ -167,11 +176,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn claim_payout() -> Weight {
// Proof Size summary in bytes:
// Measured: `1189`
// Estimated: `10489`
// Minimum execution time: 51_146 nanoseconds.
Weight::from_parts(51_570_000, 10489)
.saturating_add(T::DbWeight::get().reads(4_u64))
// Measured: `1254`
// Estimated: `13005`
// Minimum execution time: 61_423 nanoseconds.
Weight::from_ref_time(63_219_000)
.saturating_add(Weight::from_proof_size(13005))
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
/// Storage: NominationPools PoolMembers (r:1 w:1)
@@ -202,14 +212,17 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: NominationPools SubPoolsStorage (max_values: None, max_size: Some(24382), added: 26857, mode: MaxEncodedLen)
/// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
/// Proof: NominationPools CounterForSubPoolsStorage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: NominationPools ClaimPermissions (r:0 w:1)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
fn unbond() -> Weight {
// Proof Size summary in bytes:
// Measured: `3858`
// Estimated: `67379`
// Minimum execution time: 141_400 nanoseconds.
Weight::from_parts(141_822_000, 67379)
// Minimum execution time: 174_532 nanoseconds.
Weight::from_ref_time(180_032_000)
.saturating_add(Weight::from_proof_size(67379))
.saturating_add(T::DbWeight::get().reads(18_u64))
.saturating_add(T::DbWeight::get().writes(13_u64))
.saturating_add(T::DbWeight::get().writes(14_u64))
}
/// Storage: NominationPools BondedPools (r:1 w:0)
/// Proof: NominationPools BondedPools (max_values: None, max_size: Some(164), added: 2639, mode: MaxEncodedLen)
@@ -226,10 +239,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `1779`
// Estimated: `13025`
// Minimum execution time: 49_021 nanoseconds.
Weight::from_parts(49_954_282, 13025)
// Standard Error: 378
.saturating_add(Weight::from_ref_time(5_165).saturating_mul(s.into()))
// Minimum execution time: 55_327 nanoseconds.
Weight::from_ref_time(58_947_746)
.saturating_add(Weight::from_proof_size(13025))
// Standard Error: 1_589
.saturating_add(Weight::from_ref_time(40_696).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -256,10 +270,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `2303`
// Estimated: `45696`
// Minimum execution time: 92_473 nanoseconds.
Weight::from_parts(93_901_972, 45696)
// Standard Error: 618
.saturating_add(Weight::from_ref_time(12_032).saturating_mul(s.into()))
// Minimum execution time: 105_923 nanoseconds.
Weight::from_ref_time(110_572_476)
.saturating_add(Weight::from_proof_size(45696))
// Standard Error: 2_438
.saturating_add(Weight::from_ref_time(69_045).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(9_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
}
@@ -308,8 +323,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `2690`
// Estimated: `68812`
// Minimum execution time: 150_063 nanoseconds.
Weight::from_parts(152_321_387, 68812)
// Minimum execution time: 169_700 nanoseconds.
Weight::from_ref_time(178_693_541)
.saturating_add(Weight::from_proof_size(68812))
.saturating_add(T::DbWeight::get().reads(20_u64))
.saturating_add(T::DbWeight::get().writes(17_u64))
}
@@ -359,8 +375,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `1321`
// Estimated: `31522`
// Minimum execution time: 131_430 nanoseconds.
Weight::from_parts(132_214_000, 31522)
// Minimum execution time: 145_976 nanoseconds.
Weight::from_ref_time(150_664_000)
.saturating_add(Weight::from_proof_size(31522))
.saturating_add(T::DbWeight::get().reads(21_u64))
.saturating_add(T::DbWeight::get().writes(15_u64))
}
@@ -393,10 +410,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `1909`
// Estimated: `21998 + n * (2520 ±0)`
// Minimum execution time: 61_798 nanoseconds.
Weight::from_parts(61_504_758, 21998)
// Standard Error: 4_046
.saturating_add(Weight::from_ref_time(1_159_175).saturating_mul(n.into()))
// Minimum execution time: 69_288 nanoseconds.
Weight::from_ref_time(71_075_293)
.saturating_add(Weight::from_proof_size(21998))
// Standard Error: 10_508
.saturating_add(Weight::from_ref_time(1_384_674).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(12_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(5_u64))
@@ -412,8 +430,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `1498`
// Estimated: `8752`
// Minimum execution time: 32_433 nanoseconds.
Weight::from_parts(32_894_000, 8752)
// Minimum execution time: 36_410 nanoseconds.
Weight::from_ref_time(37_585_000)
.saturating_add(Weight::from_proof_size(8752))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -428,10 +447,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `559`
// Estimated: `5883`
// Minimum execution time: 13_608 nanoseconds.
Weight::from_parts(13_966_346, 5883)
// Standard Error: 44
.saturating_add(Weight::from_ref_time(1_511).saturating_mul(n.into()))
// Minimum execution time: 14_322 nanoseconds.
Weight::from_ref_time(15_328_204)
.saturating_add(Weight::from_proof_size(5883))
// Standard Error: 161
.saturating_add(Weight::from_ref_time(1_406).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -449,8 +469,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_832 nanoseconds.
Weight::from_ref_time(6_117_000)
// Minimum execution time: 5_968 nanoseconds.
Weight::from_ref_time(6_245_000)
.saturating_add(Weight::from_proof_size(0))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: NominationPools BondedPools (r:1 w:1)
@@ -459,8 +480,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `559`
// Estimated: `2639`
// Minimum execution time: 18_160 nanoseconds.
Weight::from_parts(18_567_000, 2639)
// Minimum execution time: 18_979 nanoseconds.
Weight::from_ref_time(19_795_000)
.saturating_add(Weight::from_proof_size(2639))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -486,11 +508,26 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `2136`
// Estimated: `20489`
// Minimum execution time: 58_991 nanoseconds.
Weight::from_parts(59_528_000, 20489)
// Minimum execution time: 68_145 nanoseconds.
Weight::from_ref_time(70_444_000)
.saturating_add(Weight::from_proof_size(20489))
.saturating_add(T::DbWeight::get().reads(9_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: NominationPools PoolMembers (r:1 w:0)
/// Proof: NominationPools PoolMembers (max_values: None, max_size: Some(237), added: 2712, mode: MaxEncodedLen)
/// Storage: NominationPools ClaimPermissions (r:1 w:1)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
fn set_claim_permission() -> Weight {
// Proof Size summary in bytes:
// Measured: `542`
// Estimated: `5228`
// Minimum execution time: 15_112 nanoseconds.
Weight::from_ref_time(15_897_000)
.saturating_add(Weight::from_proof_size(5228))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
// For backwards compatibility and tests
@@ -525,8 +562,9 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `3573`
// Estimated: `37988`
// Minimum execution time: 140_155 nanoseconds.
Weight::from_parts(141_098_000, 37988)
// Minimum execution time: 169_857 nanoseconds.
Weight::from_ref_time(173_895_000)
.saturating_add(Weight::from_proof_size(37988))
.saturating_add(RocksDbWeight::get().reads(17_u64))
.saturating_add(RocksDbWeight::get().writes(12_u64))
}
@@ -552,11 +590,14 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `3615`
// Estimated: `38583`
// Minimum execution time: 136_048 nanoseconds.
Weight::from_parts(136_767_000, 38583)
// Minimum execution time: 167_372 nanoseconds.
Weight::from_ref_time(168_776_000)
.saturating_add(Weight::from_proof_size(38583))
.saturating_add(RocksDbWeight::get().reads(14_u64))
.saturating_add(RocksDbWeight::get().writes(12_u64))
}
/// Storage: NominationPools ClaimPermissions (r:1 w:0)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
/// Storage: NominationPools PoolMembers (r:1 w:1)
/// Proof: NominationPools PoolMembers (max_values: None, max_size: Some(237), added: 2712, mode: MaxEncodedLen)
/// Storage: NominationPools BondedPools (r:1 w:1)
@@ -575,15 +616,18 @@ impl WeightInfo for () {
/// Proof: VoterList ListNodes (max_values: None, max_size: Some(154), added: 2629, mode: MaxEncodedLen)
/// Storage: VoterList ListBags (r:2 w:2)
/// Proof: VoterList ListBags (max_values: None, max_size: Some(82), added: 2557, mode: MaxEncodedLen)
fn bond_extra_reward() -> Weight {
fn bond_extra_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `3615`
// Estimated: `38583`
// Minimum execution time: 151_473 nanoseconds.
Weight::from_parts(152_375_000, 38583)
.saturating_add(RocksDbWeight::get().reads(14_u64))
// Measured: `3680`
// Estimated: `41099`
// Minimum execution time: 186_346 nanoseconds.
Weight::from_ref_time(191_308_000)
.saturating_add(Weight::from_proof_size(41099))
.saturating_add(RocksDbWeight::get().reads(15_u64))
.saturating_add(RocksDbWeight::get().writes(13_u64))
}
/// Storage: NominationPools ClaimPermissions (r:1 w:0)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
/// Storage: NominationPools PoolMembers (r:1 w:1)
/// Proof: NominationPools PoolMembers (max_values: None, max_size: Some(237), added: 2712, mode: MaxEncodedLen)
/// Storage: NominationPools BondedPools (r:1 w:1)
@@ -594,11 +638,12 @@ impl WeightInfo for () {
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
fn claim_payout() -> Weight {
// Proof Size summary in bytes:
// Measured: `1189`
// Estimated: `10489`
// Minimum execution time: 51_146 nanoseconds.
Weight::from_parts(51_570_000, 10489)
.saturating_add(RocksDbWeight::get().reads(4_u64))
// Measured: `1254`
// Estimated: `13005`
// Minimum execution time: 61_423 nanoseconds.
Weight::from_ref_time(63_219_000)
.saturating_add(Weight::from_proof_size(13005))
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
/// Storage: NominationPools PoolMembers (r:1 w:1)
@@ -629,14 +674,17 @@ impl WeightInfo for () {
/// Proof: NominationPools SubPoolsStorage (max_values: None, max_size: Some(24382), added: 26857, mode: MaxEncodedLen)
/// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
/// Proof: NominationPools CounterForSubPoolsStorage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: NominationPools ClaimPermissions (r:0 w:1)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
fn unbond() -> Weight {
// Proof Size summary in bytes:
// Measured: `3858`
// Estimated: `67379`
// Minimum execution time: 141_400 nanoseconds.
Weight::from_parts(141_822_000, 67379)
// Minimum execution time: 174_532 nanoseconds.
Weight::from_ref_time(180_032_000)
.saturating_add(Weight::from_proof_size(67379))
.saturating_add(RocksDbWeight::get().reads(18_u64))
.saturating_add(RocksDbWeight::get().writes(13_u64))
.saturating_add(RocksDbWeight::get().writes(14_u64))
}
/// Storage: NominationPools BondedPools (r:1 w:0)
/// Proof: NominationPools BondedPools (max_values: None, max_size: Some(164), added: 2639, mode: MaxEncodedLen)
@@ -653,10 +701,11 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `1779`
// Estimated: `13025`
// Minimum execution time: 49_021 nanoseconds.
Weight::from_parts(49_954_282, 13025)
// Standard Error: 378
.saturating_add(Weight::from_ref_time(5_165).saturating_mul(s.into()))
// Minimum execution time: 55_327 nanoseconds.
Weight::from_ref_time(58_947_746)
.saturating_add(Weight::from_proof_size(13025))
// Standard Error: 1_589
.saturating_add(Weight::from_ref_time(40_696).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -683,10 +732,11 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `2303`
// Estimated: `45696`
// Minimum execution time: 92_473 nanoseconds.
Weight::from_parts(93_901_972, 45696)
// Standard Error: 618
.saturating_add(Weight::from_ref_time(12_032).saturating_mul(s.into()))
// Minimum execution time: 105_923 nanoseconds.
Weight::from_ref_time(110_572_476)
.saturating_add(Weight::from_proof_size(45696))
// Standard Error: 2_438
.saturating_add(Weight::from_ref_time(69_045).saturating_mul(s.into()))
.saturating_add(RocksDbWeight::get().reads(9_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
@@ -735,8 +785,9 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `2690`
// Estimated: `68812`
// Minimum execution time: 150_063 nanoseconds.
Weight::from_parts(152_321_387, 68812)
// Minimum execution time: 169_700 nanoseconds.
Weight::from_ref_time(178_693_541)
.saturating_add(Weight::from_proof_size(68812))
.saturating_add(RocksDbWeight::get().reads(20_u64))
.saturating_add(RocksDbWeight::get().writes(17_u64))
}
@@ -786,8 +837,9 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `1321`
// Estimated: `31522`
// Minimum execution time: 131_430 nanoseconds.
Weight::from_parts(132_214_000, 31522)
// Minimum execution time: 145_976 nanoseconds.
Weight::from_ref_time(150_664_000)
.saturating_add(Weight::from_proof_size(31522))
.saturating_add(RocksDbWeight::get().reads(21_u64))
.saturating_add(RocksDbWeight::get().writes(15_u64))
}
@@ -820,10 +872,11 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `1909`
// Estimated: `21998 + n * (2520 ±0)`
// Minimum execution time: 61_798 nanoseconds.
Weight::from_parts(61_504_758, 21998)
// Standard Error: 4_046
.saturating_add(Weight::from_ref_time(1_159_175).saturating_mul(n.into()))
// Minimum execution time: 69_288 nanoseconds.
Weight::from_ref_time(71_075_293)
.saturating_add(Weight::from_proof_size(21998))
// Standard Error: 10_508
.saturating_add(Weight::from_ref_time(1_384_674).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(12_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes(5_u64))
@@ -839,8 +892,9 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `1498`
// Estimated: `8752`
// Minimum execution time: 32_433 nanoseconds.
Weight::from_parts(32_894_000, 8752)
// Minimum execution time: 36_410 nanoseconds.
Weight::from_ref_time(37_585_000)
.saturating_add(Weight::from_proof_size(8752))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -855,10 +909,11 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `559`
// Estimated: `5883`
// Minimum execution time: 13_608 nanoseconds.
Weight::from_parts(13_966_346, 5883)
// Standard Error: 44
.saturating_add(Weight::from_ref_time(1_511).saturating_mul(n.into()))
// Minimum execution time: 14_322 nanoseconds.
Weight::from_ref_time(15_328_204)
.saturating_add(Weight::from_proof_size(5883))
// Standard Error: 161
.saturating_add(Weight::from_ref_time(1_406).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -876,8 +931,9 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_832 nanoseconds.
Weight::from_ref_time(6_117_000)
// Minimum execution time: 5_968 nanoseconds.
Weight::from_ref_time(6_245_000)
.saturating_add(Weight::from_proof_size(0))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
/// Storage: NominationPools BondedPools (r:1 w:1)
@@ -886,8 +942,9 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `559`
// Estimated: `2639`
// Minimum execution time: 18_160 nanoseconds.
Weight::from_parts(18_567_000, 2639)
// Minimum execution time: 18_979 nanoseconds.
Weight::from_ref_time(19_795_000)
.saturating_add(Weight::from_proof_size(2639))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -913,9 +970,24 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `2136`
// Estimated: `20489`
// Minimum execution time: 58_991 nanoseconds.
Weight::from_parts(59_528_000, 20489)
// Minimum execution time: 68_145 nanoseconds.
Weight::from_ref_time(70_444_000)
.saturating_add(Weight::from_proof_size(20489))
.saturating_add(RocksDbWeight::get().reads(9_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
/// Storage: NominationPools PoolMembers (r:1 w:0)
/// Proof: NominationPools PoolMembers (max_values: None, max_size: Some(237), added: 2712, mode: MaxEncodedLen)
/// Storage: NominationPools ClaimPermissions (r:1 w:1)
/// Proof: NominationPools ClaimPermissions (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
fn set_claim_permission() -> Weight {
// Proof Size summary in bytes:
// Measured: `542`
// Estimated: `5228`
// Minimum execution time: 15_112 nanoseconds.
Weight::from_ref_time(15_897_000)
.saturating_add(Weight::from_proof_size(5228))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}