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

[Docs] Document (non-)custodial staking #720

Merged
merged 58 commits into from
Aug 27, 2024
Merged

Conversation

red-0ne
Copy link
Contributor

@red-0ne red-0ne commented Aug 5, 2024

Summary

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

Issue

image

Type of change

Select one or more:

  • 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 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

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

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.

red-0ne added 24 commits July 30, 2024 18:33
@red-0ne red-0ne added documentation Improvements or additions to documentation supplier Changes related to the Supplier actor on-chain On-chain business logic labels Aug 5, 2024
@red-0ne red-0ne self-assigned this Aug 5, 2024
@red-0ne red-0ne changed the base branch from feat/non-custodial-staking to refactor/non-custodial-staking-tests August 9, 2024 08:00
red-0ne added a commit that referenced this pull request 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 red-0ne changed the base branch from refactor/non-custodial-staking-tests to main August 14, 2024 12:36
Copy link

coderabbitai bot commented Aug 14, 2024

Walkthrough

This update improves the documentation and configuration for staking parameters related to Suppliers in the Pocket Network. It clarifies custodial and non-custodial staking types, enhances command usability in the Makefile, and provides detailed key configuration elements within YAML files. The introduction of clear distinctions between addresses ensures users have the necessary information for effective implementation and management of staked Suppliers.

Changes

Files Change Summary
Makefile Modified supplier_unstake command to directly integrate the $(SUPPLIER) variable for improved usability.
docusaurus/docs/operate/configs/supplier_staking_config.md Added "Staking types" section detailing Custodial and Non-Custodial Staking, clarified roles for owner_address and operator_address.
localnet/poktrolld/config/supplier*_stake_config.yaml Updated configurations by replacing owner_address with operator_address and clarified roles in each supplier's staking configuration.
localnet/poktrolld/config/supplier_stake_config_example.yaml Introduced a template configuration file for staking Suppliers, outlining custodial/non-custodial options and key parameters for management and services.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6b92e50 and 1a2285a.

Files selected for processing (3)
  • docusaurus/docs/operate/configs/supplier_staking_config.md (3 hunks)
  • localnet/poktrolld/config/supplier1_stake_config.yaml (1 hunks)
  • localnet/poktrolld/config/supplier_stake_config_example.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • localnet/poktrolld/config/supplier1_stake_config.yaml
  • localnet/poktrolld/config/supplier_stake_config_example.yaml
Additional context used
LanguageTool
docusaurus/docs/operate/configs/supplier_staking_config.md

[misspelling] ~71-~71: This word is normally spelled as one.
Context: ...ses and submitting claims and proofs. Non-custodial staking is suitable for Supplier`s tha...

(EN_COMPOUNDS_NON_CUSTODIAL)


[misspelling] ~103-~103: This word is normally spelled as one.
Context: ...he same as the operator_address. For non-custodial staking, the owner_address must be di...

(EN_COMPOUNDS_NON_CUSTODIAL)


[uncategorized] ~122-~122: Loose punctuation mark.
Context: ...:: ### operator_address Optional, Non-empty ```yaml operator_address...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~131-~131: In American English, abbreviations like “etc.” require a period.
Context: ... services, increasing the stake amount, etc). The operator account can also be use...

(ETC_PERIOD)

Additional comments not posted (3)
docusaurus/docs/operate/configs/supplier_staking_config.md (3)

97-107: LGTM!

The owner_address section is clear and provides comprehensive information about its role in both custodial and non-custodial staking.

Tools
LanguageTool

[misspelling] ~103-~103: This word is normally spelled as one.
Context: ...he same as the operator_address. For non-custodial staking, the owner_address must be di...

(EN_COMPOUNDS_NON_CUSTODIAL)


128-147: LGTM!

The operator_address section is clear and provides comprehensive information about its role and constraints.

Tools
LanguageTool

[style] ~131-~131: In American English, abbreviations like “etc.” require a period.
Context: ... services, increasing the stake amount, etc). The operator account can also be use...

(ETC_PERIOD)


Line range hint 149-169:
LGTM!

The stake_amount section is clear and provides comprehensive information about its requirements and implications.

Tools
LanguageTool

[misspelling] ~103-~103: This word is normally spelled as one.
Context: ...he same as the operator_address. For non-custodial staking, the owner_address must be di...

(EN_COMPOUNDS_NON_CUSTODIAL)


[uncategorized] ~122-~122: Loose punctuation mark.
Context: ...:: ### operator_address Optional, Non-empty ```yaml operator_address...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~131-~131: In American English, abbreviations like “etc.” require a period.
Context: ... services, increasing the stake amount, etc). The operator account can also be use...

(ETC_PERIOD)


[uncategorized] ~153-~153: Loose punctuation mark.
Context: .... ::: ### stake_amount Required, Non-empty ```yaml stake_amount: <n...

(UNLIKELY_OPENING_PUNCTUATION)


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (7)
localnet/poktrolld/config/supplier1_stake_config.yaml (2)

1-8: Enhance Documentation Clarity.

The documentation provides a good overview of custodial and non-custodial staking. Consider adding examples to illustrate the differences in practical scenarios.


10-14: Clarify Owner Address Role.

The explanation of the owner_address role is clear. Ensure that any limitations or constraints on changing the owner address are well-documented in the surrounding documentation.

docusaurus/docs/operate/configs/supplier_staking_config.md (5)

49-51: Well-Structured Staking Types Section.

The new section on staking types is well-structured and provides clarity. Consider providing a visual diagram to further aid understanding.


66-72: Non-Custodial Staking Explanation is Clear.

The explanation of non-custodial staking is thorough. Consider adding a section on best practices for securing the operator account.

Tools
LanguageTool

[misspelling] ~69-~69: This word is normally spelled as one.
Context: ...ses and submitting claims and proofs. Non-custodial staking is suitable for Supplier`s tha...

(EN_COMPOUNDS_NON_CUSTODIAL)


89-89: Punctuation Consistency.

Ensure consistent punctuation usage throughout the document. The use of underscores and commas should be reviewed for consistency.

Tools
LanguageTool

[uncategorized] ~89-~89: Loose punctuation mark.
Context: ...ation ### owner_address Required, Non-empty ```yaml owner_address: <...

(UNLIKELY_OPENING_PUNCTUATION)


95-97: Clarify Owner Address Constraints.

The description of the owner_address role is clear. Ensure that any constraints or limitations on changing the owner address are well-documented.

Tools
LanguageTool

[uncategorized] ~95-~95: Possible missing comma found.
Context: ...ccount that owns the Suppliers staked funds which will be returned to this account ...

(AI_HYDRA_LEO_MISSING_COMMA)


119-119: Punctuation Consistency.

Ensure consistent punctuation usage throughout the document. The use of underscores and commas should be reviewed for consistency.

Tools
LanguageTool

[uncategorized] ~119-~119: Loose punctuation mark.
Context: ...:: ### operator_address Optional, Non-empty ```yaml operator_address...

(UNLIKELY_OPENING_PUNCTUATION)

The `operator_address` is the address that identifies the `Supplier`.
Its corresponding account is used for operational tasks such as signing `RelayResponse`s,
submitting `Claims` and `Proofs` as well as updating the `Supplier`'s info
(i.e. Adding or removing services, increasing the stake amount, etc).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Period to Abbreviation.

In American English, abbreviations like “etc.” require a period.

- etc)
+ etc.)
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
(i.e. Adding or removing services, increasing the stake amount, etc).
(i.e. Adding or removing services, increasing the stake amount, etc.).
Tools
LanguageTool

[style] ~128-~128: In American English, abbreviations like “etc.” require a period.
Context: ... services, increasing the stake amount, etc). The operator account can also be use...

(ETC_PERIOD)

Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Suggested a few improvements to get it even better

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

## Configuration

### `owner_address`

_`Required`_, _`Non-empty`_
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove loose punctuation marks.

The underscores around "Required" and "Non-empty" should be removed or formatted consistently.

- _`Required`_, _`Non-empty`_
+ **Required**, **Non-empty**

Also applies to: 119-119

Tools
LanguageTool

[uncategorized] ~89-~89: Loose punctuation mark.
Context: ...ation ### owner_address Required, Non-empty ```yaml owner_address: <...

(UNLIKELY_OPENING_PUNCTUATION)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (4)
docusaurus/docs/operate/configs/supplier_staking_config.md (4)

71-71: Correct spelling for "non-custodial".

The term "non-custodial" should be spelled as one word.

- Non-custodial
+ Noncustodial

Also applies to: 103-103

Tools
LanguageTool

[misspelling] ~71-~71: This word is normally spelled as one.
Context: ...ses and submitting claims and proofs. Non-custodial staking is suitable for Supplier`s tha...

(EN_COMPOUNDS_NON_CUSTODIAL)


133-140: Consider adding a mermaid diagram.

A mermaid diagram could visually represent the differences between custodial and non-custodial staking, enhancing clarity.


122-122: Remove loose punctuation marks.

The underscores around "Optional" and "Non-empty" should be removed or formatted consistently.

- _`Optional`_, _`Non-empty`_
+ **Optional**, **Non-empty**
Tools
LanguageTool

[uncategorized] ~122-~122: Loose punctuation mark.
Context: ...:: ### operator_address Optional, Non-empty ```yaml operator_address...

(UNLIKELY_OPENING_PUNCTUATION)


131-131: Add period to abbreviation.

In American English, abbreviations like “etc.” require a period.

- etc)
+ etc.)
Tools
LanguageTool

[style] ~131-~131: In American English, abbreviations like “etc.” require a period.
Context: ... services, increasing the stake amount, etc). The operator account can also be use...

(ETC_PERIOD)

@red-0ne red-0ne requested a review from Olshansk August 15, 2024 13:48
Copy link
Contributor

@bryanchriswhite bryanchriswhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff @red-0ne 🔥

Copy link
Contributor

@bryanchriswhite bryanchriswhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preemptively approving, just a few more suggestions but otherwise LGTM! 🚀 🚢

@red-0ne red-0ne merged commit 3a08e41 into main Aug 27, 2024
11 checks passed
okdas pushed a commit that referenced this pull request 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 pull request 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
documentation Improvements or additions to documentation on-chain On-chain business logic supplier Changes related to the Supplier actor
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants