Skip to content

Commit 4d330c5

Browse files
committed
Remove Fields types from Generic tests
1 parent 7cb77b5 commit 4d330c5

File tree

40 files changed

+2829
-4359
lines changed

40 files changed

+2829
-4359
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ module Test.Cardano.Ledger.Allegra.Era (
99
import Cardano.Ledger.Allegra
1010
import Cardano.Ledger.Allegra.Core
1111
import Cardano.Ledger.Allegra.Scripts
12+
import Cardano.Ledger.Plutus (emptyCostModels)
1213
import Test.Cardano.Ledger.Allegra.Arbitrary ()
1314
import Test.Cardano.Ledger.Allegra.TreeDiff ()
14-
import Test.Cardano.Ledger.Era
1515
import Test.Cardano.Ledger.Shelley.Era
1616

1717
class
@@ -22,7 +22,8 @@ class
2222
) =>
2323
AllegraEraTest era
2424

25-
instance EraTest AllegraEra
25+
instance EraTest AllegraEra where
26+
zeroCostModels = emptyCostModels
2627

2728
instance ShelleyEraTest AllegraEra
2829

eras/alonzo/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.14.0.0
44

5+
* Add `Generic` instance to `TransactionScriptFailure`
56
* Add `Generic` instance for `AlonzoBbodyEvent`
67
* Fix `AlonzoPlutusPurpose` CBOR(Group) instances. #5135
78
* Reset shuffled serialization indexes for `AlonzoPlutusPurpose AsItem`.

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Plutus/Evaluate.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ data TransactionScriptFailure era
268268
NoCostModelInLedgerState !Language
269269
| -- | Error that can happen during plutus context translation
270270
ContextError !(ContextError era)
271+
deriving (Generic)
271272

272273
deriving instance
273274
( Era era

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ module Test.Cardano.Ledger.Alonzo.Era (
1212
import Cardano.Ledger.Alonzo
1313
import Cardano.Ledger.Alonzo.Core
1414
import Cardano.Ledger.Alonzo.Plutus.Context
15-
import Cardano.Ledger.Alonzo.Scripts ()
1615
import Cardano.Ledger.Alonzo.UTxO
16+
import Cardano.Ledger.Plutus (Language (..))
1717
import Data.TreeDiff
1818
import Test.Cardano.Ledger.Alonzo.Arbitrary ()
1919
import Test.Cardano.Ledger.Alonzo.TreeDiff ()
2020
import Test.Cardano.Ledger.Mary.Era
21+
import Test.Cardano.Ledger.Plutus (zeroTestingCostModels)
2122

2223
class
2324
( MaryEraTest era
@@ -32,7 +33,8 @@ class
3233
) =>
3334
AlonzoEraTest era
3435

35-
instance EraTest AlonzoEra
36+
instance EraTest AlonzoEra where
37+
zeroCostModels = zeroTestingCostModels [PlutusV1]
3638

3739
instance ShelleyEraTest AlonzoEra
3840

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import Cardano.Ledger.Compactible
3131
import Cardano.Ledger.Plutus.Evaluate (PlutusWithContext (..))
3232
import Cardano.Ledger.Shelley.Rules
3333
import qualified Data.TreeDiff.OMap as OMap
34+
import PlutusLedgerApi.Common (EvaluationError (..), ExBudget, ExCPU, ExMemory, SatInt)
3435
import Test.Cardano.Ledger.Mary.TreeDiff
3536

3637
-- Scripts
@@ -183,3 +184,22 @@ instance
183184
instance
184185
ToExpr (Event (EraRule "LEDGERS" era)) =>
185186
ToExpr (AlonzoBbodyEvent era)
187+
188+
instance ToExpr EvaluationError where
189+
toExpr = toExpr . show
190+
191+
instance ToExpr SatInt
192+
193+
instance ToExpr ExCPU
194+
195+
instance ToExpr ExMemory
196+
197+
instance ToExpr ExBudget
198+
199+
instance
200+
( ToExpr (PlutusPurpose AsIx era)
201+
, ToExpr (PlutusPurpose AsItem era)
202+
, ToExpr (PlutusScript era)
203+
, ToExpr (ContextError era)
204+
) =>
205+
ToExpr (TransactionScriptFailure era)

eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/Era.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ module Test.Cardano.Ledger.Babbage.Era (
88

99
import Cardano.Ledger.Babbage
1010
import Cardano.Ledger.Babbage.Core
11+
import Cardano.Ledger.Plutus (Language (..))
1112
import Test.Cardano.Ledger.Alonzo.Era
1213
import Test.Cardano.Ledger.Babbage.Arbitrary ()
1314
import Test.Cardano.Ledger.Babbage.TreeDiff ()
15+
import Test.Cardano.Ledger.Plutus (zeroTestingCostModels)
1416

1517
class
1618
( AlonzoEraTest era
@@ -19,7 +21,8 @@ class
1921
) =>
2022
BabbageEraTest era
2123

22-
instance EraTest BabbageEra
24+
instance EraTest BabbageEra where
25+
zeroCostModels = zeroTestingCostModels [PlutusV1 .. PlutusV2]
2326

2427
instance ShelleyEraTest BabbageEra
2528

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import Cardano.Ledger.Conway
1010
import Cardano.Ledger.Conway.Core
1111
import Cardano.Ledger.Conway.Governance
1212
import Cardano.Ledger.Conway.State
13+
import Cardano.Ledger.Plutus (Language (..))
1314
import Test.Cardano.Ledger.Babbage.Era
1415
import Test.Cardano.Ledger.Conway.Arbitrary ()
1516
import Test.Cardano.Ledger.Conway.TreeDiff ()
17+
import Test.Cardano.Ledger.Plutus (zeroTestingCostModels)
1618

1719
class
1820
( BabbageEraTest era
@@ -22,7 +24,8 @@ class
2224
) =>
2325
ConwayEraTest era
2426

25-
instance EraTest ConwayEra
27+
instance EraTest ConwayEra where
28+
zeroCostModels = zeroTestingCostModels [PlutusV1 .. PlutusV3]
2629

2730
instance ShelleyEraTest ConwayEra
2831

eras/dijkstra/testlib/Test/Cardano/Ledger/Dijkstra/Era.hs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
{-# OPTIONS_GHC -Wno-orphans #-}
22

3-
module Test.Cardano.Ledger.Dijkstra.Era () where
3+
module Test.Cardano.Ledger.Dijkstra.Era (
4+
module Test.Cardano.Ledger.Conway.Era,
5+
) where
46

57
import Cardano.Ledger.Dijkstra (DijkstraEra)
6-
import Test.Cardano.Ledger.Conway.Era (
7-
AllegraEraTest,
8-
AlonzoEraTest,
9-
BabbageEraTest,
10-
ConwayEraTest,
11-
EraTest,
12-
MaryEraTest,
13-
ShelleyEraTest,
14-
)
8+
import Cardano.Ledger.Plutus (Language (..))
9+
import Test.Cardano.Ledger.Conway.Era
1510
import Test.Cardano.Ledger.Dijkstra.Arbitrary ()
1611
import Test.Cardano.Ledger.Dijkstra.TreeDiff ()
12+
import Test.Cardano.Ledger.Plutus (zeroTestingCostModels)
1713

18-
instance EraTest DijkstraEra
14+
instance EraTest DijkstraEra where
15+
zeroCostModels = zeroTestingCostModels [PlutusV1 .. PlutusV4]
1916

2017
instance ShelleyEraTest DijkstraEra
2118

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Test.Cardano.Ledger.Mary.Era (
88

99
import Cardano.Ledger.Mary
1010
import Cardano.Ledger.Mary.Core
11+
import Cardano.Ledger.Plutus (emptyCostModels)
1112
import Test.Cardano.Ledger.Allegra.Era
1213
import Test.Cardano.Ledger.Mary.Arbitrary ()
1314
import Test.Cardano.Ledger.Mary.TreeDiff ()
@@ -18,7 +19,8 @@ class
1819
) =>
1920
MaryEraTest era
2021

21-
instance EraTest MaryEra
22+
instance EraTest MaryEra where
23+
zeroCostModels = emptyCostModels
2224

2325
instance ShelleyEraTest MaryEra
2426

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{-# LANGUAGE FlexibleContexts #-}
2+
{-# LANGUAGE TypeApplications #-}
23
{-# LANGUAGE UndecidableSuperClasses #-}
34
{-# OPTIONS_GHC -Wno-orphans #-}
45

56
module Test.Cardano.Ledger.Shelley.Era (
6-
EraTest,
7+
EraTest (..),
78
ShelleyEraTest,
89
) where
910

11+
import Cardano.Ledger.Plutus (emptyCostModels)
1012
import Cardano.Ledger.Shelley
1113
import Cardano.Ledger.Shelley.LedgerState
1214
import Cardano.Ledger.Shelley.Scripts
@@ -33,6 +35,7 @@ class
3335
) =>
3436
ShelleyEraTest era
3537

36-
instance EraTest ShelleyEra
38+
instance EraTest ShelleyEra where
39+
zeroCostModels = emptyCostModels
3740

3841
instance ShelleyEraTest ShelleyEra

0 commit comments

Comments
 (0)