@@ -1172,23 +1172,26 @@ canCommit tracer workDir node hydraScriptsTxId =
1172
1172
(`finally` returnFundsToFaucet tracer node Bob ) $ do
1173
1173
refuelIfNeeded tracer node Alice 30_000_000
1174
1174
refuelIfNeeded tracer node Bob 30_000_000
1175
- let contestationPeriod = 20
1175
+ -- NOTE: Deliberately low periods to speed up happy path test
1176
+ let contestationPeriod = truncate $ 3 * blockTime
1177
+ depositPeriod = truncate $ 5 * blockTime
1176
1178
aliceChainConfig <-
1177
1179
chainConfigFor Alice workDir nodeSocket hydraScriptsTxId [Bob ] contestationPeriod
1178
1180
<&> setNetworkId networkId
1181
+ . modifyConfig (\ c -> c{depositPeriod})
1179
1182
bobChainConfig <-
1180
1183
chainConfigFor Bob workDir nodeSocket hydraScriptsTxId [Alice ] contestationPeriod
1181
1184
<&> setNetworkId networkId
1185
+ . modifyConfig (\ c -> c{depositPeriod})
1182
1186
withHydraNode hydraTracer aliceChainConfig workDir 1 aliceSk [bobVk] [2 ] $ \ n1 -> do
1183
1187
withHydraNode hydraTracer bobChainConfig workDir 2 bobSk [aliceVk] [1 ] $ \ n2 -> do
1184
1188
send n1 $ input " Init" []
1185
- -- _ <- waitMatch 10 n1 $ headIsInitializingWith (Set.fromList [bob])
1186
- headId <- waitMatch 20 n2 $ headIsInitializingWith (Set. fromList [alice, bob])
1189
+ headId <- waitMatch (2 * blockTime) n2 $ headIsInitializingWith (Set. fromList [alice, bob])
1187
1190
1188
1191
-- Commit nothing
1189
1192
requestCommitTx n1 mempty >>= submitTx node
1190
1193
requestCommitTx n2 mempty >>= submitTx node
1191
- waitFor hydraTracer (20 * blockTime) [n1, n2] $
1194
+ waitFor hydraTracer (2 * blockTime) [n1, n2] $
1192
1195
output " HeadIsOpen" [" utxo" .= object mempty , " headId" .= headId]
1193
1196
1194
1197
-- Get some L1 funds
@@ -1206,9 +1209,9 @@ canCommit tracer workDir node hydraScriptsTxId =
1206
1209
1207
1210
submitTx node tx
1208
1211
1209
- waitFor hydraTracer 20 [n1, n2] $
1212
+ waitFor hydraTracer ( 2 * realToFrac depositPeriod) [n1, n2] $
1210
1213
output " CommitApproved" [" headId" .= headId, " utxoToCommit" .= commitUTxO]
1211
- waitFor hydraTracer 20 [n1, n2] $
1214
+ waitFor hydraTracer ( 2 * blockTime) [n1, n2] $
1212
1215
output " CommitFinalized" [" headId" .= headId, " depositTxId" .= getTxId (getTxBody tx)]
1213
1216
1214
1217
getSnapshotUTxO n1 `shouldReturn` commitUTxO
@@ -1223,24 +1226,24 @@ canCommit tracer workDir node hydraScriptsTxId =
1223
1226
1224
1227
submitTx node tx'
1225
1228
1226
- waitFor hydraTracer 20 [n1, n2] $
1229
+ waitFor hydraTracer ( 2 * realToFrac depositPeriod) [n1, n2] $
1227
1230
output " CommitApproved" [" headId" .= headId, " utxoToCommit" .= commitUTxO2]
1228
- waitFor hydraTracer 20 [n1, n2] $
1231
+ waitFor hydraTracer ( 2 * blockTime) [n1, n2] $
1229
1232
output " CommitFinalized" [" headId" .= headId, " depositTxId" .= getTxId (getTxBody tx')]
1230
1233
1231
1234
getSnapshotUTxO n1 `shouldReturn` commitUTxO <> commitUTxO2
1232
1235
1233
1236
send n2 $ input " Close" []
1234
1237
1235
- deadline <- waitMatch (20 * blockTime) n2 $ \ v -> do
1238
+ deadline <- waitMatch (2 * blockTime) n2 $ \ v -> do
1236
1239
guard $ v ^? key " tag" == Just " HeadIsClosed"
1237
1240
v ^? key " contestationDeadline" . _JSON
1238
1241
1239
1242
remainingTime <- diffUTCTime deadline <$> getCurrentTime
1240
1243
waitFor hydraTracer (remainingTime + 3 * blockTime) [n1, n2] $
1241
1244
output " ReadyToFanout" [" headId" .= headId]
1242
1245
send n2 $ input " Fanout" []
1243
- waitMatch (20 * blockTime) n2 $ \ v ->
1246
+ waitMatch (2 * blockTime) n2 $ \ v ->
1244
1247
guard $ v ^? key " tag" == Just " HeadIsFinalized"
1245
1248
1246
1249
-- Assert final wallet balance
0 commit comments