Skip to content

Commit

Permalink
Add fuzz to STAKE_POOLS_JOIN_01x for reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Feb 22, 2024
1 parent 01985dc commit f67423c
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,11 @@ spec = describe "SHELLEY_STAKE_POOLS" $ do
describe "STAKE_POOLS_JOIN_01x - Fee boundary values" $ do
it
"STAKE_POOLS_JOIN_01x - \
\I can join if I have just the right amount"
\I can join if I have barely enough fees"
$ \ctx -> runResourceT $ do
w <- fixtureWalletWith @n ctx [costOfJoining ctx + depositAmt ctx]
let fuzz = costOf 50 ctx -- exact CBOR size can change
let enoughFees = costOfJoining ctx + depositAmt ctx + fuzz
w <- fixtureWalletWith @n ctx [enoughFees]
pool : _ <-
map (view #id . getApiT) . snd
<$> unsafeRequest @[ApiT StakePool]
Expand All @@ -1070,7 +1072,9 @@ spec = describe "SHELLEY_STAKE_POOLS" $ do
"STAKE_POOLS_JOIN_01x - \
\I cannot join if I have not enough fee to cover"
$ \ctx -> runResourceT $ do
w <- fixtureWalletWith @n ctx [costOfJoining ctx + depositAmt ctx - 1]
let fuzz = costOf 50 ctx -- exact CBOR size can change
let notEnoughFees = costOfJoining ctx + depositAmt ctx - fuzz
w <- fixtureWalletWith @n ctx [notEnoughFees]
pool : _ <-
map (view #id . getApiT) . snd
<$> unsafeRequest @[ApiT StakePool]
Expand Down

0 comments on commit f67423c

Please sign in to comment.