-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix(x/auth): update proto address conversion query to prevent duplicate HTTP binding #23357
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThis pull request addresses HTTP binding issues for address conversion methods in the Cosmos SDK. The changes modify the Changes
Sequence DiagramsequenceDiagram
participant Client
participant Server
participant AddressConverter
Client->>Server: Request AddressBytesToString
Server->>AddressConverter: Convert bytes to string
AddressConverter-->>Server: Return string representation
Server-->>Client: Respond with converted address
Client->>Server: Request AddressStringToBytes
Server->>AddressConverter: Convert string to bytes
AddressConverter-->>Server: Return byte representation
Server-->>Client: Respond with converted address
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Finishing Touches
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
|
…uplicate-annotation
…uplicate-annotation
This comment has been minimized.
This comment has been minimized.
@julienrbrt i imagine this should be backported to v0.52 and thats where i should put the changelog entry? i imagine we may want to tag a minor bump for the |
Correct it should be backported. x/auth isn't an extracted module from the SDK, so the changelog should only be in CHANGELOG.md. Once merged you can do the following: git checkout main
git pull
git tag api/v0.8.2 -m 'Release api v0.8.2' -s
git push Afterwards instead of using the pseudo version in the backport PR from mergify, just use v0.8.2 |
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: 1
🧹 Nitpick comments (3)
api/cosmos/auth/v1beta1/query.pulsar.go (3)
Line range hint
52-53
: Consider documenting the expected account types.The
accounts
field usesgoogle.protobuf.Any
for flexibility, but it would be helpful to document which concrete account types can be expected here for better type safety and easier client implementation.
9530-9537
: Document error handling for address conversion endpoints.The HTTP bindings for address conversion should document possible error cases and their corresponding HTTP status codes, especially for invalid addresses or encoding/decoding failures.
9551-9562
: Consider adding pagination support for AccountInfo queries.For consistency with other query endpoints and to handle large result sets efficiently, consider adding pagination support to the AccountInfo query endpoint.
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (7)
client/grpc/reflection/reflection.pb.go
is excluded by!**/*.pb.go
server/v2/cometbft/go.sum
is excluded by!**/*.sum
server/v2/go.sum
is excluded by!**/*.sum
simapp/v2/go.sum
is excluded by!**/*.sum
tests/go.sum
is excluded by!**/*.sum
x/auth/types/query.pb.go
is excluded by!**/*.pb.go
x/auth/types/query.pb.gw.go
is excluded by!**/*.pb.gw.go
📒 Files selected for processing (6)
api/cosmos/auth/v1beta1/query.pulsar.go
(2 hunks)proto/cosmos/auth/v1beta1/query.proto
(1 hunks)server/v2/cometbft/go.mod
(1 hunks)server/v2/go.mod
(1 hunks)simapp/v2/go.mod
(1 hunks)tests/go.mod
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
tests/go.mod (1)
Pattern tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
api/cosmos/auth/v1beta1/query.pulsar.go (1)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze
- GitHub Check: Summary
🔇 Additional comments (6)
proto/cosmos/auth/v1beta1/query.proto (3)
66-71
: LGTM! Good approach to maintain backward compatibility.The additional binding for the decode endpoint provides better clarity while maintaining the original endpoint for backward compatibility.
73-77
: Endpoint path now better reflects the operation.The change from
/bech32/{address_string}
to/bech32/encode/{address_string}
improves API clarity by explicitly indicating the operation type.
79-84
: LGTM! No functional changes.Only formatting changes were made to improve code readability.
server/v2/cometbft/go.mod (1)
17-17
: LGTM! Consistent version update.The version update is consistent with other modules.
tests/go.mod (1)
6-6
: LGTM! Consistent version update.The version update is consistent with other modules.
simapp/v2/go.mod (1)
6-6
: LGTM! Consistent version update.The version update is consistent with other modules.
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
🧹 Nitpick comments (4)
CHANGELOG.md (4)
Line range hint
1-1
: Add missing title to the CHANGELOG fileThe file should start with a # title like "# Changelog" for better documentation.
+ # Changelog
60-60
: Fix inconsistent bullet point styleThe bullet point style is inconsistent with the rest of the file. Other entries use
-
while this one uses*
.- * (x/auth) [#23357](https://github.com/cosmos/cosmos-sdk/pull/23357) Fixes accessibility of the AddressStringToBytes HTTP binding and adds another binding to AddressBytesToString. + * (x/auth) [#23357](https://github.com/cosmos/cosmos-sdk/pull/23357) Fixes accessibility of the AddressStringToBytes HTTP binding and adds another binding to AddressBytesToString.
Line range hint
785-790
: Fix broken link formattingThe link to previous versions contains raw markdown that should be properly formatted.
- [CHANGELOG of previous versions](https://github.com/cosmos/cosmos-sdk/blob/c17c3caab86a1426a1eef4541e8203f5f54a1a54/CHANGELOG.md#v0391---2020-08-11) (pre Stargate). + See [CHANGELOG of previous versions](https://github.com/cosmos/cosmos-sdk/blob/c17c3caab86a1426a1eef4541e8203f5f54a1a54/CHANGELOG.md#v0391---2020-08-11) for changes before Stargate.
Line range hint
791-793
: Remove unnecessary code blockThere's an empty code block at the end of the file that should be removed.
- ```
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (7)
client/grpc/reflection/reflection.pb.go
is excluded by!**/*.pb.go
server/v2/cometbft/go.sum
is excluded by!**/*.sum
server/v2/go.sum
is excluded by!**/*.sum
simapp/v2/go.sum
is excluded by!**/*.sum
tests/go.sum
is excluded by!**/*.sum
x/auth/types/query.pb.go
is excluded by!**/*.pb.go
x/auth/types/query.pb.gw.go
is excluded by!**/*.pb.gw.go
📒 Files selected for processing (7)
CHANGELOG.md
(1 hunks)api/cosmos/auth/v1beta1/query.pulsar.go
(2 hunks)proto/cosmos/auth/v1beta1/query.proto
(1 hunks)server/v2/cometbft/go.mod
(1 hunks)server/v2/go.mod
(1 hunks)simapp/v2/go.mod
(1 hunks)tests/go.mod
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
tests/go.mod (1)
Pattern tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
CHANGELOG.md (1)
Pattern **/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"
api/cosmos/auth/v1beta1/query.pulsar.go (1)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Analyze
- GitHub Check: test-system-v2
- GitHub Check: Summary
🔇 Additional comments (12)
api/cosmos/auth/v1beta1/query.pulsar.go (4)
9530-9537
: HTTP bindings for address conversion have been updated correctlyThe HTTP bindings for address conversion methods have been properly updated with distinct endpoints:
/cosmos/auth/v1beta1/bech32/decode/{address_bytes}
for bytes to string conversion/cosmos/auth/v1beta1/bech32/{address_bytes}
as an alternative endpoint
9538-9550
: HTTP binding for address string to bytes conversion is properly definedThe endpoint
/cosmos/auth/v1beta1/bech32/encode/{address_string}
is correctly defined for string to bytes conversion, maintaining API consistency.
Line range hint
16-24
: Message definitions follow protobuf best practicesThe message definitions properly use the Any type for account interfaces and include appropriate pagination support. The code follows protobuf best practices for message definitions.
9562-9575
: Package metadata is properly configuredThe generated code includes complete package metadata with proper Go package path and protobuf options. The metadata ensures correct integration with the Cosmos SDK.
proto/cosmos/auth/v1beta1/query.proto (4)
66-71
: Well-structured HTTP bindings for address decoding!The addition of a more descriptive
/decode/
endpoint while maintaining the original endpoint for backward compatibility is a good approach.
73-77
: Consistent HTTP binding pattern for address encoding!The endpoint now follows a consistent pattern with its decode counterpart, using
/encode/
to clearly indicate its purpose.
79-84
: LGTM - Well-documented RPC method!The method includes all necessary annotations for versioning, safety, and HTTP binding.
66-84
: Verify no remaining duplicate HTTP bindings.Let's ensure there are no other duplicate HTTP bindings in the codebase.
✅ Verification successful
HTTP bindings verification successful ✅
The changes have successfully eliminated duplicate HTTP bindings, and no other duplicates were found in the codebase. The new encode/decode path segments are properly organized.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for duplicate HTTP bindings in proto files # Expected: No duplicate GET paths should be found # Find all proto files and extract HTTP GET paths rg -t proto 'option \(google\.api\.http\).*get:.*"([^"]+)"' -o | sort | uniq -d # Also check additional_bindings rg -t proto 'additional_bindings.*get:.*"([^"]+)"' -o | sort | uniq -dLength of output: 214
Script:
#!/bin/bash # Find all proto files first, then search within them fd '\.proto$' | xargs rg 'get: "([^"]+)"' -o | sort | uniq -c | awk '$1 > 1 {print $0}'Length of output: 89
server/v2/go.mod (1)
12-12
: Verify the accessibility of the pseudo-version.The dependency update to
cosmossdk.io/api v0.8.2-0.20250114014050-e279d7cec391
uses a pseudo-version with a timestamp from 2025. This future date might cause issues with dependency resolution.server/v2/cometbft/go.mod (1)
17-17
: Consistent dependency update.The update to
cosmossdk.io/api v0.8.2-0.20250114014050-e279d7cec391
aligns with the version used in other modules, maintaining consistency across the codebase.tests/go.mod (1)
6-6
: Consistent dependency update.The update to
cosmossdk.io/api v0.8.2-0.20250114014050-e279d7cec391
aligns with the version used in other modules, maintaining consistency across the codebase.simapp/v2/go.mod (1)
6-6
: Consistent dependency update.The update to
cosmossdk.io/api v0.8.2-0.20250114014050-e279d7cec391
aligns with the version used in other modules, maintaining consistency across the codebase.
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.
Can we add system tests for these end points?
imho that isn't necessary, we have an unit test for it. system tests are expensive in CI time, and this isn't a critical flow and that would basically mean testing the grpc gateway implementation. |
Description
Closes: #23281
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
Dependency Updates
cosmossdk.io/api
dependency to versionv0.8.2-0.20250114014050-e279d7cec391
across multiple modulesAPI Modifications