[WIP] Ensure ED is respected over total balance when depositing new funds to an account. #6256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change
When new funds are minted into an account (e.g., for staking rewards), check the account’s total balance rather than just the free balance to ensure it never falls between 0 and the Existential Deposit (ED).
Context
Currently, users can stake with all their funds on staking (including ED).
pallet-staking
uses locks (similar to freezes) and locked balance are part of free balance so this is not an issue as any staked balance is still part of the free balance.Staking should though switch to use
fungible::hold
(See #226 and #5501), and held balance is taken away from free balance.The accounts that are staking all their funds, once we migrate them to hold, will have no free balance. Any staking rewards that are paid out to them, if less than the minimum balance, won't be able to be minted as free balance without this change.
Alternative solution