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 cli for listing all module accounts #9812

Merged
merged 10 commits into from
Aug 2, 2021

Conversation

mattverse
Copy link
Contributor

@mattverse mattverse commented Jul 29, 2021

Description

This PR adds a CLI for querying all module accounts, module-accounts, in the auth module.
Using this command would display all the account information, including human readable name of the module, module account address, account number, permissions, etc.

This command would be especially useful for developers using cosmos-sdk as there are lots of instances where a developer would have to look into the module account, but only to do so by getting the module account address after getting the module name, hashing it and bech32fying it in the status quo. By using this command, users would be able to get a quick look on the list of all module accounts' information.


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)

@mattverse mattverse changed the title Mattverse/cli module accounts feat: Add cli for listing all module accounts Jul 29, 2021
@codecov
Copy link

codecov bot commented Jul 30, 2021

Codecov Report

Merging #9812 (5041d18) into master (36ab23a) will increase coverage by 0.04%.
The diff coverage is 25.64%.

❗ Current head 5041d18 differs from pull request most recent head 17f7208. Consider uploading reports for the commit 17f7208 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9812      +/-   ##
==========================================
+ Coverage   63.47%   63.51%   +0.04%     
==========================================
  Files         566      566              
  Lines       53107    53134      +27     
==========================================
+ Hits        33711    33750      +39     
+ Misses      17488    17470      -18     
- Partials     1908     1914       +6     
Impacted Files Coverage Δ
x/auth/client/cli/query.go 1.98% <0.00%> (-0.18%) ⬇️
x/auth/keeper/grpc_query.go 57.14% <52.63%> (-1.69%) ⬇️
x/gov/client/testutil/deposits.go 94.11% <0.00%> (-0.73%) ⬇️
x/gov/client/cli/query.go 0.00% <0.00%> (ø)
x/auth/keeper/keeper.go 67.32% <0.00%> (+15.84%) ⬆️

Copy link
Contributor

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request! This is a nice addition!

Manually tested with no issues. Looks like you have a linting error and there is room to improve the code coverage. Maybe a test for the command? I left a few minor suggestions as well.

x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
proto/cosmos/auth/v1beta1/query.proto Outdated Show resolved Hide resolved
x/auth/client/cli/query.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query.go Outdated Show resolved Hide resolved
@mattverse
Copy link
Contributor Author

@ryanchristo Cool! Thanks for the awesome review comments!

Made the changes on the lint problems and wrote an additional test case.

Code coverage is tricky as I can't omit a failure in the request iteself, although I did add a test case for checking for a module name that doesn't exist on the new commit!

Thanks!

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK 👏

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
Copy link
Contributor

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

tACK. Please address the suggestions above but otherwise looks good to me. Nice work!

@mattverse
Copy link
Contributor Author

@ryanchristo Acknowledged and Changes made, committed the updates! Thanks :)

@ryanchristo ryanchristo added the A:automerge Automatically merge PR once all prerequisites pass. label Aug 2, 2021
@mergify mergify bot merged commit 42e28e2 into cosmos:master Aug 2, 2021
@orijbot
Copy link

orijbot commented Aug 2, 2021

Visit https://dashboard.github.orijtech.com?pr=9812&repo=cosmos%2Fcosmos-sdk to see benchmark details.

mattverse added a commit to osmosis-labs/cosmos-sdk that referenced this pull request May 23, 2022
## Description

This PR adds a CLI for querying all module accounts, `module-accounts`, in the auth module. 
Using this command would display all the account information, including human readable name of the module, module account address, account number, permissions, etc. 

This command would be especially useful for developers using cosmos-sdk as there are lots of instances where a developer would have to look into the module account, but only to do so by getting the module account address after getting the module name, hashing it and bech32fying it in the status quo. By using this command, users would be able to get a quick look on the list of all module accounts' information.


---

### 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] 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...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] 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
- [x] reviewed tests and test coverage
- [x] manually tested (if applicable)
mergify bot pushed a commit to osmosis-labs/cosmos-sdk that referenced this pull request May 25, 2022
cref: cosmos#9812

## Description

This PR adds a CLI for querying all module accounts, `module-accounts`, in the auth module. 
Using this command would display all the account information, including human readable name of the module, module account address, account number, permissions, etc. 

This command would be especially useful for developers using cosmos-sdk as there are lots of instances where a developer would have to look into the module account, but only to do so by getting the module account address after getting the module name, hashing it and bech32fying it in the status quo. By using this command, users would be able to get a quick look on the list of all module accounts' information.


---

### 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] 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...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] 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
- [x] reviewed tests and test coverage
- [x] manually tested (if applicable)
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:CLI C:x/auth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants