-
Notifications
You must be signed in to change notification settings - Fork 217
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
Minting edge cases and additional testing #3226
Conversation
423348f
to
52b2a1b
Compare
a031620
to
fa51158
Compare
lib/core-integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs
Outdated
Show resolved
Hide resolved
- use 4-character indents. - avoid variable-length indentation. - limit line lengths to 80 characters where practical. - use only a single blank line between top-level definitions. https://input-output-hk.github.io/adrestia/code/Coding-Standards
a66f71e
to
e038cbc
Compare
It's easier to identify and reuse an existing constructor if the list is sorted into alphabetical order.
Rename `CreatedTransactionWithTooLongAssetName` to `AssetNameTooLong`. This error message implies that we've actually created a transaction. But if an asset name is too long, then it isn't possble for us to have created a transaction. Therefore, we can't say that we've created one. Additionally, if an asset name is too long, then it's too long in all contexts. Therefore, it's enough to say that "the asset name is too long": we don't actually need to state the context. We already use this style in other areas. For example: - AssetNotPresent - WalletAlreadyExists
Rename `CreatedTransactionWithIncorrectAssetQuantity` to `AssetQuantityOutOfBounds`. If an asset quantity is out of bounds, then it's impossible for us to say we have created a transaction. Therefore, it's enough to say "asset quantity out of bounds". The `AssetQuantityOutOfBounds` error name is consistent with other existing error names: - `AssetNameTooLong` - `AssetNotPresent` - `AssetQuantityOutOfBounds`
The upper limit is 32 bytes, but this does not necessarily correspond to 16 characters. According to the UTF-8 standard, Unicode code points can require between 1 and 4 bytes to encode.
1f382d1
to
3846b54
Compare
Mention that the upper limit is equal to 2^63-1.
3846b54
to
da85cf4
Compare
Emphasise that when an address is not specified, that minted assets will be returned to the wallet as change, and that change addresses will assigned automatically.
- Move this constant to `Primitive.Types.Tx`, so that it is located together with similar constants. - Redefine it in terms of `Int64` rather that `Int`, which may be platform specific. - Rename it to `txMintBurnMaxTokenQuantity`, to emphasise that it only relates to minting and burning.
Rename `AssetQuantityOutOfBounds` to `MintOrBurnAssetQuantityOutOfBounds`. The upper limit for a token quantity in the `mint` field of a transaction is actually different from the upper limit for a token quantity in an ordinary transaction output. So we use a more specific name to emphasise this difference.
This name was a bit confusing, because it could be interpreted as being "a token name of the maximum length", when in actuality it is "the maximum length of a token name".
This is consistant with other constants in the `Tx` module.
bors r+ |
3226: Minting edge cases and additional testing r=jonathanknowles a=paweljakubas <!-- Detail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: * Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. * Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. * Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> Edge cases addressed: - [x] We now reject asset names that are too long. - [x] We now reject asset quantities that are out of bounds. - [x] We now accept empty asset names. - [x] We now handle minting to foreign addresses. ### Comments <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number ADP-1542 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Co-authored-by: Pawel Jakubas <jakubas.pawel@gmail.com> Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
Just running e2e tests against this branch (5f54412) -> https://github.com/input-output-hk/cardano-wallet/runs/6037549759?check_suite_focus=true. And it seems I now get this:
even when I construct tx that does not include |
bors r- |
Canceled. |
Hi @piotr-iohk. Thanks for posting! Just want to ask your opinion: if we think it's a requirement that the end-to-end test suite passes before a PR is merged, then what would you think about us incorporating the end-to-end test suite into CI? Otherwise, if some essential test is not included in CI, I think it becomes trickier to reason about whether a PR should be merged or not. I would hope that we can make CI our single source of truth for whether a PR should be merged or not. (I definitely wouldn't have expected a merge to be cancelled for a test failure that's not part of CI, so this cancellation caught me by surprise! I hope we can figure out a way to avoid this kind of scenario. 😄 ) Of course, as you point out, if it is genuinely broken, then we definitely should add an integration test to cover this failure. Thanks for your help! |
@jonathanknowles @piotr-iohk I will push a fix for this very soon |
bors r+ |
Maybe that's something to discuss. From the top of my head I see two issues:
On the other hand full e2e suite is run nightly so potential issues should be caught the next day. In practice those issues should be only those that cannot be caught with integration tests so it, I guess, it should be ok. |
Build succeeded: |
3236: Adjust e2e tests for minting/burning edge cases r=piotr-iohk a=piotr-iohk <!-- Detail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: * Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. * Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. * Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] Adjust e2e tests for minting/burning edge cases ### Comments Adjust tests after #3226. ### Issue Number adp-1542 Co-authored-by: Piotr Stachyra <piotr.stachyra@iohk.io>
Edge cases addressed:
Comments
Issue Number
ADP-1542