diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs index e70c9fc3132..ac768f4a5c5 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs @@ -75,6 +75,7 @@ module Cardano.Wallet.Shelley.Compatibility , internalError , isInternalError , ToCardanoGenTx (..) + , fromLedgerExUnits -- ** Assessing sizes of token bundles , tokenBundleSizeAssessor @@ -674,6 +675,15 @@ executionUnitPricesFromPParams pp = , W.priceExecutionMemory = Ledger.unboundRational prMem } +fromLedgerExUnits + :: Alonzo.ExUnits + -> W.ExecutionUnits +fromLedgerExUnits (Alonzo.ExUnits mem steps) = + W.ExecutionUnits + { executionSteps = steps + , executionMemory = mem + } + txParametersFromPParams :: HasField "_minfeeA" pparams Natural => HasField "_minfeeB" pparams Natural diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs index 2b6fbfc78a5..df6889ba23a 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs @@ -109,6 +109,7 @@ import Cardano.Wallet.Primitive.Types.Tx import Cardano.Wallet.Shelley.Compatibility ( fromAllegraTx , fromAlonzoTx + , fromLedgerExUnits , fromMaryTx , fromShelleyTx , sealShelleyTx @@ -173,6 +174,7 @@ import qualified Cardano.Crypto as CC import qualified Cardano.Crypto.DSIGN as DSIGN import qualified Cardano.Crypto.Hash.Class as Crypto import qualified Cardano.Crypto.Wallet as Crypto.HD +import qualified Cardano.Ledger.Alonzo.TxWitness as SL import qualified Cardano.Ledger.Core as SL import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle @@ -499,7 +501,8 @@ _calcScriptExecutionCost pp sealedTx = undefined getScriptData _ = error "we should not expect Cardano.ByronTxBody here" getRedeemers Cardano.TxBodyNoScriptData = Nothing getRedeemers (Cardano.TxBodyScriptData _ _ redeemers) = Just redeemers - in getRedeemers $ getScriptData $ Cardano.getTxBody txValid + getExtUnit (SL.Redeemers rmds) = map (fromLedgerExUnits . snd . snd) $ Map.toList rmds + in getExtUnit <$> (getRedeemers $ getScriptData $ Cardano.getTxBody txValid) Left _ -> Nothing _decodeSignedTx