Skip to content

Commit 99b6d1f

Browse files
committed
Propagate HasCallStack through tx body construction and output callers
Add HasCallStack to makeShelleyTransactionBody, createAndValidateTransactionBody, fromLegacyTxOut, and toShelleyUTxO, which call functions like mkCommonTxBody, toShelleyTxOutAny, toShelleyTxOut, and createTransactionBody that already carry the constraint.
1 parent e8ef953 commit 99b6d1f

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

cardano-api/src/Cardano/Api/Experimental/Tx/Internal/BodyContent/New.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ import Data.Set qualified as Set
170170
import Data.Text.Encoding qualified as Text
171171
import Data.Typeable (cast)
172172
import GHC.Exts (IsList (..))
173+
import GHC.Stack (HasCallStack)
173174
import Lens.Micro
174175

175176
-- | Error that can occur when constructing an unsigned transaction.
@@ -538,7 +539,8 @@ legacyDatumToDatum OldApi.TxOutDatumNone = Nothing
538539

539540
fromLegacyTxOut
540541
:: forall era
541-
. IsEra era
542+
. HasCallStack
543+
=> IsEra era
542544
=> OldApi.TxOut CtxTx era
543545
-> Either DatumDecodingError (TxOut (LedgerEra era), Map L.DataHash (L.Data (LedgerEra era)))
544546
fromLegacyTxOut tOut@(OldApi.TxOut _ _ d _) = do

cardano-api/src/Cardano/Api/Tx/Internal/Body.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,7 @@ maxShelleyTxInIx = fromIntegral $ maxBound @Word16
15181518
{-# DEPRECATED createAndValidateTransactionBody "Use createTransactionBody instead" #-}
15191519
createAndValidateTransactionBody
15201520
:: ()
1521+
=> HasCallStack
15211522
=> ShelleyBasedEra era
15221523
-> TxBodyContent BuildTx era
15231524
-> Either TxBodyError (TxBody era)
@@ -2104,6 +2105,7 @@ mkCommonTxBody sbe txIns txOuts txFee txWithdrawals txAuxData =
21042105
makeShelleyTransactionBody
21052106
:: forall era
21062107
. ()
2108+
=> HasCallStack
21072109
=> ShelleyBasedEra era
21082110
-> TxBodyContent BuildTx era
21092111
-> Either TxBodyError (TxBody era)

cardano-api/src/Cardano/Api/UTxO.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ import Data.Set (Set)
122122
import Data.Text (Text)
123123
import Data.Tuple (uncurry)
124124
import GHC.Exts qualified as GHC
125+
import GHC.Stack (HasCallStack)
125126
import Text.Show
126127

127128
newtype UTxO era = UTxO {unUTxO :: Map TxIn (TxOut CtxUTxO era)}
@@ -354,7 +355,8 @@ fromMap = UTxO
354355
--------------------------------------------------------------------}
355356

356357
-- | Convert from a `cardano-api` `UTxO` to a `cardano-ledger` UTxO.
357-
toShelleyUTxO :: ShelleyBasedEra era -> UTxO era -> Ledger.UTxO (ShelleyLedgerEra era)
358+
toShelleyUTxO
359+
:: HasCallStack => ShelleyBasedEra era -> UTxO era -> Ledger.UTxO (ShelleyLedgerEra era)
358360
toShelleyUTxO sbe =
359361
Ledger.UTxO . Map.foldMapWithKey f . unUTxO
360362
where

0 commit comments

Comments
 (0)