mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 08:57:56 +00:00
Refactor the balances module (#4649)
* Initially scoping out of the problem * Remove need for exiry in balance locks. * Remove expiry from locks. * Remove supefluous balance test * Amalgamate pieces of balance module * Split out vesting * Fix tests * Fixes for vesting. * Docs. * Weight docs. * Refactor things in terms of set_balances. * Switch out ED to be free + reserved. * Remove on_free_balance_zero and some docs. * Build fixes * Update frame/vesting/src/lib.rs Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com> * Update frame/vesting/src/lib.rs Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com> * Migration * Remove superfluous code. * Test fixes * Fix some tests * Fix repatriate reserve * Fixes * Add test for migration * Final cleanups * Fix * Indentation. * Undo unneeded referencing * Bump runtime version * Fixes Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
This commit is contained in:
@@ -30,8 +30,8 @@ type Balances = pallet_balances::Module<Test>;
|
||||
fn query_membership_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_eq!(ScoredPool::members(), vec![20, 40]);
|
||||
assert_eq!(Balances::reserved_balance(&31), CandidateDeposit::get());
|
||||
assert_eq!(Balances::reserved_balance(&40), CandidateDeposit::get());
|
||||
assert_eq!(Balances::reserved_balance(31), CandidateDeposit::get());
|
||||
assert_eq!(Balances::reserved_balance(40), CandidateDeposit::get());
|
||||
assert_eq!(MEMBERS.with(|m| m.borrow().clone()), vec![20, 40]);
|
||||
});
|
||||
}
|
||||
@@ -61,7 +61,7 @@ fn submit_candidacy_works() {
|
||||
assert_eq!(fetch_from_pool(15), Some((who, None)));
|
||||
|
||||
// then
|
||||
assert_eq!(Balances::reserved_balance(&who), CandidateDeposit::get());
|
||||
assert_eq!(Balances::reserved_balance(who), CandidateDeposit::get());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ fn kicking_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// given
|
||||
let who = 40;
|
||||
assert_eq!(Balances::reserved_balance(&who), CandidateDeposit::get());
|
||||
assert_eq!(Balances::reserved_balance(who), CandidateDeposit::get());
|
||||
assert_eq!(find_in_pool(who), Some(0));
|
||||
|
||||
// when
|
||||
@@ -128,7 +128,7 @@ fn kicking_works() {
|
||||
assert_eq!(find_in_pool(who), None);
|
||||
assert_eq!(ScoredPool::members(), vec![20, 31]);
|
||||
assert_eq!(MEMBERS.with(|m| m.borrow().clone()), ScoredPool::members());
|
||||
assert_eq!(Balances::reserved_balance(&who), 0); // deposit must have been returned
|
||||
assert_eq!(Balances::reserved_balance(who), 0); // deposit must have been returned
|
||||
});
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ fn withdraw_scored_candidacy_must_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// given
|
||||
let who = 40;
|
||||
assert_eq!(Balances::reserved_balance(&who), CandidateDeposit::get());
|
||||
assert_eq!(Balances::reserved_balance(who), CandidateDeposit::get());
|
||||
|
||||
// when
|
||||
let index = find_in_pool(who).expect("entity must be in pool") as u32;
|
||||
@@ -255,7 +255,7 @@ fn withdraw_scored_candidacy_must_work() {
|
||||
// then
|
||||
assert_eq!(fetch_from_pool(who), None);
|
||||
assert_eq!(ScoredPool::members(), vec![20, 31]);
|
||||
assert_eq!(Balances::reserved_balance(&who), 0);
|
||||
assert_eq!(Balances::reserved_balance(who), 0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user