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

Register gRPC Gateway routes #7173

Merged
merged 25 commits into from
Sep 4, 2020
Merged

Conversation

atheeshp
Copy link
Contributor

@atheeshp atheeshp commented Aug 26, 2020

ref: #5921
follow-up: #7019

  • Registers gRPC routes for:
    • x/auth
    • x/distribution
    • x/evidence
    • x/ibc
    • x/ibc-transfer
    • x/upgrade
  • Adds gRPC tests for x/{distribution, bank}

Description

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@atheeshp atheeshp changed the title Atheesh/5921 grpc gateway x auth routes Registers gRPC routes for x/{auth} Aug 26, 2020
@codecov
Copy link

codecov bot commented Aug 26, 2020

Codecov Report

Merging #7173 into master will increase coverage by 0.72%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #7173      +/-   ##
==========================================
+ Coverage   54.04%   54.77%   +0.72%     
==========================================
  Files         415      565     +150     
  Lines       30163    39134    +8971     
==========================================
+ Hits        16301    21434    +5133     
- Misses      12557    15932    +3375     
- Partials     1305     1768     +463     

@atheeshp atheeshp changed the title Registers gRPC routes for x/{auth} Registers gRPC routes for x/auth Aug 26, 2020
@atheeshp atheeshp changed the title Registers gRPC routes for x/auth Registers gRPC routes Aug 26, 2020
@anilcse anilcse changed the title Registers gRPC routes Register gRPC Gateway routes Aug 26, 2020
}{
{
"gRPC total account balance",
fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", baseURL, base64.URLEncoding.EncodeToString(val.Address)),
Copy link
Contributor

@amaury1093 amaury1093 Aug 28, 2020

Choose a reason for hiding this comment

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

Since the address path in the URL is defined as bytes in the proto files, and grpc-gateway decodes bytes with base64.URLEncoding, we (actually, any HTTP client really) need to encode the address as base64 URLEncoding first.

This has the unfortunate consequence of showing non-human-readable addresses in URLs:

+ /cosmos/bank/v1beta1/balances/u1-UOH-CHOvM2rNadSjtNARKkSk= // with base64
- /cosmos/bank/v1beta1/balances/cosmos1hd0egwrlsgwwhnx6kdd8228dxszy4yffnv2gtu // expected

What do people think here? Are you okay to use base64-encoded addresses in URLs?

If not, it's maybe worth to raise an issue on grpc-gateway to see if we can customize bytes decoding.

@aaronc aaronc mentioned this pull request Sep 1, 2020
43 tasks
@atheeshp atheeshp marked this pull request as ready for review September 3, 2020 11:14
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

lgtm 👍

x/bank/client/rest/grpc_query_test.go Outdated Show resolved Hide resolved
x/bank/client/rest/grpc_query_test.go Outdated Show resolved Hide resolved
@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Sep 3, 2020
@amaury1093
Copy link
Contributor

Could you rename the PR title to reflect the modules you changed in this PR?

x/ibc/module.go Outdated Show resolved Hide resolved
@amaury1093 amaury1093 removed the A:automerge Automatically merge PR once all prerequisites pass. label Sep 3, 2020
@atheeshp
Copy link
Contributor Author

atheeshp commented Sep 4, 2020

Could you rename the PR title to reflect the modules you changed in this PR?

Added all the addressed modules in description part of the PR.

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Sep 4, 2020
@mergify mergify bot merged commit 5df7dbc into master Sep 4, 2020
@mergify mergify bot deleted the atheesh/5921-grpc-gateway-x-auth-routes branch September 4, 2020 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants