Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- 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 → PDoc
- 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 fn t → Specification fn t
- witKeyHashSpec ∷ ∀ fn era krole. (IsConwayUniv fn, Typeable krole) ⇒ WitUniv era → Specification fn (KeyHash krole)
- witScriptHashSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn ScriptHash
- witBootstrapAddress ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn BootstrapAddress
- witCredSpec ∷ ∀ fn era krole. (IsConwayUniv fn, Typeable krole) ⇒ WitUniv era → Specification fn (Credential krole)
- witDRepSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn DRep
- witRewardAccountSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn RewardAccount
- owners_ ∷ IsConwayUniv fn ⇒ Term fn PoolParams → Term fn (Set (KeyHash 'Staking))
- witPoolParamsSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn PoolParams
- witGenDelegPairSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn GenDelegPair
- witShelleyTxCert ∷ ∀ fn era. (Era era, IsConwayUniv fn) ⇒ WitUniv era → Specification fn (ShelleyTxCert era)
- witConwayTxCert ∷ ∀ fn era. (Era era, IsConwayUniv fn) ⇒ WitUniv era → Specification fn (ConwayTxCert era)
- witnessBootAddr ∷ ∀ era. Reflect era ⇒ BodyHash → BootstrapAddress → WitUniv era → TxWits era
- witnessKeyHash ∷ ∀ era. Reflect era ⇒ BodyHash → KeyHash 'Witness → WitUniv era → TxWits era
- witnessScriptHash ∷ ∀ era. EraTxWits era ⇒ ScriptHash → WitUniv era → TxWits era
- witnessDataHash ∷ ∀ era. 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 ∷ ∀ era. (GenScript era, HasWitness ScriptHash era) ⇒ Int → Gen (WitUniv era)
- genNestedMultiSig ∷ ∀ era. ShelleyEraScript era ⇒ Int → Gen (NativeScript era)
- genNestedTimelock ∷ ∀ era. AllegraEraScript era ⇒ Int → Gen (NativeScript era)
- class Witnessed fn era t where
- class (EraTxCert era, HasSpec fn (TxCert era)) ⇒ EraSpecTxCert fn era where
- witTxCert ∷ WitUniv era → Specification fn (TxCert era)
- class (Reflect era, ToExpr (NativeScript era), NFData (Script era), ToExpr (Script era)) ⇒ GenScript era where
- spec1 ∷ WitUniv ShelleyEra → Specification ConwayFn (Set ScriptHash)
- go1 ∷ IO ()
- spec2 ∷ WitUniv ShelleyEra → Set ScriptHash → Specification ConwayFn (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 ∷ ∀ fn era. (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (GovActionState era)
- govActionWitness ∷ ∀ fn era. (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (GovAction era)
- proposalProcedureWitness ∷ ∀ fn era. (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (ProposalProcedure era)
- committeeWitness ∷ (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (Committee era)
- go9 ∷ IO ()
Documentation
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 #
type ProofType hashtype era Source #
type WitnessType hashtype era Source #
type TypeHashed hashtype era Source #
hash ∷ TypeHashed hashtype era → hashtype Source #
mkWitness ∷ ProofType hashtype era → WitnessType hashtype era Source #
getTypeHashed ∷ ProofType hashtype era → TypeHashed hashtype era Source #
prettyHash ∷ hashtype → PDoc 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.
Instances
(Era era, Ord t, HasWitness t era) ⇒ Monoid (WitBlock t era) Source # | |
Ord t ⇒ Semigroup (WitBlock t era) Source # | |
Show (WitBlock t era) Source # | |
(Era era, Typeable t) ⇒ EncCBOR (WitBlock t era) Source # | |
PrettyA (WitBlock t era) Source # | when we print a WitBlock, we are only interested in the hashes, not the witnesses |
NFData (WitBlock t era) Source # | |
Eq (WitBlock t era) Source # | |
ToExpr t ⇒ ToExpr (WitBlock t era) Source # | |
type BodyHash = SafeHash EraIndependentTxBody Source #
Instances
explainWit ∷ String → WitUniv era → Specification fn t → Specification fn t Source #
witKeyHashSpec ∷ ∀ fn era krole. (IsConwayUniv fn, Typeable krole) ⇒ WitUniv era → Specification fn (KeyHash krole) Source #
witScriptHashSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn ScriptHash Source #
witBootstrapAddress ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn BootstrapAddress Source #
witCredSpec ∷ ∀ fn era krole. (IsConwayUniv fn, Typeable krole) ⇒ WitUniv era → Specification fn (Credential krole) Source #
witDRepSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn DRep Source #
witRewardAccountSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn RewardAccount Source #
Used only in Withdrawals, other RewardAccounts, not being withdrawn do not need witnessing
owners_ ∷ IsConwayUniv fn ⇒ Term fn PoolParams → Term fn (Set (KeyHash 'Staking)) Source #
witPoolParamsSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn PoolParams Source #
witGenDelegPairSpec ∷ ∀ fn era. IsConwayUniv fn ⇒ WitUniv era → Specification fn GenDelegPair Source #
witShelleyTxCert ∷ ∀ fn era. (Era era, IsConwayUniv fn) ⇒ WitUniv era → Specification fn (ShelleyTxCert era) Source #
Constrains all the Certificate Authors. Sometimes thay are keyHashes, and sometimes Credentials
witConwayTxCert ∷ ∀ fn era. (Era era, IsConwayUniv fn) ⇒ WitUniv era → Specification fn (ConwayTxCert era) Source #
Constrains all the Certificate Authors. Sometimes thay are keyHashes, and sometimes Credentials
witnessBootAddr ∷ ∀ era. Reflect era ⇒ BodyHash → BootstrapAddress → WitUniv era → TxWits era Source #
witnessKeyHash ∷ ∀ era. Reflect era ⇒ BodyHash → KeyHash 'Witness → WitUniv era → TxWits era Source #
witnessScriptHash ∷ ∀ era. EraTxWits era ⇒ ScriptHash → WitUniv era → TxWits era Source #
witnessDataHash ∷ ∀ era. 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 ∷ ∀ era. (GenScript era, HasWitness ScriptHash era) ⇒ Int → Gen (WitUniv era) Source #
genNestedMultiSig ∷ ∀ era. ShelleyEraScript era ⇒ Int → Gen (NativeScript era) Source #
genNestedTimelock ∷ ∀ era. AllegraEraScript era ⇒ Int → Gen (NativeScript era) Source #
class Witnessed fn 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
class (EraTxCert era, HasSpec fn (TxCert era)) ⇒ EraSpecTxCert fn era where Source #
Parametric TxCert
Instances
IsConwayUniv fn ⇒ EraSpecTxCert fn AllegraEra Source # | |
IsConwayUniv fn ⇒ EraSpecTxCert fn AlonzoEra Source # | |
IsConwayUniv fn ⇒ EraSpecTxCert fn BabbageEra Source # | |
IsConwayUniv fn ⇒ EraSpecTxCert fn ConwayEra Source # | |
IsConwayUniv fn ⇒ EraSpecTxCert fn MaryEra Source # | |
IsConwayUniv fn ⇒ EraSpecTxCert fn ShelleyEra Source # | |
class (Reflect era, ToExpr (NativeScript era), NFData (Script era), ToExpr (Script era)) ⇒ GenScript era where Source #
Parametric Script
class EraUniverse era where Source #
eraWitUniv ∷ Int → WitUniv era Source #
govActionStateWitness ∷ ∀ fn era. (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (GovActionState era) Source #
Constrains just the parts that need witnessing in GovActionState
govActionWitness ∷ ∀ fn era. (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (GovAction era) Source #
Constrains just the parts that need witnessing in GovAction
proposalProcedureWitness ∷ ∀ fn era. (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (ProposalProcedure era) Source #
Constrains just the parts that need witnessing in ProposalProcedure
committeeWitness ∷ (IsConwayUniv fn, EraSpecPParams era) ⇒ WitUniv era → Specification fn (Committee era) Source #
Constrains just the parts that need witnessing in Committee