Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data EvaluationContext
- mkEvaluationContext :: (MonadError CostModelApplyError m, MonadWriter [CostModelApplyWarn] m) => [Integer] -> m EvaluationContext
- type CostModelParams = Map Text Integer
- assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m ()
- machineParametersImmediate :: EvaluationContext -> DefaultMachineParameters
- machineParametersDeferred :: EvaluationContext -> DefaultMachineParameters
- toMachineParameters :: ProtocolVersion -> EvaluationContext -> DefaultMachineParameters
- data CostModelApplyError
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
Generic EvaluationContext Source # | |
Defined in PlutusLedgerApi.Common.Eval from :: EvaluationContext -> Rep EvaluationContext x Source # to :: Rep EvaluationContext x -> EvaluationContext Source # | |
NFData EvaluationContext Source # | |
Defined in PlutusLedgerApi.Common.Eval rnf :: EvaluationContext -> () Source # | |
NoThunks EvaluationContext Source # | |
Defined in PlutusLedgerApi.Common.Eval | |
type Rep EvaluationContext Source # | |
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.
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] |
|