plutus-core-1.34.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Evaluation.Machine.CostModelInterface

Synopsis

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.

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)

Instances

Instances details
Data CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Methods

gfoldl ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → CostModelApplyError → c CostModelApplyError Source #

gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c CostModelApplyError Source #

toConstrCostModelApplyErrorConstr Source #

dataTypeOfCostModelApplyErrorDataType Source #

dataCast1Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c CostModelApplyError) Source #

dataCast2Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c CostModelApplyError) Source #

gmapT ∷ (∀ b. Data b ⇒ b → b) → CostModelApplyErrorCostModelApplyError Source #

gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → CostModelApplyError → r Source #

gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → CostModelApplyError → r Source #

gmapQ ∷ (∀ d. Data d ⇒ d → u) → CostModelApplyError → [u] Source #

gmapQiInt → (∀ d. Data d ⇒ d → u) → CostModelApplyError → u Source #

gmapMMonad m ⇒ (∀ d. Data d ⇒ d → m d) → CostModelApplyError → m CostModelApplyError Source #

gmapMpMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → CostModelApplyError → m CostModelApplyError Source #

gmapMoMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → CostModelApplyError → m CostModelApplyError Source #

Exception CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Generic CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Associated Types

type Rep CostModelApplyErrorTypeType Source #

Show CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

NFData CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Methods

rnfCostModelApplyError → () Source #

Eq CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

NoThunks CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Pretty CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

type Rep CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

type Rep CostModelApplyError = D1 ('MetaData "CostModelApplyError" "PlutusCore.Evaluation.Machine.CostModelInterface" "plutus-core-1.34.0.0-inplace" 'False) (C1 ('MetaCons "CMUnknownParamError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "CMInternalReadError" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "CMInternalWriteError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String))))

data CostModelApplyWarn Source #

A non-fatal warning when trying to create a cost given some plain costmodel parameters.

Constructors

CMTooManyParamsWarn

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

Fields

CMTooFewParamsWarn

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

Fields

Instances

Instances details
Pretty CostModelApplyWarn Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface