From 38be46b4dd048d65e0f257252dcca4cddd7ce060 Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Wed, 20 Apr 2022 07:25:38 +0000 Subject: [PATCH] Also test with mainnet fee policy in `prop_distributeSurplus_onSuccess`. In response to review feedback: https://github.com/input-output-hk/cardano-wallet/pull/3238#discussion_r853330566 --- .../Cardano/Wallet/Shelley/TransactionSpec.hs | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs b/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs index c0611e451bf..77f0337a8d7 100644 --- a/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs +++ b/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs @@ -2434,16 +2434,27 @@ prop_distributeSurplusDelta_coversCostIncreaseAndConservesSurplus -------------------------------------------------------------------------------- instance Arbitrary FeePolicy where - arbitrary = do - intercept <- frequency - [ (1, pure 0.0) - , (3, getPositive <$> arbitrary) - ] - slope <- frequency - [ (1, pure 0.0) - , (3, getPositive <$> arbitrary) - ] - pure $ LinearFee LinearFunction {intercept, slope} + arbitrary = frequency + [ (1, feePolicyMainnet) + , (7, feePolicyGeneral) + ] + where + feePolicyMainnet :: Gen FeePolicy + feePolicyMainnet = pure $ LinearFee $ LinearFunction + {intercept = 150_000, slope = 44} + + feePolicyGeneral :: Gen FeePolicy + feePolicyGeneral = do + intercept <- frequency + [ (1, pure 0.0) + , (3, getPositive <$> arbitrary) + ] + slope <- frequency + [ (1, pure 0.0) + , (3, getPositive <$> arbitrary) + ] + pure $ LinearFee LinearFunction {intercept, slope} + shrink (LinearFee LinearFunction {intercept, slope}) = LinearFee . uncurry LinearFunction <$> shrink (intercept, slope)