From 8c29016cb90b18c8d01fc4ec23a2c5cef6284596 Mon Sep 17 00:00:00 2001 From: Duncan Coutts Date: Mon, 30 Nov 2020 10:45:33 +0000 Subject: [PATCH] Prefer Shelley CLI commands over Byron ones where they clash We have done a fair bit of shuffling of CLI commands over time, and have kept the old commands for backwards compatibility. There was a name clash over the "genesis" top level command: between the Shelley command and the backwards compat Byron command. Reorder the command lists so we prefer the new Shelley commands, and generally the new ones over the old ones. --- cardano-cli/src/Cardano/CLI/Parsers.hs | 9 +++++++-- cardano-node-chairman/src/Testnet/Byron.hs | 4 +++- cardano-node-chairman/src/Testnet/ByronShelley.hs | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Parsers.hs b/cardano-cli/src/Cardano/CLI/Parsers.hs index 7a8d909448a..f8d3c13f331 100644 --- a/cardano-cli/src/Cardano/CLI/Parsers.hs +++ b/cardano-cli/src/Cardano/CLI/Parsers.hs @@ -34,8 +34,13 @@ pref = Opt.prefs showHelpOnEmpty parseClientCommand :: Parser ClientCommand parseClientCommand = asum - [ parseByron <|> backwardsCompatibilityCommands - , parseShelley <|> parseDeprecatedShelleySubcommand + -- There are name clashes between Shelley commands and the Byron backwards + -- compat commands (e.g. "genesis"), and we need to prefer the Shelley ones + -- so we list it first. + [ parseShelley + , parseByron + , parseDeprecatedShelleySubcommand + , backwardsCompatibilityCommands , parseDisplayVersion ] diff --git a/cardano-node-chairman/src/Testnet/Byron.hs b/cardano-node-chairman/src/Testnet/Byron.hs index eca0e5c58e8..8e81cb949c1 100644 --- a/cardano-node-chairman/src/Testnet/Byron.hs +++ b/cardano-node-chairman/src/Testnet/Byron.hs @@ -74,7 +74,9 @@ testnet H.Conf {..} = do -- Generate keys void $ H.execCli - [ "genesis" + [ "byron" + , "genesis" + , "genesis" , "--genesis-output-dir", tempAbsPath "genesis" , "--start-time", showUTCTimeSeconds startTime , "--protocol-parameters-file", tempAbsPath "protocol-params.json" diff --git a/cardano-node-chairman/src/Testnet/ByronShelley.hs b/cardano-node-chairman/src/Testnet/ByronShelley.hs index 096e266e586..9ed56e6faa3 100644 --- a/cardano-node-chairman/src/Testnet/ByronShelley.hs +++ b/cardano-node-chairman/src/Testnet/ByronShelley.hs @@ -200,7 +200,9 @@ testnet testnetOptions H.Conf {..} = do -- stuff void . H.execCli $ - [ "genesis" + [ "byron" + , "genesis" + , "genesis" , "--protocol-magic", show @Int testnetMagic , "--start-time", showUTCTimeSeconds startTime , "--k", show @Int securityParam