Skip to content

Commit

Permalink
Lower UnableToConstructChange.shortfall values for balanceTx gold…
Browse files Browse the repository at this point in the history
…en tests.

The previous commit adjusted the dummy output used by function
`performSelectionEmpty` so that it uses a null-length `Address` value.

This null-length `Address` value is identical to the one we used before
we adjusted `computeMinimumCoinForUTxO` to require a valid `Address`.

However, we were also able to adjust `performSelectionEmpty` so that it
no longer needs to validate minimum ada quantities of user-specified
outputs, and consequently we were able to reduce the dummy output's
`Coin` value to just `Coin 1`, which has the smallest space cost of
any non-zero `Coin` value.

This results in a further reduction in cost overestimation while
constructing change, which results in smaller `shortfall` values within
`UnableToConstructChange` errors.
  • Loading branch information
jonathanknowles committed Aug 1, 2022
1 parent 6c270a5 commit 114651d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/shelley/test/data/balanceTx/delegate/golden
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
1.850000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (BalanceInsufficient (BalanceInsufficientError {utxoBalanceAvailable = TokenBundle {coin = Coin 1850000, tokens = TokenMap (fromList [])}, utxoBalanceRequired = TokenBundle {coin = Coin 2000000, tokens = TokenMap (fromList [])}}))))
1.900000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (BalanceInsufficient (BalanceInsufficientError {utxoBalanceAvailable = TokenBundle {coin = Coin 1900000, tokens = TokenMap (fromList [])}, utxoBalanceRequired = TokenBundle {coin = Coin 2000000, tokens = TokenMap (fromList [])}}))))
1.950000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (BalanceInsufficient (BalanceInsufficientError {utxoBalanceAvailable = TokenBundle {coin = Coin 1950000, tokens = TokenMap (fromList [])}, utxoBalanceRequired = TokenBundle {coin = Coin 2000000, tokens = TokenMap (fromList [])}}))))
2.000000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 182177, shortfall = Coin 182177}))))
2.050000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 182177, shortfall = Coin 132177}))))
2.100000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 182177, shortfall = Coin 82177}))))
2.150000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 182177, shortfall = Coin 32177}))))
2.000000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 180725, shortfall = Coin 180725}))))
2.050000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 180725, shortfall = Coin 130725}))))
2.100000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 180725, shortfall = Coin 80725}))))
2.150000,ErrBalanceTxSelectAssets (ErrSelectAssetsSelectionError (SelectionBalanceErrorOf (UnableToConstructChange (UnableToConstructChangeError {requiredCost = Coin 180725, shortfall = Coin 30725}))))
2.200000,0.200000,0.175401
2.250000,0.250000,0.175401
2.300000,0.300000,0.175401
Expand Down

0 comments on commit 114651d

Please sign in to comment.