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

auth: query all accounts stored via gRPC #8522

Merged
merged 18 commits into from
Feb 22, 2021
Merged

auth: query all accounts stored via gRPC #8522

merged 18 commits into from
Feb 22, 2021

Conversation

RiccardoM
Copy link
Contributor

Description

This PR adds the ability to query all the accounts stored on the chain, which might be particularly useful to third party projects like Juno when parsing the chain data from scratch starting at a given height.

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

@codecov
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

Merging #8522 (dd80814) into master (0b3af0e) will increase coverage by 0.00%.
The diff coverage is 61.76%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8522   +/-   ##
=======================================
  Coverage   61.47%   61.47%           
=======================================
  Files         659      659           
  Lines       37876    37910   +34     
=======================================
+ Hits        23283    23304   +21     
- Misses      12159    12166    +7     
- Partials     2434     2440    +6     
Impacted Files Coverage Δ
x/auth/client/cli/query.go 38.70% <61.11%> (+3.80%) ⬆️
x/auth/keeper/grpc_query.go 61.11% <62.50%> (+1.11%) ⬆️

@amaury1093 amaury1093 added C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. C:x/auth labels Feb 5, 2021
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, thanks. proto-docs.md should also be updated, it should be updated automatically when running make proto-all

proto/cosmos/auth/v1beta1/query.proto Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query.go Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@RiccardoM
Copy link
Contributor Author

RiccardoM commented Feb 5, 2021

lgtm, thanks. proto-docs.md should also be updated, it should be updated automatically when running make proto-all

I can't run this because I get the following error:

make proto-gen
Generating Protobuf files
/usr/bin/docker run --rm -v /home/robert/go/src/github.com/cosmos/cosmos-sdk:/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh
W0207 21:47:23.959599     362 services.go:38] No HttpRule found for method: Msg.GrantAuthorization
W0207 21:47:23.959691     362 services.go:38] No HttpRule found for method: Msg.ExecAuthorized
...
--doc_out: could not find protoc plugin for name doc
make: *** [Makefile:372: proto-gen] Error 1

P.S. It looks like I'm not the only one: https://discord.com/channels/669268347736686612/680435043570941973/808093567779602442

RiccardoM and others added 3 commits February 8, 2021 07:27
Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Amaury <amaury.martiny@protonmail.com>
@amaury1093
Copy link
Contributor

I can't run this because I get the following error:

Could you try deleting your Docker containers and running the command again from a fresh start?

@RiccardoM
Copy link
Contributor Author

I can't run this because I get the following error:

Could you try deleting your Docker containers and running the command again from a fresh start?

Ok I just pulled tendermintdev/sdk-proto-gen and tendermintdev/docker-build-proto and it worked

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.

utACK

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

ACK minor comment. Don't you need to also add the auth client cmd?

x/auth/keeper/grpc_query.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query.go Outdated Show resolved Hide resolved
@RiccardoM
Copy link
Contributor Author

RiccardoM commented Feb 22, 2021

ACK minor comment. Don't you need to also add the auth client cmd?

Do you think we should add both CLI and REST client commands, or only the CLI one?

Since there's the willing to eventually deprecate the REST APIs, I'd implement only the CLI query.

@amaury1093
Copy link
Contributor

Yes, CLI is enough. The non-legacy REST endpoint "/cosmos/auth/v1beta1/accounts" will be handled by grpc-gateway automatically.

@RiccardoM
Copy link
Contributor Author

Yes, CLI is enough. The non-legacy REST endpoint "/cosmos/auth/v1beta1/accounts" will be handled by grpc-gateway automatically.

Perfect, should have added it

CHANGELOG.md Outdated Show resolved Hide resolved
@fedekunze fedekunze added the A:automerge Automatically merge PR once all prerequisites pass. label Feb 22, 2021
@fedekunze fedekunze changed the title Added the ability to query all accounts stored using gRPC auth: query all accounts stored via gRPC Feb 22, 2021
@mergify mergify bot merged commit c2be53a into cosmos:master Feb 22, 2021
@RiccardoM RiccardoM deleted the auth-accounts-query branch April 29, 2021 13:03
zakir-code pushed a commit to FunctionX/cosmos-sdk that referenced this pull request Apr 14, 2022
* Added the ability to query all accounts stored using gRPC

* Added CHANGELOG entry

* Fixed linting errors

* Update CHANGELOG.md

Co-authored-by: Amaury <amaury.martiny@protonmail.com>

* Update proto/cosmos/auth/v1beta1/query.proto

Co-authored-by: Amaury <amaury.martiny@protonmail.com>

* Run make proto-all

* Merged origin/master

* Applied suggestions

* Added CLI command

* Updated CHANGELOG

* Fixed merge conflicts

Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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. C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. C:x/auth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants