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

Conversation

smelc
Copy link
Contributor

@smelc smelc commented Sep 10, 2024

ADR explaining how we came up with the CLI's check-node-configuration command.

I've left the various commits to allow reviewers to see the decision's history, but I will squash before merging.


# Context

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you highlight more status quo here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end I didn't, because the scope changed: we only check the configuration file, we don't create it.

Copy link
Collaborator

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should have a command to create a node configuration file as we will be repeating ourselves in a sense (why not just create the config file to begin with?). On the other hand a command that checks a node config file for the user would be handy. For example:

  • The files listed do exist (and can be successfully decoded?)
  • The mandatory configuration values are set


Introduce a new `conway genesis check-node-config file` command in `cardano-cli`. It will have the following options:

```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why list the options again? It should just check the existence of filepaths and that the genesis file hashes are correct. Have a look at the other fields that it may make sense to have checks for as well but to re-enter the file paths doesn't make sense imo. Parameterizing it on the era makes sense because things can change era to era and notifying the user what they may be missing in an upcoming era would be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, actually this was an earlier design and the actual WIP work (this branch) has the following API:

cardano-cli debug check-node-configuration
  --node-configuration-file FILEPATH
  [--fix-configuration-file]

Updating the ADR accordingly right now 👍


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

1. Have `create-testnet-data` create a default node configuration file (populating it with the paths and hashes of the genesis files).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

docs/ADR-5-cardano-testnet-node-configuration-file.md Outdated Show resolved Hide resolved
@smelc smelc changed the title Add ADR for generating node configuration files with cardano-cli Add ADR for checking node configuration files with cardano-cli Nov 26, 2024
@smelc smelc force-pushed the smelc/adr-5-node-config branch 4 times, most recently from 1210aa6 to e977968 Compare November 26, 2024 09:21
@smelc smelc marked this pull request as ready for review November 26, 2024 09:22
@smelc smelc requested review from a team as code owners November 26, 2024 09:22

# Context

There is no way to check a node configuration file for basic sanity issues.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe the risks and who is affected by not checking the configuration file?
I see that you described it in the Consequences, but I think it belongs more to the Context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 👍

Adding more details in the Context section:

 # Context
 
-There is no way to check a node configuration file for basic sanity issues.
+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.

Introduce a new `debug check-node-configuration FILEPATH` command in `cardano-cli`. It will have the following options:

```
--node-configuration-file FILEPATH
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid listing the command names and option names. Those are parts of the user interface design, and not really n part of an architecture. Additionally, the commands and option names can change during the time and the ADR will be out of sync.

If you insist on keeping the command and option names, can you rephrase the text to make them examples rather than a references to a command option / toggle?
For example instead of

Have a --fix flag

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

write

Provide fix up capability

We considered having a dedicated flag (e.g. --fix) that would make the command:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carbolymer> good point 👍

I addressed your concerns in the additional commit Do not give exact API in the ADR. Make it more high-level.

Copy link
Collaborator

@carbolymer carbolymer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this. 👍🏻

I remember there was a brief discussion about parsing of node config files, where the datatypes should lie and what's the difference between the cardano-node parsing of config file and what's done in api/cli. If there were conclusions, they would be worth adding here I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants