diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs index 2c972d8496..c3b125403d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs @@ -48,7 +48,8 @@ data TransactionCmds era [MetadataFile] (Maybe ProtocolParamsFile) (Maybe UpdateProposalFile) - [ProposalFile 'In] + [VoteFile In] + [ProposalFile In] (TxBodyFile Out) -- | Like 'TxBuildRaw' but without the fee, and with a change output. diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs index 87d9f3b984..9623304ba8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs @@ -211,6 +211,7 @@ pTransactionBuildRaw era = <*> many pMetadataFile <*> optional pProtocolParamsFile <*> optional pUpdateProposalFile + <*> many (pFileInDirection "vote-file" "Filepath of the vote.") <*> many (pFileInDirection "proposal-file" "Filepath of the proposal.") <*> pTxBodyFileOut diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 1dfb3f2732..e5312e2787 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -79,21 +79,23 @@ runTransactionCmds cmd = TxBuild era mNodeSocketPath consensusModeParams nid mScriptValidity mOverrideWits txins readOnlyRefIns reqSigners txinsc mReturnColl mTotCollateral txouts changeAddr mValue mLowBound - mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mUpProp votingProcedureFiles + mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mUpProp voteFiles proposalFiles outputOptions -> runTxBuildCmd era mNodeSocketPath consensusModeParams nid mScriptValidity mOverrideWits txins readOnlyRefIns reqSigners txinsc mReturnColl mTotCollateral txouts changeAddr mValue mLowBound - mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mUpProp votingProcedureFiles + mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mUpProp voteFiles proposalFiles outputOptions TxBuildRaw era mScriptValidity txins readOnlyRefIns txinsc mReturnColl mTotColl reqSigners txouts mValue mLowBound mUpperBound fee certs wdrls - metadataSchema scriptFiles metadataFiles mProtocolParamsFile mUpProp proposalFiles + metadataSchema scriptFiles metadataFiles mProtocolParamsFile mUpProp + voteFiles proposalFiles out -> runTxBuildRawCmd era mScriptValidity txins readOnlyRefIns txinsc mReturnColl mTotColl reqSigners txouts mValue mLowBound mUpperBound fee certs wdrls - metadataSchema scriptFiles metadataFiles mProtocolParamsFile mUpProp proposalFiles + metadataSchema scriptFiles metadataFiles mProtocolParamsFile mUpProp + voteFiles proposalFiles out TxSign txinfile skfiles network txoutfile -> runTxSignCmd txinfile skfiles network txoutfile @@ -152,7 +154,7 @@ runTxBuildCmd era socketPath consensusModeParams@(AnyConsensusModeParams cModeParams) nid mScriptValidity mOverrideWits txins readOnlyRefIns reqSigners txinsc mReturnColl mTotCollateral txouts changeAddr mValue mLowBound mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mUpProp - votingProcedureFiles proposalFiles outputOptions = do + voteFiles proposalFiles 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 @@ -197,7 +199,7 @@ runTxBuildCmd votingProcedures <- inEonForEra (pure emptyVotingProcedures) - (\w -> firstExceptT TxCmdVoteError $ ExceptT (readVotingProceduresFiles w votingProcedureFiles)) + (\w -> firstExceptT TxCmdVoteError $ ExceptT (readVotingProceduresFiles w voteFiles)) era proposals <- newExceptT $ first TxCmdConstitutionError @@ -307,6 +309,7 @@ runTxBuildRawCmd -> [MetadataFile] -> Maybe ProtocolParamsFile -> Maybe UpdateProposalFile + -> [VoteFile In] -> [ProposalFile In] -> TxBodyFile Out -> ExceptT TxCmdError IO () @@ -314,7 +317,7 @@ runTxBuildRawCmd era mScriptValidity txins readOnlyRefIns txinsc mReturnColl mTotColl reqSigners txouts mValue mLowBound mUpperBound fee certs wdrls metadataSchema scriptFiles metadataFiles mpParamsFile mUpProp - proposalFiles out = do + voteFiles proposalFiles out = do inputsAndMaybeScriptWits <- firstExceptT TxCmdScriptWitnessError $ readScriptWitnessFiles era txins certFilesAndMaybeScriptWits <- firstExceptT TxCmdScriptWitnessError @@ -361,6 +364,13 @@ runTxBuildRawCmd -- the same collateral input can be used for several plutus scripts let filteredTxinsc = Set.toList $ Set.fromList txinsc + -- Conway related + votingProcedures <- + inEonForEra + (pure emptyVotingProcedures) + (\w -> firstExceptT TxCmdVoteError $ ExceptT (readVotingProceduresFiles w voteFiles)) + era + proposals <- lift (readTxGovernanceActions era proposalFiles) & onLeft (left . TxCmdConstitutionError) @@ -368,7 +378,7 @@ runTxBuildRawCmd txBody <- hoistEither $ runTxBuildRaw era mScriptValidity inputsAndMaybeScriptWits readOnlyRefIns filteredTxinsc mReturnCollateral mTotColl txOuts mLowBound mUpperBound fee valuesWithScriptWits certsAndMaybeScriptWits withdrawalsAndMaybeScriptWits requiredSigners txAuxScripts - txMetadata mLedgerPParams mProp proposals + txMetadata mLedgerPParams mProp votingProcedures proposals let noWitTx = makeSignedTransaction [] txBody lift (cardanoEraConstraints era $ writeTxFileTextEnvelopeCddl out noWitTx) @@ -407,6 +417,7 @@ runTxBuildRaw :: () -> TxMetadataInEra era -> Maybe (LedgerProtocolParameters era) -> Maybe UpdateProposal + -> VotingProcedures era -> [Proposal era] -> Either TxCmdError (TxBody era) runTxBuildRaw era @@ -416,7 +427,7 @@ runTxBuildRaw era mLowerBound mUpperBound mFee valuesWithScriptWits certsAndMaybeSriptWits withdrawals reqSigners - txAuxScripts txMetadata mpparams mUpdateProp proposals = do + txAuxScripts txMetadata mpparams mUpdateProp votingProcedures proposals = do let allReferenceInputs = getAllReferenceInputs inputsAndMaybeScriptWits @@ -450,7 +461,7 @@ runTxBuildRaw era validatedTxScriptValidity <- first TxCmdScriptValidityValidationError $ validateTxScriptValidity era mScriptValidity let validatedTxProposal = proposals - validatedTxVotes = Nothing -- TODO: Conwary era + validatedTxVotes = votingProcedures -- TODO: Conwary era let txBodyContent = TxBodyContent { txIns = validateTxIns inputsAndMaybeScriptWits @@ -471,7 +482,7 @@ runTxBuildRaw era , txMintValue = validatedMintValue , txScriptValidity = validatedTxScriptValidity , txProposalProcedures = forEraInEonMaybe era (`Featured` validatedTxProposal) - , txVotingProcedures = validatedTxVotes + , txVotingProcedures = forEraInEonMaybe era (`Featured` validatedTxVotes) } first TxCmdTxBodyError $ diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs index 9e34bd0be8..8134add4f6 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -120,7 +120,7 @@ runLegacyTxBuildRawCmd metadataSchema scriptFiles metadataFiles mProtocolParamsFile mUpProp = runTxBuildRawCmd era mScriptValidity txins readOnlyRefIns txinsc mReturnColl mTotColl reqSigners txouts mValue mLowBound mUpperBound fee certs wdrls - metadataSchema scriptFiles metadataFiles mProtocolParamsFile mUpProp [] + metadataSchema scriptFiles metadataFiles mProtocolParamsFile mUpProp [] [] runLegacyTxSignCmd :: InputTxBodyOrTxFile -> [WitnessSigningData] 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 fb926bc293..42775f0d7f 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -945,6 +945,7 @@ Usage: cardano-cli shelley transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -2130,6 +2131,7 @@ Usage: cardano-cli allegra transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -3302,6 +3304,7 @@ Usage: cardano-cli mary transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -4479,6 +4482,7 @@ Usage: cardano-cli alonzo transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -5692,6 +5696,7 @@ Usage: cardano-cli babbage transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -7249,6 +7254,7 @@ Usage: cardano-cli conway transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -8459,6 +8465,7 @@ Usage: cardano-cli latest transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_build-raw.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_build-raw.cli index 6080031cf5..d5fbc8c108 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_build-raw.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_transaction_build-raw.cli @@ -113,6 +113,7 @@ Usage: cardano-cli allegra transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -382,6 +383,7 @@ Available options: Filepath of the JSON-encoded protocol parameters file --update-proposal-file FILE Filepath of the update proposal. + --vote-file FILE Filepath of the vote. --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_build-raw.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_build-raw.cli index 8179fd8b30..e798df3dfa 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_build-raw.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_transaction_build-raw.cli @@ -113,6 +113,7 @@ Usage: cardano-cli alonzo transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -382,6 +383,7 @@ Available options: Filepath of the JSON-encoded protocol parameters file --update-proposal-file FILE Filepath of the update proposal. + --vote-file FILE Filepath of the vote. --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_build-raw.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_build-raw.cli index 77a75d86e9..28d774dd54 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_build-raw.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_transaction_build-raw.cli @@ -113,6 +113,7 @@ Usage: cardano-cli babbage transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -382,6 +383,7 @@ Available options: Filepath of the JSON-encoded protocol parameters file --update-proposal-file FILE Filepath of the update proposal. + --vote-file FILE Filepath of the vote. --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_build-raw.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_build-raw.cli index f986701818..776f2fce16 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_build-raw.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_build-raw.cli @@ -113,6 +113,7 @@ Usage: cardano-cli conway transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -382,6 +383,7 @@ Available options: Filepath of the JSON-encoded protocol parameters file --update-proposal-file FILE Filepath of the update proposal. + --vote-file FILE Filepath of the vote. --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_build-raw.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_build-raw.cli index c7a34f0e6c..bb50cfb81e 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_build-raw.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_transaction_build-raw.cli @@ -113,6 +113,7 @@ Usage: cardano-cli latest transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -382,6 +383,7 @@ Available options: Filepath of the JSON-encoded protocol parameters file --update-proposal-file FILE Filepath of the update proposal. + --vote-file FILE Filepath of the vote. --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_build-raw.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_build-raw.cli index 39340040e0..4fbcef5859 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_build-raw.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_transaction_build-raw.cli @@ -113,6 +113,7 @@ Usage: cardano-cli mary transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -382,6 +383,7 @@ Available options: Filepath of the JSON-encoded protocol parameters file --update-proposal-file FILE Filepath of the update proposal. + --vote-file FILE Filepath of the vote. --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_build-raw.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_build-raw.cli index b6479e7b1b..efe4974678 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_build-raw.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_transaction_build-raw.cli @@ -113,6 +113,7 @@ Usage: cardano-cli shelley transaction build-raw ] [--protocol-params-file FILE] [--update-proposal-file FILE] + [--vote-file FILE] [--proposal-file FILE] --out-file FILE @@ -382,6 +383,7 @@ Available options: Filepath of the JSON-encoded protocol parameters file --update-proposal-file FILE Filepath of the update proposal. + --vote-file FILE Filepath of the vote. --proposal-file FILE Filepath of the proposal. --out-file FILE Output filepath of the JSON TxBody. -h,--help Show this help text