From 5139946fd1ffd21456e1b7b4893b9868100f88c2 Mon Sep 17 00:00:00 2001 From: Sasha Bogicevic Date: Thu, 3 Oct 2024 16:01:10 +0200 Subject: [PATCH] Fix a bug in the pending deposit projection --- hydra-cluster/src/Hydra/Cluster/Scenarios.hs | 2 +- hydra-node/src/Hydra/API/ServerOutput.hs | 5 +++-- hydra-node/src/Hydra/HeadLogic.hs | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hydra-cluster/src/Hydra/Cluster/Scenarios.hs b/hydra-cluster/src/Hydra/Cluster/Scenarios.hs index d22978c19b0..8e4af71d2f5 100644 --- a/hydra-cluster/src/Hydra/Cluster/Scenarios.hs +++ b/hydra-cluster/src/Hydra/Cluster/Scenarios.hs @@ -883,7 +883,7 @@ canSeePendingDeposits tracer workDir node hydraScriptsTxId = forM_ deposited $ \deposit -> do let path = BSC.unpack $ urlEncode False $ encodeUtf8 $ T.pack $ show deposit recoverResp <- - parseUrlThrow ("DELETE " <> hydraNodeBaseUrl n1 <> "/commits/" <> spy path) + parseUrlThrow ("DELETE " <> hydraNodeBaseUrl n1 <> "/commits/" <> path) >>= httpJSON (getResponseBody recoverResp :: String) `shouldBe` "OK" diff --git a/hydra-node/src/Hydra/API/ServerOutput.hs b/hydra-node/src/Hydra/API/ServerOutput.hs index fdcb7ab68a1..c4294f601e7 100644 --- a/hydra-node/src/Hydra/API/ServerOutput.hs +++ b/hydra-node/src/Hydra/API/ServerOutput.hs @@ -141,7 +141,7 @@ data ServerOutput tx | CommitApproved {headId :: HeadId, utxoToCommit :: UTxOType tx} | DecommitFinalized {headId :: HeadId, decommitTxId :: TxIdType tx} | CommitFinalized {headId :: HeadId, utxo :: UTxOType tx, theDeposit :: TxIdType tx} - | CommitRecovered {headId :: HeadId, recoveredUTxO :: UTxOType tx} + | CommitRecovered {headId :: HeadId, recoveredUTxO :: UTxOType tx, recoveredTxId :: TxIdType tx} deriving stock (Generic) deriving stock instance IsChainState tx => Eq (ServerOutput tx) @@ -199,7 +199,7 @@ instance (ArbitraryIsTx tx, IsChainState tx) => Arbitrary (ServerOutput tx) wher CommitRecorded headId u txId -> CommitRecorded headId <$> shrink u <*> shrink txId CommitApproved headId u -> CommitApproved headId <$> shrink u DecommitApproved headId txid u -> DecommitApproved headId txid <$> shrink u - CommitRecovered headId u -> CommitRecovered headId <$> shrink u + CommitRecovered headId u rid -> CommitRecovered headId <$> shrink u <*> shrink rid DecommitFinalized{} -> [] CommitFinalized{} -> [] @@ -292,6 +292,7 @@ data CommitInfo projectPendingDeposits :: IsTx tx => [TxIdType tx] -> ServerOutput tx -> [TxIdType tx] projectPendingDeposits txIds = \case CommitRecorded{pendingDeposit} -> pendingDeposit : txIds + CommitRecovered{recoveredTxId} -> filter (/= recoveredTxId) txIds CommitFinalized{theDeposit} -> filter (/= theDeposit) txIds _other -> txIds diff --git a/hydra-node/src/Hydra/HeadLogic.hs b/hydra-node/src/Hydra/HeadLogic.hs index 6bf9179b205..4dc86696ca9 100644 --- a/hydra-node/src/Hydra/HeadLogic.hs +++ b/hydra-node/src/Hydra/HeadLogic.hs @@ -986,6 +986,7 @@ onOpenChainRecoverTx headId st recoveredUTxO recoveredTxId = ServerOutput.CommitRecovered { headId , recoveredUTxO + , recoveredTxId } ) where