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

[Application] Application Unbonding Periods #696

Closed
6 tasks
red-0ne opened this issue Jul 16, 2024 · 4 comments
Closed
6 tasks

[Application] Application Unbonding Periods #696

red-0ne opened this issue Jul 16, 2024 · 4 comments
Assignees
Labels
application Changes related to the Application actor on-chain On-chain business logic

Comments

@red-0ne
Copy link
Contributor

red-0ne commented Jul 16, 2024

Objective

Prevent Applications from immediately unbonding when the MsgUnstake message is submitted.

Origin Document

Deliverables

General deliverables

  • Comments: Add/update TODOs and comments alongside the source code so it is easier to follow.
  • Testing: Add new tests (unit and/or E2E) to the test suite.
  • Makefile: Add new targets to the Makefile to make the new functionality easier to use.
  • Documentation: Update architectural or development READMEs; use mermaid diagrams where appropriate.

Creator: @red-0ne
Co-owner: @Olshansk

@red-0ne red-0ne added supplier Changes related to the Supplier actor on-chain On-chain business logic labels Jul 16, 2024
@red-0ne red-0ne self-assigned this Jul 16, 2024
@red-0ne red-0ne added application Changes related to the Application actor and removed supplier Changes related to the Supplier actor labels Jul 16, 2024
@Olshansk
Copy link
Member

Olshansk commented Aug 5, 2024

@red-0ne Could this just be a copy-paste of supplier unbonding?

@red-0ne
Copy link
Contributor Author

red-0ne commented Aug 6, 2024

@red-0ne Could this just be a copy-paste of supplier unbonding?

Yes, it's basically the same logic as supplier unbonding.

@Olshansk
Copy link
Member

Olshansk commented Aug 7, 2024

@red-0ne DO you mind updating the ticket title + description to call out "unbonding" and reference the PR that will mimick the behaviour?

@Olshansk Olshansk changed the title [Application] Prevent Applications from instant unstaking [Application] Application Unbonding Periods Aug 9, 2024
red-0ne added a commit that referenced this issue Aug 26, 2024
## Summary

This PR adds an unbonding period when an `Application` submits an
unstaking transaction.

* Adds an unbondingHeight to the `Application` proto.
* Resets the unbondingHeight when an `Application` re-stakes during that
period.
* Prevents unstaking when an `Application` is already in an unbonding
period.
* Adds an EndBlocker routine to unbond `Application`s that reached their
unbonding height.
* Deactivate the `Application`, denying it to get/construct `Session`s
after the session corresponding to the unstake message ends.

## Issue

`Application`s unstaking needs to be delayed at least until the
accounting for the last `Session` is settled.

This is to avoid `Application`s from prematurely unstaking and getting
their funds back, before their stake is burned for the work requested.

- #696 

## Type of change

Select one or more:

- [x] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Documentation
- [ ] Other (specify)

## Testing

**Documentation changes** (only if making doc changes)
- [ ] `make docusaurus_start`; only needed if you make doc changes

**Local Testing** (only if making code changes)
- [x] **Unit Tests**: `make go_develop_and_test`
- [x] **LocalNet E2E Tests**: `make test_e2e`
- See [quickstart
guide](https://dev.poktroll.com/developer_guide/quickstart) for
instructions

**PR Testing** (only if making code changes)
- [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR.
- **THIS IS VERY EXPENSIVE**, so only do it after all the reviews are
complete.
- Optionally run `make trigger_ci` if you want to re-trigger tests
without any code changes
- If tests fail, try re-running failed tests only using the GitHub UI as
shown
[here](https://github.com/pokt-network/poktroll/assets/1892194/607984e9-0615-4569-9452-4c730190c1d2)


## Sanity Checklist

- [x] I have tested my changes using the available tooling
- [x] I have commented my code
- [x] I have performed a self-review of my own code; both comments &
source code
- [ ] I create and reference any new tickets, if applicable
- [ ] I have left TODOs throughout the codebase, if applicable


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added the ability to track the end height of unstaking sessions for
applications.
- Introduced a new parameter to configure the number of unbonding
sessions applications must wait after unstaking.
  
- **Bug Fixes**
- Enhanced operational checks in the unstaking process to improve
reliability.
  
- **Documentation**
- Updated test scenarios for clarity regarding application unbonding and
staking processes.

- **Tests**
- Expanded the test suite to cover new unbonding functionality and
parameter updates.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@red-0ne
Copy link
Contributor Author

red-0ne commented Aug 26, 2024

Done as per #735

@red-0ne red-0ne closed this as completed Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application Changes related to the Application actor on-chain On-chain business logic
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants