You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ADR-5-cardano-testnet-node-configuration-file.md
+16-14Lines changed: 16 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,7 @@
4
4
5
5
# Context
6
6
7
-
There is no canonical way to create a node configuration file. `cardano-cli` offers this possibility as part of the bigger [create-cardano](https://github.com/IntersectMBO/cardano-cli/blob/551d9b9f2f244e0d681bf03eaa6d985565ac3a5b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_genesis_create-cardano.cli#L49) command, but this is ad-hoc.
8
-
9
-
Programmatic users proceed as follows instead:
10
-
11
-
* Scripts like [mkfiles.sh](https://github.com/IntersectMBO/cardano-node/blob/51a034a51c5cefdd6ab4b9ff1e71710cf0c96643/scripts/babbage/mkfiles.sh#L85) and [jobs.nix](https://github.com/input-output-hk/cardano-parts/blob/0abf510e0ed70fda4e6ad3ae71632c20d09f135a/flakeModules/jobs.nix#L253) copy an existing template.
12
-
*[cardano-testnet](https://github.com/IntersectMBO/cardano-node/blob/51a034a51c5cefdd6ab4b9ff1e71710cf0c96643/cardano-testnet/src/Testnet/Defaults.hs#L340) uses a hardcoded Haskell value.
7
+
There is no way to check a node configuration file for basic sanity issues.
13
8
14
9
# Decision
15
10
@@ -19,18 +14,25 @@ Introduce a new `debug check-node-configuration FILEPATH` command in `cardano-cl
19
14
20
15
```
21
16
--node-configuration-file FILEPATH
22
-
[--fix-configuration-file]
23
17
```
24
18
25
-
Option `-node-configuration-file` specifies the path of the file to check. The optional flag `--fix-configuration-file` lets `cardano-cli` fix the wrong genesis hashes (or fill them in) in the file specified by `--node-configuration-file`. By default (i.e. when `--fix-configuration-file` is not specified), `check-node-configuration` only checks that the genesis hashes are correct: it doesn't correct them.
19
+
Option `-node-configuration-file` specifies the path of the file to check. This command checks that the paths of genesis files are specified and that the hashes of those files are correct.
20
+
21
+
## Alternatives considered
22
+
23
+
### Have a `--fix` flag
24
+
25
+
We considered having a `--fix` flag that would make `check-node-configuration`:
26
+
27
+
1. Fill the hashes of genesis files if missing
28
+
2. Fix the hashes of genesis files if present but wrong
29
+
30
+
However, in the end, we favored having pure commands (i.e. commands that don't modify things) so we ruled `--fix` out.
26
31
27
-
## Have `create-testnet-data` create the node configuration file
32
+
###Have `create-testnet-data` create the node configuration file
28
33
29
-
Have `create-testnet-data` create a default node configuration file (populating it with the paths and hashes of the genesis files).
34
+
We considered having `create-testnet-data` create a default node configuration file, and populating it with the paths and hashes of the genesis files. This could have been nice to users, but it is complicated to implement, because most of the types for the node configuration file live in `cardano-node` (see [here](https://github.com/IntersectMBO/cardano-node/blob/ef5f0a9ed52d969b3753c96955add25b9e08f02d/cardano-node/src/Cardano/Node/Configuration/POM.hs#L87)). What we have in `cardano-api` (see [here](https://github.com/IntersectMBO/cardano-api/blob/4dde2e65c496f989f079354f407e7617563f4bc7/cardano-api/internal/Cardano/Api/LedgerState.hs#L1048)) for the node configuration file is not general enough.
30
35
31
36
# Consequences
32
37
33
-
* This will allow users that spin testnets to generate their node configuration file using `create-testnet-data`
34
-
* As a consequence, this will avoid having to keep track of external templates
35
-
* This will allow to remove some code in [cardano-testnet](https://github.com/IntersectMBO/cardano-node/blob/51a034a51c5cefdd6ab4b9ff1e71710cf0c96643/cardano-testnet/src/Testnet/Defaults.hs#L340)
36
-
* It will make possible to generalize `cardano-testnet` so that it allows to pass custom node configuration files (this is [cardano-node/issues/3719](https://github.com/IntersectMBO/cardano-node/issues/3719), and to have a handy way to generate those files.
38
+
This will allow users that spin testnets to check their node configuration file using `check-node-configuration`.
0 commit comments