This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
[Staking] Active ledger balance may fall below ED if account chills before unbounding #14246
Labels
A0-please_review
Pull request needs code review.
C1-low
PR touches the given topic and has a low impact on builders.
Currently, there are some stashes in Polkadot (11) with
ledger.active
balance below the existential deposit. The call path for that to happen is to chill the stash before unbonding and not callwithdraw_unbonded
after the bonding period.However, if the stash tries to call
unbond
with the fullledger.active
balance, it will fail due to the checks enforcing that the active balance should beMinNominatorBond
orMinValidatorBond
at the end of the unbonding. In this case, the stash needs to callchill
first to be able to unbond all the active balance (as described above).Given that reap stash can be called only against stashes that have
ledger.total
balance below ED, the stashes that were chilled and do not callwithdraw_unbonded
after the unbonding period will have remain in the ledger with active balance = 0 without any mechanism to "clean" the ledger besides the stash callingwithdraw_unbonded
.Another path for the
ledger.active
balance to be belowMinBond
is through slashing. However, in that case it is possible to callreap
against the stash if the total (and thus active) balance is below ED.Side effects
Currently, the staking try-state checks that inspect the ledger state consistency are triggering if there are
ledger.active
balances below the ED which, as laid out above, can happen (related to #14186).Allow
withdraw_unbonded
to be called permissionlesslyFrom the reasoning above, it follows that some ledger entries may linger in the ledger indefinitely if the stash/controller does not call
withdraw_unbonded
after chilling and the unbonding period has passed. Currently, there is no way to enforce the withdrawal in those situations.Perhaps we should consider allowing anyone to call
withdraw_unbonded
for a third-party stash which has unbonded chunks for longer than N eras and active balance below ED, e.g.:Or even better, we could just allow anyone to call
withdraw_unbounded_other
on any stash, without any extra check as in the code above.After
withdraw_unbonded_other
, the ledger can may be killed if the balance goes to 0.PR with E2E test reproducing the behaviour described above #14247
The text was updated successfully, but these errors were encountered: