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

Test the generation of change maps for non-user-specified assets. #2692

Merged

Conversation

jonathanknowles
Copy link
Member

@jonathanknowles jonathanknowles commented Jun 7, 2021

Issue Number

ADP-346

Overview

This PR:

  • extracts out function collateNonUserSpecifiedAssetQuantities.
  • extracts out function makeChangeForNonUserSpecifiedAssets.
  • adds property tests to verify the expected behaviour of each function.
  • adds unit tests to illustrate the expected behaviour of each function.

The collateNonUserSpecifiedAssetQuantities function is designed to produce a map of all assets that do NOT appear in the user-specified outputs of a coin selection. Each asset a is mapped to the complete list of discrete quantities of a found in the selected inputs.

The makeChangeForNonUserSpecifiedAssets function is designed to make a list of change maps for all assets that do NOT appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

@jonathanknowles jonathanknowles self-assigned this Jun 7, 2021
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/collateNonUserSpecifiedAssetQuantities branch from da08f18 to 6baac80 Compare June 7, 2021 11:35
discardUserSpecifiedAssets
:: TokenBundle
:: TokenMap
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that we're not interested in ada quantities here.

@jonathanknowles jonathanknowles mentioned this pull request Jun 7, 2021
5 tasks
@sevanspowell
Copy link
Contributor

This is great, thank you 👍

@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2692: Test the collation of non-user-specified asset quantities within `makeChange`. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- adds a property test to verify the expected behaviour.
- adds unit tests to illustrate the expected behaviour.

The `collateNonUserSpecifiedAssetQuantities` function is designed to product a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed:

   OPTIONS /wallets/0000000000000000000000000000000000000000/keys/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     POST /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
building of '/nix/store/5yz1ncjz74myklahsn2f0m5qrwhzz95b-cardano-wallet-core-test-unit-2021.5.26-check' timed out after 900 seconds of silence

#2472 (Mac)

Q: Could this also related to the MVar properties?

Comparing with https://hydra.iohk.io/build/6593101/nixlog/1/tail, starting from where this failure timed out:

OPTIONS /wallets/0000000000000000000000000000000000000000/keys/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     POST /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     PATCH /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     DELETE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     TRACE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0
     PUT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0H
     POST /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0H
     PATCH /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0H
     DELETE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0H
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0H
     TRACE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0H
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/mutable_account/0H
     PUT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234
     POST /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234
     PATCH /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234
     DELETE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234
     TRACE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234
     PUT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234H
     POST /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234H
     PATCH /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234H
     DELETE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234H
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234H
     TRACE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234H
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/mutable_account/1234H
     PUT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/2147483647
     POST /wallets/0000000000000000000000000000000000000000/keys/mutable_account/2147483647
     PATCH /wallets/0000000000000000000000000000000000000000/keys/mutable_account/2147483647
     DELETE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/2147483647
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/mutable_account/2147483647
     TRACE /wallets/0000000000000000000000000000000000000000/keys/mutable_account/2147483647
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/mutable_account/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0H
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0H
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0H
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0H
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0H
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0H
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_external/0H
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234H
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234H
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234H
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234H
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234H
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234H
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_external/1234H
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/2147483647
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_external/2147483647
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_external/2147483647
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/2147483647
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_external/2147483647
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_external/2147483647
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_external/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0H
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0H
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0H
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0H
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0H
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0H
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/0H
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234H
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234H
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234H
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234H
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234H
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234H
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/1234H
     PUT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/2147483647
     POST /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/2147483647
     PATCH /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/2147483647
     DELETE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/2147483647
     CONNECT /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/2147483647
     TRACE /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/2147483647
     OPTIONS /wallets/0000000000000000000000000000000000000000/keys/utxo_internal/2147483647
     GET /wallets/0000000000000000000000000000000000000000/migrations
     PUT /wallets/0000000000000000000000000000000000000000/migrations
     PATCH /wallets/0000000000000000000000000000000000000000/migrations
     DELETE /wallets/0000000000000000000000000000000000000000/migrations
     CONNECT /wallets/0000000000000000000000000000000000000000/migrations
     TRACE /wallets/0000000000000000000000000000000000000000/migrations
     OPTIONS /wallets/0000000000000000000000000000000000000000/migrations
     GET /wallets/0000000000000000000000000000000000000000/migrations/plan
     PUT /wallets/0000000000000000000000000000000000000000/migrations/plan
     PATCH /wallets/0000000000000000000000000000000000000000/migrations/plan
     DELETE /wallets/0000000000000000000000000000000000000000/migrations/plan
     CONNECT /wallets/0000000000000000000000000000000000000000/migrations/plan
     TRACE /wallets/0000000000000000000000000000000000000000/migrations/plan
     OPTIONS /wallets/0000000000000000000000000000000000000000/migrations/plan
     GET /wallets/0000000000000000000000000000000000000000/passphrase
     POST /wallets/0000000000000000000000000000000000000000/passphrase
     PATCH /wallets/0000000000000000000000000000000000000000/passphrase
     DELETE /wallets/0000000000000000000000000000000000000000/passphrase
     CONNECT /wallets/0000000000000000000000000000000000000000/passphrase
     TRACE /wallets/0000000000000000000000000000000000000000/passphrase
     OPTIONS /wallets/0000000000000000000000000000000000000000/passphrase
     GET /wallets/0000000000000000000000000000000000000000/payment-fees
     PUT /wallets/0000000000000000000000000000000000000000/payment-fees
     PATCH /wallets/0000000000000000000000000000000000000000/payment-fees
     DELETE /wallets/0000000000000000000000000000000000000000/payment-fees
     CONNECT /wallets/0000000000000000000000000000000000000000/payment-fees
     TRACE /wallets/0000000000000000000000000000000000000000/payment-fees
     OPTIONS /wallets/0000000000000000000000000000000000000000/payment-fees
     GET /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0
     PUT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0
     GET /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0H
     PUT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0H
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0H
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0H
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0H
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0H
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/0H
     GET /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234
     PUT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234
     GET /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234H
     PUT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234H
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234H
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234H
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234H
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234H
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/1234H
     GET /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/2147483647
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/2147483647
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/2147483647
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/2147483647
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/2147483647
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/mutable_account/2147483647
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0H
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0H
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0H
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0H
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0H
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0H
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/0H
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234H
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234H
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234H
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234H
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234H
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234H
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/1234H
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/2147483647
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/2147483647
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/2147483647
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/2147483647
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/2147483647
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_external/2147483647
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0H
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0H
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0H
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0H
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0H
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0H
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/0H
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234H
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234H
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234H
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234H
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234H
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234H
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/1234H
     GET /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/2147483647
     PATCH /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/2147483647
     DELETE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/2147483647
     CONNECT /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/2147483647
     TRACE /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/2147483647
     OPTIONS /wallets/0000000000000000000000000000000000000000/signatures/utxo_internal/2147483647
     PUT /wallets/0000000000000000000000000000000000000000/stake-keys
     POST /wallets/0000000000000000000000000000000000000000/stake-keys
     PATCH /wallets/0000000000000000000000000000000000000000/stake-keys
     DELETE /wallets/0000000000000000000000000000000000000000/stake-keys
     CONNECT /wallets/0000000000000000000000000000000000000000/stake-keys
     TRACE /wallets/0000000000000000000000000000000000000000/stake-keys
     OPTIONS /wallets/0000000000000000000000000000000000000000/stake-keys
     PUT /wallets/0000000000000000000000000000000000000000/statistics/utxos
     POST /wallets/0000000000000000000000000000000000000000/statistics/utxos
     PATCH /wallets/0000000000000000000000000000000000000000/statistics/utxos
     DELETE /wallets/0000000000000000000000000000000000000000/statistics/utxos
     CONNECT /wallets/0000000000000000000000000000000000000000/statistics/utxos
     TRACE /wallets/0000000000000000000000000000000000000000/statistics/utxos
     OPTIONS /wallets/0000000000000000000000000000000000000000/statistics/utxos
     PUT /wallets/0000000000000000000000000000000000000000/transactions
     PATCH /wallets/0000000000000000000000000000000000000000/transactions
     DELETE /wallets/0000000000000000000000000000000000000000/transactions
     CONNECT /wallets/0000000000000000000000000000000000000000/transactions
     TRACE /wallets/0000000000000000000000000000000000000000/transactions
     OPTIONS /wallets/0000000000000000000000000000000000000000/transactions
     PUT /wallets/0000000000000000000000000000000000000000/transactions/0000000000000000000000000000000000000000000000000000000000000000
     POST /wallets/0000000000000000000000000000000000000000/transactions/0000000000000000000000000000000000000000000000000000000000000000
     PATCH /wallets/0000000000000000000000000000000000000000/transactions/0000000000000000000000000000000000000000000000000000000000000000
     CONNECT /wallets/0000000000000000000000000000000000000000/transactions/0000000000000000000000000000000000000000000000000000000000000000
     TRACE /wallets/0000000000000000000000000000000000000000/transactions/0000000000000000000000000000000000000000000000000000000000000000
     OPTIONS /wallets/0000000000000000000000000000000000000000/transactions/0000000000000000000000000000000000000000000000000000000000000000
     PUT /wallets/0000000000000000000000000000000000000000/utxo
     POST /wallets/0000000000000000000000000000000000000000/utxo
     PATCH /wallets/0000000000000000000000000000000000000000/utxo
     DELETE /wallets/0000000000000000000000000000000000000000/utxo
     CONNECT /wallets/0000000000000000000000000000000000000000/utxo
     TRACE /wallets/0000000000000000000000000000000000000000/utxo
     OPTIONS /wallets/0000000000000000000000000000000000000000/utxo
Cardano.Wallet.DB.MVar
  MVar
    Extra Properties about DB initialization
      createWallet . listWallets yields expected results
        +++ OK, passed 100 tests.
      creating same wallet twice yields an error
        +++ OK, passed 100 tests.
      removing the same wallet twice yields an error
        +++ OK, passed 100 tests.
    put . read yields a result

Not sure to what extent log lines could be buffered / yet to be shown, but it would have to be quite a lot of them for this to be a MVar property timeout.

@jonathanknowles jonathanknowles changed the title Test the collation of non-user-specified asset quantities within makeChange. Test the generation of change maps for non-user-specified assets. Jun 8, 2021
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/collateNonUserSpecifiedAssetQuantities branch 3 times, most recently from 1775a16 to 8f2e54d Compare June 8, 2021 05:59
@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2680: Update cardano-node to 1.27.0. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-914

# Overview

Updates the dependencies of `cardano-wallet` to include version 1.27.0 of `cardano-node`.

2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed (retrying...):

Failure:

src/Test/Integration/Framework/DSL.hs:971:11:

1) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them

     Quantity {getQuantity = 0} does not satisfy (&gt; Quantity {getQuantity = 0})

     While verifying (Status {statusCode = 200, statusMessage = "OK"},Right (ApiWallet {id = ApiT {getApiT = WalletId {getWalletId = 4828e1ca3ef03e7fdf30b166fa16520f483f6b2e}}, addressPoolGap = ApiT {getApiT = AddressPoolGap {getAddressPoolGap = 20}}, balance = ApiWalletBalance {available = Quantity {getQuantity = 999998855100}, total = Quantity {getQuantity = 999998855100}, reward = Quantity {getQuantity = 0}}, assets = ApiWalletAssetsBalance {available = ApiT {getApiT = TokenMap (fromList [])}, total = ApiT {getApiT = TokenMap (fromList [])}}, delegation = ApiWalletDelegation {active = ApiWalletDelegationNext {status = Delegating, target = Just (ApiT {getApiT = PoolId {getPoolId = "\236(\243=\203\230\214@\n\RS^3\155\208d\|\ts\202l\f\249\194\187\230\131\141\198"}}), changesAt = Nothing}, next = []}, name = ApiT {getApiT = WalletName {getWalletName = "Faucet Wallet"}}, passphrase = Just (ApiWalletPassphraseInfo {lastUpdatedAt = 2021-06-08 08:30:58.823407645 UTC}), state = ApiT {getApiT = Ready}, tip = ApiBlockReference {absoluteSlotNumber = ApiT {getApiT = SlotNo 4249}, slotId = ApiSlotId {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 84}}, slotNumber = ApiT {getApiT = SlotInEpoch {unSlotInEpoch = 49}}}, time = 2021-06-08 08:32:47.8 UTC, block = ApiBlockInfo {height = Quantity {getQuantity = 1496}}}}))

     Waited longer than 90s to resolve action: "Wallet gets rewards".
cardano-wallet

To rerun use: --match "/API Specifications/SHELLEY_STAKE_POOLS/STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them/"
cardano-wallet

src/Test/Integration/Framework/DSL.hs:971:11:

2) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_04 - Rewards accumulate

     Quantity {getQuantity = 0} does not satisfy (&gt; Quantity {getQuantity = 0})

     While verifying (Status {statusCode = 200, statusMessage = "OK"},Right (ApiWallet {id = ApiT {getApiT = WalletId {getWalletId = 08e85bba85772dae58b18193182614952e478cec}}, addressPoolGap = ApiT {getApiT = AddressPoolGap {getAddressPoolGap = 20}}, balance = ApiWalletBalance {available = Quantity {getQuantity = 999998855100}, total = Quantity {getQuantity = 999998855100}, reward = Quantity {getQuantity = 0}}, assets = ApiWalletAssetsBalance {available = ApiT {getApiT = TokenMap (fromList [])}, total = ApiT {getApiT = TokenMap (fromList [])}}, delegation = ApiWalletDelegation {active = ApiWalletDelegationNext {status = Delegating, target = Just (ApiT {getApiT = PoolId {getPoolId = "\236(\243=\203\230\214@\n\RS^3\155\208d\|\ts\202l\f\249\194\187\230\131\141\198"}}), changesAt = Nothing}, next = []}, name = ApiT {getApiT = WalletName {getWalletName = "Faucet Wallet"}}, passphrase = Just (ApiWalletPassphraseInfo {lastUpdatedAt = 2021-06-08 08:31:25.725897931 UTC}), state = ApiT {getApiT = Ready}, tip = ApiBlockReference {absoluteSlotNumber = ApiT {getApiT = SlotNo 4352}, slotId = ApiSlotId {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 87}}, slotNumber = ApiT {getApiT = SlotInEpoch {unSlotInEpoch = 2}}}, time = 2021-06-08 08:33:08.4 UTC, block = ApiBlockInfo {height = Quantity {getQuantity = 1543}}}}))

     Waited longer than 90s to resolve action: "Wallet gets rewards".
cardano-wallet

To rerun use: --match "/API Specifications/SHELLEY_STAKE_POOLS/STAKE_POOLS_JOIN_04 - Rewards accumulate/"
cardano-wallet

src/Test/Integration/Framework/DSL.hs:971:11:

3) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_LIST_01 - List stake pools, has non-zero saturation &amp; stake

     Quantity {getQuantity = Percentage {getPercentage = 0 % 1}} does not satisfy (&gt; Quantity {getQuantity = Percentage {getPercentage = 0 % 1}})

     While verifying (Status {statusCode = 200, statusMessage = "OK"},Right [ApiStakePool {id = ApiT {getApiT = PoolId {getPoolId = "\236(\243=\203\230\214@\n\RS^3\155\208d\|\ts\202l\f\249\194\187\230\131\141\198"}}, metrics = ApiStakePoolMetrics {nonMyopicMemberRewards = Quantity {getQuantity = 627337175132}, relativeStake = Quantity {getQuantity = Percentage {getPercentage = 0 % 1}}, saturation = 8.105442711135319e-6, producedBlocks = Quantity {getQuantity = 1}}, metadata = Nothing, cost = Quantity {getQuantity = 0}, margin = Quantity {getQuantity = Percentage {getPercentage = 1 % 10}}, pledge = Quantity {getQuantity = 2000000000000}, retirement = Nothing, flags = []},ApiStakePool {id = ApiT {getApiT = PoolId {getPoolId = "\180Wh\193\162\218K\209&gt;\188\170\RS\165\DC4\b\237\163\GS\204!v\\\203\212\a\205\169\242"}}, metrics = ApiStakePoolMetrics {nonMyopicMemberRewards = Quantity {getQuantity = 479836022907}, relativeStake = Quantity {getQuantity = Percentage {getPercentage = 4307 % 10000}}, saturation = 1.2921513072316304, producedBlocks = Quantity {getQuantity = 908}}, metadata = Nothing, cost = Quantity {getQuantity = 0}, margin = Quantity {getQuantity = Percentage {getPercentage = 1 % 10}}, pledge = Quantity {getQuantity = 1000000000000}, retirement = Just (ApiEpochInfo {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 100000}}, epochStartTime = 2021-06-19 22:05:18 UTC}), flags = []},ApiStakePool {id = ApiT {getApiT = PoolId {getPoolId = "\187\DC1L\179}u\250\ENQ&amp;\ETX(\194\&amp;5\163\218\226\149\163=\v\166t\165\235\RS&gt;V\142"}}, metrics = ApiStakePoolMetrics {nonMyopicMemberRewards = Quantity {getQuantity = 456823856704}, relativeStake = Quantity {getQuantity = Percentage {getPercentage = 4477 % 10000}}, saturation = 1.3432376892064584, producedBlocks = Quantity {getQuantity = 927}}, metadata = Nothing, cost = Quantity {getQuantity = 0}, margin = Quantity {getQuantity = Percentage {getPercentage = 1 % 10}}, pledge = Quantity {getQuantity = 1000000000000}, retirement = Just (ApiEpochInfo {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 1000000}}, epochStartTime = 2021-10-02 02:05:18 UTC}), flags = []}])

#2415

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed:

Timed out here:

Cardano.Wallet.DB.MVar
  MVar
    Extra Properties about DB initialization
      createWallet . listWallets yields expected results
        +++ OK, passed 100 tests.
      creating same wallet twice yields an error
        +++ OK, passed 100 tests.
      removing the same wallet twice yields an error
        +++ OK, passed 100 tests.
    put . read yields a result
      Checkpoint
        +++ OK, passed 100 tests.
      Wallet Metadata
        +++ OK, passed 100 tests.
      Tx History
        +++ OK, passed 100 tests.
      Private Key
        +++ OK, passed 100 tests.
    getTx properties
      can read after putting tx history for valid tx id
        +++ OK, passed 100 tests.
      cannot read after putting tx history for invalid tx id
        +++ OK, passed 100 tests.
      cannot read after putting tx history for invalid wallet id
        +++ OK, passed 100 tests; 9 discarded.
    can't put before wallet exists
      Checkpoint
        +++ OK, passed 100 tests.
      Wallet Metadata
        +++ OK, passed 100 tests.
      Tx History
        +++ OK, passed 100 tests.
      Private Key
        +++ OK, passed 100 tests.
    put doesn't affect other resources
      Checkpoint vs Wallet Metadata & Tx History & Private Key
building of '/nix/store/2kaha7iv2qj7b5sylz88ydsbnclh9iy8-cardano-wallet-core-test-unit-2021.5.26-check' timed out after 900 seconds of silence

#2472 (Mac)

@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

2693: Allow specifying purpose for acc x pub r=paweljakubas a=paweljakubas

# Issue Number

<!-- Put here a reference to the issue that this PR relates to and which requirements it tackles. Jira issues of the form ADP- will be auto-linked. -->
adp-950

# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] updated swagger
- [x] enable passing purpose
- [x] adjust core unit tests
- [x] add integration test
- [x] guard purpose with integration test  


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!--
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
Co-authored-by: Pawel Jakubas <pawel.jakubas@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed (retrying...):

[69 of 89] Compiling Cardano.Wallet.Api.Types ( src/Cardano/Wallet/Api/Types.hs, dist/build/Cardano/Wallet/Api/Types.o, dist/build/Cardano/Wallet/Api/Types.dyn_o )
/nix/store/ih4r8m73xxgxpn3g6w8bp97s4ybj22pl-stdenv-linux/setup: line 1310:   117 Killed                  $SETUP_HS build lib:cardano-wallet-core -j$(($NIX_BUILD_CORES > 4 ? 4 : $NIX_BUILD_CORES))
builder for '/nix/store/ivrv78d7ic4wzfc52q51hnwmgpk0c164-cardano-wallet-core-lib-cardano-wallet-core-2021.5.26.drv' failed with exit code 137

@jonathanknowles
Copy link
Member Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Already running a review

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed:

    Making change
      prop_makeChange_identity
        +++ OK, passed 1000 tests.
      prop_makeChange_length
        +++ OK, passed 100 tests (92% able to generate split change).

        largest asset set sizes (unsplit change, split change) (100 in total):
        16% (12,6)
        15% (10,5)
        12% (13,6)
        12% (14,7)
        10% (11,5)
         7% (8,4)
         7% (9,4)
         5% (1,1)
         3% (0,0)
         3% (15,7)
         3% (16,8)
         2% (6,3)
         1% (2,1)
         1% (3,1)
         1% (4,2)
         1% (5,2)
         1% (7,3)
      prop_makeChange
        +++ OK, passed 1000 tests:
        92.4% success
         5.7% cost too big
         1.9% min value too big
      makeChange example #1
      makeChange example #2
      makeChange example #3
    Collating non-user specified asset quantities
      prop_collateNonUserSpecifiedAssetQuantities
        +++ OK, passed 800 tests:
        73.4% both sets non-empty
building of '/nix/store/7ji8npdp6p63lf25ymk8k7vqkj4hcgin-cardano-wallet-core-test-unit-2021.5.26-check' timed out after 900 seconds of silence

#2703

@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2691: Additional checks for listing stake keys in e2e tests r=piotr-iohk a=piotr-iohk

# Issue Number

<!-- Put here a reference to the issue that this PR relates to and which requirements it tackles. Jira issues of the form ADP- will be auto-linked. -->


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [ ] Additional checks for listing stake keys in e2e tests


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!--
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Piotr Stachyra <piotr.stachyra@iohk.io>
Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed (retrying...):

Preprocessing test suite 'unit' for cardano-wallet-core-2021.5.26..
Building test suite 'unit' for cardano-wallet-core-2021.5.26..
[ 1 of 59] Compiling Cardano.Byron.Codec.CborSpec ( test/unit/Cardano/Byron/Codec/CborSpec.hs, dist/build/unit/unit-tmp/Cardano/Byron/Codec/CborSpec.o, dist/build/unit/unit-tmp/Cardano/Byron/Codec/CborSpec.dyn_o )
building of '/nix/store/vh1avljqjlwpbph1rjhakznahc9b2hsv-cardano-wallet-core-test-unit-2021.5.26' timed out after 900 seconds of silenc

#2703

@jonathanknowles
Copy link
Member Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Already running a review

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed:

Failure:

  src/Test/Integration/Scenario/API/Shelley/Transactions.hs:335:22:
  1) API Specifications, SHELLEY_TRANSACTIONS, TRANS_CREATE_01x - Single Output Transaction
       While verifying (Status {statusCode = 200, statusMessage = "OK"},Right (ApiWallet {id = ApiT {getApiT = WalletId {getWalletId = a64a62c65b6ce7829d002452bc235a32beea87c6}}, addressPoolGap = ApiT {getApiT = AddressPoolGap {getAddressPoolGap = 20}}, balance = ApiWalletBalance {available = Quantity {getQuantity = 1869500}, total = Quantity {getQuantity = 1869500}, reward = Quantity {getQuantity = 0}}, assets = ApiWalletAssetsBalance {available = ApiT {getApiT = TokenMap (fromList [])}, total = ApiT {getApiT = TokenMap (fromList [])}}, delegation = ApiWalletDelegation {active = ApiWalletDelegationNext {status = NotDelegating, target = Nothing, changesAt = Nothing}, next = []}, name = ApiT {getApiT = WalletName {getWalletName = "Empty Wallet"}}, passphrase = Just (ApiWalletPassphraseInfo {lastUpdatedAt = 2021-06-08 16:57:47.554275 UTC}), state = ApiT {getApiT = Ready}, tip = ApiBlockReference {absoluteSlotNumber = ApiT {getApiT = SlotNo 3293}, slotId = ApiSlotId {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 65}}, slotNumber = ApiT {getApiT = SlotInEpoch {unSlotInEpoch = 43}}}, time = 2021-06-08 16:58:29.6 UTC, block = ApiBlockInfo {height = Quantity {getQuantity = 1632}}}}))
[cardano-wallet.network:Warning:50918] [2021-06-08 17:13:53.40 UTC] Connection lost with the node.
[cardano-wallet.network:Warning:50722] [2021-06-08 17:13:53.40 UTC] Connection lost with the node.
[cardano-wallet.network:Warning:50449] [2021-06-08 17:13:53.42 UTC] Connection lost with the node.
[cardano-wallet.network:Warning:50890] [2021-06-08 17:13:53.42 UTC] Connection lost with the node.
       expected: Quantity {getQuantity = 0}
        but got: Quantity {getQuantity = 1869500}

  To rerun use: --match "/API Specifications/SHELLEY_TRANSACTIONS/TRANS_CREATE_01x - Single Output Transaction/"

Randomized with seed 275432475

@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 8, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 8, 2021

Build failed:

#duplicate (Cached failure)

@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 9, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 9, 2021

Build failed:

(Cached failure)
#duplicate

This function computes the value assigned to `nonUserSpecifiedAssets`,
so that the expected behaviour can be tested in isolation.
This change makes it very clear that the contents of the supplied list
are not used in any way by the function: the list is used only for its
length.
…dAsset`.

The `makeChangeForNonUserSpecifiedAsset` function ignores the contents
of the list parameter, and only uses the list as a proxy for the desired
length of the output.

Therefore, within our tests for this function, there's no point in going
to the effort of generating values to put in the list.
This function computes the value assigned to `changeForNonUserSpecifiedAssets`,
so that the expected behaviour can be tested in isolation.
These unit tests illustrate how the function is expected to behave when
different assets have different numbers of token quantities.
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/collateNonUserSpecifiedAssetQuantities branch from 8f2e54d to 68a5854 Compare June 9, 2021 03:29
@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 9, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 9, 2021

Build failed:

(Cached failure)
#duplicate

@jonathanknowles
Copy link
Member Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jun 9, 2021
2692: Test the generation of change maps for non-user-specified assets. r=jonathanknowles a=jonathanknowles

# Issue Number

ADP-346

# Overview

This PR:
- extracts out function `collateNonUserSpecifiedAssetQuantities`.
- extracts out function `makeChangeForNonUserSpecifiedAssets`.
- adds property tests to verify the expected behaviour of each function.
- adds unit tests to illustrate the expected behaviour of each function.

The `collateNonUserSpecifiedAssetQuantities` function is designed to produce a map of all assets that do **NOT** appear in the user-specified outputs of a coin selection. Each asset `a` is mapped to the complete list of discrete quantities of `a` found in the selected inputs.

The `makeChangeForNonUserSpecifiedAssets` function is designed to make a list of change maps for all assets that do **NOT** appear in the user-specified outputs of coin selection. The number of change maps is intended to be exactly equal to the number of user-specified outputs.

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 9, 2021

Build failed:

(Cached failure: will try restarting the parts of the build that failed, to clear the cached failure.)
#duplicate

@jonathanknowles
Copy link
Member Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 9, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit b37bdb6 into master Jun 9, 2021
@iohk-bors iohk-bors bot deleted the jonathanknowles/collateNonUserSpecifiedAssetQuantities branch June 9, 2021 12:39
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.

None yet

2 participants