-
Notifications
You must be signed in to change notification settings - Fork 753
cardano-testnet: Default to --update-time and add --no-update-time flag
#6466
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ### Added | ||
|
|
||
| - Added `--no-update-time` flag. | ||
|
|
||
| ### Changed | ||
|
|
||
| - Made `--update-time` flag the default. | ||
|
|
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -132,11 +132,14 @@ pMainnetParams = OA.flag' OnChainParamsMainnet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pUpdateTimestamps :: Parser UpdateTimestamps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pUpdateTimestamps = OA.flag DontUpdateTimestamps UpdateTimestamps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ( OA.long "update-time" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <> OA.help "Update the time stamps in genesis files to current date" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <> OA.showDefault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pUpdateTimestamps = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- Default to UpdateTimestamps, because when using the two-step flow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- (cardano-testnet create-env → cardano-testnet cardano --node-env), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- genesis timestamps can become stale. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- See https://github.com/IntersectMBO/cardano-node/issues/6455 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OA.flag' UpdateTimestamps (OA.long "update-time" <> OA.help "Update the time stamps in genesis files to current date (default, kept for backward compatibility)") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It would be nice to remove this flag at some point, because it may be confusing. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <|> OA.flag' DontUpdateTimestamps (OA.long "no-update-time" <> OA.help "Do not update the time stamps in genesis files to current date.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be simplified with value, |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <|> pure UpdateTimestamps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+135
to
+142
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pUpdateTimestamps = | |
| -- Default to UpdateTimestamps, because when using the two-step flow | |
| -- (cardano-testnet create-env → cardano-testnet cardano --node-env), | |
| -- genesis timestamps can become stale. | |
| -- See https://github.com/IntersectMBO/cardano-node/issues/6455 | |
| OA.flag' UpdateTimestamps (OA.long "update-time" <> OA.help "Update the time stamps in genesis files to current date (default, kept for backward compatibility)") | |
| <|> OA.flag' DontUpdateTimestamps (OA.long "no-update-time" <> OA.help "Do not update the time stamps in genesis files to current date.") | |
| <|> pure UpdateTimestamps | |
| pUpdateTimestamps = do | |
| -- Default to UpdateTimestamps, because when using the two-step flow | |
| -- (cardano-testnet create-env → cardano-testnet cardano --node-env), | |
| -- genesis timestamps can become stale. | |
| -- See https://github.com/IntersectMBO/cardano-node/issues/6455 | |
| mUpdate <- optional $ | |
| OA.flag' () (OA.long "update-time" | |
| <> OA.help "Update the time stamps in genesis files to current date (default, kept for backward compatibility)") | |
| mNoUpdate <- optional $ | |
| OA.flag' () (OA.long "no-update-time" | |
| <> OA.help "Do not update the time stamps in genesis files to current date.") | |
| case (mUpdate, mNoUpdate) of | |
| (Just _, Just _) -> | |
| fail "cannot use --update-time and --no-update-time together" | |
| (Just _, Nothing) -> | |
| pure UpdateTimestamps | |
| (Nothing, Just _) -> | |
| pure DontUpdateTimestamps | |
| (Nothing, Nothing) -> | |
| pure UpdateTimestamps |
Copilot
AI
Mar 3, 2026
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 parser models --update-time and --no-update-time as mutually exclusive alternatives, but it doesn’t provide a dedicated/conflict-specific error if a user supplies both flags (it will fail parsing, typically with a generic option parsing error). If you want a clearer UX, parse both flags in a way that can detect “both present” and then emit an explicit conflict message (e.g., “cannot use --update-time and --no-update-time together”).
| pUpdateTimestamps = | |
| -- Default to UpdateTimestamps, because when using the two-step flow | |
| -- (cardano-testnet create-env → cardano-testnet cardano --node-env), | |
| -- genesis timestamps can become stale. | |
| -- See https://github.com/IntersectMBO/cardano-node/issues/6455 | |
| OA.flag' UpdateTimestamps (OA.long "update-time" <> OA.help "Update the time stamps in genesis files to current date (default, kept for backward compatibility)") | |
| <|> OA.flag' DontUpdateTimestamps (OA.long "no-update-time" <> OA.help "Do not update the time stamps in genesis files to current date.") | |
| <|> pure UpdateTimestamps | |
| pUpdateTimestamps = do | |
| -- Default to UpdateTimestamps, because when using the two-step flow | |
| -- (cardano-testnet create-env → cardano-testnet cardano --node-env), | |
| -- genesis timestamps can become stale. | |
| -- See https://github.com/IntersectMBO/cardano-node/issues/6455 | |
| updateFlag <- OA.switch | |
| ( OA.long "update-time" | |
| <> OA.help "Update the time stamps in genesis files to current date (default, kept for backward compatibility)" | |
| ) | |
| noUpdateFlag <- OA.switch | |
| ( OA.long "no-update-time" | |
| <> OA.help "Do not update the time stamps in genesis files to current date." | |
| ) | |
| case (updateFlag, noUpdateFlag) of | |
| (True, True) -> | |
| fail "cannot use --update-time and --no-update-time together" | |
| (True, False) -> | |
| pure UpdateTimestamps | |
| (False, True) -> | |
| pure DontUpdateTimestamps | |
| (False, False) -> | |
| pure UpdateTimestamps |
Copilot
AI
Mar 3, 2026
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 option/parser definition (especially line 140) is very dense and will be harder to edit consistently over time (e.g., help text updates, wrapping, reuse across commands). Consider splitting the OA.long/OA.help parts onto their own lines (or binding the help strings/options to named values) so future changes are less error-prone.
| OA.flag' UpdateTimestamps (OA.long "update-time" <> OA.help "Update the time stamps in genesis files to current date (default, kept for backward compatibility)") | |
| <|> OA.flag' DontUpdateTimestamps (OA.long "no-update-time" <> OA.help "Do not update the time stamps in genesis files to current date.") | |
| <|> pure UpdateTimestamps | |
| updateTimestampsFlag | |
| <|> noUpdateTimestampsFlag | |
| <|> pure UpdateTimestamps | |
| where | |
| updateTimestampsFlag :: Parser UpdateTimestamps | |
| updateTimestampsFlag = | |
| OA.flag' UpdateTimestamps | |
| ( OA.long "update-time" | |
| <> OA.help "Update the time stamps in genesis files to current date (default, kept for backward compatibility)" | |
| ) | |
| noUpdateTimestampsFlag :: Parser UpdateTimestamps | |
| noUpdateTimestampsFlag = | |
| OA.flag' DontUpdateTimestamps | |
| ( OA.long "no-update-time" | |
| <> OA.help "Do not update the time stamps in genesis files to current date." | |
| ) |
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 option/parser definition (especially line 140) is very dense and will be harder to edit consistently over time (e.g., help text updates, wrapping, reuse across commands). Consider splitting the
OA.long/OA.helpparts onto their own lines (or binding the help strings/options to named values) so future changes are less error-prone.