Lazy reaping (#4895)

* Squash and rebase from gav-lazy-reaping

* Bump version

* Bump runtime again

* Docs.

* Remove old functions

* Update frame/balances/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/contracts/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Warnings

* Bump runtime version

* Update frame/democracy/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/system/src/lib.rs

* Clean up OnReapAccount

* Use frame_support debug

* Bump spec

* Renames and fix

* Fix

* Fix rename

* Fix

* Increase time for test

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
This commit is contained in:
Gavin Wood
2020-02-24 14:04:42 -03:00
committed by GitHub
parent c412c6230e
commit afa5861f3b
62 changed files with 604 additions and 287 deletions
+10
View File
@@ -1456,6 +1456,9 @@ fn on_free_balance_zero_stash_removes_validator() {
// Check total balance of stash
assert_eq!(Balances::total_balance(&11), 0);
// Reap the stash
assert_ok!(Staking::reap_stash(Origin::NONE, 11));
// Check storage items do not exist
assert!(!<Ledger<Test>>::contains_key(&10));
assert!(!<Bonded<Test>>::contains_key(&11));
@@ -1509,6 +1512,9 @@ fn on_free_balance_zero_stash_removes_nominator() {
// Check total balance of stash
assert_eq!(Balances::total_balance(&11), 0);
// Reap the stash
assert_ok!(Staking::reap_stash(Origin::NONE, 11));
// Check storage items do not exist
assert!(!<Ledger<Test>>::contains_key(&10));
assert!(!<Bonded<Test>>::contains_key(&11));
@@ -2303,6 +2309,10 @@ fn garbage_collection_after_slashing() {
// so we don't test those here.
assert_eq!(Balances::free_balance(11), 0);
assert_eq!(Balances::total_balance(&11), 0);
assert_ok!(Staking::reap_stash(Origin::NONE, 11));
assert!(<Staking as crate::Store>::SlashingSpans::get(&11).is_none());
assert_eq!(<Staking as crate::Store>::SpanSlash::get(&(11, 0)).amount_slashed(), &0);
})