open-runtime-module-library
open-runtime-module-library copied to clipboard
Account providers counter gets decremented on zero balance
According to this line, the providers
count gets decremented if the account balance gets to zero. I haven't found similar logic in frame_balances
, so the question is: why is it needed? What if I don't want any account to be removed if the balance reaches 0?
It is required to prevent dust account. You can't keep account without balance. This is the corresponding logic in Substrate https://github.com/paritytech/substrate/blob/a2fdd15c047289426e6023f393ee9172d81cc0ff/frame/system/src/lib.rs#L1609
@xlc this logic isn't related to balances, it's just related to providers count (if the number of providers gets 0, the account gets removed). Here is the balances
logic: https://github.com/paritytech/substrate/blob/a2fdd15c047289426e6023f393ee9172d81cc0ff/frame/balances/src/lib.rs#L675
And as you can see, the zero check happens only when the balance gets below ExistencialDeposit
. So if I have ExistencialDeposit = 0
, my account should never be removed.
And now you have dust account issue.
But we do plan to refactor all the ref count code with the recent changes https://github.com/AcalaNetwork/Acala/issues/784
@xlc of course, but it will be intentional, that's why I set ExistencialDeposit
to 0, to me It means that I want to keep all accounts, including dust accounts.
ok. I will revisit this issue after we finished the refactor