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

[Review] Followups after #552 review #706

Merged
merged 9 commits into from
Jul 30, 2024
Merged

[Review] Followups after #552 review #706

merged 9 commits into from
Jul 30, 2024

Conversation

Olshansk
Copy link
Member

@Olshansk Olshansk commented Jul 25, 2024

Summary

Minor follows-ups (improvements & capturing TODOs) while reviewing #552 after it was merged.

Nothing is critical, but capturing work and improvements while it's fresh.

Issue

Type of change

Select one or more:

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

Testing

  • 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 a new command to quickly start a localnet setup without fixture regeneration.
    • A new feature specification for service management testing has been added.
  • Improvements

    • Enhanced error handling and reporting for flaky tests.
    • Updated command to reflect the new functionality of updating existing services rather than adding them.
    • Improved clarity and correctness in function names and variable usage across various components.
  • Bug Fixes

    • Corrected the error constant for service validation to ensure accurate error reporting.
  • Documentation

    • Improved comments for clarity on compute units and relay costs, enhancing understanding of the service functionality.

@Olshansk Olshansk added the code health Cleans up some code label Jul 25, 2024
@Olshansk Olshansk added this to the Shannon Beta TestNet Launch milestone Jul 25, 2024
@Olshansk Olshansk self-assigned this Jul 25, 2024
@Olshansk Olshansk changed the title [WIP][Review] #552 Followups [Review] Followups after #552 review Jul 25, 2024
@Olshansk Olshansk requested a review from red-0ne July 25, 2024 21:56
@Olshansk
Copy link
Member Author

Ccing @rBurgett for visibility on this. No pressure for review but feel free to add comments.

@Olshansk Olshansk requested a review from adshmh July 25, 2024 21:57
@Olshansk Olshansk marked this pull request as ready for review July 25, 2024 21:58
Copy link

coderabbitai bot commented Jul 25, 2024

Walkthrough

The recent changes significantly enhance the codebase's functionality and clarity by introducing new commands, improving error handling, and refining documentation. Key modifications include a quick startup command for localnet, updates to testing configurations, and renaming functions for greater accuracy. Error messages have been standardized, and comprehensive feature specifications for service management have been initiated. Overall, these changes aim to boost usability and maintainability while addressing potential issues in the code.

Changes

Files Change Summary
Makefile Added localnet_up_quick for faster setup; refined localnet_up documentation; modified test_all to include -buildmode=pie.
e2e/tests/service.feature Introduced service.feature for e2e testing covering service management scenarios; implementation marked as TODO.
pkg/relayer/miner/miner_test.go Adjusted sleep duration in tests for reliability; changed assertion from value equality to length equality for mined relays.
testutil/keeper/tokenomics.go Renamed TokenomicsKeepersOpt for clarity; updated function signatures for flexibility in passing options.
x/service/module/tx_add_service.go Renamed command from add-service to update-service for clarity; updated error handling for compute units.
x/service/types/errors.go Reformatted error declarations for readability without changing their logic or semantics.
x/service/types/message_add_service.go Modified comments for ComputeUnitsPerRelayMax and corrected error handling for compute units per relay in validation functions.
x/service/types/message_add_service_test.go Corrected error constant naming for consistency in tests related to service validation.
x/tokenomics/keeper/settle_session_accounting.go Renamed functions and variables for clarity; improved documentation in relayCountToCoin regarding parameters used in calculations.
api/poktroll/shared/service.pulsar.go Expanded comments on ComputeUnitsPerRelay for better understanding of its relationship with global variables.
proto/poktroll/shared/service.proto Enhanced comments in service.proto for compute_units_per_relay to clarify its use in calculations.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c4bee54 and c8268b3.

