Skip to content

Commit c7171e2

Browse files
committed
Resolve TODOs and update comments
1 parent 3e36262 commit c7171e2

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

hydra-node/src/Hydra/Chain/Direct/State.hs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,9 @@ collect ctx headId headParameters utxoToCollect spendableUTxO = do
479479

480480
ChainContext{networkId, ownVerificationKey, scriptRegistry} = ctx
481481

482-
-- | Construct a close transaction based on the 'OpenState' and a confirmed
483-
-- snapshot.
484-
-- - 'SlotNo' parameter will be used as the 'Tx' lower bound.
485-
-- - 'PointInTime' parameter will be used as an upper validity bound and
486-
-- will define the start of the contestation period.
487-
-- NB: lower and upper bound slot difference should not exceed contestation period
488-
-- FIXME: wrong haddocks
482+
-- | Construct a close transaction spending the head output in given 'UTxO',
483+
-- head parameters, and a confirmed snapshot. NOTE: Lower and upper bound slot
484+
-- difference should not exceed contestation period.
489485
close ::
490486
ChainContext ->
491487
-- | Spendable UTxO containing head, initial and commit outputs

hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ instance StateModel Model where
128128
case headState of
129129
Open ->
130130
oneof
131-
[ -- TODO: non-continuous snapshot numbers
131+
[ -- NOTE: non-continuous snapshot numbers are allowed in this model
132132
Some . ProduceSnapshots <$> arbitrary
133133
, do
134134
actor <- elements allActors
@@ -152,13 +152,11 @@ instance StateModel Model where
152152
snapshotNumber <- elements snapshots
153153
pure $ Some Contest{actor, snapshotNumber}
154154

155-
-- TODO: shrinkAction to have small snapshots?
156-
157155
initialState =
158156
Model
159157
{ snapshots = []
160158
, headState = Open
161-
, utxoV = mkVar 1 -- TODO: what does '1' mean here?
159+
, utxoV = mkVar (-1)
162160
, alreadyContested = []
163161
}
164162

@@ -208,17 +206,13 @@ instance RunModel Model IO where
208206
tx <- newCloseTx actor $ correctlySignedSnapshot snapshotNumber
209207
validateTx openHeadUTxO tx
210208
observeTxMatching openHeadUTxO tx $ \case
211-
Tx.Close{} -> Just () -- TODO: check more things here (or in postcondition)?
209+
Tx.Close{} -> Just ()
212210
_ -> Nothing
213211
pure $ adjustUTxO tx openHeadUTxO
214212
Contest{actor, snapshotNumber} -> do
215-
-- NOTE: Should not happen anymore
216-
when (snapshotNumber == 0) $
217-
failure "Cannot contest initial snapshot"
218213
let utxo = lookupVar utxoV
219214
tx <- newContestTx utxo actor $ correctlySignedSnapshot snapshotNumber
220215
validateTx utxo tx
221-
222216
observation@Tx.ContestObservation{contesters} <-
223217
observeTxMatching utxo tx $ \case
224218
Tx.Contest obs -> Just obs
@@ -231,7 +225,6 @@ instance RunModel Model IO where
231225
, toString $ pShowNoColor observation
232226
, "Transaction: " <> renderTxWithUTxO utxo tx
233227
]
234-
235228
pure $ adjustUTxO tx utxo
236229
Fanout -> pure ()
237230
Stop -> pure ()

0 commit comments

Comments
 (0)