Assets pallet: Don't allow set_min_balance when sufficient (#13510)

* Assets pallet: Don't allow set_min_balance when sufficient

* fix

* fix benchmark

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_assets

* Update frame/assets/src/lib.rs

* fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_assets

---------

Co-authored-by: command-bot <>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Sergej Sakac
2023-03-03 21:39:45 +01:00
committed by GitHub
parent e4bf9f2125
commit 1d6423b41d
4 changed files with 169 additions and 189 deletions
+6 -2
View File
@@ -1540,8 +1540,12 @@ pub mod pallet {
ensure!(origin == details.owner, Error::<T, I>::NoPermission);
let old_min_balance = details.min_balance;
// Ensure that either the new min_balance is less than old min_balance or there aren't
// any accounts holding the asset.
// If the asset is marked as sufficient it won't be allowed to
// change the min_balance.
ensure!(!details.is_sufficient, Error::<T, I>::NoPermission);
// Ensure that either the new min_balance is less than old
// min_balance or there aren't any accounts holding the asset.
ensure!(
min_balance < old_min_balance || details.accounts == 0,
Error::<T, I>::NoPermission