-
Notifications
You must be signed in to change notification settings - Fork 732
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
Fix: dust unbonded for zero existential deposit #4364
Conversation
The stashing account reaping conditions have been updated to include cases where the total balance or the ledger total is zero. Previously, checks were only performed for totals falling under the existential deposit. This expanded reaping condition allows accounts with zero balances to be handled more efficiently.
…enario This commit adds two tests - `reap_stash_works_with_existential_deposit_zero` and `do_withdraw_unbonded_can_kill_stash_with_existential_deposit_zero` - to check staking functionality when existential deposit is set to zero. Also, updated the code to use `is_zero` method for zero balance check, making it more semantically clear and aligning it with other parts of the codebase. This should make the staking module more robust and easier to understand.
bot fmt |
@bkchr https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6121902 was started for your command Comment |
@bkchr Command |
5198623
* 'master' of https://github.com/metaspan/polkadot-sdk: (65 commits) Introduces `TypeWithDefault<T, D: Get<T>>` (paritytech#4034) Publish `polkadot-sdk-frame` crate (paritytech#4370) Add validate field to prdoc (paritytech#4368) State trie migration on asset-hub westend and collectives westend (paritytech#4185) Fix: dust unbonded for zero existential deposit (paritytech#4364) Bridge: added subcommand to relay single parachain header (paritytech#4365) Bridge: fix zombienet tests (paritytech#4367) [WIP][CI] Add more GHA jobs (paritytech#4270) Allow for 0 existential deposit in benchmarks for `pallet_staking`, `pallet_session`, and `pallet_balances` (paritytech#4346) Deprecate `NativeElseWasmExecutor` (paritytech#4329) More `xcm::v4` cleanup and `xcm_fee_payment_runtime_api::XcmPaymentApi` nits (paritytech#4355) sc-tracing: enable env-filter feature (paritytech#4357) deps: update jsonrpsee to v0.22.5 (paritytech#4330) Add PoV-reclaim enablement guide to polkadot-sdk-docs (paritytech#4244) cargo: Update experimental litep2p to latest version (paritytech#4344) Bridge: ignore client errors when calling recently added `*_free_headers_interval` methods (paritytech#4350) Make parachain template great again (and async backing ready) (paritytech#4295) [Backport] Version bumps and reorg prdocs from 1.11.0 (paritytech#4336) HRMP - set `DefaultChannelSizeAndCapacityWithSystem` with dynamic values according to the `ActiveConfig` (paritytech#4332) Statement Distribution Per Peer Rate Limit (paritytech#3444) ...
When a staker unbonds and withdraws, it is possible that their stash will contain less currency than the existential deposit. If that happens, their stash is reaped. But if the existential deposit is zero, the reap is not triggered. This PR adjusts `pallet_staking` to reap a stash in the special case that the stash value is zero and the existential deposit is zero. This change is important for blockchains built on substrate that require an existential deposit of zero, becuase it conserves valued storage space. There are two places in which ledgers are checked to determine if their value is less than the existential deposit and they should be reaped: in the methods `do_withdraw_unbonded` and `reap_stash`. When the check is made, the condition `ledger_total == 0` is also checked. If `ledger_total` is zero, then it must be below any existential deposit greater than zero and equal to an existential deposit of 0. I added a new test for each method to confirm the change behaves as expected. Closes paritytech#4340 --------- Co-authored-by: command-bot <>
When a staker unbonds and withdraws, it is possible that their stash will contain less currency than the existential deposit. If that happens, their stash is reaped. But if the existential deposit is zero, the reap is not triggered. This PR adjusts
pallet_staking
to reap a stash in the special case that the stash value is zero and the existential deposit is zero.This change is important for blockchains built on substrate that require an existential deposit of zero, becuase it conserves valued storage space.
There are two places in which ledgers are checked to determine if their value is less than the existential deposit and they should be reaped: in the methods
do_withdraw_unbonded
andreap_stash
. When the check is made, the conditionledger_total == 0
is also checked. Ifledger_total
is zero, then it must be below any existential deposit greater than zero and equal to an existential deposit of 0.I added a new test for each method to confirm the change behaves as expected.
Closes #4340