{-# 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.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,
  utxoSpecWit,
  utxoStateSpec,
  vstateSpec,
 )
import Test.Cardano.Ledger.Constrained.Conway.PParams (pparamsSpec)
import Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse (GenScript (..), genWitUniv)
import Test.QuickCheck (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. GenScript era => Gen (PState era)
psX :: forall era. GenScript era => Gen (PState era)
psX = do
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv Int
25
  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) =>
WitUniv era -> Term fn EpochNo -> Specification fn (PState era)
pstateSpec WitUniv era
univ (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
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv Int
25
  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) PoolParams
pools <-
    forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(Map (KeyHash 'StakePool) PoolParams)
      (forall (fn :: Univ) t.
(HasSpec fn t, Sized fn 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 =>
WitUniv era
-> Term fn AccountState
-> Term fn (Map (KeyHash 'StakePool) PoolParams)
-> Specification fn (DState era)
dstateSpec @era WitUniv era
univ (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) PoolParams
pools))

vsX :: forall era. GenScript era => Gen (VState era)
vsX :: forall era. GenScript era => Gen (VState era)
vsX = do
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv Int
25
  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) (Set (Credential 'Staking))
delegatees <-
    Map (Credential 'Staking) DRep
-> Map (Credential 'DRepRole) (Set (Credential 'Staking))
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) DRep)
        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) =>
WitUniv era
-> Term fn EpochNo
-> Term fn (Map (Credential 'DRepRole) (Set (Credential 'Staking)))
-> Specification fn (VState era)
vstateSpec WitUniv era
univ (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) (Set (Credential 'Staking))
delegatees))

csX :: forall era. EraSpecLedger era ConwayFn => Gen (CertState era)
csX :: forall era. EraSpecLedger era ConwayFn => Gen (CertState era)
csX = do
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv Int
25
  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 @(CertState era)
    (forall era (fn :: Univ).
EraSpecLedger era fn =>
WitUniv era
-> Term fn AccountState
-> Term fn EpochNo
-> Specification fn (CertState era)
certStateSpec WitUniv era
univ (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
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv @era Int
50
  Map (Credential 'Staking) (KeyHash 'StakePool)
cs <-
    forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec
      @ConwayFn
      @(Map (Credential 'Staking) (KeyHash 'StakePool))
      (forall (fn :: Univ) t.
(HasSpec fn t, Sized fn 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).
EraSpecTxOut era fn =>
WitUniv era
-> Term fn (Map (Credential 'Staking) (KeyHash 'StakePool))
-> Specification fn (UTxO era)
utxoSpecWit @era WitUniv era
univ (forall a (fn :: Univ). Show a => a -> Term fn a
lit Map (Credential 'Staking) (KeyHash 'StakePool)
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
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv @era Int
50
  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
-> WitUniv era
-> Term fn (CertState era)
-> Specification fn (UTxOState era)
utxoStateSpec PParams era
pp WitUniv era
univ (forall a (fn :: Univ). Show a => a -> Term fn a
lit CertState era
certstate))

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

conwaygovX :: PParams ConwayEra -> Gen (ConwayGovState ConwayEra)
conwaygovX :: PParams ConwayEra -> Gen (ConwayGovState ConwayEra)
conwaygovX PParams ConwayEra
pp = do
  GovEnv ConwayEra
env <- forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(GovEnv ConwayEra) (forall (fn :: Univ).
IsConwayUniv fn =>
PParams ConwayEra -> Specification fn (GovEnv ConwayEra)
govEnvSpec PParams ConwayEra
pp)
  forall (fn :: Univ) a.
(HasCallStack, HasSpec fn a) =>
Specification fn a -> Gen a
genFromSpec @ConwayFn @(ConwayGovState ConwayEra) (forall (fn :: Univ).
EraSpecLedger ConwayEra fn =>
PParams ConwayEra
-> GovEnv ConwayEra -> Specification fn (ConwayGovState ConwayEra)
conwayGovStateSpec PParams ConwayEra
pp GovEnv ConwayEra
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
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv @era Int
50
  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
-> WitUniv era
-> Term fn AccountState
-> Term fn EpochNo
-> Specification fn (LedgerState era)
ledgerStateSpec PParams era
pp WitUniv era
univ (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
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv @era Int
50
  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
-> WitUniv era
-> Term fn EpochNo
-> Specification fn (EpochState era)
epochStateSpec PParams era
pp WitUniv era
univ (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 = do
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv @era Int
50
  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 -> WitUniv era -> Specification fn (NewEpochState era)
newEpochStateSpec PParams era
pp WitUniv era
univ)

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

snapsX :: forall era. EraSpecLedger era ConwayFn => PParams era -> Gen SnapShots
snapsX :: forall era.
EraSpecLedger era ConwayFn =>
PParams era -> Gen SnapShots
snapsX PParams era
pp = do
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv @era Int
50
  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
-> WitUniv era
-> Term fn AccountState
-> Term fn EpochNo
-> Specification fn (LedgerState era)
ledgerStateSpec PParams era
pp WitUniv era
univ (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 (forall (fn :: Univ).
IsConwayUniv fn =>
Term fn SnapShot -> Specification fn SnapShots
snapShotsSpec (forall a (fn :: Univ). Show a => a -> Term fn a
lit (forall era. LedgerState era -> SnapShot
getMarkSnapShot LedgerState era
ls)))

instanRewX :: forall era. EraSpecTxOut era ConwayFn => Gen InstantaneousRewards
instanRewX :: forall era. EraSpecTxOut era ConwayFn => Gen InstantaneousRewards
instanRewX = do
  WitUniv era
univ <- forall era.
(GenScript era, HasWitness ScriptHash era) =>
Int -> Gen (WitUniv era)
genWitUniv @era Int
50
  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
    (forall era (fn :: Univ).
EraSpecTxOut era fn =>
WitUniv era
-> Term fn AccountState -> Specification fn InstantaneousRewards
irewardSpec @era @ConwayFn WitUniv era
univ (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 (GenScript era, EraSpecPParams era) => WellFormed (PState era) era where
  wff :: Gen (PState era)
wff = forall era. GenScript era => Gen (PState era)
psX
  wffWithPP :: PParams era -> Gen (PState era)
wffWithPP PParams era
_ = forall era. GenScript 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 (GenScript era, EraSpecPParams era) => WellFormed (VState era) era where
  wff :: Gen (VState era)
wff = forall era. GenScript era => Gen (VState era)
vsX
  wffWithPP :: PParams era -> Gen (VState era)
wffWithPP PParams era
_ = forall era. GenScript 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 ConwayEra) ConwayEra where
  wffWithPP :: PParams ConwayEra -> Gen (GovEnv ConwayEra)
wffWithPP PParams ConwayEra
pp = PParams ConwayEra -> Gen (GovEnv ConwayEra)
govenvX PParams ConwayEra
pp

instance WellFormed (ConwayGovState ConwayEra) ConwayEra where
  wffWithPP :: PParams ConwayEra -> Gen (ConwayGovState ConwayEra)
wffWithPP PParams ConwayEra
pp = PParams ConwayEra -> Gen (ConwayGovState ConwayEra)
conwaygovX PParams ConwayEra
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 => WellFormed SnapShot era where
  wff :: Gen SnapShot
wff = Gen SnapShot
snapX

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

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