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

Collin/update prost build #307

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Collin/update prost build #307

merged 2 commits into from
Jul 18, 2024

Conversation

cbrit
Copy link
Member

@cbrit cbrit commented Jul 17, 2024

Summary by CodeRabbit

  • New Features

    • Added a new parameter somm_burn_ratio to auction parameters to specify the burn ratio of SOMM received from bids.
    • Introduced new protocol buffer definitions for Cosmos messages and queries.
    • Added HttpBody message for handling non-JSON payloads.
  • Improvements

    • Added serialization and deserialization capabilities to various structs to enhance compatibility and flexibility.
    • Extended protocol buffers with additional options for enhanced customization and functionality in Go.
  • Documentation

    • Added detailed information about the Rust Proto Bindings Build process and third-party vendored protos.

Copy link

coderabbitai bot commented Jul 18, 2024

Walkthrough

This update introduces several enhancements to the Rust Proto Bindings Build process, including new type attributes for serialization, the addition of new fields in specific structs, and the incorporation of third-party protobufs. Notable changes include the need for manual serde attribute additions for certain types and the addition of a new somm_burn_ratio field in the Params struct. Extensions to google.protobuf options for custom fields and HTTP mapping are also included.

Changes

File Path Change Summary
prost_build/README.md Documented a workaround for type_attribute issues and the need for manual serde attributes.
prost_build/src/main.rs Added type attributes for new proposals and a struct in the compile_protos function.
somm_proto/src/prost/auction.v1.rs Added a new somm_burn_ratio field to the Params struct.
somm_proto/src/prost/axelarcork.v1.rs Added serde::Deserialize and serde::Serialize traits to several structs for serialization support.
somm_proto/src/prost/cork.v2.rs Enhanced CorkResult and AddManagedCellarIDsProposalWithDeposit structs with serde traits.
somm_proto/src/prost/pubsub.v1.rs Added serde::Deserialize and serde::Serialize traits to the AddPublisherProposal struct.
third_party/proto/README.md Introduced information about the necessity and usage of third-party vendored protos.
third_party/proto/cosmos/msg/v1/msg.proto Extended google.protobuf options with custom fields for service and signer specifications in Cosmos messages.
third_party/proto/cosmos/query/v1/query.proto Added module_query_safe option to google.protobuf.MethodOptions for safe query criteria.
third_party/proto/cosmos_proto/cosmos.proto Added extensions to MessageOptions and FieldOptions for interface type specifications.
third_party/proto/gogoproto/gogo.proto Introduced numerous extensions to support enhanced functionalities and settings for enums, files, messages, and fields for Go with Gadgets.
third_party/proto/google/api/annotations.proto Defined HttpRule field for specifying HTTP mapping rules.
third_party/proto/google/api/http.proto Introduced Http and HttpRule messages for gRPC to HTTP REST endpoint mappings, explaining rules and examples.
third_party/proto/google/api/httpbody.proto Added HttpBody message to represent arbitrary HTTP body payloads, with fields for content type, raw data, and extensions.
third_party/proto/google/protobuf/any.proto Defined the Any message for encapsulating arbitrary serialized protocol buffer messages with type URLs.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d8bdaeb and 882163d.

Files selected for processing (18)
  • prost_build/README.md (1 hunks)
  • prost_build/src/main.rs (1 hunks)
  • somm_proto/src/prost/auction.v1.rs (1 hunks)
  • somm_proto/src/prost/axelarcork.v1.rs (2 hunks)
  • somm_proto/src/prost/cork.v2.rs (2 hunks)
  • somm_proto/src/prost/cosmos.msg.v1.rs (1 hunks)
  • somm_proto/src/prost/cosmos.query.v1.rs (1 hunks)
  • somm_proto/src/prost/cosmos_proto.rs (1 hunks)
  • somm_proto/src/prost/pubsub.v1.rs (1 hunks)
  • third_party/proto/README.md (1 hunks)
  • third_party/proto/cosmos/msg/v1/msg.proto (1 hunks)
  • third_party/proto/cosmos/query/v1/query.proto (1 hunks)
  • third_party/proto/cosmos_proto/cosmos.proto (1 hunks)
  • third_party/proto/gogoproto/gogo.proto (1 hunks)
  • third_party/proto/google/api/annotations.proto (1 hunks)
  • third_party/proto/google/api/http.proto (1 hunks)
  • third_party/proto/google/api/httpbody.proto (1 hunks)
  • third_party/proto/google/protobuf/any.proto (1 hunks)
Files skipped from review due to trivial changes (4)
  • somm_proto/src/prost/cosmos.msg.v1.rs
  • somm_proto/src/prost/cosmos.query.v1.rs
  • somm_proto/src/prost/cosmos_proto.rs
  • third_party/proto/README.md
Additional context used
LanguageTool
prost_build/README.md

[duplication] ~5-~5: Possible typo: you repeated a word
Context: ...attributeconfig method is not working the theCellarIdSet` type, therefore whenever ...

(ENGLISH_WORD_REPEAT_RULE)

Additional comments not posted (19)
third_party/proto/cosmos_proto/cosmos.proto (1)

1-16: LGTM!

The protobuf extensions are well-structured and follow the correct syntax.

third_party/proto/google/api/annotations.proto (1)

1-31: LGTM!

The Google API annotations are well-structured and follow the correct syntax. The license header is correctly included.

third_party/proto/cosmos/msg/v1/msg.proto (1)

1-30: LGTM!

The protobuf extensions are well-structured and follow the correct syntax.

third_party/proto/cosmos/query/v1/query.proto (1)

1-35: LGTM! Ensure the usage of the custom extension in the codebase.

The protobuf schema is well-defined with detailed comments explaining the purpose and usage of the custom extension.

Verify that the module_query_safe extension is used correctly in the codebase.

Verification successful

Usage of module_query_safe extension verified.

The module_query_safe extension is used extensively in the codebase, indicating correct integration and active utilization.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `module_query_safe` extension in the codebase.

# Test: Search for the usage of `module_query_safe`. Expect: Correct usage in the codebase.
rg --type proto -A 5 $'module_query_safe'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify the usage of the `module_query_safe` extension in the codebase.

# Locate all .proto files and search for the usage of `module_query_safe`.
fd --extension proto --exec rg 'module_query_safe' {}

Length of output: 3255

third_party/proto/google/api/httpbody.proto (1)

1-77: LGTM! Ensure the usage of the HttpBody message in the codebase.

The protobuf schema is well-defined with detailed comments explaining the purpose and usage of the HttpBody message.

Verify that the HttpBody message is used correctly in the codebase.

Verification successful

LGTM! Ensure the usage of the HttpBody message in the codebase.

The protobuf schema is well-defined with detailed comments explaining the purpose and usage of the HttpBody message. The HttpBody message is used correctly in various parts of the codebase.

  • somm_proto/src/prost/cork.v2.rs
  • somm_proto/src/prost/auction.v1.rs
  • somm_proto/src/prost/axelarcork.v1.rs
  • somm_proto/src/prost/pubsub.v1.rs
  • somm_proto/src/prost/incentives.v1.rs
  • somm_proto/src/prost/cellarfees.v1.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `HttpBody` message in the codebase.

# Test: Search for the usage of `HttpBody`. Expect: Correct usage in the codebase.
rg --type proto -A 5 $'HttpBody'

Length of output: 61


Script:

#!/bin/bash
# Description: Verify the usage of the `HttpBody` message in the codebase.

# Test: Search for the usage of `HttpBody`. Expect: Correct usage in the codebase.
rg -A 5 'HttpBody'

Length of output: 8407

third_party/proto/gogoproto/gogo.proto (1)

1-145: LGTM! Ensure the usage of the Go-specific extensions in the codebase.

The protobuf schema is well-defined with detailed comments explaining the purpose and usage of the Go-specific extensions.

Verify that the Go-specific extensions are used correctly in the codebase.

Verification successful

Go-specific extensions are correctly used in the codebase.

The goproto_ extensions defined in third_party/proto/gogoproto/gogo.proto are utilized in various .proto files across the codebase, confirming their correct usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the Go-specific extensions in the codebase.

# Test: Search for the usage of Go-specific extensions. Expect: Correct usage in the codebase.
rg --type proto -A 5 $'goproto_'

Length of output: 61


Script:

#!/bin/bash
# Description: Verify the usage of the Go-specific extensions in the codebase.

# Test: Search for the usage of Go-specific extensions. Expect: Correct usage in the codebase.
# Find all .proto files and search for the term 'goproto_' within them.
fd --extension proto --exec rg 'goproto_'

Length of output: 1621

third_party/proto/google/protobuf/any.proto (1)

1-158: LGTM! Ensure the usage of the Any message in the codebase.

The protobuf schema is well-defined with detailed comments explaining the purpose and usage of the Any message.

Verify that the Any message is used correctly in the codebase.

Verification successful

LGTM! The Any message is used correctly in the codebase.

The protobuf schema is well-defined with detailed comments explaining the purpose and usage of the Any message. The verification confirmed the usage of the Any message in several .proto files.

  • third_party/proto/cosmos/base/abci/v1beta1/abci.proto
  • third_party/proto/google/api/httpbody.proto
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `Any` message in the codebase.

# Test: Search for the usage of `Any`. Expect: Correct usage in the codebase.
rg --type proto -A 5 $'Any'

Length of output: 56


Script:

#!/bin/bash
# Description: Find all .proto files and search for the usage of the `Any` message within those files.

# Find all .proto files in the repository
proto_files=$(fd --type f --extension proto)

# Search for the usage of `Any` in each .proto file
for file in $proto_files; do
  echo "Searching in $file"
  rg 'Any' "$file"
done

Length of output: 11934

prost_build/src/main.rs (1)

105-108: LGTM!

The added type attributes for serialization and deserialization using serde are appropriate and facilitate data interchange.

third_party/proto/google/api/http.proto (3)

1-13: Correct Licensing Information.

The file includes the correct Apache License, Version 2.0 information.


15-17: Correct Syntax and Package Declaration.

The file uses proto3 syntax and declares the google.api package correctly.


19-375: Correct Options and Message Definitions.

The file includes correct options for different languages and defines Http and HttpRule messages according to the proto3 specification.

somm_proto/src/prost/auction.v1.rs (1)

180-183: LGTM!

The added field somm_burn_ratio in the Params struct is appropriate and correctly defined.

somm_proto/src/prost/cork.v2.rs (2)

32-32: LGTM!

The added serde::Deserialize and serde::Serialize attributes in the CorkResult struct are appropriate and facilitate data interchange.


405-405: LGTM!

The added serde::Deserialize and serde::Serialize attributes in the AddManagedCellarIDsProposalWithDeposit struct are appropriate and facilitate data interchange.

somm_proto/src/prost/pubsub.v1.rs (1)

80-80: LGTM!

The addition of serde::Deserialize and serde::Serialize derives to the AddPublisherProposal struct is correct and enhances the struct's functionality for serialization.

somm_proto/src/prost/axelarcork.v1.rs (4)

49-49: LGTM!

The addition of serde::Deserialize and serde::Serialize derives to the AxelarCorkResults struct is correct and enhances the struct's functionality for serialization.


49-49: LGTM!

The addition of serde::Deserialize and serde::Serialize derives to the CellarIdSet struct is correct and enhances the struct's functionality for serialization.


49-49: LGTM!

The addition of serde::Deserialize and serde::Serialize derives to the AddAxelarManagedCellarIDsProposal struct is correct and enhances the struct's functionality for serialization.


771-771: LGTM!

The addition of serde::Deserialize and serde::Serialize derives to the AddAxelarManagedCellarIDsProposalWithDeposit struct is correct and enhances the struct's functionality for serialization.


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

Outside diff range, codebase verification and nitpick comments (1)
prost_build/README.md (1)

5-5: The serde attributes are not manually added to the CellarIdSet type.

The serde::Deserialize and serde::Serialize attributes are not found in the CellarIdSet struct definitions within the generated files. Although there is a .type_attribute call in prost_build/src/main.rs to add these attributes, it does not appear to be effective.

  • somm_proto/src/prost/axelarcork.v1.rs
  • somm_proto/src/prost/cork.v2.rs
Analysis chain

Verify the manual addition of serde attributes.

Ensure that the serde::Deserialize and serde::Serialize attributes are manually added to the CellarIdSet type after running prost_build.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the manual addition of `serde` attributes to `CellarIdSet`.

# Test: Search for the `CellarIdSet` type in the generated files. Expect: `serde` attributes to be present.
rg --type rust 'CellarIdSet' -A 5

Length of output: 4993

Tools
LanguageTool

[duplication] ~5-~5: Possible typo: you repeated a word
Context: ...attributeconfig method is not working the theCellarIdSet` type, therefore whenever ...

(ENGLISH_WORD_REPEAT_RULE)


## Notes

For some reason, the `type_attribute` config method is not working the the `CellarIdSet` type, therefore whenever `prost_build` gets run, we have to manually add the `serde::Deserialize` and `serde::Serialize` attributes to it.
Copy link

Choose a reason for hiding this comment

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

Fix the typo.

There is a repeated word "the" in the sentence.

-  is not working the the `CellarIdSet` type
+  is not working with the `CellarIdSet` type
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
For some reason, the `type_attribute` config method is not working the the `CellarIdSet` type, therefore whenever `prost_build` gets run, we have to manually add the `serde::Deserialize` and `serde::Serialize` attributes to it.
For some reason, the `type_attribute` config method is not working with the `CellarIdSet` type, therefore whenever `prost_build` gets run, we have to manually add the `serde::Deserialize` and `serde::Serialize` attributes to it.
Tools
LanguageTool

[duplication] ~5-~5: Possible typo: you repeated a word
Context: ...attributeconfig method is not working the theCellarIdSet` type, therefore whenever ...

(ENGLISH_WORD_REPEAT_RULE)

Comment on lines +7 to +8
// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated.
// We need this right now because gogoproto codegen needs to import the extension.
Copy link

Choose a reason for hiding this comment

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

Offer assistance for the TODO comment.

The TODO comment indicates a pending migration to protov2.

Do you want me to help with the migration to protov2 or open a GitHub issue to track this task?

@cbrit cbrit merged commit cec0a52 into main Jul 18, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants