Fix lazy batch contract removal (#10728)

* Fix lazy batch contract removal

* Apply suggestions

* Qualify ChildInfo

* Negligible change to restart pipeline

* Revert "Negligible change to restart pipeline"

This reverts commit b38abb622a17de9f0d19b3eadcea611ead1a7251.

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Piotr Mikołajczyk
2022-01-28 19:37:54 +01:00
committed by GitHub
parent ffcd97807f
commit ee557b769c
3 changed files with 658 additions and 603 deletions
+4 -2
View File
@@ -268,7 +268,9 @@ where
let mut queue = <DeletionQueue<T>>::get();
if let (Some(trie), true) = (queue.get(0), remaining_key_budget > 0) {
while !queue.is_empty() && remaining_key_budget > 0 {
// Cannot panic due to loop condition
let trie = &mut queue[0];
let outcome =
child::kill_storage(&child_trie_info(&trie.trie_id), Some(remaining_key_budget));
let keys_removed = match outcome {
@@ -276,7 +278,7 @@ where
KillStorageResult::SomeRemaining(count) => count,
KillStorageResult::AllRemoved(count) => {
// We do not care to preserve order. The contract is deleted already and
// noone waits for the trie to be deleted.
// no one waits for the trie to be deleted.
queue.swap_remove(0);
count
},