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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining fee calculation #1578

Merged
merged 6 commits into from
Apr 16, 2020
Merged

Commits on Apr 16, 2020

  1. add regression test triggering the unbalanced invariant

      currently fails as expected with:
    
      ```
      Generated an unbalanced tx! Too much left for fees : fee (raw) = 164282 : fee (dangling) = 167722 , diff = 200000
      selection = inputs: - 1st 30 (~ 1000000 @ 66616b65...72657373)
      outputs: - 800000 @ 66616b65...72657373
      change: []
    
      CallStack (from HasCallStack):
        error, called at src/Cardano/Wallet/Primitive/Fee.hs:330:18 in cardano-wallet-core-2020.4.7-Be8Kf2A2Kpl7z2pVyjHPdZ:Cardano.Wallet.Primitive.Fee
        remainingFee, called at src/Cardano/Wallet/Primitive/Fee.hs:207:22 in cardano-wallet-core-2020.4.7-Be8Kf2A2Kpl7z2pVyjHPdZ:Cardano.Wallet.Primitive.Fee
      ```
    KtorZ committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    938a3a0 View commit details
    Browse the repository at this point in the history
  2. refactor: merge 'remainingFee' and 'rebalanceChangeOutput'

    The former actually makes assumption based on the output of the later. Testing these
    function in isolation makes little sense. Grouping them into one function makes it
    easier to understand the surrounding context and what is happening.
    
    Further refactoring is needed in order to now fix the issue with dangling fee
    KtorZ committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    1041fac View commit details
    Browse the repository at this point in the history
  3. use dustThreshold instead of 'Coin 0'

    They should actually have the same semantic within this context.
    KtorZ committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    1758a30 View commit details
    Browse the repository at this point in the history
  4. fix remaining fee calculation

    KtorZ committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    7194126 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a17462c View commit details
    Browse the repository at this point in the history
  6. property test fee balancing

    And allow transaction to be unbalanced if the node allows it
    KtorZ committed Apr 16, 2020
    Configuration menu
    Copy the full SHA
    5c88126 View commit details
    Browse the repository at this point in the history