content: {-# LANGUAGE AllowAmbiguousTypes #-}
  {-# LANGUAGE DataKinds #-}
  {-# LANGUAGE FlexibleContexts #-}
  {-# LANGUAGE ScopedTypeVariables #-}
  {-# LANGUAGE TypeApplications #-}
  {-# LANGUAGE TypeFamilies #-}
  {-# OPTIONS_GHC -Wno-orphans #-}
  
  module Test.Cardano.Ledger.Shelley.Binary.RoundTrip (
    roundTripShelleyCommonSpec,
    roundTripStateEraTypesSpec,
  ) where
  
  import Cardano.Ledger.Binary
  import Cardano.Ledger.Core
  import Cardano.Ledger.Shelley (ShelleyEra)
  import Cardano.Ledger.Shelley.LedgerState
  import Cardano.Ledger.Shelley.State
  import Test.Cardano.Ledger.Common
  import Test.Cardano.Ledger.Core.Binary.RoundTrip
  import Test.Cardano.Ledger.Shelley.Arbitrary ()
  import Test.Cardano.Ledger.Shelley.Binary.Annotator ()
  import Test.Cardano.Ledger.Shelley.Era (ShelleyEraTest)
  
  roundTripShelleyCommonSpec ::
    forall era.
    ( ShelleyEraTest era
    , RuleListEra era
    ) =>
    Spec
  roundTripShelleyCommonSpec = do
    roundTripCoreEraTypesSpec @era
    roundTripStateEraTypesSpec @era
    roundTripAllPredicateFailures @era
  
  roundTripStateEraTypesSpec ::
    forall era.
    ( EraTxOut era
    , EraGov era
    , EraStake era
    , EraCertState era
    , Eq (StashedAVVMAddresses era)
    , Show (StashedAVVMAddresses era)
    , EncCBOR (StashedAVVMAddresses era)
    , DecCBOR (StashedAVVMAddresses era)
    , Arbitrary (StashedAVVMAddresses era)
    , Arbitrary (TxOut era)
    , Arbitrary (Value era)
    , Arbitrary (PParams era)
    , Arbitrary (GovState era)
    , Arbitrary (CertState era)
    , Arbitrary (InstantStake era)
    ) =>
    Spec
  roundTripStateEraTypesSpec = do
    describe "State Types Families" $ do
      roundTripShareEraSpec @era @(GovState era)
    describe "State Types" $ do
      roundTripShareEraTypeSpec @era @UTxOState
      roundTripEraTypeSpec @era @EpochState
      roundTripEraTypeSpec @era @NewEpochState
  
  instance RuleListEra ShelleyEra where
    type
      EraRules ShelleyEra =
        '[ "DELEG"
         , "DELEGS"
         , "DELPL"
         , "LEDGER"
         , "LEDGERS"
         , "POOL"
         , "PPUP"
         , "UTXO"
         , "UTXOW"
         ]
  