Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type CostModelParams = Map Text Integer
- data CostModelApplyError
- data EvaluationContext
- toMachineParameters :: ProtocolVersion -> EvaluationContext -> DefaultMachineParameters
- mkEvaluationContext :: MonadError CostModelApplyError m => CostModelParams -> m EvaluationContext
- assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m ()
- costModelParamsForTesting :: CostModelParams
- evalCtxForTesting :: EvaluationContext
- costModelParamNames :: Set Text
Documentation
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) |
Instances
Show CostModelApplyError | |
|
|
Exception CostModelApplyError | |
Pretty CostModelApplyError | |
Defined in PlutusCore.Evaluation.Machine.CostModelInterface pretty :: CostModelApplyError -> Doc ann Source # prettyList :: [ CostModelApplyError ] -> Doc ann Source # |
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 Plutus.ApiCommon from :: EvaluationContext -> Rep EvaluationContext x Source # to :: Rep EvaluationContext x -> EvaluationContext Source # |
|
NFData EvaluationContext Source # | |
Defined in Plutus.ApiCommon rnf :: EvaluationContext -> () Source # |
|
NoThunks EvaluationContext Source # | |
Defined in Plutus.ApiCommon |
|
type Rep EvaluationContext Source # | |
Defined in Plutus.ApiCommon
type
Rep
EvaluationContext
=
D1
('
MetaData
"EvaluationContext" "Plutus.ApiCommon" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" '
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 => CostModelParams -> m EvaluationContext Source #
Build the
EvaluationContext
.
The input is a
Map
of strings to cost integer values (aka
CostModelParams
,
CostModel
)
See Note [Inlining meanings of builtins].
assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m () Source #
Comparably expensive to
mkEvaluationContext
, so it should only be used sparingly.
costModelParamsForTesting :: CostModelParams Source #
The raw cost model params, only to be used for testing purposes.
evalCtxForTesting :: EvaluationContext Source #
only to be for testing purposes: make an evaluation context by applying an empty set of protocol parameters
costModelParamNames :: Set Text Source #
The set of valid names that a cost model parameter can take for this language version.
It is used for the deserialization of
CostModelParams
.