diff --git a/hydra-node/src/Hydra/HeadLogic.hs b/hydra-node/src/Hydra/HeadLogic.hs index 037d54c2db7..d8dcfd09f3e 100644 --- a/hydra-node/src/Hydra/HeadLogic.hs +++ b/hydra-node/src/Hydra/HeadLogic.hs @@ -928,7 +928,7 @@ onOpenChainCloseTx openState newChainState closedSnapshotNumber contestationDead if number (getSnapshot confirmedSnapshot) > closedSnapshotNumber then outcome - -- TODO: As we use 'version' in the contest here, this is implies + -- XXX: As we use 'version' in the contest here, this is implies -- that our last 'confirmedSnapshot' must match version or -- version-1. Assert this fact? -- Spec: η ← combine(̅S.𝑈) @@ -977,7 +977,7 @@ onClosedChainContestTx closedState newChainState snapshotNumber contestationDead | -- Spec: if ̅S.s > sc number (getSnapshot confirmedSnapshot) > snapshotNumber -> cause notifyClients - -- TODO: As we use 'version' in the contest here, this is implies + -- XXX: As we use 'version' in the contest here, this is implies -- that our last 'confirmedSnapshot' must match version or -- version-1. Assert this fact? -- Spec: η ← combine(̅S.𝑈) diff --git a/hydra-node/test/Hydra/BehaviorSpec.hs b/hydra-node/test/Hydra/BehaviorSpec.hs index 83e6f832a9d..a14e5c1f05a 100644 --- a/hydra-node/test/Hydra/BehaviorSpec.hs +++ b/hydra-node/test/Hydra/BehaviorSpec.hs @@ -437,7 +437,6 @@ spec = parallel $ do waitUntil [n1, n2] $ DecommitApproved{headId = testHeadId, decommitTxId = txId decommitTx2, utxoToDecommit = utxoRefs [22]} waitUntil [n1, n2] $ DecommitFinalized{headId = testHeadId, decommitTxId = txId decommitTx2} - -- TODO: Add it "can contest with decommit in flight" it "can close with decommit in flight" $ shouldRunInSim $ do withSimulatedChainAndNetwork $ \chain -> diff --git a/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseCurrent.hs b/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseCurrent.hs index 73cb104d542..c77aeba9d6c 100644 --- a/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseCurrent.hs +++ b/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseCurrent.hs @@ -199,11 +199,6 @@ data CloseMutation MutateContestationPeriod deriving stock (Generic, Show, Enum, Bounded) --- TODO: Add mutations which work "this way" around now. For example, before --- we did mutate a close with signed snapshot to result in snapshot number 0, --- which would trigger the validator. However, that would not be a faithful --- representation of an "attack" anymore. Now, the tx creator needs to claim --- what situation we are in now and how the snapshot signature is valid. genCloseCurrentMutation :: (Tx, UTxO) -> Gen SomeMutation genCloseCurrentMutation (tx, _utxo) = oneof diff --git a/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseOutdated.hs b/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseOutdated.hs index 7565f6c17e7..ccfb5e89bdc 100644 --- a/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseOutdated.hs +++ b/hydra-node/test/Hydra/Chain/Direct/Contract/Close/CloseOutdated.hs @@ -220,11 +220,6 @@ data CloseMutation MutateContestationPeriod deriving stock (Generic, Show, Enum, Bounded) --- TODO: Add mutations which work "this way" around now. For example, before --- we did mutate a close with signed snapshot to result in snapshot number 0, --- which would trigger the validator. However, that would not be a faithful --- representation of an "attack" anymore. Now, the tx creator needs to claim --- what situation we are in now and how the snapshot signature is valid. genCloseOutdatedMutation :: (Tx, UTxO) -> Gen SomeMutation genCloseOutdatedMutation (tx, _utxo) = oneof diff --git a/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs b/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs index e15e50d9337..dd580464ff1 100644 --- a/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs +++ b/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs @@ -288,7 +288,7 @@ instance StateModel Model where snapshot <- genSnapshot pure $ Some Decrement{actor, snapshot} ) - | -- XXX: We dont want to generate decrements if there is nothing in the head. + | -- We dont want to generate decrements if there is nothing in the head. not (null utxoInHead) ] Closed{} -> @@ -389,9 +389,9 @@ instance StateModel Model where Decrement{snapshot} -> headState == Open && snapshot.version == currentVersion - -- XXX: you are decrementing from existing utxo in the head + -- you are decrementing from existing utxo in the head && all (`elem` Map.keys utxoInHead) (Map.keys (decommitUTxO snapshot) <> Map.keys (snapshotUTxO snapshot)) - -- XXX: your tx is balanced with the utxo in the head + -- your tx is balanced with the utxo in the head && sum (decommitUTxO snapshot) + sum (snapshotUTxO snapshot) == sum utxoInHead && (not . null $ decommitUTxO snapshot) Close{snapshot} -> @@ -402,9 +402,9 @@ instance StateModel Model where snapshot.number >= latestSnapshot && snapshot.version `elem` (currentVersion : [currentVersion - 1 | currentVersion > 0]) ) - -- XXX: you are decrementing from existing utxo in the head + -- you are decrementing from existing utxo in the head && all (`elem` Map.keys utxoInHead) (Map.keys (decommitUTxO snapshot) <> Map.keys (snapshotUTxO snapshot)) - -- XXX: your tx is balanced with the utxo in the head + -- your tx is balanced with the utxo in the head && sum (decommitUTxO snapshot) + sum (snapshotUTxO snapshot) == sum utxoInHead where Model{utxoInHead = initialUTxOInHead} = initialState @@ -413,9 +413,9 @@ instance StateModel Model where && actor `notElem` alreadyContested && snapshot.version `elem` (currentVersion : [currentVersion - 1 | currentVersion > 0]) && snapshot.number > latestSnapshot - -- XXX: you are decrementing from existing utxo in the head + -- you are decrementing from existing utxo in the head && all (`elem` Map.keys utxoInHead) (Map.keys (decommitUTxO snapshot) <> Map.keys (snapshotUTxO snapshot)) - -- XXX: your tx is balanced with the utxo in the head + -- your tx is balanced with the utxo in the head && sum (decommitUTxO snapshot) + sum (snapshotUTxO snapshot) == sum utxoInHead Fanout{utxo, deltaUTxO} -> headState == Closed @@ -433,35 +433,33 @@ instance StateModel Model where Decrement{snapshot} -> headState == Open && snapshot.version /= currentVersion - -- XXX: Ignore unbalanced decrements. + -- Ignore unbalanced decrements. -- TODO: make them fail gracefully and test this? && sum (decommitUTxO snapshot) + sum (snapshotUTxO snapshot) == sum utxoInHead - -- XXX: Ignore decrements that work with non existing utxo in the head + -- Ignore decrements that work with non existing utxo in the head && all (`elem` Map.keys utxoInHead) (Map.keys (decommitUTxO snapshot) <> Map.keys (snapshotUTxO snapshot)) - -- XXX: Ignore decrement without something to decommit + -- Ignore decrement without something to decommit && (not . null $ decommitUTxO snapshot) Close{snapshot} -> headState == Open && ( snapshot.number == 0 || snapshot.version `elem` (currentVersion : [currentVersion - 1 | currentVersion > 0]) ) - -- XXX: Ignore unbalanced close. + -- Ignore unbalanced close. -- TODO: make them fail gracefully and test this? && sum (decommitUTxO snapshot) + sum (snapshotUTxO snapshot) == sum utxoInHead - -- XXX: Ignore close that work with non existing utxo in the head + -- Ignore close that work with non existing utxo in the head && all (`elem` Map.keys utxoInHead) (Map.keys (decommitUTxO snapshot) <> Map.keys (snapshotUTxO snapshot)) Contest{snapshot} -> headState == Closed - -- XXX: Ignore unbalanced close. + -- Ignore unbalanced close. -- TODO: make them fail gracefully and test this? && sum (decommitUTxO snapshot) + sum (snapshotUTxO snapshot) == sum utxoInHead - -- XXX: Ignore close that work with non existing utxo in the head + -- Ignore close that work with non existing utxo in the head && all (`elem` Map.keys utxoInHead) (Map.keys (decommitUTxO snapshot) <> Map.keys (snapshotUTxO snapshot)) Fanout{} -> headState == Closed - -- XXX: Ignore fanouts which does not preserve the closing head - nextState :: Model -> Action Model a -> Var a -> Model nextState m@Model{currentVersion} t _result = case t of @@ -774,7 +772,7 @@ newFanoutTx actor utxo deltaUTxO = do spendableUTxO Fixture.testSeedInput (realWorldModelUTxO utxo) - -- XXX: Model world has no 'Maybe ModelUTxO', but real world does. + -- Model world has no 'Maybe ModelUTxO', but real world does. (if null deltaUTxO then Nothing else Just $ realWorldModelUTxO deltaUTxO) deadline where