Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type CostModelParams = Map Text Int64
- type CekMachineCosts = CekMachineCostsBase Identity
- extractCostModelParams :: (ToJSON machinecosts, ToJSON builtincosts) => CostModel machinecosts builtincosts -> Maybe CostModelParams
- applyCostModelParams :: (FromJSON evaluatorcosts, FromJSON builtincosts, ToJSON evaluatorcosts, ToJSON builtincosts, MonadError CostModelApplyError m) => CostModel evaluatorcosts builtincosts -> CostModelParams -> m (CostModel evaluatorcosts builtincosts)
- data CostModelApplyError
- data CostModelApplyWarn
- = CMTooManyParamsWarn {
- cmExpected :: !Int
- cmActual :: !Int
- | CMTooFewParamsWarn {
- cmExpected :: !Int
- cmActual :: !Int
- = CMTooManyParamsWarn {
Documentation
type CostModelParams = Map Text Int64 Source #
A raw representation of the ledger's cost model parameters.
The associated keys/names to the parameter values are arbitrarily set by the plutus team; the ledger does not hold any such names.
See Note [Cost model parameters]
type CekMachineCosts = CekMachineCostsBase Identity Source #
Costs for evaluating AST nodes. Times should be specified in picoseconds, memory sizes in bytes.
extractCostModelParams :: (ToJSON machinecosts, ToJSON builtincosts) => CostModel machinecosts builtincosts -> Maybe CostModelParams Source #
Given a CostModel, produce a single map containing the parameters from both components
applyCostModelParams :: (FromJSON evaluatorcosts, FromJSON builtincosts, ToJSON evaluatorcosts, ToJSON builtincosts, MonadError CostModelApplyError m) => CostModel evaluatorcosts builtincosts -> CostModelParams -> m (CostModel evaluatorcosts builtincosts) Source #
Update a CostModel for the CEK machine with a given set of parameters. Note that this is costly. See here. Callers are recommended to call this once and cache the results.
data CostModelApplyError Source #
A fatal error when trying to create a cost given some plain costmodel parameters.
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
data CostModelApplyWarn Source #
A non-fatal warning when trying to create a cost given some plain costmodel parameters.
CMTooManyParamsWarn | See Note [Cost model parameters from the ledger's point of view] |
| |
CMTooFewParamsWarn | See Note [Cost model parameters from the ledger's point of view] |
|
Instances
Pretty CostModelApplyWarn Source # | |
Defined in PlutusCore.Evaluation.Machine.CostModelInterface pretty :: CostModelApplyWarn -> Doc ann # prettyList :: [CostModelApplyWarn] -> Doc ann # |