Skip to content

Commit

Permalink
Add a note under TODO comment
Browse files Browse the repository at this point in the history
To explain the reason for this to stay.

Also improved a NetworkId arg haddock.
  • Loading branch information
ffakenz committed Jan 3, 2024
1 parent c68a51f commit 076d9b0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
7 changes: 4 additions & 3 deletions hydra-cluster/src/CardanoClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module CardanoClient (

import Hydra.Prelude

import Hydra.Cardano.Api hiding (Block, queryCurrentEra)
import Hydra.Cardano.Api hiding (Block)
import Hydra.Chain.CardanoClient

import Cardano.Api.UTxO qualified as UTxO
Expand Down Expand Up @@ -90,7 +90,7 @@ waitForPayment ::
Lovelace ->
Address ShelleyAddr ->
IO UTxO
waitForPayment networkId socket amount addr = do
waitForPayment networkId socket amount addr =
go
where
go = do
Expand All @@ -108,9 +108,10 @@ waitForUTxO ::
SocketPath ->
UTxO ->
IO ()
waitForUTxO networkId nodeSocket utxo = do
waitForUTxO networkId nodeSocket utxo =
forM_ (snd <$> UTxO.pairs utxo) forEachUTxO
where
forEachUTxO :: TxOut CtxUTxO -> IO ()
forEachUTxO = \case
TxOut (ShelleyAddressInEra addr@ShelleyAddress{}) value _ _ -> do
void $
Expand Down
2 changes: 1 addition & 1 deletion hydra-cluster/src/Hydra/Cluster/Faucet.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Hydra.Cluster.Faucet where

import Hydra.Cardano.Api hiding (cardanoEra, queryCurrentEra)
import Hydra.Cardano.Api
import Hydra.Prelude
import Test.Hydra.Prelude

Expand Down
2 changes: 1 addition & 1 deletion hydra-cluster/test/Test/Hydra/Cluster/FaucetSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec = do
showLogsOnFailure "FaucetSpec" $ \tracer ->
failAfter 30 $
withTempDir "end-to-end-cardano-node" $ \tmpDir ->
withCardanoNodeDevnet (contramap FromCardanoNode tracer) tmpDir $ \node -> do
withCardanoNodeDevnet (contramap FromCardanoNode tracer) tmpDir $ \node ->
replicateConcurrently_ 10 $ do
vk <- generate genVerificationKey
seedFromFaucet_ node vk 1_000_000 (contramap FromFaucet tracer)
Expand Down
8 changes: 4 additions & 4 deletions hydra-node/src/Hydra/Chain/CardanoClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ data CardanoClient = CardanoClient
mkCardanoClient :: NetworkId -> SocketPath -> CardanoClient
mkCardanoClient networkId nodeSocket =
CardanoClient
{ queryUTxOByAddress = \addresses -> do
queryUTxO networkId nodeSocket QueryTip addresses
{ queryUTxOByAddress = queryUTxO networkId nodeSocket QueryTip
, networkId
}

Expand Down Expand Up @@ -190,7 +189,8 @@ awaitTransaction ::
-- | The transaction to watch / await
Tx ->
IO UTxO
awaitTransaction networkId socket tx = go
awaitTransaction networkId socket tx =
go
where
ins = keys (UTxO.toMap $ utxoFromTx tx)
go = do
Expand Down Expand Up @@ -374,7 +374,7 @@ queryUTxOWhole networkId socket queryPoint = do
queryUTxOFor :: NetworkId -> SocketPath -> QueryPoint -> VerificationKey PaymentKey -> IO UTxO
queryUTxOFor networkId nodeSocket queryPoint vk =
case mkVkAddress networkId vk of
ShelleyAddressInEra addr -> do
ShelleyAddressInEra addr ->
queryUTxO networkId nodeSocket queryPoint [addr]
ByronAddressInEra{} ->
fail "impossible: mkVkAddress returned Byron address."
Expand Down
2 changes: 2 additions & 0 deletions hydra-node/src/Hydra/Chain/Direct.hs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ chainSyncClient handler wallet startingPoint =
pure clientStIdle
BlockInMode _ block ConwayEraInCardanoMode -> do
-- TODO: uses cardano-api:internal
-- NOTE: we should remove this dependency once we have ShelleyBlock available
-- on the normal cardano-api library.
let (ShelleyBlock ShelleyBasedEraConway conwayBlock) = block
-- XXX: We should not be needing to wrap / unwrap in addition. We
-- just found those functions to satisfy the types.
Expand Down
3 changes: 2 additions & 1 deletion hydra-node/src/Hydra/Chain/Direct/ScriptRegistry.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ registryUTxO scriptRegistry =
--
-- Can throw at least 'NewScriptRegistryException' on failure.
queryScriptRegistry ::
-- | Current network discriminant
-- | cardano-node's network identifier.
-- A combination of network discriminant + magic number.
NetworkId ->
-- | Filepath to the cardano-node's domain socket
SocketPath ->
Expand Down

0 comments on commit 076d9b0

Please sign in to comment.