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

PlutusCore.Evaluation.Machine.MachineParameters.Default

Description

Defines the type of default machine parameters and a function for creating a value of the type. We keep them separate, because the function unfolds into multiple thousands of lines of Core that we need to be able to visually inspect, hence we dedicate a separate file to it.

Synopsis

Documentation

type DefaultMachineParameters = MachineParameters CekMachineCosts DefaultFun (CekValue DefaultUni DefaultFun ()) Source #

MachineParameters instantiated at CEK-machine-specific types and default builtins. Encompasses everything we need for evaluating a UPLC program with default builtins using the CEK machine.

mkMachineParametersForMonadError CostModelApplyError m ⇒ [BuiltinSemanticsVariant DefaultFun] → CostModelParams → m [(BuiltinSemanticsVariant DefaultFun, DefaultMachineParameters)] Source #

Produce a DefaultMachineParameters for each of the given semantics variants. The CostModelParams argument is used to update the costing parameters returned by cekCostModelForVariant for each of the semantics variants.

Whenever you need to evaluate UPLC in a performance-sensitive manner (e.g. in the production, for benchmarking, for cost calibration etc), you MUST use this definition for creating a DefaultMachineParameters and not any other. Changing this definition in absolutely any way, however trivial, requires running the benchmarks and making sure that the resulting GHC Core is still sensible. E.g. you switch the order of arguments -- you run the benchmarks and check the Core; you move this definition as-is to a different file -- you run the benchmarks and check the Core; you change how it's exported (implicitly as a part of a whole-module export or explicitly as a single definition) -- you get the idea.

This function is very expensive, so its result needs to be cached if it's going to be used multiple times.