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

refactor(server/v2/grpc): simplify node service #22728

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Dec 3, 2024

Description

Should not be merged before the target PR.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features

    • Introduced configuration options for a gRPC gateway, enabling enhanced service interaction.
  • Bug Fixes

    • Improved error handling in transaction simulation to ensure better response for invalid transactions.
  • Refactor

    • Removed deprecated node service configurations, streamlining the server's operational scope.
  • Chores

    • Updated dependency versions and modified configuration mappings for pruning options.

Copy link
Contributor

coderabbitai bot commented Dec 3, 2024

📝 Walkthrough

Walkthrough

The pull request includes the removal of a gRPC service and related protobuf definitions for querying node configuration in the Cosmos SDK framework. It also updates the protobuf version in the build scripts and modifies the gRPC server implementation to eliminate the registration of the removed service. Additionally, changes were made to enhance configuration handling in the gRPC service, including the introduction of a gRPC gateway configuration while removing outdated pruning options. The updates reflect a restructuring of service management and configuration handling within the server.

Changes

File Change Summary
proto/cosmos/base/node/v2/query.proto - Removed service Service and its Config method.
- Deleted ConfigRequest and ConfigResponse messages.
scripts/build/protobuf.mk - Updated protoVer from 0.15.1 to 0.15.2, affecting protoImageName.
server/v2/api/grpc/nodeservice/service.go - Removed queryServer type and its Config method.
- Deleted NewQueryServer constructor.
server/v2/api/grpc/server.go - Removed the registration of the node service in the gRPC server setup.
server/v2/cometbft/grpc.go - Added import for storeserver.
- Updated Config method to include unmarshalling of store configuration.
- Enhanced error handling in Simulate method.
server/v2/go.mod - Removed direct dependency on google.golang.org/genproto/googleapis/api and added it as an indirect dependency.
- Updated versions for google.golang.org/genproto and google.golang.org/genproto/googleapis/rpc.
tools/confix/data/v2-app.toml - Added new [grpc-gateway] section with enable and address parameters.
- Removed [store.options.ss-pruning-option] section.
tools/confix/migrations.go - Updated v2KeyChanges mapping, replacing entries for pruning-keep-recent and pruning-interval with their sc-pruning-option variants.

Possibly related PRs

Suggested reviewers

  • kocubinski
  • sontrinh16
  • akhilkumarpilli
  • tac0turtle

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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
Contributor

@akhilkumarpilli akhilkumarpilli left a comment

Choose a reason for hiding this comment

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

lgtm, can you remove key changes values related to store.options.ss here: https://github.com/cosmos/cosmos-sdk/blob/main/tools/confix/migrations.go#L41

Copy link
Contributor

@hieuvubk hieuvubk left a comment

Choose a reason for hiding this comment

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

lgtm

@julienrbrt
Copy link
Member Author

lgtm, can you remove key changes values related to store.options.ss here: https://github.com/cosmos/cosmos-sdk/blob/main/tools/confix/migrations.go#L41

Yep, good point! Done.

Base automatically changed from marko/SS_removal to main December 3, 2024 16:26
@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Dec 3, 2024
Copy link
Contributor

@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 and nitpick comments (2)
tools/confix/data/v2-app.toml (1)

44-48: Consider security implications of the gRPC gateway configuration

The default configuration binds to localhost, which is secure for development but may need adjustment for production environments. Consider adding:

  • TLS configuration options
  • Configurable bind address for different environments
  • Rate limiting settings
server/v2/cometbft/grpc.go (1)

Line range hint 124-186: Consider standardizing error message format

The implementation looks good with thorough error handling and backwards compatibility support. Consider standardizing the error message format:

-    return nil, status.Error(codes.InvalidArgument, "invalid empty tx")
+    return nil, status.Error(codes.InvalidArgument, "invalid tx: empty request")
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 94cfcc1 and 2dce606.

⛔ Files ignored due to path filters (2)
  • server/v2/api/grpc/nodeservice/query.pb.go is excluded by !**/*.pb.go
  • server/v2/api/grpc/nodeservice/query.pb.gw.go is excluded by !**/*.pb.gw.go
📒 Files selected for processing (8)
  • proto/cosmos/base/node/v2/query.proto (0 hunks)
  • scripts/build/protobuf.mk (1 hunks)
  • server/v2/api/grpc/nodeservice/service.go (0 hunks)
  • server/v2/api/grpc/server.go (0 hunks)
  • server/v2/cometbft/grpc.go (3 hunks)
  • server/v2/go.mod (1 hunks)
  • tools/confix/data/v2-app.toml (1 hunks)
  • tools/confix/migrations.go (0 hunks)
💤 Files with no reviewable changes (4)
  • server/v2/api/grpc/nodeservice/service.go
  • proto/cosmos/base/node/v2/query.proto
  • server/v2/api/grpc/server.go
  • tools/confix/migrations.go
✅ Files skipped from review due to trivial changes (1)
  • scripts/build/protobuf.mk
🧰 Additional context used
📓 Path-based instructions (1)
server/v2/cometbft/grpc.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (3)
server/v2/go.mod (1)

115-116: LGTM: Dependency updates are consistent

The changes to google.golang.org/genproto dependencies reflect their indirect usage status and include version updates.

server/v2/cometbft/grpc.go (2)

5-5: LGTM: Required imports added

The new imports support the enhanced configuration handling in the Config method.

Also applies to: 19-19


213-221: LGTM: Improved configuration handling

The changes improve type safety by:

  • Using proper unmarshaling of store configuration
  • Adding appropriate error handling
  • Using typed values for pruning options

@julienrbrt julienrbrt added this pull request to the merge queue Dec 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 3, 2024
@julienrbrt julienrbrt added this pull request to the merge queue Dec 3, 2024
Merged via the queue into main with commit af4b7d2 Dec 3, 2024
77 of 79 checks passed
@julienrbrt julienrbrt deleted the julien/nodeservice-simpl branch December 3, 2024 17:19
mergify bot pushed a commit that referenced this pull request Dec 3, 2024
(cherry picked from commit af4b7d2)

# Conflicts:
#	server/v2/api/grpc/server.go
#	server/v2/go.mod
julienrbrt added a commit that referenced this pull request Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release C:Confix Issues and PR related to Confix C:server/v2 api C:server/v2 cometbft C:server/v2 Issues related to server/v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.