Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- quantifyTL ∷ AllegraEraScript era ⇒ NativeScript era → Quantifier (NativeScript era)
- unQuantifyTL ∷ AllegraEraScript era ⇒ Quantifier (NativeScript era) → NativeScript era
- someLeaf ∷ ∀ era. (AllegraEraScript era, NativeScript era ~ Timelock era) ⇒ KeyHash 'Witness → NativeScript era
- genValidityInterval ∷ SlotNo → Gen ValidityInterval
Documentation
quantifyTL ∷ AllegraEraScript era ⇒ NativeScript era → Quantifier (NativeScript era) Source #
unQuantifyTL ∷ AllegraEraScript era ⇒ Quantifier (NativeScript era) → NativeScript era Source #
someLeaf ∷ ∀ era. (AllegraEraScript era, NativeScript era ~ Timelock era) ⇒ KeyHash 'Witness → NativeScript era Source #
Generate some Leaf Timelock (i.e. a Signature or TimeStart or TimeExpire).
Because we don't know how these "leaf scripts" will be situated in larger scripts
(e.g. the script generated here might form part of a RequireAll
or RequireMOf
script)
we must make sure that all timelocks generated here are valid for all slots.
To achieve this we arrange the timelock scripts like so: RequireAnyOf [ RequireAllOf [RequireTimeExpire k, RequireSignature x], RequireAllOf [RequireTimeStart k, RequireSignature x] ] where k is arbitrary. This means that regardless of slot, there will be a valid sub-branch of script.
genValidityInterval ∷ SlotNo → Gen ValidityInterval Source #
Generates a trivial validity interval that is valid for the current slot.
Note: the validity interval must be a subset of all timelock script intervals that apply to the transaction. This depends on which generated scripts are actually required to validate the transaction (which is itself not always deterministic, e.g. 'RequireMOf n scripts').
A more sophisticated generator would compute which set of scripts would validate the transaction, and from that compute a minimal ValidityInterval that fits into all timelock slot ranges.