[WIP] RFC-0097 Implementation to Decrease Unbonding Time
This PR aims to implement RFC-0097, that introduces a flexible unbonding mechanism to decrease the time stakers have to wait to unbond by as much as 26 eras, resulting in 2 eras / 2 days on Polkadot in the best case scenario.
Commit Log
- [x] Introduce
MinSlashableShare,UnbondPeriodUpperBoundandUnbondPeriodLowerBoundparameters as genesis storage items. - [x] Define new migration to set initial parameter values in storage.
- [x] Record how much stake was used to back the lowest-backed 1/3 of validators, for the last
UnbondingPeriodUpperBounderas. ThisLowestThirdTotalStakestorage record can be updated when a new planned era is triggered, more specifically in thestore_stakers_infofunction. - [x] Implement a
get_min_lowest_third_stakefunction that gets the lowest third stake entry overUnbondPeriodUpperBounderas. - [x] Create pallet function
get_quick_unbond_max_unstake(), that will essentially returnMinSlashableShare * min_lowest_third_stake, wheremin_lowest_third_stakeis determined by the above storage addition. Utilising this new storage item is of course less weight heavy than iterating throughErasStakersPaged. - [x] Calculate
unbonding_time_delta- this can use the following formula to determine a concrete unbond block number. - [x] Combine new storage items into a struct.
- [x] Calculate
back_of_unbonding_queue_block_number. - [x] Calculate
unbonding_block_numberand reflect in unlock chunks. - [x] Use correct
back_of_unbonding_queue_block_numbercalculation. - [x] Calculate unbond era and refactor to use eras instead of block numbers.
- [ ] Add unit tests ensuring new functions returning expected results.
- [ ] Add Integration tests for unbonding scenarios (lowest, beyond max stake, etc).
- [ ] Ensure existing tests impacted by unbonding queue are amended.
More to come...
Post Implementation Checklist
- [ ] Add migration to runtimes.
The CI pipeline was cancelled due to failure one of the required jobs. Job name: test-linux-stable 2/3 Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7347472
Wen are we having this released?
How can one apply to work on this?
came across this on X
@runcomet so you could start forking this pr and implementing the missing things.
@runcomet do you have element?
@bkchr @runcomet:matrix.org
searched for the fellowship channel, don't think it's public.
@bkchr Better to commit to this branch or open a new PR?
@bkchr Better to commit to this branch or open a new PR?
I'd recommend forking this branch & then merging updates into it, to keep one source of truth for the implementation.
set aside in favor of @runcomet