-
Notifications
You must be signed in to change notification settings - Fork 321
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
staking: use block height to enforce unbonding delay #3923
Conversation
d16af48
to
ec85a43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i should not be a definitive approval, but i have read through this and believe that the changes are sound. i really appreciate how you have divided the changes here into distinct commits, it made reviewing this much easier. ⭐
This will let us provide useful error messages in case there is a rate data mismatch when we execute the delegate action.
This commit implements `compute_unbonding_height` which returns the allowed unbonding height for an undelegation that has started at some previous arbitrary time. It consults the validator pool's unbonding state short-circuiting the unbonding delay if the pool is already unbonded.
This will allow us to _not_ have to maintain a reverse (epoch index -> epoch) index.
cf7be8c
to
bed50ce
Compare
Thanks for the review @cratelyn, rebased conflicts, then merging this so we can start work on integration. |
merged on your behalf ⭐ |
Follow-up to changes made in [0], where we settled on "unbonded delay" rather than "unbonding epochs" to describe how many blocks must elapse until undelegated stake becomes claimable. The `pd` CLI options are only used by developers, so I'm not worried about breaking operator scripts in the wild. [0] #3923
Follow-up to changes made in [0], where we settled on "unbonded delay" rather than "unbonding epochs" to describe how many blocks must elapse until undelegated stake becomes claimable. The `pd` CLI options are only used by developers, so I'm not worried about breaking operator scripts in the wild. [0] #3923
Close #3738, this PR makes the unbonding mechanism based on block delay rather than epochs. In practice, this means that a user will wait X blocks for a validator pool to unbond (rather than Y epochs).
To achieve this, this PR:
StakeParamater::unbonding_delay
measured in blocksstart_height
start_epoch_index
fields in delegate/claim actionsepoch_index
from validatorRateData
s2.013718unbonding_start_at_1540_penumbravalid1
(vs._epoch_XXX
)Important point about the mechanism: we bind tokens to the starting height of the epoch that they belong to. This let us avoid binding transactions to specific block heights.