Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eras/allegra/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

### `testlib`

* Make `Test.Cardano.Ledger.Allegra.Imp.spec` accept `Proxy era`
* In `Test.Cardano.Ledger.Allegra.Examples`:
- Remove `mkAllegraBasedExampleTx`, `exampleAllegraBasedTxBody`, `exampleAllegraBasedShelleyTxBody`
- Add `exampleAllegraBasedTx`
Expand Down
24 changes: 14 additions & 10 deletions eras/allegra/impl/test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Main where

Expand All @@ -8,18 +9,21 @@ import qualified Test.Cardano.Ledger.Allegra.Binary.Golden as Golden
import qualified Test.Cardano.Ledger.Allegra.BinarySpec as BinarySpec
import qualified Test.Cardano.Ledger.Allegra.Imp as Imp
import Test.Cardano.Ledger.Allegra.ImpTest ()
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Core.JSON (roundTripJsonEraSpec)
import Test.Cardano.Ledger.Era
import qualified Test.Cardano.Ledger.Shelley.Imp as Imp (shelleyEraSpecificSpec)
Comment thread
lehins marked this conversation as resolved.
import Test.Cardano.Ledger.Shelley.JSON (roundTripJsonShelleyEraSpec)

instance EraSpec AllegraEra where
eraImpSpec era = do
Imp.shelleyEraSpecificSpec era
Comment thread
lehins marked this conversation as resolved.
Comment thread
lehins marked this conversation as resolved.
Imp.spec era

main :: IO ()
main =
ledgerTestMain $
describe "Allegra" $ do
BinarySpec.spec
CddlSpec.spec
describe "Imp" $ do
Imp.spec @AllegraEra
roundTripJsonEraSpec @AllegraEra
roundTripJsonShelleyEraSpec @AllegraEra
Golden.spec @AllegraEra
ledgerEraTestMain @AllegraEra $ do
BinarySpec.spec
CddlSpec.spec
roundTripJsonEraSpec @AllegraEra
roundTripJsonShelleyEraSpec @AllegraEra
Golden.spec @AllegraEra
17 changes: 5 additions & 12 deletions eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/Imp.hs
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Cardano.Ledger.Allegra.Imp (spec) where

import Cardano.Ledger.Allegra (AllegraEra)
import Cardano.Ledger.Core
import Cardano.Ledger.Shelley.Rules
import Test.Cardano.Ledger.Allegra.ImpTest
import Test.Cardano.Ledger.Imp.Common
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp
import qualified Test.Cardano.Ledger.Shelley.Imp as Shelley

spec ::
forall era.
( ShelleyEraImp era
, EraSpecificSpec era
, Event (EraRule "RUPD" era) ~ RupdEvent
) =>
proxy era ->
Spec
spec = do
ShelleyImp.spec @era

instance EraSpecificSpec AllegraEra where
eraSpecificSpec = ShelleyImp.shelleyEraSpecificSpec
spec era = do
Shelley.spec era
describe "AllegraEra Onwards" $ pure ()
Comment thread
lehins marked this conversation as resolved.
2 changes: 2 additions & 0 deletions eras/alonzo/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

### `testlib`

* Add `proxy era` argument to `alonzoEraSpecificSpec`
* Make `Test.Cardano.Ledger.Alonzo.Imp.spec` accept `Proxy era`
* Add `genDatumPresent`
* Added `Proxy era` argument to `exUnitsRule`
* `TranslationInstance` has a new field `tiPlutusPurpose`
Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/cardano-ledger-alonzo.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ library
cardano-ledger-allegra ^>=1.10,
cardano-ledger-binary ^>=1.9,
cardano-ledger-core:{cardano-ledger-core, internal} ^>=1.21,
cardano-ledger-mary ^>=1.10.1,
cardano-ledger-mary ^>=1.11,
cardano-ledger-shelley ^>=1.19,
cardano-slotting,
cardano-strict-containers,
Expand Down
40 changes: 23 additions & 17 deletions eras/alonzo/impl/test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Main where

Expand All @@ -11,27 +12,32 @@ import qualified Test.Cardano.Ledger.Alonzo.BinarySpec as BinarySpec
import qualified Test.Cardano.Ledger.Alonzo.GoldenSpec as Golden
import qualified Test.Cardano.Ledger.Alonzo.GoldenTranslation as GoldenTranslation
import qualified Test.Cardano.Ledger.Alonzo.Imp as Imp
import qualified Test.Cardano.Ledger.Alonzo.Imp.TxInfoSpec as TxInfoImp
import qualified Test.Cardano.Ledger.Alonzo.Imp.TxInfoSpec as TxInfo
import Test.Cardano.Ledger.Alonzo.ImpTest ()
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Core.JSON (roundTripJsonEraSpec)
import Test.Cardano.Ledger.Era
import qualified Test.Cardano.Ledger.Shelley.Imp as Shelley
import Test.Cardano.Ledger.Shelley.JSON (roundTripJsonShelleyEraSpec)

instance EraSpec AlonzoEra where
eraImpSpec era = do
Shelley.shelleyEraSpecificSpec era
Imp.alonzoEraSpecificSpec era
Imp.spec era

main :: IO ()
main =
ledgerTestMain $
describe "Alonzo" $ do
BinarySpec.spec
Canonical.spec
CddlSpec.spec
roundTripJsonEraSpec @AlonzoEra
roundTripJsonShelleyEraSpec @AlonzoEra
GoldenTranslation.tests
Golden.spec
describe "Imp" $ do
Imp.spec @AlonzoEra
describe "CostModels" $ do
CostModelsSpec.spec @AlonzoEra
describe "TxWits" $ do
TxWitsSpec.spec @AlonzoEra
TxInfoImp.spec
ledgerEraTestMain @AlonzoEra $ do
BinarySpec.spec
Canonical.spec
CddlSpec.spec
roundTripJsonEraSpec @AlonzoEra
roundTripJsonShelleyEraSpec @AlonzoEra
GoldenTranslation.tests
Golden.spec
describe "CostModels" $ do
CostModelsSpec.spec @AlonzoEra
describe "TxWits" $ do
TxWitsSpec.spec @AlonzoEra
TxInfo.spec
48 changes: 18 additions & 30 deletions eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Imp.hs
Original file line number Diff line number Diff line change
@@ -1,51 +1,39 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Cardano.Ledger.Alonzo.Imp where

import Cardano.Ledger.Alonzo (AlonzoEra)
import Cardano.Ledger.Core
import Cardano.Ledger.Shelley.Core (ShelleyEraTxCert)
import Cardano.Ledger.Shelley.Rules
import qualified Test.Cardano.Ledger.Alonzo.Imp.BbodySpec as Bbody
import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxoSpec as Utxo
import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxosSpec as Utxos
import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxowSpec as Utxow
import qualified Test.Cardano.Ledger.Alonzo.Imp.BbodySpec as BBODY
import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxoSpec as UTXO
import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxosSpec as UTXOS
import qualified Test.Cardano.Ledger.Alonzo.Imp.UtxowSpec as UTXOW
import Test.Cardano.Ledger.Alonzo.ImpTest
import Test.Cardano.Ledger.Imp.Common
import qualified Test.Cardano.Ledger.Mary.Imp as MaryImp
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp
import qualified Test.Cardano.Ledger.Mary.Imp as Mary

spec ::
forall era.
( AlonzoEraImp era
, EraSpecificSpec era
, Event (EraRule "RUPD" era) ~ RupdEvent
) =>
proxy era ->
Spec
spec = do
MaryImp.spec @era
describe "AlonzoImpSpec" . withEachEraVersion @era $ do
Bbody.spec
Utxo.spec
Utxos.spec
Utxow.spec
spec era = do
Mary.spec era
describe "AlonzoEra Onwards" $ withImpInitEachEraVersion era $ do
BBODY.spec
UTXO.spec
UTXOS.spec
UTXOW.spec

alonzoEraSpecificSpec ::
forall era.
(AlonzoEraImp era, ShelleyEraTxCert era) =>
SpecWith (ImpInit (LedgerSpec era))
alonzoEraSpecificSpec = do
describe "Alonzo era specific Imp spec" $
describe "Certificates without deposits" $ do
Utxow.alonzoEraSpecificSpec

instance EraSpecificSpec AlonzoEra where
eraSpecificSpec =
ShelleyImp.shelleyEraSpecificSpec >> alonzoEraSpecificSpec
proxy era ->
Spec
alonzoEraSpecificSpec era = withImpInitEachEraVersion era $ do
describe "AlonzoEra Specific" $ do
UTXOW.alonzoEraSpecificSpec
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ alonzoEraSpecificSpec ::
forall era. (AlonzoEraImp era, ShelleyEraTxCert era) => SpecWith (ImpInit (LedgerSpec era))
alonzoEraSpecificSpec = do
describe "UTXOW" $ do
Valid.alonzoEraSpecificSpec
Invalid.alonzoEraSpecificSpec
describe "Certificates without deposits" $ do
Valid.alonzoEraSpecificSpec
Invalid.alonzoEraSpecificSpec
2 changes: 2 additions & 0 deletions eras/babbage/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

### `testlib`

* Add `proxy era` argument to `babbageEraSpecificSpec`
* Make `Test.Cardano.Ledger.Babbage.Imp.spec` accept `Proxy era`
* Add `Test.Cardano.Ledger.Babbage.Imp.PoolSpec` module with `babbageEraSpecificSpec`
* In `Test.Cardano.Ledger.Babbage.Examples`:
- Remove `mkBabbageBasedExampleTx`, `exampleBabbageBasedTxBody`
Expand Down
2 changes: 1 addition & 1 deletion eras/babbage/impl/cardano-ledger-babbage.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ library
cardano-ledger-alonzo ^>=1.16,
cardano-ledger-binary >=1.6,
cardano-ledger-core:{cardano-ledger-core, internal} >=1.20,
cardano-ledger-mary ^>=1.10.1,
cardano-ledger-mary ^>=1.11,
cardano-ledger-shelley ^>=1.19,
cardano-strict-containers,
containers,
Expand Down
38 changes: 23 additions & 15 deletions eras/babbage/impl/test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Main where

import Cardano.Ledger.Babbage (BabbageEra)
import qualified Test.Cardano.Ledger.Alonzo.Binary.CostModelsSpec as CostModelsSpec
import qualified Test.Cardano.Ledger.Alonzo.Binary.TxWitsSpec as TxWitsSpec
import qualified Test.Cardano.Ledger.Alonzo.Imp as Alonzo
import qualified Test.Cardano.Ledger.Babbage.Binary.CddlSpec as CddlSpec
import qualified Test.Cardano.Ledger.Babbage.BinarySpec as BinarySpec
import qualified Test.Cardano.Ledger.Babbage.GoldenSpec as Golden
Expand All @@ -14,22 +16,28 @@ import Test.Cardano.Ledger.Babbage.ImpTest ()
import qualified Test.Cardano.Ledger.Babbage.TxInfoSpec as TxInfo
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Core.JSON (roundTripJsonEraSpec)
import Test.Cardano.Ledger.Era
import qualified Test.Cardano.Ledger.Shelley.Imp as Shelley
import Test.Cardano.Ledger.Shelley.JSON (roundTripJsonShelleyEraSpec)

instance EraSpec BabbageEra where
eraImpSpec era = do
Shelley.shelleyEraSpecificSpec era
Alonzo.alonzoEraSpecificSpec era
Imp.babbageEraSpecificSpec era
Imp.spec era

main :: IO ()
main =
ledgerTestMain $
describe "Babbage" $ do
TxInfo.spec @BabbageEra
GoldenTranslation.spec
Golden.spec
BinarySpec.spec
CddlSpec.spec
roundTripJsonEraSpec @BabbageEra
roundTripJsonShelleyEraSpec @BabbageEra
describe "Imp" $ do
Imp.spec @BabbageEra
describe "CostModels" $ do
CostModelsSpec.spec @BabbageEra
describe "TxWits" $ do
TxWitsSpec.spec @BabbageEra
ledgerEraTestMain @BabbageEra $ do
TxInfo.spec @BabbageEra
GoldenTranslation.spec
Golden.spec
BinarySpec.spec
CddlSpec.spec
roundTripJsonEraSpec @BabbageEra
roundTripJsonShelleyEraSpec @BabbageEra
describe "CostModels" $ do
CostModelsSpec.spec @BabbageEra
describe "TxWits" $ do
TxWitsSpec.spec @BabbageEra
46 changes: 18 additions & 28 deletions eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/Imp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,40 @@
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Cardano.Ledger.Babbage.Imp (spec) where
module Test.Cardano.Ledger.Babbage.Imp (spec, babbageEraSpecificSpec) where

import Cardano.Ledger.Babbage (BabbageEra)
import Cardano.Ledger.Babbage.Core
import Cardano.Ledger.Babbage.State
import Cardano.Ledger.Shelley.Rules
import qualified Test.Cardano.Ledger.Alonzo.Imp as AlonzoImp
import qualified Test.Cardano.Ledger.Alonzo.Imp as Alonzo
import Test.Cardano.Ledger.Alonzo.ImpTest
import qualified Test.Cardano.Ledger.Babbage.Imp.PoolSpec as Pool
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxoSpec as Utxo
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxosSpec as Utxos
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxowSpec as Utxow
import qualified Test.Cardano.Ledger.Babbage.Imp.PoolSpec as POOL
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxoSpec as UTXO
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxosSpec as UTXOS
import qualified Test.Cardano.Ledger.Babbage.Imp.UtxowSpec as UTXOW
import Test.Cardano.Ledger.Babbage.ImpTest (BabbageEraImp)
import Test.Cardano.Ledger.Imp.Common
import qualified Test.Cardano.Ledger.Shelley.Imp as ShelleyImp

spec ::
forall era.
( BabbageEraImp era
, EraSpecificSpec era
, Event (EraRule "RUPD" era) ~ RupdEvent
) =>
proxy era ->
Spec
spec = do
AlonzoImp.spec @era
withEachEraVersion @era $
describe "BabbageImpSpec - era generic tests" $ do
Utxo.spec
Utxow.spec
Utxos.spec @era
spec era = do
Alonzo.spec era
describe "BabbageEra Onwards" $ withImpInitEachEraVersion era $ do
UTXO.spec
UTXOW.spec
UTXOS.spec

babbageEraSpecificSpec ::
forall era.
( BabbageEraImp era
, ShelleyEraAccounts era
, Event (EraRule "NEWEPOCH" era) ~ ShelleyNewEpochEvent era
) =>
SpecWith (ImpInit (LedgerSpec era))
babbageEraSpecificSpec = do
describe "Babbage era specific Imp spec" $
describe "POOL" Pool.babbageEraSpecificSpec

instance EraSpecificSpec BabbageEra where
eraSpecificSpec =
ShelleyImp.shelleyEraSpecificSpec
>> AlonzoImp.alonzoEraSpecificSpec
>> babbageEraSpecificSpec
proxy era ->
Spec
babbageEraSpecificSpec era = do
describe "BabbageEra Specific" $ withImpInitEachEraVersion era $ do
POOL.babbageEraSpecificSpec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ babbageEraSpecificSpec ::
, Event (EraRule "NEWEPOCH" era) ~ ShelleyNewEpochEvent era
) =>
SpecWith (ImpInit (LedgerSpec era))
babbageEraSpecificSpec = do
babbageEraSpecificSpec = describe "POOL" $ do
it "Pool to pool member rewards" $ do
-- This test attempts to reproduce the issue that appeared with the release of
-- `cardano-db-sync-10.6.1` (using `cardano-ledger-shelley-1.17.0.0`),
Expand Down
2 changes: 2 additions & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

### `testlib`

* Export `conwayEraSpecificSpec`
* Make `Test.Cardano.Ledger.Conway.Imp.spec` accept `Proxy era`
* In `Test.Cardano.Ledger.Conway.Examples`:
- Remove `mkConwayBasedExampleTx`, `exampleConwayBasedTxBody`
- Add `exampleConwayBasedTx`, `exampleConwayBasedTopTx`
Expand Down
Loading
Loading