From 7cb4715e035496292f1d9cb2a7f73e5ff1ff0cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Mon, 6 Nov 2023 15:16:20 +0100 Subject: [PATCH 1/3] protocol-(major|minor)-version disappears in conway's create-protocol-parameters-update command --- .../EraBased/Options/Governance/Actions.hs | 11 +++++++- .../cardano-cli-golden/files/golden/help.cli | 26 +++++++++---------- ...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 | 9 ------- ...tion_create-protocol-parameters-update.cli | 18 ++++++------- ...tion_create-protocol-parameters-update.cli | 18 ++++++------- ...tion_create-protocol-parameters-update.cli | 10 +++---- 9 files changed, 72 insertions(+), 74 deletions(-) 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 4235eaa118..614c6035ad 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -239,7 +239,6 @@ pCommonProtocolParameters = <*> convertToLedger toNonNegativeIntervalOrErr (optional pPoolInfluence) <*> convertToLedger toUnitIntervalOrErr (optional pTreasuryExpansion) <*> convertToLedger toUnitIntervalOrErr (optional pMonetaryExpansion) - <*> convertToLedger mkProtocolVersionOrErr (optional pProtocolVersion) <*> convertToLedger toShelleyLovelace (optional pMinPoolCost) @@ -248,6 +247,11 @@ pDeprecatedAfterMaryPParams = DeprecatedAfterMaryPParams <$> convertToLedger toShelleyLovelace (optional pMinUTxOValue) +pDeprecatedAfterBabbagePParams :: Parser (DeprecatedAfterBabbagePParams ledgerera) +pDeprecatedAfterBabbagePParams = + DeprecatedAfterBabbagePParams + <$> convertToLedger mkProtocolVersionOrErr (optional pProtocolVersion) + pShelleyToAlonzoPParams :: Parser (ShelleyToAlonzoPParams ledgerera) pShelleyToAlonzoPParams = ShelleyToAlonzoPParams @@ -294,26 +298,31 @@ dpGovActionProtocolParametersUpdate = \case ShelleyEraBasedProtocolParametersUpdate <$> pCommonProtocolParameters <*> pDeprecatedAfterMaryPParams + <*> pDeprecatedAfterBabbagePParams <*> pShelleyToAlonzoPParams ShelleyBasedEraAllegra -> AllegraEraBasedProtocolParametersUpdate <$> pCommonProtocolParameters <*> pDeprecatedAfterMaryPParams <*> pShelleyToAlonzoPParams + <*> pDeprecatedAfterBabbagePParams ShelleyBasedEraMary -> MaryEraBasedProtocolParametersUpdate <$> pCommonProtocolParameters <*> pDeprecatedAfterMaryPParams <*> pShelleyToAlonzoPParams + <*> pDeprecatedAfterBabbagePParams ShelleyBasedEraAlonzo -> AlonzoEraBasedProtocolParametersUpdate <$> pCommonProtocolParameters <*> pShelleyToAlonzoPParams <*> pAlonzoOnwardsPParams + <*> pDeprecatedAfterBabbagePParams ShelleyBasedEraBabbage -> BabbageEraBasedProtocolParametersUpdate <$> pCommonProtocolParameters <*> pAlonzoOnwardsPParams + <*> pDeprecatedAfterBabbagePParams <*> pIntroducedInBabbagePParams ShelleyBasedEraConway -> ConwayEraBasedProtocolParametersUpdate 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 b2375e1074..1ec924bcb1 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -341,10 +341,10 @@ Usage: cardano-cli shelley governance action create-protocol-parameters-update - [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--min-utxo-value NATURAL] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] [ --extra-entropy HEX | --reset-extra-entropy ] @@ -1466,14 +1466,14 @@ Usage: cardano-cli allegra governance action create-protocol-parameters-update - [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--min-utxo-value NATURAL] [ --extra-entropy HEX | --reset-extra-entropy ] [--decentralization-parameter RATIONAL] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] --out-file FILE Create a protocol parameters update. @@ -2589,14 +2589,14 @@ Usage: cardano-cli mary governance action create-protocol-parameters-update --ep [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--min-utxo-value NATURAL] [ --extra-entropy HEX | --reset-extra-entropy ] [--decentralization-parameter RATIONAL] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] --out-file FILE Create a protocol parameters update. @@ -3695,8 +3695,6 @@ Usage: cardano-cli alonzo governance action create-protocol-parameters-update -- [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [ --extra-entropy HEX | --reset-extra-entropy @@ -3709,6 +3707,8 @@ Usage: cardano-cli alonzo governance action create-protocol-parameters-update -- [--max-value-size INT] [--collateral-percent INT] [--max-collateral-inputs INT] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] --out-file FILE Create a protocol parameters update. @@ -4828,8 +4828,6 @@ Usage: cardano-cli babbage governance action create-protocol-parameters-update - [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--price-execution-steps RATIONAL --price-execution-memory RATIONAL] @@ -4838,6 +4836,8 @@ Usage: cardano-cli babbage governance action create-protocol-parameters-update - [--max-value-size INT] [--collateral-percent INT] [--max-collateral-inputs INT] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] [--utxo-cost-per-byte LOVELACE] --out-file FILE @@ -6029,8 +6029,6 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--price-execution-steps RATIONAL --price-execution-memory RATIONAL] @@ -7461,8 +7459,6 @@ Usage: cardano-cli latest governance action create-protocol-parameters-update -- [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--price-execution-steps RATIONAL --price-execution-memory RATIONAL] @@ -7471,6 +7467,8 @@ Usage: cardano-cli latest governance action create-protocol-parameters-update -- [--max-value-size INT] [--collateral-percent INT] [--max-collateral-inputs INT] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] [--utxo-cost-per-byte LOVELACE] --out-file 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 4579b21872..ecfdcaf21d 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 @@ -12,14 +12,14 @@ Usage: cardano-cli allegra governance action create-protocol-parameters-update - [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--min-utxo-value NATURAL] [ --extra-entropy HEX | --reset-extra-entropy ] [--decentralization-parameter RATIONAL] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] --out-file FILE Create a protocol parameters update. @@ -53,13 +53,6 @@ Available options: Treasury expansion. --monetary-expansion RATIONAL Monetary expansion. - --protocol-major-version NATURAL - Major protocol version. An increase indicates a hard - fork. - --protocol-minor-version NATURAL - Minor protocol version. An increase indicates a soft - fork (old software canvalidate but not produce new - blocks). --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. --min-utxo-value NATURAL The minimum allowed UTxO value (Shelley to Mary eras). @@ -67,5 +60,12 @@ Available options: --reset-extra-entropy Reset the Praos extra entropy to none. --decentralization-parameter RATIONAL Decentralization parameter. + --protocol-major-version NATURAL + Major protocol version. An increase indicates a hard + fork. + --protocol-minor-version NATURAL + Minor protocol version. An increase indicates a soft + fork (old software canvalidate but not produce new + blocks). --out-file FILE The output file. -h,--help Show this help text 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 e74c08a62e..157cef1c2b 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 @@ -12,8 +12,6 @@ Usage: cardano-cli alonzo governance action create-protocol-parameters-update -- [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [ --extra-entropy HEX | --reset-extra-entropy @@ -26,6 +24,8 @@ Usage: cardano-cli alonzo governance action create-protocol-parameters-update -- [--max-value-size INT] [--collateral-percent INT] [--max-collateral-inputs INT] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] --out-file FILE Create a protocol parameters update. @@ -59,13 +59,6 @@ Available options: Treasury expansion. --monetary-expansion RATIONAL Monetary expansion. - --protocol-major-version NATURAL - Major protocol version. An increase indicates a hard - fork. - --protocol-minor-version NATURAL - Minor protocol version. An increase indicates a soft - fork (old software canvalidate but not produce new - blocks). --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. --extra-entropy HEX Praos extra entropy seed, as a hex byte string. --reset-extra-entropy Reset the Praos extra entropy to none. @@ -95,5 +88,12 @@ Available options: --max-collateral-inputs INT The maximum number of collateral inputs allowed in a transaction (from Alonzo era). + --protocol-major-version NATURAL + Major protocol version. An increase indicates a hard + fork. + --protocol-minor-version NATURAL + Minor protocol version. An increase indicates a soft + fork (old software canvalidate but not produce new + blocks). --out-file FILE The output file. -h,--help Show this help text 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 80dbc48fc9..3959d17348 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 @@ -12,8 +12,6 @@ Usage: cardano-cli babbage governance action create-protocol-parameters-update - [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--price-execution-steps RATIONAL --price-execution-memory RATIONAL] @@ -22,6 +20,8 @@ Usage: cardano-cli babbage governance action create-protocol-parameters-update - [--max-value-size INT] [--collateral-percent INT] [--max-collateral-inputs INT] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] [--utxo-cost-per-byte LOVELACE] --out-file FILE @@ -56,13 +56,6 @@ Available options: Treasury expansion. --monetary-expansion RATIONAL Monetary expansion. - --protocol-major-version NATURAL - Major protocol version. An increase indicates a hard - fork. - --protocol-minor-version NATURAL - Minor protocol version. An increase indicates a soft - fork (old software canvalidate but not produce new - blocks). --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. --price-execution-steps RATIONAL Step price of execution units for script languages @@ -88,6 +81,13 @@ Available options: --max-collateral-inputs INT The maximum number of collateral inputs allowed in a transaction (from Alonzo era). + --protocol-major-version NATURAL + Major protocol version. An increase indicates a hard + fork. + --protocol-minor-version NATURAL + Minor protocol version. An increase indicates a soft + fork (old software canvalidate but not produce new + blocks). --utxo-cost-per-byte LOVELACE Cost in lovelace per unit of UTxO storage (from Babbage era). 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 83b31c4446..cf3d3445f2 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 @@ -26,8 +26,6 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--price-execution-steps RATIONAL --price-execution-memory RATIONAL] @@ -107,13 +105,6 @@ Available options: Treasury expansion. --monetary-expansion RATIONAL Monetary expansion. - --protocol-major-version NATURAL - Major protocol version. An increase indicates a hard - fork. - --protocol-minor-version NATURAL - Minor protocol version. An increase indicates a soft - fork (old software canvalidate but not produce new - blocks). --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. --price-execution-steps RATIONAL Step price of execution units for script languages 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 79b3732baa..e604642e17 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 @@ -12,8 +12,6 @@ Usage: cardano-cli latest governance action create-protocol-parameters-update -- [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--price-execution-steps RATIONAL --price-execution-memory RATIONAL] @@ -22,6 +20,8 @@ Usage: cardano-cli latest governance action create-protocol-parameters-update -- [--max-value-size INT] [--collateral-percent INT] [--max-collateral-inputs INT] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] [--utxo-cost-per-byte LOVELACE] --out-file FILE @@ -56,13 +56,6 @@ Available options: Treasury expansion. --monetary-expansion RATIONAL Monetary expansion. - --protocol-major-version NATURAL - Major protocol version. An increase indicates a hard - fork. - --protocol-minor-version NATURAL - Minor protocol version. An increase indicates a soft - fork (old software canvalidate but not produce new - blocks). --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. --price-execution-steps RATIONAL Step price of execution units for script languages @@ -88,6 +81,13 @@ Available options: --max-collateral-inputs INT The maximum number of collateral inputs allowed in a transaction (from Alonzo era). + --protocol-major-version NATURAL + Major protocol version. An increase indicates a hard + fork. + --protocol-minor-version NATURAL + Minor protocol version. An increase indicates a soft + fork (old software canvalidate but not produce new + blocks). --utxo-cost-per-byte LOVELACE Cost in lovelace per unit of UTxO storage (from Babbage era). 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 54eb7d40e4..bc6e9ef3ef 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 @@ -12,14 +12,14 @@ Usage: cardano-cli mary governance action create-protocol-parameters-update --ep [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--min-utxo-value NATURAL] [ --extra-entropy HEX | --reset-extra-entropy ] [--decentralization-parameter RATIONAL] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] --out-file FILE Create a protocol parameters update. @@ -53,13 +53,6 @@ Available options: Treasury expansion. --monetary-expansion RATIONAL Monetary expansion. - --protocol-major-version NATURAL - Major protocol version. An increase indicates a hard - fork. - --protocol-minor-version NATURAL - Minor protocol version. An increase indicates a soft - fork (old software canvalidate but not produce new - blocks). --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. --min-utxo-value NATURAL The minimum allowed UTxO value (Shelley to Mary eras). @@ -67,5 +60,12 @@ Available options: --reset-extra-entropy Reset the Praos extra entropy to none. --decentralization-parameter RATIONAL Decentralization parameter. + --protocol-major-version NATURAL + Major protocol version. An increase indicates a hard + fork. + --protocol-minor-version NATURAL + Minor protocol version. An increase indicates a soft + fork (old software canvalidate but not produce new + blocks). --out-file FILE The output file. -h,--help Show this help text 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 b0ee7db6cc..a52ae2be3d 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 @@ -12,10 +12,10 @@ Usage: cardano-cli shelley governance action create-protocol-parameters-update - [--pool-influence RATIONAL] [--treasury-expansion RATIONAL] [--monetary-expansion RATIONAL] - [--protocol-major-version NATURAL - --protocol-minor-version NATURAL] [--min-pool-cost NATURAL] [--min-utxo-value NATURAL] + [--protocol-major-version NATURAL + --protocol-minor-version NATURAL] [ --extra-entropy HEX | --reset-extra-entropy ] @@ -53,6 +53,9 @@ Available options: Treasury expansion. --monetary-expansion RATIONAL Monetary expansion. + --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. + --min-utxo-value NATURAL The minimum allowed UTxO value (Shelley to Mary + eras). --protocol-major-version NATURAL Major protocol version. An increase indicates a hard fork. @@ -60,9 +63,6 @@ Available options: Minor protocol version. An increase indicates a soft fork (old software canvalidate but not produce new blocks). - --min-pool-cost NATURAL The minimum allowed cost parameter for stake pools. - --min-utxo-value NATURAL The minimum allowed UTxO value (Shelley to Mary - eras). --extra-entropy HEX Praos extra entropy seed, as a hex byte string. --reset-extra-entropy Reset the Praos extra entropy to none. --decentralization-parameter RATIONAL From 294cb74488fb73f3a4e47bd7a78210dca7f80745 Mon Sep 17 00:00:00 2001 From: John Ky Date: Sat, 11 Nov 2023 02:37:11 +1100 Subject: [PATCH 2/3] Update to cardano-api-8.31.0.0 --- cabal.project | 2 +- cardano-cli/cardano-cli.cabal | 2 +- cardano-cli/src/Cardano/CLI/Byron/Parsers.hs | 2 +- .../src/Cardano/CLI/EraBased/Run/Query.hs | 5 +- .../Cardano/CLI/EraBased/Run/Transaction.hs | 57 +++++++++++++------ cardano-cli/src/Cardano/CLI/Json/Friendly.hs | 19 +++++-- .../files/golden/allegra/transaction-view.out | 3 +- .../GovernanceVoteCmdReadVoteFileError.txt | 2 +- ...nstitution-for-stake-address.action.golden | 2 +- .../stakeaddress/alwaysAbstainDeleg.cert | 2 +- .../stakeaddress/noConfidenceDeleg.cert | 2 +- .../poolAndAlwaysAbstainDeleg.cert | 2 +- .../stakeaddress/poolAndDrepVkeyDeleg.cert | 2 +- .../poolAndNoConfidenceDeleg.cert | 2 +- .../files/golden/shelley/transaction-view.out | 3 +- .../Test/Cli/MultiAssetParsing.hs | 27 +++++---- flake.lock | 6 +- 17 files changed, 88 insertions(+), 52 deletions(-) diff --git a/cabal.project b/cabal.project index fee28e5cad..5c176c9171 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2023-08-08T19:56:09Z - , cardano-haskell-packages 2023-11-03T08:46:06Z + , cardano-haskell-packages 2023-11-10T12:47:36Z packages: cardano-cli diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index e2f1be004f..fd8f8de899 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -202,7 +202,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.30.0.0 + , cardano-api ^>= 8.31.0.0 , cardano-binary , cardano-crypto , cardano-crypto-class ^>= 2.1.2 diff --git a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs index 1f6944ba05..ff6b1250f1 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs @@ -293,7 +293,7 @@ parseTxOut = pLovelaceTxOut l = if l > (maxBound :: Word64) then error $ show l <> " lovelace exceeds the Word64 upper bound" - else TxOutAdaOnly ByronToAllegraEraByron . Lovelace $ toInteger l + else TxOutValueByron ByronEraOnlyByron . Lovelace $ toInteger l readerFromAttoParser :: Atto.Parser a -> Opt.ReadM a readerFromAttoParser p = diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index cb06d0c17c..4c14bd71a0 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -1049,8 +1049,9 @@ printUtxo sbe txInOutTuple = in Text.pack $ replicate (max 1 (len - slen)) ' ' ++ str printableValue :: TxOutValue era -> Text - printableValue (TxOutValue _ val) = renderValue val - printableValue (TxOutAdaOnly _ (Lovelace i)) = Text.pack $ show i + printableValue = \case + TxOutValueByron _ (Lovelace i) -> Text.pack $ show i + TxOutValueShelleyBased sbe2 val -> renderValue $ Api.fromLedgerValue sbe2 val runQueryStakePoolsCmd :: () => Cmd.QueryStakePoolsCmdArgs diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 30c3188be6..d7280bed46 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -689,18 +689,31 @@ toAddressInAnyEra era addrAny = runExcept $ do pure (AddressInEra (ShelleyAddressInEra sbe) sAddr) + +lovelaceToCoin :: Lovelace -> Ledger.Coin +lovelaceToCoin (Lovelace ll) = Ledger.Coin ll + toTxOutValueInAnyEra :: CardanoEra era -> Value -> Either TxCmdError (TxOutValue era) toTxOutValueInAnyEra era val = - caseByronToAllegraOrMaryEraOnwards + caseByronOrShelleyBasedEra (\w -> case valueToLovelace val of - Just l -> return (TxOutAdaOnly w l) + Just l -> return (TxOutValueByron w l) Nothing -> txFeatureMismatchPure era TxFeatureMultiAssetOutputs ) - (\w -> return (TxOutValue w val)) + (\sbe -> + caseShelleyToAllegraOrMaryEraOnwards + (\_ -> case valueToLovelace val of + Just l -> return (TxOutValueShelleyBased sbe $ lovelaceToCoin l) + Nothing -> txFeatureMismatchPure era TxFeatureMultiAssetOutputs + ) + (\w -> return (TxOutValueShelleyBased sbe (toLedgerValue w val)) + ) + sbe + ) era toTxOutInAnyEra :: CardanoEra era @@ -710,9 +723,12 @@ toTxOutInAnyEra era (TxOutAnyEra addr' val' mDatumHash refScriptFp) = do addr <- hoistEither $ toAddressInAnyEra era addr' val <- hoistEither $ toTxOutValueInAnyEra era val' - datum <- caseByronToMaryOrAlonzoEraOnwards + datum <- caseByronOrShelleyBasedEra (const (pure TxOutDatumNone)) - (\wa -> toTxAlonzoDatum wa mDatumHash) + (caseShelleyToMaryOrAlonzoEraOnwards + (const (pure TxOutDatumNone)) + (\wa -> toTxAlonzoDatum wa mDatumHash) + ) era refScript <- caseByronToAlonzoOrBabbageEraOnwards @@ -763,24 +779,27 @@ createTxMintValue era (val, scriptWitnesses) = if List.null (valueToList val) && List.null scriptWitnesses then return TxMintNone else do - caseByronToAllegraOrMaryEraOnwards + caseByronOrShelleyBasedEra (const (txFeatureMismatchPure era TxFeatureMintValue)) - (\w -> do - -- The set of policy ids for which we need witnesses: - let witnessesNeededSet :: Set PolicyId - witnessesNeededSet = - Set.fromList [ pid | (AssetId pid _, _) <- valueToList val ] + (caseShelleyToAllegraOrMaryEraOnwards + (const (txFeatureMismatchPure era TxFeatureMintValue)) + (\w -> do + -- The set of policy ids for which we need witnesses: + let witnessesNeededSet :: Set PolicyId + witnessesNeededSet = + Set.fromList [ pid | (AssetId pid _, _) <- valueToList val ] - let witnessesProvidedMap :: Map PolicyId (ScriptWitness WitCtxMint era) - witnessesProvidedMap = Map.fromList $ gatherMintingWitnesses scriptWitnesses + let witnessesProvidedMap :: Map PolicyId (ScriptWitness WitCtxMint era) + witnessesProvidedMap = Map.fromList $ gatherMintingWitnesses scriptWitnesses - witnessesProvidedSet = Map.keysSet witnessesProvidedMap + witnessesProvidedSet = Map.keysSet witnessesProvidedMap - -- Check not too many, nor too few: - validateAllWitnessesProvided witnessesNeededSet witnessesProvidedSet - validateNoUnnecessaryWitnesses witnessesNeededSet witnessesProvidedSet + -- Check not too many, nor too few: + validateAllWitnessesProvided witnessesNeededSet witnessesProvidedSet + validateNoUnnecessaryWitnesses witnessesNeededSet witnessesProvidedSet - return (TxMintValue w val (BuildTxWith witnessesProvidedMap)) + return (TxMintValue w val (BuildTxWith witnessesProvidedMap)) + ) ) era where @@ -903,6 +922,7 @@ runTransactionSignCmd firstExceptT TxCmdWriteFileError . newExceptT $ writeLazyByteStringFile outTxFile + $ shelleyBasedEraConstraints sbe $ textEnvelopeToJSON Nothing tx -- ---------------------------------------------------------------------------- @@ -1201,6 +1221,7 @@ runTransactionWitnessCmd firstExceptT TxCmdWriteFileError . newExceptT $ writeLazyByteStringFile outFile + $ shelleyBasedEraConstraints sbe $ textEnvelopeToJSON Nothing witness runTransactionSignWitnessCmd :: () diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index aab4de79c0..9f14a99723 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -562,15 +562,24 @@ friendlyLovelace (Shelley.Coin value) = String $ textShow value <> " Lovelace" friendlyMintValue :: TxMintValue ViewTx era -> Aeson.Value friendlyMintValue = \case TxMintNone -> Null - TxMintValue _ v _ -> friendlyValue v + TxMintValue sbe v _ -> friendlyValue (maryEraOnwardsToShelleyBasedEra sbe) v friendlyTxOutValue :: TxOutValue era -> Aeson.Value friendlyTxOutValue = \case - TxOutAdaOnly _ lovelace -> friendlyLovelace $ toShelleyLovelace lovelace - TxOutValue _ v -> friendlyValue v + TxOutValueByron _ lovelace -> friendlyLovelace $ toShelleyLovelace lovelace + TxOutValueShelleyBased sbe v -> friendlyLedgerValue sbe v -friendlyValue :: Api.Value -> Aeson.Value -friendlyValue v = +friendlyLedgerValue :: () + => ShelleyBasedEra era + -> Ledger.Value (ShelleyLedgerEra era) + -> Aeson.Value +friendlyLedgerValue sbe v = friendlyValue sbe $ Api.fromLedgerValue sbe v + +friendlyValue :: () + => ShelleyBasedEra era + -> Api.Value + -> Aeson.Value +friendlyValue _ v = object [ case bundle of ValueNestedBundleAda q -> "lovelace" .= q diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.out b/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.out index b4a82f94d2..f038d3c373 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.out +++ b/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.out @@ -10,7 +10,8 @@ mint: null outputs: - address: addr_test1qrefnr4k09pvge6dq83v6s67ruter8sftmky8qrmkqqsxy7q5psgn8tgqmupq4r79jmxlyk4eqt6z6hj5g8jd8393msqaw47f4 address era: Shelley - amount: 99 Lovelace + amount: + lovelace: 99 network: Testnet payment credential key hash: f2998eb67942c4674d01e2cd435e1f17919e095eec43807bb0010313 reference script: null diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdReadVoteFileError.txt b/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdReadVoteFileError.txt index 4c4805607b..7c40f79fe7 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdReadVoteFileError.txt +++ b/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Types.Errors.GovernanceVoteCmdError.GovernanceVoteCmdError/GovernanceVoteCmdReadVoteFileError.txt @@ -1 +1 @@ -Cannot read vote file: path/file.txt: TextEnvelope aeson decode error: some error description +Cannot read vote file: path/file.txt: TextEnvelope aeson decode error: some error description \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/create-constitution-for-stake-address.action.golden b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/create-constitution-for-stake-address.action.golden index 7b542f5b7a..0a9e6843a8 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/create-constitution-for-stake-address.action.golden +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/create-constitution-for-stake-address.action.golden @@ -2,4 +2,4 @@ "cborHex": "", "description": "", "type": "Governance proposal" -} +} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/alwaysAbstainDeleg.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/alwaysAbstainDeleg.cert index c256ca8a75..818d8e536b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/alwaysAbstainDeleg.cert +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/alwaysAbstainDeleg.cert @@ -2,4 +2,4 @@ "type": "CertificateShelley", "description": "Vote Delegation Certificate", "cborHex": "83098200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab018102" -} \ No newline at end of file +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/noConfidenceDeleg.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/noConfidenceDeleg.cert index 06dc9b4470..f0f7526649 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/noConfidenceDeleg.cert +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/noConfidenceDeleg.cert @@ -2,4 +2,4 @@ "type": "CertificateShelley", "description": "Vote Delegation Certificate", "cborHex": "83098200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab018103" -} \ No newline at end of file +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndAlwaysAbstainDeleg.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndAlwaysAbstainDeleg.cert index 777a264ca9..9aa3393b8a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndAlwaysAbstainDeleg.cert +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndAlwaysAbstainDeleg.cert @@ -2,4 +2,4 @@ "type": "CertificateShelley", "description": "Stake and Vote Delegation Certificate", "cborHex": "840a8200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab01581cc27cf021914a2b3bcb286d3d741979083422378c577fe757702b69888102" -} \ No newline at end of file +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndDrepVkeyDeleg.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndDrepVkeyDeleg.cert index 6dc565c85f..c5208eff1b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndDrepVkeyDeleg.cert +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndDrepVkeyDeleg.cert @@ -2,4 +2,4 @@ "type": "CertificateShelley", "description": "Stake and Vote Delegation Certificate", "cborHex": "840a8200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab01581cc27cf021914a2b3bcb286d3d741979083422378c577fe757702b69888200581ce68f9ee70599cb93d9f60678f9c6463c01938c27d9820c7bf93887a5" -} \ No newline at end of file +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndNoConfidenceDeleg.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndNoConfidenceDeleg.cert index a2ce19f224..688ad49c70 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndNoConfidenceDeleg.cert +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/poolAndNoConfidenceDeleg.cert @@ -2,4 +2,4 @@ "type": "CertificateShelley", "description": "Stake and Vote Delegation Certificate", "cborHex": "840a8200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab01581cc27cf021914a2b3bcb286d3d741979083422378c577fe757702b69888103" -} \ No newline at end of file +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.out b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.out index e8f51f0365..b4110439ed 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.out +++ b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.out @@ -40,7 +40,8 @@ mint: null outputs: - address: addr_test1vz7w0r9epak6nmnh3mc8e2ypkjyu8zsc3xf7dpct6k577acxmcfyv address era: Shelley - amount: 31 Lovelace + amount: + lovelace: 31 network: Testnet payment credential key hash: bce78cb90f6da9ee778ef07ca881b489c38a188993e6870bd5a9ef77 reference script: null diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs index fb7462faf2..1bbfd6aeaf 100644 --- a/cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs +++ b/cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs @@ -1,11 +1,11 @@ {-# LANGUAGE OverloadedStrings #-} -module Test.Cli.MultiAssetParsing - ( hprop_roundtrip_Value_parse_render - , hprop_roundtrip_Value_parse_renderPretty - ) where +{- HLINT ignore "Use camelCase" -} -import Cardano.Api (parseValue, renderValue, renderValuePretty, valueToList) +module Test.Cli.MultiAssetParsing where + +import Cardano.Api (MaryEraOnwards (..), ShelleyBasedEra (..), fromLedgerValue, + parseValue, renderValue, renderValuePretty) import qualified Data.Text as Text import qualified Text.Parsec as Parsec (parse) @@ -13,21 +13,24 @@ import qualified Text.Parsec as Parsec (parse) import Test.Gen.Cardano.Api.Typed (genValueDefault) import Hedgehog (Property, forAll, property, tripping) -import qualified Hedgehog.Gen as Gen -hprop_roundtrip_Value_parse_render :: Property -hprop_roundtrip_Value_parse_render = +-- TODO enable these tests after switching completely to ledger types +disable_hprop_roundtrip_Value_parse_render :: Property +disable_hprop_roundtrip_Value_parse_render = property $ do - value <- forAll $ Gen.filter (not . null . valueToList) genValueDefault + ledgerValue <- forAll $ genValueDefault MaryEraOnwardsConway + let value = fromLedgerValue ShelleyBasedEraConway ledgerValue tripping value renderValue (Parsec.parse parseValue "" . Text.unpack) -hprop_roundtrip_Value_parse_renderPretty :: Property -hprop_roundtrip_Value_parse_renderPretty = +-- TODO enable these tests after switching completely to ledger types +disable_hprop_roundtrip_Value_parse_renderPretty :: Property +disable_hprop_roundtrip_Value_parse_renderPretty = property $ do - value <- forAll $ Gen.filter (not . null . valueToList) genValueDefault + ledgerValue <- forAll $ genValueDefault MaryEraOnwardsConway + let value = fromLedgerValue ShelleyBasedEraConway ledgerValue tripping value renderValuePretty diff --git a/flake.lock b/flake.lock index 4fc708f359..07d6765d02 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1699002072, - "narHash": "sha256-WEhB4QGcO2tw4Kyi/217Oe0Sl7FJzQdWaiwsoqZuHac=", + "lastModified": 1699621724, + "narHash": "sha256-9ILdzJPu8Nzb7zVCSra95U3MddZL3Lq8RmX4C4/Tiak=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "79dd4bb1db3da3ea342bf8759821c7fe46a188f3", + "rev": "53af7297cedefb4bbd463c070b559b6be83f0c2e", "type": "github" }, "original": { From 383dc195eeb3ad9341db7cb07805ff08eed85258 Mon Sep 17 00:00:00 2001 From: John Ky Date: Sat, 11 Nov 2023 16:05:05 +1100 Subject: [PATCH 3/3] Delete tests that belong in cardano-api --- cardano-cli/cardano-cli.cabal | 2 - .../Test/Cli/MultiAssetParsing.hs | 37 ------------------- 2 files changed, 39 deletions(-) delete mode 100644 cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index fd8f8de899..0129180c78 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -303,7 +303,6 @@ test-suite cardano-cli-test , filepath , hedgehog , hedgehog-extras ^>= 0.4.7.0 - , parsec , tasty , tasty-hedgehog , text @@ -316,7 +315,6 @@ test-suite cardano-cli-test Test.Cli.FilePermissions Test.Cli.ITN Test.Cli.JSON - Test.Cli.MultiAssetParsing Test.Cli.Pioneers.Exercise1 Test.Cli.Pioneers.Exercise2 Test.Cli.Pioneers.Exercise3 diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs deleted file mode 100644 index 1bbfd6aeaf..0000000000 --- a/cardano-cli/test/cardano-cli-test/Test/Cli/MultiAssetParsing.hs +++ /dev/null @@ -1,37 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -{- HLINT ignore "Use camelCase" -} - -module Test.Cli.MultiAssetParsing where - -import Cardano.Api (MaryEraOnwards (..), ShelleyBasedEra (..), fromLedgerValue, - parseValue, renderValue, renderValuePretty) - -import qualified Data.Text as Text -import qualified Text.Parsec as Parsec (parse) - -import Test.Gen.Cardano.Api.Typed (genValueDefault) - -import Hedgehog (Property, forAll, property, tripping) - --- TODO enable these tests after switching completely to ledger types -disable_hprop_roundtrip_Value_parse_render :: Property -disable_hprop_roundtrip_Value_parse_render = - property $ do - ledgerValue <- forAll $ genValueDefault MaryEraOnwardsConway - let value = fromLedgerValue ShelleyBasedEraConway ledgerValue - tripping - value - renderValue - (Parsec.parse parseValue "" . Text.unpack) - --- TODO enable these tests after switching completely to ledger types -disable_hprop_roundtrip_Value_parse_renderPretty :: Property -disable_hprop_roundtrip_Value_parse_renderPretty = - property $ do - ledgerValue <- forAll $ genValueDefault MaryEraOnwardsConway - let value = fromLedgerValue ShelleyBasedEraConway ledgerValue - tripping - value - renderValuePretty - (Parsec.parse parseValue "" . Text.unpack)