{-# LANGUAGE TypeOperators #-}
module UntypedPlutusCore.Evaluation.Machine.SteppableCek
(
runCek
, runCekDeBruijn
, runCekNoEmit
, evaluateCek
, evaluateCekNoEmit
, EvaluationResult(..)
, splitStructuralOperational
, unsafeSplitStructuralOperational
, CekUserError(..)
, ErrorWithCause(..)
, CekEvaluationException
, EvaluationError(..)
, ExBudgetCategory(..)
, CekBudgetSpender(..)
, ExBudgetMode(..)
, StepKind(..)
, CekExTally(..)
, CountingSt (..)
, TallyingSt (..)
, RestrictingSt (..)
, CekMachineCosts
, counting
, tallying
, restricting
, restrictingEnormous
, enormousBudget
, noEmitter
, logEmitter
, logWithTimeEmitter
, logWithBudgetEmitter
, CekValue(..)
, readKnownCek
, Hashable
, ThrowableBuiltins
)
where
import UntypedPlutusCore.Core
import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts
import UntypedPlutusCore.Evaluation.Machine.Cek.EmitterMode
import UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode
import UntypedPlutusCore.Evaluation.Machine.CommonAPI qualified as Common
import UntypedPlutusCore.Evaluation.Machine.SteppableCek.Internal as S
import PlutusCore.Builtin
import PlutusCore.Evaluation.Machine.MachineParameters
import PlutusCore.Name.Unique
import Data.Text (Text)
runCek
:: ThrowableBuiltins uni fun
=> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> Term Name uni fun ann
-> (Either (CekEvaluationException Name uni fun) (Term Name uni fun ()), cost, [Text])
runCek :: forall (uni :: * -> *) fun ann cost.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
cost, [Text])
runCek = MachineRunner cost uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
cost, [Text])
forall cost (uni :: * -> *) fun ann.
MachineRunner cost uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
cost, [Text])
Common.runCek MachineRunner cost uni fun ann
forall (uni :: * -> *) fun ann cost.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> NTerm uni fun ann
-> (Either
(CekEvaluationException NamedDeBruijn uni fun) (NTerm uni fun ()),
cost, [Text])
S.runCekDeBruijn
runCekNoEmit
:: ThrowableBuiltins uni fun
=> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> Term Name uni fun ann
-> (Either (CekEvaluationException Name uni fun) (Term Name uni fun ()), cost)
runCekNoEmit :: forall (uni :: * -> *) fun ann cost.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
cost)
runCekNoEmit = MachineRunner cost uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
cost)
forall cost (uni :: * -> *) fun ann.
MachineRunner cost uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
cost)
Common.runCekNoEmit MachineRunner cost uni fun ann
forall (uni :: * -> *) fun ann cost.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> NTerm uni fun ann
-> (Either
(CekEvaluationException NamedDeBruijn uni fun) (NTerm uni fun ()),
cost, [Text])
S.runCekDeBruijn
evaluateCek
:: ThrowableBuiltins uni fun
=> EmitterMode uni fun
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> (Either (CekEvaluationException Name uni fun) (Term Name uni fun ()), [Text])
evaluateCek :: forall (uni :: * -> *) fun ann.
ThrowableBuiltins uni fun =>
EmitterMode uni fun
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
[Text])
evaluateCek = MachineRunner RestrictingSt uni fun ann
-> EmitterMode uni fun
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
[Text])
forall (uni :: * -> *) fun ann.
ThrowableBuiltins uni fun =>
MachineRunner RestrictingSt uni fun ann
-> EmitterMode uni fun
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> (Either
(CekEvaluationException Name uni fun) (Term Name uni fun ()),
[Text])
Common.evaluateCek MachineRunner RestrictingSt uni fun ann
forall (uni :: * -> *) fun ann cost.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> NTerm uni fun ann
-> (Either
(CekEvaluationException NamedDeBruijn uni fun) (NTerm uni fun ()),
cost, [Text])
S.runCekDeBruijn
evaluateCekNoEmit
:: ThrowableBuiltins uni fun
=> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either (CekEvaluationException Name uni fun) (Term Name uni fun ())
evaluateCekNoEmit :: forall (uni :: * -> *) fun ann.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either
(CekEvaluationException Name uni fun) (Term Name uni fun ())
evaluateCekNoEmit = MachineRunner RestrictingSt uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either
(CekEvaluationException Name uni fun) (Term Name uni fun ())
forall (uni :: * -> *) fun ann.
ThrowableBuiltins uni fun =>
MachineRunner RestrictingSt uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either
(CekEvaluationException Name uni fun) (Term Name uni fun ())
Common.evaluateCekNoEmit MachineRunner RestrictingSt uni fun ann
forall (uni :: * -> *) fun ann cost.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> NTerm uni fun ann
-> (Either
(CekEvaluationException NamedDeBruijn uni fun) (NTerm uni fun ()),
cost, [Text])
S.runCekDeBruijn
readKnownCek
:: (ThrowableBuiltins uni fun, ReadKnown (Term Name uni fun ()) a)
=> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either (CekEvaluationException Name uni fun) a
readKnownCek :: forall (uni :: * -> *) fun a ann.
(ThrowableBuiltins uni fun, ReadKnown (Term Name uni fun ()) a) =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either (CekEvaluationException Name uni fun) a
readKnownCek = MachineRunner RestrictingSt uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either (CekEvaluationException Name uni fun) a
forall (uni :: * -> *) fun a ann.
(ThrowableBuiltins uni fun, ReadKnown (Term Name uni fun ()) a) =>
MachineRunner RestrictingSt uni fun ann
-> MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> Term Name uni fun ann
-> Either (CekEvaluationException Name uni fun) a
Common.readKnownCek MachineRunner RestrictingSt uni fun ann
forall (uni :: * -> *) fun ann cost.
ThrowableBuiltins uni fun =>
MachineParameters CekMachineCosts fun (CekValue uni fun ann)
-> ExBudgetMode cost uni fun
-> EmitterMode uni fun
-> NTerm uni fun ann
-> (Either
(CekEvaluationException NamedDeBruijn uni fun) (NTerm uni fun ()),
cost, [Text])
S.runCekDeBruijn