Skip to content

Commit

Permalink
Merge pull request #520 from input-output-hk/felix-lipski/txn-build-i…
Browse files Browse the repository at this point in the history
…nvalid-file-options

fix: invalid options on cardano-cli babbage transaction build and build-raw
  • Loading branch information
felix-lipski committed Dec 13, 2023
2 parents 8a0c9f7 + 648c8a9 commit c7f1e95
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 77 deletions.
21 changes: 16 additions & 5 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Cardano.CLI.Environment (EnvCli (..))
import Cardano.CLI.EraBased.Commands.Transaction
import Cardano.CLI.EraBased.Options.Common
import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Governance (VoteFile)

import Data.Foldable
import Options.Applicative hiding (help, str)
Expand Down Expand Up @@ -151,7 +152,7 @@ pTransactionBuildCmd era envCli = do
]
]
where
pCmd :: ShelleyBasedEra era -> Parser (TransactionCmds era)
pCmd :: ShelleyBasedEra era -> Parser (TransactionCmds era)
pCmd sbe =
fmap TransactionBuildCmd $
TransactionBuildCmdArgs sbe
Expand Down Expand Up @@ -180,8 +181,8 @@ pTransactionBuildCmd era envCli = do
"Filepath of auxiliary script(s)")
<*> many pMetadataFile
<*> pFeatured (shelleyBasedToCardanoEra sbe) (optional pUpdateProposalFile)
<*> many (pFileInDirection "vote-file" "Filepath of the vote.")
<*> many (pFileInDirection "proposal-file" "Filepath of the proposal.")
<*> pVoteFiles sbe
<*> pProposalFiles sbe
<*> (OutputTxBodyOnly <$> pTxBodyFileOut <|> pCalculatePlutusScriptCost)

pChangeAddress :: Parser TxOutChangeAddress
Expand Down Expand Up @@ -215,10 +216,20 @@ pTransactionBuildRaw era =
<*> many pMetadataFile
<*> optional pProtocolParamsFile
<*> pFeatured era (optional pUpdateProposalFile)
<*> many (pFileInDirection "vote-file" "Filepath of the vote.")
<*> many (pFileInDirection "proposal-file" "Filepath of the proposal.")
<*> pVoteFiles era
<*> pProposalFiles era
<*> pTxBodyFileOut

pVoteFiles :: ShelleyBasedEra era -> Parser [VoteFile In]
pVoteFiles = caseShelleyToBabbageOrConwayEraOnwards
(const $ pure [])
(const $ many (pFileInDirection "vote-file" "Filepath of the vote."))

pProposalFiles :: ShelleyBasedEra era -> Parser [ProposalFile In]
pProposalFiles = caseShelleyToBabbageOrConwayEraOnwards
(const $ pure [])
(const $ many (pFileInDirection "proposal-file" "Filepath of the proposal."))

pTransactionSign :: EnvCli -> Parser (TransactionCmds era)
pTransactionSign envCli =
fmap TransactionSignCmd $
Expand Down
24 changes: 0 additions & 24 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,6 @@ Usage: cardano-cli shelley transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -1047,8 +1045,6 @@ Usage: cardano-cli shelley transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -2085,8 +2081,6 @@ Usage: cardano-cli allegra transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -2210,8 +2204,6 @@ Usage: cardano-cli allegra transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -3240,8 +3232,6 @@ Usage: cardano-cli mary transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -3362,8 +3352,6 @@ Usage: cardano-cli mary transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -4396,8 +4384,6 @@ Usage: cardano-cli alonzo transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -4521,8 +4507,6 @@ Usage: cardano-cli alonzo transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -5585,8 +5569,6 @@ Usage: cardano-cli babbage transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -5710,8 +5692,6 @@ Usage: cardano-cli babbage transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -8280,8 +8260,6 @@ Usage: cardano-cli latest transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -8405,8 +8383,6 @@ Usage: cardano-cli latest transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ Usage: cardano-cli allegra transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -398,7 +396,5 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ Usage: cardano-cli allegra transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -391,8 +389,6 @@ Available options:
Filepath of the metadata, in raw CBOR format.
--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.
--calculate-plutus-script-cost FILE
(File () Out) filepath of the script cost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ Usage: cardano-cli alonzo transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -398,7 +396,5 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ Usage: cardano-cli alonzo transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -391,8 +389,6 @@ Available options:
Filepath of the metadata, in raw CBOR format.
--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.
--calculate-plutus-script-cost FILE
(File () Out) filepath of the script cost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ Usage: cardano-cli babbage transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -398,7 +396,5 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ Usage: cardano-cli babbage transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -391,8 +389,6 @@ Available options:
Filepath of the metadata, in raw CBOR format.
--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.
--calculate-plutus-script-cost FILE
(File () Out) filepath of the script cost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ Usage: cardano-cli latest transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -398,7 +396,5 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ Usage: cardano-cli latest transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -391,8 +389,6 @@ Available options:
Filepath of the metadata, in raw CBOR format.
--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.
--calculate-plutus-script-cost FILE
(File () Out) filepath of the script cost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ Usage: cardano-cli mary transaction build-raw
]
[--protocol-params-file FILE]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
--out-file FILE

Build a transaction (low-level, inconvenient)
Expand Down Expand Up @@ -398,7 +396,5 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ Usage: cardano-cli mary transaction build --socket-path SOCKET_PATH
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
[--vote-file FILE]
[--proposal-file FILE]
( --out-file FILE
| --calculate-plutus-script-cost FILE
)
Expand Down Expand Up @@ -388,8 +386,6 @@ Available options:
Filepath of the metadata, in raw CBOR format.
--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.
--calculate-plutus-script-cost FILE
(File () Out) filepath of the script cost
Expand Down
Loading

0 comments on commit c7f1e95

Please sign in to comment.