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

feat: add DenomOwners gRPC method for x/bank #9533

Merged
merged 16 commits into from
Jun 28, 2021

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Jun 17, 2021

Description

Adds a new gRPC method, DenomOwners, to the x/bank module. This method queries for all account addresses that own a particular token denomination (paginated). Naming subject to change based on reviews.

closes: #9393


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...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

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.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@alexanderbez alexanderbez added C:x/bank C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. labels Jun 17, 2021
@alexanderbez
Copy link
Contributor Author

alexanderbez commented Jun 17, 2021

@aaronc @AmauryM , can I please get confirmation/approval on naming of the gRPC method and it's types before I proceed with completing the PR?

@github-actions github-actions bot removed the C:x/bank label Jun 17, 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.

DenomOwners sounds fine to me 👍

proto/cosmos/bank/v1beta1/query.proto Outdated Show resolved Hide resolved
alexanderbez and others added 2 commits June 17, 2021 14:41
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
@alexanderbez alexanderbez changed the title feature: feature: add DenomOwners gRPC method for x/bank Jun 17, 2021
@alexanderbez alexanderbez changed the title feature: add DenomOwners gRPC method for x/bank feat: add DenomOwners gRPC method for x/bank Jun 17, 2021
@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #9533 (d3cb620) into master (0027111) will increase coverage by 25.23%.
The diff coverage is 62.90%.

❗ Current head d3cb620 differs from pull request most recent head 82a9488. Consider uploading reports for the commit 82a9488 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #9533       +/-   ##
===========================================
+ Coverage   35.48%   60.71%   +25.23%     
===========================================
  Files         332      588      +256     
  Lines       32620    37310     +4690     
===========================================
+ Hits        11575    22653    +11078     
+ Misses      19819    12703     -7116     
- Partials     1226     1954      +728     
Impacted Files Coverage Δ
client/keys/show.go 83.67% <ø> (-0.24%) ⬇️
client/keys/types.go 100.00% <ø> (+100.00%) ⬆️
client/keys/utils.go 42.85% <ø> (+2.50%) ⬆️
client/query.go 16.98% <ø> (ø)
client/rpc/block.go 10.00% <ø> (ø)
client/rpc/routes.go 100.00% <ø> (ø)
client/rpc/status.go 47.72% <ø> (ø)
client/rpc/validators.go 0.00% <ø> (ø)
client/test_helpers.go 0.00% <ø> (ø)
client/tx/factory.go 28.20% <ø> (ø)
... and 699 more

@alexanderbez alexanderbez marked this pull request as ready for review June 17, 2021 21:18
Copy link
Member

@aaronc aaronc left a comment

Choose a reason for hiding this comment

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

LGTM 🎉 . Since this is a query and not state breaking can we merge before 0.43 RC? or should we block @AmauryM @robert-zaremba ?

// QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query.
message QueryDenomOwnersResponse {
// addresses defines the set of addresses that own a particular denomination.
repeated string addresses = 1;
Copy link
Member

Choose a reason for hiding this comment

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

do we want to include balances here too?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that'd be useful too. @alexanderbez ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll make this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)

@amaury1093
Copy link
Contributor

OK to include this in 0.43. We can do a quick manual test once this is merged.

@alexanderbez
Copy link
Contributor Author

@AmauryM @aaronc can you follow up in #9393 (comment)? I'd like to know how to proceed with this PR.

@amaury1093
Copy link
Contributor

I'm personally fine to merge this PR as-is, include it in 0.43, though I think adding #9533 (comment) is useful.

If we add another index as per #9393, it's state breaking so would need to wait the next release. I would do that in a follow-up PR.

@alexanderbez
Copy link
Contributor Author

I'd be happy to tackle the reverse index issue after this is merged.

CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines +196 to +198
if req.Denom != balance.Denom {
return false, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I think we need to have an index to avoid unmarshaling and doing this step

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, #9590 should address this.

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!

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Jun 28, 2021
@mergify mergify bot merged commit d8059ff into master Jun 28, 2021
@mergify mergify bot deleted the bez/9393-bank-query-balance-holders branch June 28, 2021 14:40
@amaury1093 amaury1093 mentioned this pull request May 20, 2022
72 tasks
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/bank
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Bank.getAllHolders(denom) grpc/api
3 participants