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

Remove --conway-era flag #276

Merged
merged 1 commit into from
Sep 14, 2023
Merged
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
44 changes: 0 additions & 44 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import Data.ByteString (ByteString)
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Char8 as BSC
import Data.Foldable
import Data.Function
import Data.Functor (($>))
import qualified Data.IP as IP
import Data.List.NonEmpty (NonEmpty)
Expand Down Expand Up @@ -65,49 +64,6 @@ defaultShelleyBasedEra = AnyShelleyBasedEra ShelleyBasedEraBabbage
defaultShelleyToBabbageEra :: AnyShelleyToBabbageEra
defaultShelleyToBabbageEra = AnyShelleyToBabbageEra ShelleyToBabbageEraBabbage

pCardanoEra :: EnvCli -> Parser AnyCardanoEra
pCardanoEra envCli =
asum $ mconcat
[ [ Opt.flag' (AnyCardanoEra ByronEra) $ mconcat
[ Opt.long "byron-era"
, Opt.help "Specify the Byron era"
]
, Opt.flag' (AnyCardanoEra ShelleyEra) $ mconcat
[ Opt.long "shelley-era"
, Opt.help "Specify the Shelley era"
]
, Opt.flag' (AnyCardanoEra AllegraEra) $ mconcat
[ Opt.long "allegra-era"
, Opt.help "Specify the Allegra era"
]
, Opt.flag' (AnyCardanoEra MaryEra) $ mconcat
[ Opt.long "mary-era"
, Opt.help "Specify the Mary era"
]
, Opt.flag' (AnyCardanoEra AlonzoEra) $ mconcat
[ Opt.long "alonzo-era"
, Opt.help "Specify the Alonzo era"
]
, Opt.flag' (AnyCardanoEra BabbageEra) $ mconcat
[ Opt.long "babbage-era"
, Opt.help "Specify the Babbage era (default)"
]
, Opt.flag' (AnyCardanoEra ConwayEra) $ mconcat
[ Opt.long "conway-era"
, Opt.help "Specify the Conway era"
]

-- NEW-ERA-ADD-NEW: When a new era is added, add a new flag here.
-- NEW-ERA-SET-DEFAULT: When a new era is working, select a new default above and below.
]
, maybeToList $ pure <$> envCliAnyCardanoEra envCli
-- TODO is this default needed anymore?
, pure $ pure defaultCardanoEra
]
where
defaultCardanoEra = defaultShelleyBasedEra & \(AnyShelleyBasedEra era) ->
AnyCardanoEra (shelleyBasedToCardanoEra era)

command' :: String -> String -> Parser a -> Mod CommandFields a
command' c descr p =
mconcat
Expand Down
45 changes: 41 additions & 4 deletions cardano-cli/src/Cardano/CLI/Legacy/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import Cardano.CLI.Parser
import Cardano.CLI.Types.Common

import Data.Foldable
import Data.Maybe (fromMaybe)
import Data.Function
import Data.Maybe (fromMaybe, maybeToList)
import Data.Text (Text)
import Data.Word (Word64)
import Options.Applicative hiding (help, str)
Expand Down Expand Up @@ -541,7 +542,7 @@ pTransaction envCli =
pTransactionBuild =
TxBuild
<$> pSocketPath envCli
<*> pCardanoEra envCli
<*> pLegacyCardanoEra envCli
<*> pConsensusModeParams
<*> pNetworkId envCli
<*> optional pScriptValidity
Expand Down Expand Up @@ -581,7 +582,7 @@ pTransaction envCli =
pTransactionBuildRaw :: Parser LegacyTransactionCmds
pTransactionBuildRaw =
TxBuildRaw
<$> pCardanoEra envCli
<$> pLegacyCardanoEra envCli
<*> optional pScriptValidity
<*> some (pTxIn ManualBalance)
<*> many pReadOnlyReferenceTxIn
Expand Down Expand Up @@ -650,7 +651,7 @@ pTransaction envCli =

pTransactionCalculateMinReqUTxO :: Parser LegacyTransactionCmds
pTransactionCalculateMinReqUTxO = TxCalculateMinRequiredUTxO
<$> pCardanoEra envCli
<$> pLegacyCardanoEra envCli
<*> pProtocolParamsFile
<*> pTxOut

Expand Down Expand Up @@ -1412,3 +1413,39 @@ pStakePoolDeregistrationCertificateCmd envCli =
<*> pStakePoolVerificationKeyOrFile
<*> pEpochNo "The epoch number."
<*> pOutputFile

pLegacyCardanoEra :: EnvCli -> Parser AnyCardanoEra
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

pLegacyCardanoEra envCli =
asum $ mconcat
[ [ Opt.flag' (AnyCardanoEra ByronEra) $ mconcat
[ Opt.long "byron-era"
, Opt.help "Specify the Byron era"
]
, Opt.flag' (AnyCardanoEra ShelleyEra) $ mconcat
[ Opt.long "shelley-era"
, Opt.help "Specify the Shelley era"
]
, Opt.flag' (AnyCardanoEra AllegraEra) $ mconcat
[ Opt.long "allegra-era"
, Opt.help "Specify the Allegra era"
]
, Opt.flag' (AnyCardanoEra MaryEra) $ mconcat
[ Opt.long "mary-era"
, Opt.help "Specify the Mary era"
]
, Opt.flag' (AnyCardanoEra AlonzoEra) $ mconcat
[ Opt.long "alonzo-era"
, Opt.help "Specify the Alonzo era"
]
, Opt.flag' (AnyCardanoEra BabbageEra) $ mconcat
[ Opt.long "babbage-era"
, Opt.help "Specify the Babbage era (default)"
]
]
, maybeToList $ pure <$> envCliAnyCardanoEra envCli
-- TODO is this default needed anymore?
, pure $ pure defaultCardanoEra
]
where
defaultCardanoEra = defaultShelleyBasedEra & \(AnyShelleyBasedEra era) ->
AnyCardanoEra (shelleyBasedToCardanoEra era)
4 changes: 2 additions & 2 deletions cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ hprop_golden_byronTx_legacy = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir
goldenTx <- noteInputFile "test/cardano-cli-golden/files/golden/byron/tx/legacy.tx"
createdTx <- noteTempFile tempDir "tx"
void $ execCardanoCLI
[ "byron","transaction","issue-utxo-expenditure"
[ "byron", "transaction", "issue-utxo-expenditure"
, "--mainnet"
, "--byron-legacy-formats"
, "--wallet-key", signingKey
Expand All @@ -45,7 +45,7 @@ hprop_golden_byronTx = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do
goldenTx <- noteInputFile "test/cardano-cli-golden/files/golden/byron/tx/normal.tx"
createdTx <- noteTempFile tempDir "tx"
void $ execCardanoCLI
[ "byron","transaction","issue-utxo-expenditure"
[ "byron", "transaction", "issue-utxo-expenditure"
, "--mainnet"
, "--byron-formats"
, "--wallet-key", signingKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ hprop_golden_byron_update_proposal = propertyOnce $ H.moduleWorkspace "tmp" $ \t
signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey"
createdUpdateProposal <- noteTempFile tempDir "byron-update-proposal"
void $ execCardanoCLI
[ "byron","governance","create-update-proposal"
[ "byron", "governance", "create-update-proposal"
, "--mainnet"
, "--signing-key", signingKey
, "--protocol-version-major", "1"
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ hprop_golden_byron_yes_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir
signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey"
createdYesVote <- noteTempFile tempDir "byron-yes-vote"
void $ execCardanoCLI
[ "byron","governance","create-proposal-vote"
[ "byron", "governance", "create-proposal-vote"
, "--mainnet"
, "--proposal-filepath", proposal
, "--signing-key", signingKey
Expand All @@ -51,7 +51,7 @@ hprop_golden_byron_no_vote = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -
signingKey <- noteInputFile "test/cardano-cli-golden/files/golden/byron/keys/byron.skey"
createdNoVote <- noteTempFile tempDir "byron-no-vote"
void $ execCardanoCLI
[ "byron","governance","create-proposal-vote"
[ "byron", "governance", "create-proposal-vote"
, "--mainnet"
, "--proposal-filepath", proposal
, "--signing-key", signingKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ hprop_golden_shelleyStakeAddressDeregistrationCertificate = propertyOnce . H.mod
exampleScript <- noteInputFile $ base </> "scripts/plutus/scripts/v1/custom-guess-42-datum-42.plutus"

void $ execCardanoCLI
[ "stake-address","deregistration-certificate"
, "--babbage-era"
[ "babbage", "stake-address","deregistration-certificate"
, "--staking-verification-key-file", verificationKeyFile
, "--out-file", deregistrationCertFile
]

H.assertFileOccurences 1 "Stake Address Deregistration Certificate" deregistrationCertFile

void $ execCardanoCLI
[ "stake-address","deregistration-certificate"
, "--babbage-era"
[ "babbage", "stake-address","deregistration-certificate"
, "--stake-script-file", exampleScript
, "--out-file", scriptDeregistrationCertFile
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ hprop_golden_shelleyStakeAddressRegistrationCertificate = propertyOnce . H.modul
exampleScript <- noteInputFile $ base </> "scripts/plutus/scripts/v1/custom-guess-42-datum-42.plutus"

void $ execCardanoCLI
[ "stake-address","registration-certificate"
, "--babbage-era"
[ "babbage", "stake-address", "registration-certificate"
, "--staking-verification-key-file", keyGenStakingVerificationKeyFile
, "--out-file", registrationCertFile
]

H.assertFileOccurences 1 "Stake Address Registration Certificate" registrationCertFile

void $ execCardanoCLI
[ "stake-address","registration-certificate"
, "--babbage-era"
[ "babbage", "stake-address", "registration-certificate"
, "--stake-script-file", exampleScript
, "--out-file", scriptRegistrationCertFile
]
Expand All @@ -50,8 +48,7 @@ hprop_golden_shelleyStakeAddressRegistrationCertificateWithBuildRaw = propertyOn
txRawFile <- noteTempFile tempDir "tx.raw"

void $ execCardanoCLI
[ "stake-address","registration-certificate"
, "--conway-era"
[ "conway", "stake-address", "registration-certificate"
, "--staking-verification-key-file", keyGenStakingVerificationKeyFile
, "--key-reg-deposit-amt", "2000000"
, "--out-file", registrationCertFile
Expand All @@ -60,8 +57,7 @@ hprop_golden_shelleyStakeAddressRegistrationCertificateWithBuildRaw = propertyOn
H.assertFileOccurences 1 "Stake Address Registration Certificate" registrationCertFile

void $ execCardanoCLI
[ "transaction","build-raw"
, "--conway-era"
[ "conway", "transaction", "build-raw"
, "--tx-in", "bdfa7d91a29ffe071c028c0143c5d278c0a7ddb829c1e95f54a1676915fd82c2#0"
, "--fee", "1"
, "--certificate-file", registrationCertFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ hprop_golden_shelleyStakePoolRegistrationCertificate = propertyOnce . H.moduleWo
registrationCertFile <- noteTempFile tempDir "registration.cert"

void $ execCardanoCLI
[ "stake-pool","registration-certificate"
, "--babbage-era"
[ "babbage", "stake-pool", "registration-certificate"
, "--testnet-magic", "42"
, "--pool-pledge", "0"
, "--pool-cost", "0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ hprop_golden_shelleyStakeAddressCertificates = propertyOnce . H.moduleWorkspace

-- Generate stake verification key
void $ execCardanoCLI
[ "stake-address","key-gen"
[ "stake-address", "key-gen"
, "--verification-key-file", verKey
, "--signing-key-file", signKey
]
Expand All @@ -42,8 +42,7 @@ hprop_golden_shelleyStakeAddressCertificates = propertyOnce . H.moduleWorkspace

-- Create stake address registration certificate
void $ execCardanoCLI
[ "stake-address","registration-certificate"
, "--babbage-era"
[ "babbage", "stake-address", "registration-certificate"
, "--stake-verification-key-file", verKey
, "--out-file", registrationCertificate
]
Expand All @@ -56,8 +55,7 @@ hprop_golden_shelleyStakeAddressCertificates = propertyOnce . H.moduleWorkspace

-- Create stake address deregistration certificate
void $ execCardanoCLI
[ "stake-address","deregistration-certificate"
, "--babbage-era"
[ "babbage", "stake-address", "deregistration-certificate"
, "--stake-verification-key-file", verKey
, "--out-file", deregistrationCertificate
]
Expand All @@ -70,7 +68,7 @@ hprop_golden_shelleyStakeAddressCertificates = propertyOnce . H.moduleWorkspace
{-
-- Create stake address delegation certificate
void $ execCardanoCLI
[ "stake-address","delegation-certificate"
[ "stake-address", "delegation-certificate"
, "--stake-verification-key-file", verKey
, "--cold-verification-key-file", verKey --TODO: Should be stake pool's hash
, "--out-file", deregistrationCertificate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ hprop_golden_shelleyStakePoolCertificates = propertyOnce . H.moduleWorkspace "tm

-- Create cold key pair
void $ execCardanoCLI
[ "node","key-gen"
[ "node", "key-gen"
, "--cold-verification-key-file", coldVerKey
, "--cold-signing-key-file", coldSignKey
, "--operational-certificate-issue-counter", operationalCertCounter
Expand All @@ -52,7 +52,7 @@ hprop_golden_shelleyStakePoolCertificates = propertyOnce . H.moduleWorkspace "tm

-- Generate stake key pair
void $ execCardanoCLI
[ "stake-address","key-gen"
[ "stake-address", "key-gen"
, "--verification-key-file", poolRewardAccountAndOwnerVerKey
, "--signing-key-file", poolRewardAccountSignKey
]
Expand All @@ -61,7 +61,7 @@ hprop_golden_shelleyStakePoolCertificates = propertyOnce . H.moduleWorkspace "tm

-- Generate vrf verification key
void $ execCardanoCLI
[ "node","key-gen-VRF"
[ "node", "key-gen-VRF"
, "--verification-key-file", vrfVerKey
, "--signing-key-file", vrfSignKey
]
Expand All @@ -71,8 +71,7 @@ hprop_golden_shelleyStakePoolCertificates = propertyOnce . H.moduleWorkspace "tm

-- Create stake pool registration certificate
void $ execCardanoCLI
[ "stake-pool","registration-certificate"
, "--babbage-era"
[ "babbage", "stake-pool", "registration-certificate"
, "--cold-verification-key-file", coldVerKey
, "--vrf-verification-key-file", vrfVerKey
, "--mainnet"
Expand All @@ -94,8 +93,7 @@ hprop_golden_shelleyStakePoolCertificates = propertyOnce . H.moduleWorkspace "tm

-- Create stake pool deregistration certificate
void $ execCardanoCLI
[ "stake-pool", "deregistration-certificate"
, "--babbage-era"
[ "babbage", "stake-pool", "deregistration-certificate"
, "--cold-verification-key-file", coldVerKey
, "--epoch", "42"
, "--out-file", deregistrationCertificate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ hprop_golden_shelleyTx = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do

-- Create transaction body
void $ execCardanoCLI
[ "transaction", "build-raw"
, "--alonzo-era"
[ "alonzo", "transaction", "build-raw"
, "--tx-in", "f62cd7bc15d8c6d2c8519fb8d13c57c0157ab6bab50af62bc63706feb966393d#0"
, "--tx-out", "addr_test1qpmxr8d8jcl25kyz2tz9a9sxv7jxglhddyf475045y8j3zxjcg9vquzkljyfn3rasfwwlkwu7hhm59gzxmsyxf3w9dps8832xh+1199989833223"
, "--tx-out", "addr_test1vpqgspvmh6m2m5pwangvdg499srfzre2dd96qq57nlnw6yctpasy4+10000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ hprop_golden_shelleyTxBody = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -

-- Create transaction body
void $ execCardanoCLI
[ "transaction", "build-raw"
, "--mary-era"
[ "mary", "transaction", "build-raw"
, "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0"
, "--tx-out", "addr1v9wmu83pzajplrtpsq6tsqdgwr98x888trpmah2u0ezznsge7del3+100000000"
, "--fee", "1000000"
Expand Down
Loading