Skip to content

Commit

Permalink
#86 Set default era to Babbage in stake-address, stake-pool and gover…
Browse files Browse the repository at this point in the history
…nance commmands
  • Loading branch information
carbolymer committed Jul 19, 2023
1 parent 5db5de8 commit be6eeda
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 52 deletions.
12 changes: 10 additions & 2 deletions cardano-cli/src/Cardano/CLI/Common/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Cardano.CLI.Types
import Data.Bifunctor
import qualified Data.ByteString.Char8 as BSC
import Data.Foldable
import Data.Function
import Data.List.NonEmpty (NonEmpty)
import qualified Data.List.NonEmpty as NE
import Data.Maybe (maybeToList)
Expand All @@ -29,6 +30,9 @@ import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec

defaultCurrentEra :: AnyShelleyBasedEra
defaultCurrentEra = AnyShelleyBasedEra ShelleyBasedEraBabbage

pCardanoEra :: Parser AnyCardanoEra
pCardanoEra = asum
[ Opt.flag' (AnyCardanoEra ByronEra) $ mconcat
Expand Down Expand Up @@ -64,8 +68,11 @@ pCardanoEra = asum
-- NEW-ERA-SET-DEFAULT: When a new era is working, select a new default above and below.

-- Default for now:
, pure (AnyCardanoEra BabbageEra)
, pure defaultCardanoEra
]
where
defaultCardanoEra = defaultCurrentEra & \(AnyShelleyBasedEra era) ->
AnyCardanoEra (shelleyBasedToCardanoEra era)

command' :: String -> String -> Parser a -> Mod CommandFields a
command' c descr p =
Expand Down Expand Up @@ -296,6 +303,7 @@ pAnyShelleyBasedEra = asum
, pShelleyBasedAlonzo
, pShelleyBasedBabbage
, pShelleyBasedConway
, pure defaultCurrentEra
]

pShelleyBasedShelley :: Parser AnyShelleyBasedEra
Expand All @@ -321,7 +329,7 @@ pShelleyBasedAlonzo =
pShelleyBasedBabbage :: Parser AnyShelleyBasedEra
pShelleyBasedBabbage =
Opt.flag' (AnyShelleyBasedEra ShelleyBasedEraBabbage)
$ mconcat [Opt.long "babbage-era", Opt.help "Specify the Babbage era"]
$ mconcat [Opt.long "babbage-era", Opt.help "Specify the Babbage era (default)"]

pShelleyBasedConway :: Parser AnyShelleyBasedEra
pShelleyBasedConway =
Expand Down
40 changes: 20 additions & 20 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Usage: cardano-cli governance
Governance commands

Usage: cardano-cli governance create-mir-certificate
( ( --shelley-era
( [ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --reserves
| --treasury
)
Expand All @@ -44,13 +44,13 @@ Usage: cardano-cli governance create-mir-certificate
Create an MIR (Move Instantaneous Rewards) certificate

Usage: cardano-cli governance create-mir-certificate stake-addresses
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --reserves
| --treasury
)
Expand All @@ -61,41 +61,41 @@ Usage: cardano-cli governance create-mir-certificate stake-addresses
Create an MIR certificate to pay stake addresses

Usage: cardano-cli governance create-mir-certificate transfer-to-treasury
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
--transfer LOVELACE
--out-file FILE

Create an MIR certificate to transfer from the reserves pot to the treasury
pot

Usage: cardano-cli governance create-mir-certificate transfer-to-rewards
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
--transfer LOVELACE
--out-file FILE

Create an MIR certificate to transfer from the treasury pot to the reserves
pot

Usage: cardano-cli governance create-genesis-key-delegation-certificate
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --genesis-verification-key STRING
| --genesis-verification-key-file FILE
| --genesis-verification-key-hash STRING
Expand Down Expand Up @@ -559,13 +559,13 @@ Usage: cardano-cli stake-pool
Stake pool commands

Usage: cardano-cli stake-pool registration-certificate
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --stake-pool-verification-key STRING
| --cold-verification-key-file FILE
)
Expand Down Expand Up @@ -598,13 +598,13 @@ Usage: cardano-cli stake-pool registration-certificate
Create a stake pool registration certificate

Usage: cardano-cli stake-pool deregistration-certificate
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --stake-pool-verification-key STRING
| --cold-verification-key-file FILE
)
Expand Down Expand Up @@ -1193,13 +1193,13 @@ Usage: cardano-cli stake-address key-hash
Print the hash of a stake address key.

Usage: cardano-cli stake-address registration-certificate
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --stake-verification-key STRING
| --stake-verification-key-file FILE
| --stake-script-file FILE
Expand All @@ -1210,13 +1210,13 @@ Usage: cardano-cli stake-address registration-certificate
Create a stake address registration certificate

Usage: cardano-cli stake-address deregistration-certificate
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --stake-verification-key STRING
| --stake-verification-key-file FILE
| --stake-script-file FILE
Expand All @@ -1227,13 +1227,13 @@ Usage: cardano-cli stake-address deregistration-certificate
Create a stake address deregistration certificate

Usage: cardano-cli stake-address delegation-certificate
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --stake-verification-key STRING
| --stake-verification-key-file FILE
| --stake-script-file FILE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Usage: cardano-cli governance create-genesis-key-delegation-certificate
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --genesis-verification-key STRING
| --genesis-verification-key-file FILE
| --genesis-verification-key-hash STRING
Expand All @@ -27,7 +27,7 @@ Available options:
--allegra-era Specify the Allegra era
--mary-era Specify the Mary era
--alonzo-era Specify the Alonzo era
--babbage-era Specify the Babbage era
--babbage-era Specify the Babbage era (default)
--conway-era Specify the Conway era
--genesis-verification-key STRING
Genesis verification key (hex-encoded).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Usage: cardano-cli governance create-mir-certificate
( ( --shelley-era
( [ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --reserves
| --treasury
)
Expand All @@ -24,7 +24,7 @@ Available options:
--allegra-era Specify the Allegra era
--mary-era Specify the Mary era
--alonzo-era Specify the Alonzo era
--babbage-era Specify the Babbage era
--babbage-era Specify the Babbage era (default)
--conway-era Specify the Conway era
--reserves Use the reserves pot.
--treasury Use the treasury pot.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Usage: cardano-cli governance create-mir-certificate stake-addresses
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
( --reserves
| --treasury
)
Expand All @@ -20,7 +20,7 @@ Available options:
--allegra-era Specify the Allegra era
--mary-era Specify the Mary era
--alonzo-era Specify the Alonzo era
--babbage-era Specify the Babbage era
--babbage-era Specify the Babbage era (default)
--conway-era Specify the Conway era
--reserves Use the reserves pot.
--treasury Use the treasury pot.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Usage: cardano-cli governance create-mir-certificate transfer-to-rewards
( --shelley-era
[ --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
| --babbage-era
| --conway-era
)
]
--transfer LOVELACE
--out-file FILE

Expand All @@ -17,7 +17,7 @@ Available options:
--allegra-era Specify the Allegra era
--mary-era Specify the Mary era
--alonzo-era Specify the Alonzo era
--babbage-era Specify the Babbage era
--babbage-era Specify the Babbage era (default)
--conway-era Specify the Conway era
--transfer LOVELACE The amount to transfer.
--out-file FILE The output file.
Expand Down
Loading

0 comments on commit be6eeda

Please sign in to comment.