Skip to content

Commit

Permalink
Add relative dir relay field to cluster configuration record
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed May 3, 2024
1 parent 0b08671 commit aeaf62a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/benchmarks/exe/latency-bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ withShelleyServer tracers action = withFaucet $ \faucetClientEnv -> do
]
, cfgTracer = stdoutTextTracer
, cfgNodeOutputFile = Nothing
, cfgRelayNodePath = mkRelDirOf "relay"
}
withCluster
clusterConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import Cardano.Wallet.Launch.Cluster.Env
)
import Cardano.Wallet.Launch.Cluster.FileOf
( DirOf (..)
, toFilePath
, toFilePath, mkRelDirOf
)
import Cardano.Wallet.Network.Implementation.Ouroboros
( tunedForMainnetPipeliningStrategy
Expand Down Expand Up @@ -350,6 +350,7 @@ withServer
, cfgShelleyGenesisMods = []
, cfgTracer = tr'
, cfgNodeOutputFile = nodeOutputFile
, cfgRelayNodePath = mkRelDirOf "relay"
}
withCluster clusterConfig faucetFunds
$ onClusterStart
Expand Down Expand Up @@ -461,6 +462,7 @@ setupContext
, cfgShelleyGenesisMods = []
, cfgTracer = tr'
, cfgNodeOutputFile = nodeOutputFile
, cfgRelayNodePath = mkRelDirOf "relay"
}

putMVar
Expand Down
1 change: 1 addition & 0 deletions lib/local-cluster/exe/local-cluster.hs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ main = withUtf8 $ do
, cfgShelleyGenesisMods = [over #sgSlotLength \_ -> 0.2]
, cfgTracer = stdoutTextTracer
, cfgNodeOutputFile = Nothing
, cfgRelayNodePath = mkRelDirOf "relay"
}
node <-
ContT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ withCluster config@Config{..} faucetFunds onClusterStart = runClusterM config
genesisFiles
poolPorts
runningPool0
runningNode <- ContT $ withRelayNode relayNodeParams
runningNode <-
ContT $ withRelayNode relayNodeParams cfgRelayNodePath
liftIO $ onClusterStart runningNode
where
FaucetFunds pureAdaFunds maryAllegraFunds massiveWalletFunds =
Expand Down
3 changes: 3 additions & 0 deletions lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import Cardano.Wallet.Launch.Cluster.ClusterEra
import Cardano.Wallet.Launch.Cluster.FileOf
( DirOf
, FileOf
, RelDirOf
)
import Cardano.Wallet.Launch.Cluster.Logging
( ClusterLog (..)
Expand Down Expand Up @@ -65,4 +66,6 @@ data Config = Config
-- ^ Shelley genesis modifications to apply.
, cfgTracer :: Tracer IO ClusterLog
, cfgNodeOutputFile :: Maybe (FileOf "node-output")
-- ^ File to write node output to.
, cfgRelayNodePath :: RelDirOf "relay"
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Cardano.Wallet.Launch.Cluster.ClusterM
)
import Cardano.Wallet.Launch.Cluster.FileOf
( DirOf (..)
, RelDirOf (..)
, absFilePathOf
, toFilePath
)
Expand Down Expand Up @@ -69,12 +70,13 @@ import System.Path.Directory
withRelayNode
:: NodeParams
-- ^ Parameters used to generate config files.
-> RelDirOf "relay"
-- ^ Path segment for the node to add to the cluster directory.
-> (RunningNode -> ClusterM a)
-- ^ Callback function with socket path
-> ClusterM a
withRelayNode params onClusterStart = do
withRelayNode params (RelDirOf nodeSegment) onClusterStart = do
let name = "node"
nodeSegment = relDir name
DirOf nodeDirPath <- askNodeDir nodeSegment
let NodeParams genesisFiles hardForks (port, peers) logCfg _ = params
bracketTracer' "withRelayNode" $ do
Expand Down
3 changes: 3 additions & 0 deletions lib/unit/test/unit/Cardano/Wallet/Shelley/NetworkSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Cardano.Wallet.Launch.Cluster
)
import Cardano.Wallet.Launch.Cluster.FileOf
( DirOf (..)
, mkRelDirOf
)
import Cardano.Wallet.Network
( NetworkLayer (..)
Expand Down Expand Up @@ -353,6 +354,8 @@ withTestNode tr action = do
, cfgShelleyGenesisMods = []
, cfgTracer = tr
, cfgNodeOutputFile = Nothing
, cfgRelayNodePath = mkRelDirOf "relay"

}
withCluster clusterConfig (FaucetFunds [] [] [])
$ \(RunningNode sock genesisData vData) -> do
Expand Down

0 comments on commit aeaf62a

Please sign in to comment.