Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3a11e89
[Enhancement] Convert fast-unstake to use StakingInterface, decouplin…
ruseinov Oct 5, 2022
4f39589
Update primitives/staking/src/lib.rs
ruseinov Oct 6, 2022
9b8e123
Update primitives/staking/src/lib.rs
ruseinov Oct 6, 2022
25520d6
fix validator comment
ruseinov Oct 6, 2022
ad90903
remove todo
ruseinov Oct 10, 2022
89b32b5
ideas from Kian (#12474)
ruseinov Oct 11, 2022
f51c073
Merge remote-tracking branch 'origin/master' into ru/feature/fast-uns…
Oct 11, 2022
41d04ad
Rename StakingInterface -> Staking for nomination-pools
ruseinov Oct 12, 2022
7fc52f8
Staking fixes
ruseinov Oct 12, 2022
d3958ba
StakingInterface changes
ruseinov Oct 12, 2022
2ff689c
fix fast-unstake
ruseinov Oct 12, 2022
1fc6510
fix nomination-pools
ruseinov Oct 12, 2022
28d15d7
Merge remote-tracking branch 'origin/master' into ru/feature/fast-uns…
Oct 18, 2022
0705029
Fix fast-unstake tests
ruseinov Oct 18, 2022
39cf580
Fix benches for fast-unstake
ruseinov Oct 18, 2022
8093567
fix is_unbonding
ruseinov Oct 18, 2022
30a5882
fix nomination pools
ruseinov Oct 18, 2022
37107ef
fix node code
ruseinov Oct 19, 2022
097a9d1
add mock comments
ruseinov Oct 19, 2022
613a701
fix imports
ruseinov Oct 19, 2022
e785dd5
remove todo
ruseinov Oct 19, 2022
03586d7
more fixes
ruseinov Oct 19, 2022
20a4f29
more fixes
ruseinov Oct 19, 2022
9807cf2
bench fixes
ruseinov Oct 19, 2022
3639af8
more fixes
ruseinov Oct 19, 2022
b7827d5
more fixes
ruseinov Oct 20, 2022
5232b99
import fix
ruseinov Oct 20, 2022
f881456
more fixes
ruseinov Oct 20, 2022
c3cee71
more bench fix
ruseinov Oct 20, 2022
068c565
refix
ruseinov Oct 20, 2022
ff36f90
refix
ruseinov Oct 20, 2022
6f862e4
Update primitives/staking/src/lib.rs
ruseinov Oct 25, 2022
bff58a4
is_unbonding returns a result
ruseinov Oct 20, 2022
bdb525e
fix
ruseinov Oct 25, 2022
4bd57b1
review fixes
ruseinov Oct 25, 2022
f6040ec
more review fixes
ruseinov Oct 25, 2022
8c5604d
more fixes
ruseinov Oct 25, 2022
731fab2
more fixes
ruseinov Oct 25, 2022
b90082a
Update frame/fast-unstake/src/benchmarking.rs
ruseinov Oct 26, 2022
1eee8a5
remove redundant CurrencyBalance from nom-pools
ruseinov Oct 26, 2022
1f4fad2
remove CB
ruseinov Oct 26, 2022
27530dc
Merge remote-tracking branch 'origin/master' into ru/feature/fast-uns…
Oct 26, 2022
90cec9f
rephrase
ruseinov Oct 26, 2022
b1560aa
Apply suggestions from code review
kianenigma Oct 27, 2022
75a36bb
Update frame/nomination-pools/src/tests.rs
kianenigma Oct 27, 2022
b3e843e
finish damn renamed
kianenigma Oct 27, 2022
963837b
clippy fix
ruseinov Oct 27, 2022
cbed2f9
fix
ruseinov Oct 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finish damn renamed
  • Loading branch information
kianenigma committed Oct 27, 2022
commit b3e843e56b58bd231d6afec921117f84b0ad7c5c
26 changes: 13 additions & 13 deletions frame/nomination-pools/benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl<T: Config> ListScenario<T> {
self.origin1_member = Some(joiner.clone());
CurrencyOf::<T>::make_free_balance_be(&joiner, amount * 2u32.into());

let original_bonded = T::Staking::active_balance(&self.origin1).unwrap();
let original_bonded = T::Staking::active_stake(&self.origin1).unwrap();

// Unbond `amount` from the underlying pool account so when the member joins
// we will maintain `current_bonded`.
Expand Down Expand Up @@ -215,7 +215,7 @@ frame_benchmarking::benchmarks! {
// setup the worst case list scenario.
let scenario = ListScenario::<T>::new(origin_weight, true)?;
assert_eq!(
T::Staking::active_balance(&scenario.origin1).unwrap(),
T::Staking::active_stake(&scenario.origin1).unwrap(),
origin_weight
);

Expand All @@ -230,7 +230,7 @@ frame_benchmarking::benchmarks! {
verify {
assert_eq!(CurrencyOf::<T>::free_balance(&joiner), joiner_free - max_additional);
assert_eq!(
T::Staking::active_balance(&scenario.origin1).unwrap(),
T::Staking::active_stake(&scenario.origin1).unwrap(),
scenario.dest_weight
);
}
Expand All @@ -245,7 +245,7 @@ frame_benchmarking::benchmarks! {
}: bond_extra(RuntimeOrigin::Signed(scenario.creator1.clone()), BondExtra::FreeBalance(extra))
verify {
assert!(
T::Staking::active_balance(&scenario.origin1).unwrap() >=
T::Staking::active_stake(&scenario.origin1).unwrap() >=
scenario.dest_weight
);
}
Expand All @@ -263,7 +263,7 @@ frame_benchmarking::benchmarks! {
}: bond_extra(RuntimeOrigin::Signed(scenario.creator1.clone()), BondExtra::Rewards)
verify {
assert!(
T::Staking::active_balance(&scenario.origin1).unwrap() >=
T::Staking::active_stake(&scenario.origin1).unwrap() >=
scenario.dest_weight
);
}
Expand Down Expand Up @@ -310,7 +310,7 @@ frame_benchmarking::benchmarks! {
whitelist_account!(member_id);
}: _(RuntimeOrigin::Signed(member_id.clone()), member_id_lookup, all_points)
verify {
let bonded_after = T::Staking::active_balance(&scenario.origin1).unwrap();
let bonded_after = T::Staking::active_stake(&scenario.origin1).unwrap();
// We at least went down to the destination bag
assert!(bonded_after <= scenario.dest_weight);
let member = PoolMembers::<T>::get(
Expand Down Expand Up @@ -341,7 +341,7 @@ frame_benchmarking::benchmarks! {

// Sanity check join worked
assert_eq!(
T::Staking::active_balance(&pool_account).unwrap(),
T::Staking::active_stake(&pool_account).unwrap(),
min_create_bond + min_join_bond
);
assert_eq!(CurrencyOf::<T>::free_balance(&joiner), min_join_bond);
Expand All @@ -351,7 +351,7 @@ frame_benchmarking::benchmarks! {

// Sanity check that unbond worked
assert_eq!(
T::Staking::active_balance(&pool_account).unwrap(),
T::Staking::active_stake(&pool_account).unwrap(),
min_create_bond
);
assert_eq!(pallet_staking::Ledger::<T>::get(&pool_account).unwrap().unlocking.len(), 1);
Expand Down Expand Up @@ -384,7 +384,7 @@ frame_benchmarking::benchmarks! {

// Sanity check join worked
assert_eq!(
T::Staking::active_balance(&pool_account).unwrap(),
T::Staking::active_stake(&pool_account).unwrap(),
min_create_bond + min_join_bond
);
assert_eq!(CurrencyOf::<T>::free_balance(&joiner), min_join_bond);
Expand All @@ -395,7 +395,7 @@ frame_benchmarking::benchmarks! {

// Sanity check that unbond worked
assert_eq!(
T::Staking::active_balance(&pool_account).unwrap(),
T::Staking::active_stake(&pool_account).unwrap(),
min_create_bond
);
assert_eq!(pallet_staking::Ledger::<T>::get(&pool_account).unwrap().unlocking.len(), 1);
Expand Down Expand Up @@ -442,7 +442,7 @@ frame_benchmarking::benchmarks! {

// Sanity check that unbond worked
assert_eq!(
T::Staking::active_balance(&pool_account).unwrap(),
T::Staking::active_stake(&pool_account).unwrap(),
Zero::zero()
);
assert_eq!(
Expand Down Expand Up @@ -521,7 +521,7 @@ frame_benchmarking::benchmarks! {
}
);
assert_eq!(
T::Staking::active_balance(&Pools::<T>::create_bonded_account(1)),
T::Staking::active_stake(&Pools::<T>::create_bonded_account(1)),
Ok(min_create_bond)
);
}
Expand Down Expand Up @@ -560,7 +560,7 @@ frame_benchmarking::benchmarks! {
}
);
assert_eq!(
T::Staking::active_balance(&Pools::<T>::create_bonded_account(1)),
T::Staking::active_stake(&Pools::<T>::create_bonded_account(1)),
Ok(min_create_bond)
);
}
Expand Down
4 changes: 2 additions & 2 deletions frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl<T: Config> PoolMember<T> {
///
/// This is derived from the ratio of points in the pool to which the member belongs to.
/// Might return different values based on the pool state for the same member and points.
fn active_balance(&self) -> BalanceOf<T> {
fn active_stake(&self) -> BalanceOf<T> {
if let Some(pool) = BondedPool::<T>::get(self.pool_id).defensive() {
pool.points_to_balance(self.points)
} else {
Expand Down Expand Up @@ -791,7 +791,7 @@ impl<T: Config> BondedPool<T> {
target_member.active_points().saturating_sub(unbonding_points);
let mut target_member_after_unbond = (*target_member).clone();
target_member_after_unbond.points = new_depositor_points;
target_member_after_unbond.active_balance()
target_member_after_unbond.active_stake()
};

// any partial unbonding is only ever allowed if this unbond is permissioned.
Expand Down
2 changes: 1 addition & 1 deletion frame/nomination-pools/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4115,7 +4115,7 @@ mod create {
}
);
assert_eq!(
StakingMock::active_balance(&next_pool_stash).unwrap(),
StakingMock::active_stake(&next_pool_stash).unwrap(),
StakingMock::minimum_nominator_bond()
);
assert_eq!(
Expand Down