plutus-core-1.36.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 :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CostModelApplyError -> c CostModelApplyError Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CostModelApplyError Source #

toConstr :: CostModelApplyError -> Constr Source #

dataTypeOf :: CostModelApplyError -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CostModelApplyError) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CostModelApplyError) Source #

gmapT :: (forall b. Data b => b -> b) -> CostModelApplyError -> CostModelApplyError Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CostModelApplyError -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CostModelApplyError -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CostModelApplyError -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CostModelApplyError -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CostModelApplyError -> m CostModelApplyError Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CostModelApplyError -> m CostModelApplyError Source #

gmapMo :: MonadPlus m => (forall 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 CostModelApplyError :: Type -> Type Source #

Show CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

NFData CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Eq CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

NoThunks CostModelApplyError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.CostModelInterface

Methods

noThunks :: Context -> CostModelApplyError -> IO (Maybe ThunkInfo)

wNoThunks :: Context -> CostModelApplyError -> IO (Maybe ThunkInfo)

showTypeOf :: Proxy CostModelApplyError -> String

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.36.0.0-7ehJj5tIPqoJIiiivXkX9N" 'False) (C1 ('MetaCons "CMUnknownParamError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "CMInternalReadError" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CMInternalWriteError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe 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