diff --git a/eras/alonzo/impl/CHANGELOG.md b/eras/alonzo/impl/CHANGELOG.md index 93821037913..d80aa917255 100644 --- a/eras/alonzo/impl/CHANGELOG.md +++ b/eras/alonzo/impl/CHANGELOG.md @@ -9,6 +9,7 @@ * `VState` * Added support for Plutus V3 in the types and functions that use `Language`. (Note that the Alonzo ledger era rules do not allow V3 scripts, however.). +* Fix a bug of converting a mint field to the plutus context: [#3398](https://github.com/input-output-hk/cardano-ledger/pull/3398) ## 1.1.0.0 diff --git a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs index dabcfaf40ad..2e610bafa2a 100644 --- a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs +++ b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs @@ -363,7 +363,10 @@ transAssetName :: AssetName -> PV1.TokenName transAssetName (AssetName bs) = PV1.TokenName (PV1.toBuiltin (SBS.fromShort bs)) transMultiAsset :: MultiAsset c -> PV1.Value -transMultiAsset (MultiAsset m) = Map.foldlWithKey' accum1 mempty m +transMultiAsset ma = transMultiAssetInternal ma mempty + +transMultiAssetInternal :: MultiAsset c -> PV1.Value -> PV1.Value +transMultiAssetInternal (MultiAsset m) initAcc = Map.foldlWithKey' accum1 initAcc m where accum1 ans sym mp2 = Map.foldlWithKey' accum2 ans mp2 where @@ -380,7 +383,7 @@ transMultiAsset (MultiAsset m) = Map.foldlWithKey' accum1 mempty m -- makes no sense). However, if we don't preserve previous translation, scripts that -- previously succeeded will fail. transMintValue :: MultiAsset c -> PV1.Value -transMintValue m = transMultiAsset m <> justZeroAda +transMintValue m = transMultiAssetInternal m justZeroAda where justZeroAda = PV1.singleton PV1.adaSymbol PV1.adaToken 0