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

chore: Change Query/DenomTrace gRPC #1312

Closed
wants to merge 10 commits into from

Conversation

catShaark
Copy link
Contributor

Description

Change the DenomTrace grpc so that it takes the whole ibc denom instead of just the hash

closes: #101


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

codecov-commenter commented Apr 29, 2022

Codecov Report

Merging #1312 (7e2318e) into main (7bb609c) will decrease coverage by 0.02%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1312      +/-   ##
==========================================
- Coverage   80.27%   80.25%   -0.03%     
==========================================
  Files         166      166              
  Lines       12023    12026       +3     
==========================================
  Hits         9652     9652              
- Misses       1916     1918       +2     
- Partials      455      456       +1     
Impacted Files Coverage Δ
modules/apps/transfer/keeper/grpc_query.go 75.00% <83.33%> (-3.27%) ⬇️

@catShaark catShaark marked this pull request as ready for review April 29, 2022 05:31
Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

Thanks, @catShaark. I left just a couple of nits. And we need a changelog entry. :) Since this changing the API, then I would say in the API breaking section.

modules/apps/transfer/keeper/grpc_query.go Outdated Show resolved Hide resolved
modules/apps/transfer/keeper/grpc_query.go Outdated Show resolved Hide resolved
@catShaark catShaark changed the title change Query/DenomTrace gRPC chore: Change Query/DenomTrace gRPC May 3, 2022
@@ -21,10 +21,10 @@ func (suite *KeeperTestSuite) TestQueryDenomTrace() {
expPass bool
}{
{
"invalid hex hash",
"invalid ibc denom",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could we put the success case first? :=)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yesss

Copy link
Contributor

@seantking seantking left a comment

Choose a reason for hiding this comment

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

Great work!

Comment on lines +26 to +28
if !strings.HasPrefix(req.Denom, "ibc/") {
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid denom with no ibc prefix: %s", req.Denom))
}
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 we should make this change backwards compatible. We could do so by checking if it has the ibc prefix and then remove the prefix before performing the query. I should have specified this on the original issue (but at the time there was a lot less dependencies on this gRPC

So essentially:

if strings.HasPrefix(denom, "ibc/") {
    denom = denom[4:]
}

Copy link
Contributor Author

@catShaark catShaark May 4, 2022

Choose a reason for hiding this comment

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

If so, how should we name the field in the gRPC request, is it still denom, now that the field means denom or hash

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I'll make it like you said and leave the field name still be denom

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good suggestion from @colin-axner. If you make the change backwards compatible, then the changelog entry shouldn't be in the API breaking section, but in the improvements one instead.

Copy link
Contributor Author

@catShaark catShaark May 4, 2022

Choose a reason for hiding this comment

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

I'll apply the change accordingly and I'll change the field back to hash

@catShaark
Copy link
Contributor Author

catShaark commented May 5, 2022

I'll close this PR and make a new one #1342

@catShaark catShaark closed this May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DenomTrace gRPC should take in a IBC prefixed denom rather than a hash
5 participants