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
The main reason of ExistentialDeposit is to prevent dust account attack, avoid state bloating to ensure people will not be unnecessarily to store account balances with near zero value and the storages are paid with enough compensation.
To prevent such attack without ExistentialDeposit, a new account model is required.
An account needs to be opened before it can exists and holding balances and system account data (i.e. nonce and ref count). A deposit will be reserved in order to open an account. This deposit essentially pays for the state usage of account data and all the token balances.
Account can be closed to wipe account data and token balances and release the reserved token.
System account ref counting can be used to prevent an account to be closed, so pallets can know it only need to dealing with opened accounts.
Workflow
any kind of transfer
check if receiver has account opened
if no, use the transfered fund to open account
if fund is not ACA
use DEX to convert required amount to ACA
reserve required ACA and mark account is open
to close account
parameter dest: Option<AccountId>
if no dest, use treasury address
check allow_death from system ref counting
if yes
iterate all token balances, send remaining fund including reserved ones to dest
Account Model Refactor
ExistentialDeposit
causes a lot of issues and edgecases:So we will be dropping it.
The main reason of
ExistentialDeposit
is to prevent dust account attack, avoid state bloating to ensure people will not be unnecessarily to store account balances with near zero value and the storages are paid with enough compensation.To prevent such attack without
ExistentialDeposit
, a new account model is required.An account needs to be opened before it can exists and holding balances and system account data (i.e. nonce and ref count). A deposit will be reserved in order to open an account. This deposit essentially pays for the state usage of account data and all the token balances.
Account can be closed to wipe account data and token balances and release the reserved token.
System account ref counting can be used to prevent an account to be closed, so pallets can know it only need to dealing with opened accounts.
Workflow
dest: Option<AccountId>
Spec
system::Module::allow_death
to
KillAccount
NewAccountDeposit
OnCreatedAccount
open_account
system::Account
as storageopen_account
The text was updated successfully, but these errors were encountered: