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

chore: use comet proto type instead of custom #20255

Merged
merged 6 commits into from
May 10, 2024
Merged

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented May 2, 2024

Description

ref #20250


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

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

    • Enhanced the ABCIQuery function to return more detailed responses including ProofOps, Height, and Codespace.
  • Refactor

    • Removed the FromABCIResponseQuery function to streamline response handling.
  • Documentation

    • Updated protocol buffer files to reflect changes in message structures and deprecations.

Copy link
Contributor

coderabbitai bot commented May 2, 2024

Walkthrough

Walkthrough

The recent updates aim to enhance the ABCIQuery function in the gRPC service by returning a more detailed ABCIQueryResponse struct, removing a conversion function in types.go, and updating the protobuf definitions with new imports and deprecated messages. These changes focus on improving the data structure and streamlining the codebase by eliminating redundant conversions.

Changes

File Path Summary of Changes
client/grpc/cmtservice/service.go Modified ABCIQuery to return ABCIQueryResponse with additional fields.
client/grpc/cmtservice/types.go Removed FromABCIResponseQuery function.
proto/cosmos/base/tendermint/v1beta1/query.proto Added new import, updated ProofOps field, and marked ProofOp and ProofOps as deprecated.

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

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

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

@tac0turtle tac0turtle marked this pull request as ready for review May 2, 2024 17:21
@tac0turtle tac0turtle requested a review from a team as a code owner May 2, 2024 17:21
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: 1

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

Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between f2cf991 and 89db06a.
Files ignored due to path filters (1)
  • client/grpc/cmtservice/query.pb.go is excluded by !**/*.pb.go
Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • api/cosmos/base/tendermint/v1beta1/query.pulsar.go (27 hunks)
  • client/grpc/cmtservice/service.go (1 hunks)
  • client/grpc/cmtservice/types.go (1 hunks)
  • proto/cosmos/base/tendermint/v1beta1/query.proto (3 hunks)
Files not summarized due to errors (1)
  • api/cosmos/base/tendermint/v1beta1/query.pulsar.go: Error: Message exceeds token limit
Files skipped from review as they are similar to previous changes (2)
  • client/grpc/cmtservice/service.go
  • client/grpc/cmtservice/types.go
Additional Context Used
GitHub Check Runs (1)
break-check failure (3)

proto/cosmos/base/tendermint/v1beta1/query.proto: [failure] 175-175:
Previously present field "8" with name "proof_ops" on message "ABCIQueryResponse" was deleted.

Path-based Instructions (2)
CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

api/cosmos/base/tendermint/v1beta1/query.pulsar.go (1)

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

Additional comments not posted (32)
proto/cosmos/base/tendermint/v1beta1/query.proto (3)

13-13: The addition of the import statement for "cometbft/crypto/v1/proof.proto" aligns with the PR's objective to standardize the use of Comet proto types. This change should help in integrating the crypto structures more seamlessly.


188-188: Updating the proof_ops field to use a fully qualified proto path (.cometbft.crypto.v1.ProofOps) enhances clarity and helps prevent type conflicts. This change is a good practice in proto definitions to ensure that the correct types are used, especially when similar names might exist in different packages.


Line range hint 175-175: The static analysis tool flagged the deletion of the previously existing field "8" named "proof_ops" in the ABCIQueryResponse message. This change is not reflected in the provided code, suggesting a possible oversight. Please verify this change to ensure that it aligns with the intended modifications and does not affect backward compatibility.

CHANGELOG.md (3)

184-184: LGTM! The description is clear and concise.


184-184: LGTM! The description is clear and concise.


184-184: LGTM! The description is clear and concise.

api/cosmos/base/tendermint/v1beta1/query.pulsar.go (26)

8449-8449: The addition of the field descriptor for proof_ops aligns well with the PR's objectives to integrate Comet proto types. Good job on maintaining consistency.


8463-8463: Correct assignment of the field descriptor for proof_ops. This is necessary for the integration of the new Comet proto types.


4-4: Ensure the surrounding logic for the Height field check integrates well with the rest of the function. The provided snippet is correct.


8579-8584: Proper handling of the ProofOps field using proto reflection methods. This is consistent with the integration of the new Comet proto types.


8616-8617: Correct addition of the proof_ops case in the switch statement. This ensures proper handling of the new ProofOps field.


8650-8651: Proper handling of the clearing of the ProofOps field. This is necessary for correct data management.


8692-8694: Correct handling for retrieving the ProofOps field value using proto reflection methods. This ensures consistency with the new field addition.


8731-8732: Correct handling for setting the ProofOps field value. This ensures that the field is correctly populated with the expected type.


8755-8755: Proper initialization of the ProofOps field using new. This is necessary to ensure that the field is ready for use.


8803-8805: Correct handling for creating a new ProofOps instance for a field value. This ensures that the field is correctly populated.


8904-8907: Correct calculation of the size of the ProofOps field. This is necessary for accurate serialization.


Line range hint 13-13: Proper marshaling of the ProofOps field with appropriate error handling. This ensures data integrity during serialization.


8949-8950: Proper encoding of the ProofOps field. This ensures that the field is correctly represented in the serialized data.


9220-9224: Proper unmarshaling of the Height field with appropriate error handling and wire type checking. This ensures data integrity during deserialization.


9240-9243: Proper unmarshaling of the Codespace field with appropriate error handling and wire type checking. This ensures data integrity during deserialization.


9271-9273: Proper unmarshaling of the ProofOps field with appropriate error handling and wire type checking. This ensures data integrity during deserialization.


9300-9305: Proper unmarshaling of the ProofOps field with appropriate error handling. This ensures data integrity during deserialization.


11176-11176: Correct update of the ABCIQueryResponse struct to include the new ProofOps field. This aligns with the PR's objectives to integrate Comet proto types.


Line range hint 20-20: Correct implementation of the getter method for the Height field. This ensures proper encapsulation and data access.


11255-11260: Correct implementation of the getter method for the ProofOps field. This ensures proper encapsulation and data access.


11323-11324: Correct marking of the ProofOps type as deprecated. This aligns with the PR's objectives to move away from older structures.


11385-11387: Correct inclusion of necessary imports for proto definitions. This ensures that all required types are available in the file.


11524-11524: Correct definition of fields in the proto message. This ensures that the message structure is properly specified.


11533-11540: Correct continuation of field definitions in the proto message. This ensures that the message structure is properly specified.


11695-11695: Correct definition of type references in the proto file. This ensures that the types are correctly linked and accessible.


11714-11714: Correct definition of type references and service methods in the proto file. This ensures that the types and methods are correctly linked and defined.

@@ -181,6 +181,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (baseapp) [#19993](https://github.com/cosmos/cosmos-sdk/pull/19993) Indicate pruning with error code "not found" rather than "invalid request".
* (x/consensus) [#20010](https://github.com/cosmos/cosmos-sdk/pull/20010) Move consensus module to be its own go.mod
* (server) [#20140](https://github.com/cosmos/cosmos-sdk/pull/20140) Remove embedded grpc-web proxy in favor of standalone grpc-web proxy. [Envoy Proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start)
* (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove trailing spaces at the end of the line.

- * (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime. 
+ * (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime.

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.

Suggested change
* (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime.
* (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime.

Comment on lines +197 to +200
option deprecated = true;
string type = 1;
bytes key = 2;
bytes data = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search results indicate that the ProofOp and ProofOps messages are still present and referenced in the proto/cosmos/base/tendermint/v1beta1/query.proto file. This contradicts the expectation that all references to ProofOp should have been updated or a migration path should have been documented following its deprecation.

Action Required:

  • Update all references to ProofOp and ProofOps in the codebase to use the new standardized structures.
  • Alternatively, ensure that a clear migration path is documented for transitioning from ProofOp and ProofOps to the new structures.

Locations needing attention:

  • proto/cosmos/base/tendermint/v1beta1/query.proto: References to ProofOp and ProofOps are still present.
Analysis chain

Marking the ProofOp message as deprecated is consistent with the move towards using more standardized structures. Ensure that all references to ProofOp in the codebase are updated to use the new structures, or that a migration path is clearly documented.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all references to `ProofOp` have been updated or that a migration path is documented.

# Test: Search for the usage of `ProofOp`. Expect: No occurrences or documented migration path.
rg --type proto $'ProofOp'

Length of output: 55



Script:

#!/bin/bash
# Description: Re-verify that all references to `ProofOp` have been updated or that a migration path is documented.

# Test: Search for the usage of `ProofOp` in .proto files. Expect: No occurrences or documented migration path.
rg 'ProofOp' -g '*.proto'

Length of output: 907

Comment on lines +207 to +208
option deprecated = true;
repeated ProofOp ops = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The verification process has revealed that the ProofOps message and its references are still present in the proto/cosmos/base/tendermint/v1beta1/query.proto file. This contradicts the expectation that all usages of ProofOps would have been updated or that a migration strategy would be in place following its deprecation.

  • proto/cosmos/base/tendermint/v1beta1/query.proto: Contains the definition of ProofOps and references to it.
Analysis chain

Similarly, marking the ProofOps message as deprecated aligns with the PR's goals. It's important to verify that all usages of ProofOps have been appropriately updated or that a migration strategy is in place.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all references to `ProofOps` have been updated or that a migration path is documented.

# Test: Search for the usage of `ProofOps`. Expect: No occurrences or documented migration path.
rg --type proto $'ProofOps'

Length of output: 56



Script:

#!/bin/bash
# Description: Re-verify that all references to `ProofOps` have been updated or that a migration path is documented.

# Test: Search for the usage of `ProofOps` in .proto files. Expect: No occurrences or documented migration path.
rg 'ProofOps' --glob '*.proto'

Length of output: 437

@@ -2,6 +2,7 @@
package tendermintv1beta1

import (
v12 "buf.build/gen/go/cometbft/cometbft/protocolbuffers/go/cometbft/crypto/v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider removing the unused import _ "cosmossdk.io/api/amino" to clean up the codebase and avoid including unnecessary dependencies.

@tac0turtle tac0turtle enabled auto-merge May 9, 2024 13:31
@tac0turtle tac0turtle added this pull request to the merge queue May 10, 2024
Merged via the queue into main with commit 03dc8bd May 10, 2024
64 of 66 checks passed
@tac0turtle tac0turtle deleted the marko/use_comet_proofops branch May 10, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants