You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
-- You have to wait at least a diameter to get the block.
366
+
-- You have to wait at least N blocks before attempting to run the continuation,
367
367
-- where N is the diameter of the graph + some constant. Here, we just run 10 blocks,
368
368
-- because it is less than the minimumBlockHeaderHistory of the test version, but
369
369
-- more than sufficient for the target chain to be aware of the source xchain transfer.
370
370
let waitBlocks ::Integrala=>a
371
-
waitBlocks =int $ diameter (chainGraphAt v maxBound) +1
371
+
waitBlocks =10
372
372
let expirationWindow = fromMaybe (error"missing minimumBlockHeaderHistory") (minimumBlockHeaderHistory v maxBound)
373
373
when (int expirationWindow < waitBlocks + diameter (chainGraphAt v maxBound)) $ assertFailure "test version has a minimumBlockHeaderHistory that is too short to test"
374
374
375
375
replicateM_ waitBlocks $ advanceAllChains_ fx
376
-
377
376
[Just sendCr] <- pollWithDepth fx v srcChain [initiatorReqKey] (Just (ConfirmationDepth0))
378
377
let cont = fromMaybe (error"missing continuation") (_crContinuation sendCr)
379
-
380
-
TransactionOutputProofB64 expiringSpvProof <- spvTxOutProof fx v targetChain srcChain initiatorReqKey
381
-
let expiringContMsg =ContMsg
378
+
TransactionOutputProofB64 spvProof <- spvTxOutProof fx v targetChain srcChain initiatorReqKey
-- We have already run an extra 10 blocks since initiating the transfer.
389
388
-- We need to wait for the full window to expire.
389
+
390
390
-- still accessible at remainingWindow + diameter + 1 so we have to go one beyond
391
391
let remainingWindow = int @_@Int (int expirationWindow - waitBlocks + diameter (chainGraphAt v maxBound) +2)
392
392
replicateM_ remainingWindow $ advanceAllChains_ fx
393
393
394
-
expiringRecv <- buildTextCmd v
395
-
$ set cbRPC (mkCont expiringContMsg)
396
-
$ defaultCmd targetChain
397
-
send fx v targetChain [expiringRecv]
398
-
let expiringRecvReqKey = cmdToRequestKey expiringRecv
399
-
advanceAllChains_ fx
400
-
poll fx v targetChain [expiringRecvReqKey]
401
-
>>=P.match (_head . _Just)
402
-
?P.checkAll
403
-
[ P.fun _crResult ?P.match _PactResultErr ?P.fun _peMsg ?P.equals "Continuation error: spv verification failed: target header is not in the chain or is out of bounds"
404
-
]
405
-
406
-
TransactionOutputProofB64 spvWorkingProof <- spvTxOutProof fx v targetChain srcChain initiatorReqKey
[ P.fun _crResult ?P.match _PactResultErr ?P.fun _peMsg ?P.equals "Continuation error: spv verification failed: target header is not in the chain or is out of bounds"
0 commit comments