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

authz/ics20: unit tests for Accept method of TransferAuthorization #2961

Closed
crodriguezvega opened this issue Dec 20, 2022 · 0 comments
Closed
Assignees
Labels
20-transfer testing Testing package and unit/integration tests
Milestone

Comments

@crodriguezvega
Copy link
Contributor

crodriguezvega commented Dec 20, 2022

Refactor existing test and convert it into table tests covering the following scenarios:

  • WHEN TransferAuthorization contains 1 allocation AND source port ID/channel ID in MsgTransfer matches the source port and channel of the allocation AND the recipient address in MsgTransfer is found in the allow_list:

    • AND the amount in MsgTransfer is greater than the available funds, THEN error is returned.
    • AND the amount in MsgTransfer is equal to available funds, THEN the updated TransferAuthorization is nil.
    • AND the amount in MsgTransfer is smaller than the available funds, THEN the spend limit in the updated TransferAuthorization is reduced by the amount in MsgTransfer.
  • WHEN TransferAuthorization contains 1 allocation AND the source port ID/channel ID in combination MsgTransfer does not match the source port and channel of the allocation, THEN an error is returned.

  • WHEN TransferAuthorization contains 1 allocation AND source port ID/channel ID in MsgTransfer matches the source port and channel of the allocation AND the allow_list is empty AND the amount in MsgTransfer is smaller than the available funds, THEN the spend limit in the updated TransferAuthorization is reduced by the amount in MsgTransfer.

  • WHEN TransferAuthorization contains 1 allocation AND the recipient address is not in found in the allow_list, THEN an error is returned.

- WHEN TransferAuthorization contains 1 allocation with empty source port and source channel AND the recipient address in MsgTransfer is found in the allow_list AND the amount in MsgTransfer is smaller than the available funds, then the spend limit in the updated TransferAuthorization is reduced by the amount in MsgTransfer.

  • WHEN TransferAuthorization contains 2 allocations AND source port ID/channel ID in MsgTransfer matches the source port and channel of one of the allocations AND the recipient address in MsgTransfer is found in the allow_list:
    • AND the amount in MsgTransfer is greater than the available funds for one allocation, THEN an error is returned.
    • AND the amount in MsgTransfer is equal to available funds for one allocation, THEN the updated TransferAuthorization contains only the other allocation.
    • AND the amount in MsgTransfer is smaller than the available funds for one allocation, THEN the spend limit for that allocation in the updated TransferAuthorization is reduced by the amount in MsgTransfer and two allocations are returned.

Open PRs against the feature branch.

@crodriguezvega crodriguezvega moved this to Todo in ibc-go Dec 20, 2022
@crodriguezvega crodriguezvega added this to the v7.0.0 milestone Dec 21, 2022
@crodriguezvega crodriguezvega changed the title Integration tests for Accept method for authz ics20 authz/ics20: unit tests for Accept method of TransferAuthorization Dec 21, 2022
@crodriguezvega crodriguezvega added the testing Testing package and unit/integration tests label Dec 21, 2022
@damiannolan damiannolan self-assigned this Jan 10, 2023
@damiannolan damiannolan moved this from Todo to In progress in ibc-go Jan 10, 2023
@github-project-automation github-project-automation bot moved this from In progress to Todo in ibc-go Jan 16, 2023
@damiannolan damiannolan moved this from Todo to Done in ibc-go Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
20-transfer testing Testing package and unit/integration tests
Projects
Status: Done 🥳
Development

No branches or pull requests

2 participants