| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusCore.Evaluation.Machine.BuiltinCostModel
Synopsis
- type BuiltinCostModel = BuiltinCostModelBase CostingFun
- data BuiltinCostModelBase f = BuiltinCostModelBase {
- paramAddInteger :: f ModelTwoArguments
- paramSubtractInteger :: f ModelTwoArguments
- paramMultiplyInteger :: f ModelTwoArguments
- paramDivideInteger :: f ModelTwoArguments
- paramQuotientInteger :: f ModelTwoArguments
- paramRemainderInteger :: f ModelTwoArguments
- paramModInteger :: f ModelTwoArguments
- paramEqualsInteger :: f ModelTwoArguments
- paramLessThanInteger :: f ModelTwoArguments
- paramLessThanEqualsInteger :: f ModelTwoArguments
- paramAppendByteString :: f ModelTwoArguments
- paramConsByteString :: f ModelTwoArguments
- paramSliceByteString :: f ModelThreeArguments
- paramLengthOfByteString :: f ModelOneArgument
- paramIndexByteString :: f ModelTwoArguments
- paramEqualsByteString :: f ModelTwoArguments
- paramLessThanByteString :: f ModelTwoArguments
- paramLessThanEqualsByteString :: f ModelTwoArguments
- paramSha2_256 :: f ModelOneArgument
- paramSha3_256 :: f ModelOneArgument
- paramBlake2b_256 :: f ModelOneArgument
- paramVerifyEd25519Signature :: f ModelThreeArguments
- paramVerifyEcdsaSecp256k1Signature :: f ModelThreeArguments
- paramVerifySchnorrSecp256k1Signature :: f ModelThreeArguments
- paramAppendString :: f ModelTwoArguments
- paramEqualsString :: f ModelTwoArguments
- paramEncodeUtf8 :: f ModelOneArgument
- paramDecodeUtf8 :: f ModelOneArgument
- paramIfThenElse :: f ModelThreeArguments
- paramChooseUnit :: f ModelTwoArguments
- paramTrace :: f ModelTwoArguments
- paramFstPair :: f ModelOneArgument
- paramSndPair :: f ModelOneArgument
- paramChooseList :: f ModelThreeArguments
- paramMkCons :: f ModelTwoArguments
- paramHeadList :: f ModelOneArgument
- paramTailList :: f ModelOneArgument
- paramNullList :: f ModelOneArgument
- paramChooseData :: f ModelSixArguments
- paramConstrData :: f ModelTwoArguments
- paramMapData :: f ModelOneArgument
- paramListData :: f ModelOneArgument
- paramIData :: f ModelOneArgument
- paramBData :: f ModelOneArgument
- paramUnConstrData :: f ModelOneArgument
- paramUnMapData :: f ModelOneArgument
- paramUnListData :: f ModelOneArgument
- paramUnIData :: f ModelOneArgument
- paramUnBData :: f ModelOneArgument
- paramEqualsData :: f ModelTwoArguments
- paramMkPairData :: f ModelTwoArguments
- paramMkNilData :: f ModelOneArgument
- paramMkNilPairData :: f ModelOneArgument
- paramSerialiseData :: f ModelOneArgument
- paramBls12_381_G1_add :: f ModelTwoArguments
- paramBls12_381_G1_neg :: f ModelOneArgument
- paramBls12_381_G1_scalarMul :: f ModelTwoArguments
- paramBls12_381_G1_multiScalarMul :: f ModelTwoArguments
- paramBls12_381_G1_equal :: f ModelTwoArguments
- paramBls12_381_G1_compress :: f ModelOneArgument
- paramBls12_381_G1_uncompress :: f ModelOneArgument
- paramBls12_381_G1_hashToGroup :: f ModelTwoArguments
- paramBls12_381_G2_add :: f ModelTwoArguments
- paramBls12_381_G2_neg :: f ModelOneArgument
- paramBls12_381_G2_scalarMul :: f ModelTwoArguments
- paramBls12_381_G2_equal :: f ModelTwoArguments
- paramBls12_381_G2_multiScalarMul :: f ModelTwoArguments
- paramBls12_381_G2_compress :: f ModelOneArgument
- paramBls12_381_G2_uncompress :: f ModelOneArgument
- paramBls12_381_G2_hashToGroup :: f ModelTwoArguments
- paramBls12_381_millerLoop :: f ModelTwoArguments
- paramBls12_381_mulMlResult :: f ModelTwoArguments
- paramBls12_381_finalVerify :: f ModelTwoArguments
- paramKeccak_256 :: f ModelOneArgument
- paramBlake2b_224 :: f ModelOneArgument
- paramIntegerToByteString :: f ModelThreeArguments
- paramByteStringToInteger :: f ModelTwoArguments
- paramAndByteString :: f ModelThreeArguments
- paramOrByteString :: f ModelThreeArguments
- paramXorByteString :: f ModelThreeArguments
- paramComplementByteString :: f ModelOneArgument
- paramReadBit :: f ModelTwoArguments
- paramWriteBits :: f ModelThreeArguments
- paramReplicateByte :: f ModelTwoArguments
- paramShiftByteString :: f ModelTwoArguments
- paramRotateByteString :: f ModelTwoArguments
- paramCountSetBits :: f ModelOneArgument
- paramFindFirstSetBit :: f ModelOneArgument
- paramRipemd_160 :: f ModelOneArgument
- paramExpModInteger :: f ModelThreeArguments
- paramDropList :: f ModelTwoArguments
- paramLengthOfArray :: f ModelOneArgument
- paramListToArray :: f ModelOneArgument
- paramIndexArray :: f ModelTwoArguments
- paramLookupCoin :: f ModelThreeArguments
- paramValueContains :: f ModelTwoArguments
- paramValueData :: f ModelOneArgument
- paramUnValueData :: f ModelOneArgument
- paramInsertCoin :: f ModelFourArguments
- paramUnionValue :: f ModelTwoArguments
- paramScaleValue :: f ModelTwoArguments
- data CostingFun model = CostingFun {
- costingFunCpu :: model
- costingFunMemory :: model
- class UnimplementedCostingFun a where
- unimplementedCostingFun :: b -> CostingFun a
- newtype Intercept = Intercept {}
- newtype Slope = Slope {}
- newtype Coefficient0 = Coefficient0 {}
- newtype Coefficient1 = Coefficient1 {}
- newtype Coefficient2 = Coefficient2 {}
- newtype Coefficient00 = Coefficient00 {}
- newtype Coefficient10 = Coefficient10 {}
- newtype Coefficient01 = Coefficient01 {}
- newtype Coefficient20 = Coefficient20 {}
- newtype Coefficient11 = Coefficient11 {}
- newtype Coefficient02 = Coefficient02 {}
- newtype Coefficient12 = Coefficient12 {}
- data OneVariableLinearFunction = OneVariableLinearFunction {}
- data OneVariableQuadraticFunction = OneVariableQuadraticFunction {}
- data TwoVariableLinearFunction = TwoVariableLinearFunction {}
- data TwoVariableQuadraticFunction = TwoVariableQuadraticFunction {
- twoVariableQuadraticFunctionMinimum :: CostingInteger
- twoVariableQuadraticFunctionC00 :: Coefficient00
- twoVariableQuadraticFunctionC10 :: Coefficient10
- twoVariableQuadraticFunctionC01 :: Coefficient01
- twoVariableQuadraticFunctionC20 :: Coefficient20
- twoVariableQuadraticFunctionC11 :: Coefficient11
- twoVariableQuadraticFunctionC02 :: Coefficient02
- data TwoVariableWithInteractionFunction = TwoVariableWithInteractionFunction {}
- data ExpModCostingFunction = ExpModCostingFunction {}
- data ModelSubtractedSizes = ModelSubtractedSizes {}
- data ModelConstantOrOneArgument = ModelConstantOrOneArgument {}
- data ModelConstantOrTwoArguments = ModelConstantOrTwoArguments {}
- data ModelConstantOrLinear = ModelConstantOrLinear {}
- data ModelOneArgument
- data ModelTwoArguments
- = ModelTwoArgumentsConstantCost CostingInteger
- | ModelTwoArgumentsLinearInX OneVariableLinearFunction
- | ModelTwoArgumentsLinearInY OneVariableLinearFunction
- | ModelTwoArgumentsLinearInXAndY TwoVariableLinearFunction
- | ModelTwoArgumentsAddedSizes OneVariableLinearFunction
- | ModelTwoArgumentsSubtractedSizes ModelSubtractedSizes
- | ModelTwoArgumentsMultipliedSizes OneVariableLinearFunction
- | ModelTwoArgumentsMinSize OneVariableLinearFunction
- | ModelTwoArgumentsMaxSize OneVariableLinearFunction
- | ModelTwoArgumentsLinearOnDiagonal ModelConstantOrLinear
- | ModelTwoArgumentsConstOffDiagonal ModelConstantOrOneArgument
- | ModelTwoArgumentsConstAboveDiagonal ModelConstantOrTwoArguments
- | ModelTwoArgumentsConstBelowDiagonal ModelConstantOrTwoArguments
- | ModelTwoArgumentsQuadraticInY OneVariableQuadraticFunction
- | ModelTwoArgumentsQuadraticInXAndY TwoVariableQuadraticFunction
- | ModelTwoArgumentsWithInteractionInXAndY TwoVariableWithInteractionFunction
- data ModelThreeArguments
- = ModelThreeArgumentsConstantCost CostingInteger
- | ModelThreeArgumentsLinearInX OneVariableLinearFunction
- | ModelThreeArgumentsLinearInY OneVariableLinearFunction
- | ModelThreeArgumentsLinearInZ OneVariableLinearFunction
- | ModelThreeArgumentsQuadraticInZ OneVariableQuadraticFunction
- | ModelThreeArgumentsLiteralInYOrLinearInZ OneVariableLinearFunction
- | ModelThreeArgumentsLinearInMaxYZ OneVariableLinearFunction
- | ModelThreeArgumentsLinearInYAndZ TwoVariableLinearFunction
- | ModelThreeArgumentsQuadraticInYAndZ TwoVariableQuadraticFunction
- | ModelThreeArgumentsExpModCost ExpModCostingFunction
- data ModelFourArguments
- data ModelFiveArguments = ModelFiveArgumentsConstantCost CostingInteger
- data ModelSixArguments = ModelSixArgumentsConstantCost CostingInteger
- runCostingFunOneArgument :: ExMemoryUsage a1 => CostingFun ModelOneArgument -> a1 -> ExBudgetStream
- runCostingFunTwoArguments :: (ExMemoryUsage a1, ExMemoryUsage a2) => CostingFun ModelTwoArguments -> a1 -> a2 -> ExBudgetStream
- runCostingFunThreeArguments :: (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3) => CostingFun ModelThreeArguments -> a1 -> a2 -> a3 -> ExBudgetStream
- runCostingFunFourArguments :: (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4) => CostingFun ModelFourArguments -> a1 -> a2 -> a3 -> a4 -> ExBudgetStream
- runCostingFunFiveArguments :: (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4, ExMemoryUsage a5) => CostingFun ModelFiveArguments -> a1 -> a2 -> a3 -> a4 -> a5 -> ExBudgetStream
- runCostingFunSixArguments :: (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4, ExMemoryUsage a5, ExMemoryUsage a6) => CostingFun ModelSixArguments -> a1 -> a2 -> a3 -> a4 -> a5 -> a6 -> ExBudgetStream
- class Eq a => Hashable a
- newtype MCostingFun a = MCostingFun (Maybe (CostingFun a))
Documentation
data BuiltinCostModelBase f #
The main model which contains all data required to predict the cost of
builtin functions. See md for how this is
generated. Calibrated for the CEK machine.
Constructors
Instances
data CostingFun model #
A type of costing functions parametric over a model type. In practice the we have one model type `ModelNArguments` for every N, where N is the arity of the builtin whose costs we want to model. Each model type has a number of constructors defining different "shapes" of N-parameter functions which calculate a cost given the sizes of the builtin's arguments.
Constructors
| CostingFun | |
Fields
| |
Instances
class UnimplementedCostingFun a where #
In the initial stages of implementing a new builtin it is necessary to
provide a temporary costing function which is used until the builtin has been
properly costed: `see CostModelGeneration.md`. Each `ModelNArguments` type
defines an instance of this class where unimplementedCostingFun is a
constant costing function which returns a very high cost for all inputs.
This prevents new functions from being used in situations where costs are
important until a sensible costing function has been implemented.
Methods
unimplementedCostingFun :: b -> CostingFun a #
Instances
A wrapped CostingInteger that is supposed to be used as an intercept.
Constructors
| Intercept | |
Fields | |
Instances
| ToJSON Slope # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.JSON Methods toEncoding :: Slope -> Encoding toJSONList :: [Slope] -> Value toEncodingList :: [Slope] -> Encoding | |
| Generic Slope # | |
| Num Slope # | |
| Show Slope # | |
| NFData Slope # | |
| Eq Slope # | |
| Lift Slope # | |
| type Rep Slope # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.Core type Rep Slope = D1 ('MetaData "Slope" "PlutusCore.Evaluation.Machine.CostingFun.Core" "plutus-core-1.60.0.0-inplace" 'True) (C1 ('MetaCons "Slope" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSlope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CostingInteger))) | |
newtype Coefficient0 #
A wrapped CostingInteger that is supposed to be used as the degree 0
coefficient of a polynomial.
Constructors
| Coefficient0 | |
Fields | |
Instances
newtype Coefficient1 #
A wrapped CostingInteger that is supposed to be used as the degree 1
coefficient of a polynomial.
Constructors
| Coefficient1 | |
Fields | |
Instances
newtype Coefficient2 #
A wrapped CostingInteger that is supposed to be used as the degree 2
coefficient of a polynomial.
Constructors
| Coefficient2 | |
Fields | |
Instances
newtype Coefficient00 #
A wrapped CostingInteger that is supposed to be used as the degree (0,0)
coefficient of a two-variable polynomial.
Constructors
| Coefficient00 | |
Fields | |
Instances
newtype Coefficient10 #
A wrapped CostingInteger that is supposed to be used as the degree (1,0)
coefficient of a two-variable polynomial.
Constructors
| Coefficient10 | |
Fields | |
Instances
newtype Coefficient01 #
A wrapped CostingInteger that is supposed to be used as the degree (0,1)
coefficient of a two-variable polynomial.
Constructors
| Coefficient01 | |
Fields | |
Instances
newtype Coefficient20 #
A wrapped CostingInteger that is supposed to be used as the degree (2,0)
coefficient of a two-variable polynomial.
Constructors
| Coefficient20 | |
Fields | |
Instances
newtype Coefficient11 #
A wrapped CostingInteger that is supposed to be used as the degree (1,1)
coefficient of a two-variable polynomial.
Constructors
| Coefficient11 | |
Fields | |
Instances
newtype Coefficient02 #
A wrapped CostingInteger that is supposed to be used as the degree (0,2)
coefficient of a two-variable polynomial.
Constructors
| Coefficient02 | |
Fields | |
Instances
newtype Coefficient12 #
A wrapped CostingInteger that is supposed to be used as the degree (1,2)
coefficient of a two-variable polynomial.
Constructors
| Coefficient12 | |
Fields | |
Instances
data ExpModCostingFunction #
c00 + c01x*y + c12x*y^2
This is used only for expModInteger, whose costing is quite complex.
Constructors
| ExpModCostingFunction | |
Fields | |
Instances
| hashWithSalt.
If you are looking for Instances
newtype MCostingFun a # Same as Constructors
| ||||||||||||||||