Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
PlutusLedgerApi.V2.EvaluationContext
Synopsis
- data EvaluationContext
- mkEvaluationContext :: (MonadError CostModelApplyError m, MonadWriter [CostModelApplyWarn] m) => [Integer] -> m EvaluationContext
- type CostModelParams = Map Text Integer
- assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m ()
- toMachineParameters :: MajorProtocolVersion -> EvaluationContext -> DefaultMachineParameters
- data CostModelApplyError
- = CMUnknownParamError !Text
- | CMInternalReadError
- | CMInternalWriteError !String
- | CMTooFewParamsError {
- cmTooFewExpected :: !Int
- cmTooFewActual :: !Int
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 being recomputed on every evaluation.
Instances
Generic EvaluationContext Source # | |
Defined in PlutusLedgerApi.Common.Eval Methods from :: EvaluationContext -> Rep EvaluationContext x Source # to :: Rep EvaluationContext x -> EvaluationContext Source # | |
NFData EvaluationContext Source # | |
Defined in PlutusLedgerApi.Common.Eval Methods rnf :: EvaluationContext -> () Source # | |
NoThunks EvaluationContext Source # | |
Defined in PlutusLedgerApi.Common.Eval Methods noThunks :: Context -> EvaluationContext -> IO (Maybe ThunkInfo) wNoThunks :: Context -> EvaluationContext -> IO (Maybe ThunkInfo) | |
type Rep EvaluationContext Source # | |
Defined in PlutusLedgerApi.Common.Eval type Rep EvaluationContext = D1 ('MetaData "EvaluationContext" "PlutusLedgerApi.Common.Eval" "plutus-ledger-api-1.18.0.0-Arniy3OL4wy69RH7u4QMZP" 'True) (C1 ('MetaCons "EvaluationContext" 'PrefixI 'True) (S1 ('MetaSel ('Just "machineParameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DefaultMachineParameters))) |
Arguments
:: (MonadError CostModelApplyError m, MonadWriter [CostModelApplyWarn] m) | |
=> [Integer] | the (updated) cost model parameters of the protocol |
-> m EvaluationContext |
Build the EvaluationContext
.
The input is a list of cost model parameters (which are integer values) passed from the ledger.
IMPORTANT: the cost model parameters MUST appear in the correct order,
matching the names in ParamName
. If the parameters are
supplied in the wrong order then script cost calculations will be incorrect.
IMPORTANT: The evaluation context of every Plutus version must be recreated upon a protocol update with the updated cost model parameters.
type CostModelParams = Map Text Integer #
assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m () Source #
toMachineParameters :: MajorProtocolVersion -> EvaluationContext -> DefaultMachineParameters Source #
data CostModelApplyError #
Constructors
CMUnknownParamError !Text | |
CMInternalReadError | |
CMInternalWriteError !String | |
CMTooFewParamsError | |
Fields
|