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

[Utility] Introduce an unbonding period after an actor unstakes #489

Closed
13 tasks
Olshansk opened this issue Apr 24, 2024 · 6 comments
Closed
13 tasks

[Utility] Introduce an unbonding period after an actor unstakes #489

Olshansk opened this issue Apr 24, 2024 · 6 comments
Assignees
Labels
community A ticket intended to potentially be picked up by a community member p0 Top priority protocol General core protocol related changes utility

Comments

@Olshansk
Copy link
Member

Olshansk commented Apr 24, 2024

Objective

Design & implement a framework of how to handle on-chain Unbonding after an actor submits a valid Unstake transaction.

Origin Documents

Goals

  • Unbonding definition: a state during which an actor operates normally, after unstaking, before their escrowed stake is returned and they are removed as active actors
  • At a minimum, have parity with unbonding periods from Morse
  • Evaluate options for how on-chain actor unbonding could be implemented
  • Design, document and implement unbonding of Applications, Suppliers & Gateways
  • Create a pattern reusable for all actors

Deliverables

IMPORTANT NOTE TO THE OWNER: The deliverables below are not a complete list of everything that needs to be done, but rather a starting point to help. The research, which is part of the deliverables, should drive most of the design decisions.

  1. Research
    • Put together a reference doc with bullet points, links, highlights, learnings capturing the research below(< 1 page total
    • Other Projects
      • Investigate how actor (e.g. validator) unbonding is designed and implemented in the Cosmos SDK
      • Investigate how at least one other project does (non-validator) actor unbonding in the Cosmos ecosystem
    • Morse
      • Investigate how actor unbonding currently works in Morse
  2. Before implementation
    • Prepare a 1-pager “mini spec” notion / docs / markdown and get feedback & review before kicking off the implementation
  3. Implementation requirements
    • Unbonding should finish automatically N blocks from the moment the actor submits the unstaking transaction
    • N should have a unique governance parameter for every actor: Application, Supplier, Gateway
    • Escrowed funds are returned to the actor only AFTER the unbonding process is complete
  4. During implementation
    • Separate PRs per actor after the foundation is in place
    • Add unit / integration tests
    • Add at least 1 E2E test (per actor)
    • Make target to trigger the E2E test
  5. After implementation
    • Add a new page in docusaurus that explains how the implemented mechanism works

Estimated Days of Work

5 days

Disclaimer: This is the total projected number of estimated hours to completion & merge. The owner of this tickets is expected to use this GitHub issue to communicate with the core protocol team along the way, with update & feedback for each deliverable throughout the duration of this work._


Creator: @Olshansk
Co-Owners: @moatus

@Olshansk Olshansk added protocol General core protocol related changes community A ticket intended to potentially be picked up by a community member utility labels Apr 24, 2024
@Olshansk Olshansk added this to the Shannon MainNet milestone Apr 24, 2024
@Olshansk Olshansk added this to Shannon Apr 24, 2024
@Olshansk Olshansk moved this to 📋 Backlog in Shannon Apr 24, 2024
@Olshansk
Copy link
Member Author

@moatus Could you review the requirements for unstaking here. I'm thinking of mounting out the engineering work for it.

@Olshansk Olshansk self-assigned this May 13, 2024
@Olshansk Olshansk moved this from 📋 Backlog to 🔖 Ready in Shannon May 14, 2024
@Olshansk Olshansk removed the community A ticket intended to potentially be picked up by a community member label May 14, 2024
@Olshansk Olshansk removed their assignment May 15, 2024
@Olshansk Olshansk added the community A ticket intended to potentially be picked up by a community member label May 15, 2024
@Olshansk
Copy link
Member Author

Olshansk commented May 30, 2024

With some guidance from @facundomedica, here is the way to go

In that case I don't think we have a solution that would work "out of the box". You could achieve something like that with endblock or x/epochs, both solutions being pretty similar, main difference being that with x/epochs you can "schedule" the process to happen every certain amount of time.
Most likely you'll have an unbonding queue so on endblock/epochEnd you iterate through them and release any that its unbonding time has expired. You might also want to add some limits to this kind of processing, so you process up to X unbonds per epoch/endblock. Otherwise you might get timeouts.

After looking through [1], this is EXACTLY what we should be using for this.

[1] https://github.com/cosmos/cosmos-sdk/tree/main/x/epochs

@Olshansk Olshansk added the p0 Top priority label Jun 4, 2024
@Olshansk
Copy link
Member Author

Please note that the documentation is outdated on their website right now: cosmos/cosmos-sdk#20651

@Olshansk
Copy link
Member Author

@red-0ne Please make sure to take a look at the notes & comments. We should tackle this in the next iteration.

@Olshansk
Copy link
Member Author

Olshansk commented Jun 19, 2024

Cross-referencing this comment for the most up to date documentation [2]

[1] cosmos/cosmos-sdk#20651 (comment)
[2] https://docs.cosmos.network/main/build/modules/epochs

@red-0ne red-0ne moved this from 🔖 Ready to 🏗 In progress in Shannon Jul 8, 2024
@red-0ne red-0ne moved this from 🏗 In progress to 👀 In review in Shannon Jul 15, 2024
@red-0ne
Copy link
Contributor

red-0ne commented Aug 2, 2024

Implemented in #666 and #704.

@red-0ne red-0ne closed this as completed Aug 2, 2024
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Shannon Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community A ticket intended to potentially be picked up by a community member p0 Top priority protocol General core protocol related changes utility
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants