{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Test.Cardano.Ledger.Conway.Spec (spec) where
import Cardano.Ledger.Alonzo.Plutus.Context (EraPlutusContext (..), EraPlutusTxInfo)
import Cardano.Ledger.Alonzo.Rules (
AlonzoUtxoPredFailure,
AlonzoUtxosPredFailure,
AlonzoUtxowPredFailure,
)
import Cardano.Ledger.Babbage.Rules (BabbageUtxoPredFailure, BabbageUtxowPredFailure)
import Cardano.Ledger.Babbage.TxInfo (BabbageContextError)
import Cardano.Ledger.BaseTypes (Inject)
import Cardano.Ledger.Binary (DecCBOR)
import Cardano.Ledger.Conway.Core (
AlonzoEraScript (..),
AsIx,
EraRule,
EraTx (..),
EraTxBody (..),
EraTxCert (..),
EraTxWits (..),
InjectRuleEvent,
InjectRuleFailure,
SafeToHash,
)
import Cardano.Ledger.Conway.Rules (
ConwayBbodyPredFailure,
ConwayCertsPredFailure,
ConwayDelegPredFailure,
ConwayEpochEvent,
ConwayGovCertPredFailure,
ConwayGovPredFailure,
ConwayHardForkEvent,
ConwayLedgerPredFailure,
ConwayNewEpochEvent,
ConwayUtxoPredFailure,
ConwayUtxowPredFailure,
)
import Cardano.Ledger.Conway.TxCert (ConwayTxCert)
import Cardano.Ledger.Conway.TxInfo (ConwayContextError)
import Cardano.Ledger.Plutus (Language (..))
import Cardano.Ledger.Plutus.Language (SLanguage (..))
import Cardano.Ledger.Shelley.API (ApplyTx)
import Cardano.Ledger.Shelley.LedgerState (StashedAVVMAddresses)
import Cardano.Ledger.Shelley.Rules (
ShelleyDelegPredFailure,
ShelleyPoolPredFailure,
ShelleyUtxoPredFailure,
ShelleyUtxowPredFailure,
)
import Control.State.Transition (STS (..))
import Data.Typeable (Typeable)
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.Babbage.TxInfoSpec as BabbageTxInfo
import Test.Cardano.Ledger.Common
import qualified Test.Cardano.Ledger.Conway.Binary.Regression as Regression
import qualified Test.Cardano.Ledger.Conway.BinarySpec as Binary
import qualified Test.Cardano.Ledger.Conway.CommitteeRatifySpec as CommitteeRatify
import qualified Test.Cardano.Ledger.Conway.DRepRatifySpec as DRepRatify
import qualified Test.Cardano.Ledger.Conway.Imp as Imp
import Test.Cardano.Ledger.Conway.ImpTest (ConwayEraImp)
import qualified Test.Cardano.Ledger.Conway.Proposals as Proposals
import qualified Test.Cardano.Ledger.Conway.SPORatifySpec as SPORatifySpec
import qualified Test.Cardano.Ledger.Conway.TxInfoSpec as TxInfo
import Test.Cardano.Ledger.Core.Binary.RoundTrip (RuleListEra)
import Test.Cardano.Ledger.Core.JSON (roundTripJsonEraSpec)
spec ::
forall era.
( EraPlutusTxInfo PlutusV1 era
, EraPlutusTxInfo PlutusV2 era
, EraPlutusTxInfo PlutusV3 era
, RuleListEra era
, ConwayEraImp era
, ApplyTx era
, DecCBOR (TxWits era)
, DecCBOR (TxBody era)
, DecCBOR (Tx era)
, Arbitrary (PlutusPurpose AsIx era)
, SafeToHash (TxWits era)
, StashedAVVMAddresses era ~ ()
, Inject (BabbageContextError era) (ContextError era)
, Inject (ConwayContextError era) (ContextError era)
, Event (EraRule "EPOCH" era) ~ ConwayEpochEvent era
, Event (EraRule "NEWEPOCH" era) ~ ConwayNewEpochEvent era
, Event (EraRule "HARDFORK" era) ~ ConwayHardForkEvent era
, InjectRuleFailure "BBODY" ConwayBbodyPredFailure era
, InjectRuleFailure "LEDGER" ConwayGovPredFailure era
, InjectRuleFailure "LEDGER" ConwayCertsPredFailure era
, InjectRuleFailure "LEDGER" BabbageUtxoPredFailure era
, InjectRuleFailure "LEDGER" BabbageUtxowPredFailure era
, InjectRuleFailure "LEDGER" AlonzoUtxoPredFailure era
, InjectRuleFailure "LEDGER" AlonzoUtxosPredFailure era
, InjectRuleFailure "LEDGER" AlonzoUtxowPredFailure era
, InjectRuleFailure "LEDGER" ShelleyDelegPredFailure era
, InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era
, InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era
, InjectRuleFailure "LEDGER" ShelleyPoolPredFailure era
, InjectRuleFailure "LEDGER" ConwayDelegPredFailure era
, InjectRuleFailure "LEDGER" ConwayGovCertPredFailure era
, InjectRuleFailure "LEDGER" ConwayLedgerPredFailure era
, InjectRuleFailure "LEDGER" ConwayUtxoPredFailure era
, InjectRuleFailure "LEDGER" ConwayUtxowPredFailure era
, InjectRuleEvent "TICK" ConwayEpochEvent era
, NFData (Event (EraRule "ENACT" era))
, ToExpr (Event (EraRule "ENACT" era))
, Eq (Event (EraRule "ENACT" era))
, Typeable (Event (EraRule "ENACT" era))
, ToExpr (Event (EraRule "BBODY" era))
, TxCert era ~ ConwayTxCert era
) =>
Spec
spec :: forall era.
(EraPlutusTxInfo 'PlutusV1 era, EraPlutusTxInfo 'PlutusV2 era,
EraPlutusTxInfo 'PlutusV3 era, RuleListEra era, ConwayEraImp era,
ApplyTx era, DecCBOR (TxWits era), DecCBOR (TxBody era),
DecCBOR (Tx era), Arbitrary (PlutusPurpose AsIx era),
SafeToHash (TxWits era), StashedAVVMAddresses era ~ (),
Inject (BabbageContextError era) (ContextError era),
Inject (ConwayContextError era) (ContextError era),
Event (EraRule "EPOCH" era) ~ ConwayEpochEvent era,
Event (EraRule "NEWEPOCH" era) ~ ConwayNewEpochEvent era,
Event (EraRule "HARDFORK" era) ~ ConwayHardForkEvent era,
InjectRuleFailure "BBODY" ConwayBbodyPredFailure era,
InjectRuleFailure "LEDGER" ConwayGovPredFailure era,
InjectRuleFailure "LEDGER" ConwayCertsPredFailure era,
InjectRuleFailure "LEDGER" BabbageUtxoPredFailure era,
InjectRuleFailure "LEDGER" BabbageUtxowPredFailure era,
InjectRuleFailure "LEDGER" AlonzoUtxoPredFailure era,
InjectRuleFailure "LEDGER" AlonzoUtxosPredFailure era,
InjectRuleFailure "LEDGER" AlonzoUtxowPredFailure era,
InjectRuleFailure "LEDGER" ShelleyDelegPredFailure era,
InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era,
InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era,
InjectRuleFailure "LEDGER" ShelleyPoolPredFailure era,
InjectRuleFailure "LEDGER" ConwayDelegPredFailure era,
InjectRuleFailure "LEDGER" ConwayGovCertPredFailure era,
InjectRuleFailure "LEDGER" ConwayLedgerPredFailure era,
InjectRuleFailure "LEDGER" ConwayUtxoPredFailure era,
InjectRuleFailure "LEDGER" ConwayUtxowPredFailure era,
InjectRuleEvent "TICK" ConwayEpochEvent era,
NFData (Event (EraRule "ENACT" era)),
ToExpr (Event (EraRule "ENACT" era)),
Eq (Event (EraRule "ENACT" era)),
Typeable (Event (EraRule "ENACT" era)),
ToExpr (Event (EraRule "BBODY" era)),
TxCert era ~ ConwayTxCert era) =>
Spec
spec =
String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Conway features" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
forall era. ConwayEraTest era => Spec
Proposals.spec @era
forall era.
(ConwayEraImp era, DecCBOR (TxAuxData era), DecCBOR (TxWits era),
DecCBOR (TxBody era), DecCBOR (Tx era),
Arbitrary (PlutusPurpose AsIx era), RuleListEra era,
StashedAVVMAddresses era ~ (), SafeToHash (TxWits era)) =>
Spec
Binary.spec @era
forall era. ConwayEraTest era => Spec
DRepRatify.spec @era
forall era. ConwayEraTest era => Spec
CommitteeRatify.spec @era
forall era. ConwayEraTest era => Spec
SPORatifySpec.spec @era
forall era. (HasCallStack, EraTest era) => Spec
roundTripJsonEraSpec @era
String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"Imp" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$
forall era.
(ConwayEraImp era,
Inject (BabbageContextError era) (ContextError era),
Inject (ConwayContextError era) (ContextError era),
InjectRuleFailure "LEDGER" ConwayGovPredFailure era,
InjectRuleFailure "LEDGER" ConwayCertsPredFailure era,
InjectRuleFailure "LEDGER" BabbageUtxoPredFailure era,
InjectRuleFailure "LEDGER" BabbageUtxowPredFailure era,
InjectRuleFailure "LEDGER" AlonzoUtxoPredFailure era,
InjectRuleFailure "LEDGER" AlonzoUtxosPredFailure era,
InjectRuleFailure "LEDGER" AlonzoUtxowPredFailure era,
InjectRuleFailure "LEDGER" ShelleyDelegPredFailure era,
InjectRuleFailure "LEDGER" ShelleyUtxoPredFailure era,
InjectRuleFailure "LEDGER" ShelleyUtxowPredFailure era,
InjectRuleFailure "LEDGER" ShelleyPoolPredFailure era,
InjectRuleFailure "LEDGER" ConwayDelegPredFailure era,
InjectRuleFailure "LEDGER" ConwayGovCertPredFailure era,
InjectRuleFailure "LEDGER" ConwayLedgerPredFailure era,
InjectRuleFailure "LEDGER" ConwayUtxoPredFailure era,
InjectRuleFailure "LEDGER" ConwayUtxowPredFailure era,
InjectRuleFailure "BBODY" ConwayBbodyPredFailure era,
InjectRuleEvent "TICK" ConwayEpochEvent era,
Event (EraRule "EPOCH" era) ~ ConwayEpochEvent era,
Event (EraRule "NEWEPOCH" era) ~ ConwayNewEpochEvent era,
Event (EraRule "HARDFORK" era) ~ ConwayHardForkEvent era,
ApplyTx era, NFData (Event (EraRule "ENACT" era)),
ToExpr (Event (EraRule "ENACT" era)),
Eq (Event (EraRule "ENACT" era)),
Typeable (Event (EraRule "ENACT" era)),
ToExpr (Event (EraRule "BBODY" era)),
EraPlutusTxInfo 'PlutusV2 era) =>
Spec
Imp.spec @era
String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"CostModels" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
forall era. (AlonzoEraPParams era, AlonzoEraScript era) => Spec
CostModelsSpec.spec @era
String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"TxWits" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
forall era.
(EraPlutusContext era, Arbitrary (NativeScript era)) =>
Spec
TxWitsSpec.spec @era
forall era. EraTx era => Spec
Regression.spec @era
String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"TxInfo" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
forall era.
(ConwayEraTest era, EraPlutusTxInfo 'PlutusV3 era,
TxCert era ~ ConwayTxCert era) =>
Spec
TxInfo.spec @era
forall era.
(EraTx era, BabbageEraTxBody era, Value era ~ MaryValue,
Inject (BabbageContextError era) (ContextError era),
EraPlutusTxInfo 'PlutusV1 era, EraPlutusTxInfo 'PlutusV2 era) =>
Spec
BabbageTxInfo.spec @era
String -> Spec -> Spec
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
xdescribe String
"PlutusV3" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
forall era (l :: Language).
(EraTx era, EraPlutusTxInfo l era, EraPlutusTxInfo 'PlutusV2 era,
BabbageEraTxBody era, Value era ~ MaryValue,
Inject (BabbageContextError era) (ContextError era)) =>
SLanguage l -> Spec
BabbageTxInfo.txInfoSpecV2 @era SLanguage 'PlutusV3
SPlutusV3