-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(x/tx): add aminoNameAsTypeURL
option in aminojson encoder
#21712
Conversation
aminoNameAsTypeURL
option in aminojson encoderaminoNameAsTypeURL
option in aminojson encoder
WalkthroughWalkthroughThe pull request introduces significant changes across multiple files in the Changes
Assessment against linked issues
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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)
client/v2/CHANGELOG.md (1)
46-49
: Add the pull request number for reference.The addition of the "Improvements" section and the description of the change to marshal the
type
field as a proto message URL in queries is well-documented.However, please add the pull request number in the format
[#<pr-number>](https://github.com/cosmos/cosmos-sdk/pull/<pr-number>)
for reference.x/tx/CHANGELOG.md (1)
38-38
: Add the pull request number for traceability.The addition of the
AminoNameAsTypeURL
option to the Amino JSON encoder aligns with the PR objective of improving the serialization of Proto types into Amino types.Please add the pull request number in the format
[#<pr-number>]
for better traceability:-* [#](https://github.com/cosmos/cosmos-sdk/pull/) Add `AminoNameAsTypeURL` option to Amino JSON encoder. +* [#21712](https://github.com/cosmos/cosmos-sdk/pull/21712) Add `AminoNameAsTypeURL` option to Amino JSON encoder.
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (6)
- client/v2/CHANGELOG.md (1 hunks)
- client/v2/autocli/query.go (1 hunks)
- x/tx/CHANGELOG.md (1 hunks)
- x/tx/signing/aminojson/any.go (2 hunks)
- x/tx/signing/aminojson/json_marshal.go (5 hunks)
- x/tx/signing/aminojson/options.go (1 hunks)
Additional context used
Path-based instructions (6)
x/tx/signing/aminojson/any.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/tx/signing/aminojson/options.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/v2/CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"client/v2/autocli/query.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/tx/CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"x/tx/signing/aminojson/json_marshal.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (11)
x/tx/signing/aminojson/any.go (2)
53-53
: LGTM!The change to include the
aminoNameAsTypeURL
option in thebeginMarshal
call is consistent with the PR objective and does not introduce any new issues.
76-76
: LGTM!The change to include the
aminoNameAsTypeURL
option in thebeginMarshal
call is applied consistently and does not introduce any new issues.x/tx/signing/aminojson/options.go (2)
35-36
: LGTM!The change enhances the modularity of the code by separating the URL retrieval logic into its own function. This improves readability and maintainability while preserving the overall functionality.
Line range hint
38-51
: LGTM!The new
getMessageTypeURL
function correctly retrieves the message URL using the message's full name orgogoproto.MessageName
. It handles the case when the message URL is not found by returning an empty string. The function is well-structured and follows the Uber Go Style Guide.client/v2/CHANGELOG.md (1)
48-49
: The missing pull request number has already been addressed in the previous comment.client/v2/autocli/query.go (1)
122-127
: LGTM!The addition of the
AminoNameAsTypeURL
field to theEncoderOptions
struct, with a value oftrue
, aligns with the PR objective of treating Amino names as Type URLs when serializing messages. This change should improve the handling of thetype
field in queries, shifting from the amino name format to the proto message URL format.The code change follows the Uber Go Style Guide, and the existing fields in the struct remain unchanged, maintaining the overall structure and behavior.
x/tx/signing/aminojson/json_marshal.go (5)
35-37
: LGTM!The new
AminoNameAsTypeURL
field in theEncoderOptions
struct is well-documented and provides a useful option for configuring the JSON output.
56-56
: LGTM!The new
aminoNameAsTypeURL
field in theEncoder
struct aligns with the corresponding option inEncoderOptions
.
87-92
: LGTM!The
NewEncoder
function correctly initializes theaminoNameAsTypeURL
field and other fields based on the provided options.
171-172
: LGTM!The
Marshal
method correctly passes theenc.aminoNameAsTypeURL
value to thebeginMarshal
method to control the encoding behavior.
Line range hint
188-200
: LGTM!The changes to the
beginMarshal
method introduce the flexibility to use either the type URL or the amino name based on theuseTypeUrl
flag. The logic for determining the message name is clear and covers all possible scenarios.
Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
Something is up with system tests, having a look |
) Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com> (cherry picked from commit 0c8ad9d) # Conflicts: # x/tx/CHANGELOG.md # x/tx/signing/aminojson/json_marshal.go # x/tx/signing/aminojson/json_marshal_test.go # x/tx/signing/aminojson/options.go
) Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com> (cherry picked from commit 0c8ad9d) # Conflicts: # client/v2/CHANGELOG.md # x/tx/CHANGELOG.md
… (#21797) Co-authored-by: Julien Robert <julien@rbrt.fr>
Description
Closes: #21261
Afterwards, I'll tag a new x/tx and bump it in autocli for 0.52 and 0.50 to make use of that new option.
before
$ simd q feegrant grant alice bob allowance: allowance: type: cosmos-sdk/BasicAllowance value: spend_limit: - amount: "100" denom: stake grantee: cosmos18ac8zvrnaezk9unff26sre7c22r07frzw4yavs granter: cosmos1x4gsc5t9n646y5csw2wqz3rjsym0dz2fczkztf
after
$ simd q feegrant grant alice bob allowance: allowance: type: /cosmos.feegrant.v1beta1.BasicAllowance value: spend_limit: - amount: "100" denom: stake grantee: cosmos18ac8zvrnaezk9unff26sre7c22r07frzw4yavs granter: cosmos1x4gsc5t9n646y5csw2wqz3rjsym0dz2fczkztf
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...
!
in the type prefix if API or client breaking changeCHANGELOG.md
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...
Summary by CodeRabbit
New Features
type
field now represented as a proto message URL.Improvements
AminoNameAsTypeURL
option for better type URL handling.Bug Fixes