Skip to content

Commit 55fa90b

Browse files
authored
Merge pull request #52 from input-output-hk/smelc/adr-5-node-config
Add ADR for checking node configuration files with cardano-cli
2 parents bbf170e + bd2ac25 commit 55fa90b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Status
2+
3+
📜 Proposed 2024-09-10
4+
5+
# Context
6+
7+
There is no way to check a node configuration file for basic sanity issues. This is a problem for people running testnets, because they will only discover _after having started their testnet_ that something is wrong (because the node will refuse to start). And starting a testnet is a costly operation, meaning the failures will only happen after tenth of seconds; causing the feedback loop to be slow.
8+
9+
# Decision
10+
11+
## Add a new command in the CLI
12+
13+
Introduce a new command in `cardano-cli` that takes a node configuration file as parameter and performs sanity checks:
14+
15+
1. The configuration file can be loaded.
16+
2. Paths of genesis files are specified.
17+
3. Hashes of genesis files are specified and are correct.
18+
19+
## Alternatives considered
20+
21+
### Provide a fixup option
22+
23+
We considered having a flag that would make `check-node-configuration`:
24+
25+
1. Fill the hashes of genesis files if missing
26+
2. Fix the hashes of genesis files if present but wrong
27+
28+
However, in the end, we favored having a pure command (i.e. a command that doesn't modify things) so we ruled such a fixup flag.
29+
30+
### Have `create-testnet-data` create the node configuration file
31+
32+
We considered having `create-testnet-data` create a default node configuration file, and populating it with the paths and hashes of 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`, as for example the `NodeConfiguration` type which lives in [cardano-node/src/Cardano/Node/Configuration/POM.hs](https://github.com/IntersectMBO/cardano-node/blob/ef5f0a9ed52d969b3753c96955add25b9e08f02d/cardano-node/src/Cardano/Node/Configuration/POM.hs#L87). The `NodeConfig` type which we have in `cardano-api` (see [cardano-api/internal/Cardano/Api/LedgerState.hs](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 to create a full-fledged node configuration file.
33+
34+
However, moving the `NodeConfiguration` type and its accompanying types to `cardano-api` is a large endeavor, which was not given priority yet. It is a large endeavor for two reasons: `NodeConfiguration` has many fields of different types and it is quite different from `NodeConfig`. `NodeConfig` contains the bare minimum needed for API specific operations: it is mostly concerned with genesis files and their hashes.
35+
36+
# Consequences
37+
38+
This will allow users of testnets to check their node configuration file before starting their testnet, and so they will catch errors earlier and faster.

docs/Architecture-Decision-Records.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*[[ADR-1 Default eras for CLI commands]]
44
*[[ADR-2 Module structure for generators]]
55
* 📜 [[ADR-3 Dependencies version constraints in cabal file]]
6+
* 📜 [[ADR-4 Support-only-for-mainnet-and-upcoming-eras]]
7+
* 📜 [[ADR-5 cardano-testnet-node-configuration-file]]
68
* 📜 [[ADR-6 Using optparse-applicative main repository]]
79
* 📜 [[ADR-7 CLI Output Presentation]]
810

0 commit comments

Comments
 (0)