From a389b1e29ca429d17be811906a5ba20356d8d01c Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Tue, 8 Oct 2024 09:45:58 +0200 Subject: [PATCH 1/2] Warn on usages of spy and spy' These functions should not remain in production code and only be used for debugging purposes only. --- hydra-prelude/src/Hydra/Prelude.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hydra-prelude/src/Hydra/Prelude.hs b/hydra-prelude/src/Hydra/Prelude.hs index aa0dae58df1..456afc48a56 100644 --- a/hydra-prelude/src/Hydra/Prelude.hs +++ b/hydra-prelude/src/Hydra/Prelude.hs @@ -257,9 +257,11 @@ withFile fp mode action = Right x -> pure x -- | Like 'traceShow', but with pretty printing of the value. +{-# WARNING spy "Use for debugging purposes only" #-} spy :: Show a => a -> a spy a = trace (toString $ pShow a) a -- | Like 'spy' but prefixed with a label. +{-# WARNING spy' "Use for debugging purposes only" #-} spy' :: Show a => String -> a -> a spy' msg a = trace (msg <> ": " <> toString (pShow a)) a From 3d6701328201ca08df50a4e7e5ed3d59022d0083 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Tue, 8 Oct 2024 10:00:19 +0200 Subject: [PATCH 2/2] Remove leftover usage of spy in HeadLogic --- hydra-node/src/Hydra/HeadLogic.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra-node/src/Hydra/HeadLogic.hs b/hydra-node/src/Hydra/HeadLogic.hs index 3012bef7cd1..3d3fc64b6da 100644 --- a/hydra-node/src/Hydra/HeadLogic.hs +++ b/hydra-node/src/Hydra/HeadLogic.hs @@ -1423,7 +1423,7 @@ aggregate st = \case { coordinatedHeadState = coordinatedHeadState { localUTxO = newLocalUTxO - , pendingDeposits = Map.delete (spy recoveredTxId) existingDeposits + , pendingDeposits = Map.delete recoveredTxId existingDeposits } } where