From 890e634f1a24bc4f6b3caf9b871e2bbaa7514fc1 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Wed, 3 Jan 2024 14:03:15 +0000 Subject: [PATCH] match on ChainConfig in withHydraNode --- hydra-cluster/hydra-cluster.cabal | 1 - hydra-cluster/src/CardanoNode.hs | 4 ++-- hydra-cluster/src/HydraNode.hs | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hydra-cluster/hydra-cluster.cabal b/hydra-cluster/hydra-cluster.cabal index 423f1d905e7..a7550eb89b5 100644 --- a/hydra-cluster/hydra-cluster.cabal +++ b/hydra-cluster/hydra-cluster.cabal @@ -80,7 +80,6 @@ library , async , base >=4.7 && <5 , bytestring - , cardano-ledger-babbage , cardano-ledger-core , cardano-slotting , containers diff --git a/hydra-cluster/src/CardanoNode.hs b/hydra-cluster/src/CardanoNode.hs index b0cf1c46d84..353aa89d968 100644 --- a/hydra-cluster/src/CardanoNode.hs +++ b/hydra-cluster/src/CardanoNode.hs @@ -429,8 +429,8 @@ instance Exception ProcessHasExited -- functions in Hydra.Chain.CardanoClient and Hydra.Cluster.CardanoClient, -- sometimes we deliberately want to use the cardano-cli to ensure -- compatibility. -cliQueryProtocolParameters :: RunningNode -> IO Value -cliQueryProtocolParameters RunningNode{nodeSocket, networkId} = do +cliQueryProtocolParameters :: SocketPath -> NetworkId -> IO Value +cliQueryProtocolParameters nodeSocket networkId = do out <- readCreateProcess cmd "" unsafeDecodeJson $ fromString out where diff --git a/hydra-cluster/src/HydraNode.hs b/hydra-cluster/src/HydraNode.hs index 817c65db22e..86de08ca3e6 100644 --- a/hydra-cluster/src/HydraNode.hs +++ b/hydra-cluster/src/HydraNode.hs @@ -305,15 +305,18 @@ withHydraNode' :: IO a withHydraNode' chainConfig workDir hydraNodeId hydraSKey hydraVKeys allNodeIds pparams mGivenStdOut action = do withSystemTempDirectory "hydra-node" $ \dir -> do - -- NOTE: This implicitly tests of cardano-cli with hydra-node let cardanoLedgerProtocolParametersFile = dir "protocol-parameters.json" - protocolParameters <- cliQueryProtocolParameters - Aeson.encodeFile cardanoLedgerProtocolParametersFile $ - protocolParameters - & atKey "txFeeFixed" ?~ toJSON (Number 0) - & atKey "txFeePerByte" ?~ toJSON (Number 0) - & key "executionUnitPrices" . atKey "priceMemory" ?~ toJSON (Number 0) - & key "executionUnitPrices" . atKey "priceSteps" ?~ toJSON (Number 0) + case chainConfig of + Offline _ -> undefined + Direct DirectChainConfig{nodeSocket, networkId} -> do + -- NOTE: This implicitly tests of cardano-cli with hydra-node + protocolParameters <- cliQueryProtocolParameters nodeSocket networkId + Aeson.encodeFile cardanoLedgerProtocolParametersFile $ + protocolParameters + & atKey "txFeeFixed" ?~ toJSON (Number 0) + & atKey "txFeePerByte" ?~ toJSON (Number 0) + & key "executionUnitPrices" . atKey "priceMemory" ?~ toJSON (Number 0) + & key "executionUnitPrices" . atKey "priceSteps" ?~ toJSON (Number 0) let hydraSigningKey = dir (show hydraNodeId <> ".sk") void $ writeFileTextEnvelope (File hydraSigningKey) Nothing hydraSKey