2

As we know from this doc, account get reaped when it's consumers/providers/sufficients (all of them) reference count decreased to 0. These counters described as:

  /// The number of other modules that currently depend on this account's existence. The account
  /// cannot be reaped until this is zero.
  pub consumers: RefCount,
  /// The number of other modules that allow this account to exist. The account may not be reaped
  /// until this and `sufficients` are both zero.
  pub providers: RefCount,
  /// The number of modules that allow this account to exist for their own purposes only. The
  /// account may not be reaped until this and `providers` are both zero.
  pub sufficients: RefCount,

Suppose that we have a pallet that has storage map AccountId -> SomeData. And in this pallet we could increment some of the references counts mentioned above to keep account alive until we descrease this. Let's consider a case when we don't do this. The questions are the following:

  1. Are there any differences between account that was reaped and then endowed again and account that was not reaped because we added a reference?

  2. When we really should modify these counters in our pallets?

1 Answer 1

1

1- No, unless you scan the blockchain to see all the events related to that account you won't know if has been reaped before.

Having an account go below the existential deposit causes that account to be reaped. The account will be wiped from the blockchain's state to conserve space, along with any funds in that address. You do not lose access to the reaped address - as long as you have your private key or recovery phrase, you can still use the address - but it needs a top-up of another existential deposit to be able to interact with the chain.

This is how the clean up of the account works under the hood: How does Substrate clean up accounts whose balance is below the existential deposit?

2- If your pallet depend on an account (consumers) or may need the existence of this account for the pallet own purposes (sufficients).

See this previous StackExchange answers for more detailed explanations:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.