{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}

#if __GLASGOW_HASKELL__ < 900
{-# OPTIONS_GHC -O0 #-}
#endif

module Test.Cardano.Ledger.Constrained.Conway.LedgerTypes.WellFormed where

import Cardano.Ledger.Api
import Cardano.Ledger.BaseTypes hiding (inject)
import Cardano.Ledger.CertState
import Cardano.Ledger.Conway.Rules (GovEnv (..))
import Cardano.Ledger.Credential (Credential)
import Cardano.Ledger.EpochBoundary (SnapShot (..), SnapShots (..))
import Cardano.Ledger.Keys (KeyHash, KeyRole (..))
import Cardano.Ledger.PoolParams (PoolParams (..))
import Cardano.Ledger.SafeHash ()
import Cardano.Ledger.Shelley.LedgerState
import Cardano.Ledger.UTxO (UTxO (..))
import Constrained hiding (Value)
import Data.Map (Map)
import Test.Cardano.Ledger.Constrained.Conway ()
import Test.Cardano.Ledger.Constrained.Conway.Instances
import Test.Cardano.Ledger.Constrained.Conway.LedgerTypes.Specs (
  EraSpecLedger (..),
  accountStateSpec,
  aggregateDRep,
  certStateSpec,
  conwayGovStateSpec,
  dstateSpec,
  epochNoSpec,
  epochStateSpec,
  getMarkSnapShot,
  govEnvSpec,
  ledgerStateSpec,
  pstateSpec,
  shelleyGovStateSpec,
  snapShotSpec,
  snapShotsSpec,
  utxoSpec,
  utxoStateSpec,
  vstateSpec,
 )
import Test.Cardano.Ledger.Constrained.Conway.PParams (pparamsSpec)
import Test.QuickCheck (Arbitrary (..), Gen)

-- ==============================================================
-- Generators for all the types found in the Ledger State.
-- ==============================================================

ppX :: forall era. EraSpecPParams era => Gen (PParams era)
ppX :: forall era. EraSpecPParams era => Gen (PParams era)
ppX = forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(PParams era) forall (fn :: Univ) era.
(EraSpecPParams era, BaseUniverse fn) =>
Specification fn (PParams era)
pparamsSpec

acctX :: Gen AccountState
acctX :: Gen AccountState
acctX = forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @AccountState forall (fn :: Univ).
IsConwayUniv fn =>
Specification fn AccountState
accountStateSpec

psX :: forall era. EraSpecPParams era => Gen (PState era)
psX :: forall era. EraSpecPParams era => Gen (PState era)
psX = do
  EpochNo
epoch <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @EpochNo forall (fn :: Univ). IsConwayUniv fn => Specification fn EpochNo
epochNoSpec
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(PState era) (forall (fn :: Univ) era.
(IsConwayUniv fn, Era era) =>
Term fn EpochNo -> Specification fn (PState era)
pstateSpec (forall a (fn :: Univ). Show a => a -> Term fn a
lit EpochNo
epoch))

dsX :: forall era. EraSpecLedger era ConwayFn => Gen (DState era)
dsX :: forall era. EraSpecLedger era ConwayFn => Gen (DState era)
dsX = do
  AccountState
acct <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @AccountState forall (fn :: Univ).
IsConwayUniv fn =>
Specification fn AccountState
accountStateSpec
  Map (KeyHash 'StakePool StandardCrypto) (PoolParams StandardCrypto)
pools <-
    forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(Map (KeyHash 'StakePool (EraCrypto era)) (PoolParams (EraCrypto era)))
      (forall (fn :: Univ) t.
(HasSpec fn t, Sized t) =>
SizeSpec fn -> Specification fn t
hasSize (forall (fn :: Univ). Integer -> Integer -> SizeSpec fn
rangeSize Integer
8 Integer
8))
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(DState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
Term fn AccountState
-> Term
     fn
     (Map
        (KeyHash 'StakePool (EraCrypto era)) (PoolParams (EraCrypto era)))
-> Specification fn (DState era)
dstateSpec (forall a (fn :: Univ). Show a => a -> Term fn a
lit AccountState
acct) (forall a (fn :: Univ). Show a => a -> Term fn a
lit Map (KeyHash 'StakePool StandardCrypto) (PoolParams StandardCrypto)
pools))

vsX :: forall era. EraSpecPParams era => Gen (VState era)
vsX :: forall era. EraSpecPParams era => Gen (VState era)
vsX = do
  EpochNo
epoch <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @EpochNo forall (fn :: Univ). IsConwayUniv fn => Specification fn EpochNo
epochNoSpec
  Map
  (Credential 'DRepRole StandardCrypto)
  (Set (Credential 'Staking StandardCrypto))
delegatees <-
    forall c.
Map (Credential 'Staking c) (DRep c)
-> Map (Credential 'DRepRole c) (Set (Credential 'Staking c))
aggregateDRep
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn -- ensures that each credential delegates to exactly one DRep
        @(Map (Credential 'Staking (EraCrypto era)) (DRep (EraCrypto era)))
        forall (fn :: Univ) a. Specification fn a
TrueSpec
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(VState era) (forall (fn :: Univ) era.
(IsConwayUniv fn, Era era) =>
Term fn EpochNo
-> Term
     fn
     (Map
        (Credential 'DRepRole (EraCrypto era))
        (Set (Credential 'Staking (EraCrypto era))))
-> Specification fn (VState era)
vstateSpec (forall a (fn :: Univ). Show a => a -> Term fn a
lit EpochNo
epoch) (forall a (fn :: Univ). Show a => a -> Term fn a
lit Map
  (Credential 'DRepRole StandardCrypto)
  (Set (Credential 'Staking StandardCrypto))
delegatees))

csX :: forall era. EraSpecLedger era ConwayFn => Gen (CertState era)
csX :: forall era. EraSpecLedger era ConwayFn => Gen (CertState era)
csX = do
  AccountState
acct <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @AccountState forall (fn :: Univ).
IsConwayUniv fn =>
Specification fn AccountState
accountStateSpec
  EpochNo
epoch <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @EpochNo forall (fn :: Univ). IsConwayUniv fn => Specification fn EpochNo
epochNoSpec
  Set (Credential 'DRepRole StandardCrypto)
delegatees <- forall a. Arbitrary a => Gen a
arbitrary
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(CertState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
Term fn (Set (Credential 'DRepRole (EraCrypto era)))
-> Term fn AccountState
-> Term fn EpochNo
-> Specification fn (CertState era)
certStateSpec (forall a (fn :: Univ). Show a => a -> Term fn a
lit Set (Credential 'DRepRole StandardCrypto)
delegatees) (forall a (fn :: Univ). Show a => a -> Term fn a
lit AccountState
acct) (forall a (fn :: Univ). Show a => a -> Term fn a
lit EpochNo
epoch))

utxoX :: forall era. EraSpecLedger era ConwayFn => Gen (UTxO era)
utxoX :: forall era. EraSpecLedger era ConwayFn => Gen (UTxO era)
utxoX = do
  Map
  (Credential 'Staking StandardCrypto)
  (KeyHash 'StakePool StandardCrypto)
cs <-
    forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec
      @ConwayFn
      @(Map (Credential 'Staking StandardCrypto) (KeyHash 'StakePool StandardCrypto))
      (forall (fn :: Univ) t.
(HasSpec fn t, Sized t) =>
SizeSpec fn -> Specification fn t
hasSize (forall (fn :: Univ). Integer -> Integer -> SizeSpec fn
rangeSize Integer
30 Integer
30))
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(UTxO era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
Term
  fn
  (Map
     (Credential 'Staking (EraCrypto era))
     (KeyHash 'StakePool (EraCrypto era)))
-> Specification fn (UTxO era)
utxoSpec @era (forall a (fn :: Univ). Show a => a -> Term fn a
lit Map
  (Credential 'Staking StandardCrypto)
  (KeyHash 'StakePool StandardCrypto)
cs))

utxostateX :: forall era. EraSpecLedger era ConwayFn => PParams era -> Gen (UTxOState era)
utxostateX :: forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (UTxOState era)
utxostateX PParams era
pp = do
  CertState era
certstate <- forall era. EraSpecLedger era ConwayFn => Gen (CertState era)
csX @era
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(UTxOState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
PParams era
-> Term fn (CertState era) -> Specification fn (UTxOState era)
utxoStateSpec PParams era
pp (forall a (fn :: Univ). Show a => a -> Term fn a
lit CertState era
certstate))

govenvX :: PParams Conway -> Gen (GovEnv Conway)
govenvX :: PParams Conway -> Gen (GovEnv Conway)
govenvX PParams Conway
pp = forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(GovEnv Conway) (forall (fn :: Univ).
IsConwayUniv fn =>
PParams Conway -> Specification fn (GovEnv Conway)
govEnvSpec PParams Conway
pp)

conwaygovX :: PParams Conway -> Gen (ConwayGovState Conway)
conwaygovX :: PParams Conway -> Gen (ConwayGovState Conway)
conwaygovX PParams Conway
pp = do
  GovEnv Conway
env <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(GovEnv Conway) (forall (fn :: Univ).
IsConwayUniv fn =>
PParams Conway -> Specification fn (GovEnv Conway)
govEnvSpec PParams Conway
pp)
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(ConwayGovState Conway) (forall (fn :: Univ).
EraSpecLedger Conway fn =>
PParams Conway
-> GovEnv Conway -> Specification fn (ConwayGovState Conway)
conwayGovStateSpec PParams Conway
pp GovEnv Conway
env)

lsX :: forall era. EraSpecLedger era ConwayFn => PParams era -> Gen (LedgerState era)
lsX :: forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (LedgerState era)
lsX PParams era
pp = do
  AccountState
acct <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @AccountState forall (fn :: Univ).
IsConwayUniv fn =>
Specification fn AccountState
accountStateSpec
  EpochNo
epoch <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @EpochNo forall (fn :: Univ). IsConwayUniv fn => Specification fn EpochNo
epochNoSpec
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(LedgerState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
PParams era
-> Term fn AccountState
-> Term fn EpochNo
-> Specification fn (LedgerState era)
ledgerStateSpec PParams era
pp (forall a (fn :: Univ). Show a => a -> Term fn a
lit AccountState
acct) (forall a (fn :: Univ). Show a => a -> Term fn a
lit EpochNo
epoch))

esX :: forall era. EraSpecLedger era ConwayFn => PParams era -> Gen (EpochState era)
esX :: forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (EpochState era)
esX PParams era
pp = do
  EpochNo
epoch <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @EpochNo forall (fn :: Univ). IsConwayUniv fn => Specification fn EpochNo
epochNoSpec
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(EpochState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
PParams era -> Term fn EpochNo -> Specification fn (EpochState era)
epochStateSpec PParams era
pp (forall a (fn :: Univ). Show a => a -> Term fn a
lit EpochNo
epoch))

nesX :: forall era. EraSpecLedger era ConwayFn => PParams era -> Gen (NewEpochState era)
nesX :: forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (NewEpochState era)
nesX PParams era
pp = forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(NewEpochState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
PParams era -> Specification fn (NewEpochState era)
newEpochStateSpec PParams era
pp)

snapX :: forall era. Era era => Gen (SnapShot (EraCrypto era))
snapX :: forall era. Era era => Gen (SnapShot (EraCrypto era))
snapX = forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(SnapShot (EraCrypto era)) forall c (fn :: Univ).
(Crypto c, IsConwayUniv fn) =>
Specification fn (SnapShot c)
snapShotSpec

snapsX :: forall era. EraSpecLedger era ConwayFn => PParams era -> Gen (SnapShots (EraCrypto era))
snapsX :: forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (SnapShots (EraCrypto era))
snapsX PParams era
pp = do
  AccountState
acct <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @AccountState forall (fn :: Univ).
IsConwayUniv fn =>
Specification fn AccountState
accountStateSpec
  EpochNo
epoch <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @EpochNo forall (fn :: Univ). IsConwayUniv fn => Specification fn EpochNo
epochNoSpec
  LedgerState era
ls <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(LedgerState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
PParams era
-> Term fn AccountState
-> Term fn EpochNo
-> Specification fn (LedgerState era)
ledgerStateSpec PParams era
pp (forall a (fn :: Univ). Show a => a -> Term fn a
lit AccountState
acct) (forall a (fn :: Univ). Show a => a -> Term fn a
lit EpochNo
epoch))
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(SnapShots (EraCrypto era)) (forall c (fn :: Univ).
(Crypto c, IsConwayUniv fn) =>
Term fn (SnapShot c) -> Specification fn (SnapShots c)
snapShotsSpec (forall a (fn :: Univ). Show a => a -> Term fn a
lit (forall era. LedgerState era -> SnapShot (EraCrypto era)
getMarkSnapShot LedgerState era
ls)))

instanRewX :: forall era. EraSpecTxOut era ConwayFn => Gen (InstantaneousRewards (EraCrypto era))
instanRewX :: forall era.
EraSpecTxOut era ConwayFn =>
Gen (InstantaneousRewards (EraCrypto era))
instanRewX = do
  AccountState
acct <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @AccountState forall (fn :: Univ).
IsConwayUniv fn =>
Specification fn AccountState
accountStateSpec
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(InstantaneousRewards (EraCrypto era))
    (forall era (fn :: Univ).
EraSpecTxOut era fn =>
Term fn AccountState
-> Specification fn (InstantaneousRewards (EraCrypto era))
irewardSpec @era @ConwayFn (forall a (fn :: Univ). Show a => a -> Term fn a
lit AccountState
acct))

-- ==============================================================
-- The WellFormed class
-- ==============================================================

class (EraSpecPParams era, HasSpec ConwayFn t) => WellFormed t era where
  -- \| Well formed with PParams as input
  wffWithPP :: PParams era -> Gen t
  wffWithPP PParams era
_ = forall t era. WellFormed t era => Gen t
wff @t @era

  -- \| Generate a constrained PParams if one is needed
  wff :: Gen t
  wff = do
    PParams era
pp <- forall era. EraSpecPParams era => Gen (PParams era)
ppX @era
    forall t era. WellFormed t era => PParams era -> Gen t
wffWithPP PParams era
pp

-- ==============================================================
-- The WellFormed instances
-- ==============================================================

instance EraSpecPParams era => WellFormed (PParams era) era where
  wff :: Gen (PParams era)
wff = forall era. EraSpecPParams era => Gen (PParams era)
ppX @era
  wffWithPP :: PParams era -> Gen (PParams era)
wffWithPP PParams era
p = forall (f :: * -> *) a. Applicative f => a -> f a
pure PParams era
p

instance EraSpecPParams era => WellFormed AccountState era where
  wff :: Gen AccountState
wff = Gen AccountState
acctX
  wffWithPP :: PParams era -> Gen AccountState
wffWithPP PParams era
_ = Gen AccountState
acctX

instance EraSpecPParams era => WellFormed (PState era) era where
  wff :: Gen (PState era)
wff = forall era. EraSpecPParams era => Gen (PState era)
psX
  wffWithPP :: PParams era -> Gen (PState era)
wffWithPP PParams era
_ = forall era. EraSpecPParams era => Gen (PState era)
psX

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (DState era) era where
  wff :: Gen (DState era)
wff = forall era. EraSpecLedger era ConwayFn => Gen (DState era)
dsX
  wffWithPP :: PParams era -> Gen (DState era)
wffWithPP PParams era
_ = forall era. EraSpecLedger era ConwayFn => Gen (DState era)
dsX

instance EraSpecPParams era => WellFormed (VState era) era where
  wff :: Gen (VState era)
wff = forall era. EraSpecPParams era => Gen (VState era)
vsX
  wffWithPP :: PParams era -> Gen (VState era)
wffWithPP PParams era
_ = forall era. EraSpecPParams era => Gen (VState era)
vsX

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (CertState era) era where
  wff :: Gen (CertState era)
wff = forall era. EraSpecLedger era ConwayFn => Gen (CertState era)
csX

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (UTxO era) era where
  wff :: Gen (UTxO era)
wff = forall era. EraSpecLedger era ConwayFn => Gen (UTxO era)
utxoX

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (UTxOState era) era where
  wffWithPP :: PParams era -> Gen (UTxOState era)
wffWithPP = forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (UTxOState era)
utxostateX

instance WellFormed (GovEnv Conway) Conway where
  wffWithPP :: PParams Conway -> Gen (GovEnv Conway)
wffWithPP PParams Conway
pp = PParams Conway -> Gen (GovEnv Conway)
govenvX PParams Conway
pp

instance WellFormed (ConwayGovState Conway) Conway where
  wffWithPP :: PParams Conway -> Gen (ConwayGovState Conway)
wffWithPP PParams Conway
pp = PParams Conway -> Gen (ConwayGovState Conway)
conwaygovX PParams Conway
pp

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (ShelleyGovState era) era where
  wffWithPP :: PParams era -> Gen (ShelleyGovState era)
wffWithPP PParams era
pp = forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(ShelleyGovState era) (forall era (fn :: Univ).
EraSpecLedger era fn =>
PParams era -> Specification fn (ShelleyGovState era)
shelleyGovStateSpec PParams era
pp)

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (LedgerState era) era where
  wffWithPP :: PParams era -> Gen (LedgerState era)
wffWithPP = forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (LedgerState era)
lsX

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (EpochState era) era where
  wffWithPP :: PParams era -> Gen (EpochState era)
wffWithPP = forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (EpochState era)
esX

instance (EraSpecPParams era, EraSpecLedger era ConwayFn) => WellFormed (NewEpochState era) era where
  wffWithPP :: PParams era -> Gen (NewEpochState era)
wffWithPP = forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (NewEpochState era)
nesX

instance (EraSpecPParams era, c ~ EraCrypto era) => WellFormed (SnapShot c) era where
  wff :: Gen (SnapShot c)
wff = forall era. Era era => Gen (SnapShot (EraCrypto era))
snapX @era

instance (EraSpecPParams era, EraSpecLedger era ConwayFn, c ~ EraCrypto era) => WellFormed (SnapShots c) era where
  wffWithPP :: PParams era -> Gen (SnapShots c)
wffWithPP = forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen (SnapShots (EraCrypto era))
snapsX @era

instance
  (EraSpecPParams era, c ~ EraCrypto era, EraSpecTxOut era ConwayFn) =>
  WellFormed (InstantaneousRewards c) era
  where
  wff :: Gen (InstantaneousRewards c)
wff = forall era.
EraSpecTxOut era ConwayFn =>
Gen (InstantaneousRewards (EraCrypto era))
instanRewX @era