From 1d4c567f31cba5a5c93479dd9c0ae21e6f408eeb Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Fri, 21 Jul 2023 23:16:03 +0200 Subject: [PATCH 1/2] Reintroduce a fix for translating the mint field in Babbage era --- eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs | 1 + eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs | 6 ++---- eras/conway/impl/src/Cardano/Ledger/Conway/TxInfo.hs | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs index 0eab1bce95f..69bf7678ef8 100644 --- a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs +++ b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs @@ -41,6 +41,7 @@ module Cardano.Ledger.Alonzo.TxInfo ( transPolicyID, transAssetName, transMultiAsset, + transMintValue, transValue, transWithdrawals, getWitVKeyHash, diff --git a/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs b/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs index bddb66beace..2f67815456a 100644 --- a/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs +++ b/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs @@ -233,7 +233,7 @@ babbageTxInfoV1 timeRange tx utxo = do { PV1.txInfoInputs = inputs , PV1.txInfoOutputs = outputs , PV1.txInfoFee = Alonzo.transValue (inject @(MaryValue (EraCrypto era)) fee) - , PV1.txInfoMint = Alonzo.transMultiAsset multiAsset + , PV1.txInfoMint = Alonzo.transMintValue (txBody ^. mintTxBodyL) , PV1.txInfoDCert = toList $ fmap (unTxCertV1 . Alonzo.transTxCert) (txBody ^. certsTxBodyL) , PV1.txInfoWdrl = Map.toList (Alonzo.transWithdrawals (txBody ^. withdrawalsTxBodyL)) , PV1.txInfoValidRange = timeRange @@ -247,7 +247,6 @@ babbageTxInfoV1 timeRange tx utxo = do witnesses = tx ^. witsTxL outs = txBody ^. outputsTxBodyL fee = txBody ^. feeTxBodyL - multiAsset = txBody ^. mintTxBodyL datpairs = Map.toList (unTxDats $ witnesses ^. datsTxWitsL) babbageTxInfoV2 :: @@ -278,7 +277,7 @@ babbageTxInfoV2 timeRange tx utxo = do , PV2.txInfoOutputs = outputs , PV2.txInfoReferenceInputs = refInputs , PV2.txInfoFee = Alonzo.transValue (inject @(MaryValue (EraCrypto era)) fee) - , PV2.txInfoMint = Alonzo.transMultiAsset multiAsset + , PV2.txInfoMint = Alonzo.transMintValue (txBody ^. mintTxBodyL) , PV2.txInfoDCert = toList $ fmap (unTxCertV2 . Alonzo.transTxCert) (txBody ^. certsTxBodyL) , PV2.txInfoWdrl = PV2.fromList $ Map.toList (Alonzo.transWithdrawals (txBody ^. withdrawalsTxBodyL)) , PV2.txInfoValidRange = timeRange @@ -293,6 +292,5 @@ babbageTxInfoV2 timeRange tx utxo = do witnesses = tx ^. witsTxL outs = txBody ^. outputsTxBodyL fee = txBody ^. feeTxBodyL - multiAsset = txBody ^. mintTxBodyL datpairs = Map.toList (unTxDats $ witnesses ^. datsTxWitsL) rdmrs = Map.toList (unRedeemers $ witnesses ^. rdmrsTxWitsL) diff --git a/eras/conway/impl/src/Cardano/Ledger/Conway/TxInfo.hs b/eras/conway/impl/src/Cardano/Ledger/Conway/TxInfo.hs index c72ccc6838e..d0ffd8142c6 100644 --- a/eras/conway/impl/src/Cardano/Ledger/Conway/TxInfo.hs +++ b/eras/conway/impl/src/Cardano/Ledger/Conway/TxInfo.hs @@ -114,7 +114,9 @@ conwayTxInfoV3 timeRange tx utxo = do , PV3.txInfoOutputs = outputs , PV3.txInfoReferenceInputs = refInputs , PV3.txInfoFee = Alonzo.transValue (inject @(MaryValue (EraCrypto era)) fee) - , PV3.txInfoMint = Alonzo.transMultiAsset multiAsset + , -- Note that this translation is different from previous Plutus versions, sine we no + -- longer add a zero ADA value to the mint field during translation: + PV3.txInfoMint = Alonzo.transMultiAsset (txBody ^. mintTxBodyL) , PV3.txInfoDCert = toList $ fmap (unTxCertV3 . Alonzo.transTxCert) (txBody ^. certsTxBodyL) , PV3.txInfoWdrl = PV3.fromList $ Map.toList (Alonzo.transWithdrawals (txBody ^. withdrawalsTxBodyL)) , PV3.txInfoValidRange = timeRange @@ -129,6 +131,5 @@ conwayTxInfoV3 timeRange tx utxo = do witnesses = tx ^. witsTxL outs = txBody ^. outputsTxBodyL fee = txBody ^. feeTxBodyL - multiAsset = txBody ^. mintTxBodyL datpairs = Map.toList (unTxDats $ witnesses ^. datsTxWitsL) rdmrs = Map.toList (unRedeemers $ witnesses ^. rdmrsTxWitsL) From 3d3717ace035fe6fc34336ebdfbe3edc90a5356c Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Fri, 21 Jul 2023 23:30:32 +0200 Subject: [PATCH 2/2] Adjust versions and changelogs --- eras/alonzo/impl/CHANGELOG.md | 4 ++++ eras/babbage/impl/CHANGELOG.md | 6 +++++- eras/babbage/impl/cardano-ledger-babbage.cabal | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/eras/alonzo/impl/CHANGELOG.md b/eras/alonzo/impl/CHANGELOG.md index b8626454b26..7ba2bdc65be 100644 --- a/eras/alonzo/impl/CHANGELOG.md +++ b/eras/alonzo/impl/CHANGELOG.md @@ -14,6 +14,10 @@ `Plutus` type instead of a `Language` and `ShortByteString` * Rename `pdSBS` field to `pdPlutusScript` in the `PlutusDebugLang` data type +## 1.3.3.0 + +* Export `transMintValue` + ## 1.3.2.0 * Add implementation for `spendableInputsTxBodyL` diff --git a/eras/babbage/impl/CHANGELOG.md b/eras/babbage/impl/CHANGELOG.md index 0ec4c3bf228..31d621bbc5a 100644 --- a/eras/babbage/impl/CHANGELOG.md +++ b/eras/babbage/impl/CHANGELOG.md @@ -1,9 +1,13 @@ # Version history for `cardano-ledger-babbage` -## 1.4.2.0 +## 1.4.3.0 * Added `babbagePParamsHKDPairs` +## 1.4.2.0 + +* Fix `mint` field Plutus translation bug. + ## 1.4.1.0 * Add implementation for `spendableInputsTxBodyL` diff --git a/eras/babbage/impl/cardano-ledger-babbage.cabal b/eras/babbage/impl/cardano-ledger-babbage.cabal index 00c459fc446..0d335f15def 100644 --- a/eras/babbage/impl/cardano-ledger-babbage.cabal +++ b/eras/babbage/impl/cardano-ledger-babbage.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: cardano-ledger-babbage -version: 1.4.2.0 +version: 1.4.3.0 license: Apache-2.0 maintainer: operations@iohk.io author: IOHK