Skip to content

Commit 5b269d5

Browse files
committed
Remove Pretty from cardano-ledger-test
1 parent 82c3d9b commit 5b269d5

File tree

64 files changed

+1218
-5458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1218
-5458
lines changed

eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/Era.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE TypeOperators #-}
12
{-# LANGUAGE UndecidableSuperClasses #-}
23
{-# OPTIONS_GHC -Wno-orphans #-}
34

@@ -19,6 +20,7 @@ class
1920
, AllegraEraTxBody era
2021
, AllegraEraTxAuxData era
2122
, AllegraEraScript era
23+
, NativeScript era ~ Timelock era
2224
) =>
2325
AllegraEraTest era
2426

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/UTxO.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE BangPatterns #-}
22
{-# LANGUAGE DataKinds #-}
3+
{-# LANGUAGE DeriveGeneric #-}
34
{-# LANGUAGE FlexibleContexts #-}
45
{-# LANGUAGE FlexibleInstances #-}
56
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -63,13 +64,14 @@ import qualified Data.Map.Strict as Map
6364
import Data.Maybe (catMaybes, fromMaybe, isJust)
6465
import qualified Data.Set as Set
6566
import Data.Word (Word32)
67+
import GHC.Generics
6668
import Lens.Micro ((^.))
6769
import Lens.Micro.Extras (view)
6870

6971
-- | Alonzo era style `ScriptsNeeded` require also a `PlutusPurpose`, not only the `ScriptHash`
7072
newtype AlonzoScriptsNeeded era
7173
= AlonzoScriptsNeeded [(PlutusPurpose AsIxItem era, ScriptHash)]
72-
deriving (Monoid, Semigroup)
74+
deriving (Monoid, Semigroup, Generic)
7375

7476
deriving instance AlonzoEraScript era => Eq (AlonzoScriptsNeeded era)
7577

eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Era.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class
2626
, AlonzoEraTxAuxData era
2727
, AlonzoEraUTxO era
2828
, ToExpr (PlutusScript era)
29+
, ToExpr (PlutusPurpose AsIx era)
30+
, ToExpr (PlutusPurpose AsIxItem era)
2931
, Script era ~ AlonzoScript era
3032
) =>
3133
AlonzoEraTest era

eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/TreeDiff.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import Cardano.Ledger.Alonzo.Tx
2525
import Cardano.Ledger.Alonzo.TxAuxData
2626
import Cardano.Ledger.Alonzo.TxBody
2727
import Cardano.Ledger.Alonzo.TxWits
28+
import Cardano.Ledger.Alonzo.UTxO
2829
import Cardano.Ledger.BaseTypes
2930
import Cardano.Ledger.Compactible
3031
import Cardano.Ledger.Plutus.Evaluate (PlutusWithContext (..))
@@ -45,6 +46,12 @@ deriving newtype instance ToExpr ix => ToExpr (AsIx ix it)
4546

4647
deriving newtype instance ToExpr it => ToExpr (AsItem ix it)
4748

49+
instance (ToExpr ix, ToExpr it) => ToExpr (AsIxItem ix it)
50+
51+
instance ToExpr (PlutusPurpose AsIxItem era) => ToExpr (AlonzoScriptsNeeded era)
52+
53+
instance ToExpr (TxCert era) => ToExpr (AlonzoPlutusPurpose AsIxItem era)
54+
4855
-- Core
4956
deriving newtype instance ToExpr CoinPerWord
5057

@@ -168,3 +175,7 @@ instance
168175
, ("pwcExUnits", toExpr pwcExUnits)
169176
, ("pwcCostModel", toExpr pwcCostModel)
170177
]
178+
179+
instance
180+
ToExpr (PredicateFailure (EraRule "LEDGERS" era)) =>
181+
ToExpr (AlonzoBbodyPredFailure era)

eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Era.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE FlexibleContexts #-}
12
{-# LANGUAGE UndecidableSuperClasses #-}
23
{-# OPTIONS_GHC -Wno-orphans #-}
34

eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/TreeDiff.hs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ instance
4646
) =>
4747
ToExpr (ConwayPlutusPurpose AsItem era)
4848

49+
instance
50+
( ToExpr (TxCert era)
51+
, ToExpr (PParamsHKD StrictMaybe era)
52+
) =>
53+
ToExpr (ConwayPlutusPurpose AsIxItem era)
54+
4955
-- PlutusContext
5056
instance
5157
( Era era
@@ -127,6 +133,18 @@ instance
127133
where
128134
(a, b) = finishDRepPulser x
129135

136+
-- TODO: consider this
137+
instance
138+
( EraStake era
139+
, EraPParams era
140+
, ToExpr (DRepPulsingState era)
141+
, ToExpr (RatifyState era)
142+
, ToExpr (PParamsHKD StrictMaybe era)
143+
) =>
144+
ToExpr (DRepPulser era Identity (RatifyState era))
145+
where
146+
toExpr = toExpr . finishDRepPulser . DRPulsing
147+
130148
instance ToExpr (InstantStake era) => ToExpr (RatifyEnv era) where
131149
toExpr (RatifyEnv stake pool drep dstate ep cs delegatees poolps) =
132150
App
@@ -291,3 +309,7 @@ instance
291309
instance ToExpr (VState era)
292310

293311
instance ConwayEraCertState era => ToExpr (ConwayCertState era)
312+
313+
instance
314+
ToExpr (PredicateFailure (EraRule "LEDGERS" era)) =>
315+
ToExpr (ConwayBbodyPredFailure era)

eras/mary/impl/testlib/Test/Cardano/Ledger/Mary/TreeDiff.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ instance ToExpr AssetName where
3030

3131
deriving newtype instance ToExpr (CompactForm MaryValue)
3232

33-
instance ToExpr (TxBody MaryEra)
33+
instance ToExpr (TxBody MaryEra) -- TODO: investigate

eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Bbody.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import NoThunks.Class (NoThunks (..))
6565

6666
data ShelleyBbodyState era
6767
= BbodyState !(State (EraRule "LEDGERS" era)) !BlocksMade
68+
deriving (Generic)
6869

6970
deriving stock instance Show (State (EraRule "LEDGERS" era)) => Show (ShelleyBbodyState era)
7071

eras/shelley/impl/src/Cardano/Ledger/Shelley/UTxO.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{-# LANGUAGE BlockArguments #-}
44
{-# LANGUAGE ConstraintKinds #-}
55
{-# LANGUAGE DataKinds #-}
6+
{-# LANGUAGE DeriveGeneric #-}
67
{-# LANGUAGE DerivingVia #-}
78
{-# LANGUAGE FlexibleContexts #-}
89
{-# LANGUAGE FlexibleInstances #-}
@@ -79,6 +80,7 @@ import Data.Foldable (Foldable (fold), foldr', toList)
7980
import qualified Data.Map.Strict as Map
8081
import Data.Set (Set)
8182
import qualified Data.Set as Set
83+
import GHC.Generics (Generic)
8284
import Lens.Micro ((^.))
8385

8486
-- | Compute the subset of inputs of the set 'txIns' for which each input is
@@ -172,7 +174,7 @@ getConsumedCoin pp lookupRefund utxo txBody =
172174
withdrawals = fold . unWithdrawals $ txBody ^. withdrawalsTxBodyL
173175

174176
newtype ShelleyScriptsNeeded era = ShelleyScriptsNeeded (Set ScriptHash)
175-
deriving (Eq, Show)
177+
deriving (Eq, Show, Generic)
176178

177179
instance EraUTxO ShelleyEra where
178180
type ScriptsNeeded ShelleyEra = ShelleyScriptsNeeded ShelleyEra

eras/shelley/impl/testlib/Test/Cardano/Ledger/Shelley/Era.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module Test.Cardano.Ledger.Shelley.Era (
1010
import Cardano.Ledger.Shelley
1111
import Cardano.Ledger.Shelley.LedgerState
1212
import Cardano.Ledger.Shelley.Scripts
13+
import Cardano.Ledger.State
1314
import Data.Default
1415
import Test.Cardano.Ledger.Common
1516
import Test.Cardano.Ledger.Era
@@ -25,6 +26,7 @@ class
2526
, NFData (StashedAVVMAddresses era)
2627
, Default (StashedAVVMAddresses era)
2728
, Arbitrary (StashedAVVMAddresses era)
29+
, ToExpr (ScriptsNeeded era)
2830
) =>
2931
ShelleyEraTest era
3032

eras/shelley/impl/testlib/Test/Cardano/Ledger/Shelley/TreeDiff.hs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import Cardano.Ledger.Shelley.TxBody
2626
import Cardano.Ledger.Shelley.TxCert
2727
import Cardano.Ledger.Shelley.TxOut
2828
import Cardano.Ledger.Shelley.TxWits
29+
import Cardano.Ledger.Shelley.UTxO
2930
import Test.Cardano.Ledger.TreeDiff
3031

3132
-- PParams
@@ -159,6 +160,8 @@ instance
159160

160161
instance ToExpr (ShelleyInstantStake era)
161162

163+
instance ToExpr (ShelleyScriptsNeeded era)
164+
162165
-- Rules/Utxo
163166
instance
164167
( ToExpr (EraRuleFailure "PPUP" era)
@@ -279,3 +282,40 @@ instance
279282
ToExpr (ShelleyLedgersPredFailure era)
280283

281284
instance EraCertState era => ToExpr (ShelleyCertState era)
285+
286+
instance
287+
ToExpr (PredicateFailure (EraRule "LEDGERS" era)) =>
288+
ToExpr (ShelleyBbodyPredFailure era)
289+
290+
instance
291+
ToExpr (State (EraRule "LEDGERS" era)) =>
292+
ToExpr (ShelleyBbodyState era)
293+
294+
instance
295+
( ToExpr (PredicateFailure (EraRule "NEWEPOCH" era))
296+
, ToExpr (PredicateFailure (EraRule "RUPD" era))
297+
) =>
298+
ToExpr (ShelleyTickPredFailure era)
299+
300+
instance
301+
( ToExpr (PredicateFailure (EraRule "EPOCH" era))
302+
, ToExpr (PredicateFailure (EraRule "MIR" era))
303+
) =>
304+
ToExpr (ShelleyNewEpochPredFailure era)
305+
306+
instance
307+
( ToExpr (UpecPredFailure era)
308+
, ToExpr (PredicateFailure (EraRule "POOLREAP" era))
309+
, ToExpr (PredicateFailure (EraRule "SNAP" era))
310+
) =>
311+
ToExpr (ShelleyEpochPredFailure era)
312+
313+
instance ToExpr (ShelleyUpecPredFailure era)
314+
315+
instance ToExpr (ShelleyPoolreapPredFailure era)
316+
317+
instance ToExpr (ShelleySnapPredFailure era)
318+
319+
instance ToExpr (ShelleyMirPredFailure era)
320+
321+
instance ToExpr (ShelleyRupdPredFailure era)

libs/cardano-ledger-test/cardano-ledger-test.cabal

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,8 @@ library
9292
Test.Cardano.Ledger.Generic.Indexed
9393
Test.Cardano.Ledger.Generic.MockChain
9494
Test.Cardano.Ledger.Generic.ModelState
95-
Test.Cardano.Ledger.Generic.PrettyCore
96-
Test.Cardano.Ledger.Generic.PrettyTest
9795
Test.Cardano.Ledger.Generic.Proof
9896
Test.Cardano.Ledger.Generic.Properties
99-
Test.Cardano.Ledger.Generic.Same
10097
Test.Cardano.Ledger.Generic.Scriptic
10198
Test.Cardano.Ledger.Generic.Trace
10299
Test.Cardano.Ledger.Generic.TxGen
@@ -123,7 +120,6 @@ library
123120
QuickCheck,
124121
array,
125122
base >=4.18 && <5,
126-
bech32,
127123
bytestring,
128124
cardano-crypto,
129125
cardano-crypto-class,

0 commit comments

Comments
 (0)