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

cardano-testnet executable: take node config file as optional input #6103

Draft
wants to merge 6 commits into
base: smelc/per-genesis-file-origin
Choose a base branch
from

Conversation

smelc
Copy link
Contributor

@smelc smelc commented Feb 5, 2025

Note

On top of #6138

Description

Fixes #6069

With @CarlosLopezDeLara's input, I have chosen an all or nothing behavior: either you pass the configuration file and all genesis files or you pass none of them. If we choose an à la carte behavior, it's cumbersome to implement, and anyway since the node configuration file contains the hashes of genesis files, there is at least some degree of binding between all of these files.

After feedback from Jordan, we finally only ask the user to provide the node configuration file. Then we read the eras' genesis files by looking at the paths specified in the node configuration file. This way, no additional flag needed, nor checking consistency between the flags and the node configuration file.

TBD

How to trust this PR

TBD

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • CI passes.
  • Self-reviewed the diff

@smelc smelc changed the title cardano-testnet: allow to take config files as input cardano-testnet: allow to take node config and genesis files as input Feb 5, 2025
@smelc smelc linked an issue Feb 5, 2025 that may be closed by this pull request
17 tasks
Base automatically changed from smelc/cardano-testnet-support-custom-node-config-file to master February 5, 2025 16:14
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from 3894926 to 8e37423 Compare February 7, 2025 13:53
@smelc smelc marked this pull request as ready for review February 7, 2025 13:53
@smelc smelc requested a review from a team as a code owner February 7, 2025 13:53
Copy link
Contributor

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

How do you plan to deal with conflicts in the node configuration yaml file? I think this is the wrong approach. We don't want to be forced to reconcile configuration file differences. All we should need the is the node configuration yaml file.

decodeFileThrow $ icfAlonzoGenesisConfigFile inputConfigFiles
conwayGenesisFile :: ConwayGenesis StandardCrypto <-
decodeFileThrow $ icfConwayGenesisConfigFile inputConfigFiles
runTestnet testnetOptions $ cardanoTestnet
Copy link
Contributor

Choose a reason for hiding this comment

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

why does runTestnet result in a Property??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

runTestnet doesn't return a property but it does take a Conf -> H.Integration a callback, as visible here:

runTestnet :: CardanoTestnetOptions -> (Conf -> H.Integration a) -> IO ()

This is a bit meh and we can probably improve that: in the case where the user provides a configuration file, we would like not be tied to the hedgehog-extras/hedgehog APIs like Integration and Property. But this is something we would better do in the future, not in this PR, because it's not required for reaching a first release of cardano-testnet IMHO. And also, it will be some work, because our existing "backend", e.g. cardanoTestnet here is in the Integration monad. So it's not an easy change.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can return to this. Could you create an issue to track it? The issue just needs to point out its an issue 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Jimbo4350> created follow-up issue: #6122

@smelc smelc force-pushed the smelc/testnet-pass-config-files branch 2 times, most recently from 63c60a5 to 6ca79c5 Compare February 11, 2025 16:16
@smelc
Copy link
Contributor Author

smelc commented Feb 12, 2025

For future reference, if we leave the call to cardano-cli debug check-node-configuration, we have the following failures with the following genesis files:

> cabal run cardano-testnet -- cardano --output-dir cl-output-dir --node-config cl-example/configuration.json --testnet-magic 44
  ✗ <interactive> failed at src/Testnet/Start/Cardano.hs:283:3
    after 1 test.
    shrink path: 1:
  
    forAll0 =
      Process exited with non-zero exit-code: 1
      ━━━━ stdout ━━━━
      Checking byron genesis file: cl-example/byron.genesis.spec.json
      
      ━━━━ stderr ━━━━
      Error reading node configuration at: cl-example/byron.genesis.spec.json: Incorrect schema for GenesisData.
       Error: expected field protocolConsts

It seems the code is requiring too much data here when deserializing the Byron genesis. This data is actually not required to start the node (i.e. if we remove the check, the testnet starts fine). So it seems overkill to require this data when starting a testnet.

[edit] Oh well, it seems the node doesn't like it either actually:

<interactive> failed at src/Testnet/Start/Cardano.hs:342:5
    after 1 test.
    shrink path: 1:
  
    forAll0 =
      Cardano node process did not start: CardanoProtocolInstantiationError (CardanoProtocolInstantiationErrorByron (GenesisReadError "/home/churlin/dev/cardano-node/cl-example/byron.genesis.spec.json" (GenesisDataSchemaError (SchemaError {seExpected = "field protocolConsts", seActual = Nothing}))))
      
      cardano-node: There was an error parsing the genesis file: "/home/churlin/dev/cardano-node/cl-example/byron.genesis.spec.json" Error: GenesisDataSchemaError (SchemaError {seExpected = "field protocolConsts", seActual = Nothing})

smelc added a commit that referenced this pull request Feb 12, 2025
The node itself, when it starts, doesn't require hashes of genesis
files. So it seems overkill to require it to start a testnet.
See also
#6103 (comment)
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from 6ca79c5 to d67ff61 Compare February 12, 2025 10:38
smelc added a commit that referenced this pull request Feb 12, 2025
The node itself, when it starts, doesn't require hashes of genesis
files. So it seems overkill to require it to start a testnet.
See also
#6103 (comment)
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from d67ff61 to c78c34f Compare February 12, 2025 10:39
smelc added a commit that referenced this pull request Feb 12, 2025
The node itself, when it starts, doesn't require hashes of genesis
files. So it seems overkill to require it to start a testnet.
See also
#6103 (comment)
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from c78c34f to 1f7c3d8 Compare February 12, 2025 14:25
smelc added a commit that referenced this pull request Feb 12, 2025
The node itself, when it starts, doesn't require hashes of genesis
files. So it seems overkill to require it to start a testnet.
See also
#6103 (comment)
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from 18c0d3e to 50849e1 Compare February 12, 2025 15:30
@smelc
Copy link
Contributor Author

smelc commented Feb 12, 2025

Starting with the configuration.yaml file created by running the queries (e.g. the sandbox created by DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/CliQueries/"') test fails as follows:

> cabal run cardano-testnet -- cardano --output-dir cl-output-dir --node-config nix-shell.Ai0S6G/cli-queries-test-6184168d6b9797eb/configuration.yaml --testnet-magic 44

✗ <interactive> failed at src/Testnet/Start/Cardano.hs:342:5
    after 1 test.
    shrink path: 1:
  
    forAll0 =
      Cardano node process did not start: CardanoProtocolInstantiationError (CardanoProtocolInstantiationErrorByron (CredentialsError DelegationCertificateNotFromGenesisKey))
      
      cardano-node: Byron leader credentials error: DelegationCertificateNotFromGenesisKey

I'm a bit puzzled.

[edit] Solved later on, it was related to not honoring the custom configuration file everywhere

smelc added a commit that referenced this pull request Feb 12, 2025
The node itself, when it starts, doesn't require hashes of genesis
files. So it seems overkill to require it to start a testnet.
See also
#6103 (comment)
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch 3 times, most recently from 8117ffc to 3671f83 Compare February 18, 2025 12:14
@smelc smelc changed the title cardano-testnet: allow to take node config and genesis files as input cardano-testnet: allow to take node config file as input Feb 18, 2025
@smelc
Copy link
Contributor Author

smelc commented Feb 18, 2025

All we should need the is the node configuration yaml file.

@Jimbo4350> Updated version of this PR now does that 👍

smelc added a commit that referenced this pull request Feb 18, 2025
… node configuration file (it was unused)

This will be done differently in
#6103
smelc added a commit that referenced this pull request Feb 18, 2025
… node configuration file (it was unused)

This will be done differently in
#6103
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from c25acc3 to 6dc7fb4 Compare February 18, 2025 14:52
@smelc smelc changed the base branch from master to smelc/per-genesis-file-origin March 4, 2025 16:02
@smelc smelc force-pushed the smelc/per-genesis-file-origin branch 8 times, most recently from 15b1364 to 24e09df Compare March 10, 2025 10:23
@smelc smelc force-pushed the smelc/per-genesis-file-origin branch from 24e09df to ad8dbd6 Compare March 10, 2025 14:10
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch 7 times, most recently from e03bd74 to 1b6c518 Compare March 11, 2025 10:02
@smelc smelc changed the title cardano-testnet: allow to take node config file as input cardano-testnet executable: take node config file as optional input Mar 11, 2025
@smelc smelc force-pushed the smelc/per-genesis-file-origin branch from ad8dbd6 to 70c0e00 Compare March 11, 2025 14:51
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from 1b6c518 to c4aba77 Compare March 11, 2025 15:04
@smelc smelc force-pushed the smelc/per-genesis-file-origin branch from 70c0e00 to 9cd0ae0 Compare March 11, 2025 15:07
@smelc smelc force-pushed the smelc/testnet-pass-config-files branch from c4aba77 to 4d424b6 Compare March 11, 2025 15:51
@smelc smelc force-pushed the smelc/per-genesis-file-origin branch from 9cd0ae0 to 72ea5dc Compare March 11, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] - cardano-testnet: Use flags to pass genesis and configuration files
2 participants