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][Morse Parity] Introduce non-custodial Staking #493

Closed
8 tasks
Olshansk opened this issue Apr 25, 2024 · 0 comments
Closed
8 tasks

[Utility][Morse Parity] Introduce non-custodial Staking #493

Olshansk opened this issue Apr 25, 2024 · 0 comments
Assignees
Labels
protocol General core protocol related changes utility

Comments

@Olshansk
Copy link
Member

Olshansk commented Apr 25, 2024

Objective

Feature parity with non-custodial staking from Morse.

Origin Document

Goals

  • Achieve non-custodial & custodial staking feature parity w/ Morse
  • Use mainline Cosmos SDK best practices to implement non-custodial staking
  • Create a better user-interface (that's easy for anyone to use) for non-custodial staking
  • Prepare for reward sharing in [Utility][Morse Parity] Built In Revenue Share #496
  • Create a better user interface than how non-custodial staking works (see below) by allowing to set the complex configurations via a yaml file (like we do elsewhere)

Deliverables

  • Research Morse: Study & understand how non-custodial staking works in Morse
  • Research Cosmos: Study & understand what (if any) parts of the Cosmos SDK we should use for non-custodial staking
  • Implement: Implement non-custodial staking in Shannon
  • CLI: Update the poktrolld to support non-custodial staking
  • Test: Add unit, integration and E2E tests
  • Tooling: Add Makefile targets to easily trigger (on LocalNet) and test (e2e) non-custodial staking
  • Document: Add a new page to dev.poktroll.com explaining how non-custodial staking works and how to use it
  • Comments: Add/update TODOs and comments alongside the source code so it is easier to follow.

Non-goals / Non-deliverables

  • Expanding beyond what Morse has for non-custodial staking for Suppliers
  • Adding delegation or non-custodial taking for any other actors

Estimated Days of Work

3 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 25, 2024
@Olshansk Olshansk added this to the Shannon MainNet milestone Apr 25, 2024
@Olshansk Olshansk added this to Shannon Apr 25, 2024
@Olshansk Olshansk moved this to 🔖 Ready in Shannon Jul 3, 2024
@Olshansk Olshansk removed the community A ticket intended to potentially be picked up by a community member label Jul 4, 2024
@Olshansk Olshansk changed the title [Utility] Introduce non-custodial Staking [Utility][Morse Parity] Introduce non-custodial Staking Jul 4, 2024
@Olshansk Olshansk assigned red-0ne and unassigned bryanchriswhite Jul 25, 2024
@red-0ne red-0ne moved this from 🔖 Ready to 🏗 In progress in Shannon Jul 29, 2024
@red-0ne red-0ne moved this from 🏗 In progress to 👀 In review in Shannon Aug 12, 2024
red-0ne added a commit that referenced this issue Aug 13, 2024
## Summary

This PR implements non-custodial staking by
* Adding a `Supplier.OwnerAddress` that represents the `Supplier` owner
* Modifying `stake` and `unstake` CLI
* Ensure that only the owner is able to `stake`, `unstake`, `change
owner`, `change operator`
* Update supplier staking config parser
* Have the owner receive the rewards.

*NOTE: ~950LOC is proto auto-generated code*

The PR will be ready after:
- [ ] Validating non-custodial logic added in this PR
- [ ] Merging #718 into this one
- [ ] Merging #720 into this one
- [ ] Merging #722 into this one

## Issue

- #493
-
https://www.notion.so/buildwithgrove/Non-custodial-staking-92a136174dac41279717e8b963672e38

## 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)
- [ ] **Unit Tests**: `make go_develop_and_test`
- [ ] **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

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] 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**
- Introduced a new field `OwnerAddress` in the `Supplier` struct for
improved ownership management.
- Enhanced supplier configuration structures with `OwnerAddress` and
`OperatorAddress` fields for better role management.
- Added new validation methods to ensure correct ownership and operator
address integrity.

- **Bug Fixes**
- Improved validation logic to ensure only authorized users can modify
supplier details.

- **Documentation**
- Clarified comments in code to improve understanding of address
management and supplier roles.

- **Chores**
- Added new error constants to enhance error handling and user feedback
for supplier-related operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
red-0ne added a commit that referenced this issue Aug 13, 2024
## Summary

This PR is a follow-up to #716.
* It refactors the existing unit/integration tests to add
`Supplier.OwnerAddress`
* Adapts the `Supplier` (un)staking and tests (staking config,
(un)staking CLI and keeper methods) to comply with the `Supplier`
non-custodial staking.

## Issue

- #493 

## Type of change

Select one or more:

- [ ] New feature, functionality or library
- [ ] Bug fix
- [x] 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`
- [ ] **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

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] 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**
	- Enhanced readability of output messages in the Makefile.
- Added `OwnerAddress` to the `Supplier` data model for better ownership
tracking.
- Introduced support for both owner and operator addresses in various
staking and unstaking processes.

- **Bug Fixes**
- Updated tests for `MsgUnstakeSupplier` to correctly validate signer
addresses and enhance robustness.

- **Documentation**
- Improved test coverage and clarity for supplier-related functionality,
reflecting the new data model changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
red-0ne added a commit that referenced this issue Aug 13, 2024
## Summary

This PR renames all the `Supplier.Address` references to
`Supplier.OperatorAddress`.

It also include renaming `supplierAddress` to `supplierOperatorAddress`
variables, methods in `Claim` and `Proof`, comments and error messages.

This PR has a lot of changes but does not introduce any addition logic
to the code base.

## Issue

- #493 

## Type of change

Select one or more:

- [ ] New feature, functionality or library
- [ ] Bug fix
- [x] 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`
- [ ] **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
- [ ] I have commented my code
- [ ] 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
@red-0ne red-0ne closed this as completed Aug 13, 2024
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Shannon Aug 13, 2024
red-0ne added a commit that referenced this issue Aug 14, 2024
## Summary

*This PR is duplicate of #722 which got mistakingly merged into
`refactor/non-custodial-staking-tests`*

This PR renames all the Supplier.Address references to
Supplier.OperatorAddress.

It also include renaming supplierAddress to supplierOperatorAddress
variables, methods in Claim and Proof, comments and error messages.

This PR has a lot of changes but does not introduce any addition logic
to the code base.

## Issue

- #493 

## Type of change

Select one or more:

- [ ] New feature, functionality or library
- [ ] Bug fix
- [x] 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
- [ ] 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
red-0ne added a commit that referenced this issue Aug 27, 2024
## Summary

Follow-up to #716 to document custodial and non-custodial staking
configuration.

## Issue


![image](https://github.com/user-attachments/assets/671278e9-911f-43d9-b7eb-e7994b959b72)

- #493

## Type of change

Select one or more:

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

## Testing

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

**Local Testing** (only if making code changes)
- [ ] **Unit Tests**: `make go_develop_and_test`
- [ ] **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

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] 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**
- Enhanced command for supplier unstake, improving usability and
flexibility.
- Introduced new sections in documentation for "Staking types,"
detailing Custodial and Non-Custodial Staking.

- **Documentation**
- Expanded configuration documentation with detailed explanations of
`owner_address` and `operator_address`.

- **Config Updates**
- Added `owner_address` and `operator_address` parameters to multiple
staking configuration files for improved clarity.

- **Improvements**
- Streamlined configuration files by removing comments, enhancing
clarity on staking roles.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
okdas pushed a commit that referenced this issue Nov 14, 2024
## Summary

This PR implements non-custodial staking by
* Adding a `Supplier.OwnerAddress` that represents the `Supplier` owner
* Modifying `stake` and `unstake` CLI
* Ensure that only the owner is able to `stake`, `unstake`, `change
owner`, `change operator`
* Update supplier staking config parser
* Have the owner receive the rewards.

*NOTE: ~950LOC is proto auto-generated code*

The PR will be ready after:
- [ ] Validating non-custodial logic added in this PR
- [ ] Merging #718 into this one
- [ ] Merging #720 into this one
- [ ] Merging #722 into this one

## Issue

- #493
-
https://www.notion.so/buildwithgrove/Non-custodial-staking-92a136174dac41279717e8b963672e38

## 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)
- [ ] **Unit Tests**: `make go_develop_and_test`
- [ ] **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

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] 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**
- Introduced a new field `OwnerAddress` in the `Supplier` struct for
improved ownership management.
- Enhanced supplier configuration structures with `OwnerAddress` and
`OperatorAddress` fields for better role management.
- Added new validation methods to ensure correct ownership and operator
address integrity.

- **Bug Fixes**
- Improved validation logic to ensure only authorized users can modify
supplier details.

- **Documentation**
- Clarified comments in code to improve understanding of address
management and supplier roles.

- **Chores**
- Added new error constants to enhance error handling and user feedback
for supplier-related operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
okdas pushed a commit that referenced this issue Nov 14, 2024
## Summary

This PR is a follow-up to #716.
* It refactors the existing unit/integration tests to add
`Supplier.OwnerAddress`
* Adapts the `Supplier` (un)staking and tests (staking config,
(un)staking CLI and keeper methods) to comply with the `Supplier`
non-custodial staking.

## Issue

- #493 

## Type of change

Select one or more:

- [ ] New feature, functionality or library
- [ ] Bug fix
- [x] 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`
- [ ] **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

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] 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**
	- Enhanced readability of output messages in the Makefile.
- Added `OwnerAddress` to the `Supplier` data model for better ownership
tracking.
- Introduced support for both owner and operator addresses in various
staking and unstaking processes.

- **Bug Fixes**
- Updated tests for `MsgUnstakeSupplier` to correctly validate signer
addresses and enhance robustness.

- **Documentation**
- Improved test coverage and clarity for supplier-related functionality,
reflecting the new data model changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
okdas pushed a commit that referenced this issue Nov 14, 2024
## Summary

*This PR is duplicate of #722 which got mistakingly merged into
`refactor/non-custodial-staking-tests`*

This PR renames all the Supplier.Address references to
Supplier.OperatorAddress.

It also include renaming supplierAddress to supplierOperatorAddress
variables, methods in Claim and Proof, comments and error messages.

This PR has a lot of changes but does not introduce any addition logic
to the code base.

## Issue

- #493 

## Type of change

Select one or more:

- [ ] New feature, functionality or library
- [ ] Bug fix
- [x] 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
- [ ] 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
okdas pushed a commit that referenced this issue Nov 14, 2024
## Summary

Follow-up to #716 to document custodial and non-custodial staking
configuration.

## Issue


![image](https://github.com/user-attachments/assets/671278e9-911f-43d9-b7eb-e7994b959b72)

- #493

## Type of change

Select one or more:

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

## Testing

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

**Local Testing** (only if making code changes)
- [ ] **Unit Tests**: `make go_develop_and_test`
- [ ] **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

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] 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**
- Enhanced command for supplier unstake, improving usability and
flexibility.
- Introduced new sections in documentation for "Staking types,"
detailing Custodial and Non-Custodial Staking.

- **Documentation**
- Expanded configuration documentation with detailed explanations of
`owner_address` and `operator_address`.

- **Config Updates**
- Added `owner_address` and `operator_address` parameters to multiple
staking configuration files for improved clarity.

- **Improvements**
- Streamlined configuration files by removing comments, enhancing
clarity on staking roles.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol General core protocol related changes utility
Projects
Status: ✅ Done
Development

No branches or pull requests

3 participants