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

Use Cardano API function calculateMinimumUTxO for minimum UTxO calculations. #3368

Merged
merged 36 commits into from
Jul 13, 2022

Commits on Jul 13, 2022

  1. Configuration menu
    Copy the full SHA
    ad11edb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f3b549 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    76c2756 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    45ba2f5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    55fad34 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    04af270 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    66f9086 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d6175a5 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    6f7de9b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    d32b55a View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    4935f26 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    03d1c6c View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    33f480f View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    c9a8558 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    aad2053 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    527529b View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    a46f500 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    ae5790f View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    d9c8cae View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    009d3e3 View commit details
    Browse the repository at this point in the history
  21. Extract out getMinimumUTxOFunction within Blockfrost network layer.

    This function encapsulates the logic of constructing an era-specific
    minimum UTxO function, and reduces the complexity of the
    `fromBlockfrostPP` function.
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    c26ef6f View commit details
    Browse the repository at this point in the history
  22. Generalize function verify in Test.QuickCheck.Extra.

    This allows `verify` to modify any `Testable` value.
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    c2a55f6 View commit details
    Browse the repository at this point in the history
  23. Add property prop_computeMinimumCoinForUTxO_shelleyBasedEra_stability.

    This function compares the stability of:
    
    - the Cardano API function 'calculateMinimumUTxO'
    - the wallet function 'computeMinimumCoinForUTxO'
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    c4f01d9 View commit details
    Browse the repository at this point in the history
  24. Simplify property `prop_computeMinimumCoinForUTxO_shelleyBasedEra_bou…

    …nds`.
    
    Simplify this property by moving the error pattern match to inner
    function `apiComputeMinCoin`. We assume that error pattern will never
    match. But if it does, then this property will still fail.
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    6bd15b1 View commit details
    Browse the repository at this point in the history
  25. Add golden tests for minimum UTxO values.

    We add golden minimum UTxO values for all Shelley-based eras.
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    4f348ca View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    f75c995 View commit details
    Browse the repository at this point in the history
  27. Disable PartialTypeSignatures in Shelley.Compatibility.

    This extension was only used once in the whole module.
    
    In the particular case it was used, it is arguably clearer and safer to
    state the era explicitly.
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    75015c2 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    763a0d3 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    fc2344e View commit details
    Browse the repository at this point in the history
  30. Improve clarity of counterexample output within golden tests.

    In particular, we indicate more clearly which value was expected, and
    which value was returned.
    
    For example:
    
    ```
    Failures:
    
      lib/shelley/test/unit/Cardano/Wallet/Shelley/MinimumUTxOSpec.hs:490:9:
      1) computeMinimumCoinForUTxO, Golden Tests, goldenTests_computeMinimumCoinForUTxO Babbage, golden test #3
           Falsified (after 1 test):
             resultExpected:                                                                                                                                                                           Coin 1323170
                 Coin 1323170
    
             resultReturned:
                 Coin 1357650
    
             Condition violated: resultReturned == resultExpected
    ```
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    964faa4 View commit details
    Browse the repository at this point in the history
  31. Add further explanatory comments.

    In response to review feedback:
    #3368 (comment)
    #3368 (comment)
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    bda5651 View commit details
    Browse the repository at this point in the history
  32. Add commentary to `prop_computeMinimumCoinForUTxO_shelleyBasedEra_sta…

    …bility`.
    
    We further explain the purpose of this property.
    
    If the Cardano API function `calculateMinimumUTxO` is ever changed so
    that it computes a fixed point before returning its result, this
    property will fail.
    
    However, this is valuable information, as it tells us that we might be
    able to revise our implementation of `computeMinimumCoinForUTxO` to
    reduce the level of overestimation.
    
    In response to review feedback.
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    a4d6519 View commit details
    Browse the repository at this point in the history
  33. Improve realism of generated test protocol parameters in `MinimumUTxO…

    ….Gen`.
    
    This commit introduces generator function `genLedgerCoinOfSimilarMagnitude`,
    which, when given a coin value, will generate another coin value that is
    of a similar magnitude.
    
    When generating test values of `MinimumUTxO`, we apply the generator
    function `genLedgerCoinOfSimilarMagnitude` to protocol parameter values
    obtained from real mainnet genesis files. This enables us to generate
    more realistic values of `MinimumUTxO`.
    
    In response to review feedback:
    #3368 (comment)
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    114cf90 View commit details
    Browse the repository at this point in the history
  34. Reuse test protocol parameters from MinimumUTxO.Gen in `MinimumUTxO…

    …Spec`.
    
    Since we've already defined a set of test protocol parameter values
    within `MinimumUTxO.Gen`, we might as well re-use these test parameter
    values within `MinimumUTxOSpec`. This reduces the amount of repetition.
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    f08e0a0 View commit details
    Browse the repository at this point in the history
  35. Adjust monotonicity comment for function `embedTokenMapWithinPaddedTx…

    …Out`.
    
    In response to review feedback:
    
    #3368 (comment)
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    eb446c6 View commit details
    Browse the repository at this point in the history
  36. Describe motivation for MinimumUTxOConstant constructor.

    In response to review feedback:
    
    #3368 (comment)
    jonathanknowles committed Jul 13, 2022
    Configuration menu
    Copy the full SHA
    727c7cb View commit details
    Browse the repository at this point in the history