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

Sanity checking for node configuration on startup #874

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

fraser-iohk
Copy link
Contributor

@fraser-iohk fraser-iohk commented Jan 11, 2024

  • This PR adds a a new mechanism for sanity checking node configuration on startup
  • These checks are intended to operate as a warning to users that they may have misconfigured their node, and are designed to be easily bypassed by a user who is intentionally configuring their node in an unusual but possibly acceptable way
  • For safety reasons, the first change to cardano-node to support this will only log the exception in the standard way, though in future it should cause the node to terminate. We plan to add a way for the cardano-node tracer implementation to distinguish between sanity check issues which are fatal and those which are only warnings.
  • The first of these checks is simply to ensure that K, the security parameter, is consistent between all known eras. If eras' security parameters are different, a SanityCheckIssue exception will be traced in the new sanityCheckIssueTracer.

There is an associated branch in the cardano-node repository with changes required to support this additional Tracer.

@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch from 89e8181 to ca818ca Compare January 11, 2024 12:35
@dnadales dnadales requested a review from Jimbo4350 January 11, 2024 13:31
@nfrisby
Copy link
Contributor

nfrisby commented Jan 11, 2024

is a Tracer the correct way to report these errors / warnings?

My immediate thought is that the kinds of errors we're concerned with here deserve exceptions.

@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch 4 times, most recently from d50d74b to ff8db93 Compare February 7, 2024 15:06
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch 3 times, most recently from 1eb753d to 57bdbd3 Compare February 14, 2024 18:25
@fraser-iohk fraser-iohk marked this pull request as ready for review February 15, 2024 14:43
@fraser-iohk fraser-iohk requested a review from a team as a code owner February 15, 2024 14:43
@fraser-iohk
Copy link
Contributor Author

fraser-iohk commented Feb 15, 2024

My immediate thought is that the kinds of errors we're concerned with here deserve exceptions.

when I discussed this initially with damien and javier, we thought that tracers would be better, since the "errors" we want to raise here shouldn't necessarily be fatal, but probably should at least be communicated to the user as a warning. we thought that implementing them with a Tracer meant that we'd have the flexibility to change it easily and have different issues with varying severity. I don't think exceptions are a bad idea, but it feels a little more awkward to have someone (probably a developer) add catches than to add a filter to a Tracer

edit: putting "errors" in quotes makes it look like I'm being snarky when I'm not trying to, I think that me calling them "errors" in the first place was a mistake

@fraser-iohk fraser-iohk changed the title wip: a mechanism for checking at startup whether K (SecurityParam) is consistent between constituent eras of the HFC Sanity checking for node configuration on startup Feb 15, 2024
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch 3 times, most recently from 1b7a6de to 09adfd2 Compare February 20, 2024 12:54
Copy link
Contributor

@nfrisby nfrisby 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 "Requesting changes" only because of the dangling dead code comment.

Otherwise, looks very good. Great comments. Idiomatic design. 👍

Regarding tracers, versus exceptions: tracers does seem reasonable, given that these checks are not necessarily fatal.

@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch 2 times, most recently from 81fc683 to b90cb3c Compare March 4, 2024 10:47
@nfrisby nfrisby dismissed their stale review April 8, 2024 12:59

no more dead code comment :thumbs-up:

@jasagredo jasagredo linked an issue Apr 16, 2024 that may be closed by this pull request
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch from b90cb3c to 08dc61b Compare June 25, 2024 12:19
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch 3 times, most recently from 19fedfa to e730e81 Compare July 1, 2024 12:08
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch from 5977d3b to c46fc2a Compare July 4, 2024 09:35
@fraser-iohk
Copy link
Contributor Author

appropriate changes to cardano-node are available on the fraser-iohk/consensus-startup-sanity-checks branch: https://github.com/IntersectMBO/cardano-node/tree/fraser-iohk/consensus-startup-sanity-checks

@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch from 63846a8 to 82454c0 Compare July 8, 2024 15:04
@amesgen
Copy link
Member

amesgen commented Jul 8, 2024

appropriate changes to cardano-node are available on the fraser-iohk/consensus-startup-sanity-checks branch: https://github.com/IntersectMBO/cardano-node/tree/fraser-iohk/consensus-startup-sanity-checks

Wasn't the idea (also see #874 (comment)) to throw an exception for InconsistentSecurityParam (as part of the tracer, based on a "fatality" classification function in Consensus)?

@fraser-iohk
Copy link
Contributor Author

Wasn't the idea (also see #874 (comment)) to throw an exception for InconsistentSecurityParam (as part of the tracer, based on a "fatality" classification function in Consensus)?

yep, that's the goal for the future, but for the first iteration (when stuff might go wrong) I've just made it trace the exception since I don't want to potentially break node use cases without warning the user for at least one version first

Copy link
Member

@amesgen amesgen left a comment

Choose a reason for hiding this comment

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

Wasn't the idea (also see #874 (comment)) to throw an exception for InconsistentSecurityParam (as part of the tracer, based on a "fatality" classification function in Consensus)?

yep, that's the goal for the future, but for the first iteration (when stuff might go wrong) I've just made it trace the exception since I don't want to potentially break node use cases without warning the user for at least one version first

Makes sense, can you record that somewhere, maybe in #125?


Apart from that, LGTM after formatting, squasing and updating the PR description 👍

@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch 2 times, most recently from d9fdb4c to 1173bb5 Compare July 22, 2024 12:09
@fraser-iohk fraser-iohk enabled auto-merge July 23, 2024 10:40
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch from 1173bb5 to 7bd62bf Compare July 23, 2024 12:10
Currently the only supported sanity check is that k (the security parameter) is consistent between eras, and traces a SanityCheckIssue exception if it isn't
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/startup-sanity-checks branch from 7bd62bf to 8448a91 Compare July 23, 2024 12:30
@fraser-iohk fraser-iohk added this pull request to the merge queue Jul 23, 2024
Merged via the queue into main with commit ee232fb Jul 23, 2024
15 checks passed
@fraser-iohk fraser-iohk deleted the fraser-iohk/startup-sanity-checks branch July 23, 2024 13:47
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.

Throw an impure exception when k differs across eras
4 participants