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: change compute_unbonding_height api #4041

Merged
merged 3 commits into from
Mar 18, 2024
Merged

Conversation

erwanor
Copy link
Member

@erwanor erwanor commented Mar 18, 2024

This PR modifies the staking module logic responsible for determining the unbonding schedule, in particular it:

  • returns the current height if a pool is unbonded
  • change the compute_unbonding_height API to return an Option<u64> to allow callers to detect an unbonded pool

One tricky aspect of our unbonding mechanism is that we want to:

  1. Bind unbonding notes to the economic effect of validator misbehavior for some window of blocks
  2. Leave it to the application to decide when a note is allowed to be claimed

One thing to note is that this mechanism works relative to the current bonding state of the pool. This is generally fine for the protocol security because this leads the application to "overshoot" the penalty window range since it cannot know the exact moment a note was allowed to unbond (since bonding the state could have changed). This means that when processing a claim, we detect if the pool is unbonded, and if so, we set the "allowed unbonding height" to the current height.

@erwanor erwanor added A-staking Area: Design and implementation of staking and delegation consensus-breaking breaking change to execution of on-chain data labels Mar 18, 2024
@erwanor erwanor added this to the Sprint 3 milestone Mar 18, 2024
@erwanor erwanor merged commit 3011b17 into main Mar 18, 2024
6 checks passed
@erwanor erwanor deleted the erwan/unbonding_api branch March 18, 2024 17:44
@cratelyn cratelyn modified the milestones: Sprint 3, Sprint 2 Mar 18, 2024
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
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants