diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs index 668fb3465b..a12084f5d2 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs @@ -91,7 +91,7 @@ data LegacyTransactionCmds [MetadataFile] (Maybe UpdateProposalFile) [VoteFile In] - [NewConstitutionFile In] + [ProposalFile In] TxBuildOutputOptions | TxSign InputTxBodyOrTxFile diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index d9c5289706..a354fe953e 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -564,7 +564,7 @@ pTransaction envCli = <*> many pMetadataFile <*> optional pUpdateProposalFile <*> many (pFileInDirection "vote-file" "Filepath of the vote.") - <*> many (pFileInDirection "constitution-file" "Filepath of the constitution.") + <*> many (pFileInDirection "proposal-file" "Filepath of the proposal.") <*> (OutputTxBodyOnly <$> pTxBodyFileOut <|> pCalculatePlutusScriptCost) pChangeAddress :: Parser TxOutChangeAddress diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs index 6e9cd4d152..41dd31747f 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -123,14 +123,14 @@ runTxBuildCmd -> [MetadataFile] -> Maybe UpdateProposalFile -> [VoteFile In] - -> [NewConstitutionFile In] -- TODO: Conway era - we should replace this with a sumtype that handles all governance actions + -> [File () In] -- TODO: Conway era - we should replace this with a sumtype that handles all governance actions -> TxBuildOutputOptions -> ExceptT ShelleyTxCmdError IO () runTxBuildCmd socketPath (AnyCardanoEra cEra) consensusModeParams@(AnyConsensusModeParams cModeParams) nid mScriptValidity mOverrideWits txins readOnlyRefIns reqSigners txinsc mReturnColl mTotCollateral txouts changeAddr mValue mLowBound mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mUpProp - conwayVotes newConstitutions outputOptions = do + conwayVotes newProposals outputOptions = do -- The user can specify an era prior to the era that the node is currently in. -- We cannot use the user specified era to construct a query against a node because it may differ @@ -179,8 +179,7 @@ runTxBuildCmd cEra proposals <- newExceptT $ first ShelleyTxCmdConstitutionError - <$> readTxNewConstitutionActions cEra newConstitutions - + <$> readTxGovernanceActions cEra newProposals -- the same collateral input can be used for several plutus scripts let filteredTxinsc = Set.toList $ Set.fromList txinsc diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 560ed1666c..4e2fe73037 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -56,7 +56,7 @@ module Cardano.CLI.Read -- * Governance related , ConstitutionError(..) , VoteError (..) - , readTxNewConstitutionActions + , readTxGovernanceActions -- * FileOrPipe , FileOrPipe @@ -776,22 +776,22 @@ data ConstitutionError | ConstitutionsNotSupportedInEra AnyCardanoEra deriving Show -readTxNewConstitutionActions +readTxGovernanceActions :: CardanoEra era - -> [NewConstitutionFile In] + -> [ProposalFile In] -> IO (Either ConstitutionError (TxGovernanceActions era)) -readTxNewConstitutionActions _ [] = return $ Right TxGovernanceActionsNone -readTxNewConstitutionActions era files = runExceptT $ do +readTxGovernanceActions _ [] = return $ Right TxGovernanceActionsNone +readTxGovernanceActions era files = runExceptT $ do w <- maybeFeatureInEra era & hoistMaybe (ConstitutionsNotSupportedInEra $ cardanoEraConstraints era $ AnyCardanoEra era) - constitutions <- newExceptT $ sequence <$> mapM (readConstitution w) files - pure $ TxGovernanceActions w constitutions + proposals <- newExceptT $ sequence <$> mapM (readProposal w) files + pure $ TxGovernanceActions w proposals -readConstitution +readProposal :: ConwayEraOnwards era - -> NewConstitutionFile In + -> ProposalFile In -> IO (Either ConstitutionError (Proposal era)) -readConstitution w fp = +readProposal w fp = first ConstitutionErrorFile <$> conwayEraOnwardsConstraints w (readFileTextEnvelope AsProposal fp) diff --git a/cardano-cli/src/Cardano/CLI/Types/Common.hs b/cardano-cli/src/Cardano/CLI/Types/Common.hs index 1eaf0743c8..92bdf23f55 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Common.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Common.hs @@ -38,6 +38,7 @@ module Cardano.CLI.Types.Common , ParserFileDirection (..) , IdOutputFormat (..) , PrivKeyFile(..) + , ProposalFile , ProtocolParamsFile(..) , ReferenceScriptAnyEra (..) , RequiredSigner (..) @@ -270,6 +271,8 @@ instance Crypto.Crypto crypto => ToJSON (Params crypto) where type SigningKeyFile = File (SigningKey ()) +type ProposalFile = File () + newtype UpdateProposalFile = UpdateProposalFile { unUpdateProposalFile :: FilePath } deriving newtype (Eq, Show) diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 552f7fd90f..c6d240dd15 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -2234,7 +2234,7 @@ Usage: cardano-cli legacy transaction build --socket-path SOCKET_PATH ] [--update-proposal-file FILE] [--vote-file FILE] - [--constitution-file FILE] + [--proposal-file FILE] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -3548,7 +3548,7 @@ Usage: cardano-cli transaction build --socket-path SOCKET_PATH ] [--update-proposal-file FILE] [--vote-file FILE] - [--constitution-file FILE] + [--proposal-file FILE] ( --out-file FILE | --calculate-plutus-script-cost FILE ) diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_build.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_build.cli index b3c393bf31..06e25919d6 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_build.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_transaction_build.cli @@ -120,7 +120,7 @@ Usage: cardano-cli legacy transaction build --socket-path SOCKET_PATH ] [--update-proposal-file FILE] [--vote-file FILE] - [--constitution-file FILE] + [--proposal-file FILE] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -400,7 +400,7 @@ Available options: --update-proposal-file FILE Filepath of the update proposal. --vote-file FILE Filepath of the vote. - --constitution-file FILE Filepath of the constitution. + --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. --calculate-plutus-script-cost FILE (File () Out) filepath of the script cost diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_build.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_build.cli index 262ba4342a..62574b3727 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_build.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/transaction_build.cli @@ -113,7 +113,7 @@ Usage: cardano-cli transaction build --socket-path SOCKET_PATH ] [--update-proposal-file FILE] [--vote-file FILE] - [--constitution-file FILE] + [--proposal-file FILE] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -393,7 +393,7 @@ Available options: --update-proposal-file FILE Filepath of the update proposal. --vote-file FILE Filepath of the vote. - --constitution-file FILE Filepath of the constitution. + --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. --calculate-plutus-script-cost FILE (File () Out) filepath of the script cost