Skip to content

Commit

Permalink
Reintroduce a fix for translating the mint field in Babbage era
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Jul 22, 2023
1 parent b8acba8 commit 1d4c567
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module Cardano.Ledger.Alonzo.TxInfo (
transPolicyID,
transAssetName,
transMultiAsset,
transMintValue,
transValue,
transWithdrawals,
getWitVKeyHash,
Expand Down
6 changes: 2 additions & 4 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ::
Expand Down Expand Up @@ -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
Expand All @@ -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)
5 changes: 3 additions & 2 deletions eras/conway/impl/src/Cardano/Ledger/Conway/TxInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

0 comments on commit 1d4c567

Please sign in to comment.