cardano-ledger-shelley-test-1.6.0.0: Test helpers from cardano-ledger-shelley exposed to other packages
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cardano.Ledger.Shelley.Generator.ScriptClass

Synopsis

Documentation

data Quantifier t Source #

Constructors

AllOf [t] 
AnyOf [t] 
MOf Int [t] 
Leaf t 

Instances

Instances details
Functor Quantifier Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.Generator.ScriptClass

Methods

fmap ∷ (a → b) → Quantifier a → Quantifier b Source #

(<$) ∷ a → Quantifier b → Quantifier a Source #

anyOf ∷ ∀ era. ScriptClass era ⇒ Proxy era → [Script era] → Script era Source #

allOf ∷ ∀ era. ScriptClass era ⇒ Proxy era → [Script era] → Script era Source #

mOf ∷ ∀ era. ScriptClass era ⇒ Proxy era → Int → [Script era] → Script era Source #

keyPairsConstantsKeyPairs Source #

Constant list of KeyPairs intended to be used in the generators.

mkPayScriptHashMap ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → Map ScriptHash (Script era, Script era) Source #

mkStakeScriptHashMap ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → Map ScriptHash (Script era, Script era) Source #

Generate a mapping from stake script hash to script pair.

mkScripts ∷ ∀ era. ScriptClass era ⇒ KeyPairs → [(Script era, Script era)] Source #

make Scripts based on the given key pairs

mkScriptCombinations ∷ ∀ era. ScriptClass era ⇒ [(Script era, Script era)] → [(Script era, Script era)] Source #

Combine a list of script pairs into hierarchically structured multi-sig scripts, list must have at least length 3. Be careful not to call with too many pairs in order not to create too many of the possible combinations.

combinedScripts ∷ ∀ era. ScriptClass era ⇒ Constants → [(Script era, Script era)] Source #

Make a list of script pairs (payment,staking). Each of these are combined scripts. I.e. All, Any, MofN, etc. These come from combining the the first N (numBaseScripts) baseScripts When N==3, we get about 150 combined scripts.

baseScripts ∷ ∀ era. ScriptClass era ⇒ Constants → [(Script era, Script era)] Source #

Make list of script pairs (payment,staking). These are non-combined scripts Ie NO quantifer like All, Any, MofN, etc.) scripts. In post Shelley Eras, either Keylock or Require Start-Finish scripts.

scriptKeyCombinations ∷ ∀ era. ScriptClass era ⇒ Proxy era → Script era → [[KeyHash 'Witness]] Source #

Return all valid lists of KeyHashes that appear in a Script used in testing.

scriptKeyCombination ∷ ∀ era. ScriptClass era ⇒ Proxy era → Script era → [KeyHash 'Witness] Source #

Produce a valid list of key hashes that appear in a Script. Note: in the case of AnyOf, we just take the first script in the expression. This only works if we generate AnyOf scripts such that all script options are valid scripts (that is, valid in the context of a transaction, at generation time and execution/spend time).