Skip to content

Commit

Permalink
match on ChainConfig in withHydraNode
Browse files Browse the repository at this point in the history
  • Loading branch information
locallycompact committed Jan 3, 2024
1 parent 5ac2048 commit 890e634
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
1 change: 0 additions & 1 deletion hydra-cluster/hydra-cluster.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ library
, async
, base >=4.7 && <5
, bytestring
, cardano-ledger-babbage
, cardano-ledger-core
, cardano-slotting
, containers
Expand Down
4 changes: 2 additions & 2 deletions hydra-cluster/src/CardanoNode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions hydra-cluster/src/HydraNode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 890e634

Please sign in to comment.