Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Ensure ED is respected over total balance when depositing new funds to an account. #6256

Closed
wants to merge 1 commit into from

Conversation

Ank4n
Copy link
Contributor

@Ank4n Ank4n commented Oct 28, 2024

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

  • Ensure all stakers maintain at least ED in their stash accounts.
  • At migration, stakers who do not have enough free balance left after hold, will be force withdrawn upto ED to maintain this free balance. This would imply the total stake of the system would reduce by 23k DOT in the worst case where all stakers are fully staked.
  • Pools would need to maintain ED in their pool accounts as well. Since there are only around 250 pools, treasury could probably fund this, but in future, should come from pool operator and refunded to them when pool is destroyed.

@Ank4n Ank4n closed this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant