-
Notifications
You must be signed in to change notification settings - Fork 720
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: allow to take node config file as input #6103
base: master
Are you sure you want to change the base?
Conversation
3894926
to
8e37423
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
??
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😆
There was a problem hiding this comment.
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
63c60a5
to
6ca79c5
Compare
For future reference, if we leave the call to > 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 [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}) |
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)
6ca79c5
to
d67ff61
Compare
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)
d67ff61
to
c78c34f
Compare
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)
c78c34f
to
1f7c3d8
Compare
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)
18c0d3e
to
50849e1
Compare
Starting with the > 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
[edit] Solved later on, it was related to not honoring the custom configuration file everywhere |
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)
8117ffc
to
3671f83
Compare
@Jimbo4350> Updated version of this PR now does that 👍 |
… node configuration file (it was unused) This will be done differently in #6103
… node configuration file (it was unused) This will be done differently in #6103
c25acc3
to
6dc7fb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an improvement 👍 . Have a look at my comments.
<> OA.showDefault | ||
<> OA.value 1) | ||
, UserNodeOptions | ||
<$> strOption ( long "node-config" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is an improvement however the resultant type should be [TestnetNodeOptions]
. Users (or QA) may want to for example create forking conditions whereby nodes have different configurations. This will have to be done in another PR at some point.
Nothing -> error $ "Genesis files not specified in node configuration file: " <> nodeInputConfigFile | ||
Just x -> x | ||
adjustedProtocolConfig = | ||
-- Make all the files be relative to the location of the config file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
alonzoGenesisFile | ||
conwayGenesisFile | ||
where | ||
getShelleyGenesises (NodeProtocolConfigurationCardano _byron shelley alonzo conway _hardForkConfig) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also want to confirm the validity of the byron genesis but that can be a separate PR in the future.
where | ||
nSpoNodes = | ||
case cardanoNodes of | ||
UserNodeOptions _ -> 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding this isn't great. This is related to my comment above regarding [TestnetNodeOptions]
-- to run a testnet. "create-staked" is not a good way to do this especially because it | ||
-- makes assumptions about where things should go and where genesis template files should be. | ||
-- See all of the ad hoc file creation/renaming/dir creation etc below. | ||
H.failMessage GHC.callStack "Specifying node configuration files per node not supported yet." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to note that we want to support configuration files per node. However it's not urgent to do this now.
@@ -67,7 +66,7 @@ instance Default CardanoTestnetCliOptions where | |||
data CardanoTestnetOptions = CardanoTestnetOptions | |||
{ -- | List of node options. Each option will result in a single node being | |||
-- created. | |||
cardanoNodes :: [TestnetNodeOptions] | |||
cardanoNodes :: TestnetNodeOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The haddock should be updated
cardanoNumRelays CardanoTestnetOptions{cardanoNodes} = | ||
NumRelays . length $ filter isRelayNodeOptions cardanoNodes | ||
cardanoNumRelays CardanoTestnetOptions{cardanoNodes=_} = | ||
undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
@@ -193,16 +197,15 @@ getDefaultShelleyGenesis asbe maxSupply opts = do | |||
cardanoTestnet :: () | |||
=> HasCallStack | |||
=> CardanoTestnetOptions -- ^ The options to use | |||
-> Conf | |||
-> UserNodeConfig -- ^ The node configuration file to use. If omitted it's generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an indication that TestnetNodeOptions
ought to be renamed to TestnetNodeConfiguration
.
A type like the following would be more indicative:
data TestnetNodeConfiguration
= UserSpecifiedConfiguration FilePath
| DefaultConfiguration [AutomaticNodeOption]
However what we really want is:
data TestnetNodeConfiguration
= UserSpecifiedConfiguration FilePath
| DefaultSpoConfiguration [String]
| DefaultRelayConfiguration [String]
This gives users the most flexibility in that they can spin up a testnet with a mixture of nodes. Haddocks are desperately needed to indicate that [String]
types are command line executable modifiers.
… node configuration file (it was unused) This will be done differently in #6103
a9301e7
to
12c67b4
Compare
12c67b4
to
b26b198
Compare
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.
How to trust this PR
TBD
Checklist