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(cli): add acc-address by id cli and grpc gateway api #12199

Merged
merged 36 commits into from
Jun 15, 2022
Merged

feat(cli): add acc-address by id cli and grpc gateway api #12199

merged 36 commits into from
Jun 15, 2022

Conversation

gsk967
Copy link
Contributor

@gsk967 gsk967 commented Jun 8, 2022

Description

Closes: #12155

This pull request contains the address-by-id cli cmd and grpc gateway api request for account address retrieval by id

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)

x/auth/keeper/grpc_query.go Fixed Show fixed Hide fixed
x/auth/keeper/grpc_query.go Fixed Show fixed Hide fixed
@gsk967 gsk967 changed the title feat(cli): add account by id cli and grpc api feat(cli): add acc-address by id cli and grpc gateway api Jun 9, 2022
@gsk967 gsk967 marked this pull request as ready for review June 9, 2022 06:26
@gsk967 gsk967 requested a review from a team as a code owner June 9, 2022 06:26
@gsk967 gsk967 requested a review from likhita-809 June 9, 2022 11:13
proto/cosmos/auth/v1beta1/query.proto Outdated Show resolved Hide resolved
proto/cosmos/auth/v1beta1/query.proto 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/types/keys.go Outdated Show resolved Hide resolved
@gsk967 gsk967 requested a review from alexanderbez June 9, 2022 16:37
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.

nice work!

x/auth/keeper/account.go Outdated Show resolved Hide resolved
x/auth/migrations/v046/store.go Outdated Show resolved Hide resolved
x/auth/types/keys.go Outdated Show resolved Hide resolved
x/auth/types/keys.go Outdated Show resolved Hide resolved
gsk967 and others added 2 commits June 14, 2022 10:40
@gsk967 gsk967 requested a review from alexanderbez June 14, 2022 05:41
@atheeshp
Copy link
Contributor

atheeshp commented Jun 14, 2022

@gsk967 can you look into the failing tests?

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.

LGTM! Great work!

Looks like x/auth/migrations/v046/store_test.go is empty though? We probably want a simple test or two there.

@gsk967
Copy link
Contributor Author

gsk967 commented Jun 15, 2022

@alexanderbez @likhita-809 add state migration test cases , Please look into changes.

@gsk967 gsk967 requested a review from alexanderbez June 15, 2022 08:21
x/auth/keeper/migrations.go Show resolved Hide resolved
x/auth/keeper/migrations.go Outdated Show resolved Hide resolved
}

// V45_SetAccount implements V45_SetAccount
// set the account without map to accAddr to accNumber
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// set the account without map to accAddr to accNumber
// set the account without map to accAddr to accNumber.
//
// NOTE: This is used for testing purposes only.

@alexanderbez alexanderbez added the backport/0.46.x PR scheduled for inclusion in the v0.46's next stable release label Jun 15, 2022
@alexanderbez alexanderbez merged commit 4385325 into cosmos:main Jun 15, 2022
mergify bot pushed a commit that referenced this pull request Jun 15, 2022
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.

I left some suggestions for API improvements

@@ -24,6 +24,11 @@ service Query {
option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}";
}

// AccountAddressByID returns account address based on account id
rpc AccountAddressByID(QueryAccountAddressByIDRequest) returns (QueryAccountAddressByIDResponse) {
Copy link
Contributor

Choose a reason for hiding this comment

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

AccountAddressByID seems like a weird name to me. Do people use the term "ID"?

I would call it AddressByAccountNumber or AddressByAccNum


// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method
message QueryAccountAddressByIDRequest{
int64 id = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this int64, when account_number is uint64 everywhere?

@@ -24,6 +24,11 @@ service Query {
option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}";
}

// AccountAddressByID returns account address based on account id
Copy link
Contributor

Choose a reason for hiding this comment

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

This is missing a Since proto comment


// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method
message QueryAccountAddressByIDResponse {
string account_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Copy link
Contributor

Choose a reason for hiding this comment

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

Would rename this field to address simply, which makes it consistent with some other places

@alexanderbez
Copy link
Contributor

If we can't rename the proto fields (too late), then we can at least update the CLI command name and gRPC routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/0.46.x PR scheduled for inclusion in the v0.46's next stable release C:CLI C:x/auth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CLI query to auth for account-by-id
5 participants