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: transfer authz nits #3586

Merged
merged 2 commits into from
May 16, 2023
Merged

chore: transfer authz nits #3586

merged 2 commits into from
May 16, 2023

Conversation

damiannolan
Copy link
Member

Description

#3454 (comment)

  • Use nil to consume less gas and avoid potential pitfalls
  • Import separation

closes: #XXXX


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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@damiannolan damiannolan marked this pull request as ready for review May 16, 2023 09:55
Comment on lines -96 to +98
updatedTransferAuthz, ok := res.Updated.(*types.TransferAuthorization)
suite.Require().True(ok)

remainder := updatedTransferAuthz.Allocations[0].SpendLimit.AmountOf(sdk.DefaultBondDenom)
suite.Require().True(types.UnboundedSpendLimit().Equal(remainder))
suite.Require().True(res.Accept)
suite.Require().False(res.Delete)
suite.Require().Nil(res.Updated)
Copy link
Member Author

Choose a reason for hiding this comment

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

I was going to do a stateful lookup using the authz keeper to maintain the same checks but we don't actually register the transfer authorization for these tests, its bypassed. I think this is fine tho!

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

You are the greatest and best 🙏 ❤️

@codecov-commenter
Copy link

Codecov Report

Merging #3586 (3f8d824) into main (dc3c649) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3586   +/-   ##
=======================================
  Coverage   78.79%   78.79%           
=======================================
  Files         182      182           
  Lines       12688    12688           
=======================================
  Hits         9998     9998           
  Misses       2258     2258           
  Partials      432      432           
Impacted Files Coverage Δ
...ules/apps/transfer/types/transfer_authorization.go 92.04% <100.00%> (ø)

Copy link
Contributor

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

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

LGTM!

@damiannolan damiannolan enabled auto-merge (squash) May 16, 2023 11:18
@damiannolan damiannolan merged commit f6e8f03 into main May 16, 2023
@damiannolan damiannolan deleted the damian/transfer-authz-nits branch May 16, 2023 11:23
mergify bot pushed a commit that referenced this pull request May 16, 2023
…d limits (#3586)

(cherry picked from commit f6e8f03)

# Conflicts:
#	modules/apps/transfer/types/transfer_authorization.go
mergify bot pushed a commit that referenced this pull request May 16, 2023
…d limits (#3586)

(cherry picked from commit f6e8f03)

# Conflicts:
#	modules/apps/transfer/types/transfer_authorization.go
colin-axner pushed a commit that referenced this pull request May 16, 2023
* chore: optimise transfer authz to consume less gas for unbounded spend limits (#3586)

(cherry picked from commit f6e8f03)

# Conflicts:
#	modules/apps/transfer/types/transfer_authorization.go

* resolve conflicts

---------

Co-authored-by: Damian Nolan <[email protected]>
colin-axner pushed a commit that referenced this pull request May 16, 2023
* chore: optimise transfer authz to consume less gas for unbounded spend limits (#3586)

(cherry picked from commit f6e8f03)

# Conflicts:
#	modules/apps/transfer/types/transfer_authorization.go

* resolve conflicts

---------

Co-authored-by: Damian Nolan <[email protected]>
@faddat faddat mentioned this pull request Jun 23, 2023
9 tasks
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.

4 participants