-
Notifications
You must be signed in to change notification settings - Fork 16
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 check-node-configuration command #923
base: main
Are you sure you want to change the base?
Conversation
c740c1f
to
9a6f631
Compare
66c8ef2
to
9d4dba7
Compare
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
4be047d
to
212c3d2
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.
LGTM. I think I'll leave the approval to @Jimbo4350
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
d8c18e5
to
5b42105
Compare
Putting back to draft while I change the code to use |
f64d941
to
682dc9a
Compare
682dc9a
to
887fbc0
Compare
@Jimbo4350, @carbolymer> done that: #923 (comment) However, the code still needs to use the vanilla Nevertheless, this version using |
887fbc0
to
2aafdb0
Compare
3db92ac
to
1e89e5d
Compare
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
-> NodeConfig | ||
-- ^ The parsed node configuration file | ||
-> ExceptT DebugCmdError IO (Maybe Analysis) | ||
mkAnalysis cEra@(AnyCardanoEra era) configFile nodeConfig = do |
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're doing a validation of the node configuration file. Why not use https://hackage.haskell.org/package/validation?
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 don't depend on validation
yet and I believe this simple use case does not justify adding an external dependency.
-- | Build an 'Analysis' value from the given node configuration file, for the given era. | ||
-- Reads the genesis file path and hash from the node configuration file, if they exist. | ||
mkAnalysis | ||
:: AnyCardanoEra |
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.
Use the experimental api interface here. We don't care about previous eras.
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 parameter isn't about the era we support, it's about the era whose hash we want to validate. I updated the haddock to make this explicit, as this indeed is an usual use case for us.
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 only care about mainnet and the upcoming era and therefore the configuration files associated with those eras which include Byron, Shelley, Alonzo and Conway genesis files/hashes. I.e we check all for the presence of all of theses things in the Conway era. If another genesis file is added in an upcoming era then we would add that additional check for the upcoming era. Currently there are a bunch of irrelevant cases that return Nothing
which we can totally exclude by not parameterizing on AnyCardanoEra
.
cardano-cli/src/Cardano/CLI/Run/Debug/CheckNodeConfiguration.hs
Outdated
Show resolved
Hide resolved
|
||
-- | Get the data associated with the given role for the given era. | ||
getData :: CardanoEra a -> Role r -> NodeConfig -> Maybe (DataKind r) | ||
getData era role 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.
Create standalone functions that retrieve the genesis files and hashes from the node configuration. Pattern matching on the eras exposed by the experimental and calling the relevant functions will simplify this code.
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.
As I wrote in #923 (comment), this code doesn't depend on the era, so using the experimental API here doesn't help.
7ed8319
to
78c0fe5
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.
Also we need to come up with a better name than Analysis
.
78c0fe5
to
2e88aae
Compare
Renamed to |
27126cd
to
637e846
Compare
637e846
to
f6d4b34
Compare
Note
Needs IntersectMBO/cardano-api#652
Changelog
Context
How to trust this PR
Try it yourself:
TBD
Checklist