mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
[Enhancement] Convert fast-unstake to use StakingInterface, decouplin… (#12424)
* [Enhancement] Convert fast-unstake to use StakingInterface, decoupling it from Staking * Update primitives/staking/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update primitives/staking/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * fix validator comment * remove todo * ideas from Kian (#12474) Co-authored-by: kianenigma <kian@parity.io> * Rename StakingInterface -> Staking for nomination-pools * Staking fixes * StakingInterface changes * fix fast-unstake * fix nomination-pools * Fix fast-unstake tests * Fix benches for fast-unstake * fix is_unbonding * fix nomination pools * fix node code * add mock comments * fix imports * remove todo * more fixes * more fixes * bench fixes * more fixes * more fixes * import fix * more fixes * more bench fix * refix * refix * Update primitives/staking/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * is_unbonding returns a result * fix * review fixes * more review fixes * more fixes * more fixes * Update frame/fast-unstake/src/benchmarking.rs Co-authored-by: Squirrel <gilescope@gmail.com> * remove redundant CurrencyBalance from nom-pools * remove CB * rephrase * Apply suggestions from code review * Update frame/nomination-pools/src/tests.rs * finish damn renamed * clippy fix * fix 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: Squirrel <gilescope@gmail.com>
This commit is contained in:
@@ -48,7 +48,7 @@ fn register_insufficient_funds_fails() {
|
||||
use pallet_balances::Error as BalancesError;
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
ErasToCheckPerBlock::<T>::put(1);
|
||||
<T as Config>::DepositCurrency::make_free_balance_be(&1, 3);
|
||||
<T as Config>::Currency::make_free_balance_be(&1, 3);
|
||||
|
||||
// Controller account registers for fast unstake.
|
||||
assert_noop!(
|
||||
@@ -138,15 +138,15 @@ fn deregister_works() {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
ErasToCheckPerBlock::<T>::put(1);
|
||||
|
||||
assert_eq!(<T as Config>::DepositCurrency::reserved_balance(&1), 0);
|
||||
assert_eq!(<T as Config>::Currency::reserved_balance(&1), 0);
|
||||
|
||||
// Controller account registers for fast unstake.
|
||||
assert_ok!(FastUnstake::register_fast_unstake(RuntimeOrigin::signed(2)));
|
||||
assert_eq!(<T as Config>::DepositCurrency::reserved_balance(&1), DepositAmount::get());
|
||||
assert_eq!(<T as Config>::Currency::reserved_balance(&1), DepositAmount::get());
|
||||
|
||||
// Controller then changes mind and deregisters.
|
||||
assert_ok!(FastUnstake::deregister(RuntimeOrigin::signed(2)));
|
||||
assert_eq!(<T as Config>::DepositCurrency::reserved_balance(&1), 0);
|
||||
assert_eq!(<T as Config>::Currency::reserved_balance(&1), 0);
|
||||
|
||||
// Ensure stash no longer exists in the queue.
|
||||
assert_eq!(Queue::<T>::get(1), None);
|
||||
@@ -363,7 +363,7 @@ mod on_idle {
|
||||
CurrentEra::<T>::put(BondingDuration::get());
|
||||
|
||||
// given
|
||||
assert_eq!(<T as Config>::DepositCurrency::reserved_balance(&1), 0);
|
||||
assert_eq!(<T as Config>::Currency::reserved_balance(&1), 0);
|
||||
|
||||
assert_ok!(FastUnstake::register_fast_unstake(RuntimeOrigin::signed(2)));
|
||||
assert_ok!(FastUnstake::register_fast_unstake(RuntimeOrigin::signed(4)));
|
||||
@@ -371,7 +371,7 @@ mod on_idle {
|
||||
assert_ok!(FastUnstake::register_fast_unstake(RuntimeOrigin::signed(8)));
|
||||
assert_ok!(FastUnstake::register_fast_unstake(RuntimeOrigin::signed(10)));
|
||||
|
||||
assert_eq!(<T as Config>::DepositCurrency::reserved_balance(&1), DepositAmount::get());
|
||||
assert_eq!(<T as Config>::Currency::reserved_balance(&1), DepositAmount::get());
|
||||
|
||||
assert_eq!(Queue::<T>::count(), 5);
|
||||
assert_eq!(Head::<T>::get(), None);
|
||||
@@ -411,7 +411,7 @@ mod on_idle {
|
||||
);
|
||||
assert_eq!(Queue::<T>::count(), 3);
|
||||
|
||||
assert_eq!(<T as Config>::DepositCurrency::reserved_balance(&1), 0);
|
||||
assert_eq!(<T as Config>::Currency::reserved_balance(&1), 0);
|
||||
|
||||
assert_eq!(
|
||||
fast_unstake_events_since_last_call(),
|
||||
|
||||
Reference in New Issue
Block a user