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 bech32 prefix to authkeeper #9759

Merged
merged 73 commits into from
Aug 25, 2021

Conversation

cyberbono3
Copy link
Contributor

@cyberbono3 cyberbono3 commented Jul 23, 2021

Description

Closes Step1 from #9690

  • Add auth keeper methods and gRPC queries:
    • the NewAccountKeeper should take a string bech32Prefix argument
    • auth AccountKeeper implements Codec interface that contains 2 methods: ConvertAddressStringToBytes and ConvertAddressBytesToString
    • Add the 3 following gRPC queries:
      • Get bech32 prefix
      • AddressStringToBytes (converts AccountAddr string to AccountAddr bytes)
      • AddressBytesToString ( converts AccountAddr bytes to AccountAddr str)
    • Add the corresponding keeper methods
    • Add tests

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)

@codecov
Copy link

codecov bot commented Jul 23, 2021

Codecov Report

Merging #9759 (3d2d5b0) into master (147d798) will decrease coverage by 0.00%.
The diff coverage is 60.00%.

❗ Current head 3d2d5b0 differs from pull request most recent head 4d2a866. Consider uploading reports for the commit 4d2a866 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9759      +/-   ##
==========================================
- Coverage   63.75%   63.74%   -0.01%     
==========================================
  Files         566      567       +1     
  Lines       53402    53422      +20     
==========================================
+ Hits        34048    34056       +8     
- Misses      17435    17445      +10     
- Partials     1919     1921       +2     
Impacted Files Coverage Δ
types/address.go 68.69% <ø> (ø)
x/auth/keeper/bech32_codec.go 55.00% <55.00%> (ø)
x/auth/keeper/grpc_query.go 48.00% <60.00%> (-9.15%) ⬇️
x/auth/keeper/keeper.go 52.72% <66.66%> (-14.60%) ⬇️
simapp/app.go 81.66% <100.00%> (ø)
crypto/keys/internal/ecdsa/privkey.go 82.45% <0.00%> (-1.76%) ⬇️
x/auth/vesting/types/msgs.go 0.00% <0.00%> (ø)

@cyberbono3 cyberbono3 force-pushed the cyberbono3/add-bech32Prefix-to-authkeeper branch from c71015f to c78a879 Compare July 23, 2021 16:48
@orijbot
Copy link

orijbot commented Jul 23, 2021

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

@cyberbono3 cyberbono3 force-pushed the cyberbono3/add-bech32Prefix-to-authkeeper branch from c78a879 to 7da481f Compare July 23, 2021 16:52
@cyberbono3 cyberbono3 force-pushed the cyberbono3/add-bech32Prefix-to-authkeeper branch from 7da481f to 556810d Compare July 23, 2021 16:54
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.

looks like a good start. I'm not sure the proto field names are perfect, but can't think of anything else for now

simapp/app.go Outdated Show resolved Hide resolved
x/auth/atlas/atlas-v0.39.1.md Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/keeper_test.go Outdated Show resolved Hide resolved
x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
@cyberbono3 cyberbono3 changed the title Add bech32 prefix to authkeeper refactor!: Add bech32 prefix to authkeeper Jul 26, 2021
@cyberbono3 cyberbono3 changed the title refactor!: Add bech32 prefix to authkeeper feat!: Add bech32 prefix to authkeeper Jul 26, 2021
@github-actions github-actions bot added the C:CLI label Jul 26, 2021
@cyberbono3 cyberbono3 marked this pull request as ready for review July 26, 2021 14:53
Copy link
Contributor

@blushi blushi left a comment

Choose a reason for hiding this comment

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

Looks good overall, just left a couple comments

x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
cyberbono3 and others added 3 commits August 24, 2021 15:04
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
@amaury1093
Copy link
Contributor

amaury1093 commented Aug 24, 2021

LGTM. Are we just bypassing address verification for now in the auth keeper?

Actually we still do it! We just use the global config for now, let's tackle that in a separate PR (added an item in #9690). See https://github.com/cosmos/cosmos-sdk/pull/9759/files#diff-c73f18717271f4171c3ae22f928c5ab7b9890185a9101828252dacab71e78545R31

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 overall, small nits around not exporting too many public methods

x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Show resolved Hide resolved
x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
cyberbono3 and others added 7 commits August 24, 2021 15:46
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
@cyberbono3
Copy link
Contributor Author

cyberbono3 commented Aug 24, 2021

@AmauryM I addressed your comments, can you take one more look, please?

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.

came up with some new comments while re-reviewing

x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
x/auth/keeper/keeper.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/auth/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
cyberbono3 and others added 3 commits August 25, 2021 13:13
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
@cyberbono3 cyberbono3 force-pushed the cyberbono3/add-bech32Prefix-to-authkeeper branch 2 times, most recently from ab34ebf to 16f55fc Compare August 25, 2021 10:51
@cyberbono3 cyberbono3 force-pushed the cyberbono3/add-bech32Prefix-to-authkeeper branch from 16f55fc to fb9e5a3 Compare August 25, 2021 10:53
@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Aug 25, 2021
@mergify mergify bot merged commit 59640fb into master Aug 25, 2021
@mergify mergify bot deleted the cyberbono3/add-bech32Prefix-to-authkeeper branch August 25, 2021 11:17
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes **Step1** from cosmos#9690

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

- Add auth keeper methods and gRPC queries:
  - the `NewAccountKeeper` should take a `string bech32Prefix` argument
  - ` auth AccountKeeper` implements `Codec` interface that contains 2 methods:  `ConvertAddressStringToBytes` and `ConvertAddressBytesToString` 
  - Add the 3 following gRPC queries:
    - Get bech32 prefix
    - `AddressStringToBytes` (converts `AccountAddr` string to `AccountAddr` bytes)
    - `AddressBytesToString` ( converts `AccountAddr` bytes to `AccountAddr` str)
  - Add the corresponding keeper methods
  - Add tests
---

### 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)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [x] 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) 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)
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 C:x/bank
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants