Skip to content

Commit

Permalink
Also test with mainnet fee policy in prop_distributeSurplus_onSuccess.
Browse files Browse the repository at this point in the history
In response to review feedback:

#3238 (comment)
  • Loading branch information
jonathanknowles authored and paolino committed Apr 26, 2022
1 parent 43c8ba6 commit 6e4e041
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6e4e041

Please sign in to comment.