Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

13 changes: 8 additions & 5 deletions cardano-testnet/src/Parsers/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Copy link

Copilot AI Mar 3, 2026

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.

Copilot uses AI. Check for mistakes.
-- 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)")
Copy link
Contributor

@carbolymer carbolymer Mar 12, 2026

Choose a reason for hiding this comment

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

Suggested change
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' UpdateTimestamps (OA.long "update-time" <> OA.help "Update the time stamps in genesis files to current date (flag is deprecated) (default)")

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.")
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link

Copilot AI Mar 3, 2026

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”).

Suggested change
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 uses AI. Check for mistakes.
Comment on lines +135 to +142
Copy link

Copilot AI Mar 3, 2026

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”).

Suggested change
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 uses AI. Check for mistakes.

Comment on lines +140 to 143
Copy link

Copilot AI Mar 3, 2026

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.

Suggested change
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."
)

Copilot uses AI. Check for mistakes.
pEnvOutputDir :: Parser FilePath
pEnvOutputDir = OA.strOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage: cardano-testnet cardano [--num-pool-nodes COUNT]
[--slot-length SECONDS]
[--active-slots-coeff DOUBLE]
[--node-env FILEPATH]
[--update-time]
[--update-time | --no-update-time]

Start a testnet and keep it running until stopped

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Usage: cardano-testnet cardano [--num-pool-nodes COUNT]
[--slot-length SECONDS]
[--active-slots-coeff DOUBLE]
[--node-env FILEPATH]
[--update-time]
[--update-time | --no-update-time]

Start a testnet and keep it running until stopped

Expand Down Expand Up @@ -51,5 +51,7 @@ Available options:
with the 'create-env' command, then modify it and
pass it with this argument.
--update-time Update the time stamps in genesis files to current
date
date (default, kept for backward compatibility)
--no-update-time Do not update the time stamps in genesis files to
current date.
-h,--help Show this help text
Loading