From ad32c7ffa483369e0e24277750dcc76945b4999a Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 19 Sep 2024 17:17:04 -0400 Subject: [PATCH] Remove all legacy commands except those involved in update proposals Set default top level era to Conway --- .../src/Cardano/CLI/EraBased/Commands.hs | 4 +- cardano-cli/src/Cardano/CLI/Legacy/Options.hs | 851 +----------------- cardano-cli/src/Cardano/CLI/Options.hs | 12 - .../Test/Golden/Governance/Action.hs | 3 +- 4 files changed, 5 insertions(+), 865 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs index aa6711daed..427b14273a 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs @@ -108,8 +108,10 @@ pAnyEraCommand envCli = Opt.info (AnyEraCommandOf ShelleyBasedEraConway <$> pCmds ShelleyBasedEraConway envCli) $ Opt.progDesc "Conway era commands" , subParser "latest" $ - Opt.info (AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds ShelleyBasedEraBabbage envCli) $ + Opt.info (AnyEraCommandOf ShelleyBasedEraConway <$> pCmds ShelleyBasedEraConway envCli) $ Opt.progDesc ("Latest era commands (Babbage)" <> deprecationText) + , -- Default to Conway era + AnyEraCommandOf ShelleyBasedEraConway <$> pCmds ShelleyBasedEraConway envCli ] pCmds :: ShelleyBasedEra era -> EnvCli -> Parser (Cmds era) diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index f5e5a22bba..f368ccf0ff 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -2,7 +2,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} module Cardano.CLI.Legacy.Options ( -- * CLI command parser @@ -23,24 +22,13 @@ where import Cardano.Api hiding (QueryInShelleyBasedEra (..), parseFilePath) import Cardano.Api.Ledger (Coin (..)) -import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..), parseFilePath) import Cardano.Chain.Common (BlockCount (BlockCount)) import Cardano.CLI.Environment -import qualified Cardano.CLI.EraBased.Commands.Node as Cmd import Cardano.CLI.EraBased.Options.Common import Cardano.CLI.Legacy.Commands -import Cardano.CLI.Legacy.Commands.Address import Cardano.CLI.Legacy.Commands.Genesis import Cardano.CLI.Legacy.Commands.Governance -import Cardano.CLI.Legacy.Commands.Node -import qualified Cardano.CLI.Legacy.Commands.Node as Cmd -import Cardano.CLI.Legacy.Commands.Query -import Cardano.CLI.Legacy.Commands.StakeAddress -import Cardano.CLI.Legacy.Commands.StakePool -import Cardano.CLI.Legacy.Commands.TextView -import Cardano.CLI.Legacy.Commands.Transaction -import Cardano.CLI.Legacy.Options.Key import Cardano.CLI.Parser import Cardano.CLI.Types.Common @@ -49,8 +37,6 @@ import Data.Maybe (fromMaybe, maybeToList) import Data.Word (Word64) import Options.Applicative hiding (help, str) import qualified Options.Applicative as Opt -import qualified Options.Applicative.Help as H -import Prettyprinter (line) {- HLINT ignore "Use <$>" -} {- HLINT ignore "Move brackets to avoid $" -} @@ -58,801 +44,21 @@ import Prettyprinter (line) -- -- Shelley CLI command parsers -- - +-- This is necessary for QA to create update proposals pre-Conway parseLegacyCmds :: EnvCli -> Parser LegacyCmds parseLegacyCmds envCli = Opt.hsubparser $ mconcat [ Opt.metavar "Legacy commands" , Opt.commandGroup "Legacy commands" - , Opt.command "address" $ - Opt.info (LegacyAddressCmds <$> pAddressCmds envCli) $ - Opt.progDesc "Payment address commands" - , Opt.command "stake-address" $ - Opt.info (LegacyStakeAddressCmds <$> pStakeAddressCmds envCli) $ - Opt.progDesc "Stake address commands" - , Opt.command "key" $ - Opt.info (LegacyKeyCmds <$> pKeyCmds) $ - Opt.progDesc "Key utility commands" - , Opt.command "transaction" $ - Opt.info (LegacyTransactionCmds <$> pTransaction envCli) $ - Opt.progDesc "Transaction commands" - , Opt.command "node" $ - Opt.info (LegacyNodeCmds <$> pNodeCmds) $ - Opt.progDesc "Node operation commands" - , Opt.command "stake-pool" $ - Opt.info (LegacyStakePoolCmds <$> pStakePoolCmds envCli) $ - Opt.progDesc "Stake pool commands" - , Opt.command "query" $ - Opt.info (LegacyQueryCmds <$> pQueryCmds envCli) . Opt.progDesc $ - mconcat - [ "Node query commands. Will query the local node whose Unix domain socket " - , "is obtained from the CARDANO_NODE_SOCKET_PATH environment variable." - ] , Opt.command "genesis" $ Opt.info (LegacyGenesisCmds <$> pGenesisCmds envCli) $ Opt.progDesc "Genesis block commands" , Opt.command "governance" $ Opt.info (LegacyGovernanceCmds <$> pGovernanceCmds envCli) $ Opt.progDesc "Governance commands" - , Opt.command "text-view" $ - Opt.info (LegacyTextViewCmds <$> pTextViewCmds) . Opt.progDesc $ - mconcat - [ "Commands for dealing with Shelley TextView files. " - , "Transactions, addresses etc are stored on disk as TextView files." - ] ] -pTextViewCmds :: Parser LegacyTextViewCmds -pTextViewCmds = - asum - [ subParser - "decode-cbor" - ( Opt.info (TextViewInfo <$> pCBORInFile <*> pMaybeOutputFile) $ - Opt.progDesc "Print a TextView file as decoded CBOR." - ) - ] - -pAddressCmds :: EnvCli -> Parser LegacyAddressCmds -pAddressCmds envCli = - asum - [ subParser - "key-gen" - (Opt.info pAddressKeyGen $ Opt.progDesc "Create an address key pair.") - , subParser - "key-hash" - (Opt.info pAddressKeyHash $ Opt.progDesc "Print the hash of an address key.") - , subParser - "build" - ( Opt.info pAddressBuild $ - Opt.progDesc "Build a Shelley payment address, with optional delegation to a stake address." - ) - , subParser - "info" - (Opt.info pAddressInfo $ Opt.progDesc "Print information about an address.") - ] - where - pAddressKeyGen :: Parser LegacyAddressCmds - pAddressKeyGen = - AddressKeyGen - <$> pKeyOutputFormat - <*> pAddressKeyType - <*> pVerificationKeyFileOut - <*> pSigningKeyFileOut - - pAddressKeyHash :: Parser LegacyAddressCmds - pAddressKeyHash = - AddressKeyHash - <$> pPaymentVerificationKeyTextOrFile - <*> pMaybeOutputFile - - pAddressBuild :: Parser LegacyAddressCmds - pAddressBuild = - AddressBuild - <$> pPaymentVerifier - <*> Opt.optional (pStakeIdentifier Nothing) - <*> pNetworkId envCli - <*> pMaybeOutputFile - - pAddressInfo :: Parser LegacyAddressCmds - pAddressInfo = AddressInfo <$> pAddress <*> pMaybeOutputFile - -pStakeAddressCmds :: EnvCli -> Parser LegacyStakeAddressCmds -pStakeAddressCmds envCli = - asum - [ subParser "key-gen" $ - Opt.info pStakeAddressKeyGenCmd $ - Opt.progDesc "Create a stake address key pair" - , subParser "build" $ - Opt.info pStakeAddressBuildCmd $ - Opt.progDesc "Build a stake address" - , subParser "key-hash" $ - Opt.info pStakeAddressKeyHashCmd $ - Opt.progDesc "Print the hash of a stake address key." - , subParser "registration-certificate" $ - Opt.info pStakeAddressRegistrationCertificateCmd $ - Opt.progDesc "Create a stake address registration certificate" - , subParser "deregistration-certificate" $ - Opt.info pStakeAddressDeregistrationCertificateCmd $ - Opt.progDesc "Create a stake address deregistration certificate" - , subParser "delegation-certificate" $ - Opt.info pStakeAddressStakeDelegationCertificateCmd $ - Opt.progDesc "Create a stake address pool delegation certificate" - ] - where - pStakeAddressKeyGenCmd :: Parser LegacyStakeAddressCmds - pStakeAddressKeyGenCmd = - StakeAddressKeyGenCmd - <$> pKeyOutputFormat - <*> pVerificationKeyFileOut - <*> pSigningKeyFileOut - - pStakeAddressKeyHashCmd :: Parser LegacyStakeAddressCmds - pStakeAddressKeyHashCmd = - StakeAddressKeyHashCmd - <$> pStakeVerificationKeyOrFile Nothing - <*> pMaybeOutputFile - - pStakeAddressBuildCmd :: Parser LegacyStakeAddressCmds - pStakeAddressBuildCmd = - StakeAddressBuildCmd - <$> pStakeVerifier Nothing - <*> pNetworkId envCli - <*> pMaybeOutputFile - - pStakeAddressRegistrationCertificateCmd :: Parser LegacyStakeAddressCmds - pStakeAddressRegistrationCertificateCmd = - StakeAddressRegistrationCertificateCmd - <$> pAnyShelleyBasedEra envCli - <*> pStakeIdentifier Nothing - <*> optional pKeyRegistDeposit - <*> pOutputFile - - pStakeAddressDeregistrationCertificateCmd :: Parser LegacyStakeAddressCmds - pStakeAddressDeregistrationCertificateCmd = - StakeAddressDeregistrationCertificateCmd - <$> pAnyShelleyBasedEra envCli - <*> pStakeIdentifier Nothing - <*> optional pKeyRegistDeposit - <*> pOutputFile - - pStakeAddressStakeDelegationCertificateCmd :: Parser LegacyStakeAddressCmds - pStakeAddressStakeDelegationCertificateCmd = - StakeAddressDelegationCertificateCmd - <$> pAnyShelleyBasedEra envCli - <*> pStakeIdentifier Nothing - <*> pStakePoolVerificationKeyOrHashOrFile Nothing - <*> pOutputFile - -pTransaction :: EnvCli -> Parser LegacyTransactionCmds -pTransaction envCli = - asum - [ subParser "build-raw" $ - Opt.info pTransactionBuildRaw $ - Opt.progDescDoc $ - Just $ - mconcat - [ pretty @String "Build a transaction (low-level, inconvenient)" - , line - , line - , H.yellow $ - mconcat - [ "Please note " - , H.underline "the order" - , " of some cmd options is crucial. If used incorrectly may produce " - , "undesired tx body. See nested [] notation above for details." - ] - ] - , subParser "build" $ - Opt.info pTransactionBuild $ - Opt.progDescDoc $ - Just $ - mconcat - [ pretty @String "Build a balanced transaction (automatically calculates fees)" - , line - , line - , H.yellow $ - mconcat - [ "Please note " - , H.underline "the order" - , " of some cmd options is crucial. If used incorrectly may produce " - , "undesired tx body. See nested [] notation above for details." - ] - ] - , subParser - "sign" - (Opt.info pTransactionSign $ Opt.progDesc "Sign a transaction") - , subParser - "witness" - (Opt.info pTransactionCreateWitness $ Opt.progDesc "Create a transaction witness") - , subParser - "assemble" - ( Opt.info pTransactionAssembleTxBodyWit $ - Opt.progDesc "Assemble a tx body and witness(es) to form a transaction" - ) - , pSignWitnessBackwardCompatible - , subParser - "submit" - ( Opt.info pTransactionSubmit . Opt.progDesc $ - mconcat - [ "Submit a transaction to the local node whose Unix domain socket " - , "is obtained from the CARDANO_NODE_SOCKET_PATH environment variable." - ] - ) - , subParser - "policyid" - ( Opt.info pTransactionPolicyId $ - Opt.progDesc "Calculate the PolicyId from the monetary policy script." - ) - , subParser - "calculate-min-fee" - (Opt.info pTransactionCalculateMinFee $ Opt.progDesc "Calculate the minimum fee for a transaction.") - , subParser - "calculate-min-required-utxo" - ( Opt.info pTransactionCalculateMinReqUTxO $ - Opt.progDesc "Calculate the minimum required UTxO for a transaction output." - ) - , pCalculateMinRequiredUtxoBackwardCompatible - , subParser - "hash-script-data" - (Opt.info pTxHashScriptData $ Opt.progDesc "Calculate the hash of script data.") - , subParser - "txid" - (Opt.info pTransactionId $ Opt.progDesc "Print a transaction identifier.") - , subParser "view" $ - Opt.info pTransactionView $ - Opt.progDesc "This command has been removed. Please use \"debug transaction view\" instead." - ] - where - -- Backwards compatible parsers - calcMinValueInfo :: ParserInfo LegacyTransactionCmds - calcMinValueInfo = - Opt.info pTransactionCalculateMinReqUTxO $ - Opt.progDesc "DEPRECATED: Use 'calculate-min-required-utxo' instead." - - pCalculateMinRequiredUtxoBackwardCompatible :: Parser LegacyTransactionCmds - pCalculateMinRequiredUtxoBackwardCompatible = - Opt.subparser $ - Opt.command "calculate-min-value" calcMinValueInfo <> Opt.internal - - assembleInfo :: ParserInfo LegacyTransactionCmds - assembleInfo = - Opt.info pTransactionAssembleTxBodyWit $ - Opt.progDesc "Assemble a tx body and witness(es) to form a transaction" - - pSignWitnessBackwardCompatible :: Parser LegacyTransactionCmds - pSignWitnessBackwardCompatible = - Opt.subparser $ - Opt.command "sign-witness" assembleInfo <> Opt.internal - - pScriptValidity :: Parser ScriptValidity - pScriptValidity = - asum - [ Opt.flag' ScriptValid $ - mconcat - [ Opt.long "script-valid" - , Opt.help "Assertion that the script is valid. (default)" - ] - , Opt.flag' ScriptInvalid $ - mconcat - [ Opt.long "script-invalid" - , Opt.help $ - mconcat - [ "Assertion that the script is invalid. " - , "If a transaction is submitted with such a script, " - , "the script will fail and the collateral will be taken." - ] - ] - ] - - pTransactionBuild :: Parser LegacyTransactionCmds - pTransactionBuild = - TransactionBuildCmd - <$> pSocketPath envCli - <*> pLegacyShelleyBasedEra envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> optional pScriptValidity - <*> optional pWitnessOverride - <*> some (pTxIn ShelleyBasedEraConway AutoBalance) - <*> many pReadOnlyReferenceTxIn - <*> many pRequiredSigner - <*> many pTxInCollateral - <*> optional pReturnCollateral - <*> optional pTotalCollateral - <*> many pTxOut - <*> pChangeAddress - <*> optional (pMintMultiAsset ShelleyBasedEraConway AutoBalance) - <*> optional pInvalidBefore - <*> optional pLegacyInvalidHereafter - <*> many (pCertificateFile ShelleyBasedEraConway AutoBalance) - <*> many (pWithdrawal ShelleyBasedEraConway AutoBalance) - <*> pTxMetadataJsonSchema - <*> many - ( pScriptFor - "auxiliary-script-file" - Nothing - "Filepath of auxiliary script(s)" - ) - <*> many pMetadataFile - <*> optional pUpdateProposalFile - <*> pVoteFiles ShelleyBasedEraConway AutoBalance - <*> pProposalFiles ShelleyBasedEraConway AutoBalance - <*> pTreasuryDonation ShelleyBasedEraConway - <*> pTxBuildOutputOptions - - pChangeAddress :: Parser TxOutChangeAddress - pChangeAddress = - fmap TxOutChangeAddress $ - Opt.option (readerFromParsecParser parseAddressAny) $ - mconcat - [ Opt.long "change-address" - , Opt.metavar "ADDRESS" - , Opt.help "Address where ADA in excess of the tx fee will go to." - ] - - pTransactionBuildRaw :: Parser LegacyTransactionCmds - pTransactionBuildRaw = - TransactionBuildRawCmd - <$> pLegacyCardanoEra envCli - <*> optional pScriptValidity - <*> some (pTxIn ShelleyBasedEraConway ManualBalance) - <*> many pReadOnlyReferenceTxIn - <*> many pTxInCollateral - <*> optional pReturnCollateral - <*> optional pTotalCollateral - <*> many pRequiredSigner - <*> many pTxOut - <*> optional (pMintMultiAsset ShelleyBasedEraConway ManualBalance) - <*> optional pInvalidBefore - <*> optional pLegacyInvalidHereafter - <*> pTxFee - <*> many (pCertificateFile ShelleyBasedEraConway ManualBalance) - <*> many (pWithdrawal ShelleyBasedEraConway ManualBalance) - <*> pTxMetadataJsonSchema - <*> many (pScriptFor "auxiliary-script-file" Nothing "Filepath of auxiliary script(s)") - <*> many pMetadataFile - <*> optional pProtocolParamsFile - <*> optional pUpdateProposalFile - <*> pTxBodyFileOut - - pTransactionSign :: Parser LegacyTransactionCmds - pTransactionSign = - TransactionSignCmd - <$> pInputTxOrTxBodyFile - <*> many pWitnessSigningData - <*> optional (pNetworkId envCli) - <*> pTxFileOut - - pTransactionCreateWitness :: Parser LegacyTransactionCmds - pTransactionCreateWitness = - TransactionWitnessCmd - <$> pTxBodyFileIn - <*> pWitnessSigningData - <*> optional (pNetworkId envCli) - <*> pOutputFile - - pTransactionAssembleTxBodyWit :: Parser LegacyTransactionCmds - pTransactionAssembleTxBodyWit = - TransactionSignWitnessCmd - <$> pTxBodyFileIn - <*> many pWitnessFile - <*> pOutputFile - - pTransactionSubmit :: Parser LegacyTransactionCmds - pTransactionSubmit = - TransactionSubmitCmd - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTxSubmitFile - - pTransactionPolicyId :: Parser LegacyTransactionCmds - pTransactionPolicyId = - TransactionPolicyIdCmd - <$> pScript - - pTransactionCalculateMinFee :: Parser LegacyTransactionCmds - pTransactionCalculateMinFee = - TransactionCalculateMinFeeCmd - <$> pTxBodyFileIn - <*> pProtocolParamsFile - <*> pTxShelleyWitnessCount - <*> pTxByronWitnessCount - <*> pReferenceScriptSize - <*> (optional $ pOutputFormatJsonOrText "calculate-min-fee") - <*> optional pOutputFile - -- Deprecated options: - <* optional pNetworkIdDeprecated - <* optional pTxInCountDeprecated - <* optional pTxOutCountDeprecated - - pTransactionCalculateMinReqUTxO :: Parser LegacyTransactionCmds - pTransactionCalculateMinReqUTxO = - TransactionCalculateMinValueCmd - <$> pAnyShelleyBasedEra envCli - <*> pProtocolParamsFile - <*> pTxOutShelleyBased - - pTxHashScriptData :: Parser LegacyTransactionCmds - pTxHashScriptData = - fmap TransactionHashScriptDataCmd $ - pScriptDataOrFile - "script-data" - "The script data." - "The script data file." - - pTransactionId :: Parser LegacyTransactionCmds - pTransactionId = - TransactionTxIdCmd - <$> pInputTxOrTxBodyFile - - pTransactionView :: Parser LegacyTransactionCmds - pTransactionView = - pure TransactionViewCmd - -pNodeCmds :: Parser LegacyNodeCmds -pNodeCmds = - asum - [ subParser "key-gen" . Opt.info pKeyGenOperator . Opt.progDesc $ - mconcat - [ "Create a key pair for a node operator's offline " - , "key and a new certificate issue counter" - ] - , subParser "key-gen-KES" . Opt.info pKeyGenKES . Opt.progDesc $ - mconcat - [ "Create a key pair for a node KES operational key" - ] - , subParser "key-gen-VRF" . Opt.info pKeyGenVRF . Opt.progDesc $ - mconcat - [ "Create a key pair for a node VRF operational key" - ] - , subParser "key-hash-VRF" . Opt.info pKeyHashVRF . Opt.progDesc $ - mconcat - [ "Print hash of a node's operational VRF key." - ] - , subParser "new-counter" . Opt.info pNewCounter . Opt.progDesc $ - mconcat - [ "Create a new certificate issue counter" - ] - , subParser "issue-op-cert" . Opt.info pIssueOpCert . Opt.progDesc $ - mconcat - [ "Issue a node operational certificate" - ] - ] - where - pKeyGenOperator :: Parser LegacyNodeCmds - pKeyGenOperator = - fmap Cmd.LegacyNodeKeyGenColdCmd $ - Cmd.NodeKeyGenColdCmdArgs - <$> pKeyOutputFormat - <*> pColdVerificationKeyFile - <*> pColdSigningKeyFile - <*> pOperatorCertIssueCounterFile - - pKeyGenKES :: Parser LegacyNodeCmds - pKeyGenKES = - fmap Cmd.LegacyNodeKeyGenKESCmd $ - Cmd.NodeKeyGenKESCmdArgs - <$> pKeyOutputFormat - <*> pVerificationKeyFileOut - <*> pSigningKeyFileOut - - pKeyGenVRF :: Parser LegacyNodeCmds - pKeyGenVRF = - fmap Cmd.LegacyNodeKeyGenVRFCmd $ - Cmd.NodeKeyGenVRFCmdArgs - <$> pKeyOutputFormat - <*> pVerificationKeyFileOut - <*> pSigningKeyFileOut - - pKeyHashVRF :: Parser LegacyNodeCmds - pKeyHashVRF = - fmap Cmd.LegacyNodeKeyHashVRFCmd $ - Cmd.NodeKeyHashVRFCmdArgs - <$> pVerificationKeyOrFileIn AsVrfKey - <*> pMaybeOutputFile - - pNewCounter :: Parser LegacyNodeCmds - pNewCounter = - fmap Cmd.LegacyNodeNewCounterCmd $ - Cmd.NodeNewCounterCmdArgs - <$> pColdVerificationKeyOrFile Nothing - <*> pCounterValue - <*> pOperatorCertIssueCounterFile - - pCounterValue :: Parser Word - pCounterValue = - Opt.option integralReader $ - mconcat - [ Opt.long "counter-value" - , Opt.metavar "INT" - , Opt.help "The next certificate issue counter value to use." - ] - - pIssueOpCert :: Parser LegacyNodeCmds - pIssueOpCert = - fmap Cmd.LegacyNodeIssueOpCertCmd $ - Cmd.NodeIssueOpCertCmdArgs - <$> pKesVerificationKeyOrFile - <*> pColdSigningKeyFile - <*> pOperatorCertIssueCounterFile - <*> pKesPeriod - <*> pOutputFile - -pStakePoolCmds :: EnvCli -> Parser LegacyStakePoolCmds -pStakePoolCmds envCli = - asum - [ subParser "registration-certificate" $ - Opt.info (pStakePoolRegistrationCertificiateCmd envCli) $ - Opt.progDesc "Create a stake pool registration certificate" - , subParser "deregistration-certificate" $ - Opt.info (pStakePoolDeregistrationCertificateCmd envCli) $ - Opt.progDesc "Create a stake pool deregistration certificate" - , subParser "id" $ - Opt.info pStakePoolId $ - Opt.progDesc "Build pool id from the offline key" - , subParser "metadata-hash" $ - Opt.info pStakePoolMetadataHashCmd $ - Opt.progDesc "Print the hash of pool metadata." - ] - where - pStakePoolId :: Parser LegacyStakePoolCmds - pStakePoolId = - StakePoolIdCmd - <$> pStakePoolVerificationKeyOrFile Nothing - <*> pPoolIdOutputFormat - <*> pMaybeOutputFile - - pStakePoolMetadataHashCmd :: Parser LegacyStakePoolCmds - pStakePoolMetadataHashCmd = - StakePoolMetadataHashCmd - <$> pPoolMetadataFile - <*> pMaybeOutputFile - -pQueryCmds :: EnvCli -> Parser LegacyQueryCmds -pQueryCmds envCli = - asum - [ subParser "protocol-parameters" $ - Opt.info pQueryProtocolParameters $ - Opt.progDesc "Get the node's current protocol parameters" - , subParser "tip" $ - Opt.info pQueryTip $ - Opt.progDesc "Get the node's current tip (slot no, hash, block no)" - , subParser "stake-pools" $ - Opt.info pQueryStakePools $ - Opt.progDesc "Get the node's current set of stake pool ids" - , subParser "stake-distribution" $ - Opt.info pQueryStakeDistribution $ - Opt.progDesc "Get the node's current aggregated stake distribution" - , subParser "stake-address-info" $ - Opt.info pQueryStakeAddressInfo $ - Opt.progDesc $ - mconcat - [ "Get the current delegations and reward accounts filtered by stake address." - ] - , subParser "utxo" $ - Opt.info pQueryUTxO $ - Opt.progDesc $ - mconcat - [ "Get a portion of the current UTxO: by tx in, by address or the whole." - ] - , subParser "ledger-state" $ - Opt.info pQueryLedgerState $ - Opt.progDesc $ - mconcat - [ "Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command)" - ] - , subParser "protocol-state" $ - Opt.info pQueryProtocolState $ - Opt.progDesc $ - mconcat - [ "Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command)" - ] - , subParser "stake-snapshot" $ - Opt.info pQueryStakeSnapshot $ - Opt.progDesc $ - mconcat - [ "Obtain the three stake snapshots for a pool, plus the total active stake (advanced command)" - ] - , hiddenSubParser "pool-params" $ - Opt.info pQueryPoolState $ - Opt.progDesc $ - mconcat - [ "DEPRECATED. Use query pool-state instead. Dump the pool parameters " - , "(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced command)" - ] - , subParser "leadership-schedule" $ - Opt.info pLeadershipSchedule $ - Opt.progDesc "Get the slots the node is expected to mint a block in (advanced command)" - , subParser "kes-period-info" $ - Opt.info pKesPeriodInfo $ - Opt.progDesc "Get information about the current KES period and your node's operational certificate." - , subParser "pool-state" $ - Opt.info pQueryPoolState $ - Opt.progDesc "Dump the pool state" - , subParser "tx-mempool" $ - Opt.info pQueryTxMempool $ - Opt.progDesc "Local Mempool info" - , subParser "slot-number" $ - Opt.info pQuerySlotNumber $ - Opt.progDesc "Query slot number for UTC timestamp" - ] - where - pQueryProtocolParameters :: Parser LegacyQueryCmds - pQueryProtocolParameters = - fmap QueryProtocolParametersCmd $ - LegacyQueryProtocolParametersCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pMaybeOutputFile - - pQueryTip :: Parser LegacyQueryCmds - pQueryTip = - fmap QueryTipCmd $ - LegacyQueryTipCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pMaybeOutputFile - - pQueryUTxO :: Parser LegacyQueryCmds - pQueryUTxO = - fmap QueryUTxOCmd $ - LegacyQueryUTxOCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pQueryUTxOFilter - <*> pNetworkId envCli - <*> (optional $ pOutputFormatJsonOrText "utxo") - <*> pMaybeOutputFile - - pQueryStakePools :: Parser LegacyQueryCmds - pQueryStakePools = - fmap QueryStakePoolsCmd $ - LegacyQueryStakePoolsCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> (optional $ pOutputFormatJsonOrText "stake-pools") - <*> pMaybeOutputFile - - pQueryStakeDistribution :: Parser LegacyQueryCmds - pQueryStakeDistribution = - fmap QueryStakeDistributionCmd $ - LegacyQueryStakeDistributionCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> (optional $ pOutputFormatJsonOrText "stake-distribution") - <*> pMaybeOutputFile - - pQueryStakeAddressInfo :: Parser LegacyQueryCmds - pQueryStakeAddressInfo = - fmap QueryStakeAddressInfoCmd $ - LegacyQueryStakeAddressInfoCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pFilterByStakeAddress - <*> pNetworkId envCli - <*> pMaybeOutputFile - - pQueryLedgerState :: Parser LegacyQueryCmds - pQueryLedgerState = - fmap QueryLedgerStateCmd $ - LegacyQueryLedgerStateCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pMaybeOutputFile - - pQueryProtocolState :: Parser LegacyQueryCmds - pQueryProtocolState = - fmap QueryProtocolStateCmd $ - LegacyQueryProtocolStateCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pMaybeOutputFile - - pAllStakePoolsOrOnly :: Parser (AllOrOnly (Hash StakePoolKey)) - pAllStakePoolsOrOnly = pAll <|> pOnly - where - pAll :: Parser (AllOrOnly (Hash StakePoolKey)) - pAll = - Opt.flag' All $ - mconcat - [ Opt.long "all-stake-pools" - , Opt.help "Query for all stake pools" - ] - pOnly :: Parser (AllOrOnly (Hash StakePoolKey)) - pOnly = Only <$> some (pStakePoolVerificationKeyHash Nothing) - - pQueryStakeSnapshot :: Parser LegacyQueryCmds - pQueryStakeSnapshot = - fmap QueryStakeSnapshotCmd $ - LegacyQueryStakeSnapshotCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pAllStakePoolsOrOnly - <*> pMaybeOutputFile - - pQueryPoolState :: Parser LegacyQueryCmds - pQueryPoolState = - fmap QueryPoolStateCmd $ - LegacyQueryPoolStateCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pAllStakePoolsOrOnly - <*> pMaybeOutputFile - - pQueryTxMempool :: Parser LegacyQueryCmds - pQueryTxMempool = - fmap QueryTxMempoolCmd $ - LegacyQueryTxMempoolCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pTxMempoolQuery - <*> pMaybeOutputFile - where - pTxMempoolQuery :: Parser TxMempoolQuery - pTxMempoolQuery = - asum - [ subParser "info" $ - Opt.info (pure TxMempoolQueryInfo) $ - Opt.progDesc "Ask the node about the current mempool's capacity and sizes" - , subParser "next-tx" $ - Opt.info (pure TxMempoolQueryNextTx) $ - Opt.progDesc "Requests the next transaction from the mempool's current list" - , subParser "tx-exists" $ - Opt.info (TxMempoolQueryTxExists <$> argument Opt.str (metavar "TX_ID")) $ - Opt.progDesc "Query if a particular transaction exists in the mempool" - ] - pLeadershipSchedule :: Parser LegacyQueryCmds - pLeadershipSchedule = - fmap QueryLeadershipScheduleCmd $ - LegacyQueryLeadershipScheduleCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pGenesisFile "Shelley genesis filepath" - <*> pStakePoolVerificationKeyOrHashOrFile Nothing - <*> pVrfSigningKeyFile - <*> pWhichLeadershipSchedule - <*> (optional $ pOutputFormatJsonOrText "leadership-schedule") - <*> pMaybeOutputFile - - pKesPeriodInfo :: Parser LegacyQueryCmds - pKesPeriodInfo = - fmap QueryKesPeriodInfoCmd $ - LegacyQueryKesPeriodInfoCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pOperationalCertificateFile - <*> pMaybeOutputFile - - pQuerySlotNumber :: Parser LegacyQueryCmds - pQuerySlotNumber = - fmap QuerySlotNumberCmd $ - LegacyQuerySlotNumberCmdArgs - <$> pSocketPath envCli - <*> pConsensusModeParams - <*> pNetworkId envCli - <*> pUtcTimestamp - where - pUtcTimestamp = - convertTime - <$> (Opt.strArgument . mconcat) - [ Opt.metavar "TIMESTAMP" - , Opt.help "UTC timestamp in YYYY-MM-DDThh:mm:ssZ format" - ] - --- TODO: Conway era - move to Cardano.CLI.Conway.Parsers pGovernanceCmds :: EnvCli -> Parser LegacyGovernanceCmds pGovernanceCmds envCli = asum @@ -865,15 +71,6 @@ pGovernanceCmds envCli = , subParser "create-update-proposal" $ Opt.info pUpdateProposal $ Opt.progDesc "Create an update proposal" - , subParser "create-poll" $ - Opt.info pGovernanceCreatePoll $ - Opt.progDesc "Create an SPO poll" - , subParser "answer-poll" $ - Opt.info pGovernanceAnswerPoll $ - Opt.progDesc "Answer an SPO poll" - , subParser "verify-poll" $ - Opt.info pGovernanceVerifyPoll $ - Opt.progDesc "Verify an answer to a given SPO poll" ] where mirCertParsers :: Parser LegacyGovernanceCmds @@ -931,28 +128,6 @@ pGovernanceCmds envCli = <*> pProtocolParametersUpdate <*> optional pCostModels - pGovernanceCreatePoll :: Parser LegacyGovernanceCmds - pGovernanceCreatePoll = - GovernanceCreatePoll - <$> pPollQuestion - <*> some pPollAnswer - <*> optional pPollNonce - <*> pOutputFile - - pGovernanceAnswerPoll :: Parser LegacyGovernanceCmds - pGovernanceAnswerPoll = - GovernanceAnswerPoll - <$> pPollFile - <*> optional pPollAnswerIndex - <*> optional pOutputFile - - pGovernanceVerifyPoll :: Parser LegacyGovernanceCmds - pGovernanceVerifyPoll = - GovernanceVerifyPoll - <$> pPollFile - <*> pPollTxFile - <*> optional pOutputFile - pGenesisCmds :: EnvCli -> Parser LegacyGenesisCmds pGenesisCmds envCli = asum @@ -1264,30 +439,6 @@ pGenesisCmds envCli = , Opt.value 0 ] -pStakePoolRegistrationCertificiateCmd :: EnvCli -> Parser LegacyStakePoolCmds -pStakePoolRegistrationCertificiateCmd envCli = - StakePoolRegistrationCertificateCmd - <$> pAnyShelleyBasedEra envCli - <*> pStakePoolVerificationKeyOrFile Nothing - <*> pVrfVerificationKeyOrFile - <*> pPoolPledge - <*> pPoolCost - <*> pPoolMargin - <*> pRewardAcctVerificationKeyOrFile - <*> some pPoolOwnerVerificationKeyOrFile - <*> many pPoolRelay - <*> pStakePoolMetadataReference - <*> pNetworkId envCli - <*> pOutputFile - -pStakePoolDeregistrationCertificateCmd :: EnvCli -> Parser LegacyStakePoolCmds -pStakePoolDeregistrationCertificateCmd envCli = - StakePoolDeregistrationCertificateCmd - <$> pAnyShelleyBasedEra envCli - <*> pStakePoolVerificationKeyOrFile Nothing - <*> pEpochNo "The epoch number." - <*> pOutputFile - pLegacyCardanoEra :: EnvCli -> Parser AnyCardanoEra pLegacyCardanoEra envCli = asum $ diff --git a/cardano-cli/src/Cardano/CLI/Options.hs b/cardano-cli/src/Cardano/CLI/Options.hs index 6522e4d48d..a320a5b705 100644 --- a/cardano-cli/src/Cardano/CLI/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Options.hs @@ -9,8 +9,6 @@ module Cardano.CLI.Options ) where -import Cardano.Api (ShelleyBasedEra (..)) - import Cardano.CLI.Byron.Parsers (backwardsCompatibilityCommands, parseByronCommands) import Cardano.CLI.Environment (EnvCli) import Cardano.CLI.EraBased.Commands @@ -57,8 +55,6 @@ parseClientCommand envCli = -- so we list it first. [ parseAnyEra envCli , parseLegacy envCli - , -- , parseTopLevelLatest envCli -- TODO restore this when the governance command group is fully operational - parseTopLevelLegacy envCli , parseByron envCli , parseHash , parsePing @@ -95,14 +91,6 @@ parseLegacy envCli = Opt.info (LegacyCmds <$> parseLegacyCmds envCli) $ Opt.progDesc ("Legacy commands" <> deprecationText) -_parseTopLevelLatest :: EnvCli -> Parser ClientCommand -_parseTopLevelLatest envCli = - AnyEraCommand . AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds ShelleyBasedEraBabbage envCli - --- | Parse Legacy commands at the top level of the CLI. -parseTopLevelLegacy :: EnvCli -> Parser ClientCommand -parseTopLevelLegacy envCli = LegacyCmds <$> parseLegacyCmds envCli - -- | Parse Legacy commands at the top level of the CLI. -- Yes! A --version flag or version command. Either guess is right! parseDisplayVersion :: ParserInfo a -> Parser ClientCommand diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs index 317b7a43f1..c73df7542a 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs @@ -19,8 +19,7 @@ hprop_golden_governance_action_create_constitution = void $ execCardanoCLI - [ "legacy" - , "stake-address" + [ "stake-address" , "key-gen" , "--verification-key-file" , stakeAddressVKeyFile