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

staking: use block height to enforce unbonding delay #3923

Merged
merged 34 commits into from
Mar 12, 2024

Conversation

erwanor
Copy link
Member

@erwanor erwanor commented Mar 1, 2024

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:

  • defines StakeParamater::unbonding_delay measured in blocks
  • parameterize unbonding tokens based on a start_height
  • deprecate start_epoch_index fields in delegate/claim actions
  • strip epoch_index from validator RateDatas
  • generalize the unbonding token denom format:
    2.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.

@cratelyn cratelyn added the A-staking Area: Design and implementation of staking and delegation label Mar 5, 2024
@erwanor erwanor added consensus-breaking breaking change to execution of on-chain data protobuf-changes Makes changes to the protobuf definitions. state-breaking breaking change to on-chain data labels Mar 11, 2024
@erwanor erwanor force-pushed the erwan/3738_unbonding_work_better branch from d16af48 to ec85a43 Compare March 11, 2024 10:02
@erwanor erwanor marked this pull request as ready for review March 11, 2024 20:10
@erwanor erwanor requested a review from hdevalence March 11, 2024 20:10
Copy link
Contributor

@cratelyn cratelyn left a 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. ⭐

@erwanor erwanor force-pushed the erwan/3738_unbonding_work_better branch from cf7be8c to bed50ce Compare March 12, 2024 21:23
@erwanor
Copy link
Member Author

erwanor commented Mar 12, 2024

Thanks for the review @cratelyn, rebased conflicts, then merging this so we can start work on integration.

@cratelyn
Copy link
Contributor

Thanks for the review @cratelyn, rebased conflicts, then merging this so we can start work on integration.

perfect timing, i was about to ask when this might land. i'm in the neighborhood via #4001. 🙂

@cratelyn cratelyn merged commit b429bc7 into main Mar 12, 2024
6 checks passed
@cratelyn cratelyn deleted the erwan/3738_unbonding_work_better branch March 12, 2024 21:51
@cratelyn
Copy link
Contributor

merged on your behalf ⭐

conorsch added a commit that referenced this pull request Mar 15, 2024
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
conorsch added a commit that referenced this pull request Mar 15, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-staking Area: Design and implementation of staking and delegation consensus-breaking breaking change to execution of on-chain data protobuf-changes Makes changes to the protobuf definitions. state-breaking breaking change to on-chain data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

staking: rework the unbonding delay mechanism
2 participants