Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Allow to update min_balance by asset owner for non-sufficient assets in assets pallet #13402

Closed
2 tasks done
IkerAlus opened this issue Feb 17, 2023 · 9 comments · Fixed by #13486
Closed
2 tasks done
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.

Comments

@IkerAlus
Copy link

IkerAlus commented Feb 17, 2023

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Once an asset is created with create the value assigned to min_balance can't be modified again by the asset owner (It can be done with force_asset_status but this requires ForceOrigin, aka root origin on Statemint/e). On the other hand, the number of decimals, decimals, can be always modified by the asset owner with the set_metadata call.

For external tools, UIs and end users there is a correspondence between minimum balance and number of decimals of an asset. If one of these is modified, the other one should be adapted accordingly. Hence, assets pallet should allow updating min_balance of an asset together with the number of decimals. This is particularly interesting soon after the asset is created and its owners are still in the process of deploying the new asset class. Otherwise, they are forced to destroy the asset (two steps process) and create it again.

Note that the possibility of updating min_balance parameter of an asset should be allow as long as it has no impact in the network. If the asset is made sufficient, then min_balance should be only modified by ForceOrigin.

Steps to reproduce

Create a new asset class with create call and try to change min_balance as the asset owner afterwards.

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Feb 17, 2023
@Szegoo
Copy link
Contributor

Szegoo commented Feb 25, 2023

I think it makes sense to allow this for asset owners. @bkchr if you confirm I will open a PR to implement this.

@bkchr
Copy link
Member

bkchr commented Feb 27, 2023

Generally sounds reasonable, but we should probably only allow as long as accounts == 0. Otherwise there may exist accounts which have less than min_balance.

WDYT @jsidorenko?

@jsidorenko
Copy link
Contributor

jsidorenko commented Feb 27, 2023

If we check the docs they say:

		/// - `min_balance`: The minimum balance of this new asset that any single account must
		/// have. If an account's balance is reduced below this, then it collapses to zero.

by allowing to change that param, an admin acc could easily set now the highly wrong min_balance and wipe by that mistake users' balances

@jsidorenko
Copy link
Contributor

so yeah, it would be safe to modify that param, only if accounts == 0

@Szegoo
Copy link
Contributor

Szegoo commented Feb 27, 2023

@jsidorenko Do you think it would make sense to allow the admin account to set min_balance even when accounts > 0 if the new min balance is smaller than the old one?

@bkchr
Copy link
Member

bkchr commented Feb 27, 2023

@jsidorenko Do you think it would make sense to allow the admin account to set min_balance even when accounts > 0 if the new min balance is smaller than the old one?

Then we would need to iterate all accounts, that would be way too costly.

@jsidorenko
Copy link
Contributor

@jsidorenko Do you think it would make sense to allow the admin account to set min_balance even when accounts > 0 if the new min balance is smaller than the old one?

Then we would need to iterate all accounts, that would be way too costly.

@bkchr why would you need to iterate all the accounts?
let can_set = accounts == 0 || new_min_balance < old_min_balance;

@bkchr
Copy link
Member

bkchr commented Feb 28, 2023

@jsidorenko Do you think it would make sense to allow the admin account to set min_balance even when accounts > 0 if the new min balance is smaller than the old one?

Then we would need to iterate all accounts, that would be way too costly.

@bkchr why would you need to iterate all the accounts? let can_set = accounts == 0 || new_min_balance < old_min_balance;

Yeah no that makes sense. I read it differently, like checking that each account has an higher balance. Sorry :D

@Polkadot-Forum
Copy link

This issue has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/polkadot-release-analysis-v0-9-40/2468/1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants