Skip to content

Commit

Permalink
Contracts: Charge min amount when processing deletion queue (#2934)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Theißen <[email protected]>
  • Loading branch information
pgherveou and athei authored Mar 6, 2024
1 parent 8f8297e commit 475e7a1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion substrate/frame/contracts/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ impl<T: Config> ContractInfo<T> {
KillStorageResult::SomeRemaining(_) => return weight_limit,
KillStorageResult::AllRemoved(keys_removed) => {
entry.remove();
remaining_key_budget = remaining_key_budget.saturating_sub(keys_removed);
// charge at least one key even if none were removed.
remaining_key_budget = remaining_key_budget.saturating_sub(keys_removed.max(1));
},
};
}
Expand Down

0 comments on commit 475e7a1

Please sign in to comment.