{-# LANGUAGE TypeApplications #-}
module Test.Cardano.Ledger.Alonzo.BinarySpec (spec) where
import Cardano.Ledger.Alonzo
import Cardano.Ledger.Alonzo.Genesis
import Cardano.Ledger.Alonzo.TxWits (Redeemers, TxDats)
import Test.Cardano.Ledger.Alonzo.Arbitrary ()
import Test.Cardano.Ledger.Alonzo.Binary.RoundTrip (roundTripAlonzoCommonSpec)
import Test.Cardano.Ledger.Alonzo.TreeDiff ()
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Core.Binary (BinaryUpgradeOpts (..), specUpgrade)
import Test.Cardano.Ledger.Core.Binary as Binary (
decoderEquivalenceCoreEraTypesSpec,
decoderEquivalenceEraSpec,
txSizeSpec,
)
import Test.Cardano.Ledger.Core.Binary.RoundTrip (roundTripEraSpec)
spec :: Spec
spec :: Spec
spec = do
forall era.
(Arbitrary (TxOut (PreviousEra era)),
Arbitrary (TxCert (PreviousEra era)),
Arbitrary (TxAuxData (PreviousEra era)),
Arbitrary (TxWits (PreviousEra era)),
Arbitrary (TxBody (PreviousEra era)), EraTx (PreviousEra era),
EraTx era, Arbitrary (Tx (PreviousEra era)),
Arbitrary (Script (PreviousEra era)), HasCallStack,
ToExpr (Tx era), ToExpr (TxBody era), ToExpr (TxWits era),
ToExpr (TxAuxData era), DecCBOR (TxAuxData era),
DecCBOR (Script era), DecCBOR (TxWits era), DecCBOR (TxBody era),
DecCBOR (Tx era)) =>
BinaryUpgradeOpts -> Spec
specUpgrade @AlonzoEra (Bool -> Bool -> BinaryUpgradeOpts
BinaryUpgradeOpts Bool
False Bool
False)
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"RoundTrip" forall a b. (a -> b) -> a -> b
$ do
forall era.
(EraTx era, EraGov era, EraStake era, EraCertState era,
AlonzoEraScript era, StashedAVVMAddresses era ~ (),
Arbitrary (Tx era), Arbitrary (TxBody era), Arbitrary (TxOut era),
Arbitrary (TxCert era), Arbitrary (TxWits era),
Arbitrary (TxAuxData era), Arbitrary (Value era),
Arbitrary (CompactForm (Value era)), Arbitrary (Script era),
Arbitrary (GovState era), Arbitrary (PlutusPurpose AsIx era),
Arbitrary (PParams era), Arbitrary (PParamsUpdate era),
Arbitrary (CertState era), Arbitrary (InstantStake era),
DecCBOR (Script era), DecCBOR (TxAuxData era),
DecCBOR (TxWits era), DecCBOR (TxBody era), DecCBOR (Tx era),
RuleListEra era) =>
Spec
roundTripAlonzoCommonSpec @AlonzoEra
forall era t.
(Era era, Show t, Eq t, EncCBOR t, DecCBOR t, Arbitrary t,
HasCallStack) =>
Spec
roundTripEraSpec @AlonzoEra @AlonzoGenesis
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"DecCBOR instances equivalence" forall a b. (a -> b) -> a -> b
$ do
forall era.
(EraTx era, Arbitrary (Tx era), Arbitrary (TxBody era),
Arbitrary (TxWits era), Arbitrary (TxAuxData era),
Arbitrary (Script era), HasCallStack) =>
Spec
Binary.decoderEquivalenceCoreEraTypesSpec @AlonzoEra
forall era t.
(Era era, Eq t, ToCBOR t, DecCBOR (Annotator t), Arbitrary t,
Show t) =>
Spec
decoderEquivalenceEraSpec @AlonzoEra @(TxDats AlonzoEra)
forall era t.
(Era era, Eq t, ToCBOR t, DecCBOR (Annotator t), Arbitrary t,
Show t) =>
Spec
decoderEquivalenceEraSpec @AlonzoEra @(Redeemers AlonzoEra)
forall era.
(EraTx era, Arbitrary (Tx era), SafeToHash (TxWits era)) =>
Spec
Binary.txSizeSpec @AlonzoEra