mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 12:11:09 +00:00
BREAKING: Rename Origin (#12258)
* BREAKING: Rename Origin * more renaming * a bit more renaming * fix * more fixing * fix in frame_support * even more fixes * fix * small fix * ... * update .stderr * docs * update docs * update docs * docs
This commit is contained in:
@@ -26,7 +26,7 @@ mod mock;
|
||||
use frame_benchmarking::{account, frame_support::traits::Currency, vec, whitelist_account, Vec};
|
||||
use frame_election_provider_support::SortedListProvider;
|
||||
use frame_support::{assert_ok, ensure, traits::Get};
|
||||
use frame_system::RawOrigin as Origin;
|
||||
use frame_system::RawOrigin as RuntimeOrigin;
|
||||
use pallet_nomination_pools::{
|
||||
BalanceOf, BondExtra, BondedPoolInner, BondedPools, ConfigOp, MaxPoolMembers,
|
||||
MaxPoolMembersPerPool, MaxPools, Metadata, MinCreateBond, MinJoinBond, Pallet as Pools,
|
||||
@@ -80,7 +80,7 @@ fn create_pool_account<T: pallet_nomination_pools::Config>(
|
||||
let pool_creator_lookup = T::Lookup::unlookup(pool_creator.clone());
|
||||
|
||||
Pools::<T>::create(
|
||||
Origin::Signed(pool_creator.clone()).into(),
|
||||
RuntimeOrigin::Signed(pool_creator.clone()).into(),
|
||||
balance,
|
||||
pool_creator_lookup.clone(),
|
||||
pool_creator_lookup.clone(),
|
||||
@@ -203,7 +203,7 @@ impl<T: Config> ListScenario<T> {
|
||||
maybe_pool.as_mut().map(|pool| pool.points -= amount)
|
||||
});
|
||||
|
||||
Pools::<T>::join(Origin::Signed(joiner.clone()).into(), amount, 1).unwrap();
|
||||
Pools::<T>::join(RuntimeOrigin::Signed(joiner.clone()).into(), amount, 1).unwrap();
|
||||
|
||||
// check that the vote weight is still the same as the original bonded
|
||||
let weight_of = pallet_staking::Pallet::<T>::weight_of_fn();
|
||||
@@ -236,7 +236,7 @@ frame_benchmarking::benchmarks! {
|
||||
= create_funded_user_with_balance::<T>("joiner", 0, joiner_free);
|
||||
|
||||
whitelist_account!(joiner);
|
||||
}: _(Origin::Signed(joiner.clone()), max_additional, 1)
|
||||
}: _(RuntimeOrigin::Signed(joiner.clone()), max_additional, 1)
|
||||
verify {
|
||||
assert_eq!(CurrencyOf::<T>::free_balance(&joiner), joiner_free - max_additional);
|
||||
assert_eq!(
|
||||
@@ -252,7 +252,7 @@ frame_benchmarking::benchmarks! {
|
||||
|
||||
// creator of the src pool will bond-extra, bumping itself to dest bag.
|
||||
|
||||
}: bond_extra(Origin::Signed(scenario.creator1.clone()), BondExtra::FreeBalance(extra))
|
||||
}: bond_extra(RuntimeOrigin::Signed(scenario.creator1.clone()), BondExtra::FreeBalance(extra))
|
||||
verify {
|
||||
assert!(
|
||||
T::StakingInterface::active_stake(&scenario.origin1).unwrap() >=
|
||||
@@ -270,7 +270,7 @@ frame_benchmarking::benchmarks! {
|
||||
assert!(extra >= CurrencyOf::<T>::minimum_balance());
|
||||
CurrencyOf::<T>::deposit_creating(&reward_account1, extra);
|
||||
|
||||
}: bond_extra(Origin::Signed(scenario.creator1.clone()), BondExtra::Rewards)
|
||||
}: bond_extra(RuntimeOrigin::Signed(scenario.creator1.clone()), BondExtra::Rewards)
|
||||
verify {
|
||||
assert!(
|
||||
T::StakingInterface::active_stake(&scenario.origin1).unwrap() >=
|
||||
@@ -294,7 +294,7 @@ frame_benchmarking::benchmarks! {
|
||||
);
|
||||
|
||||
whitelist_account!(depositor);
|
||||
}:_(Origin::Signed(depositor.clone()))
|
||||
}:_(RuntimeOrigin::Signed(depositor.clone()))
|
||||
verify {
|
||||
assert_eq!(
|
||||
CurrencyOf::<T>::free_balance(&depositor),
|
||||
@@ -318,7 +318,7 @@ frame_benchmarking::benchmarks! {
|
||||
let member_id_lookup = T::Lookup::unlookup(member_id.clone());
|
||||
let all_points = PoolMembers::<T>::get(&member_id).unwrap().points;
|
||||
whitelist_account!(member_id);
|
||||
}: _(Origin::Signed(member_id.clone()), member_id_lookup, all_points)
|
||||
}: _(RuntimeOrigin::Signed(member_id.clone()), member_id_lookup, all_points)
|
||||
verify {
|
||||
let bonded_after = T::StakingInterface::active_stake(&scenario.origin1).unwrap();
|
||||
// We at least went down to the destination bag
|
||||
@@ -346,7 +346,7 @@ frame_benchmarking::benchmarks! {
|
||||
// Add a new member
|
||||
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 * 2u32.into());
|
||||
Pools::<T>::join(Origin::Signed(joiner.clone()).into(), min_join_bond, 1)
|
||||
Pools::<T>::join(RuntimeOrigin::Signed(joiner.clone()).into(), min_join_bond, 1)
|
||||
.unwrap();
|
||||
|
||||
// Sanity check join worked
|
||||
@@ -357,7 +357,7 @@ frame_benchmarking::benchmarks! {
|
||||
assert_eq!(CurrencyOf::<T>::free_balance(&joiner), min_join_bond);
|
||||
|
||||
// Unbond the new member
|
||||
Pools::<T>::fully_unbond(Origin::Signed(joiner.clone()).into(), joiner.clone()).unwrap();
|
||||
Pools::<T>::fully_unbond(RuntimeOrigin::Signed(joiner.clone()).into(), joiner.clone()).unwrap();
|
||||
|
||||
// Sanity check that unbond worked
|
||||
assert_eq!(
|
||||
@@ -371,7 +371,7 @@ frame_benchmarking::benchmarks! {
|
||||
// Add `s` count of slashing spans to storage.
|
||||
pallet_staking::benchmarking::add_slashing_spans::<T>(&pool_account, s);
|
||||
whitelist_account!(pool_account);
|
||||
}: _(Origin::Signed(pool_account.clone()), 1, s)
|
||||
}: _(RuntimeOrigin::Signed(pool_account.clone()), 1, s)
|
||||
verify {
|
||||
// The joiners funds didn't change
|
||||
assert_eq!(CurrencyOf::<T>::free_balance(&joiner), min_join_bond);
|
||||
@@ -389,7 +389,7 @@ frame_benchmarking::benchmarks! {
|
||||
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 * 2u32.into());
|
||||
let joiner_lookup = T::Lookup::unlookup(joiner.clone());
|
||||
Pools::<T>::join(Origin::Signed(joiner.clone()).into(), min_join_bond, 1)
|
||||
Pools::<T>::join(RuntimeOrigin::Signed(joiner.clone()).into(), min_join_bond, 1)
|
||||
.unwrap();
|
||||
|
||||
// Sanity check join worked
|
||||
@@ -401,7 +401,7 @@ frame_benchmarking::benchmarks! {
|
||||
|
||||
// Unbond the new member
|
||||
pallet_staking::CurrentEra::<T>::put(0);
|
||||
Pools::<T>::fully_unbond(Origin::Signed(joiner.clone()).into(), joiner.clone()).unwrap();
|
||||
Pools::<T>::fully_unbond(RuntimeOrigin::Signed(joiner.clone()).into(), joiner.clone()).unwrap();
|
||||
|
||||
// Sanity check that unbond worked
|
||||
assert_eq!(
|
||||
@@ -415,7 +415,7 @@ frame_benchmarking::benchmarks! {
|
||||
|
||||
pallet_staking::benchmarking::add_slashing_spans::<T>(&pool_account, s);
|
||||
whitelist_account!(joiner);
|
||||
}: withdraw_unbonded(Origin::Signed(joiner.clone()), joiner_lookup, s)
|
||||
}: withdraw_unbonded(RuntimeOrigin::Signed(joiner.clone()), joiner_lookup, s)
|
||||
verify {
|
||||
assert_eq!(
|
||||
CurrencyOf::<T>::free_balance(&joiner),
|
||||
@@ -448,7 +448,7 @@ frame_benchmarking::benchmarks! {
|
||||
// up when unbonding.
|
||||
let reward_account = Pools::<T>::create_reward_account(1);
|
||||
assert!(frame_system::Account::<T>::contains_key(&reward_account));
|
||||
Pools::<T>::fully_unbond(Origin::Signed(depositor.clone()).into(), depositor.clone()).unwrap();
|
||||
Pools::<T>::fully_unbond(RuntimeOrigin::Signed(depositor.clone()).into(), depositor.clone()).unwrap();
|
||||
|
||||
// Sanity check that unbond worked
|
||||
assert_eq!(
|
||||
@@ -473,7 +473,7 @@ frame_benchmarking::benchmarks! {
|
||||
assert!(frame_system::Account::<T>::contains_key(&reward_account));
|
||||
|
||||
whitelist_account!(depositor);
|
||||
}: withdraw_unbonded(Origin::Signed(depositor.clone()), depositor_lookup, s)
|
||||
}: withdraw_unbonded(RuntimeOrigin::Signed(depositor.clone()), depositor_lookup, s)
|
||||
verify {
|
||||
// Pool removal worked
|
||||
assert!(!pallet_staking::Ledger::<T>::contains_key(&pool_account));
|
||||
@@ -506,7 +506,7 @@ frame_benchmarking::benchmarks! {
|
||||
|
||||
whitelist_account!(depositor);
|
||||
}: _(
|
||||
Origin::Signed(depositor.clone()),
|
||||
RuntimeOrigin::Signed(depositor.clone()),
|
||||
min_create_bond,
|
||||
depositor_lookup.clone(),
|
||||
depositor_lookup.clone(),
|
||||
@@ -550,7 +550,7 @@ frame_benchmarking::benchmarks! {
|
||||
.collect();
|
||||
|
||||
whitelist_account!(depositor);
|
||||
}:_(Origin::Signed(depositor.clone()), 1, validators)
|
||||
}:_(RuntimeOrigin::Signed(depositor.clone()), 1, validators)
|
||||
verify {
|
||||
assert_eq!(RewardPools::<T>::count(), 1);
|
||||
assert_eq!(BondedPools::<T>::count(), 1);
|
||||
@@ -586,7 +586,7 @@ frame_benchmarking::benchmarks! {
|
||||
|
||||
let caller = account("caller", 0, USER_SEED);
|
||||
whitelist_account!(caller);
|
||||
}:_(Origin::Signed(caller), 1, PoolState::Destroying)
|
||||
}:_(RuntimeOrigin::Signed(caller), 1, PoolState::Destroying)
|
||||
verify {
|
||||
assert_eq!(BondedPools::<T>::get(1).unwrap().state, PoolState::Destroying);
|
||||
}
|
||||
@@ -601,14 +601,14 @@ frame_benchmarking::benchmarks! {
|
||||
let metadata: Vec<u8> = (0..n).map(|_| 42).collect();
|
||||
|
||||
whitelist_account!(depositor);
|
||||
}:_(Origin::Signed(depositor), 1, metadata.clone())
|
||||
}:_(RuntimeOrigin::Signed(depositor), 1, metadata.clone())
|
||||
verify {
|
||||
assert_eq!(Metadata::<T>::get(&1), metadata);
|
||||
}
|
||||
|
||||
set_configs {
|
||||
}:_(
|
||||
Origin::Root,
|
||||
RuntimeOrigin::Root,
|
||||
ConfigOp::Set(BalanceOf::<T>::max_value()),
|
||||
ConfigOp::Set(BalanceOf::<T>::max_value()),
|
||||
ConfigOp::Set(u32::MAX),
|
||||
@@ -627,7 +627,7 @@ frame_benchmarking::benchmarks! {
|
||||
let (root, _) = create_pool_account::<T>(0, min_create_bond::<T>() * 2u32.into());
|
||||
let random: T::AccountId = account("but is anything really random in computers..?", 0, USER_SEED);
|
||||
}:_(
|
||||
Origin::Signed(root.clone()),
|
||||
RuntimeOrigin::Signed(root.clone()),
|
||||
first_id,
|
||||
ConfigOp::Set(random.clone()),
|
||||
ConfigOp::Set(random.clone()),
|
||||
@@ -653,11 +653,11 @@ frame_benchmarking::benchmarks! {
|
||||
.map(|i| account("stash", USER_SEED, i))
|
||||
.collect();
|
||||
|
||||
assert_ok!(Pools::<T>::nominate(Origin::Signed(depositor.clone()).into(), 1, validators));
|
||||
assert_ok!(Pools::<T>::nominate(RuntimeOrigin::Signed(depositor.clone()).into(), 1, validators));
|
||||
assert!(T::StakingInterface::nominations(Pools::<T>::create_bonded_account(1)).is_some());
|
||||
|
||||
whitelist_account!(depositor);
|
||||
}:_(Origin::Signed(depositor.clone()), 1)
|
||||
}:_(RuntimeOrigin::Signed(depositor.clone()), 1)
|
||||
verify {
|
||||
assert!(T::StakingInterface::nominations(Pools::<T>::create_bonded_account(1)).is_none());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ impl frame_system::Config for Runtime {
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = AccountIndex;
|
||||
type BlockNumber = BlockNumber;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
@@ -119,7 +119,7 @@ pub mod v2 {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
let join = |x| {
|
||||
Balances::make_free_balance_be(&x, Balances::minimum_balance() + 10);
|
||||
frame_support::assert_ok!(Pools::join(Origin::signed(x), 10, 1));
|
||||
frame_support::assert_ok!(Pools::join(RuntimeOrigin::signed(x), 10, 1));
|
||||
};
|
||||
|
||||
assert_eq!(BondedPool::<Runtime>::get(1).unwrap().points, 10);
|
||||
|
||||
@@ -128,7 +128,7 @@ impl sp_staking::StakingInterface for StakingMock {
|
||||
impl frame_system::Config for Runtime {
|
||||
type SS58Prefix = ();
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = BlockNumber;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
@@ -291,7 +291,7 @@ impl ExtBuilder {
|
||||
let amount_to_bond = Pools::depositor_min_bond();
|
||||
Balances::make_free_balance_be(&10, amount_to_bond * 5);
|
||||
assert_ok!(Pools::create(RawOrigin::Signed(10).into(), amount_to_bond, 900, 901, 902));
|
||||
assert_ok!(Pools::set_metadata(Origin::signed(900), 1, vec![1, 1]));
|
||||
assert_ok!(Pools::set_metadata(RuntimeOrigin::signed(900), 1, vec![1, 1]));
|
||||
let last_pool = LastPoolId::<Runtime>::get();
|
||||
for (account_id, bonded) in self.members {
|
||||
Balances::make_free_balance_be(&account_id, bonded * 2);
|
||||
@@ -353,7 +353,7 @@ pub fn fully_unbond_permissioned(member: AccountId) -> DispatchResult {
|
||||
let points = PoolMembers::<Runtime>::get(&member)
|
||||
.map(|d| d.active_points())
|
||||
.unwrap_or_default();
|
||||
Pools::unbond(Origin::signed(member), member, points)
|
||||
Pools::unbond(RuntimeOrigin::signed(member), member, points)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,11 +35,11 @@ fn pool_lifecycle_e2e() {
|
||||
assert_eq!(Staking::current_era(), None);
|
||||
|
||||
// create the pool, we know this has id 1.
|
||||
assert_ok!(Pools::create(Origin::signed(10), 50, 10, 10, 10));
|
||||
assert_ok!(Pools::create(RuntimeOrigin::signed(10), 50, 10, 10, 10));
|
||||
assert_eq!(LastPoolId::<Runtime>::get(), 1);
|
||||
|
||||
// have the pool nominate.
|
||||
assert_ok!(Pools::nominate(Origin::signed(10), 1, vec![1, 2, 3]));
|
||||
assert_ok!(Pools::nominate(RuntimeOrigin::signed(10), 1, vec![1, 2, 3]));
|
||||
|
||||
assert_eq!(staking_events_since_last_call(), vec![StakingEvent::Bonded(POOL1_BONDED, 50),]);
|
||||
assert_eq!(
|
||||
@@ -51,8 +51,8 @@ fn pool_lifecycle_e2e() {
|
||||
);
|
||||
|
||||
// have two members join
|
||||
assert_ok!(Pools::join(Origin::signed(20), 10, 1));
|
||||
assert_ok!(Pools::join(Origin::signed(21), 10, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(20), 10, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(21), 10, 1));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -67,17 +67,17 @@ fn pool_lifecycle_e2e() {
|
||||
);
|
||||
|
||||
// pool goes into destroying
|
||||
assert_ok!(Pools::set_state(Origin::signed(10), 1, PoolState::Destroying));
|
||||
assert_ok!(Pools::set_state(RuntimeOrigin::signed(10), 1, PoolState::Destroying));
|
||||
|
||||
// depositor cannot unbond yet.
|
||||
assert_noop!(
|
||||
Pools::unbond(Origin::signed(10), 10, 50),
|
||||
Pools::unbond(RuntimeOrigin::signed(10), 10, 50),
|
||||
PoolsError::<Runtime>::MinimumBondNotMet,
|
||||
);
|
||||
|
||||
// now the members want to unbond.
|
||||
assert_ok!(Pools::unbond(Origin::signed(20), 20, 10));
|
||||
assert_ok!(Pools::unbond(Origin::signed(21), 21, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(21), 21, 10));
|
||||
|
||||
assert_eq!(PoolMembers::<Runtime>::get(20).unwrap().unbonding_eras.len(), 1);
|
||||
assert_eq!(PoolMembers::<Runtime>::get(20).unwrap().points, 0);
|
||||
@@ -102,14 +102,14 @@ fn pool_lifecycle_e2e() {
|
||||
|
||||
// depositor cannot still unbond
|
||||
assert_noop!(
|
||||
Pools::unbond(Origin::signed(10), 10, 50),
|
||||
Pools::unbond(RuntimeOrigin::signed(10), 10, 50),
|
||||
PoolsError::<Runtime>::MinimumBondNotMet,
|
||||
);
|
||||
|
||||
for e in 1..BondingDuration::get() {
|
||||
CurrentEra::<Runtime>::set(Some(e));
|
||||
assert_noop!(
|
||||
Pools::withdraw_unbonded(Origin::signed(20), 20, 0),
|
||||
Pools::withdraw_unbonded(RuntimeOrigin::signed(20), 20, 0),
|
||||
PoolsError::<Runtime>::CannotWithdrawAny
|
||||
);
|
||||
}
|
||||
@@ -119,13 +119,13 @@ fn pool_lifecycle_e2e() {
|
||||
|
||||
// depositor cannot still unbond
|
||||
assert_noop!(
|
||||
Pools::unbond(Origin::signed(10), 10, 50),
|
||||
Pools::unbond(RuntimeOrigin::signed(10), 10, 50),
|
||||
PoolsError::<Runtime>::MinimumBondNotMet,
|
||||
);
|
||||
|
||||
// but members can now withdraw.
|
||||
assert_ok!(Pools::withdraw_unbonded(Origin::signed(20), 20, 0));
|
||||
assert_ok!(Pools::withdraw_unbonded(Origin::signed(21), 21, 0));
|
||||
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(20), 20, 0));
|
||||
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(21), 21, 0));
|
||||
assert!(PoolMembers::<Runtime>::get(20).is_none());
|
||||
assert!(PoolMembers::<Runtime>::get(21).is_none());
|
||||
|
||||
@@ -146,12 +146,12 @@ fn pool_lifecycle_e2e() {
|
||||
// as soon as all members have left, the depositor can try to unbond, but since the
|
||||
// min-nominator intention is set, they must chill first.
|
||||
assert_noop!(
|
||||
Pools::unbond(Origin::signed(10), 10, 50),
|
||||
Pools::unbond(RuntimeOrigin::signed(10), 10, 50),
|
||||
pallet_staking::Error::<Runtime>::InsufficientBond
|
||||
);
|
||||
|
||||
assert_ok!(Pools::chill(Origin::signed(10), 1));
|
||||
assert_ok!(Pools::unbond(Origin::signed(10), 10, 50));
|
||||
assert_ok!(Pools::chill(RuntimeOrigin::signed(10), 1));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(10), 10, 50));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -164,7 +164,7 @@ fn pool_lifecycle_e2e() {
|
||||
|
||||
// waiting another bonding duration:
|
||||
CurrentEra::<Runtime>::set(Some(BondingDuration::get() * 2));
|
||||
assert_ok!(Pools::withdraw_unbonded(Origin::signed(10), 10, 1));
|
||||
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(10), 10, 1));
|
||||
|
||||
// pools is fully destroyed now.
|
||||
assert_eq!(
|
||||
@@ -190,7 +190,7 @@ fn pool_slash_e2e() {
|
||||
assert_eq!(Staking::current_era(), None);
|
||||
|
||||
// create the pool, we know this has id 1.
|
||||
assert_ok!(Pools::create(Origin::signed(10), 40, 10, 10, 10));
|
||||
assert_ok!(Pools::create(RuntimeOrigin::signed(10), 40, 10, 10, 10));
|
||||
assert_eq!(LastPoolId::<Runtime>::get(), 1);
|
||||
|
||||
assert_eq!(staking_events_since_last_call(), vec![StakingEvent::Bonded(POOL1_BONDED, 40)]);
|
||||
@@ -205,8 +205,8 @@ fn pool_slash_e2e() {
|
||||
assert_eq!(Payee::<Runtime>::get(POOL1_BONDED), RewardDestination::Account(POOL1_REWARD));
|
||||
|
||||
// have two members join
|
||||
assert_ok!(Pools::join(Origin::signed(20), 20, 1));
|
||||
assert_ok!(Pools::join(Origin::signed(21), 20, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(20), 20, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(21), 20, 1));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -224,8 +224,8 @@ fn pool_slash_e2e() {
|
||||
CurrentEra::<Runtime>::set(Some(1));
|
||||
|
||||
// 20 / 80 of the total funds are unlocked, and safe from any further slash.
|
||||
assert_ok!(Pools::unbond(Origin::signed(10), 10, 10));
|
||||
assert_ok!(Pools::unbond(Origin::signed(20), 20, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(10), 10, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, 10));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -246,9 +246,9 @@ fn pool_slash_e2e() {
|
||||
|
||||
// note: depositor cannot fully unbond at this point.
|
||||
// these funds will still get slashed.
|
||||
assert_ok!(Pools::unbond(Origin::signed(10), 10, 10));
|
||||
assert_ok!(Pools::unbond(Origin::signed(20), 20, 10));
|
||||
assert_ok!(Pools::unbond(Origin::signed(21), 21, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(10), 10, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(21), 21, 10));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -290,7 +290,7 @@ fn pool_slash_e2e() {
|
||||
);
|
||||
|
||||
CurrentEra::<Runtime>::set(Some(3));
|
||||
assert_ok!(Pools::unbond(Origin::signed(21), 21, 10));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(21), 21, 10));
|
||||
|
||||
assert_eq!(
|
||||
PoolMembers::<Runtime>::get(21).unwrap(),
|
||||
@@ -310,8 +310,8 @@ fn pool_slash_e2e() {
|
||||
|
||||
// now we start withdrawing. we do it all at once, at era 6 where 20 and 21 are fully free.
|
||||
CurrentEra::<Runtime>::set(Some(6));
|
||||
assert_ok!(Pools::withdraw_unbonded(Origin::signed(20), 20, 0));
|
||||
assert_ok!(Pools::withdraw_unbonded(Origin::signed(21), 21, 0));
|
||||
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(20), 20, 0));
|
||||
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(21), 21, 0));
|
||||
|
||||
assert_eq!(
|
||||
pool_events_since_last_call(),
|
||||
@@ -331,8 +331,8 @@ fn pool_slash_e2e() {
|
||||
);
|
||||
|
||||
// now, finally, we can unbond the depositor further than their current limit.
|
||||
assert_ok!(Pools::set_state(Origin::signed(10), 1, PoolState::Destroying));
|
||||
assert_ok!(Pools::unbond(Origin::signed(10), 10, 20));
|
||||
assert_ok!(Pools::set_state(RuntimeOrigin::signed(10), 1, PoolState::Destroying));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(10), 10, 20));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -357,7 +357,7 @@ fn pool_slash_e2e() {
|
||||
}
|
||||
);
|
||||
// withdraw the depositor, they should lose 12 balance in total due to slash.
|
||||
assert_ok!(Pools::withdraw_unbonded(Origin::signed(10), 10, 0));
|
||||
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(10), 10, 0));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -385,7 +385,7 @@ fn pool_slash_proportional() {
|
||||
assert_eq!(Staking::current_era(), None);
|
||||
|
||||
// create the pool, we know this has id 1.
|
||||
assert_ok!(Pools::create(Origin::signed(10), 40, 10, 10, 10));
|
||||
assert_ok!(Pools::create(RuntimeOrigin::signed(10), 40, 10, 10, 10));
|
||||
assert_eq!(LastPoolId::<T>::get(), 1);
|
||||
|
||||
assert_eq!(staking_events_since_last_call(), vec![StakingEvent::Bonded(POOL1_BONDED, 40)]);
|
||||
@@ -399,9 +399,9 @@ fn pool_slash_proportional() {
|
||||
|
||||
// have two members join
|
||||
let bond = 20;
|
||||
assert_ok!(Pools::join(Origin::signed(20), bond, 1));
|
||||
assert_ok!(Pools::join(Origin::signed(21), bond, 1));
|
||||
assert_ok!(Pools::join(Origin::signed(22), bond, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(20), bond, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(21), bond, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(22), bond, 1));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -424,7 +424,7 @@ fn pool_slash_proportional() {
|
||||
CurrentEra::<T>::set(Some(99));
|
||||
|
||||
// and unbond
|
||||
assert_ok!(Pools::unbond(Origin::signed(20), 20, bond));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, bond));
|
||||
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
@@ -442,7 +442,7 @@ fn pool_slash_proportional() {
|
||||
);
|
||||
|
||||
CurrentEra::<T>::set(Some(100));
|
||||
assert_ok!(Pools::unbond(Origin::signed(21), 21, bond));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(21), 21, bond));
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
vec![StakingEvent::Unbonded(POOL1_BONDED, bond),]
|
||||
@@ -459,7 +459,7 @@ fn pool_slash_proportional() {
|
||||
);
|
||||
|
||||
CurrentEra::<T>::set(Some(101));
|
||||
assert_ok!(Pools::unbond(Origin::signed(22), 22, bond));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(22), 22, bond));
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
vec![StakingEvent::Unbonded(POOL1_BONDED, bond),]
|
||||
@@ -516,7 +516,7 @@ fn pool_slash_non_proportional_only_bonded_pool() {
|
||||
assert_eq!(Staking::current_era(), None);
|
||||
|
||||
// create the pool, we know this has id 1.
|
||||
assert_ok!(Pools::create(Origin::signed(10), 40, 10, 10, 10));
|
||||
assert_ok!(Pools::create(RuntimeOrigin::signed(10), 40, 10, 10, 10));
|
||||
assert_eq!(staking_events_since_last_call(), vec![StakingEvent::Bonded(POOL1_BONDED, 40)]);
|
||||
assert_eq!(
|
||||
pool_events_since_last_call(),
|
||||
@@ -528,7 +528,7 @@ fn pool_slash_non_proportional_only_bonded_pool() {
|
||||
|
||||
// have two members join
|
||||
let bond = 20;
|
||||
assert_ok!(Pools::join(Origin::signed(20), bond, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(20), bond, 1));
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
vec![StakingEvent::Bonded(POOL1_BONDED, bond)]
|
||||
@@ -540,7 +540,7 @@ fn pool_slash_non_proportional_only_bonded_pool() {
|
||||
|
||||
// progress and unbond.
|
||||
CurrentEra::<T>::set(Some(99));
|
||||
assert_ok!(Pools::unbond(Origin::signed(20), 20, bond));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, bond));
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
vec![StakingEvent::Unbonded(POOL1_BONDED, bond)]
|
||||
@@ -589,7 +589,7 @@ fn pool_slash_non_proportional_bonded_pool_and_chunks() {
|
||||
assert_eq!(Staking::current_era(), None);
|
||||
|
||||
// create the pool, we know this has id 1.
|
||||
assert_ok!(Pools::create(Origin::signed(10), 40, 10, 10, 10));
|
||||
assert_ok!(Pools::create(RuntimeOrigin::signed(10), 40, 10, 10, 10));
|
||||
assert_eq!(staking_events_since_last_call(), vec![StakingEvent::Bonded(POOL1_BONDED, 40)]);
|
||||
assert_eq!(
|
||||
pool_events_since_last_call(),
|
||||
@@ -601,7 +601,7 @@ fn pool_slash_non_proportional_bonded_pool_and_chunks() {
|
||||
|
||||
// have two members join
|
||||
let bond = 20;
|
||||
assert_ok!(Pools::join(Origin::signed(20), bond, 1));
|
||||
assert_ok!(Pools::join(RuntimeOrigin::signed(20), bond, 1));
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
vec![StakingEvent::Bonded(POOL1_BONDED, bond)]
|
||||
@@ -613,7 +613,7 @@ fn pool_slash_non_proportional_bonded_pool_and_chunks() {
|
||||
|
||||
// progress and unbond.
|
||||
CurrentEra::<T>::set(Some(99));
|
||||
assert_ok!(Pools::unbond(Origin::signed(20), 20, bond));
|
||||
assert_ok!(Pools::unbond(RuntimeOrigin::signed(20), 20, bond));
|
||||
assert_eq!(
|
||||
staking_events_since_last_call(),
|
||||
vec![StakingEvent::Unbonded(POOL1_BONDED, bond)]
|
||||
|
||||
@@ -43,7 +43,7 @@ impl frame_system::Config for Runtime {
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = AccountIndex;
|
||||
type BlockNumber = BlockNumber;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
@@ -227,7 +227,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
|
||||
// set some limit for nominations.
|
||||
assert_ok!(Staking::set_staking_configs(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
pallet_staking::ConfigOp::Set(10), // minimum nominator bond
|
||||
pallet_staking::ConfigOp::Noop,
|
||||
pallet_staking::ConfigOp::Noop,
|
||||
|
||||
Reference in New Issue
Block a user