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

[Service] Add owner_address to the Service type #714

Merged
merged 8 commits into from
Jul 30, 2024
Merged

Conversation

Olshansk
Copy link
Member

@Olshansk Olshansk commented Jul 30, 2024

Summary

  • Add owner_address to the Service proto
  • Add tests ensuring that it is the correct & expected value
  • Set up work for updating services that @adshmh will be working on

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • make docusaurus_start; only needed if you make doc changes
  • Unit Tests: make go_develop_and_test
  • LocalNet E2E Tests: make test_e2e
  • 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 the OwnerAddress field to the service structure, enhancing service ownership management and reward distribution.
    • Added error handling for invalid owner addresses during service management.
  • Bug Fixes

    • Improved validation logic for service ownership during service addition, ensuring users can only manage their services.
  • Tests

    • Enhanced test coverage for service ownership, with new scenarios reflecting the updated owner address logic.
    • Updated existing tests to align with changes in service ownership terminology and validation.
  • Chores

    • Refactored code for clarity and consistency, particularly regarding address naming conventions.

@Olshansk Olshansk self-assigned this Jul 30, 2024
@Olshansk Olshansk requested review from red-0ne and adshmh July 30, 2024 01:16
@Olshansk Olshansk added on-chain On-chain business logic utility labels Jul 30, 2024
@Olshansk Olshansk added this to the Shannon Beta TestNet Launch milestone Jul 30, 2024
@Olshansk Olshansk marked this pull request as ready for review July 30, 2024 01:17
Copy link

coderabbitai bot commented Jul 30, 2024

Walkthrough

The recent updates introduce an OwnerAddress field to the Service structure, enhancing its functionality by tying service ownership to on-chain operations. These modifications improve validation, error handling, and clarity across various components, including service creation and testing. The enhancements ensure that only rightful owners can manage their services, thereby strengthening the integrity and robustness of the blockchain application.

Changes

Files Change Summary
api/poktroll/shared/service.pulsar.go, proto/poktroll/shared/service.proto Introduced OwnerAddress field in Service structure and updated protobuf definitions, including import for Cosmos-specific types.
x/service/keeper/msg_server_add_service.go, x/service/keeper/msg_server_add_service_test.go Enhanced validation in AddService function for owner address checks and updated test cases to reflect new ownership logic.
x/service/types/message_add_service.go, x/service/types/message_add_service_test.go Updated NewMsgAddService to clarify parameter naming and improve validation for owner addresses in tests, ensuring consistency with ownership context.
x/service/types/errors.go Introduced new error constant ErrServiceInvalidOwnerAddress for better error handling regarding owner address validation.
x/tokenomics/keeper/settle_session_accounting_test.go Modified service initialization in tests to explicitly include OwnerAddress, improving clarity and maintainability.

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

Outside diff range, codebase verification and nitpick comments (1)
api/poktroll/shared/service.pulsar.go (1)

2826-2830: Add clarity to the comments.

The comments for the OwnerAddress field are clear but could be made more concise and precise.

-	// It is the address that receives  rewards based on the Service's on-chain usage
-	// It is the only address that can update the service configuration (e.g. compute_units_per_relay),
-	// or make other updates to it.
+	// The address receives rewards based on the Service's on-chain usage.
+	// This address is the only one authorized to update the service configuration (e.g., compute_units_per_relay) or make other updates.

Copy link
Contributor

@red-0ne red-0ne left a comment

Choose a reason for hiding this comment

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

Left some comments, mostly about service update.

Otherwise glad to see all of this coming-up together 👍

Copy link

The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks.

You may need to run make trigger_ci to submit an empty commit that'll trigger the tests.

GCP workloads (requires changing the namespace to 714)
Grafana network dashboard for devnet-issue-{issue-id}

@github-actions github-actions bot added devnet push-image CI related - pushes images to ghcr.io labels Jul 30, 2024
Copy link
Contributor

@red-0ne red-0ne left a comment

Choose a reason for hiding this comment

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

Perfect! Approving

@Olshansk Olshansk merged commit 1c38923 into main Jul 30, 2024
10 checks passed
@Olshansk Olshansk deleted the source_owner branch July 30, 2024 22:51
okdas pushed a commit that referenced this pull request Nov 14, 2024
- Add `owner_address` to the `Service` proto
- Add tests ensuring that it is the correct & expected value
- Set up work for `updating services` that @adshmh will be working on

Co-authored-by: Redouane Lakrache <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devnet devnet-test-e2e on-chain On-chain business logic push-image CI related - pushes images to ghcr.io utility
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants