You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Acala is using pallet-balances and orml-tokens at same time to handle tokens. pallet-balances is used to handle the native token ACA and orml-tokens is used to handle other tokens (e.g. aUSD, renBTC, DOT, etc).
We have implemented a solution to allow user to use any supported tokens (e.g. aUSD, renBTC, DOT) to pay for transaction fee. This means our users does not need to hold our native token ACA at all.
To prevent dust account, pallet-balances implements a way to wipe account data (balance & nonce & refcount) when account balances drops below existential deposit.
The problem
We may not want to wipe account data when the pallet-balances balance drops below existential deposit because the user may hold other tokens and therefore should not remove nonce.
However the current implementation of pallet-balances will always drop account data when balances drops below existential deposit.
We can prevent balances drops below existential deposit by increase ref count for accounts have orml-tokens balances but because it is totally possible for an account never have any ACA balances at all, those account cannot be killed. Decrease ref count to zero does nothing at current Substrate implementation.
The changes we need
There are few changes required to solve our problem and not introduce breaking changes to existing production chains
Add a hook to frame-system when ref count changes (or drop to zero)
This will allow us to trigger kill account when ref count drops to zero
Add a hook to pallet-balances when an account balances changes (or when changing existential deposit status)
A struct will be provided to have the existing behavior. i.e. prevent drop to zero if not allow death and kill account if drop to zero
We will make it inc/dec ref count for our chain
As a result, on Acala, an account cannot be killed as long as it holds any kind of tokens. When the balances for all tokens drops below existential deposit, then the account will be killed on last transfer.
The text was updated successfully, but these errors were encountered:
The situation
Acala is using pallet-balances and orml-tokens at same time to handle tokens. pallet-balances is used to handle the native token ACA and orml-tokens is used to handle other tokens (e.g. aUSD, renBTC, DOT, etc).
We have implemented a solution to allow user to use any supported tokens (e.g. aUSD, renBTC, DOT) to pay for transaction fee. This means our users does not need to hold our native token ACA at all.
To prevent dust account, pallet-balances implements a way to wipe account data (balance & nonce & refcount) when account balances drops below existential deposit.
The problem
We may not want to wipe account data when the pallet-balances balance drops below existential deposit because the user may hold other tokens and therefore should not remove nonce.
However the current implementation of pallet-balances will always drop account data when balances drops below existential deposit.
We can prevent balances drops below existential deposit by increase ref count for accounts have orml-tokens balances but because it is totally possible for an account never have any ACA balances at all, those account cannot be killed. Decrease ref count to zero does nothing at current Substrate implementation.
The changes we need
There are few changes required to solve our problem and not introduce breaking changes to existing production chains
As a result, on Acala, an account cannot be killed as long as it holds any kind of tokens. When the balances for all tokens drops below existential deposit, then the account will be killed on last transfer.
The text was updated successfully, but these errors were encountered: