Extract cardano-testnet-paths micro-package from cardano-testnet
## Context
Part 1 of #6510. Pure refactoring — no behavior change.
Several path conventions (node names, data dirs, socket paths, UTxO key paths) are currently defined as inline literals or local functions scattered across `cardano-testnet`. These paths form a contract that other packages (like `tx-generator`, see #6510) need to consume. Extracting them into a lightweight shared package enables compile-time safety for directory layout conventions.
## Changes
### New: `cardano-testnet/cardano-testnet-paths/cardano-testnet-paths.cabal`
Micro-package cabal file. Depends only on `base` and `filepath`.
### New: `cardano-testnet/cardano-testnet-paths/src/Testnet/Paths.hs`
**`Testnet.Paths`** exports:
```haskell
defaultNodeName :: Int -> String -- "node" <> show n
defaultNodeDataDir :: Int -> FilePath -- "node-data" </> defaultNodeName n
defaultUtxoKeyDir :: Int -> FilePath -- "utxo-keys" </> "utxo" <> show n
defaultUtxoSKeyPath :: Int -> FilePath -- defaultUtxoKeyDir n </> "utxo.skey"
defaultUtxoVKeyPath :: Int -> FilePath -- defaultUtxoKeyDir n </> "utxo.vkey"
defaultUtxoAddrPath :: Int -> FilePath -- defaultUtxoKeyDir n </> "utxo.addr"
defaultSocketDir :: FilePath -- "socket"
defaultSocketName :: FilePath -- "sock"
defaultSocketPath :: Int -> FilePath -- defaultSocketDir </> defaultNodeName n </> defaultSocketName
defaultConfigFile :: FilePath -- "configuration.yaml"
defaultPortFile :: Int -> FilePath -- defaultNodeDataDir n </> "port"
```
### Modify: `cardano-testnet/src/Testnet/Defaults.hs`
Import and re-use `defaultNodeName`, `defaultNodeDataDir` from `Testnet.Paths` instead of defining locally. `defaultUtxoKeys` delegates to `defaultUtxoSKeyPath` and `defaultUtxoVKeyPath` for path construction.
### Modify: `cardano-testnet/src/Testnet/Runtime.hs`
Import `defaultSocketDir`, `defaultSocketName` from `Testnet.Paths` instead of using bare `"socket"` and `"sock"` string literals.
### Modify: `cardano-testnet/src/Testnet/Filepath.hs`
Import `defaultSocketDir` from `Testnet.Paths` instead of using bare `"socket"` string literal.
### Modify: `cardano-testnet/src/Testnet/Start/Cardano.hs`
Import `defaultConfigFile` and `defaultUtxoAddrPath` from `Testnet.Paths` instead of using inline string literals.
### Modify: `cardano-testnet/cardano-testnet.cabal`
Add dependency on `cardano-testnet-paths`.
### Modify: `cabal.project`
Add `cardano-testnet/cardano-testnet-paths` to the `packages` list.
关闭于 2026-04-08 1 条评论