From 48f3bad9ce07ebb7d1b9d0a1ba42f94e18c10703 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Wed, 20 Dec 2023 13:07:36 -0400 Subject: [PATCH 01/10] Update pGovActionLifetime, pDRepActivity and pEpochBoundRetirement with EpochInterval Implement AnyTxCmdTxExecUnitsErr and AnyTxBodyErrorAutoBalance to wrap TransactionValidityError era and TxBodyErrorAutoBalance era respectively --- .../Cardano/CLI/EraBased/Options/Common.hs | 24 ++++++++++++------- .../Cardano/CLI/EraBased/Run/Transaction.hs | 4 ++-- cardano-cli/src/Cardano/CLI/Read.hs | 2 -- .../Cardano/CLI/Types/Errors/TxCmdError.hs | 18 ++++++++++---- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index cdb0d12bbf..012dfa679f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -2622,12 +2622,18 @@ pPoolDeposit = , Opt.help "The amount of a pool registration deposit." ] -pEpochBoundRetirement :: Parser EpochNo +pEpochBoundRetirement :: Parser L.EpochInterval pEpochBoundRetirement = - fmap EpochNo $ Opt.option (bounded "EPOCH_BOUNDARY") $ mconcat - [ Opt.long "pool-retirement-epoch-boundary" - , Opt.metavar "EPOCH_BOUNDARY" - , Opt.help "Epoch bound on pool retirement." + fmap L.EpochInterval $ asum + [ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat + [ Opt.long "pool-retirement-epoch-interval" + , Opt.metavar "EPOCH_INTERVAL" + , Opt.help "Epoch interval of pool retirement." + ] + , Opt.option (bounded "EPOCH_BOUNDARY") $ mconcat + [ Opt.long "pool-retirement-epoch-boundary" + , Opt.internal + ] ] pNumberOfPools :: Parser Natural @@ -2928,9 +2934,9 @@ pCommitteeTermLength = , Opt.help "Maximal term length for members of the constitutional committee, in epochs." ] -pGovActionLifetime :: Parser EpochNo +pGovActionLifetime :: Parser L.EpochInterval pGovActionLifetime = - fmap EpochNo $ Opt.option (bounded "EPOCH") $ mconcat + fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat [ Opt.long "governance-action-lifetime" , Opt.metavar "NATURAL" , Opt.help "Maximal lifetime of governance actions, in epochs." @@ -2944,9 +2950,9 @@ pDRepDeposit = , Opt.help "DRep deposit amount." ] -pDRepActivity :: Parser EpochNo +pDRepActivity :: Parser L.EpochInterval pDRepActivity = - fmap EpochNo $ Opt.option (bounded "EPOCH") $ mconcat + fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat [ Opt.long "drep-activity" , Opt.metavar "NATURAL" , Opt.help "DRep activity period, in epochs." diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index f63bb2b3b5..f8afebc219 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -226,7 +226,7 @@ runTransactionBuildCmd & hoistMaybe (TxCmdTxNodeEraMismatchError $ NodeEraMismatchError era nodeEra) scriptExecUnitsMap <- - firstExceptT TxCmdTxExecUnitsErr $ hoistEither + firstExceptT (TxCmdTxExecUnitsErr . AnyTxCmdTxExecUnitsErr) $ hoistEither $ evaluateTransactionExecutionUnits era systemStart (toLedgerEpochInfo eraHistory) pparams txEraUtxo balancedTxBody @@ -588,7 +588,7 @@ runTxBuild & onLeft (error $ "runTxBuild: Byron address used: " <> show changeAddr) -- should this throw instead? balancedTxBody@(BalancedTxBody _ _ _ fee) <- - firstExceptT TxCmdBalanceTxBody + firstExceptT (TxCmdBalanceTxBody . AnyTxBodyErrorAutoBalance) . hoistEither $ makeTransactionBodyAutoBalance sbe systemStart (toLedgerEpochInfo eraHistory) pparams stakePools stakeDelegDeposits drepDelegDeposits diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 640af83a2e..b90f46a8aa 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -906,8 +906,6 @@ readCostModels (File fp) = do -- Misc --- readFileInByronEra = undefined - readFileInAnyShelleyBasedEra :: ( HasTextEnvelope (thing ShelleyEra) , HasTextEnvelope (thing AllegraEra) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs index 70493025b2..1086b6b96c 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs @@ -8,6 +8,8 @@ module Cardano.CLI.Types.Errors.TxCmdError ( TxCmdError(..) + , AnyTxBodyErrorAutoBalance(..) + , AnyTxCmdTxExecUnitsErr(..) , renderTxCmdError ) where @@ -31,6 +33,12 @@ import Data.Text (Text) {- HLINT ignore "Use let" -} +data AnyTxCmdTxExecUnitsErr where + AnyTxCmdTxExecUnitsErr :: TransactionValidityError era -> AnyTxCmdTxExecUnitsErr + +data AnyTxBodyErrorAutoBalance where + AnyTxBodyErrorAutoBalance :: TxBodyErrorAutoBalance era -> AnyTxBodyErrorAutoBalance + data TxCmdError = TxCmdMetadataError MetadataError | TxCmdVoteError VoteError @@ -53,13 +61,13 @@ data TxCmdError -- policy Ids that were provided in the transaction. | TxCmdPolicyIdsExcess ![PolicyId] | TxCmdByronEra - | TxCmdBalanceTxBody !TxBodyErrorAutoBalance + | TxCmdBalanceTxBody !AnyTxBodyErrorAutoBalance | TxCmdTxInsDoNotExist !TxInsExistError | TxCmdPParamsErr !ProtocolParametersError | TxCmdTextEnvCddlError !(FileError TextEnvelopeError) !(FileError TextEnvelopeCddlError) - | TxCmdTxExecUnitsErr !TransactionValidityError + | TxCmdTxExecUnitsErr !AnyTxCmdTxExecUnitsErr | TxCmdPlutusScriptCostErr !PlutusScriptCostError | TxCmdPParamExecutionUnitsNotAvailable | TxCmdPlutusScriptsRequireCardanoMode @@ -149,8 +157,8 @@ renderTxCmdError = \case ] TxCmdByronEra -> "This query cannot be used for the Byron era" - TxCmdBalanceTxBody err' -> - prettyError err' + TxCmdBalanceTxBody (AnyTxBodyErrorAutoBalance err') -> + prettyError err' TxCmdTxInsDoNotExist e -> pretty $ renderTxInsExistError e TxCmdPParamsErr err' -> @@ -161,7 +169,7 @@ renderTxCmdError = \case , "CDDL serialisation format. TextEnvelope error: " <> prettyError textEnvErr <> "\n" , "TextEnvelopeCddl error: " <> prettyError cddlErr ] - TxCmdTxExecUnitsErr err' -> + TxCmdTxExecUnitsErr (AnyTxCmdTxExecUnitsErr err') -> prettyError err' TxCmdPlutusScriptCostErr err'-> prettyError err' From 8f55104621d71a2268d5f10d86c9e78c59656930 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 13:39:46 -0600 Subject: [PATCH 02/10] Add consitution script hash argument to the governance action 'create-treasury-withdrawal' command --- .../EraBased/Commands/Governance/Actions.hs | 20 ++++++++++--------- .../EraBased/Options/Governance/Actions.hs | 2 ++ .../CLI/EraBased/Run/Governance/Actions.hs | 2 ++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs index ba6bf4e741..3dfc58a2f3 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -27,13 +27,13 @@ import Cardano.Api.Shelley import Cardano.CLI.Types.Common import Cardano.CLI.Types.Key +import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo import qualified Cardano.Ledger.BaseTypes as Ledger import qualified Cardano.Ledger.Crypto as Crypto import qualified Cardano.Ledger.SafeHash as Ledger import Data.Text (Text) import Data.Word -import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo data GovernanceActionCmds era = GovernanceActionCreateConstitutionCmd !(GovernanceActionCreateConstitutionCmdArgs era) @@ -118,14 +118,15 @@ data GovernanceActionProtocolParametersUpdateCmdArgs era data GovernanceActionTreasuryWithdrawalCmdArgs era = GovernanceActionTreasuryWithdrawalCmdArgs - { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network - , deposit :: !Lovelace - , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) - , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) - , treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)] - , outFile :: !(File () Out) + { eon :: !(ConwayEraOnwards era) + , networkId :: !Ledger.Network + , deposit :: !Lovelace + , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) + , proposalUrl :: !ProposalUrl + , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)] + , constitutionScriptHash :: !(Maybe ScriptHash) + , outFile :: !(File () Out) } deriving Show data GovernanceActionViewCmdArgs era @@ -145,6 +146,7 @@ data UpdateProtocolParametersConwayOnwards era , proposalUrl :: !ProposalUrl , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) , governanceActionId :: !(Maybe (TxId, Word32)) + , constitutionScriptHash :: !(Maybe ScriptHash) } data CostModelsFile era diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index a93e701e08..db5f755a74 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -167,6 +167,7 @@ pUpdateProtocolParametersPostConway conwayOnwards = <*> pAnchorUrl <*> pAnchorDataHash <*> pPreviousGovernanceAction + <*> optional pConstitutionScriptHash pUpdateProtocolParametersCmd :: ShelleyBasedEra era -> Parser (Cmd.GovernanceActionProtocolParametersUpdateCmdArgs era) @@ -358,6 +359,7 @@ pGovernanceActionTreasuryWithdrawalCmd era = do <*> pAnchorUrl <*> pAnchorDataHash <*> many ((,) <$> pStakeVerificationKeyOrHashOrFile (Just "funds-receiving") <*> pTransferAmt) + <*> optional pConstitutionScriptHash <*> pFileOutDirection "out-file" "Output filepath of the treasury withdrawal." ) $ Opt.progDesc "Create a treasury withdrawal." diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index 216ba5afca..24a3332b89 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -332,6 +332,7 @@ runGovernanceActionTreasuryWithdrawalCmd , Cmd.proposalUrl , Cmd.proposalHash , Cmd.treasuryWithdrawal + , Cmd.constitutionScriptHash , Cmd.outFile } = do @@ -348,6 +349,7 @@ runGovernanceActionTreasuryWithdrawalCmd let sbe = conwayEraOnwardsToShelleyBasedEra eon treasuryWithdrawals = TreasuryWithdrawal withdrawals + (toShelleyScriptHash <$> Ledger.maybeToStrictMaybe constitutionScriptHash) proposal = createProposalProcedure sbe networkId deposit returnKeyHash treasuryWithdrawals proposalAnchor firstExceptT GovernanceActionsCmdWriteFileError . newExceptT From ce2bbb8a75609bb0ffa6da0a66c71cbe6761fb0a Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 14:34:53 -0600 Subject: [PATCH 03/10] Update transaction build and transaction build-raw parsers with the ability to submit script witnesses for votes and proposals --- .../CLI/EraBased/Commands/Transaction.hs | 8 +-- .../Cardano/CLI/EraBased/Options/Common.hs | 49 ++++++++++++++++++- .../CLI/EraBased/Options/Transaction.hs | 19 ++----- .../Cardano/CLI/EraBased/Run/Transaction.hs | 8 +-- .../CLI/Legacy/Commands/Transaction.hs | 4 +- cardano-cli/src/Cardano/CLI/Legacy/Options.hs | 4 +- .../src/Cardano/CLI/Legacy/Run/Transaction.hs | 4 +- 7 files changed, 66 insertions(+), 30 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs index a08ff62e0a..816b693a05 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs @@ -75,8 +75,8 @@ data TransactionBuildRawCmdArgs era = TransactionBuildRawCmdArgs , metadataFiles :: ![MetadataFile] , mProtocolParamsFile :: !(Maybe ProtocolParamsFile) , mUpdateProprosalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))) - , voteFiles :: ![VoteFile In] - , proposalFiles :: ![ProposalFile In] + , voteFiles :: ![(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))] + , proposalFiles :: ![(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))] , txBodyOutFile :: !(TxBodyFile Out) } deriving Show @@ -121,8 +121,8 @@ data TransactionBuildCmdArgs era = TransactionBuildCmdArgs -- ^ Auxiliary scripts , metadataFiles :: ![MetadataFile] , mfUpdateProposalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))) - , voteFiles :: ![VoteFile In] - , proposalFiles :: ![ProposalFile In] + , voteFiles :: ![(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))] + , proposalFiles :: ![(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))] , buildOutputOptions :: !TxBuildOutputOptions } deriving Show diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 012dfa679f..56eff649fc 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -27,7 +27,7 @@ import Cardano.CLI.Types.Key.VerificationKey import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.Crypto as Crypto import qualified Cardano.Ledger.SafeHash as L -import qualified Cardano.Ledger.Shelley.TxBody as Shelley +import qualified Cardano.Ledger.Shelley.API as Shelley import Control.Monad (mfilter) import qualified Data.Aeson as Aeson @@ -1116,6 +1116,53 @@ pScriptDataOrFile dataFlagPrefix helpTextForValue helpTextForFile = Left err -> fail $ docToString $ prettyError err Right sd -> return sd +pVoteFiles + :: ShelleyBasedEra era + -> BalanceTxExecUnits + -> Parser [(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))] +pVoteFiles sbe bExUnits= caseShelleyToBabbageOrConwayEraOnwards + (const $ pure []) + (const . many $ pVoteFile bExUnits) + sbe + +pVoteFile :: BalanceTxExecUnits -> Parser (VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake)) +pVoteFile balExUnits = + (,) <$> pFileInDirection "vote-file" "Filepath of the vote." + <*> optional (pVoteScriptOrReferenceScriptWitness balExUnits) + + where + pVoteScriptOrReferenceScriptWitness + :: BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake) + pVoteScriptOrReferenceScriptWitness bExUnits = + pScriptWitnessFiles + WitCtxStake + bExUnits + "vote" + Nothing + "a vote" + +pProposalFiles :: ShelleyBasedEra era -> BalanceTxExecUnits -> Parser [(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))] +pProposalFiles sbe balExUnits = caseShelleyToBabbageOrConwayEraOnwards + (const $ pure []) + (const $ many (pProposalFile balExUnits)) + sbe + +pProposalFile :: BalanceTxExecUnits -> Parser (ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake)) +pProposalFile balExUnits = + (,) <$> pFileInDirection "proposal-file" "Filepath of the proposal." + <*> optional (pProposingScriptOrReferenceScriptWitness balExUnits) + + where + pProposingScriptOrReferenceScriptWitness + :: BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake) + pProposingScriptOrReferenceScriptWitness bExUnits = + pScriptWitnessFiles + WitCtxStake + bExUnits + "proposal" + Nothing + "a proposal" + -------------------------------------------------------------------------------- pPaymentVerifier :: Parser PaymentVerifier diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs index 050ed4e0e5..8283c64035 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs @@ -14,7 +14,6 @@ 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) @@ -181,8 +180,8 @@ pTransactionBuildCmd era envCli = do "Filepath of auxiliary script(s)") <*> many pMetadataFile <*> pFeatured (shelleyBasedToCardanoEra sbe) (optional pUpdateProposalFile) - <*> pVoteFiles sbe - <*> pProposalFiles sbe + <*> pVoteFiles sbe AutoBalance + <*> pProposalFiles sbe AutoBalance <*> (OutputTxBodyOnly <$> pTxBodyFileOut <|> pCalculatePlutusScriptCost) pChangeAddress :: Parser TxOutChangeAddress @@ -216,20 +215,10 @@ pTransactionBuildRaw era = <*> many pMetadataFile <*> optional pProtocolParamsFile <*> pFeatured era (optional pUpdateProposalFile) - <*> pVoteFiles era - <*> pProposalFiles era + <*> pVoteFiles era ManualBalance + <*> pProposalFiles era ManualBalance <*> 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 $ diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index f8afebc219..f97efa6106 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -384,8 +384,8 @@ runTxBuildRaw :: () -> TxMetadataInEra era -> Maybe (LedgerProtocolParameters era) -> TxUpdateProposal era - -> VotingProcedures era - -> [Proposal era] + -> [(VotingProcedures era, Maybe (ScriptWitness WitCtxStake era))] + -> [(Proposal era, Maybe (ScriptWitness WitCtxStake era))] -> Either TxCmdError (TxBody era) runTxBuildRaw sbe mScriptValidity inputsAndMaybeScriptWits @@ -488,8 +488,8 @@ runTxBuild :: () -> TxMetadataInEra era -> TxUpdateProposal era -> Maybe Word - -> VotingProcedures era - -> [Proposal era] + -> [(VotingProcedures era, Maybe (ScriptWitness WitCtxStake era))] + -> [(Proposal era, Maybe (ScriptWitness WitCtxStake era))] -> TxBuildOutputOptions -> ExceptT TxCmdError IO (BalancedTxBody era) runTxBuild diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs index ce53dceed8..f2de4ccb10 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs @@ -90,8 +90,8 @@ data LegacyTransactionCmds -- ^ Auxiliary scripts [MetadataFile] (Maybe UpdateProposalFile) - [VoteFile In] - [ProposalFile In] + [(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))] + [(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))] TxBuildOutputOptions | TransactionSignCmd InputTxBodyOrTxFile diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index 866c9a9268..9ae80ff64e 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -336,8 +336,8 @@ pTransaction envCli = "Filepath of auxiliary script(s)") <*> many pMetadataFile <*> optional pUpdateProposalFile - <*> many (pFileInDirection "vote-file" "Filepath of the vote.") - <*> many (pFileInDirection "proposal-file" "Filepath of the proposal.") + <*> pVoteFiles ShelleyBasedEraConway AutoBalance + <*> pProposalFiles ShelleyBasedEraConway AutoBalance <*> (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 bdf1408e31..95b2e6e161 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -90,8 +90,8 @@ runLegacyTransactionBuildCmd :: () -> [ScriptFile] -> [MetadataFile] -> Maybe UpdateProposalFile - -> [VoteFile In] - -> [ProposalFile In] + -> [(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))] + -> [(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))] -> TxBuildOutputOptions -> ExceptT TxCmdError IO () runLegacyTransactionBuildCmd From 4e516f1bba1abf023e0d66953099aef68a4167d1 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 15:02:38 -0600 Subject: [PATCH 04/10] Include potential voting and proposing script witness reference inputs in 'getAllReferenceInputs' Update 'readVotingProceduresFiles' and 'readSingleVote' to also read script witnesses Update 'readTxGovernanceActions' and 'readProposal' to also read script witnesses Fix incorrect error type in 'readTxGovernanceActions' Implement 'convToTxProposalProcedures' and 'convertToTxVotingProcedures' which gathers the necessary script witnesses for us as a conventient 'Map' --- .../Cardano/CLI/EraBased/Run/Transaction.hs | 55 ++++++++------ cardano-cli/src/Cardano/CLI/Read.hs | 76 ++++++++++++------- .../CLI/Types/Errors/TxValidationError.hs | 63 +++++++++++++++ 3 files changed, 146 insertions(+), 48 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index f97efa6106..eee5055be1 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -170,13 +170,13 @@ runTransactionBuildCmd txOuts <- mapM (toTxOutInAnyEra eon) txouts -- Conway related - votingProcedures <- + votingProceduresAndMaybeScriptWits <- inEonForEra - (pure emptyVotingProcedures) + (pure mempty) (\w -> firstExceptT TxCmdVoteError $ ExceptT (readVotingProceduresFiles w voteFiles)) era - proposals <- newExceptT $ first TxCmdConstitutionError + proposals <- newExceptT $ first TxCmdProposalError <$> readTxGovernanceActions eon proposalFiles -- the same collateral input can be used for several plutus scripts @@ -188,16 +188,18 @@ runTransactionBuildCmd eon nodeSocketPath networkId mScriptValidity inputsAndMaybeScriptWits readOnlyReferenceInputs filteredTxinsc mReturnCollateral mTotalCollateral txOuts changeAddresses valuesWithScriptWits mValidityLowerBound mValidityUpperBound certsAndMaybeScriptWits withdrawalsAndMaybeScriptWits - requiredSigners txAuxScripts txMetadata mProp mOverrideWitnesses votingProcedures proposals buildOutputOptions + requiredSigners txAuxScripts txMetadata mProp mOverrideWitnesses votingProceduresAndMaybeScriptWits + proposals buildOutputOptions let mScriptWits = forEraInEon era [] $ \sbe -> collectTxBodyScriptWitnesses sbe txBodyContent - - let allReferenceInputs = getAllReferenceInputs + allReferenceInputs = getAllReferenceInputs inputsAndMaybeScriptWits (snd valuesWithScriptWits) certsAndMaybeScriptWits withdrawalsAndMaybeScriptWits + votingProceduresAndMaybeScriptWits + proposals readOnlyReferenceInputs let inputsThatRequireWitnessing = [input | (input,_) <- inputsAndMaybeScriptWits] @@ -323,15 +325,15 @@ runTransactionBuildRawCmd let filteredTxinsc = Set.toList $ Set.fromList txInsCollateral -- Conway related - votingProcedures <- + votingProceduresAndMaybeScriptWits <- inEonForShelleyBasedEra - (pure emptyVotingProcedures) - (\w -> firstExceptT TxCmdVoteError $ ExceptT (readVotingProceduresFiles w voteFiles)) + (pure mempty) + (\w -> firstExceptT TxCmdVoteError . ExceptT $ conwayEraOnwardsConstraints w $ readVotingProceduresFiles w voteFiles) eon proposals <- lift (readTxGovernanceActions eon proposalFiles) - & onLeft (left . TxCmdConstitutionError) + & onLeft (left . TxCmdProposalError) certsAndMaybeScriptWits <- shelleyBasedEraConstraints eon $ @@ -345,7 +347,7 @@ runTransactionBuildRawCmd eon mScriptValidity inputsAndMaybeScriptWits readOnlyRefIns filteredTxinsc mReturnCollateral mTotalCollateral txOuts mValidityLowerBound mValidityUpperBound fee valuesWithScriptWits certsAndMaybeScriptWits withdrawalsAndMaybeScriptWits requiredSigners txAuxScripts - txMetadata mLedgerPParams txUpdateProposal votingProcedures proposals + txMetadata mLedgerPParams txUpdateProposal votingProceduresAndMaybeScriptWits proposals let noWitTx = makeSignedTransaction [] txBody lift (writeTxFileTextEnvelopeCddl eon txBodyOutFile noWitTx) @@ -402,7 +404,10 @@ runTxBuildRaw sbe (snd valuesWithScriptWits) certsAndMaybeSriptWits withdrawals + votingProcedures + proposals readOnlyRefIns + validatedTxIns = validateTxIns inputsAndMaybeScriptWits validatedCollateralTxIns <- validateTxInsCollateral era txinsc validatedRefInputs <- validateTxInsReference era allReferenceInputs @@ -426,8 +431,6 @@ runTxBuildRaw sbe <- createTxMintValue sbe valuesWithScriptWits validatedTxScriptValidity <- first TxCmdScriptValidityValidationError $ validateTxScriptValidity era mScriptValidity - let validatedTxProposal = proposals - validatedTxVotes = votingProcedures let txBodyContent = TxBodyContent { txIns = validatedTxIns @@ -448,8 +451,8 @@ runTxBuildRaw sbe , txUpdateProposal = txUpdateProposal , txMintValue = validatedMintValue , txScriptValidity = validatedTxScriptValidity - , txProposalProcedures = forEraInEonMaybe era (`Featured` validatedTxProposal) - , txVotingProcedures = forEraInEonMaybe era (`Featured` validatedTxVotes) + , txProposalProcedures = forEraInEonMaybe era (`Featured` (shelleyBasedEraConstraints sbe $ convToTxProposalProcedures proposals)) + , txVotingProcedures = forEraInEonMaybe era (`Featured` convertToTxVotingProcedures votingProcedures) } first TxCmdTxBodyError $ createAndValidateTransactionBody sbe txBodyContent @@ -510,6 +513,8 @@ runTxBuild (snd valuesWithScriptWits) certsAndMaybeScriptWits withdrawals + votingProcedures + proposals readOnlyRefIns validatedCollateralTxIns <- hoistEither $ validateTxInsCollateral era txinsc @@ -546,16 +551,14 @@ runTxBuild _ -> [] (txEraUtxo, pparams, eraHistory, systemStart, stakePools, stakeDelegDeposits, drepDelegDeposits) <- - lift (executeLocalStateQueryExpr localNodeConnInfo Nothing $ queryStateForBalancedTx nodeEra allTxInputs certs) + lift (executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ queryStateForBalancedTx nodeEra allTxInputs certs) & onLeft (left . TxCmdQueryConvenienceError . AcqFailure) & onLeft (left . TxCmdQueryConvenienceError) validatedPParams <- hoistEither $ first TxCmdProtocolParametersValidationError $ validateProtocolParameters era (Just pparams) - let validatedTxProposalProcedures = proposals - validatedTxVotes = votingProcedures - txBodyContent = + let txBodyContent = TxBodyContent { txIns = validateTxIns inputsAndMaybeScriptWits , txInsCollateral = validatedCollateralTxIns @@ -575,8 +578,8 @@ runTxBuild , txUpdateProposal = txUpdateProposal , txMintValue = validatedMintValue , txScriptValidity = validatedTxScriptValidity - , txProposalProcedures = forEraInEonMaybe era (`Featured` validatedTxProposalProcedures) - , txVotingProcedures = forEraInEonMaybe era (`Featured` validatedTxVotes) + , txProposalProcedures = forEraInEonMaybe era (`Featured` convToTxProposalProcedures proposals) + , txVotingProcedures = forEraInEonMaybe era (`Featured` convertToTxVotingProcedures votingProcedures) } firstExceptT TxCmdTxInsDoNotExist @@ -657,18 +660,26 @@ getAllReferenceInputs -> [ScriptWitness WitCtxMint era] -> [(Certificate era, Maybe (ScriptWitness WitCtxStake era))] -> [(StakeAddress, Lovelace, Maybe (ScriptWitness WitCtxStake era))] + -> [(VotingProcedures era, Maybe (ScriptWitness WitCtxStake era))] + -> [(Proposal era, Maybe (ScriptWitness WitCtxStake era))] -> [TxIn] -- ^ Read only reference inputs -> [TxIn] -getAllReferenceInputs txins mintWitnesses certFiles withdrawals readOnlyRefIns = do +getAllReferenceInputs txins mintWitnesses certFiles withdrawals + votingProceduresAndMaybeScriptWits propProceduresAnMaybeScriptWits + readOnlyRefIns = do let txinsWitByRefInputs = [getReferenceInput sWit | (_, Just sWit) <- txins] mintingRefInputs = map getReferenceInput mintWitnesses certsWitByRefInputs = [getReferenceInput sWit | (_, Just sWit) <- certFiles] withdrawalsWitByRefInputs = [getReferenceInput sWit | (_, _, Just sWit) <- withdrawals] + votesWitByRefInputs = [getReferenceInput sWit | (_, Just sWit) <- votingProceduresAndMaybeScriptWits] + propsWitByRefInputs = [getReferenceInput sWit | (_, Just sWit) <- propProceduresAnMaybeScriptWits] catMaybes $ concat [ txinsWitByRefInputs , mintingRefInputs , certsWitByRefInputs , withdrawalsWitByRefInputs + , votesWitByRefInputs + , propsWitByRefInputs , map Just readOnlyRefIns ] where diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index b90f46a8aa..51dcd8eda4 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -4,6 +4,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} module Cardano.CLI.Read ( -- * Metadata @@ -75,7 +76,7 @@ module Cardano.CLI.Read , getStakeAddressFromVerifier , readVotingProceduresFiles - , readVotingProceduresFile + , readSingleVote -- * DRep credentials , getDRepCredentialFromVerKeyHashOrFile @@ -113,7 +114,6 @@ import qualified Cardano.Crypto.Hash.Class as Crypto import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.BaseTypes as Ledger -import qualified Cardano.Ledger.Conway.Governance as Ledger import qualified Cardano.Ledger.Credential as Ledger import qualified Cardano.Ledger.Crypto as Crypto import qualified Cardano.Ledger.Crypto as Ledger @@ -139,7 +139,6 @@ import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Function ((&)) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import qualified Data.List as List -import qualified Data.Map.Strict as Map import Data.String import Data.Text (Text) import qualified Data.Text as Text @@ -149,7 +148,6 @@ import Data.Word import GHC.IO.Handle (hClose, hIsSeekable) import GHC.IO.Handle.FD (openFileBlocking) import qualified Options.Applicative as Opt -import Prettyprinter (vsep) import System.IO (IOMode (ReadMode)) -- Metadata @@ -227,6 +225,7 @@ data ScriptWitnessError | ScriptWitnessErrorExpectedPlutus !FilePath !AnyScriptLanguage | ScriptWitnessErrorReferenceScriptsNotSupportedInEra !AnyShelleyBasedEra | ScriptWitnessErrorScriptData ScriptDataError + deriving Show renderScriptWitnessError :: ScriptWitnessError -> Doc ann renderScriptWitnessError = \case @@ -387,6 +386,7 @@ data ScriptDataError = | ScriptDataErrorValidation !FilePath !ScriptDataRangeError | ScriptDataErrorMetadataDecode !FilePath !CBOR.DecoderError | ScriptDataErrorJsonBytes !ScriptDataJsonBytesError + deriving Show renderScriptDataError :: ScriptDataError -> Doc ann renderScriptDataError = \case @@ -783,6 +783,7 @@ readRequiredSigner (RequiredSignerSkeyFile skFile) = do data VoteError = VoteErrorFile (FileError TextEnvelopeError) | VoteErrorTextNotUnicode Text.UnicodeException + | VoteErrorScriptWitness ScriptWitnessError deriving Show instance Error VoteError where @@ -791,17 +792,17 @@ instance Error VoteError where prettyError e VoteErrorTextNotUnicode e -> "Vote text file not UTF8-encoded: " <> pretty (displayException e) + VoteErrorScriptWitness e -> + renderScriptWitnessError e -readVotingProceduresFiles :: () - => ConwayEraOnwards era - -> [VoteFile In] - -> IO (Either VoteError (VotingProcedures era)) +readVotingProceduresFiles + :: ConwayEraOnwards era + -> [(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))] + -> IO (Either VoteError [(VotingProcedures era, Maybe (ScriptWitness WitCtxStake era))]) readVotingProceduresFiles w = \case - [] -> return $ Right $ VotingProcedures $ Ledger.VotingProcedures Map.empty - files -> runExceptT $ do - vpss <- forM files (ExceptT . readVotingProceduresFile w) + [] -> return $ return [] + files -> runExceptT $ forM files (ExceptT . readSingleVote w) - pure $ foldl unsafeMergeVotingProcedures emptyVotingProcedures vpss readTxUpdateProposal :: () => ShelleyToBabbageEra era @@ -810,13 +811,26 @@ readTxUpdateProposal :: () readTxUpdateProposal w (UpdateProposalFile upFp) = do TxUpdateProposal w <$> newExceptT (readFileTextEnvelope AsUpdateProposal (File upFp)) -readVotingProceduresFile :: () +-- Because the 'Voter' type is contained only in the 'VotingProcedures' +-- type, we must read a single vote as 'VotingProcedures'. The cli will +-- not read vote files with multiple votes in them because this will +-- complicate the code further in terms of contructing the redeemer map +-- when it comes to script witnessed votes. +readSingleVote :: () => ConwayEraOnwards era - -> VoteFile In - -> IO (Either VoteError (VotingProcedures era)) -readVotingProceduresFile w fp = - conwayEraOnwardsConstraints w - $ first VoteErrorFile <$> readFileTextEnvelope AsVotingProcedures fp + -> (VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake)) + -> IO (Either VoteError (VotingProcedures era, Maybe (ScriptWitness WitCtxStake era))) +readSingleVote w (voteFp, mScriptWitFiles) = do + votProceds <- conwayEraOnwardsConstraints w + $ first VoteErrorFile <$> readFileTextEnvelope AsVotingProcedures voteFp + case mScriptWitFiles of + Nothing -> pure $ (,Nothing) <$> votProceds + sWitFile -> do + let sbe = conwayEraOnwardsToShelleyBasedEra w + runExceptT $ do + sWits <- firstExceptT VoteErrorScriptWitness + $ mapM (readScriptWitness sbe) sWitFile + hoistEither $ (,sWits) <$> votProceds data ConstitutionError = ConstitutionErrorFile (FileError TextEnvelopeError) @@ -828,24 +842,34 @@ data ProposalError = ProposalErrorFile (FileError TextEnvelopeError) | ProposalNotSupportedInEra AnyCardanoEra | ProposalNotUnicodeError Text.UnicodeException + | ProposalErrorScriptWitness ScriptWitnessError deriving Show readTxGovernanceActions :: ShelleyBasedEra era - -> [ProposalFile In] - -> IO (Either ConstitutionError [Proposal era]) + -> [(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))] + -> IO (Either ProposalError [(Proposal era, Maybe (ScriptWitness WitCtxStake era))]) readTxGovernanceActions _ [] = return $ Right [] readTxGovernanceActions era files = runExceptT $ do w <- forShelleyBasedEraMaybeEon era - & hoistMaybe (ConstitutionNotSupportedInEra $ cardanoEraConstraints (toCardanoEra era) $ AnyCardanoEra (toCardanoEra era)) - newExceptT $ sequence <$> mapM (fmap (first ConstitutionErrorFile) . readProposal w) files + & hoistMaybe (ProposalNotSupportedInEra $ cardanoEraConstraints (toCardanoEra era) $ AnyCardanoEra (toCardanoEra era)) + newExceptT $ sequence <$> mapM (readProposal w) files readProposal :: ConwayEraOnwards era - -> ProposalFile In - -> IO (Either (FileError TextEnvelopeError) (Proposal era)) -readProposal w fp = - conwayEraOnwardsConstraints w (readFileTextEnvelope AsProposal fp) + -> (ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake)) + -> IO (Either ProposalError (Proposal era, Maybe (ScriptWitness WitCtxStake era))) +readProposal w (fp, mScriptWit) = do + prop <- conwayEraOnwardsConstraints w + $ first ProposalErrorFile <$> readFileTextEnvelope AsProposal fp + case mScriptWit of + Nothing -> pure $ (,Nothing) <$> prop + sWitFile -> do + let sbe = conwayEraOnwardsToShelleyBasedEra w + runExceptT $ do + sWit <- firstExceptT ProposalErrorScriptWitness + $ mapM (readScriptWitness sbe) sWitFile + hoistEither $ (,sWit) <$> prop constitutionHashSourceToHash :: () => ConstitutionHashSource diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs index 0833f69f6f..d414f9c22e 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs @@ -19,6 +19,8 @@ module Cardano.CLI.Types.Errors.TxValidationError , TxReturnCollateralValidationError(..) , TxTotalCollateralValidationError(..) , TxWithdrawalsValidationError(..) + , convToTxProposalProcedures + , convertToTxVotingProcedures , validateProtocolParameters , validateScriptSupportedInEra , validateTxAuxScripts @@ -34,16 +36,21 @@ module Cardano.CLI.Types.Errors.TxValidationError ) where import Cardano.Api +import qualified Cardano.Api.Ledger as L import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Types.Common +import qualified Cardano.Ledger.Conway.Governance as Conway +import qualified Cardano.Ledger.Core as Ledger import Prelude import Data.Bifunctor (first) +import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Data.Maybe +import qualified Data.OSet.Strict as OSet data ScriptLanguageValidationError = ScriptLanguageValidationError AnyScriptLanguage AnyCardanoEra @@ -217,6 +224,9 @@ instance Error TxCertificatesValidationError where prettyError (TxCertificatesValidationNotSupported e) = "Transaction certificates are not supported in " <> pretty e +-- TODO: Because we have separated Byron related transaction +-- construction into separate commands, we can parameterize this +-- on ShelleyBasedEra era and remove Either TxCertificatesValidationError validateTxCertificates :: forall era. CardanoEra era @@ -298,3 +308,56 @@ conjureWitness :: Eon eon conjureWitness era errF = maybe (cardanoEraConstraints era $ Left . errF $ AnyCardanoEra era) Right $ forEraMaybeEon era + +getVotingScriptCredentials + :: VotingProcedures era + -> Maybe (Conway.Voter (L.EraCrypto (ShelleyLedgerEra era))) +getVotingScriptCredentials (VotingProcedures (Conway.VotingProcedures m)) = + listToMaybe $ Map.keys m + +votingScriptWitnessSingleton + :: VotingProcedures era + -> Maybe (ScriptWitness WitCtxStake era) + -> Map (Conway.Voter (L.EraCrypto (ShelleyLedgerEra era))) (ScriptWitness WitCtxStake era) +votingScriptWitnessSingleton _ Nothing = Map.empty +votingScriptWitnessSingleton votingProcedures (Just scriptWitness) = + let voter = fromJust $ getVotingScriptCredentials votingProcedures + in Map.singleton voter scriptWitness + +-- TODO: We fold twice, we can do it in a single fold +convertToTxVotingProcedures + :: [(VotingProcedures era, Maybe (ScriptWitness WitCtxStake era))] + -> TxVotingProcedures BuildTx era +convertToTxVotingProcedures votingProcedures = + let votingScriptWitnessMap = BuildTxWith + $ foldl (\acc next -> acc `Map.union` uncurry votingScriptWitnessSingleton next ) + Map.empty + votingProcedures + allVotes = unVotingProcedures + $ foldl + (\acc next -> acc `unsafeMergeVotingProcedures` fst next) + emptyVotingProcedures + votingProcedures + + in TxVotingProcedures allVotes votingScriptWitnessMap + +proposingScriptWitnessSingleton + :: Proposal era + -> Maybe (ScriptWitness WitCtxStake era) + -> Map (Conway.ProposalProcedure (ShelleyLedgerEra era)) (ScriptWitness WitCtxStake era) +proposingScriptWitnessSingleton _ Nothing = Map.empty +proposingScriptWitnessSingleton (Proposal proposalProcedure) (Just scriptWitness) = + Map.singleton proposalProcedure scriptWitness + +convToTxProposalProcedures + :: Ledger.EraPParams (ShelleyLedgerEra era) + => [(Proposal era, Maybe (ScriptWitness WitCtxStake era))] + -> TxProposalProcedures BuildTx era +convToTxProposalProcedures proposalProcedures = + -- TODO: Ledger does not export snoc so we can't fold here. + let proposals = OSet.fromFoldable $ map (unProposal . fst) proposalProcedures + sWitMap = BuildTxWith $ foldl sWitMapFolder Map.empty proposalProcedures + in TxProposalProcedures proposals sWitMap + where + sWitMapFolder sWitMapAccum nextSWit = sWitMapAccum `Map.union` uncurry proposingScriptWitnessSingleton nextSWit + From bc5964f3a0278faf2f74630e86ba90a443fac654 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 14:28:46 -0600 Subject: [PATCH 05/10] Update golden files Remove cli tx body intermediate format backwards compatibility test --- .../golden/conway/transaction/assemble_out | 2 +- ...arameters-update-partial-costmodels.action | 2 +- ...y-create-protocol-parameters-update.action | 2 +- .../committee/update-committee-answer.json | 2 +- .../drep/extended-key-signing/tx.signed | 2 +- .../golden/governance/hash/foo.script.hash | 2 +- .../cardano-cli-golden/files/golden/help.cli | 143 ++++++++++++------ ...tion_create-protocol-parameters-update.cli | 18 +-- ...tion_create-protocol-parameters-update.cli | 18 +-- ...tion_create-protocol-parameters-update.cli | 18 +-- ...tion_create-protocol-parameters-update.cli | 40 +++-- ...ance_action_create-treasury-withdrawal.cli | 4 + .../help/conway_transaction_build-raw.cli | 45 +++++- .../golden/help/conway_transaction_build.cli | 37 ++++- .../governance_create-update-proposal.cli | 18 +-- ...tion_create-protocol-parameters-update.cli | 18 +-- ...gacy_governance_create-update-proposal.cli | 18 +-- .../golden/help/legacy_transaction_build.cli | 37 ++++- ...tion_create-protocol-parameters-update.cli | 18 +-- ...tion_create-protocol-parameters-update.cli | 18 +-- .../files/golden/help/transaction_build.cli | 37 ++++- .../shelley/stake-address/build-raw-out.json | 2 +- .../input/conway/genesis.conway.spec.json | 29 ++-- .../Test/Cli/CliIntermediateFormat.hs | 45 ------ 24 files changed, 365 insertions(+), 210 deletions(-) delete mode 100644 cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction/assemble_out b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction/assemble_out index 9f36beda13..44b7ccaffe 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction/assemble_out +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction/assemble_out @@ -1,5 +1,5 @@ { "type": "Witnessed Tx ConwayEra", "description": "Ledger Cddl Format", - "cborHex": "84a5008182582054b5f2d5ed0fa142e724c9a982864d9e080b10648a66c8f7956eb3cc2cf16c0000018182581d6052e63f22c5107ed776b70f7b92248b02552fd08f3e747bc7450994411b0000000235cfef6d021a0002ff51031a0099d1dd04828a03581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d75820dacc52f2d73542ab0fc3b1f8051d00b0e50f1130935e5a21982bd289705852ae1b000000174876e8001b00000002540be400d81e82010a581de05e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c81581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c818400190bb9447f000001f682783268747470733a2f2f6d792d69702e61742f746573742f636f6e77617974657374706f6f6c2e6d657461646174612e6a736f6e58207cd083e6682892afc2b4e315fca93784f43dccde8bae1daa81db0b587e27155f83028200581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d7a10081825820c16f6bf723e38013f88588539fbbf1cd6b57bbbd8bb2cf318e641f00dcd527875840e62f3050bf7ee1d1547badd6f8346c00957b20c8d8f201fc8cf9d64485b3b3c944392afe00619516a00d98c6ccfa44a7de8c1a093efdc10832bb6fdf4cde8e08f5f6" + "cborHex": "84a5008182582054b5f2d5ed0fa142e724c9a982864d9e080b10648a66c8f7956eb3cc2cf16c0000018182581d6052e63f22c5107ed776b70f7b92248b02552fd08f3e747bc7450994411b0000000235cfef6d021a0002ff51031a0099d1dd04828a03581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d75820dacc52f2d73542ab0fc3b1f8051d00b0e50f1130935e5a21982bd289705852ae1b000000174876e8001b00000002540be400d81e82010a581de05e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c81581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c818400190bb9447f000001f682783268747470733a2f2f6d792d69702e61742f746573742f636f6e77617974657374706f6f6c2e6d657461646174612e6a736f6e58207cd083e6682892afc2b4e315fca93784f43dccde8bae1daa81db0b587e27155f83028200581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d7a100d9010281825820c16f6bf723e38013f88588539fbbf1cd6b57bbbd8bb2cf318e641f00dcd527875840e62f3050bf7ee1d1547badd6f8346c00957b20c8d8f201fc8cf9d64485b3b3c944392afe00619516a00d98c6ccfa44a7de8c1a093efdc10832bb6fdf4cde8e08f5f6" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action index 6760d63cf7..7f98fafd03 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action @@ -1,5 +1,5 @@ { "type": "Governance proposal", "description": "", - "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058300f6a112a1019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30aff826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" + "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a112a1019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30afff6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action index 5b54ff4611..5acb9e1d6b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action @@ -1,5 +1,5 @@ { "type": "Governance proposal", "description": "", - "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058300f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30aff029f01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" + "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30aff029f01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/update-committee-answer.json b/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/update-committee-answer.json index 358e5c675f..bd5325ed25 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/update-committee-answer.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/update-committee-answer.json @@ -1,5 +1,5 @@ { "type": "Governance proposal", "description": "", - "cborHex": "8400581de08f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058504f680a28200581cc0f2510d2353ee41a508b3c700c807e52697f2813fb014e3bc6982cd18ca8200581cf5ba9ae54a389cf97c54b981513d780877fc888579148044a8e7e7f218fcd81e8218331864826c687474703a2f2f64756d6d795820c9decb4498c4924d4f9804b6fa3425bab8f669f6452cb61f295114c906f3093e" + "cborHex": "8400581de08f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058504f6d9010280a28200581cc0f2510d2353ee41a508b3c700c807e52697f2813fb014e3bc6982cd18ca8200581cf5ba9ae54a389cf97c54b981513d780877fc888579148044a8e7e7f218fcd81e8218331864826c687474703a2f2f64756d6d795820c9decb4498c4924d4f9804b6fa3425bab8f669f6452cb61f295114c906f3093e" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/extended-key-signing/tx.signed b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/extended-key-signing/tx.signed index 5eaaff652d..14a8d64a8e 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/extended-key-signing/tx.signed +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/extended-key-signing/tx.signed @@ -1,5 +1,5 @@ { "type": "Witnessed Tx ConwayEra", "description": "Ledger Cddl Format", - "cborHex": "84a50081825820829e3fd4847f53f0291370fc900b24cc7c7cc4f69676bbed9ca6e281dae9d60a00018182581d6063a11787740d8c90b6d335eefb8bb2f9e23066a3340e8c89d31ed74e1a002b2d03021a000299bd031a010f14d904d901028184108200581c8f4fefcf28017a57b41517a67d56ef4c0dc04181a11d35178dd53f4c1a001e8480f6a10081825820b18eacea2003b68e39137545e9d42ce5bca133ca0334d6a75aa9cb1fd02be7ec5840051079704c9d41192356287965e189d9fe7f693693a72a454f34e6f1c27c5523fe4c8b841931a6d7bb0f59d09b0dcc406834f990845e115a7329ef4285d38208f5f6" + "cborHex": "84a50081825820829e3fd4847f53f0291370fc900b24cc7c7cc4f69676bbed9ca6e281dae9d60a00018182581d6063a11787740d8c90b6d335eefb8bb2f9e23066a3340e8c89d31ed74e1a002b2d03021a000299bd031a010f14d904d901028184108200581c8f4fefcf28017a57b41517a67d56ef4c0dc04181a11d35178dd53f4c1a001e8480f6a100d9010281825820b18eacea2003b68e39137545e9d42ce5bca133ca0334d6a75aa9cb1fd02be7ec5840051079704c9d41192356287965e189d9fe7f693693a72a454f34e6f1c27c5523fe4c8b841931a6d7bb0f59d09b0dcc406834f990845e115a7329ef4285d38208f5f6" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash b/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash index 67040a92f1..63b4adee4a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash @@ -1 +1 @@ -7dde1be4d1a2f617ac343dd7ef0388cf497c19ba8dab653a5b9eb1e2 \ No newline at end of file +2a7a40032759083907e43e145b770b467cfc0ddbc3c1266bc2c01b40 \ No newline at end of file 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 347b2e4f8d..0ac5c5e15a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -351,12 +351,12 @@ Usage: cardano-cli shelley governance action create-protocol-parameters-update - (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -1510,12 +1510,12 @@ Usage: cardano-cli allegra governance action create-protocol-parameters-update - (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -2667,12 +2667,12 @@ Usage: cardano-cli mary governance action create-protocol-parameters-update --ep (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -3808,12 +3808,12 @@ Usage: cardano-cli alonzo governance action create-protocol-parameters-update -- (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -4976,12 +4976,12 @@ Usage: cardano-cli babbage governance action create-protocol-parameters-update - (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -6192,14 +6192,15 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update --anchor-data-hash HASH [--prev-governance-action-tx-id TXID --prev-governance-action-index WORD32] + [--constitution-script-hash HASH] [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -6216,7 +6217,8 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update [--pool-voting-threshold-motion-no-confidence RATIONAL --pool-voting-threshold-committee-normal RATIONAL --pool-voting-threshold-committee-no-confidence RATIONAL - --pool-voting-threshold-hard-fork-initiation RATIONAL] + --pool-voting-threshold-hard-fork-initiation RATIONAL + --pool-voting-threshold-pp-security-group RATIONAL] [--drep-voting-threshold-motion-no-confidence RATIONAL --drep-voting-threshold-committee-normal RATIONAL --drep-voting-threshold-committee-no-confidence RATIONAL @@ -6228,11 +6230,11 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update --drep-voting-threshold-pp-governance-group RATIONAL --drep-voting-threshold-treasury-withdrawal RATIONAL] [--min-committee-size INT] - [--committee-term-length INT] - [--governance-action-lifetime NATURAL] + [--committee-term-length WORD32] + [--governance-action-lifetime WORD32] [--new-governance-action-deposit NATURAL] [--drep-deposit LOVELACE] - [--drep-activity NATURAL] + [--drep-activity WORD32] [--cost-model-file FILE] --out-file FILE @@ -6255,6 +6257,7 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal | --funds-receiving-stake-key-hash HASH ) --transfer LOVELACE] + [--constitution-script-hash HASH] --out-file FILE Create a treasury withdrawal. @@ -7093,8 +7096,22 @@ Usage: cardano-cli conway transaction build-raw | --metadata-cbor-file FILE ] [--protocol-params-file FILE] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ + ( --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ) + --vote-execution-units (INT, INT)]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ + ( --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ) + --proposal-execution-units (INT, INT)]]] --out-file FILE Build a transaction (low-level, inconvenient) @@ -7217,8 +7234,18 @@ Usage: cardano-cli conway transaction build --socket-path SOCKET_PATH [ --metadata-json-file FILE | --metadata-cbor-file FILE ] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ]]] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -7685,12 +7712,12 @@ Usage: cardano-cli latest governance action create-protocol-parameters-update -- (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -8646,16 +8673,16 @@ Usage: cardano-cli legacy governance create-update-proposal --out-file FILE [ --extra-entropy HEX | --reset-extra-entropy ] - [--max-block-header-size NATURAL] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] + [--max-block-header-size WORD16] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] [--min-utxo-value NATURAL] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] [--min-pool-cost NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--monetary-expansion RATIONAL] @@ -9420,8 +9447,18 @@ Usage: cardano-cli legacy transaction build --socket-path SOCKET_PATH | --metadata-cbor-file FILE ] [--update-proposal-file FILE] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ]]] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -9893,16 +9930,16 @@ Usage: cardano-cli governance create-update-proposal --out-file FILE [ --extra-entropy HEX | --reset-extra-entropy ] - [--max-block-header-size NATURAL] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] + [--max-block-header-size WORD16] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] [--min-utxo-value NATURAL] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] [--min-pool-cost NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--monetary-expansion RATIONAL] @@ -10626,8 +10663,18 @@ Usage: cardano-cli transaction build --socket-path SOCKET_PATH | --metadata-cbor-file FILE ] [--update-proposal-file FILE] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ]]] ( --out-file FILE | --calculate-plutus-script-cost FILE ) diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_governance_action_create-protocol-parameters-update.cli index ecfdcaf21d..0eec29f1ae 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_governance_action_create-protocol-parameters-update.cli @@ -2,12 +2,12 @@ Usage: cardano-cli allegra governance action create-protocol-parameters-update - (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -34,17 +34,17 @@ Available options: --min-fee-linear LOVELACE The linear factor per byte for the minimum fee calculation. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. - --max-block-header-size NATURAL + --max-tx-size WORD32 Maximum transaction size. + --max-block-header-size WORD16 Maximum block header size. --key-reg-deposit-amt NATURAL Key registration deposit amount. --pool-reg-deposit NATURAL The amount of a pool registration deposit. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_governance_action_create-protocol-parameters-update.cli index 5f2a034faa..2aae6ab30e 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_governance_action_create-protocol-parameters-update.cli @@ -2,12 +2,12 @@ Usage: cardano-cli alonzo governance action create-protocol-parameters-update -- (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -41,17 +41,17 @@ Available options: --min-fee-linear LOVELACE The linear factor per byte for the minimum fee calculation. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. - --max-block-header-size NATURAL + --max-tx-size WORD32 Maximum transaction size. + --max-block-header-size WORD16 Maximum block header size. --key-reg-deposit-amt NATURAL Key registration deposit amount. --pool-reg-deposit NATURAL The amount of a pool registration deposit. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_governance_action_create-protocol-parameters-update.cli index 8cb6783991..e1e2ef7a3f 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_governance_action_create-protocol-parameters-update.cli @@ -2,12 +2,12 @@ Usage: cardano-cli babbage governance action create-protocol-parameters-update - (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -38,17 +38,17 @@ Available options: --min-fee-linear LOVELACE The linear factor per byte for the minimum fee calculation. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. - --max-block-header-size NATURAL + --max-tx-size WORD32 Maximum transaction size. + --max-block-header-size WORD16 Maximum block header size. --key-reg-deposit-amt NATURAL Key registration deposit amount. --pool-reg-deposit NATURAL The amount of a pool registration deposit. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli index 3cf5cd0522..1f659007a7 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli @@ -11,14 +11,15 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update --anchor-data-hash HASH [--prev-governance-action-tx-id TXID --prev-governance-action-index WORD32] + [--constitution-script-hash HASH] [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -35,7 +36,8 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update [--pool-voting-threshold-motion-no-confidence RATIONAL --pool-voting-threshold-committee-normal RATIONAL --pool-voting-threshold-committee-no-confidence RATIONAL - --pool-voting-threshold-hard-fork-initiation RATIONAL] + --pool-voting-threshold-hard-fork-initiation RATIONAL + --pool-voting-threshold-pp-security-group RATIONAL] [--drep-voting-threshold-motion-no-confidence RATIONAL --drep-voting-threshold-committee-normal RATIONAL --drep-voting-threshold-committee-no-confidence RATIONAL @@ -47,11 +49,11 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update --drep-voting-threshold-pp-governance-group RATIONAL --drep-voting-threshold-treasury-withdrawal RATIONAL] [--min-committee-size INT] - [--committee-term-length INT] - [--governance-action-lifetime NATURAL] + [--committee-term-length WORD32] + [--governance-action-lifetime WORD32] [--new-governance-action-deposit NATURAL] [--drep-deposit LOVELACE] - [--drep-activity NATURAL] + [--drep-activity WORD32] [--cost-model-file FILE] --out-file FILE @@ -75,22 +77,25 @@ Available options: Txid of the previous governance action. --prev-governance-action-index WORD32 Action index of the previous governance action. + --constitution-script-hash HASH + Constitution script hash (hex-encoded). Obtain it + with "cardano-cli conway governance hash script ...". --min-fee-constant LOVELACE The constant factor for the minimum fee calculation. --min-fee-linear LOVELACE The linear factor per byte for the minimum fee calculation. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. - --max-block-header-size NATURAL + --max-tx-size WORD32 Maximum transaction size. + --max-block-header-size WORD16 Maximum block header size. --key-reg-deposit-amt NATURAL Key registration deposit amount. --pool-reg-deposit NATURAL The amount of a pool registration deposit. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL @@ -140,6 +145,9 @@ Available options: --pool-voting-threshold-hard-fork-initiation RATIONAL Acceptance threshold for stake pool votes on hard fork initiations. + --pool-voting-threshold-pp-security-group RATIONAL + Acceptance threshold for stake pool votes on protocol + parameters for parameters in the 'security' group. --drep-voting-threshold-motion-no-confidence RATIONAL Acceptance threshold for DRep votes on motions of no confidence. @@ -172,16 +180,16 @@ Available options: Acceptance threshold for DRep votes on treasury withdrawals. --min-committee-size INT Minimal size of the constitutional committee. - --committee-term-length INT + --committee-term-length WORD32 Maximal term length for members of the constitutional committee, in epochs. - --governance-action-lifetime NATURAL + --governance-action-lifetime WORD32 Maximal lifetime of governance actions, in epochs. --new-governance-action-deposit NATURAL Proposed new value of the deposit required to submit a governance action. --drep-deposit LOVELACE DRep deposit amount. - --drep-activity NATURAL DRep activity period, in epochs. + --drep-activity WORD32 DRep activity period, in epochs. --cost-model-file FILE Filepath of the JSON formatted cost model --out-file FILE The output file. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli index 04460a20aa..250cf51d87 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli @@ -15,6 +15,7 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal | --funds-receiving-stake-key-hash HASH ) --transfer LOVELACE] + [--constitution-script-hash HASH] --out-file FILE Create a treasury withdrawal. @@ -40,5 +41,8 @@ Available options: --funds-receiving-stake-key-hash HASH Stake verification key hash (hex-encoded). --transfer LOVELACE The amount to transfer. + --constitution-script-hash HASH + Constitution script hash (hex-encoded). Obtain it + with "cardano-cli conway governance hash script ...". --out-file FILE Output filepath of the treasury withdrawal. -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 c562a246bc..b52d9513eb 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 @@ -120,8 +120,22 @@ Usage: cardano-cli conway transaction build-raw | --metadata-cbor-file FILE ] [--protocol-params-file FILE] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ + ( --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ) + --vote-execution-units (INT, INT)]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ + ( --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ) + --proposal-execution-units (INT, INT)]]] --out-file FILE Build a transaction (low-level, inconvenient) @@ -396,6 +410,33 @@ Available options: --protocol-params-file FILE Filepath of the JSON-encoded protocol parameters file --vote-file FILE Filepath of the vote. + --vote-script-file FILE The file containing the script to witness a vote + --vote-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. + --vote-execution-units (INT, INT) + The time and space units needed by the script. --proposal-file FILE Filepath of the proposal. + --proposal-script-file FILE + The file containing the script to witness a proposal + --proposal-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. + --proposal-execution-units (INT, INT) + The time and space units needed by the script. --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.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_build.cli index 34da230d4c..609156fd97 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_build.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction_build.cli @@ -114,8 +114,18 @@ Usage: cardano-cli conway transaction build --socket-path SOCKET_PATH [ --metadata-json-file FILE | --metadata-cbor-file FILE ] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ]]] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -389,7 +399,30 @@ Available options: --metadata-cbor-file FILE Filepath of the metadata, in raw CBOR format. --vote-file FILE Filepath of the vote. + --vote-script-file FILE The file containing the script to witness a vote + --vote-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. --proposal-file FILE Filepath of the proposal. + --proposal-script-file FILE + The file containing the script to witness a proposal + --proposal-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. --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/governance_create-update-proposal.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_create-update-proposal.cli index 7f06d3c86a..f1a4bfc3db 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_create-update-proposal.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/governance_create-update-proposal.cli @@ -7,16 +7,16 @@ Usage: cardano-cli governance create-update-proposal --out-file FILE [ --extra-entropy HEX | --reset-extra-entropy ] - [--max-block-header-size NATURAL] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] + [--max-block-header-size WORD16] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] [--min-utxo-value NATURAL] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] [--min-pool-cost NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--monetary-expansion RATIONAL] @@ -50,11 +50,11 @@ Available options: Decentralization parameter. --extra-entropy HEX Praos extra entropy seed, as a hex byte string. --reset-extra-entropy Reset the Praos extra entropy to none. - --max-block-header-size NATURAL + --max-block-header-size WORD16 Maximum block header size. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. + --max-tx-size WORD32 Maximum transaction size. --min-fee-constant LOVELACE The constant factor for the minimum fee calculation. --min-fee-linear LOVELACE @@ -67,8 +67,8 @@ Available options: --pool-reg-deposit NATURAL The amount of a pool registration deposit. --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_governance_action_create-protocol-parameters-update.cli index 1adeb6e4a6..3d5c498788 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_governance_action_create-protocol-parameters-update.cli @@ -2,12 +2,12 @@ Usage: cardano-cli latest governance action create-protocol-parameters-update -- (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -38,17 +38,17 @@ Available options: --min-fee-linear LOVELACE The linear factor per byte for the minimum fee calculation. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. - --max-block-header-size NATURAL + --max-tx-size WORD32 Maximum transaction size. + --max-block-header-size WORD16 Maximum block header size. --key-reg-deposit-amt NATURAL Key registration deposit amount. --pool-reg-deposit NATURAL The amount of a pool registration deposit. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_create-update-proposal.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_create-update-proposal.cli index 07ac6568d5..0b63e919fb 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_create-update-proposal.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/legacy_governance_create-update-proposal.cli @@ -7,16 +7,16 @@ Usage: cardano-cli legacy governance create-update-proposal --out-file FILE [ --extra-entropy HEX | --reset-extra-entropy ] - [--max-block-header-size NATURAL] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] + [--max-block-header-size WORD16] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] [--min-utxo-value NATURAL] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] [--min-pool-cost NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--monetary-expansion RATIONAL] @@ -50,11 +50,11 @@ Available options: Decentralization parameter. --extra-entropy HEX Praos extra entropy seed, as a hex byte string. --reset-extra-entropy Reset the Praos extra entropy to none. - --max-block-header-size NATURAL + --max-block-header-size WORD16 Maximum block header size. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. + --max-tx-size WORD32 Maximum transaction size. --min-fee-constant LOVELACE The constant factor for the minimum fee calculation. --min-fee-linear LOVELACE @@ -67,8 +67,8 @@ Available options: --pool-reg-deposit NATURAL The amount of a pool registration deposit. --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL 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 39657ab744..b79864ff38 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 @@ -121,8 +121,18 @@ Usage: cardano-cli legacy transaction build --socket-path SOCKET_PATH | --metadata-cbor-file FILE ] [--update-proposal-file FILE] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ]]] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -403,7 +413,30 @@ Available options: --update-proposal-file FILE Filepath of the update proposal. --vote-file FILE Filepath of the vote. + --vote-script-file FILE The file containing the script to witness a vote + --vote-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. --proposal-file FILE Filepath of the proposal. + --proposal-script-file FILE + The file containing the script to witness a proposal + --proposal-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. --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/mary_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_governance_action_create-protocol-parameters-update.cli index bc6e9ef3ef..f82045ecd8 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_governance_action_create-protocol-parameters-update.cli @@ -2,12 +2,12 @@ Usage: cardano-cli mary governance action create-protocol-parameters-update --ep (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -34,17 +34,17 @@ Available options: --min-fee-linear LOVELACE The linear factor per byte for the minimum fee calculation. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. - --max-block-header-size NATURAL + --max-tx-size WORD32 Maximum transaction size. + --max-block-header-size WORD16 Maximum block header size. --key-reg-deposit-amt NATURAL Key registration deposit amount. --pool-reg-deposit NATURAL The amount of a pool registration deposit. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_governance_action_create-protocol-parameters-update.cli index a52ae2be3d..2b776a00ec 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_governance_action_create-protocol-parameters-update.cli @@ -2,12 +2,12 @@ Usage: cardano-cli shelley governance action create-protocol-parameters-update - (--genesis-verification-key-file FILE) [--min-fee-constant LOVELACE] [--min-fee-linear LOVELACE] - [--max-block-body-size NATURAL] - [--max-tx-size NATURAL] - [--max-block-header-size NATURAL] + [--max-block-body-size WORD32] + [--max-tx-size WORD32] + [--max-block-header-size WORD16] [--key-reg-deposit-amt NATURAL] [--pool-reg-deposit NATURAL] - [--pool-retirement-epoch-boundary EPOCH_BOUNDARY] + [--pool-retirement-epoch-interval WORD32] [--number-of-pools NATURAL] [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] @@ -34,17 +34,17 @@ Available options: --min-fee-linear LOVELACE The linear factor per byte for the minimum fee calculation. - --max-block-body-size NATURAL + --max-block-body-size WORD32 Maximal block body size. - --max-tx-size NATURAL Maximum transaction size. - --max-block-header-size NATURAL + --max-tx-size WORD32 Maximum transaction size. + --max-block-header-size WORD16 Maximum block header size. --key-reg-deposit-amt NATURAL Key registration deposit amount. --pool-reg-deposit NATURAL The amount of a pool registration deposit. - --pool-retirement-epoch-boundary EPOCH_BOUNDARY - Epoch bound on pool retirement. + --pool-retirement-epoch-interval WORD32 + Epoch interval of pool retirement. --number-of-pools NATURAL Desired number of pools. --pool-influence RATIONAL 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 d398799f9c..955e684e29 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 @@ -115,8 +115,18 @@ Usage: cardano-cli transaction build --socket-path SOCKET_PATH | --metadata-cbor-file FILE ] [--update-proposal-file FILE] - [--vote-file FILE] - [--proposal-file FILE] + [--vote-file FILE + [--vote-script-file FILE + [ --vote-redeemer-cbor-file CBOR FILE + | --vote-redeemer-file JSON FILE + | --vote-redeemer-value JSON VALUE + ]]] + [--proposal-file FILE + [--proposal-script-file FILE + [ --proposal-redeemer-cbor-file CBOR FILE + | --proposal-redeemer-file JSON FILE + | --proposal-redeemer-value JSON VALUE + ]]] ( --out-file FILE | --calculate-plutus-script-cost FILE ) @@ -397,7 +407,30 @@ Available options: --update-proposal-file FILE Filepath of the update proposal. --vote-file FILE Filepath of the vote. + --vote-script-file FILE The file containing the script to witness a vote + --vote-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --vote-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. --proposal-file FILE Filepath of the proposal. + --proposal-script-file FILE + The file containing the script to witness a proposal + --proposal-redeemer-cbor-file CBOR FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-file JSON FILE + The script redeemer, in the given JSON file. The file + must follow the special JSON schema for script data. + --proposal-redeemer-value JSON VALUE + The script redeemer, in JSON syntax. There is no + schema: (almost) any JSON value is supported, + including top-level strings and numbers. --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/shelley/stake-address/build-raw-out.json b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/stake-address/build-raw-out.json index 6c1ac2504a..ef1a09041b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/stake-address/build-raw-out.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/stake-address/build-raw-out.json @@ -1,5 +1,5 @@ { "type": "Unwitnessed Tx ConwayEra", "description": "Ledger Cddl Format", - "cborHex": "84a40081825820bdfa7d91a29ffe071c028c0143c5d278c0a7ddb829c1e95f54a1676915fd82c2000180020104d901028183078200581c81b4245f84593f63c0ff2296930254f77a0690fa9de5f969cac27cb01a001e8480a0f5f6" + "cborHex": "84a400d9010281825820bdfa7d91a29ffe071c028c0143c5d278c0a7ddb829c1e95f54a1676915fd82c2000180020104d901028183078200581c81b4245f84593f63c0ff2296930254f77a0690fa9de5f969cac27cb01a001e8480a0f5f6" } diff --git a/cardano-cli/test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json b/cardano-cli/test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json index 59ed2c5f43..757ece99e8 100644 --- a/cardano-cli/test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json +++ b/cardano-cli/test/cardano-cli-golden/files/input/conway/genesis.conway.spec.json @@ -1,21 +1,22 @@ { "poolVotingThresholds": { - "pvtCommitteeNormal": 0, - "pvtCommitteeNoConfidence": 0, - "pvtHardForkInitiation": 0, - "pvtMotionNoConfidence": 0 + "committeeNormal": 0, + "committeeNoConfidence": 0, + "hardForkInitiation": 0, + "motionNoConfidence": 0, + "ppSecurityGroup": 0 }, "dRepVotingThresholds": { - "dvtMotionNoConfidence": 0, - "dvtCommitteeNormal": 0, - "dvtCommitteeNoConfidence": 0, - "dvtUpdateToConstitution": 0, - "dvtHardForkInitiation": 0, - "dvtPPNetworkGroup": 0, - "dvtPPEconomicGroup": 0, - "dvtPPTechnicalGroup": 0, - "dvtPPGovGroup": 0, - "dvtTreasuryWithdrawal": 0 + "motionNoConfidence": 0, + "committeeNormal": 0, + "committeeNoConfidence": 0, + "updateToConstitution": 0, + "hardForkInitiation": 0, + "ppNetworkGroup": 0, + "ppEconomicGroup": 0, + "ppTechnicalGroup": 0, + "ppGovGroup": 0, + "treasuryWithdrawal": 0 }, "committeeMinSize": 0, "committeeMaxTermLength": 0, diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs deleted file mode 100644 index 7bbbaf770f..0000000000 --- a/cardano-cli/test/cardano-cli-test/Test/Cli/CliIntermediateFormat.hs +++ /dev/null @@ -1,45 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -module Test.Cli.CliIntermediateFormat - ( hprop_backwardsCompatibleCliFormat - ) where - -import Control.Monad (void) - -import Test.Cardano.CLI.Util - -import Hedgehog (Property) -import qualified Hedgehog.Extras.Test.Base as H -import qualified Hedgehog.Extras.Test.File as H - -{- HLINT ignore "Use camelCase" -} - --- | We test to make sure that we can deserialize a tx body in the intermediate format -hprop_backwardsCompatibleCliFormat :: Property -hprop_backwardsCompatibleCliFormat = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do - txBodyFile <- noteInputFile "test/cardano-cli-test/files/input/babbage/deprecated-cli-format.body" - witness <- noteInputFile "test/cardano-cli-test/files/input/babbage/tx-key-witness" - initialUtxo1SigningKeyFile <- noteInputFile "test/cardano-cli-test/files/input/shelley/keys/payment_keys/signing_key" - signedTransactionFile <- noteTempFile tempDir "signed.tx" - - - void $ execCardanoCLI - [ "transaction","sign" - , "--mainnet" - , "--tx-body-file", txBodyFile - , "--signing-key-file", initialUtxo1SigningKeyFile - , "--tx-file", signedTransactionFile - ] - - H.assertFileOccurences 1 "Tx BabbageEra" signedTransactionFile - H.assertEndsWithSingleNewline signedTransactionFile - - void $ execCardanoCLI - [ "transaction","assemble" - , "--tx-body-file", txBodyFile - , "--witness-file", witness - , "--out-file", signedTransactionFile - ] - - H.assertFileOccurences 1 "Tx BabbageEra" signedTransactionFile - H.assertEndsWithSingleNewline signedTransactionFile From 17272936b05d82f1e32896051057dcc31d37c644 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 15:30:23 -0600 Subject: [PATCH 06/10] Update protocol parameters parsers: - pMaxBodySize :: Parser Word32 - pMaxBlockHeaderSize :: Parser Word32 - pCommitteeTermLength :: Parser EpochInterval Add new parser for the voting threshold of the protocol parameters security group --- cardano-cli/cardano-cli.cabal | 3 +- .../Cardano/CLI/EraBased/Options/Common.hs | 54 ++++++++++++------- .../EraBased/Options/Governance/Actions.hs | 2 +- .../Cardano/CLI/EraBased/Run/Governance.hs | 2 +- .../CLI/EraBased/Run/Governance/Actions.hs | 23 +++++--- .../CLI/EraBased/Run/Governance/Vote.hs | 8 +-- cardano-cli/src/Cardano/CLI/Parser.hs | 7 +-- cardano-cli/src/Cardano/CLI/Types/Common.hs | 6 ++- 8 files changed, 68 insertions(+), 37 deletions(-) diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index ebdf3fc510..0d961eaf86 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -203,7 +203,7 @@ library , cardano-crypto-wrapper ^>= 1.5.1 , cardano-data >= 1.1 , cardano-git-rev - , cardano-ledger-alonzo >= 1.5.0.0 + , cardano-ledger-alonzo >= 1.6.0.0 , cardano-ledger-binary >= 1.2 , cardano-ledger-byron >= 1.0.0.2 , cardano-ledger-conway >= 1.10 @@ -306,7 +306,6 @@ test-suite cardano-cli-test build-tool-depends: tasty-discover:tasty-discover other-modules: Test.Cli.AddCostModels - Test.Cli.CliIntermediateFormat Test.Cli.CreateTestnetData Test.Cli.FilePermissions Test.Cli.Governance.Hash diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 56eff649fc..eb5d4dd708 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -887,13 +887,14 @@ pConstitutionHash = ] pUrl :: String -> String -> Parser Ledger.Url -pUrl l h = fromMaybe (error "Url longer than 64 bytes") - . Ledger.textToUrl <$> - Opt.strOption (mconcat - [ Opt.long l - , Opt.metavar "TEXT" - , Opt.help h - ]) +pUrl l h = + let toUrl urlText = fromMaybe (error "Url longer than 64 bytes") + $ Ledger.textToUrl (Text.length urlText) urlText + in fmap toUrl . Opt.strOption + $ mconcat [ Opt.long l + , Opt.metavar "TEXT" + , Opt.help h + ] pGovActionDeposit :: Parser Lovelace pGovActionDeposit = @@ -2621,27 +2622,27 @@ pMinPoolCost = , Opt.help "The minimum allowed cost parameter for stake pools." ] -pMaxBodySize :: Parser Natural +pMaxBodySize :: Parser Word32 pMaxBodySize = Opt.option Opt.auto $ mconcat [ Opt.long "max-block-body-size" - , Opt.metavar "NATURAL" + , Opt.metavar "WORD32" , Opt.help "Maximal block body size." ] -pMaxTransactionSize :: Parser Natural +pMaxTransactionSize :: Parser Word32 pMaxTransactionSize = Opt.option Opt.auto $ mconcat [ Opt.long "max-tx-size" - , Opt.metavar "NATURAL" + , Opt.metavar "WORD32" , Opt.help "Maximum transaction size." ] -pMaxBlockHeaderSize :: Parser Natural +pMaxBlockHeaderSize :: Parser Word16 pMaxBlockHeaderSize = Opt.option Opt.auto $ mconcat [ Opt.long "max-block-header-size" - , Opt.metavar "NATURAL" + , Opt.metavar "WORD16" , Opt.help "Maximum block header size." ] @@ -2674,7 +2675,7 @@ pEpochBoundRetirement = fmap L.EpochInterval $ asum [ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat [ Opt.long "pool-retirement-epoch-interval" - , Opt.metavar "EPOCH_INTERVAL" + , Opt.metavar "WORD32" , Opt.help "Epoch interval of pool retirement." ] , Opt.option (bounded "EPOCH_BOUNDARY") $ mconcat @@ -2864,6 +2865,7 @@ pPoolVotingThresholds = <*> pCommitteeNormal <*> pCommitteeNoConfidence <*> pHardForkInitiation + <*> pPPSecurityGroup where pMotionNoConfidence = Opt.option (toUnitIntervalOrErr <$> readRationalUnitInterval) $ mconcat @@ -2889,6 +2891,12 @@ pPoolVotingThresholds = , Opt.metavar "RATIONAL" , Opt.help "Acceptance threshold for stake pool votes on hard fork initiations." ] + pPPSecurityGroup = + Opt.option (toUnitIntervalOrErr <$> readRationalUnitInterval) $ mconcat + [ Opt.long "pool-voting-threshold-pp-security-group" + , Opt.metavar "RATIONAL" + , Opt.help "Acceptance threshold for stake pool votes on protocol parameters for parameters in the 'security' group." + ] pDRepVotingThresholds :: Parser Ledger.DRepVotingThresholds pDRepVotingThresholds = @@ -2973,11 +2981,11 @@ pMinCommitteeSize = , Opt.help "Minimal size of the constitutional committee." ] -pCommitteeTermLength :: Parser EpochNo +pCommitteeTermLength :: Parser L.EpochInterval pCommitteeTermLength = - fmap EpochNo $ Opt.option Opt.auto $ mconcat + fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat [ Opt.long "committee-term-length" - , Opt.metavar "INT" + , Opt.metavar "WORD32" , Opt.help "Maximal term length for members of the constitutional committee, in epochs." ] @@ -2985,7 +2993,7 @@ pGovActionLifetime :: Parser L.EpochInterval pGovActionLifetime = fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat [ Opt.long "governance-action-lifetime" - , Opt.metavar "NATURAL" + , Opt.metavar "WORD32" , Opt.help "Maximal lifetime of governance actions, in epochs." ] @@ -3001,7 +3009,7 @@ pDRepActivity :: Parser L.EpochInterval pDRepActivity = fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat [ Opt.long "drep-activity" - , Opt.metavar "NATURAL" + , Opt.metavar "WORD32" , Opt.help "DRep activity period, in epochs." ] @@ -3107,6 +3115,14 @@ pDRepScriptHash = , Opt.help "DRep script hash (hex-encoded). Obtain it with \"cardano-cli conway governance hash script ...\"." ] +pConstitutionScriptHash :: Parser ScriptHash +pConstitutionScriptHash = + Opt.option scriptHashReader $ mconcat + [ Opt.long "constitution-script-hash" + , Opt.metavar "HASH" + , Opt.help "Constitution script hash (hex-encoded). Obtain it with \"cardano-cli conway governance hash script ...\"." + ] + pDRepVerificationKeyOrHashOrFile :: Parser (VerificationKeyOrHashOrFile DRepKey) pDRepVerificationKeyOrHashOrFile = diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index db5f755a74..53e056a97b 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -295,7 +295,7 @@ pIntroducedInConwayPParams = <$> convertToLedger id (optional pPoolVotingThresholds) <*> convertToLedger id (optional pDRepVotingThresholds) <*> convertToLedger id (optional pMinCommitteeSize) - <*> convertToLedger id (optional (fromIntegral . unEpochNo <$> pCommitteeTermLength)) + <*> convertToLedger id (optional pCommitteeTermLength) <*> convertToLedger id (optional pGovActionLifetime) <*> convertToLedger toShelleyLovelace (optional pNewGovActionDeposit) <*> convertToLedger toShelleyLovelace (optional pDRepDeposit) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs index a22e50e416..7951f863a7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs @@ -29,7 +29,7 @@ import Cardano.CLI.EraBased.Run.Governance.Poll import Cardano.CLI.EraBased.Run.Governance.Vote import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.GovernanceCmdError -import qualified Cardano.Ledger.Shelley.TxBody as Shelley +import qualified Cardano.Ledger.Shelley.API as Shelley import Control.Monad import Control.Monad.Trans.Except (ExceptT) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index 24a3332b89..0670f9eedc 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -67,7 +67,8 @@ runGovernanceActionViewCmd , Cmd.mOutFile , Cmd.eon } = do - proposal <- firstExceptT GovernanceActionsCmdReadTextEnvelopeFileError . newExceptT $ readProposal eon actionFile + proposal <- fmap fst . firstExceptT GovernanceActionsCmdProposalError . newExceptT + $ readProposal eon (actionFile, Nothing) firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ friendlyProposal (case outFormat of @@ -129,7 +130,13 @@ runGovernanceActionCreateNoConfidenceCmd } let sbe = conwayEraOnwardsToShelleyBasedEra eon - previousGovernanceAction = MotionOfNoConfidence . Ledger.SJust $ createPreviousGovernanceActionId governanceActionId governanceActionIndex + previousGovernanceAction = MotionOfNoConfidence + $ Ledger.SJust + $ shelleyBasedEraConstraints sbe + $ createPreviousGovernanceActionId + governanceActionId + governanceActionIndex + proposalProcedure = createProposalProcedure sbe networkId deposit returnKeyHash previousGovernanceAction proposalAnchor firstExceptT GovernanceActionsCmdWriteFileError . newExceptT @@ -160,7 +167,9 @@ runGovernanceActionCreateConstitutionCmd , Ledger.anchorDataHash = proposalHash } - let prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId + let prevGovActId = Ledger.maybeToStrictMaybe + $ shelleyBasedEraConstraints sbe + $ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId constitutionAnchor = Ledger.Anchor { Ledger.anchorUrl = unConstitutionUrl constitutionUrl , Ledger.anchorDataHash = constitutionHash @@ -193,8 +202,9 @@ runGovernanceActionCreateNewCommitteeCmd , Cmd.outFile } = do let sbe = conwayEraOnwardsToShelleyBasedEra eon - govActIdentifier = Ledger.maybeToStrictMaybe $ - uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId + govActIdentifier = Ledger.maybeToStrictMaybe + $ shelleyBasedEraConstraints sbe + $ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId quorumRational = toRational requiredQuorum let proposalAnchor = Ledger.Anchor @@ -259,7 +269,7 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do anyEra = AnyShelleyBasedEra $ conwayEraOnwardsToShelleyBasedEra conwayOnwards UpdateProtocolParametersConwayOnwards _cOnwards network deposit returnAddr proposalUrl - proposalHash mPrevGovActId + proposalHash mPrevGovActId mConstitutionalScriptHash <- hoistMaybe (GovernanceActionsValueUpdateProtocolParametersNotFound anyEra) $ uppConwayOnwards eraBasedPParams' @@ -275,6 +285,7 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do , Ledger.anchorDataHash = proposalHash } govAct = UpdatePParams prevGovActId updateProtocolParams + (toShelleyScriptHash <$> Ledger.maybeToStrictMaybe mConstitutionalScriptHash) let proposalProcedure = createProposalProcedure sbe network deposit returnKeyHash govAct proposalAnchor diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index 2e38f5428f..c787472e4a 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -15,7 +15,7 @@ import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Vote as Cmd -import Cardano.CLI.Read (readVotingProceduresFile) +import Cardano.CLI.Read (readSingleVote) import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.GovernanceVoteCmdError @@ -92,8 +92,8 @@ runGovernanceVoteViewCmd let sbe = conwayEraOnwardsToShelleyBasedEra eon shelleyBasedEraConstraints sbe $ do - voteProcedures <- firstExceptT GovernanceVoteCmdReadVoteFileError . newExceptT $ - readVotingProceduresFile eon voteFile + voteProcedures <- fmap fst . firstExceptT GovernanceVoteCmdReadVoteFileError . newExceptT $ + readSingleVote eon (voteFile, Nothing) firstExceptT GovernanceVoteCmdWriteError . newExceptT . (case outFormat of @@ -104,4 +104,4 @@ runGovernanceVoteViewCmd writeLazyByteStringOutput mOutFile . encodePretty' (defConfig {confCompare = compare})) . unVotingProcedures $ - voteProcedures \ No newline at end of file + voteProcedures diff --git a/cardano-cli/src/Cardano/CLI/Parser.hs b/cardano-cli/src/Cardano/CLI/Parser.hs index 88753d4773..e82875f7d5 100644 --- a/cardano-cli/src/Cardano/CLI/Parser.hs +++ b/cardano-cli/src/Cardano/CLI/Parser.hs @@ -114,6 +114,7 @@ readerFromAttoParser p = eDNSName :: String -> Either String ByteString eDNSName str = -- We're using 'Shelley.textToDns' to validate the string. - case Shelley.textToDns (Text.pack str) of - Nothing -> Left $ "DNS name is more than 64 bytes: " <> str - Just dnsName -> Right . Text.encodeUtf8 . Shelley.dnsToText $ dnsName + let dnsNameText = Text.pack str + in case Shelley.textToDns (Text.length dnsNameText) dnsNameText of + Nothing -> Left $ "DNS name is more than 64 bytes: " <> str + Just dnsName -> Right . Text.encodeUtf8 . Shelley.dnsToText $ dnsName diff --git a/cardano-cli/src/Cardano/CLI/Types/Common.hs b/cardano-cli/src/Cardano/CLI/Types/Common.hs index dc836be250..3be47304fa 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Common.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Common.hs @@ -88,7 +88,7 @@ import qualified Cardano.Chain.Slotting as Byron import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.Crypto as Crypto import qualified Cardano.Ledger.SafeHash as L -import Cardano.Ledger.Shelley.TxBody (PoolParams (..)) +import Cardano.Ledger.Shelley.API (PoolParams (..)) import Data.Aeson (FromJSON (..), ToJSON (..), object, pairs, (.=)) import qualified Data.Aeson as Aeson @@ -340,6 +340,10 @@ type ScriptRedeemerOrFile = ScriptDataOrFile -- -- It is era-independent, but witness context-dependent. -- +-- TODO: Potentially update to WitnessFiles so we can get +-- rid of Maybe (ScriptWitnessFiles). This will be clearer +-- in conveying that we either expect a script witness +-- or a key witness is provided at the signing stage. data ScriptWitnessFiles witctx where SimpleScriptWitnessFile :: ScriptFile -> ScriptWitnessFiles witctx From bba84d8cedf9b55cc55de35fc943b17c53331b0b Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 15:34:10 -0600 Subject: [PATCH 07/10] Update Maybe ChainPoint to Target ChainPoint --- .../src/Cardano/CLI/EraBased/Run/Query.hs | 79 ++++++++++++------- .../Cardano/CLI/EraBased/Run/Transaction.hs | 7 +- 2 files changed, 56 insertions(+), 30 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 7a0e37fa64..6d13ed0e15 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -74,6 +74,7 @@ import qualified Ouroboros.Consensus.Protocol.Abstract as Consensus import qualified Ouroboros.Consensus.Protocol.Praos.Common as Consensus import Ouroboros.Consensus.Protocol.TPraos (StandardCrypto) import Ouroboros.Network.Block (Serialised (..)) +import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus import Control.Monad (forM, forM_, join) import Control.Monad.IO.Class (MonadIO) @@ -147,7 +148,7 @@ runQueryConstitutionHashCmd } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath - result <- liftIO $ executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + result <- liftIO $ executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era @@ -249,7 +250,7 @@ runQueryTipCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath eLocalState <- ExceptT $ fmap sequence $ - executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) eraHistory <- lift queryEraHistory & onLeft (left . QueryCmdUnsupportedNtcVersion) mChainBlockNo <- lift queryChainBlockNo & onLeft (left . QueryCmdUnsupportedNtcVersion) & fmap Just @@ -333,7 +334,7 @@ runQueryUTxOCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -367,7 +368,7 @@ runQueryKesPeriodInfoCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -624,7 +625,7 @@ runQueryPoolStateCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -706,7 +707,7 @@ runQueryStakeSnapshotCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -742,7 +743,7 @@ runQueryLedgerStateCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -772,7 +773,7 @@ runQueryProtocolStateCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -783,7 +784,7 @@ runQueryProtocolStateCmd & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) - pure $ shelleyBasedEraConstraints sbe $ writeProtocolState mOutFile result + pure $ shelleyBasedEraConstraints sbe $ writeProtocolState sbe mOutFile result ) & onLeft (left . QueryCmdAcquireFailure) & onLeft left @@ -805,7 +806,7 @@ runQueryStakeAddressInfoCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -964,21 +965,45 @@ writePoolState serialisedCurrentEpochState = do liftIO . LBS.putStrLn $ encodePretty poolStates -writeProtocolState :: - ( FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) - , ToJSON (Consensus.ChainDepState (ConsensusProtocol era)) - ) - => Maybe (File () Out) +writeProtocolState + :: ShelleyBasedEra era + -> Maybe (File () Out) -> ProtocolState era -> ExceptT QueryCmdError IO () -writeProtocolState mOutFile ps@(ProtocolState pstate) = - case mOutFile of - Nothing -> case decodeProtocolState ps of - Left (bs, _) -> firstExceptT QueryCmdHelpersError $ pPrintCBOR bs - Right chainDepstate -> liftIO . LBS.putStrLn $ encodePretty chainDepstate - Just (File fpath) -> +writeProtocolState sbe mOutFile ps@(ProtocolState pstate) = + case sbe of + ShelleyBasedEraShelley -> + case mOutFile of + Nothing -> decodePState ps + Just (File fpath) -> writePState fpath pstate + ShelleyBasedEraAllegra -> + case mOutFile of + Nothing -> decodePState ps + Just (File fpath) -> writePState fpath pstate + ShelleyBasedEraMary -> + case mOutFile of + Nothing -> decodePState ps + Just (File fpath) -> writePState fpath pstate + ShelleyBasedEraAlonzo -> + case mOutFile of + Nothing -> decodePState ps + Just (File fpath) -> writePState fpath pstate + ShelleyBasedEraBabbage -> + case mOutFile of + Nothing -> decodePState ps + Just (File fpath) -> writePState fpath pstate + ShelleyBasedEraConway -> + case mOutFile of + Nothing -> decodePState ps + Just (File fpath) -> writePState fpath pstate + where + writePState fpath pstate' = handleIOExceptT (QueryCmdWriteFileError . FileIOError fpath) - . LBS.writeFile fpath $ unSerialised pstate + . LBS.writeFile fpath $ unSerialised pstate' + decodePState ps' = + case decodeProtocolState ps' of + Left (bs, _) -> firstExceptT QueryCmdHelpersError $ pPrintCBOR bs + Right chainDepstate -> liftIO . LBS.putStrLn $ encodePretty chainDepstate writeFilteredUTxOs :: Api.ShelleyBasedEra era -> Maybe (File () Out) @@ -1103,7 +1128,7 @@ runQueryStakePoolsCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT @QueryCmdError $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT @QueryCmdError $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era @@ -1143,7 +1168,7 @@ runQueryStakeDistributionCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -1221,7 +1246,7 @@ runQueryLeadershipScheduleCmd & onLeft (left . QueryCmdGenesisReadError) join $ lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) @@ -1480,7 +1505,7 @@ runQuery :: LocalNodeConnectInfo -> ExceptT QueryCmdError IO a runQuery localNodeConnInfo query = firstExceptT QueryCmdAcquireFailure - ( newExceptT $ executeLocalStateQueryExpr localNodeConnInfo Nothing query) + ( newExceptT $ executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip query) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdEraMismatch) @@ -1530,7 +1555,7 @@ utcTimeToSlotNo nodeSocketPath consensusModeParams networkId utcTime = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath lift - ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do + ( executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip $ runExceptT $ do systemStart <- lift querySystemStart & onLeft (left . QueryCmdUnsupportedNtcVersion) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index eee5055be1..e53a7b52f5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -49,6 +49,7 @@ import Cardano.CLI.Types.Errors.TxValidationError import Cardano.CLI.Types.Output (renderScriptCosts) import Cardano.CLI.Types.TxFeature import qualified Cardano.Ledger.Alonzo.Core as Ledger +import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx import Control.Monad (forM) @@ -215,12 +216,12 @@ runTransactionBuildCmd pparams <- pure mTxProtocolParams & onNothing (left TxCmdProtocolParametersNotPresentInTxBody) executionUnitPrices <- pure (getExecutionUnitPrices era pparams) & onNothing (left TxCmdPParamExecutionUnitsNotAvailable) - AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing queryCurrentEra) + AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip queryCurrentEra) & onLeft (left . TxCmdQueryConvenienceError . AcqFailure) & onLeft (left . TxCmdQueryConvenienceError . QceUnsupportedNtcVersion) (txEraUtxo, _, eraHistory, systemStart, _, _, _) <- - lift (executeLocalStateQueryExpr localNodeConnInfo Nothing (queryStateForBalancedTx nodeEra allTxInputs [])) + lift (executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip (queryStateForBalancedTx nodeEra allTxInputs [])) & onLeft (left . TxCmdQueryConvenienceError . AcqFailure) & onLeft (left . TxCmdQueryConvenienceError) @@ -538,7 +539,7 @@ runTxBuild , localNodeSocketPath = socketPath } - AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing queryCurrentEra) + AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Consensus.VolatileTip queryCurrentEra) & onLeft (left . TxCmdQueryConvenienceError . AcqFailure) & onLeft (left . TxCmdQueryConvenienceError . QceUnsupportedNtcVersion) From 082d5f6616fee894b4a4e14da58cfe2549f0017a Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 15:34:52 -0600 Subject: [PATCH 08/10] Remove prettyprinter imports --- cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs | 1 - .../src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs | 2 -- .../Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs | 1 - cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs | 5 ++++- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs index 6bf818c4a6..d59fd086fd 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs @@ -17,7 +17,6 @@ import Cardano.CLI.Types.Errors.StakePoolCmdError import Control.Exception (IOException) import Data.Text (Text) -import Prettyprinter data GenesisCmdError = GenesisCmdAesonDecodeError !FilePath !Text diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs index eaae47d401..614977a790 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs @@ -7,8 +7,6 @@ import Cardano.Api.Shelley import Ouroboros.Consensus.Cardano.Block (EraMismatch) -import Prettyprinter - data GovernanceQueryError = GovernanceQueryWriteFileError !(FileError ()) | GovernanceQueryAcqireFailureError !AcquiringFailure diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs index 44afcee177..959e95811b 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs @@ -12,7 +12,6 @@ import Cardano.Api.Pretty import Cardano.CLI.Types.Errors.NodeEraMismatchError import Ouroboros.Consensus.Cardano.Block (EraMismatch (..)) -import Prettyprinter ((<+>)) -- | An error that can occur while querying a node's local state. newtype QueryCmdLocalStateQueryError diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs index 1086b6b96c..395464e0df 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs @@ -43,6 +43,7 @@ data TxCmdError = TxCmdMetadataError MetadataError | TxCmdVoteError VoteError | TxCmdConstitutionError ConstitutionError + | TxCmdProposalError ProposalError | TxCmdScriptWitnessError ScriptWitnessError | TxCmdProtocolParamsError ProtocolParamsError | TxCmdScriptFileError (FileError ScriptDecodeError) @@ -99,9 +100,11 @@ renderTxCmdError = \case TxCmdProtocolParamsConverstionError err' -> "Error while converting protocol parameters: " <> prettyError err' TxCmdVoteError voteErr -> - pshow voteErr + prettyError voteErr TxCmdConstitutionError constErr -> pshow constErr + TxCmdProposalError propErr -> + pshow propErr TxCmdReadTextViewFileError fileErr -> prettyError fileErr TxCmdScriptFileError fileErr -> From d88efb144cd39e9a5bb453ce5dd77a3c91f61b13 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Thu, 1 Feb 2024 14:29:34 -0600 Subject: [PATCH 09/10] Bump cabal and nix flake --- cabal.project | 13 ++++++++++--- flake.lock | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cabal.project b/cabal.project index b63af04a41..60521bbe24 100644 --- a/cabal.project +++ b/cabal.project @@ -14,8 +14,8 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2024-01-23T08:19:39Z - , cardano-haskell-packages 2024-01-25T13:05:04Z - + , cardano-haskell-packages 2024-01-30T07:58:01Z + packages: cardano-cli @@ -24,7 +24,7 @@ package cardano-cli package cardano-api ghc-options: -Werror - + package cardano-api-gen ghc-options: -Werror @@ -44,3 +44,10 @@ write-ghc-environment-files: always -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-api.git + tag: 3388849f3e935576265dc2d3d2ee3427a383c264 + subdir: cardano-api + --sha256: sha256-7W500dNvyiQ9gkgXPEm6jEiJFq0vyGXgGm3zWwdmBqM= diff --git a/flake.lock b/flake.lock index 058eb0ba56..6e2cf87ec0 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1706189917, - "narHash": "sha256-X3OubU+ac8zRusECafdBSTv+AP4uRNZEnccd85FrukI=", + "lastModified": 1706612908, + "narHash": "sha256-rZytUcsrRO6EIOdDSuQw9vhNUFRk1GuG6w2vUxLv5H8=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "834f1277d402a8c4aeef912dc0d7e00aeb6753a7", + "rev": "44e3f3330cc807066818f739946ab08e868a4b30", "type": "github" }, "original": { From 26fb079f11f6c88eddbe6dafc2d1c04b5c1620dd Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Tue, 6 Feb 2024 16:49:57 +0100 Subject: [PATCH 10/10] Bump chap & hackage --- .github/workflows/haskell.yml | 2 +- cabal.project | 16 ++++------------ cardano-cli/cardano-cli.cabal | 2 +- flake.lock | 12 ++++++------ 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 5b51e70c59..e9bf9a8efc 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -24,7 +24,7 @@ jobs: env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2024-01-24-2" + CABAL_CACHE_VERSION: "2024-02-06-1" concurrency: group: > diff --git a/cabal.project b/cabal.project index 60521bbe24..ffa795c597 100644 --- a/cabal.project +++ b/cabal.project @@ -13,9 +13,9 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2024-01-23T08:19:39Z - , cardano-haskell-packages 2024-01-30T07:58:01Z - + , hackage.haskell.org 2024-02-06T15:14:59Z + , cardano-haskell-packages 2024-02-06T15:25:20Z + packages: cardano-cli @@ -24,7 +24,7 @@ package cardano-cli package cardano-api ghc-options: -Werror - + package cardano-api-gen ghc-options: -Werror @@ -43,11 +43,3 @@ write-ghc-environment-files: always -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. - - -source-repository-package - type: git - location: https://github.com/IntersectMBO/cardano-api.git - tag: 3388849f3e935576265dc2d3d2ee3427a383c264 - subdir: cardano-api - --sha256: sha256-7W500dNvyiQ9gkgXPEm6jEiJFq0vyGXgGm3zWwdmBqM= diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 0d961eaf86..50320620b9 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -196,7 +196,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.37.1.0 + , cardano-api ^>= 8.38.0.0 , cardano-binary , cardano-crypto , cardano-crypto-class ^>= 2.1.2 diff --git a/flake.lock b/flake.lock index 6e2cf87ec0..c89add0be7 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1706612908, - "narHash": "sha256-rZytUcsrRO6EIOdDSuQw9vhNUFRk1GuG6w2vUxLv5H8=", + "lastModified": 1707233847, + "narHash": "sha256-qKxufDdwSWx/5Qq2YnZysBqCMJ8n2xrhnyNvyCaMzg4=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "44e3f3330cc807066818f739946ab08e868a4b30", + "rev": "2ec70a5d10b1d7e1befa6a59814a727b7f879a40", "type": "github" }, "original": { @@ -210,11 +210,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1706055829, - "narHash": "sha256-4bIOyE4CSPij2j+bo/kLlnHojkfFqQMVpN3xnQ5reiA=", + "lastModified": 1707178947, + "narHash": "sha256-zK4s98xucxwefNtf7Ewc42lQkb5ZXNzFV4sOliif8Rg=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "c9889ce77afa9fd20d6845808c83da11efbe8e48", + "rev": "ef22972dd06ed3359945489b582849fdf680c583", "type": "github" }, "original": {