From a152bfdd1feace185e036bec6afa71d0bac19ce2 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Fri, 30 Jan 2026 10:51:17 -0400 Subject: [PATCH 1/3] Bump cardano-api --- cabal.project | 8 ++ .../Cardano/CLI/EraBased/Script/Mint/Read.hs | 12 +-- .../Cardano/CLI/EraBased/Transaction/Run.hs | 81 +++++++++++-------- .../src/Cardano/CLI/Type/Error/TxCmdError.hs | 3 + .../shelley/build-raw-tx-body-out-6.json | 2 +- 5 files changed, 65 insertions(+), 41 deletions(-) diff --git a/cabal.project b/cabal.project index e9df825162..f55e444689 100644 --- a/cabal.project +++ b/cabal.project @@ -67,3 +67,11 @@ if impl (ghc >= 9.12) -- 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: 294ecd9c0bdcd34925992676c29a8102eb869d60 + --sha256: sha256-sLiVIz2pA7bXLa3lOecJF92upKlX1xEFhLG1THMD7yY= + subdir: cardano-api \ No newline at end of file diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Script/Mint/Read.hs b/cardano-cli/src/Cardano/CLI/EraBased/Script/Mint/Read.hs index 26b22e3537..ba109ac91d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Script/Mint/Read.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Script/Mint/Read.hs @@ -10,7 +10,7 @@ module Cardano.CLI.EraBased.Script.Mint.Read ) where -import Cardano.Api +import Cardano.Api hiding (AnyScriptWitness) import Cardano.Api.Experimental qualified as Exp import Cardano.Api.Experimental.AnyScriptWitness import Cardano.Api.Experimental.Plutus qualified as Exp @@ -27,13 +27,13 @@ import Cardano.Ledger.Core qualified as L readMintScriptWitness :: forall era e . Exp.IsEra era - => ScriptRequirements Exp.MintItem -> CIO e (PolicyId, Exp.AnyWitness (Exp.LedgerEra era)) + => ScriptRequirements Exp.MintItem -> CIO e (PolicyId, AnyScriptWitness (Exp.LedgerEra era)) readMintScriptWitness (OnDiskSimpleScript scriptFp) = do let sFp = unFile scriptFp s <- readFileSimpleScript sFp (Exp.useEra @era) let sHash :: L.ScriptHash = Exp.hashSimpleScript (s :: Exp.SimpleScript (Exp.LedgerEra era)) - return (fromMaryPolicyID $ L.PolicyID sHash, Exp.AnySimpleScriptWitness $ Exp.SScript s) + return (fromMaryPolicyID $ L.PolicyID sHash, AnyScriptWitnessSimple $ Exp.SScript s) readMintScriptWitness ( OnDiskPlutusScript (OnDiskPlutusScriptCliArgs scriptFp Exp.NoScriptDatumAllowed redeemerFile execUnits) @@ -57,7 +57,7 @@ readMintScriptWitness execUnits return ( polId - , Exp.AnyPlutusScriptWitness $ + , AnyScriptWitnessPlutus $ AnyPlutusMintingScriptWitness sw ) readMintScriptWitness @@ -83,9 +83,9 @@ readMintScriptWitness execUnits return ( polId - , Exp.AnyPlutusScriptWitness $ + , AnyScriptWitnessPlutus $ AnyPlutusMintingScriptWitness sw ) readMintScriptWitness (SimpleReferenceScript (SimpleRefScriptArgs refTxIn polId)) = - return (polId, Exp.AnySimpleScriptWitness $ Exp.SReferenceScript refTxIn) + return (polId, AnyScriptWitnessSimple $ Exp.SReferenceScript refTxIn) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs b/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs index 7f219056b8..aabb0314a8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs @@ -203,9 +203,13 @@ runTransactionBuildCmd requiredSigners <- mapM (fromEitherIOCli . readRequiredSigner) reqSigners - mReturnCollateral <- forM mReturnColl toTxOutInShelleyBasedEra + mReturnCollateral :: Maybe (Exp.TxOut (Exp.LedgerEra era)) <- + forM mReturnColl toTxOutInShelleyBasedEra - txOuts <- mapM (toTxOutInAnyEra eon) txouts + txOuts <- + mapM + toTxOutInEra + txouts -- Conway related votingProceduresAndMaybeScriptWits :: [(VotingProcedures era, Exp.AnyWitness (Exp.LedgerEra era))] <- @@ -367,6 +371,15 @@ runTransactionBuildCmd then writeTxFileTextEnvelopeCanonical eon fpath noWitTx else writeTxFileTextEnvelope eon fpath noWitTx +toTxOutInEra + :: Exp.IsEra era + => TxOutAnyEra + -> CIO e (Exp.TxOut (Exp.LedgerEra era)) +toTxOutInEra (TxOutAnyEra addr' val' mDatumHash refScriptFp) = do + let addr = anyAddressInShelleyBasedEra (convert Exp.useEra) addr' + o <- mkTxOut (convert Exp.useEra) addr val' mDatumHash refScriptFp + fromEitherCli $ Exp.fromLegacyTxOut o + runTransactionBuildEstimateCmd :: forall era e . Exp.IsEra era @@ -434,7 +447,7 @@ runTransactionBuildEstimateCmd -- TODO change type mReturnCollateral <- mapM toTxOutInShelleyBasedEra mReturnColl - txOuts <- mapM (toTxOutInAnyEra sbe) txouts + txOuts <- mapM toTxOutInEra txouts -- the same collateral input can be used for several plutus scripts let filteredTxinsc = nubOrd txInsCollateral @@ -531,7 +544,7 @@ runTransactionBuildEstimateCmd -- TODO change type txBodyOutFile $ unsignedToToApiTx unsignedTx -unsignedToToApiTx :: forall era. Exp.IsEra era => Exp.UnsignedTx era -> Api.Tx era +unsignedToToApiTx :: forall era. Exp.IsEra era => Exp.UnsignedTx (Exp.LedgerEra era) -> Api.Tx era unsignedToToApiTx (Exp.UnsignedTx lTx) = ShelleyTx (convert $ Exp.useEra @era) $ obtainCommonConstraints (Exp.useEra @era) lTx @@ -642,7 +655,7 @@ runTransactionBuildRawCmd mReturnCollateral <- mapM toTxOutInShelleyBasedEra mReturnColl - txOuts <- mapM (toTxOutInAnyEra (convert Exp.useEra)) txouts + txOuts <- mapM toTxOutInEra txouts -- the same collateral input can be used for several plutus scripts let filteredTxinsc = toList @(Set _) $ fromList txInsCollateral @@ -664,7 +677,7 @@ runTransactionBuildRawCmd ) | (CertificateFile certFile, mSwit) <- certFilesAndMaybeScriptWits ] - txBody :: Exp.UnsignedTx era <- + txBody :: Exp.UnsignedTx (Exp.LedgerEra era) <- fromEitherCli $ runTxBuildRaw mScriptValidity @@ -687,7 +700,6 @@ runTransactionBuildRawCmd votingProceduresAndMaybeScriptWits proposals currentTreasuryValueAndDonation - let Exp.UnsignedTx lTx = txBody noWitTx = ShelleyTx (convert eon) lTx fromEitherIOCli $ @@ -705,18 +717,18 @@ runTxBuildRaw -- ^ Read only reference inputs -> [TxIn] -- ^ TxIn for collateral - -> Maybe (TxOut CtxTx era) + -> Maybe (Exp.TxOut (Exp.LedgerEra era)) -- ^ Return collateral -> Maybe Lovelace -- ^ Total collateral - -> [TxOut CtxTx era] + -> [Exp.TxOut (Exp.LedgerEra era)] -> Maybe SlotNo -- ^ Tx lower bound -> TxValidityUpperBound era -- ^ Tx upper bound -> Lovelace -- ^ Tx fee - -> (L.MultiAsset, [(PolicyId, Exp.AnyWitness (Exp.LedgerEra era))]) + -> (L.MultiAsset, [(PolicyId, Exp.AnyScriptWitness (Exp.LedgerEra era))]) -- ^ Multi-Asset minted value(s) -> [(Exp.Certificate (Exp.LedgerEra era), Exp.AnyWitness (Exp.LedgerEra era))] -- ^ Certificate with potential script witness @@ -729,7 +741,7 @@ runTxBuildRaw -> [(VotingProcedures era, Exp.AnyWitness (Exp.LedgerEra era))] -> [(Proposal era, Exp.AnyWitness (Exp.LedgerEra era))] -> Maybe (TxCurrentTreasuryValue, TxTreasuryDonation) - -> Either TxCmdError (Exp.UnsignedTx era) + -> Either TxCmdError (Exp.UnsignedTx (Exp.LedgerEra era)) runTxBuildRaw mScriptValidity inputsAndMaybeScriptWits @@ -787,17 +799,17 @@ constructTxBodyContent -- ^ Read only reference inputs -> [TxIn] -- ^ TxIn for collateral - -> Maybe (TxOut CtxTx era) + -> Maybe (Exp.TxOut (Exp.LedgerEra era)) -- ^ Return collateral -> Maybe Lovelace -- ^ Total collateral - -> [TxOut CtxTx era] + -> [Exp.TxOut (Exp.LedgerEra era)] -- ^ Normal outputs -> Maybe SlotNo -- ^ Tx lower bound -> TxValidityUpperBound era -- ^ Tx upper bound - -> (L.MultiAsset, [(PolicyId, Exp.AnyWitness (Exp.LedgerEra era))]) + -> (L.MultiAsset, [(PolicyId, Exp.AnyScriptWitness (Exp.LedgerEra era))]) -- ^ Multi-Asset value(s) -> [(Exp.Certificate (Exp.LedgerEra era), Exp.AnyWitness (Exp.LedgerEra era))] -- ^ Certificate with potential script witness @@ -850,17 +862,18 @@ constructTxBodyContent -- TODO The last argument of validateTxInsReference is a datum set from reference inputs -- Should we allow providing of datum from CLI? -- TODO: Figure how to expose resolved datums + + txRetCollateral :: Maybe (Exp.TxReturnCollateral (Exp.LedgerEra era)) <- case mReturnCollateral of + Just rc -> do + let Exp.TxOut o = rc + Right $ Just $ Exp.TxReturnCollateral (o :: (L.TxOut (Exp.LedgerEra era))) + Nothing -> Right Nothing + let refInputs = Exp.TxInsReference allReferenceInputs Set.empty - expTxouts = map Exp.fromLegacyTxOut txouts auxScripts = case txAuxScripts of TxAuxScriptsNone -> [] -- TODO: Auxiliary scripts cannot be plutus scripts TxAuxScripts _ scripts -> mapMaybe scriptInEraToSimpleScript scripts - txRetCollateral = case mReturnCollateral of - Just rc -> - let Exp.TxOut o _ = Exp.fromLegacyTxOut rc - in Just $ Exp.TxReturnCollateral (o :: (L.TxOut (Exp.LedgerEra era))) - Nothing -> Nothing txTotCollateral = Exp.TxTotalCollateral <$> (mTotCollateral :: Maybe L.Coin) expTxMetadata = case txMetadata of TxMetadataNone -> TxMetadata mempty @@ -882,7 +895,7 @@ constructTxBodyContent & Exp.setTxIns inputsAndMaybeScriptWits & Exp.setTxInsCollateral txinsc & Exp.setTxInsReference refInputs - & Exp.setTxOuts expTxouts + & Exp.setTxOuts txouts & maybe id Exp.setTxReturnCollateral txRetCollateral & maybe id Exp.setTxTotalCollateral txTotCollateral & Exp.setTxFee fee @@ -940,16 +953,15 @@ runTxBuild -- ^ TxIn with potential script witness -> [TxIn] -- ^ TxIn for collateral - -> Maybe (TxOut CtxTx era) + -> Maybe (Exp.TxOut (Exp.LedgerEra era)) -- ^ Return collateral -> Maybe Lovelace -- ^ Total collateral - -> [TxOut CtxTx era] + -> [Exp.TxOut (Exp.LedgerEra era)] -- ^ Normal outputs -> TxOutChangeAddress -- ^ A change output - -> (L.MultiAsset, [(PolicyId, Exp.AnyWitness (Exp.LedgerEra era))]) -- TODO: Double check why this is a list - + -> (L.MultiAsset, [(PolicyId, Exp.AnyScriptWitness (Exp.LedgerEra era))]) -- ^ Multi-Asset value(s) -> Maybe SlotNo -- ^ Tx lower bound @@ -968,7 +980,7 @@ runTxBuild -> [(Proposal era, Exp.AnyWitness (Exp.LedgerEra era))] -> Maybe (TxCurrentTreasuryValue, TxTreasuryDonation) -- ^ The current treasury value and the donation. - -> ExceptT TxCmdError IO (Exp.UnsignedTx era, Exp.TxBodyContent (Exp.LedgerEra era)) + -> ExceptT TxCmdError IO (Exp.UnsignedTx (Exp.LedgerEra era), Exp.TxBodyContent (Exp.LedgerEra era)) runTxBuild socketPath networkId @@ -1109,7 +1121,7 @@ runTxBuild getAllReferenceInputs :: [Exp.AnyWitness (Exp.LedgerEra era)] - -> [Exp.AnyWitness (Exp.LedgerEra era)] + -> [Exp.AnyScriptWitness (Exp.LedgerEra era)] -> [Exp.AnyWitness (Exp.LedgerEra era)] -- \^ Certificate witnesses -> [Exp.AnyWitness (Exp.LedgerEra era)] @@ -1127,7 +1139,7 @@ getAllReferenceInputs propProceduresAnMaybeScriptWits readOnlyRefIns = do let txinsWitByRefInputs = mapMaybe Exp.getAnyWitnessReferenceInput spendingWitnesses - mintingRefInputs = mapMaybe Exp.getAnyWitnessReferenceInput mintWitnesses + mintingRefInputs = mapMaybe Exp.getAnyScriptWitnessReferenceInput mintWitnesses certsWitByRefInputs = mapMaybe Exp.getAnyWitnessReferenceInput certScriptWitnesses withdrawalsWitByRefInputs = mapMaybe Exp.getAnyWitnessReferenceInput withdrawals votesWitByRefInputs = mapMaybe Exp.getAnyWitnessReferenceInput votingProceduresAndMaybeScriptWits @@ -1146,11 +1158,12 @@ getAllReferenceInputs toTxOutInShelleyBasedEra :: Exp.IsEra era => TxOutShelleyBasedEra - -> CIO e (TxOut CtxTx era) + -> CIO e (Exp.TxOut (Exp.LedgerEra era)) toTxOutInShelleyBasedEra (TxOutShelleyBasedEra addr' val' mDatumHash refScriptFp) = do let sbe = convert Exp.useEra addr = shelleyAddressInEra sbe addr' - mkTxOut sbe addr val' mDatumHash refScriptFp + o <- mkTxOut sbe addr val' mDatumHash refScriptFp + fromEitherCli $ Exp.fromLegacyTxOut o -- TODO: Currently we specify the policyId with the '--mint' option on the cli -- and we added a separate '--policy-id' parser that parses the policy id for the @@ -1158,7 +1171,7 @@ toTxOutInShelleyBasedEra (TxOutShelleyBasedEra addr' val' mDatumHash refScriptFp -- for the policy id twice (in the build command) we can potentially query the UTxO and -- access the script (and therefore the policy id). createTxMintValue - :: (L.MultiAsset, [(PolicyId, Exp.AnyWitness (Exp.LedgerEra era))]) + :: (L.MultiAsset, [(PolicyId, Exp.AnyScriptWitness (Exp.LedgerEra era))]) -> Either TxCmdError (Exp.TxMintValue (Exp.LedgerEra era)) createTxMintValue (val, scriptWitnesses) = if mempty == val && List.null scriptWitnesses @@ -1421,16 +1434,16 @@ runTransactionCalculateMinValueCmd -> CIO e () runTransactionCalculateMinValueCmd Cmd.TransactionCalculateMinValueCmdArgs - { era + { era = era :: Exp.Era era , protocolParamsFile , txOut } = do - pp <- + pp :: L.PParams ((Exp.LedgerEra era)) <- fromExceptTCli @ProtocolParamsError (obtainCommonConstraints era $ readProtocolParameters protocolParamsFile) out <- obtainCommonConstraints era $ toTxOutInShelleyBasedEra txOut - let minValue = calculateMinimumUTxO (convert era) pp out + let minValue = Exp.calculateMinimumUTxO pp out liftIO . IO.print $ minValue runTransactionCalculatePlutusScriptCostCmd diff --git a/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs b/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs index 4a326f6af5..4621981377 100644 --- a/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs @@ -42,6 +42,7 @@ data AnyTxBodyErrorAutoBalance where data TxCmdError = TxCmdCBORDecodeError !CBOR.DecoderError + | TxCmdDatumDecodingError Exp.DatumDecodingError | TxCmdProtocolParamsError ProtocolParamsError | forall era. LostScriptWitnesses [Exp.AnyIndexedPlutusScriptWitness (Exp.LedgerEra era)] @@ -195,6 +196,8 @@ renderTxCmdError = \case , pretty (length after) , "." ] + TxCmdDatumDecodingError err -> + "Error decoding datum: " <> pshow err prettyPolicyIdList :: [PolicyId] -> Doc ann prettyPolicyIdList = diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/build-raw-tx-body-out-6.json b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/build-raw-tx-body-out-6.json index dcea3acf85..09115d8552 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/build-raw-tx-body-out-6.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/build-raw-tx-body-out-6.json @@ -1,5 +1,5 @@ { "type": "Tx ConwayEra", "description": "Ledger Cddl Format", - "cborHex": "84a300d90102818258202392d2b1200b5139fe555c81261697b29a8ccf561c5c783d46e78a479d977053000181a3005839016b837ca50316ee4e00033482ed128887d72c2bae5b0438d692dc1251b0c8b17595ebdb93c1f974be0a9b1ef26c474649d9c2ae766ed135cf011864028201d81842182a020ca0f5f6" + "cborHex": "84a300d90102818258202392d2b1200b5139fe555c81261697b29a8ccf561c5c783d46e78a479d977053000181a3005839016b837ca50316ee4e00033482ed128887d72c2bae5b0438d692dc1251b0c8b17595ebdb93c1f974be0a9b1ef26c474649d9c2ae766ed135cf011864028201d81842182a020ca104d9010281182af5f6" } From b4a8d91e93b0db3b7ed664317557b3ed9147e0b3 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Mon, 9 Feb 2026 09:48:20 -0400 Subject: [PATCH 2/3] Bump cabal --- cabal.project | 64 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/cabal.project b/cabal.project index f55e444689..251d578505 100644 --- a/cabal.project +++ b/cabal.project @@ -70,8 +70,62 @@ if impl (ghc >= 9.12) source-repository-package - type: git - location: https://github.com/IntersectMBO/cardano-api.git - tag: 294ecd9c0bdcd34925992676c29a8102eb869d60 - --sha256: sha256-sLiVIz2pA7bXLa3lOecJF92upKlX1xEFhLG1THMD7yY= - subdir: cardano-api \ No newline at end of file + type: git + location: https://github.com/IntersectMBO/cardano-ledger + tag: 324efe565237061615ec10e7f47e08699cace660 + --sha256: sha256-Tu5TlPwJgVpEfTui+zbaUJIOMoexCwFTQ5M/n2DP2/I= + subdir: + eras/allegra/impl + eras/alonzo/impl + eras/alonzo/test-suite + eras/babbage/impl + eras/byron/chain/executable-spec + eras/byron/crypto + eras/byron/ledger/executable-spec + eras/byron/ledger/impl + eras/conway/impl + eras/dijkstra/impl + eras/mary/impl + eras/shelley-ma/test-suite + eras/shelley/impl + eras/shelley/test-suite + libs/cardano-data + libs/cardano-ledger-api + libs/cardano-ledger-binary + libs/cardano-ledger-core + libs/cardano-protocol-tpraos + libs/non-integral + libs/plutus-preprocessor + libs/small-steps + libs/vector-map + +source-repository-package + type: git + location: https://github.com/IntersectMBO/ouroboros-consensus + tag: 0106df607184099af6770d0f49557e8f8ae93de4 + --sha256: sha256-NpyTScEwSUz2zr1DtxUVJSGT2LaDBD8wtRj6NObBOuc= + subdir: + ouroboros-consensus + ouroboros-consensus-cardano + ouroboros-consensus-diffusion + ouroboros-consensus-protocol + strict-sop-core + sop-extras + +source-repository-package + type: git + location: https://github.com/IntersectMBO/ouroboros-network + tag: 228bb2045784a9c180651dedeea9af9396140f47 + --sha256: sha256-q/93M6+TtnqWiguOiwuUSJljA7nrICOsu+5SLl6jiCc= + subdir: + ouroboros-network + cardano-diffusion + network-mux + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-api + tag: 88149e968d0536ac2110abe32a69f221d4b1ea8c + --sha256: sha256-/0oaPmSjsN0H3O/bCLSpimIzT7+Kloof1LBcDOahu5Y= + subdir: + cardano-api \ No newline at end of file From 5ade7c09007c7c618cc7d3a437633baac42fb0bc Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Fri, 6 Feb 2026 10:04:48 +0100 Subject: [PATCH 3/3] Bump Hackage and CHaP index states --- cabal.project | 67 ++----------------- .../Cardano/CLI/EraBased/Transaction/Run.hs | 17 +++-- .../src/Cardano/CLI/Type/Error/TxCmdError.hs | 3 + flake.lock | 12 ++-- 4 files changed, 28 insertions(+), 71 deletions(-) diff --git a/cabal.project b/cabal.project index 251d578505..dbb26503e9 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ 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 2025-12-02T22:23:29Z - , cardano-haskell-packages 2026-01-30T03:40:53Z + , hackage.haskell.org 2026-01-12T19:29:50Z + , cardano-haskell-packages 2026-01-27T13:37:12Z packages: cardano-cli @@ -67,65 +67,12 @@ if impl (ghc >= 9.12) -- 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-ledger - tag: 324efe565237061615ec10e7f47e08699cace660 - --sha256: sha256-Tu5TlPwJgVpEfTui+zbaUJIOMoexCwFTQ5M/n2DP2/I= - subdir: - eras/allegra/impl - eras/alonzo/impl - eras/alonzo/test-suite - eras/babbage/impl - eras/byron/chain/executable-spec - eras/byron/crypto - eras/byron/ledger/executable-spec - eras/byron/ledger/impl - eras/conway/impl - eras/dijkstra/impl - eras/mary/impl - eras/shelley-ma/test-suite - eras/shelley/impl - eras/shelley/test-suite - libs/cardano-data - libs/cardano-ledger-api - libs/cardano-ledger-binary - libs/cardano-ledger-core - libs/cardano-protocol-tpraos - libs/non-integral - libs/plutus-preprocessor - libs/small-steps - libs/vector-map - -source-repository-package - type: git - location: https://github.com/IntersectMBO/ouroboros-consensus - tag: 0106df607184099af6770d0f49557e8f8ae93de4 - --sha256: sha256-NpyTScEwSUz2zr1DtxUVJSGT2LaDBD8wtRj6NObBOuc= - subdir: - ouroboros-consensus - ouroboros-consensus-cardano - ouroboros-consensus-diffusion - ouroboros-consensus-protocol - strict-sop-core - sop-extras - -source-repository-package - type: git - location: https://github.com/IntersectMBO/ouroboros-network - tag: 228bb2045784a9c180651dedeea9af9396140f47 - --sha256: sha256-q/93M6+TtnqWiguOiwuUSJljA7nrICOsu+5SLl6jiCc= - subdir: - ouroboros-network - cardano-diffusion - network-mux - source-repository-package type: git location: https://github.com/IntersectMBO/cardano-api - tag: 88149e968d0536ac2110abe32a69f221d4b1ea8c - --sha256: sha256-/0oaPmSjsN0H3O/bCLSpimIzT7+Kloof1LBcDOahu5Y= + tag: 7f0d7a8e22f5fe921e80f75ce868554f898c1d07 + --sha256: sha256-8Lq88OX0+P+yTo2OX3oYgw3LHFSASASsnd/OoC4wMvo= subdir: - cardano-api \ No newline at end of file + cardano-api + +allow-older: plutus-ledger-api, plutus-core diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs b/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs index aabb0314a8..de39d909f5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs @@ -1046,12 +1046,12 @@ runTxBuild ) & onLeft (left . TxCmdQueryConvenienceError . AcqFailure) & onLeft (left . TxCmdQueryConvenienceError) - + let ledgerPParams = fromShelleyLedgerPParamsShim Exp.useEra $ unLedgerProtocolParameters pparams txBodyContent <- hoistEither $ constructTxBodyContent mScriptValidity - (Just $ fromShelleyLedgerPParamsShim Exp.useEra $ unLedgerProtocolParameters pparams) + (Just ledgerPParams) inputsAndMaybeScriptWits readOnlyRefIns txinsc @@ -1081,7 +1081,14 @@ runTxBuild cAddr <- pure (anyAddressInEra era changeAddr) & onLeft (error $ "runTxBuild: Byron address used: " <> show changeAddr) -- should this throw instead? - r@(unsignedTx, _) <- + let unbalancedTx = Exp.makeUnsignedTx (Exp.useEra @era) txBodyContent + + unsignedTx :: Exp.UnsignedTx (Exp.LedgerEra era) <- + firstExceptT TxCmdRecursiveTxFeeError $ + hoistEither $ + obtainCommonConstraints (Exp.useEra @era) $ + Exp.calcMinFeeRecursive unbalancedTx ledgerUTxO ledgerPParams 0 + (_, updatedTxBodyContent) <- firstExceptT (TxCmdBalanceTxBody . AnyTxBodyErrorAutoBalance) . hoistEither $ Exp.makeTransactionBodyAutoBalance @@ -1102,7 +1109,7 @@ runTxBuild Exp.extractAllIndexedPlutusScriptWitnesses Exp.useEra txBodyContent scriptWitnessesAfterBalance <- hoistEither . first TxCmdCBORDecodeError $ - Exp.extractAllIndexedPlutusScriptWitnesses Exp.useEra (snd r) + Exp.extractAllIndexedPlutusScriptWitnesses Exp.useEra updatedTxBodyContent when ( length scriptWitnessesBeforeBalance /= length scriptWitnessesAfterBalance @@ -1113,7 +1120,7 @@ runTxBuild liftIO . putStrLn . docToString $ "Estimated transaction fee:" <+> pretty (Exp.getUnsignedTxFee unsignedTx) - return r + return (unsignedTx, updatedTxBodyContent) -- ---------------------------------------------------------------------------- -- Transaction body validation and conversion diff --git a/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs b/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs index 4621981377..476d27dfbf 100644 --- a/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs @@ -79,6 +79,7 @@ data TxCmdError | TxCmdUtxoJsonError String | forall era. TxCmdDeprecatedEra (Exp.DeprecatedEra era) | TxCmdGenesisDataError GenesisDataError + | TxCmdRecursiveTxFeeError Exp.RecursiveFeeCalculationError instance Show TxCmdError where show = show . renderTxCmdError @@ -198,6 +199,8 @@ renderTxCmdError = \case ] TxCmdDatumDecodingError err -> "Error decoding datum: " <> pshow err + TxCmdRecursiveTxFeeError err -> + "Error during recursive fee calculation: " <> prettyError err prettyPolicyIdList :: [PolicyId] -> Doc ann prettyPolicyIdList = diff --git a/flake.lock b/flake.lock index 8e285b5495..ddf0a18c62 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1769746903, - "narHash": "sha256-aP97gwy91CpecSSDa/BEsohQ7hv7kuovziuNikzRGTw=", + "lastModified": 1770336764, + "narHash": "sha256-Xi7bFFnUWl4azyiJ2e/xpqgvmVBIyYl28JjB8AYMQEA=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "13b004164316511afb0d50be4fd0764da40a7a84", + "rev": "405d656dd66fcc2a3169dda1c71b9473ecddc38c", "type": "github" }, "original": { @@ -226,11 +226,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1768311066, - "narHash": "sha256-g2WdhScDFQNkJs2GBjWIGG49upIQuBshgaeAxddujrE=", + "lastModified": 1770362075, + "narHash": "sha256-AeCcHktGShwmexhR0IDtdtyUqzdOC+kbz2NOZsgmU08=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "adbb09d536f3a2797f9bd0762a0577a30672b8b1", + "rev": "f4dc8bd94173897be2ad4889a5ef45e8f2820bc7", "type": "github" }, "original": {