|
4 | 4 | -- testnet configurations depend on this module so that directory |
5 | 5 | -- layout changes are kept in sync at compile time. |
6 | 6 | module Cardano.Node.Testnet.Paths |
7 | | - ( defaultNodeName |
| 7 | + ( -- * Node paths |
| 8 | + defaultNodeName |
8 | 9 | , defaultNodeDataDir |
| 10 | + , defaultConfigFile |
| 11 | + , defaultPortFile |
| 12 | + , defaultNodeEnvFile |
| 13 | + -- * Socket paths |
| 14 | + , defaultSocketDir |
| 15 | + , defaultSocketName |
| 16 | + , defaultSocketPath |
| 17 | + -- * UTxO key paths |
9 | 18 | , defaultUtxoKeyDir |
10 | 19 | , defaultUtxoSKeyPath |
11 | 20 | , defaultUtxoVKeyPath |
12 | 21 | , defaultUtxoAddrPath |
13 | | - , defaultSocketDir |
14 | | - , defaultSocketName |
15 | | - , defaultSocketPath |
16 | | - , defaultConfigFile |
17 | | - , defaultPortFile |
18 | | - , defaultNodeEnvFile |
| 22 | + -- * Genesis paths |
| 23 | + , defaultGenesisFilepath |
| 24 | + -- * Committee key paths |
| 25 | + , defaultCommitteeName |
| 26 | + , defaultCommitteeKeysDir |
| 27 | + , defaultCommitteeVkeyFp |
| 28 | + , defaultCommitteeSkeyFp |
| 29 | + -- * DRep key paths |
| 30 | + , defaultDRepName |
| 31 | + , defaultDRepKeysDir |
| 32 | + , defaultDRepDir |
| 33 | + , defaultDRepVkeyFp |
| 34 | + , defaultDRepSkeyFp |
| 35 | + -- * SPO key paths |
| 36 | + , defaultSpoName |
| 37 | + , defaultSpoKeysDir |
| 38 | + , defaultSpoColdVKeyFp |
| 39 | + , defaultSpoColdSKeyFp |
| 40 | + , defaultSpoVrfVKeyFp |
| 41 | + , defaultSpoVrfSKeyFp |
| 42 | + , defaultSpoStakingRewardVKeyFp |
| 43 | + , defaultSpoStakingRewardSKeyFp |
| 44 | + , defaultSpoKesVKeyFp |
| 45 | + , defaultSpoKesSKeyFp |
| 46 | + , defaultSpoOpcertCounterFp |
| 47 | + , defaultSpoOpcertCertFp |
| 48 | + , defaultSpoByronDelegationCertFp |
| 49 | + , defaultSpoByronDelegateKeyFp |
| 50 | + -- * Delegator key paths |
| 51 | + , defaultDelegatorName |
| 52 | + , defaultDelegatorStakeKeysDir |
| 53 | + , defaultDelegatorStakeDir |
| 54 | + , defaultDelegatorStakeVKeyFp |
| 55 | + , defaultDelegatorStakeSKeyFp |
19 | 56 | ) where |
20 | 57 |
|
| 58 | +import Cardano.Api (CardanoEra, docToString, pretty) |
| 59 | + |
| 60 | +import Data.Char (toLower) |
21 | 61 | import System.FilePath ((</>)) |
22 | 62 |
|
23 | | --- | The name of a node: @"node" <> show n@ |
| 63 | +-- --------------------------------------------------------------------- |
| 64 | +-- Node paths |
| 65 | +-- --------------------------------------------------------------------- |
| 66 | + |
| 67 | +-- | Testnet configuration file name: @"configuration.yaml"@ |
| 68 | +defaultConfigFile :: FilePath |
| 69 | +defaultConfigFile = "configuration.yaml" |
| 70 | + |
| 71 | +-- | Directory name component for a node, e.g. @"node1"@, @"node2"@ |
24 | 72 | defaultNodeName :: Int -> String |
25 | 73 | defaultNodeName n = "node" <> show n |
26 | 74 |
|
27 | | --- | Relative path to a node's data directory: @"node-data" </> defaultNodeName n@ |
| 75 | +-- | Relative path to a node's data directory |
28 | 76 | defaultNodeDataDir :: Int -> FilePath |
29 | 77 | defaultNodeDataDir n = "node-data" </> defaultNodeName n |
30 | 78 |
|
31 | | --- | Relative path to a UTxO key directory: @"utxo-keys" </> "utxo" <> show n@ |
| 79 | +-- | Relative path to the file containing a node's assigned port number |
| 80 | +defaultPortFile :: Int -> FilePath |
| 81 | +defaultPortFile n = defaultNodeDataDir n </> "port" |
| 82 | + |
| 83 | +-- | Relative path to a node's environment file |
| 84 | +defaultNodeEnvFile :: Int -> FilePath |
| 85 | +defaultNodeEnvFile n = defaultNodeDataDir n </> "env" |
| 86 | + |
| 87 | +-- --------------------------------------------------------------------- |
| 88 | +-- Socket paths |
| 89 | +-- --------------------------------------------------------------------- |
| 90 | + |
| 91 | +-- | Top-level directory for node sockets: @"socket"@ |
| 92 | +defaultSocketDir :: FilePath |
| 93 | +defaultSocketDir = "socket" |
| 94 | + |
| 95 | +-- | Socket file name: @"sock"@ |
| 96 | +defaultSocketName :: FilePath |
| 97 | +defaultSocketName = "sock" |
| 98 | + |
| 99 | +-- | Relative path to a node's UNIX domain socket |
| 100 | +defaultSocketPath :: Int -> FilePath |
| 101 | +defaultSocketPath n = defaultSocketDir </> defaultNodeName n </> defaultSocketName |
| 102 | + |
| 103 | +-- --------------------------------------------------------------------- |
| 104 | +-- UTxO key paths |
| 105 | +-- --------------------------------------------------------------------- |
| 106 | + |
| 107 | +-- | Directory for a UTxO key set |
32 | 108 | defaultUtxoKeyDir :: Int -> FilePath |
33 | 109 | defaultUtxoKeyDir n = "utxo-keys" </> "utxo" <> show n |
34 | 110 |
|
35 | | --- | Relative path to a UTxO signing key: @defaultUtxoKeyDir n </> "utxo.skey"@ |
| 111 | +-- | Relative path to a UTxO signing key |
36 | 112 | defaultUtxoSKeyPath :: Int -> FilePath |
37 | 113 | defaultUtxoSKeyPath n = defaultUtxoKeyDir n </> "utxo.skey" |
38 | 114 |
|
39 | | --- | Relative path to a UTxO verification key: @defaultUtxoKeyDir n </> "utxo.vkey"@ |
| 115 | +-- | Relative path to a UTxO verification key |
40 | 116 | defaultUtxoVKeyPath :: Int -> FilePath |
41 | 117 | defaultUtxoVKeyPath n = defaultUtxoKeyDir n </> "utxo.vkey" |
42 | 118 |
|
43 | | --- | Relative path to a UTxO address file: @defaultUtxoKeyDir n </> "utxo.addr"@ |
| 119 | +-- | Relative path to a UTxO address file |
44 | 120 | defaultUtxoAddrPath :: Int -> FilePath |
45 | 121 | defaultUtxoAddrPath n = defaultUtxoKeyDir n </> "utxo.addr" |
46 | 122 |
|
47 | | --- | Socket directory name: @"socket"@ |
48 | | -defaultSocketDir :: FilePath |
49 | | -defaultSocketDir = "socket" |
| 123 | +-- --------------------------------------------------------------------- |
| 124 | +-- Genesis paths |
| 125 | +-- --------------------------------------------------------------------- |
50 | 126 |
|
51 | | --- | Socket file name: @"sock"@ |
52 | | -defaultSocketName :: FilePath |
53 | | -defaultSocketName = "sock" |
| 127 | +-- | Era-specific genesis file name, e.g. @"conway-genesis.json"@. Generated by @create-testnet-data@ — don't change it. |
| 128 | +defaultGenesisFilepath :: CardanoEra a -> FilePath |
| 129 | +defaultGenesisFilepath era = |
| 130 | + map toLower (docToString (pretty era)) <> "-genesis.json" |
54 | 131 |
|
55 | | --- | Relative path to a node's socket: @defaultSocketDir </> defaultNodeName n </> defaultSocketName@ |
56 | | -defaultSocketPath :: Int -> FilePath |
57 | | -defaultSocketPath n = defaultSocketDir </> defaultNodeName n </> defaultSocketName |
| 132 | +-- --------------------------------------------------------------------- |
| 133 | +-- Committee key paths |
| 134 | +-- --------------------------------------------------------------------- |
58 | 135 |
|
59 | | --- | Main node configuration file name: @"configuration.yaml"@ |
60 | | -defaultConfigFile :: FilePath |
61 | | -defaultConfigFile = "configuration.yaml" |
| 136 | +-- | File name stem for committee key files, e.g. @"committee1"@ |
| 137 | +defaultCommitteeName :: Int -> String |
| 138 | +defaultCommitteeName n = "committee" <> show n |
62 | 139 |
|
63 | | --- | Relative path to a node's port file: @defaultNodeDataDir n </> "port"@ |
64 | | -defaultPortFile :: Int -> FilePath |
65 | | -defaultPortFile n = defaultNodeDataDir n </> "port" |
| 140 | +-- | Top-level directory for committee key files: @"committee-keys"@ |
| 141 | +defaultCommitteeKeysDir :: FilePath |
| 142 | +defaultCommitteeKeysDir = "committee-keys" |
66 | 143 |
|
67 | | --- | Relative path to a node's env file: @defaultNodeDataDir n </> "env"@ |
68 | | -defaultNodeEnvFile :: Int -> FilePath |
69 | | -defaultNodeEnvFile n = defaultNodeDataDir n </> "env" |
| 144 | +-- | Relative path to a committee member's verification key |
| 145 | +defaultCommitteeVkeyFp :: Int -> FilePath |
| 146 | +defaultCommitteeVkeyFp n = defaultCommitteeKeysDir </> defaultCommitteeName n <> ".vkey" |
| 147 | + |
| 148 | +-- | Relative path to a committee member's signing key |
| 149 | +defaultCommitteeSkeyFp :: Int -> FilePath |
| 150 | +defaultCommitteeSkeyFp n = defaultCommitteeKeysDir </> defaultCommitteeName n <> ".skey" |
| 151 | + |
| 152 | +-- --------------------------------------------------------------------- |
| 153 | +-- DRep key paths |
| 154 | +-- --------------------------------------------------------------------- |
| 155 | + |
| 156 | +-- | File name stem for DRep key files, e.g. @"drep1"@ |
| 157 | +defaultDRepName :: Int -> String |
| 158 | +defaultDRepName n = "drep" <> show n |
| 159 | + |
| 160 | +-- | Top-level directory for DRep key files: @"drep-keys"@ |
| 161 | +defaultDRepKeysDir :: FilePath |
| 162 | +defaultDRepKeysDir = "drep-keys" |
| 163 | + |
| 164 | +-- | Directory for a single DRep's key files |
| 165 | +defaultDRepDir :: Int -> FilePath |
| 166 | +defaultDRepDir n = defaultDRepKeysDir </> defaultDRepName n |
| 167 | + |
| 168 | +-- | Relative path to a DRep's verification key |
| 169 | +defaultDRepVkeyFp :: Int -> FilePath |
| 170 | +defaultDRepVkeyFp n = defaultDRepDir n </> "drep.vkey" |
| 171 | + |
| 172 | +-- | Relative path to a DRep's signing key |
| 173 | +defaultDRepSkeyFp :: Int -> FilePath |
| 174 | +defaultDRepSkeyFp n = defaultDRepDir n </> "drep.skey" |
| 175 | + |
| 176 | +-- --------------------------------------------------------------------- |
| 177 | +-- SPO key paths |
| 178 | +-- --------------------------------------------------------------------- |
| 179 | + |
| 180 | +-- | File name stem for SPO key files, e.g. @"pool1"@ |
| 181 | +defaultSpoName :: Int -> String |
| 182 | +defaultSpoName n = "pool" <> show n |
| 183 | + |
| 184 | +-- | Directory for a SPO's key files |
| 185 | +defaultSpoKeysDir :: Int -> FilePath |
| 186 | +defaultSpoKeysDir n = "pools-keys" </> defaultSpoName n |
| 187 | + |
| 188 | +-- | Relative path to a SPO's cold verification key |
| 189 | +defaultSpoColdVKeyFp :: Int -> FilePath |
| 190 | +defaultSpoColdVKeyFp n = defaultSpoKeysDir n </> "cold.vkey" |
| 191 | + |
| 192 | +-- | Relative path to a SPO's cold signing key |
| 193 | +defaultSpoColdSKeyFp :: Int -> FilePath |
| 194 | +defaultSpoColdSKeyFp n = defaultSpoKeysDir n </> "cold.skey" |
| 195 | + |
| 196 | +-- | Relative path to a SPO's VRF verification key |
| 197 | +defaultSpoVrfVKeyFp :: Int -> FilePath |
| 198 | +defaultSpoVrfVKeyFp n = defaultSpoKeysDir n </> "vrf.vkey" |
| 199 | + |
| 200 | +-- | Relative path to a SPO's VRF signing key |
| 201 | +defaultSpoVrfSKeyFp :: Int -> FilePath |
| 202 | +defaultSpoVrfSKeyFp n = defaultSpoKeysDir n </> "vrf.skey" |
| 203 | + |
| 204 | +-- | Relative path to a SPO's staking reward verification key |
| 205 | +defaultSpoStakingRewardVKeyFp :: Int -> FilePath |
| 206 | +defaultSpoStakingRewardVKeyFp n = defaultSpoKeysDir n </> "staking-reward.vkey" |
| 207 | + |
| 208 | +-- | Relative path to a SPO's staking reward signing key |
| 209 | +defaultSpoStakingRewardSKeyFp :: Int -> FilePath |
| 210 | +defaultSpoStakingRewardSKeyFp n = defaultSpoKeysDir n </> "staking-reward.skey" |
| 211 | + |
| 212 | +-- | Relative path to a SPO's KES verification key |
| 213 | +defaultSpoKesVKeyFp :: Int -> FilePath |
| 214 | +defaultSpoKesVKeyFp n = defaultSpoKeysDir n </> "kes.vkey" |
| 215 | + |
| 216 | +-- | Relative path to a SPO's KES signing key |
| 217 | +defaultSpoKesSKeyFp :: Int -> FilePath |
| 218 | +defaultSpoKesSKeyFp n = defaultSpoKeysDir n </> "kes.skey" |
| 219 | + |
| 220 | +-- | Relative path to a SPO's operational certificate counter |
| 221 | +defaultSpoOpcertCounterFp :: Int -> FilePath |
| 222 | +defaultSpoOpcertCounterFp n = defaultSpoKeysDir n </> "opcert.counter" |
| 223 | + |
| 224 | +-- | Relative path to a SPO's operational certificate |
| 225 | +defaultSpoOpcertCertFp :: Int -> FilePath |
| 226 | +defaultSpoOpcertCertFp n = defaultSpoKeysDir n </> "opcert.cert" |
| 227 | + |
| 228 | +-- | Relative path to a SPO's Byron delegation certificate |
| 229 | +defaultSpoByronDelegationCertFp :: Int -> FilePath |
| 230 | +defaultSpoByronDelegationCertFp n = defaultSpoKeysDir n </> "byron-delegation.cert" |
| 231 | + |
| 232 | +-- | Relative path to a SPO's Byron delegate key |
| 233 | +defaultSpoByronDelegateKeyFp :: Int -> FilePath |
| 234 | +defaultSpoByronDelegateKeyFp n = defaultSpoKeysDir n </> "byron-delegate.key" |
| 235 | + |
| 236 | +-- --------------------------------------------------------------------- |
| 237 | +-- Delegator key paths |
| 238 | +-- --------------------------------------------------------------------- |
| 239 | + |
| 240 | +-- | File name stem for delegator key files, e.g. @"delegator1"@ |
| 241 | +defaultDelegatorName :: Int -> String |
| 242 | +defaultDelegatorName n = "delegator" <> show n |
| 243 | + |
| 244 | +-- | Top-level directory for stake delegator key files: @"stake-delegators"@ |
| 245 | +defaultDelegatorStakeKeysDir :: FilePath |
| 246 | +defaultDelegatorStakeKeysDir = "stake-delegators" |
| 247 | + |
| 248 | +-- | Directory for a single delegator's stake key files |
| 249 | +defaultDelegatorStakeDir :: Int -> FilePath |
| 250 | +defaultDelegatorStakeDir n = defaultDelegatorStakeKeysDir </> defaultDelegatorName n |
| 251 | + |
| 252 | +-- | Relative path to a delegator's stake verification key |
| 253 | +defaultDelegatorStakeVKeyFp :: Int -> FilePath |
| 254 | +defaultDelegatorStakeVKeyFp n = defaultDelegatorStakeDir n </> "staking.vkey" |
| 255 | + |
| 256 | +-- | Relative path to a delegator's stake signing key |
| 257 | +defaultDelegatorStakeSKeyFp :: Int -> FilePath |
| 258 | +defaultDelegatorStakeSKeyFp n = defaultDelegatorStakeDir n </> "staking.skey" |
0 commit comments