Skip to content

Commit 40f7066

Browse files
committed
Update ADR 5 with actual decision
1 parent 91ff9d8 commit 40f7066

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

docs/ADR-5-cardano-testnet-node-configuration-file.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44

55
# Context
66

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.
138

149
# Decision
1510

@@ -19,18 +14,25 @@ Introduce a new `debug check-node-configuration FILEPATH` command in `cardano-cl
1914

2015
```
2116
--node-configuration-file FILEPATH
22-
[--fix-configuration-file]
2317
```
2418

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.
2631

27-
## Have `create-testnet-data` create the node configuration file
32+
### Have `create-testnet-data` create the node configuration file
2833

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.
3035

3136
# Consequences
3237

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

Comments
 (0)