Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ADR for checking node configuration files with cardano-cli #52

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/ADR-5-cardano-testnet-node-configuration-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Status

📜 Proposed 2024-09-10

# Context

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.

# Decision
carbolymer marked this conversation as resolved.
Show resolved Hide resolved

## Add a new command in the CLI

Introduce a new command in `cardano-cli` that takes a node configuration file as parameter and performs sanity checks:

1. The configuration file can be loaded.
2. Paths of genesis files are specified.
3. Hashes of genesis files are specified and are correct.

## Alternatives considered

### Provide a fixup option

We considered having a flag that would make `check-node-configuration`:

1. Fill the hashes of genesis files if missing
2. Fix the hashes of genesis files if present but wrong

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.

### Have `create-testnet-data` create the node configuration file

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` (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 to create a full-fledged node configuration file.

# Consequences

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.
2 changes: 2 additions & 0 deletions docs/Architecture-Decision-Records.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* ✅ [[ADR-1 Default eras for CLI commands]]
* ✅ [[ADR-2 Module structure for generators]]
* 📜 [[ADR-3 Dependencies version constraints in cabal file]]
* 📜 [[ADR-4 Support-only-for-mainnet-and-upcoming-eras]]
* 📜 [[ADR-5 cardano-testnet-node-configuration-file]]
* 📜 [[ADR-6 Using optparse-applicative main repository]]
* 📜 [[ADR-7 CLI Output Presentation]]

Expand Down
Loading