From 1a4737395792121ad66e883f5dc5cca0771e76f4 Mon Sep 17 00:00:00 2001 From: Carl Hammann Date: Mon, 13 Nov 2023 18:08:42 +0100 Subject: [PATCH] Bump cardano-api & ouroboros-consensus (temporary) --- cabal.project | 19 +++++++++++++++++++ cardano-cli/cardano-cli.cabal | 2 +- cardano-cli/src/Cardano/CLI/Byron/Parsers.hs | 2 +- .../src/Cardano/CLI/EraBased/Run/Query.hs | 4 ++-- .../Cardano/CLI/EraBased/Run/Transaction.hs | 17 +++-------------- cardano-cli/src/Cardano/CLI/Json/Friendly.hs | 14 ++++---------- flake.lock | 6 +++--- 7 files changed, 33 insertions(+), 31 deletions(-) diff --git a/cabal.project b/cabal.project index 5c176c9171..7187fd9e7f 100644 --- a/cabal.project +++ b/cabal.project @@ -43,3 +43,22 @@ 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/input-output-hk/cardano-api.git + tag: d86466b2dc9927ae2e3ee9b5603ca90fab08ebbc + subdir: + cardano-api + --sha256: sha256-wpgPZuD+ZNqzLgPuYJXBE0uS2VqgBBlH0SvjduQBj5c= + +source-repository-package + type: git + location: https://github.com/input-output-hk/ouroboros-consensus.git + tag: ac8a4c0b34385e05616cc53212cad85bbe7ea415 + subdir: + ouroboros-consensus + ouroboros-consensus-cardano + ouroboros-consensus-diffusion + ouroboros-consensus-protocol + --sha256: sha256-e5VtDfrSmrAMfpUNdXuLiaTE3p75cRF8EVjtM7oSntY= diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 0129180c78..d6bf9091f3 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.31.0.0 + , cardano-api ^>= 8.30.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 ff6b1250f1..1f6944ba05 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 TxOutValueByron ByronEraOnlyByron . Lovelace $ toInteger l + else TxOutAdaOnly ByronToAllegraEraByron . 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 4c14bd71a0..4e484b2a08 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -1050,8 +1050,8 @@ printUtxo sbe txInOutTuple = printableValue :: TxOutValue era -> Text printableValue = \case - TxOutValueByron _ (Lovelace i) -> Text.pack $ show i - TxOutValueShelleyBased sbe2 val -> renderValue $ Api.fromLedgerValue sbe2 val + TxOutAdaOnly _ (Lovelace i) -> Text.pack $ show i + TxOutValue _ val -> renderValue 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 d7280bed46..7fa0d7234a 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -690,29 +690,18 @@ 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 = - caseByronOrShelleyBasedEra + caseByronToAllegraOrMaryEraOnwards (\w -> case valueToLovelace val of - Just l -> return (TxOutValueByron w l) + Just l -> return (TxOutAdaOnly w l) Nothing -> txFeatureMismatchPure era TxFeatureMultiAssetOutputs ) - (\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 + (\w -> return (TxOutValue w val) ) era diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index 9f14a99723..403524ede9 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -562,21 +562,15 @@ friendlyLovelace (Shelley.Coin value) = String $ textShow value <> " Lovelace" friendlyMintValue :: TxMintValue ViewTx era -> Aeson.Value friendlyMintValue = \case TxMintNone -> Null - TxMintValue sbe v _ -> friendlyValue (maryEraOnwardsToShelleyBasedEra sbe) v + TxMintValue sbe v _ -> friendlyValue sbe v friendlyTxOutValue :: TxOutValue era -> Aeson.Value friendlyTxOutValue = \case - TxOutValueByron _ lovelace -> friendlyLovelace $ toShelleyLovelace lovelace - TxOutValueShelleyBased sbe v -> friendlyLedgerValue sbe v - -friendlyLedgerValue :: () - => ShelleyBasedEra era - -> Ledger.Value (ShelleyLedgerEra era) - -> Aeson.Value -friendlyLedgerValue sbe v = friendlyValue sbe $ Api.fromLedgerValue sbe v + TxOutAdaOnly _ lovelace -> friendlyLovelace $ toShelleyLovelace lovelace + TxOutValue sbe v -> friendlyValue sbe v friendlyValue :: () - => ShelleyBasedEra era + => MaryEraOnwards era -> Api.Value -> Aeson.Value friendlyValue _ v = diff --git a/flake.lock b/flake.lock index 07d6765d02..60691123fa 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1699621724, - "narHash": "sha256-9ILdzJPu8Nzb7zVCSra95U3MddZL3Lq8RmX4C4/Tiak=", + "lastModified": 1699892661, + "narHash": "sha256-fm6El9Eoo1oPn4ztsMXK/9W6YKfrcamzpbUmvUKU1V8=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "53af7297cedefb4bbd463c070b559b6be83f0c2e", + "rev": "ecd9d0ac3a86259736209fd78dbac140d4740836", "type": "github" }, "original": {