Allow capping the amount of work performed when deleting a child trie (#7671)

* Allow Backend::for_keys_in_child_storage to be aborted by the closure

* Ext::kill_child_storage now takes an upper limit for backend deletion

* Add Storage::storage_kill_limited() runtime interface

* review: Use a new version of kill_storage instead of a new interface

* review: Simplify boolean expression

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* review: Rename for_keys_in_child_storage

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
This commit is contained in:
Alexander Theißenandcheme authored and GitHub committed 2020-12-09 01:17:28 +00:00
1 parent 4689c21069
commit 9ce24fe1f4
19 files changed
+219 -34

No files matched your search

+2
View File
@@ -240,6 +240,7 @@ where
<ContractInfoOf<T>>::remove(account);
child::kill_storage(
&alive_contract_info.child_trie_info(),
None,
);
<Module<T>>::deposit_event(RawEvent::Evicted(account.clone(), false));
None
@@ -263,6 +264,7 @@ where
child::kill_storage(
&alive_contract_info.child_trie_info(),
None,
);
<Module<T>>::deposit_event(RawEvent::Evicted(account.clone(), true));
+1 -1
View File
@@ -195,7 +195,7 @@ where
/// This function doesn't affect the account.
pub fn destroy_contract(address: &AccountIdOf<T>, trie_id: &TrieId) {
<ContractInfoOf<T>>::remove(address);
child::kill_storage(&crate::child_trie_info(&trie_id));
child::kill_storage(&crate::child_trie_info(&trie_id), None);
}
/// This generator uses inner counter for account id and applies the hash over `AccountId +