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

Create defaultYamlValue for cardano-testnet #5128

Merged
merged 1 commit into from
May 9, 2023

Conversation

Jimbo4350
Copy link
Contributor

Previously we were reading configuration files from disk and then modifying the configuration value. This is not ideal as one could not reasonably expect the on disk configuration to be equivalent to what the node's actual configuration is.

@Jimbo4350 Jimbo4350 force-pushed the jordan/create-default-yaml-value-cardano-testnet branch 2 times, most recently from e6bb300 to c1d1d16 Compare April 20, 2023 14:35
@Jimbo4350 Jimbo4350 marked this pull request as ready for review April 20, 2023 14:35
. HM.insert "TestAllegraHardForkAtEpoch" (J.toJSON @Int 0)
. HM.insert "TestMaryHardForkAtEpoch" (J.toJSON @Int 0)
. HM.insert "TestAlonzoHardForkAtEpoch" (J.toJSON @Int 0)
. HM.insert "LastKnownBlockVersion-Major" (J.toJSON @Int 6)
Copy link
Contributor

Choose a reason for hiding this comment

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

This code allowed us to choose which eras to hard fork to. Are we dropping this support?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We aren't. I was going to do a follow up PR implementing a function that will take an era and produce the "correct" yaml configuration value. I can do it here as well however.

Copy link
Contributor

Choose a reason for hiding this comment

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

Either that or add a TODO so we don't forget.

. HM.insert "TestAlonzoHardForkAtEpoch" (J.toJSON @Int 0)
. HM.insert "LastKnownBlockVersion-Major" (J.toJSON @Int 6)
H.createDirectoryIfMissing_ logDir


-- We're going to use really quick epochs (300 seconds), by using short slots 0.2s
-- and K=10, but we'll keep long KES periods so we don't have to bother
-- cycling KES keys
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a stray comment here. Looks like intended to comment code that does something necessary so needs to be paired up with code that does the thing it says.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment exists by the shelley genesis creation below (which is where it should be). I'll delete this comment.

@@ -700,15 +654,17 @@ cardanoTestnet testnetOptions H.Conf {..} = do
H.assertIO . IO.doesFileExist $ tempAbsPath </> "tx1.tx"

-- Add Byron, Shelley and Alonzo genesis hashes to node configuration
-- TODO: These genesis filepaths should not be hardcoded. Using the cli as a library
-- rather as an executable will allow us to get the genesis files paths in a more
-- direct fashion.
Copy link
Contributor

Choose a reason for hiding this comment

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

If we test using the library rather than the executable, it would mean that we aren't testing the CLI parsing code. Is this definitely the direction we want to go?

If we do head down this way, there is something we need to watch out for. Some CLI does error handling with error which doesn't give us a clear interface with which to catch errors and handle them. We should probably be more rigorous with how we error in the command implementation and not use error if we go down this way so tests can handle those cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we test using the library rather than the executable, it would mean that we aren't testing the CLI parsing code. Is this definitely the direction we want to go?

I think so. We can separately test individual commands to see if they parse correctly but its not needed to launch a testnet and should simplify things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some CLI does error handling with error which doesn't give us a clear interface with which to catch errors and handle them. We should probably be more rigorous with how we error in the command implementation and not use error if we go down this way so tests can handle those cases.

Good point 👍

, ("defaultScribes", defaultScribes)
, ("setupBackends", Aeson.Array $ Vector.fromList ["KatipBK"])
, ("defaultBackends", Aeson.Array $ Vector.fromList ["KatipBK"])
, ("options", Aeson.object mempty)
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be useful to have comments here about where these values come from or why these particular values were chosen if that information is available.

-- The node process can fail on startup, e.g while
-- parsing the configuration yaml file. If we don't fail
-- when stderr is populated, we end up having to wait for the
-- timeout to expire before we can see the error.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe if we had a command or function that only parses the configuration file and we can call that before starting the node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems wrong/not ideal to parse the configuration file twice. We should propagate the exceptions thrown by node.

@Jimbo4350 Jimbo4350 force-pushed the jordan/create-default-yaml-value-cardano-testnet branch from c1d1d16 to 3f51575 Compare May 9, 2023 13:38
@Jimbo4350 Jimbo4350 force-pushed the jordan/create-default-yaml-value-cardano-testnet branch 2 times, most recently from dfdc11b to ef381b9 Compare May 9, 2023 14:11
@Jimbo4350 Jimbo4350 force-pushed the jordan/create-default-yaml-value-cardano-testnet branch 2 times, most recently from 5986d40 to b2a0445 Compare May 9, 2023 15:54
@Jimbo4350 Jimbo4350 force-pushed the jordan/create-default-yaml-value-cardano-testnet branch from b2a0445 to 8142d40 Compare May 9, 2023 16:26
@Jimbo4350 Jimbo4350 enabled auto-merge May 9, 2023 17:29
@Jimbo4350 Jimbo4350 added this pull request to the merge queue May 9, 2023
Merged via the queue into master with commit 168621d May 9, 2023
@iohk-bors iohk-bors bot deleted the jordan/create-default-yaml-value-cardano-testnet branch May 9, 2023 18:28
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