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

[Supplier] Implement non-custodial staking #716

Merged
merged 21 commits into from
Aug 13, 2024
Merged

Conversation

red-0ne
Copy link
Contributor

@red-0ne red-0ne commented Jul 30, 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:

Issue

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

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

@red-0ne red-0ne added supplier Changes related to the Supplier actor on-chain On-chain business logic labels Jul 30, 2024
@red-0ne red-0ne self-assigned this Jul 30, 2024
@Olshansk Olshansk added this to the Shannon Beta TestNet Launch milestone Jul 30, 2024
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.

Preliminary review of draft PR. Great start!

proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
x/supplier/module/tx_unstake_supplier.go Show resolved Hide resolved
proto/poktroll/supplier/tx.proto Outdated Show resolved Hide resolved
proto/poktroll/supplier/tx.proto Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/module/tx_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/module/tx_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/module/tx_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_unstake_supplier.go Outdated Show resolved Hide resolved
@red-0ne red-0ne requested a review from Olshansk August 1, 2024 23:31
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.

Did a quick glance and great progress on this PR.

Haven't done a full review but trying to understand if you need it now?

Requesting changes just to mark it appropriately that I'm waiting for a response.

@red-0ne
Copy link
Contributor Author

red-0ne commented Aug 2, 2024

Requesting changes just to mark it appropriately that I'm waiting for a response.

This should be feature complete but don't want to mark it as ready for review before ensuring that all tests are passing.

@Olshansk
Copy link
Member

Olshansk commented Aug 2, 2024

@red-0ne You mentioned this is feature complete, but how about the detailed CLI helpers we discussed?

This is a very big painpoint in Morse, and the docs there are currently way ahead. See screenshot below.

Screenshot 2024-08-02 at 1 37 51 PM

@red-0ne
Copy link
Contributor Author

red-0ne commented Aug 6, 2024

@red-0ne You mentioned this is feature complete, but how about the detailed CLI helpers we discussed?

PR #720 tackles staking CLI description and documentation.

@red-0ne red-0ne requested a review from Olshansk August 7, 2024 19:27
@red-0ne red-0ne marked this pull request as ready for review August 7, 2024 19:34
Copy link

coderabbitai bot commented Aug 7, 2024

Warning

Rate limit exceeded

@red-0ne has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 29 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 8060f46 and 8121719.

Walkthrough

The recent changes enhance the management of supplier ownership and staking by introducing a new OwnerAddress field, improving validation checks, and restructuring associated methods. These updates aim to clarify the roles of owners and operators while ensuring that unauthorized modifications are prevented. Overall, the modifications bolster the security and integrity of supplier-related processes without compromising functionality.

Changes

Files Change Summary
api/poktroll/..., proto/poktroll/... Introduced a new OwnerAddress field, renamed existing structures, and updated proto definitions to reflect changes.
x/supplier/config/errors.go, x/supplier/config/supplier_configs_reader.go Added new error variables for invalid addresses and included OwnerAddress and OperatorAddress fields in config structures.
x/supplier/keeper/... Enhanced validation in StakeSupplier and UnstakeSupplier methods to enforce ownership and authorization checks.
x/tokenomics/keeper/..., x/tokenomics/module/module.go Renamed variables for clarity and added logic to verify supplier validity, including a new supplierKeeper for managing operations.
x/tokenomics/types/errors.go Introduced a new error constant for invalid supplier owner addresses.
x/supplier/types/... Updated message structures to incorporate new parameters and enhance validation processes.

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

Reviewed a couple files and leaving comments because it'll have downstream efforts.

proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
string owner_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // Bech32 cosmos address
// The operator address of the supplier that operates it.
// The operator address can update the supplier's configurations excluding the owner
// and operator addresses which do not change over the supplier's lifespan.
Copy link
Member

Choose a reason for hiding this comment

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

and operator addresses which do not change over the supplier's lifespan.

This is incorrect.

The operator can:

  • Update operator address

