plutus-ledger-api-1.0.0.0.0.0.0.0.1: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusLedgerApi.V3.EvaluationContext

Synopsis

Documentation

data EvaluationContext Source #

An opaque type that contains all the static parameters that the evaluator needs to evaluate a script. This is so that they can be computed once and cached, rather than recomputed on every evaluation.

There are two sets of parameters: one is with immediate unlifting and the other one is with deferred unlifting. We have to keep both of them, because depending on the language version either one has to be used or the other. We also compile them separately due to all the inlining and optimization that need to happen for things to be efficient.

Instances

Instances details
Generic EvaluationContext Source # 
Instance details

Defined in PlutusLedgerApi.Common.Eval

Associated Types

type Rep EvaluationContext :: Type -> Type Source #

NFData EvaluationContext Source # 
Instance details

Defined in PlutusLedgerApi.Common.Eval

Methods

rnf :: EvaluationContext -> () Source #

NoThunks EvaluationContext Source # 
Instance details

Defined in PlutusLedgerApi.Common.Eval

type Rep EvaluationContext Source # 
Instance details

Defined in PlutusLedgerApi.Common.Eval

type Rep EvaluationContext = D1 ('MetaData "EvaluationContext" "PlutusLedgerApi.Common.Eval" "plutus-ledger-api-1.0.0.0.0.0.0.0.1-62zX2BmwjkDFan4zfGhQ4n" 'False) (C1 ('MetaCons "EvaluationContext" 'PrefixI 'True) (S1 ('MetaSel ('Just "machineParametersImmediate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 DefaultMachineParameters) :*: S1 ('MetaSel ('Just "machineParametersDeferred") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 DefaultMachineParameters)))

mkEvaluationContext :: (MonadError CostModelApplyError m, MonadWriter [CostModelApplyWarn] m) => [Integer] -> m EvaluationContext Source #

Build the EvaluationContext.

The input is a list of integer values passed from the ledger and are expected to appear in correct order.

assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m () Source #

Comparably expensive to mkEvaluationContext, so it should only be used sparingly.

data CostModelApplyError Source #

The type of errors that applyParams can throw.

Constructors

CMUnknownParamError Text

a costmodel parameter with the give name does not exist in the costmodel to be applied upon

CMInternalReadError

internal error when we are transforming the applyParams' input to json (should not happen)

CMInternalWriteError String

internal error when we are transforming the applied params from json with given jsonstring error (should not happen)

CMTooFewParamsError

See Note [Cost model parameters from the ledger's point of view]