| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse
Contents
Synopsis
- genSigningKey ∷ Gen SigningKey
- genAddrPair ∷ Network → Gen (BootstrapAddress, SigningKey)
- class (Eq (ProofType hashtype era), EncCBOR (ProofType hashtype era), ToExpr (ProofType hashtype era), NFData (ProofType hashtype era), NFData hashtype, Eq hashtype) ⇒ HasWitness hashtype era where
- type ProofType hashtype era
- type WitnessType hashtype era
- type TypeHashed hashtype era
- hash ∷ TypeHashed hashtype era → hashtype
- mkWitness ∷ ProofType hashtype era → WitnessType hashtype era
- getTypeHashed ∷ ProofType hashtype era → TypeHashed hashtype era
- prettyHash ∷ hashtype → Doc
- data WitBlock t era where
- wbHash ∷ WitBlock t era → Set t
- wbMap ∷ WitBlock t era → Map t (ProofType t era)
- type BodyHash = SafeHash EraIndependentTxBody
- data WitUniv era = WitUniv {}
- explainWit ∷ String → WitUniv era → Specification t → Specification t
- witKeyHashSpec ∷ ∀ era (krole ∷ KeyRole). Typeable krole ⇒ WitUniv era → Specification (KeyHash krole)
- witScriptHashSpec ∷ WitUniv era → Specification ScriptHash
- witBootstrapAddress ∷ WitUniv era → Specification BootstrapAddress
- witCredSpec ∷ ∀ era (krole ∷ KeyRole). Typeable krole ⇒ WitUniv era → Specification (Credential krole)
- witDRepSpec ∷ WitUniv era → Specification DRep
- witRewardAccountSpec ∷ WitUniv era → Specification RewardAccount
- owners_ ∷ Term StakePoolParams → Term (Set (KeyHash 'Staking))
- witStakePoolParamsSpec ∷ WitUniv era → Specification StakePoolParams
- witPoolStateSpec ∷ WitUniv era → Specification StakePoolState
- witGenDelegPairSpec ∷ WitUniv era → Specification GenDelegPair
- witShelleyTxCert ∷ Era era ⇒ WitUniv era → Specification (ShelleyTxCert era)
- witConwayTxCert ∷ Era era ⇒ WitUniv era → Specification (ConwayTxCert era)
- witnessBootAddr ∷ EraTxWits era ⇒ BodyHash → BootstrapAddress → WitUniv era → TxWits era
- witnessKeyHash ∷ EraTxWits era ⇒ BodyHash → KeyHash 'Witness → WitUniv era → TxWits era
- witnessScriptHash ∷ EraTxWits era ⇒ ScriptHash → WitUniv era → TxWits era
- witnessDataHash ∷ AlonzoEraTxWits era ⇒ DataHash → WitUniv era → TxWits era
- blockFromProofList ∷ ∀ t era. (Era era, Ord t, HasWitness t era) ⇒ [ProofType t era] → WitBlock t era
- genWitBlock ∷ ∀ t era. (Era era, Ord t, HasWitness t era) ⇒ Int → Gen (ProofType t era) → Gen (WitBlock t era)
- genWitUniv ∷ (GenScript era, HasWitness ScriptHash era) ⇒ Int → Gen (WitUniv era)
- genNestedMultiSig ∷ ShelleyEraScript era ⇒ Int → Gen (NativeScript era)
- genNestedTimelock ∷ AllegraEraScript era ⇒ Int → Gen (NativeScript era)
- class Witnessed era t where
- class (EraTxCert era, HasSpec (TxCert era)) ⇒ EraSpecTxCert era where
- witTxCert ∷ WitUniv era → Specification (TxCert era)
- class (EraScript era, ToExpr (NativeScript era), NFData (Script era), ToExpr (Script era)) ⇒ GenScript era where
- spec1 ∷ WitUniv ShelleyEra → Specification (Set ScriptHash)
- go1 ∷ IO ()
- spec2 ∷ WitUniv ShelleyEra → Set ScriptHash → Specification (Set ScriptHash)
- go2 ∷ IO ()
- conwayWitUniv ∷ Int → WitUniv ConwayEra
- babbageWitUniv ∷ Int → WitUniv BabbageEra
- alonzoWitUniv ∷ Int → WitUniv AlonzoEra
- maryWitUniv ∷ Int → WitUniv MaryEra
- allegraWitUniv ∷ Int → WitUniv AllegraEra
- shelleyWitUniv ∷ Int → WitUniv ShelleyEra
- class EraUniverse era where
- eraWitUniv ∷ Int → WitUniv era
- govActionStateWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (GovActionState era)
- govActionWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (GovAction era)
- proposalProcedureWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (ProposalProcedure era)
- committeeWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (Committee era)
- go9 ∷ IO ()
Documentation
genSigningKey ∷ Gen SigningKey Source #
Turn a random bytestring into a SigningKey
genAddrPair ∷ Network → Gen (BootstrapAddress, SigningKey) Source #
Generate a pair, A Byron address, and the key that can sign it.
class (Eq (ProofType hashtype era), EncCBOR (ProofType hashtype era), ToExpr (ProofType hashtype era), NFData (ProofType hashtype era), NFData hashtype, Eq hashtype) ⇒ HasWitness hashtype era where Source #
Associated Types
type ProofType hashtype era Source #
type WitnessType hashtype era Source #
type TypeHashed hashtype era Source #
Methods
hash ∷ TypeHashed hashtype era → hashtype Source #
mkWitness ∷ ProofType hashtype era → WitnessType hashtype era Source #
getTypeHashed ∷ ProofType hashtype era → TypeHashed hashtype era Source #
prettyHash ∷ hashtype → Doc Source #
Instances
data WitBlock t era where Source #
A WitBlock is designed to have five purposes
1) To efficiently constrain objects to be witnessed when using constraint generators
the (Set hashtype) allows efficient constraints like :: (member_ t) (lit (wbHash witblock))
2) To efficiently compute witnesses from a hashtype
the (Map hashtype (ProofType hashtype era)) can be used like this
case Map.lookup hash (wbMap witblock) of
Just base -> mkWitness base
Nothing -> error "Missing hash. perhaps generator did not constrain the hash to be witnessed?"
3) When (HasWitness hashtype era) holds, the WitBlock can be computed from only [ProofType hashtype era]
using getTypeHashed. This makes Gen and CBOR instances, especially easy. We compute only with
[ProofType hashtype era] and then reconstruct the rest
4) WitBlock is a Monoid, so we can combine them easily
5) We can easily make (Gen (WitBlock t era)), so we can make them for testing.
Constructors
| WitBlock ∷ ∀ era t. (Era era, HasWitness t era) ⇒ Set t → Map t (ProofType t era) → WitBlock t era |
Instances
| Era era ⇒ EncCBOR (WitBlock t era) Source # | |
| NFData (WitBlock t era) Source # | |
| (Era era, Ord t, HasWitness t era) ⇒ Monoid (WitBlock t era) Source # | |
| Ord t ⇒ Semigroup (WitBlock t era) Source # | |
| (Show t, ToExpr t) ⇒ Show (WitBlock t era) Source # | when we print a WitBlock, we are only interested in the hashes, not the witnesses |
| Eq (WitBlock t era) Source # | |
| ToExpr t ⇒ ToExpr (WitBlock t era) Source # | |
type BodyHash = SafeHash EraIndependentTxBody Source #
Constructors
| WitUniv | |
Instances
| (HasWitness ScriptHash era, GenScript era) ⇒ Arbitrary (WitUniv era) Source # | |||||
| Era era ⇒ EncCBOR (WitUniv era) Source # | |||||
| NFData (WitUniv era) Source # | |||||
| (EraScript era, HasWitness ScriptHash era) ⇒ Monoid (WitUniv era) Source # | |||||
| Era era ⇒ Semigroup (WitUniv era) Source # | Easy to extend Monoid from WitBlock to WitUniv | ||||
| Generic (WitUniv era) Source # | |||||
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse Associated Types
| |||||
| Show (WitUniv era) Source # | |||||
| Eq (WitUniv era) Source # | |||||
| ToExpr (WitUniv era) Source # | |||||
| type Rep (WitUniv era) Source # | |||||
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse type Rep (WitUniv era) = D1 ('MetaData "WitUniv" "Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse" "cardano-ledger-test-9.9.9.9-inplace" 'False) (C1 ('MetaCons "WitUniv" 'PrefixI 'True) ((S1 ('MetaSel ('Just "wvSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "wvVKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WitBlock (KeyHash 'Witness) era))) :*: (S1 ('MetaSel ('Just "wvBoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WitBlock BootstrapAddress era)) :*: (S1 ('MetaSel ('Just "wvScript") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WitBlock ScriptHash era)) :*: S1 ('MetaSel ('Just "wvDats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WitBlock DataHash era)))))) | |||||
explainWit ∷ String → WitUniv era → Specification t → Specification t Source #
witKeyHashSpec ∷ ∀ era (krole ∷ KeyRole). Typeable krole ⇒ WitUniv era → Specification (KeyHash krole) Source #
witCredSpec ∷ ∀ era (krole ∷ KeyRole). Typeable krole ⇒ WitUniv era → Specification (Credential krole) Source #
witDRepSpec ∷ WitUniv era → Specification DRep Source #
witRewardAccountSpec ∷ WitUniv era → Specification RewardAccount Source #
Used only in Withdrawals, other RewardAccounts, not being withdrawn do not need witnessing
witShelleyTxCert ∷ Era era ⇒ WitUniv era → Specification (ShelleyTxCert era) Source #
Constrains all the Certificate Authors. Sometimes thay are keyHashes, and sometimes Credentials
witConwayTxCert ∷ Era era ⇒ WitUniv era → Specification (ConwayTxCert era) Source #
Constrains all the Certificate Authors. Sometimes thay are keyHashes, and sometimes Credentials
witnessBootAddr ∷ EraTxWits era ⇒ BodyHash → BootstrapAddress → WitUniv era → TxWits era Source #
witnessScriptHash ∷ EraTxWits era ⇒ ScriptHash → WitUniv era → TxWits era Source #
witnessDataHash ∷ AlonzoEraTxWits era ⇒ DataHash → WitUniv era → TxWits era Source #
blockFromProofList ∷ ∀ t era. (Era era, Ord t, HasWitness t era) ⇒ [ProofType t era] → WitBlock t era Source #
Reconstruct a (WitBlock t era) from only a [ProofType t era]
genWitBlock ∷ ∀ t era. (Era era, Ord t, HasWitness t era) ⇒ Int → Gen (ProofType t era) → Gen (WitBlock t era) Source #
genWitUniv ∷ (GenScript era, HasWitness ScriptHash era) ⇒ Int → Gen (WitUniv era) Source #
genNestedMultiSig ∷ ShelleyEraScript era ⇒ Int → Gen (NativeScript era) Source #
genNestedTimelock ∷ AllegraEraScript era ⇒ Int → Gen (NativeScript era) Source #
class Witnessed era t where Source #
The class of things we know how to witness. This way you don't have to remember long complicated names.
Instances
| Era era ⇒ Witnessed era BootstrapAddress Source # | |
| Era era ⇒ Witnessed era RewardAccount Source # | |
| Era era ⇒ Witnessed era DRep Source # | |
| Era era ⇒ Witnessed era GenDelegPair Source # | |
| Era era ⇒ Witnessed era ScriptHash Source # | |
| Era era ⇒ Witnessed era StakePoolParams Source # | |
| Era era ⇒ Witnessed era StakePoolState Source # | |
| EraSpecPParams era ⇒ Witnessed era (Committee era) Source # | |
| Era era ⇒ Witnessed era (ConwayAccountState era) Source # | |
| Era era ⇒ Witnessed era (ConwayAccounts era) Source # | |
| Era era ⇒ Witnessed era (ConwayTxCert era) Source # | |
| (Era era, Typeable r) ⇒ Witnessed era (Credential r) Source # | |
| (Era era, Typeable r) ⇒ Witnessed era (KeyHash r) Source # | |
| Era era ⇒ Witnessed era (ShelleyAccountState era) Source # | |
| Era era ⇒ Witnessed era (ShelleyTxCert era) Source # | |
| (Era era, HasSpec t, Witnessed era t, IsNormalType t) ⇒ Witnessed era (StrictMaybe t) Source # | |
| (Era era, HasSpec t, Ord t, Witnessed era t) ⇒ Witnessed era (Set t) Source # | |
| (Era era, HasSpec t, Witnessed era t, IsNormalType t) ⇒ Witnessed era (Maybe t) Source # | |
| (Era era, HasSpec t, Witnessed era t) ⇒ Witnessed era [t] Source # | |
| (Era era, HasSpec t, HasSpec v, IsNormalType t, IsNormalType v, Ord t, Witnessed era t) ⇒ Witnessed era (Map t v) Source # | |
class (EraTxCert era, HasSpec (TxCert era)) ⇒ EraSpecTxCert era where Source #
Parametric TxCert
Instances
| EraSpecTxCert AllegraEra Source # | |
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse Methods witTxCert ∷ WitUniv AllegraEra → Specification (TxCert AllegraEra) Source # | |
| EraSpecTxCert AlonzoEra Source # | |
| EraSpecTxCert BabbageEra Source # | |
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse Methods witTxCert ∷ WitUniv BabbageEra → Specification (TxCert BabbageEra) Source # | |
| EraSpecTxCert ConwayEra Source # | |
| EraSpecTxCert MaryEra Source # | |
| EraSpecTxCert ShelleyEra Source # | |
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse Methods witTxCert ∷ WitUniv ShelleyEra → Specification (TxCert ShelleyEra) Source # | |
class (EraScript era, ToExpr (NativeScript era), NFData (Script era), ToExpr (Script era)) ⇒ GenScript era where Source #
Parametric Script
Instances
| GenScript AllegraEra Source # | |
| GenScript AlonzoEra Source # | |
| GenScript BabbageEra Source # | |
| GenScript ConwayEra Source # | |
| GenScript MaryEra Source # | |
| GenScript ShelleyEra Source # | |
spec2 ∷ WitUniv ShelleyEra → Set ScriptHash → Specification (Set ScriptHash) Source #
class EraUniverse era where Source #
Methods
eraWitUniv ∷ Int → WitUniv era Source #
Instances
| EraUniverse AllegraEra Source # | |
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse Methods | |
| EraUniverse AlonzoEra Source # | |
| EraUniverse BabbageEra Source # | |
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse Methods | |
| EraUniverse ConwayEra Source # | |
| EraUniverse MaryEra Source # | |
| EraUniverse ShelleyEra Source # | |
Defined in Test.Cardano.Ledger.Constrained.Conway.WitnessUniverse Methods | |
govActionStateWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (GovActionState era) Source #
Constrains just the parts that need witnessing in GovActionState
govActionWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (GovAction era) Source #
Constrains just the parts that need witnessing in GovAction
proposalProcedureWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (ProposalProcedure era) Source #
Constrains just the parts that need witnessing in ProposalProcedure
committeeWitness ∷ EraSpecPParams era ⇒ WitUniv era → Specification (Committee era) Source #
Constrains just the parts that need witnessing in Committee
Orphan instances
| ToExpr SigningKey Source # | |||||||||
| Era era ⇒ HasSpec (TxDats era) Source # | |||||||||
Associated Types
Methods emptySpec ∷ TypeSpec (TxDats era) Source # combineSpec ∷ TypeSpec (TxDats era) → TypeSpec (TxDats era) → Specification (TxDats era) Source # genFromTypeSpec ∷ ∀ (m ∷ Type → Type). (HasCallStack, MonadGenError m) ⇒ TypeSpec (TxDats era) → GenT m (TxDats era) Source # conformsTo ∷ TxDats era → TypeSpec (TxDats era) → Bool Source # shrinkWithTypeSpec ∷ TypeSpec (TxDats era) → TxDats era → [TxDats era] Source # fixupWithTypeSpec ∷ TypeSpec (TxDats era) → TxDats era → Maybe (TxDats era) Source # toPreds ∷ Term (TxDats era) → TypeSpec (TxDats era) → Pred Source # cardinalTypeSpec ∷ TypeSpec (TxDats era) → Specification Integer Source # cardinalTrueSpec ∷ Specification Integer Source # typeSpecHasError ∷ TypeSpec (TxDats era) → Maybe (NonEmpty String) Source # alternateShow ∷ TypeSpec (TxDats era) → BinaryShow Source # typeSpecOpt ∷ TypeSpec (TxDats era) → [TxDats era] → Specification (TxDats era) Source # guardTypeSpec ∷ [String] → TypeSpec (TxDats era) → Specification (TxDats era) Source # prerequisites ∷ Evidence (Prerequisites (TxDats era)) Source # | |||||||||
| (ShelleyEraScript era, NativeScript era ~ MultiSig era) ⇒ HasSpec (MultiSig era) Source # | |||||||||
Associated Types
Methods emptySpec ∷ TypeSpec (MultiSig era) Source # combineSpec ∷ TypeSpec (MultiSig era) → TypeSpec (MultiSig era) → Specification (MultiSig era) Source # genFromTypeSpec ∷ ∀ (m ∷ Type → Type). (HasCallStack, MonadGenError m) ⇒ TypeSpec (MultiSig era) → GenT m (MultiSig era) Source # conformsTo ∷ MultiSig era → TypeSpec (MultiSig era) → Bool Source # shrinkWithTypeSpec ∷ TypeSpec (MultiSig era) → MultiSig era → [MultiSig era] Source # fixupWithTypeSpec ∷ TypeSpec (MultiSig era) → MultiSig era → Maybe (MultiSig era) Source # toPreds ∷ Term (MultiSig era) → TypeSpec (MultiSig era) → Pred Source # cardinalTypeSpec ∷ TypeSpec (MultiSig era) → Specification Integer Source # cardinalTrueSpec ∷ Specification Integer Source # typeSpecHasError ∷ TypeSpec (MultiSig era) → Maybe (NonEmpty String) Source # alternateShow ∷ TypeSpec (MultiSig era) → BinaryShow Source # typeSpecOpt ∷ TypeSpec (MultiSig era) → [MultiSig era] → Specification (MultiSig era) Source # guardTypeSpec ∷ [String] → TypeSpec (MultiSig era) → Specification (MultiSig era) Source # prerequisites ∷ Evidence (Prerequisites (MultiSig era)) Source # | |||||||||
| AlonzoEraScript era ⇒ HasSimpleRep (Redeemers era) Source # | |||||||||
Associated Types
| |||||||||
| Era era ⇒ HasSimpleRep (TxDats era) Source # | |||||||||