Skip to content

Commit

Permalink
[Application] Implement unbonding period (#735)
Browse files Browse the repository at this point in the history
## 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 -->
  • Loading branch information
red-0ne authored Aug 26, 2024
1 parent ebf7123 commit de840e8
Show file tree
Hide file tree
Showing 29 changed files with 954 additions and 236 deletions.
118 changes: 90 additions & 28 deletions api/poktroll/application/types.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit de840e8

Please sign in to comment.