The owner can:

  • Update operator address
  • Update owner address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added this restriction to simplify the Supplier management.

Given that:

  1. Changing the operator address mid-session would have the same effect as changing other service configs, which raises the need to delay the update til the next session.

  2. The OperatorAddress is the Supplier identifier, if the owner is allowed to change it, it would need to specify the old OperatorAddress so we would know which supplier to update when calling GetSupplier (we actually have to delete then set the Supplier entry in the Supplier KVStore). Adding an old_operator_address to the staking config file is far from ideal ux wise.

Having the owner being able to update the OwnerAddress is fine though.

Copy link
Member

Choose a reason for hiding this comment

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

Having the owner being able to update the OwnerAddress is fine though.

Let's make this clearer.

Copy link
Member

Choose a reason for hiding this comment

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

Changing the operator address mid-session would have the same effect as changing other service configs, which raises the need to delay the update til the next session.

Add one line making it clearer why operator address is immutable.

Copy link
Member

Choose a reason for hiding this comment

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

Per this comment: #716 (comment)

Can you please evaluate if there is any difference with how it works in Morse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking directly into the code, these are the current differences.

Morse Shannon
Id Operator address Operator address
Initial stake Owner and Operator Owner only
Update Owner and operator Operator only
Update owner Owner None, must unstake->stake
Update operator Owner and Operator (see Note) None, must unstake->stake
Unstake Owner and Operator Owner only (can easily upgrade to both)

Note that from reading the code, ther seems to be no code path that can update the operator address, since the message would contain a new validator address which would not be found when doing k.GetValidator(ctx, validator.Address). I may be missing something though

proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
proto/poktroll/supplier/tx.proto Outdated Show resolved Hide resolved
proto/poktroll/supplier/tx.proto Outdated Show resolved Hide resolved
x/supplier/types/message_stake_supplier.go Show resolved Hide resolved
x/supplier/types/message_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
@red-0ne red-0ne requested a review from Olshansk August 8, 2024 04:03
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: 2

Outside diff range, codebase verification and nitpick comments (4)
x/supplier/module/tx_unstake_supplier.go (1)

15-15: Clarify the command usage.

The usage string now requires an <operator_address>, which is a necessary parameter for unstaking. Ensure that this requirement is clearly documented in the CLI help and related documentation.

proto/poktroll/shared/supplier.proto (2)

13-16: Clarify the owner address documentation.

The documentation for owner_address is clear, specifying its role and immutability by the operator. Ensure this is consistently communicated in related documentation.


17-23: Clarify the operator address documentation.

The address field now represents the operator address. The comments clarify its role and immutability. Ensure this is reflected in all related documentation, and address the TODO for renaming.

testutil/integration/app.go (1)

425-425: Update all calls to NewCompleteIntegrationApp to include supplierKeeper.

The function NewCompleteIntegrationApp has been updated to include supplierKeeper in its signature, but the following calls do not pass this argument:

  • tests/integration/tokenomics/tokenomics_example_test.go
  • tests/integration/tokenomics/relay_mining_difficulty_test.go

Please ensure these calls are updated to match the new function signature.

Analysis chain

Update function signature to include supplierKeeper.

The addition of supplierKeeper to the function signature of NewCompleteIntegrationApp indicates a change in the initialization process of the integration app. Ensure that all calls to this function are updated to pass the supplierKeeper argument.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `NewCompleteIntegrationApp` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 3 $'NewCompleteIntegrationApp'

Length of output: 1923

x/supplier/types/message_unstake_supplier.go Show resolved Hide resolved
x/supplier/keeper/msg_server_unstake_supplier.go Outdated Show resolved Hide resolved
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

x/supplier/types/message_stake_supplier.go Outdated Show resolved Hide resolved
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

Comment on lines +15 to +26
signerAddress string,
ownerAddress string,
supplierAddress string,
stake sdk.Coin,
services []*sharedtypes.SupplierServiceConfig,
) *MsgStakeSupplier {
return &MsgStakeSupplier{
Address: address,
Stake: &stake,
Services: services,
Signer: signerAddress,
OwnerAddress: ownerAddress,
Address: supplierAddress,
Stake: &stake,
Services: services,
Copy link

Choose a reason for hiding this comment

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

Ensure non-empty parameters in NewMsgStakeSupplier.

The function should validate that signerAddress, ownerAddress, and supplierAddress are non-empty strings to prevent creating invalid messages.

if signerAddress == "" || ownerAddress == "" || supplierAddress == "" {
    return nil, errors.New("addresses must be non-empty")
}

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.

LET'S MERGE IT! Incredible UX (user and developer) changes in the last iteration!

@@ -31,3 +31,13 @@ func (s *Supplier) IsActive(queryHeight uint64, serviceId string) bool {

return true
}

// HasOwner returns whether the given address is the supplier's owner address.
func (s *Supplier) HasOwner(address string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Great functin naming.

coinsToEscrow = *msg.Stake
} else {
logger.Info(fmt.Sprintf("Supplier found. About to try updating supplier with address %q", msg.Address))

// Ensure the signer is either the owner or the operator of the supplier.
Copy link
Member

Choose a reason for hiding this comment

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

LOVE THIS!

)
}

// Ensure that only the owner can change the OwnerAddress.
Copy link
Member

Choose a reason for hiding this comment

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

:100

@@ -12,22 +12,28 @@ import (
func CmdUnstakeSupplier() *cobra.Command {
Copy link
Member

Choose a reason for hiding this comment

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

Not actionable: Just a reminder that we'll need to use AutoCLI in the future.

// address is the must be the owner or operator address of the supplier
address := args[0]

signerAddress := clientCtx.GetFromAddress().String()
Copy link
Member

Choose a reason for hiding this comment

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

Amazing

proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/supplier.proto Outdated Show resolved Hide resolved

string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator)
string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the owner (i.e. custodial, staker)
string address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be operator_address or have a TODO_TECHDEBT(#722) comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is already renamed in #722

option (cosmos.msg.v1.signer) = "signer";

string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator)
string address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial)
Copy link
Contributor

Choose a reason for hiding this comment

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

(same as above)

x/supplier/config/errors.go Outdated Show resolved Hide resolved
x/supplier/keeper/msg_server_stake_supplier.go Outdated Show resolved Hide resolved
OwnerAddress: ownerAddress,
Address: supplierAddress,
Stake: &stake,
Services: services,
}
}

func (msg *MsgStakeSupplier) ValidateBasic() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to move the check which ensures that the signer is either the owner or operator here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't, since we may have an external signer (neither the operator, nor the owner) that can stake the funds.

See: https://discord.com/channels/553741558869131266/1266860790917632121/1271475296805322762

return &MsgUnstakeSupplier{
Signer: signerAddress,
Address: address,
}
}

func (msg *MsgUnstakeSupplier) ValidateBasic() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

(same as above)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When unstaking, we check that the signer is either the supplier's owner or operator, which is not available in ValidateBasic. The Address here just indicate which operator to unstake.

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: 2

Outside diff range, codebase verification and nitpick comments (1)
x/supplier/config/supplier_configs_reader.go (1)

84-85: Consider logging the defaulting of the operator address.

Adding a log statement when the operator address defaults to the owner address can help with debugging and tracking configuration changes.

-		logger.Info().Msg("operator address not set, defaulting to owner address")
+		logger.Info().Str("operator_address", stakeConfig.OperatorAddress).Msg("operator address not set, defaulting to owner address")

x/supplier/config/errors.go Outdated Show resolved Hide resolved
x/supplier/config/supplier_configs_reader.go Outdated Show resolved Hide resolved
@red-0ne red-0ne merged commit d296b17 into main Aug 13, 2024
9 of 10 checks passed
red-0ne added a commit that referenced this pull request 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 pull request 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 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

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