Files ignored due to path filters (1)
  • x/shared/types/service.pb.go is excluded by !**/*.pb.go
Files selected for processing (4)
  • api/poktroll/shared/service.pulsar.go (1 hunks)
  • proto/poktroll/shared/service.proto (1 hunks)
  • x/service/module/tx_add_service.go (1 hunks)
  • x/service/types/message_add_service.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • api/poktroll/shared/service.pulsar.go
Files skipped from review as they are similar to previous changes (2)
  • proto/poktroll/shared/service.proto
  • x/service/types/message_add_service.go
Additional comments not posted (2)
x/service/module/tx_add_service.go (2)

Line range hint 2-4:
TODO Comment Approved

The TODO_BETA comment provides a clear direction for future work and is relevant to the changes being made.


20-24: TODO Comment Approved

The TODO_UPNEXT comment provides a clear direction for the immediate next steps and is relevant to the changes being made.


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.

@Olshansk
Copy link
Member Author

@adshmh Could you PTAL at this? I think some of the TODOs here are also good onboarding tasks to get really in the weeds of this repo to take on larger ticket items.

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

Outside diff range, codebase verification and nitpick comments (2)
x/service/module/tx_add_service.go (2)

Line range hint 1-24:
Reminder: Address the TODO comments.

The file contains TODO comments for updating the command and ensuring proper ownership checks.

Do you want me to help with updating the command and implementing the ownership checks, or open a GitHub issue to track these tasks?


Line range hint 25-49:
Update function name and usage.

The function CmdAddService should be renamed to CmdUpdateService to reflect the new functionality.

- func CmdAddService() *cobra.Command {
+ func CmdUpdateService() *cobra.Command {

e2e/tests/service.feature Outdated Show resolved Hide resolved
testutil/keeper/tokenomics.go Outdated Show resolved Hide resolved
testutil/keeper/tokenomics.go Outdated Show resolved Hide resolved
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.

Great comments, this blends well with the source owner feature.

Left some questions and comments but also seeing some go-test check failures.

e2e/tests/service.feature Outdated Show resolved Hide resolved
pkg/relayer/miner/miner_test.go Show resolved Hide resolved
proto/poktroll/shared/service.proto Show resolved Hide resolved
testutil/keeper/tokenomics.go Outdated Show resolved Hide resolved
testutil/keeper/tokenomics.go Outdated Show resolved Hide resolved
testutil/keeper/tokenomics.go Show resolved Hide resolved
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 706)
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
@Olshansk Olshansk requested a review from red-0ne July 30, 2024 21:15
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.

LGTM.

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 (1)
x/service/module/tx_add_service.go (1)

Line range hint 28-57:
Update command usage and error messages

The command usage and error messages should be updated to reflect the new functionality of updating existing services.

- Use:   fmt.Sprintf("add-service <service_id> <service_name> [compute_units_per_relay: default={%d}]", types.DefaultComputeUnitsPerRelay),
- Short: "Add a new service to the network",
- Long: `Add a new service to the network that will be available for applications,
+ Use:   fmt.Sprintf("update-service <service_id> <service_name> [compute_units_per_relay: default={%d}]", types.DefaultComputeUnitsPerRelay),
+ Short: "Update an existing service on the network",
+ Long: `Update an existing service on the network that will be available for applications,

Comment on lines 25 to 27
func CmdAddService() *cobra.Command {
cmd := &cobra.Command{
Use: fmt.Sprintf("add-service <service_id> <service_name> [compute_units_per_relay: default={%d}]", types.DefaultComputeUnitsPerRelay),
Copy link

Choose a reason for hiding this comment

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

Rename the function to CmdUpdateService

The function name should be updated to reflect the new functionality of updating existing services.

- func CmdAddService() *cobra.Command {
+ func CmdUpdateService() *cobra.Command {
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
func CmdAddService() *cobra.Command {
cmd := &cobra.Command{
Use: fmt.Sprintf("add-service <service_id> <service_name> [compute_units_per_relay: default={%d}]", types.DefaultComputeUnitsPerRelay),
func CmdUpdateService() *cobra.Command {
cmd := &cobra.Command{
Use: fmt.Sprintf("add-service <service_id> <service_name> [compute_units_per_relay: default={%d}]", types.DefaultComputeUnitsPerRelay),

@Olshansk Olshansk merged commit a721b89 into main Jul 30, 2024
10 checks passed
@Olshansk Olshansk deleted the pr_552_followups branch July 30, 2024 23:14
okdas pushed a commit that referenced this pull request Nov 14, 2024
Minor follows-ups (improvements & capturing TODOs) while reviewing #552 after it was merged.

Nothing is critical, but capturing work and improvements while it's fresh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Cleans up some code devnet devnet-test-e2e push-image CI related - pushes images to ghcr.io
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants