-
Notifications
You must be signed in to change notification settings - Fork 213
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
Modify coin selection algorithm to support minting and burning #2725
Commits on Jul 6, 2021
-
Modify coin selection to support minting and burning
- Modifies "performSelection" to account for minted and burnt tokens. On a superficial level, mints provide extra tokens to use, where burns increase the amount of tokens we need to select. - Modifies the "makeChange" algorithm to account for minted and burnt tokens. When tokens are minted they are added to the largest change bundle. When tokens are burnt they are removed from the smallest change bundles until the burn has been satisfied. See the code for more detailed commentary. - Adds property tests that ensure the "addMintChange" and "removeBurnChange" family of functions: - maintain number of change bundles, - maintain partial ascending ordering of change bundles - modify the total value of the change bundle by their respective mint/burn amounts. - Adds a few unit tests to ensure the change generation occurs as we expect it to. - Adds some debugging information to the coin selection tests to make debugging in the presence of minting and burning easier.
Configuration menu - View commit details
-
Copy full SHA for 1ce4c75 - Browse repository at this point
Copy the full SHA 1ce4c75View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3818c7e - Browse repository at this point
Copy the full SHA 3818c7eView commit details -
Configuration menu - View commit details
-
Copy full SHA for ff7a2a6 - Browse repository at this point
Copy the full SHA ff7a2a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3854bc6 - Browse repository at this point
Copy the full SHA 3854bc6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f09d5d - Browse repository at this point
Copy the full SHA 4f09d5dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9bb91f7 - Browse repository at this point
Copy the full SHA 9bb91f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 66edfcb - Browse repository at this point
Copy the full SHA 66edfcbView commit details -
Refactor removeBurnValueFromChangeMaps
- Refactor removeBurnValueFromChangeMaps to make use of the "TokenQuantity.difference" and "TokenMap.adjustQuantity" functions, reducing the complexity of the implementation (thanks @jonathanknowles).
Configuration menu - View commit details
-
Copy full SHA for 5093d30 - Browse repository at this point
Copy the full SHA 5093d30View commit details -
Simplify TokenMap.difference with new TokenQuantity.difference func
- Use the new TokenQuantity.difference function to simplify the TokenMap.difference implementation (thanks @jonathanknowles).
Configuration menu - View commit details
-
Copy full SHA for e6d6d27 - Browse repository at this point
Copy the full SHA e6d6d27View commit details -
Further refactor "removeBurnValueFromChangeMaps"
- Further refactor "removeBurnValueFromChangeMaps" to split out the concepts of "subtracting a value from a list of values" and "using that new list to modify the quantities of an existing token map". Thanks @jonathanknowles.
Configuration menu - View commit details
-
Copy full SHA for ecde5a9 - Browse repository at this point
Copy the full SHA ecde5a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 52503e6 - Browse repository at this point
Copy the full SHA 52503e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5ed7da6 - Browse repository at this point
Copy the full SHA 5ed7da6View commit details -
Fix indentation, use monoid operator
Co-authored-by: Jonathan Knowles <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e646a26 - Browse repository at this point
Copy the full SHA e646a26View commit details -
Configuration menu - View commit details
-
Copy full SHA for ebd57d3 - Browse repository at this point
Copy the full SHA ebd57d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 810ee61 - Browse repository at this point
Copy the full SHA 810ee61View commit details -
Use scanl and treat generated qtys as diffs to get asc partial order
- Thanks to @jonathanknowles for this great suggestion.
Configuration menu - View commit details
-
Copy full SHA for 1f9a363 - Browse repository at this point
Copy the full SHA 1f9a363View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7890bd7 - Browse repository at this point
Copy the full SHA 7890bd7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 93109fd - Browse repository at this point
Copy the full SHA 93109fdView commit details
Commits on Jul 8, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 0ef7c04 - Browse repository at this point
Copy the full SHA 0ef7c04View commit details -
Minimize the responsibility of
makeChangeForNonUserSpecifiedOutputs
.This change moves the following responsibilities out of the `makeChangeForNonUserSpecifiedOutputs` function: - the removing of burned values - the addition of minted values This reduces the complexity of property and unit tests that test this function. The following functions are still checked by relevant properties: - `addMintValuesToChangeMaps` - `removeBurnValuesFromChangeMaps` Further changes will add unit tests to act as documentation and sanity checks for the above functions.
Configuration menu - View commit details
-
Copy full SHA for 44a6a89 - Browse repository at this point
Copy the full SHA 44a6a89View commit details -
Improve documentation for minting and burning.
This commit clarifies documentation and adds explanatory examples for several functions and fields relating to minting and burning.
Configuration menu - View commit details
-
Copy full SHA for 16ad726 - Browse repository at this point
Copy the full SHA 16ad726View commit details -
Make
missingOutputAssets
resilient to changes in `OutputsInsufficie……ntError`. We replace positional arguments with named arguments. (These arguments are all the same type, so can easily be switched.)
Configuration menu - View commit details
-
Copy full SHA for c1f46e6 - Browse repository at this point
Copy the full SHA c1f46e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 47ad1e2 - Browse repository at this point
Copy the full SHA 47ad1e2View commit details -
Fix comment for minimum ada quantity pre-condition of `performSelecti…
…on`. In response to review feedback: https:/input-output-hk/cardano-wallet/pull/2725/files#r655898541
Configuration menu - View commit details
-
Copy full SHA for a941675 - Browse repository at this point
Copy the full SHA a941675View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4657ea6 - Browse repository at this point
Copy the full SHA 4657ea6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 35ec8b9 - Browse repository at this point
Copy the full SHA 35ec8b9View commit details -
Simplify folds in
{addMint,removeBurn}values{To,From}ChangeMaps
.We remove the nested function composition in favour of simple function composition.
Configuration menu - View commit details
-
Copy full SHA for a44880e - Browse repository at this point
Copy the full SHA a44880eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 36e4cce - Browse repository at this point
Copy the full SHA 36e4cceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 902b75c - Browse repository at this point
Copy the full SHA 902b75cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 93c8948 - Browse repository at this point
Copy the full SHA 93c8948View commit details -
Configuration menu - View commit details
-
Copy full SHA for 28ba0a7 - Browse repository at this point
Copy the full SHA 28ba0a7View commit details -
Introduce minimal API change to support minting and burning error.
This error should currently never be thrown, as we do not currently provide a method for the user to mint or burn tokens through the API. Nevertheless, our test suite requires that we document the error in our API specification.
Configuration menu - View commit details
-
Copy full SHA for 5a10b15 - Browse repository at this point
Copy the full SHA 5a10b15View commit details -
Configuration menu - View commit details
-
Copy full SHA for 18be06b - Browse repository at this point
Copy the full SHA 18be06bView commit details -
Add the
TokenMap.intersection
function.This function will be used to verify coverage in coin selection properties.
Configuration menu - View commit details
-
Copy full SHA for 4b38d41 - Browse repository at this point
Copy the full SHA 4b38d41View commit details -
Configuration menu - View commit details
-
Copy full SHA for b02cb1a - Browse repository at this point
Copy the full SHA b02cb1aView commit details -
Enhance the generators for minted and burned assets in `genSelectionC…
…riteria`. In particular, we add coverage for the case where some minted values are not spent or burned, so we can trigger the `OutputsInsufficient` error.
Configuration menu - View commit details
-
Copy full SHA for 5b58f1b - Browse repository at this point
Copy the full SHA 5b58f1bView commit details -
Fix erroneous assertion in
onOutputsInsufficient
.This assertion should have been negated. The error was only revealed once we had deliberately tweaked the generator to generate selection criteria with some minted values that are not spent or burned.
Configuration menu - View commit details
-
Copy full SHA for 4d22d58 - Browse repository at this point
Copy the full SHA 4d22d58View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8eb87a8 - Browse repository at this point
Copy the full SHA 8eb87a8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 96b6a75 - Browse repository at this point
Copy the full SHA 96b6a75View commit details -
Add missing coverage for
prop_makeChange
.In the `genAssetsToMintAndBurn` subgenerator for `genMakeChangeData`, we deliberately create the possibliity of a non-empty intersection between the sets of assets to mint and assets to burn.
Configuration menu - View commit details
-
Copy full SHA for 378d35f - Browse repository at this point
Copy the full SHA 378d35fView commit details