From 9b79ff49cd62c47cc4781191c50fac21ee5e7bd8 Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Tue, 14 Nov 2023 04:19:05 +0000 Subject: [PATCH] Use consistent namespace for `Cardano.Api.ShelleyLedgerEra`. --- .../Internal/Cardano/Write/Tx/Balance.hs | 88 ++++++++++--------- .../Write/Tx/Balance/TokenBundleSize.hs | 4 +- .../Internal/Cardano/Write/Tx/Redeemers.hs | 33 +++---- .../Internal/Cardano/Write/Tx/Sign.hs | 14 +-- .../Write/Tx/Balance/TokenBundleSizeSpec.hs | 4 +- .../Internal/Cardano/Write/Tx/BalanceSpec.hs | 25 +++--- 6 files changed, 87 insertions(+), 81 deletions(-) diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs index 9d4675931d6..f3fb612ba8d 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs @@ -217,7 +217,6 @@ import Internal.Cardano.Write.Tx , RecentEra (..) , RecentEraConstraints , RecentEraLedgerConstraints - , ShelleyLedgerEra , Tx , TxBody , TxIn @@ -361,7 +360,7 @@ instance Buildable (BuildableInAnyEra a) where -- data ErrBalanceTxInsufficientCollateralError era = ErrBalanceTxInsufficientCollateralError - { largestCombinationAvailable :: UTxO (ShelleyLedgerEra era) + { largestCombinationAvailable :: UTxO (CardanoApi.ShelleyLedgerEra era) -- ^ The largest available combination of pure ada UTxOs. , minimumCollateralAmount :: Coin -- ^ The minimum quantity of ada necessary for collateral. @@ -369,11 +368,11 @@ data ErrBalanceTxInsufficientCollateralError era = deriving Generic deriving instance - RecentEraLedgerConstraints (ShelleyLedgerEra era) => + RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => Eq (ErrBalanceTxInsufficientCollateralError era) deriving instance - RecentEraLedgerConstraints (ShelleyLedgerEra era) => + RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => Show (ErrBalanceTxInsufficientCollateralError era) -- | Indicates that there was not enough ada available to create change outputs. @@ -419,7 +418,8 @@ data ErrBalanceTxAssetsInsufficientError = ErrBalanceTxAssetsInsufficientError data ErrBalanceTxInternalError era = RecentEraConstraints era => - ErrUnderestimatedFee Coin (Tx (ShelleyLedgerEra era)) KeyWitnessCount + ErrUnderestimatedFee + Coin (Tx (CardanoApi.ShelleyLedgerEra era)) KeyWitnessCount | ErrFailedBalancing Value deriving instance Eq (ErrBalanceTxInternalError era) @@ -433,15 +433,19 @@ data ErrBalanceTx era | ErrBalanceTxExistingCollateral | ErrBalanceTxExistingTotalCollateral | ErrBalanceTxExistingReturnCollateral - | RecentEraLedgerConstraints (ShelleyLedgerEra era) + | RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => ErrBalanceTxInsufficientCollateral (ErrBalanceTxInsufficientCollateralError era) | ErrBalanceTxConflictingNetworks | ErrBalanceTxAssignRedeemers ErrAssignRedeemers | ErrBalanceTxInternalError (ErrBalanceTxInternalError era) - | RecentEraLedgerConstraints (ShelleyLedgerEra era) - => ErrBalanceTxInputResolutionConflicts - (NonEmpty (TxOut (ShelleyLedgerEra era), TxOut (ShelleyLedgerEra era))) + | RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => + ErrBalanceTxInputResolutionConflicts + (NonEmpty + ( TxOut (CardanoApi.ShelleyLedgerEra era) + , TxOut (CardanoApi.ShelleyLedgerEra era) + ) + ) | ErrBalanceTxUnresolvedInputs (NonEmpty TxIn) | ErrBalanceTxOutputError ErrBalanceTxOutputError | ErrBalanceTxUnableToCreateChange ErrBalanceTxUnableToCreateChangeError @@ -469,23 +473,23 @@ deriving instance Show (ErrBalanceTx era) -- and instead adjust the existing redeemer indexes ourselves when balancing, -- even though they are in an "unordered" set. data PartialTx era = PartialTx - { tx :: Tx (ShelleyLedgerEra era) - , inputs :: UTxO (ShelleyLedgerEra era) + { tx :: Tx (CardanoApi.ShelleyLedgerEra era) + , inputs :: UTxO (CardanoApi.ShelleyLedgerEra era) -- ^ NOTE: Can we rename this to something better? Perhaps 'extraUTxO'? , redeemers :: [Redeemer] } deriving Generic deriving instance - RecentEraLedgerConstraints (ShelleyLedgerEra era) => + RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => Eq (PartialTx era) deriving instance - RecentEraLedgerConstraints (ShelleyLedgerEra era) => + RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => Show (PartialTx era) instance - RecentEraLedgerConstraints (ShelleyLedgerEra era) => + RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => Buildable (PartialTx era) where build (PartialTx tx (UTxO ins) redeemers) @@ -497,18 +501,18 @@ instance where inF = build . show - txF :: Tx (ShelleyLedgerEra era) -> Builder + txF :: Tx (CardanoApi.ShelleyLedgerEra era) -> Builder txF tx' = pretty $ pShow tx' data UTxOIndex era = UTxOIndex { walletUTxO :: !W.UTxO , walletUTxOIndex :: !(UTxOIndex.UTxOIndex WalletUTxO) - , ledgerUTxO :: !(UTxO (ShelleyLedgerEra era)) + , ledgerUTxO :: !(UTxO (CardanoApi.ShelleyLedgerEra era)) } constructUTxOIndex :: forall era. IsRecentEra era - => UTxO (ShelleyLedgerEra era) + => UTxO (CardanoApi.ShelleyLedgerEra era) -> UTxOIndex era constructUTxOIndex ledgerUTxO = UTxOIndex {walletUTxO, walletUTxOIndex, ledgerUTxO} @@ -520,14 +524,14 @@ constructUTxOIndex ledgerUTxO = fromWalletUTxO :: RecentEra era -> W.UTxO - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) fromWalletUTxO era (W.UTxO m) = withConstraints era $ UTxO $ Map.mapKeys Convert.toLedger $ Map.map (toLedgerTxOut era) m toWalletUTxO :: RecentEra era - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) -> W.UTxO toWalletUTxO era (UTxO m) = withConstraints era $ W.UTxO $ Map.mapKeys Convert.toWallet @@ -872,8 +876,8 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment guardTxSize :: KeyWitnessCount - -> Tx (ShelleyLedgerEra era) - -> ExceptT (ErrBalanceTx era) m (Tx (ShelleyLedgerEra era)) + -> Tx (CardanoApi.ShelleyLedgerEra era) + -> ExceptT (ErrBalanceTx era) m (Tx (CardanoApi.ShelleyLedgerEra era)) guardTxSize witCount tx = withConstraints era $ do let maxSize = W.TxSize (pp ^. ppMaxTxSizeL) @@ -882,8 +886,8 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment pure tx guardTxBalanced - :: Tx (ShelleyLedgerEra era) - -> ExceptT (ErrBalanceTx era) m (Tx (ShelleyLedgerEra era)) + :: Tx (CardanoApi.ShelleyLedgerEra era) + -> ExceptT (ErrBalanceTx era) m (Tx (CardanoApi.ShelleyLedgerEra era)) guardTxBalanced tx = do let bal = txBalance tx if bal == mempty @@ -892,14 +896,14 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment $ ErrBalanceTxInternalError $ ErrFailedBalancing bal - txBalance :: Tx (ShelleyLedgerEra era) -> Value + txBalance :: Tx (CardanoApi.ShelleyLedgerEra era) -> Value txBalance = withConstraints era . evaluateTransactionBalance era pp combinedUTxO . txBody era balanceAfterSettingMinFee - :: Tx (ShelleyLedgerEra era) + :: Tx (CardanoApi.ShelleyLedgerEra era) -> ExceptT (ErrBalanceTx era) m (CardanoApi.Value, CardanoApi.Lovelace, KeyWitnessCount) balanceAfterSettingMinFee tx = ExceptT . pure $ do @@ -928,7 +932,7 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment -- NOTE: Representing the wallet utxo as a @CardanoApi.UTxO@ will not make -- this check easier, even if it may be useful in other regards. guardWalletUTxOConsistencyWith - :: UTxO (ShelleyLedgerEra era) + :: UTxO (CardanoApi.ShelleyLedgerEra era) -> ExceptT (ErrBalanceTx era) m () guardWalletUTxOConsistencyWith u' = do let W.UTxO u = toWalletUTxO (recentEra @era) u' @@ -945,7 +949,7 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment $ withConstraints era $ ErrBalanceTxInputResolutionConflicts (c :| cs) - combinedUTxO :: UTxO (ShelleyLedgerEra era) + combinedUTxO :: UTxO (CardanoApi.ShelleyLedgerEra era) combinedUTxO = withConstraints era $ mconcat -- The @CardanoApi.UTxO@ can contain strictly more information than -- @W.UTxO@. Therefore we make the user-specified @inputUTxO@ to take @@ -964,14 +968,14 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment $ outputs era $ txBody era tx where - fromLedgerTxOut :: TxOut (ShelleyLedgerEra era) -> W.TxOut + fromLedgerTxOut :: TxOut (CardanoApi.ShelleyLedgerEra era) -> W.TxOut fromLedgerTxOut o = case era of RecentEraBabbage -> Convert.fromBabbageTxOut o RecentEraConway -> Convert.fromConwayTxOut o assembleTransaction :: TxUpdate - -> ExceptT (ErrBalanceTx era) m (Tx (ShelleyLedgerEra era)) + -> ExceptT (ErrBalanceTx era) m (Tx (CardanoApi.ShelleyLedgerEra era)) assembleTransaction update = ExceptT . pure $ do tx' <- left ErrBalanceTxUpdateError $ updateTx era partialTx update left ErrBalanceTxAssignRedeemers $ @@ -979,7 +983,7 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment era pp timeTranslation combinedUTxO redeemers tx' guardExistingCollateral - :: Tx (ShelleyLedgerEra era) + :: Tx (CardanoApi.ShelleyLedgerEra era) -> ExceptT (ErrBalanceTx era) m () guardExistingCollateral tx = withConstraints era $ do -- Coin selection does not support pre-defining collateral. In Sep 2021 @@ -991,7 +995,7 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment throwE ErrBalanceTxExistingCollateral guardExistingTotalCollateral - :: Tx (ShelleyLedgerEra era) + :: Tx (CardanoApi.ShelleyLedgerEra era) -> ExceptT (ErrBalanceTx era) m () guardExistingTotalCollateral tx = withConstraints era $ do let totColl = tx ^. (bodyTxL . totalCollateralTxBodyL) @@ -1000,7 +1004,7 @@ balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment SJust _ -> throwE ErrBalanceTxExistingTotalCollateral guardExistingReturnCollateral - :: Tx (ShelleyLedgerEra era) + :: Tx (CardanoApi.ShelleyLedgerEra era) -> ExceptT (ErrBalanceTx era) m () guardExistingReturnCollateral tx = withConstraints era $ do let collRet = tx ^. (bodyTxL . collateralReturnTxBodyL) @@ -1115,7 +1119,7 @@ selectAssets era (ProtocolParameters pp) utxoAssumptions outs redeemers => RecentEra era -> W.Address -> W.TokenBundle - -> TxOut (ShelleyLedgerEra era) + -> TxOut (CardanoApi.ShelleyLedgerEra era) mkLedgerTxOut txOutEra address bundle = case txOutEra of RecentEraBabbage -> Convert.toBabbageTxOut txOut @@ -1271,9 +1275,9 @@ newtype ErrUpdateSealedTx -- be used to *add* tx body content. updateTx :: forall era. RecentEra era - -> Tx (ShelleyLedgerEra era) + -> Tx (CardanoApi.ShelleyLedgerEra era) -> TxUpdate - -> Either ErrUpdateSealedTx (Tx (ShelleyLedgerEra era)) + -> Either ErrUpdateSealedTx (Tx (CardanoApi.ShelleyLedgerEra era)) updateTx era tx extraContent = withConstraints era $ do let tx' = tx & over bodyTxL (modifyShelleyTxBody extraContent era) @@ -1292,7 +1296,9 @@ updateTx era tx extraContent = withConstraints era $ do TxUpdate _ _ _ extraInputScripts _ = extraContent extraInputScripts' - :: Map (ScriptHash StandardCrypto) (Script (ShelleyLedgerEra era)) + :: Map + (ScriptHash StandardCrypto) + (Script (CardanoApi.ShelleyLedgerEra era)) extraInputScripts' = withConstraints era $ Map.fromList $ map (pairWithHash . convert) extraInputScripts where @@ -1302,7 +1308,7 @@ updateTx era tx extraContent = withConstraints era $ do toLedgerScript :: CA.Script CA.KeyHash -> RecentEra era - -> Core.Script (ShelleyLedgerEra era) + -> Core.Script (CardanoApi.ShelleyLedgerEra era) toLedgerScript s = \case RecentEraBabbage -> TimelockScript $ Convert.toLedgerTimelockScript s RecentEraConway -> TimelockScript $ Convert.toLedgerTimelockScript s @@ -1310,8 +1316,8 @@ updateTx era tx extraContent = withConstraints era $ do modifyShelleyTxBody :: forall era. TxUpdate -> RecentEra era - -> TxBody (ShelleyLedgerEra era) - -> TxBody (ShelleyLedgerEra era) + -> TxBody (CardanoApi.ShelleyLedgerEra era) + -> TxBody (CardanoApi.ShelleyLedgerEra era) modifyShelleyTxBody txUpdate era = withConstraints era $ over feeTxBodyL modifyFee . over outputsTxBodyL @@ -1551,7 +1557,7 @@ toLedgerTxOut :: HasCallStack => RecentEra era -> W.TxOut - -> TxOut (ShelleyLedgerEra era) + -> TxOut (CardanoApi.ShelleyLedgerEra era) toLedgerTxOut txOutEra txOut = case txOutEra of RecentEraBabbage -> Convert.toBabbageTxOut txOut @@ -1559,7 +1565,7 @@ toLedgerTxOut txOutEra txOut = toWalletTxOut :: RecentEra era - -> TxOut (ShelleyLedgerEra era) + -> TxOut (CardanoApi.ShelleyLedgerEra era) -> W.TxOut toWalletTxOut RecentEraBabbage = Convert.fromBabbageTxOut toWalletTxOut RecentEraConway = Convert.fromConwayTxOut diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs index 076e80e525d..334f9f276a4 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs @@ -31,12 +31,12 @@ import Data.IntCast import Internal.Cardano.Write.Tx ( PParams , RecentEra - , ShelleyLedgerEra , Value , Version , withConstraints ) +import qualified Cardano.Api.Shelley as CardanoApi import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W ( TokenBundle ) @@ -53,7 +53,7 @@ import qualified Data.ByteString.Lazy as BL -- mkTokenBundleSizeAssessor :: RecentEra era - -> PParams (ShelleyLedgerEra era) + -> PParams (CardanoApi.ShelleyLedgerEra era) -> TokenBundleSizeAssessor mkTokenBundleSizeAssessor era pp = TokenBundleSizeAssessor $ \tb -> if computeTokenBundleSerializedLengthBytes tb ver > maxValSize diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs index a5b0bf7306e..8fa75c98e1b 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs @@ -99,7 +99,6 @@ import Internal.Cardano.Write.Tx ( PParams , RecentEra , RecentEraLedgerConstraints - , ShelleyLedgerEra , StandardCrypto , UTxO , txBody @@ -141,12 +140,12 @@ data ErrAssignRedeemers assignScriptRedeemers :: forall era. RecentEra era - -> PParams (ShelleyLedgerEra era) + -> PParams (CardanoApi.ShelleyLedgerEra era) -> TimeTranslation - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) -> [Redeemer] - -> Tx (ShelleyLedgerEra era) - -> Either ErrAssignRedeemers (Tx (ShelleyLedgerEra era)) + -> Tx (CardanoApi.ShelleyLedgerEra era) + -> Either ErrAssignRedeemers (Tx (CardanoApi.ShelleyLedgerEra era)) assignScriptRedeemers era pparams timeTranslation utxo redeemers tx = withConstraints era $ do flip execStateT tx $ do @@ -167,11 +166,11 @@ assignScriptRedeemers era pparams timeTranslation utxo redeemers tx = -- Redeemers are determined from the context given to the caller via the -- 'Redeemer' type which is mapped to an 'Alonzo.ScriptPurpose'. assignNullRedeemers - :: RecentEraLedgerConstraints (ShelleyLedgerEra era) - => Tx (ShelleyLedgerEra era) + :: RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) + => Tx (CardanoApi.ShelleyLedgerEra era) -> Either ErrAssignRedeemers ( Map Alonzo.RdmrPtr Redeemer - , Tx (ShelleyLedgerEra era) + , Tx (CardanoApi.ShelleyLedgerEra era) ) assignNullRedeemers ledgerTx = do (indexedRedeemers, nullRedeemers) <- @@ -200,7 +199,7 @@ assignScriptRedeemers era pparams timeTranslation utxo redeemers tx = -- | Evaluate execution units of each script/redeemer in the transaction. -- This may fail for each script. evaluateExecutionUnits - :: RecentEraLedgerConstraints (ShelleyLedgerEra era) + :: RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => Map Alonzo.RdmrPtr Redeemer -> Tx (CardanoApi.ShelleyLedgerEra era) -> Either ErrAssignRedeemers @@ -223,10 +222,10 @@ assignScriptRedeemers era pparams timeTranslation utxo redeemers tx = -- | Change execution units for each redeemers in the transaction to what -- they ought to be. assignExecutionUnits - :: RecentEraLedgerConstraints (ShelleyLedgerEra era) + :: RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) => Map Alonzo.RdmrPtr (Either ErrAssignRedeemers Alonzo.ExUnits) - -> Tx (ShelleyLedgerEra era) - -> Either ErrAssignRedeemers (Tx (ShelleyLedgerEra era)) + -> Tx (CardanoApi.ShelleyLedgerEra era) + -> Either ErrAssignRedeemers (Tx (CardanoApi.ShelleyLedgerEra era)) assignExecutionUnits exUnits ledgerTx = do let Alonzo.Redeemers rdmrs = view (witsTxL . rdmrsTxWitsL) ledgerTx @@ -249,9 +248,9 @@ assignScriptRedeemers era pparams timeTranslation utxo redeemers tx = -- | Finally, calculate and add the script integrity hash with the new -- final redeemers, if any. addScriptIntegrityHash - :: RecentEraLedgerConstraints (ShelleyLedgerEra era) - => Tx (ShelleyLedgerEra era) - -> Tx (ShelleyLedgerEra era) + :: RecentEraLedgerConstraints (CardanoApi.ShelleyLedgerEra era) + => Tx (CardanoApi.ShelleyLedgerEra era) + -> Tx (CardanoApi.ShelleyLedgerEra era) addScriptIntegrityHash ledgerTx = ledgerTx & (bodyTxL . scriptIntegrityHashTxBodyL) .~ Alonzo.hashScriptIntegrity @@ -263,7 +262,9 @@ assignScriptRedeemers era pparams timeTranslation utxo redeemers tx = langs = [ l | (_hash, script) <- Map.toList (Alonzo.txscripts wits) - , (not . Ledger.isNativeScript @(ShelleyLedgerEra era)) script + , ( not + . Ledger.isNativeScript @(CardanoApi.ShelleyLedgerEra era) + ) script , Just l <- [Alonzo.language script] ] diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs index f3529ec2f1b..c808e188dee 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs @@ -58,7 +58,6 @@ import Internal.Cardano.Write.Tx , KeyWitnessCount (..) , PParams , RecentEra (..) - , ShelleyLedgerEra , Tx , TxIn , UTxO @@ -91,9 +90,10 @@ import qualified Internal.Cardano.Write.Tx as Write -- NOTE: Existing key witnesses in the tx are ignored. estimateSignedTxSize :: forall era. RecentEra era - -> PParams (ShelleyLedgerEra era) + -> PParams (CardanoApi.ShelleyLedgerEra era) -> KeyWitnessCount - -> Tx (ShelleyLedgerEra era) -- ^ existing wits in tx are ignored + -> Tx (CardanoApi.ShelleyLedgerEra era) + -- ^ existing wits in tx are ignored -> W.TxSize estimateSignedTxSize era pparams nWits txWithWits = withConstraints era $ let @@ -125,7 +125,7 @@ estimateSignedTxSize era pparams nWits txWithWits = withConstraints era $ in sizeOfTx <> sizeOfWits where - unsignedTx :: Tx (ShelleyLedgerEra era) + unsignedTx :: Tx (CardanoApi.ShelleyLedgerEra era) unsignedTx = withConstraints era $ txWithWits & (witsTxL . addrTxWitsL) .~ mempty @@ -161,7 +161,7 @@ numberOfShelleyWitnesses n = KeyWitnessCount n 0 -- we cannot use because it requires a 'TxBodyContent BuildTx era'. estimateKeyWitnessCount :: forall era. IsRecentEra era - => UTxO (ShelleyLedgerEra era) + => UTxO (CardanoApi.ShelleyLedgerEra era) -- ^ Must contain all inputs from the 'TxBody' or -- 'estimateKeyWitnessCount will 'error'. -> CardanoApi.TxBody era @@ -265,7 +265,7 @@ estimateKeyWitnessCount utxo txbody@(CardanoApi.TxBody txbodycontent) = Alonzo.PlutusScript _ _ -> Nothing hasScriptCred - :: UTxO (ShelleyLedgerEra era) + :: UTxO (CardanoApi.ShelleyLedgerEra era) -> TxIn -> Bool hasScriptCred u inp = withConstraints (recentEra @era) $ @@ -280,7 +280,7 @@ estimateKeyWitnessCount utxo txbody@(CardanoApi.TxBody txbodycontent) = ] hasBootstrapAddr - :: UTxO (ShelleyLedgerEra era) + :: UTxO (CardanoApi.ShelleyLedgerEra era) -> TxIn -> Bool hasBootstrapAddr u inp = withConstraints (recentEra @era) $ diff --git a/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs b/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs index 57100b50e46..ed22b64f7bc 100644 --- a/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs +++ b/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs @@ -33,7 +33,6 @@ import Data.Word import Internal.Cardano.Write.Tx ( ProtVer (..) , RecentEra (..) - , ShelleyLedgerEra , StandardBabbage , StandardConway , Version @@ -69,6 +68,7 @@ import Test.QuickCheck , (==>) ) +import qualified Cardano.Api.Shelley as CardanoApi import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W.TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W ( TokenBundle @@ -282,7 +282,7 @@ instance Arbitrary PParamsInRecentEra where where genPParams :: RecentEra era - -> Gen (PParams (ShelleyLedgerEra era)) + -> Gen (PParams (CardanoApi.ShelleyLedgerEra era)) genPParams era = withConstraints era $ do ver <- arbitrary maxSize <- genMaxSizeBytes diff --git a/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs b/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs index f3435aad9b3..692e64a086c 100644 --- a/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs +++ b/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs @@ -249,7 +249,6 @@ import Internal.Cardano.Write.Tx , InAnyRecentEra (..) , IsRecentEra (..) , RecentEra (..) - , ShelleyLedgerEra , Tx , TxIn , TxOut @@ -1108,7 +1107,7 @@ spec_estimateSignedTxSize = describe "estimateSignedTxSize" $ do body era = recentEra @era - tx :: Tx (ShelleyLedgerEra era) + tx :: Tx (CardanoApi.ShelleyLedgerEra era) tx = fromCardanoApiTx @era cTx noScripts = withConstraints (recentEra @era) @@ -1170,8 +1169,8 @@ spec_estimateSignedTxSize = describe "estimateSignedTxSize" $ do :: forall era. HasCallStack => RecentEra era -> W.Address - -> Tx (ShelleyLedgerEra era) - -> UTxO (ShelleyLedgerEra era) + -> Tx (CardanoApi.ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) utxoPromisingInputsHaveAddress era addr tx = utxoFromTxOutsInRecentEra era $ [ (i @@ -1185,7 +1184,7 @@ spec_estimateSignedTxSize = describe "estimateSignedTxSize" $ do ] where allInputs - :: Tx (ShelleyLedgerEra era) + :: Tx (CardanoApi.ShelleyLedgerEra era) -> [TxIn] allInputs body = withConstraints era $ Set.toList @@ -1487,7 +1486,7 @@ prop_balanceTransactionValid prop_expectFeeExcessSmallerThan :: CardanoApi.Lovelace -> CardanoApi.Tx era - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) -> Property prop_expectFeeExcessSmallerThan lim tx utxo = do let fee = txFee tx @@ -1506,7 +1505,7 @@ prop_balanceTransactionValid prop_minfeeIsCovered :: CardanoApi.Tx era - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) -> Property prop_minfeeIsCovered tx utxo = do let fee = txFee tx @@ -1525,7 +1524,7 @@ prop_balanceTransactionValid prop_validSize :: CardanoApi.Tx era - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) -> Property prop_validSize tx@(CardanoApi.Tx body _) utxo = do let era = recentEra @era @@ -1593,7 +1592,7 @@ prop_balanceTransactionValid minFee :: CardanoApi.Tx era - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) -> CardanoApi.Lovelace minFee tx@(CardanoApi.Tx body _) utxo = Write.toCardanoApiLovelace $ Write.evaluateMinimumFee (recentEra @era) ledgerPParams @@ -1602,7 +1601,7 @@ prop_balanceTransactionValid txBalance :: CardanoApi.Tx era - -> UTxO (ShelleyLedgerEra era) + -> UTxO (CardanoApi.ShelleyLedgerEra era) -> CardanoApi.Value txBalance tx u = Write.toCardanoApiValue @era $ Write.evaluateTransactionBalance @@ -2295,7 +2294,7 @@ cardanoToWalletTxOut cardanoToWalletTxOut = toWallet . CardanoApi.toShelleyTxOut (Write.shelleyBasedEra @era) where - toWallet :: TxOut (ShelleyLedgerEra era) -> W.TxOut + toWallet :: TxOut (CardanoApi.ShelleyLedgerEra era) -> W.TxOut toWallet x = case recentEra @era of RecentEraBabbage -> Convert.fromBabbageTxOut x RecentEraConway -> Convert.fromConwayTxOut x @@ -2816,8 +2815,8 @@ shrinkInputResolution ( IsRecentEra era , Arbitrary (CardanoApi.TxOut CardanoApi.CtxUTxO era) ) - => Write.UTxO (ShelleyLedgerEra era) - -> [Write.UTxO (ShelleyLedgerEra era)] + => Write.UTxO (CardanoApi.ShelleyLedgerEra era) + -> [Write.UTxO (CardanoApi.ShelleyLedgerEra era)] shrinkInputResolution = shrinkMapBy utxoFromList utxoToList shrinkUTxOEntries where