Skip to content

Commit

Permalink
Use arbitrary for contestation period in Close tests
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch authored and ch1bo committed Nov 29, 2022
1 parent a7c3f4c commit fb4d285
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hydra-node/test/Hydra/Chain/Direct/Contract/Close.hs
Expand Up @@ -46,8 +46,8 @@ healthyCloseTx =
openThreadOutput

headInput = generateWith arbitrary 42
(startSlot, pointInTime) = genPointInTimeWithSlotDifference 1 `generateWith` 42

(startSlot, pointInTime) =
genPointInTimeWithSlotDifference (fromIntegral healthyContestationPeriodSeconds) `generateWith` 42
headResolvedInput =
mkHeadOutput testNetworkId testPolicyId headTxOutDatum
& addParticipationTokens healthyParties
Expand Down Expand Up @@ -92,6 +92,7 @@ healthyCloseUTxO =
(genOneUTxOFor somePartyCardanoVerificationKey `suchThat` (/= healthyUTxO))
`generateWith` 42

-- TODO: generate arbitrary SnapshotNumber too?
healthySnapshotNumber :: SnapshotNumber
healthySnapshotNumber = 1

Expand All @@ -106,8 +107,10 @@ healthyCloseDatum =
healthyContestationPeriod :: OnChain.ContestationPeriod
healthyContestationPeriod = OnChain.contestationPeriodFromDiffTime $ fromInteger healthyContestationPeriodSeconds

-- NB: We don't want to wait too long for contestation period to pass
-- so constraining this to < 100
healthyContestationPeriodSeconds :: Integer
healthyContestationPeriodSeconds = 10
healthyContestationPeriodSeconds = arbitrary `suchThat` (< 100) `generateWith` 42

healthyUTxO :: UTxO
healthyUTxO = genOneUTxOFor somePartyCardanoVerificationKey `generateWith` 42
Expand Down

0 comments on commit fb4d285

Please sign in to comment.